Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audit mybatis xml panic when xml file content no contained "otherwise" label in "choose" lable. #639

Closed
sjjian opened this issue Jun 30, 2022 · 5 comments
Assignees
Labels
bug Something isn't working verified the issue all pr is verified
Milestone

Comments

@sjjian
Copy link
Member

sjjian commented Jun 30, 2022

SQLe Version
main

Describe the bug
audit mybatis xml panic when xml file content no contained "otherwise" label in "choose" lable. 审核mybatis xml 文件程序panic。

<mapper namespace="Test">
    <select id="testChoose">
        SELECT
        name,
        category,
        price
        FROM
        fruits
        <where>
            <choose>
                <when test="name != null">
                    AND name = #{name}
                </when>
                <when test="category == 'banana'">
                    AND category = #{category}
                    <if test="price != null and price !=''">
                        AND price = ${price}
                    </if>
                </when>
            </choose>
        </where>
    </select>
</mapper>

image

To Reproduce

  1. 通过审核界面的提交Mybatis XML文件进行审核,内容参考描述
  2. 点击审核报错未知错误,如描述截图

Expected behavior
能正常审核

@sjjian sjjian added the bug Something isn't working label Jun 30, 2022
@sjjian sjjian added this to the v1.2206.0 milestone Jun 30, 2022
@sjjian sjjian self-assigned this Jun 30, 2022
@sjjian
Copy link
Member Author

sjjian commented Jun 30, 2022

原因

mybatis 解析库在处理choose标签内无otherwise 时未作判空处理,导致空指针

@sjjian sjjian closed this as completed in 104f975 Jun 30, 2022
sjjian added a commit that referenced this issue Jun 30, 2022
@Marcus9530
Copy link
Collaborator

UI Version: release-1.2205.x b4c6fc1
Server Version: release-1.2205.x-ee ac7e75f
复现步骤:
1.使用上述的内容创建一个xml文件
2.创建一个工单,然后上传文件,点击审核,出现请求错误信息
3.创建审核任务,配置gitlab+jenkins流水线,触发变更也可以看到jenkins控制台输出了panic信息

image
image

@Marcus9530
Copy link
Collaborator

UI Version: main 614a04c
Server Version: main-ee 26c6848faa
验证步骤
1.1.使用上面的内容创建一个xml文件
2.创建一个工单,然后上传文件,点击审核,未出现报错
3.配置 gitlab+jeins 流水线,配置 gitlab+jeins 流水线,也可以查看 jenkins 的控制台输出,未发现panic信息

image
image

@Marcus9530 Marcus9530 added the verified the issue all pr is verified label Jul 1, 2022
@JianleiZhang
Copy link

建议mybatis-mapper-2-sql打个新tag吧,默认引入的tag是v0.1.0。刚刚准备提merge request,发现已经修复这个Bug了…

@sjjian
Copy link
Member Author

sjjian commented Sep 13, 2022

@JianleiZhang good idea

LordofAvernus pushed a commit that referenced this issue Nov 6, 2023
skip license check when logout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working verified the issue all pr is verified
Projects
None yet
Development

No branches or pull requests

3 participants