sqle icon indicating copy to clipboard operation
sqle copied to clipboard

在用mybatisscanner进行mybatis文件批量审核的时候,如果部分文件审核有异常,希望可以跳过继续往下审核而不是退出

Open itachihqzhu opened this issue 3 years ago • 0 comments

SQLe Version

Version: "main fb1fd7a8fb08746d14f43d9cd1f2db461d821811" Describe the bug

在使用scanner对mybatis多个文件进行批量审核时,扫描出现异常,直接退出了。报错如下所示: INFO[0000] scanner started...
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9bd476]

goroutine 35 [running]: github.com/actiontech/mybatis-mapper-2-sql/ast.(*OtherwiseNode).GetStmt(...) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/dynamic.go:126 github.com/actiontech/mybatis-mapper-2-sql/ast.(*ChooseNode).GetStmt(0xc0004f38a0, 0xc000286920, 0x36, 0x36, 0x0, 0x0) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/dynamic.go:71 +0xf6 github.com/actiontech/mybatis-mapper-2-sql/ast.(*TrimNode).GetStmt(0xc00011e3c0, 0xc000286920, 0x2fc, 0x2fc, 0x0, 0x0) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/dynamic.go:171 +0x426 github.com/actiontech/mybatis-mapper-2-sql/ast.(*QueryNode).GetStmt(0xc0007cd890, 0xc000286920, 0x7f48692675b8, 0x30, 0xc00012bb30, 0x20) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/query.go:36 +0xb6 github.com/actiontech/mybatis-mapper-2-sql/ast.(*Mapper).GetStmt(0xc0007c8100, 0xc000286920, 0x10572b0, 0xc0007c8100, 0x0, 0x0) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/ast/mapper.go:57 +0xe5 github.com/actiontech/mybatis-mapper-2-sql.ParseXML(0xc0002e6000, 0x5f04, 0xc0002e6000, 0x5f04, 0x0, 0x0) /universe/vendor/github.com/actiontech/mybatis-mapper-2-sql/parser.go:21 +0x134 github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/mybatis.GetSQLFromFile(0xc0003ca050, 0x44, 0x2, 0xc0003ca050, 0x44, 0xb, 0x53) /universe/sqle/cmd/scannerd/scanners/mybatis/mybatis.go:155 +0x67 github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/mybatis.GetSQLFromPath(0xc0000442a0, 0x2c, 0x2, 0xc0000442a0, 0x2c, 0x0, 0x0) /universe/sqle/cmd/scannerd/scanners/mybatis/mybatis.go:139 +0x48e github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/mybatis.GetSQLFromPath(0x7ffc586c345b, 0x25, 0x0, 0x0, 0x0, 0x0, 0x0) /universe/sqle/cmd/scannerd/scanners/mybatis/mybatis.go:137 +0x1dd github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/mybatis.(*MyBatis).Run(0xc0004f62a0, 0x105b4b8, 0xc0000823c0, 0x0, 0x0) /universe/sqle/cmd/scannerd/scanners/mybatis/mybatis.go:50 +0x3c github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/supervisor.Start.func1(0x1057400, 0xc0004f62a0, 0x105b4b8, 0xc0000823c0, 0xc0001825a0) /universe/sqle/cmd/scannerd/scanners/supervisor/supervisor.go:18 +0x45 created by github.com/actiontech/sqle/sqle/cmd/scannerd/scanners/supervisor.Start /universe/sqle/cmd/scannerd/scanners/supervisor/supervisor.go:17 +0xfe To Reproduce

Expected behavior

希望在对多个mybatis文件扫描的时候,如果单个文件审核有异常,不要退出扫描,可以跳过该文件继续对下一个文件进行扫描,这样对于有审核结果的mybatis文件可以有扫描结果。

Suggestion

itachihqzhu avatar Jun 30 '22 05:06 itachihqzhu