Skip to content

Commit

Permalink
Merge pull request #792 from didebughu/main
Browse files Browse the repository at this point in the history
🐛 Handle xml file parsing exception
  • Loading branch information
cyw3 authored Mar 13, 2023
2 parents 29944b1 + 7143aee commit c182600
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions client/tool/util/tscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from util.pathlib import PathMgr
from task.scmmgr import SCMMgr
from util.subprocc import SubProcController

from util.exceptions import AnalyzeTaskError

class Tscan(CodeLintModel):
def analyze(self, params, tc_home, bin_name, want_suffix):
Expand Down Expand Up @@ -66,7 +66,10 @@ def analyze(self, params, tc_home, bin_name, want_suffix):

def _format_issue(self, output_file):
issues = []
result_tree = ET.parse(output_file)
try:
result_tree = ET.parse(output_file)
except ET.ParseError:
raise AnalyzeTaskError("源文件编码格式错误,建议启用WrongEncoding规则检测源文件编码格式")
root = result_tree.getroot()
for error in root:
error_attr = error.attrib
Expand Down

0 comments on commit c182600

Please sign in to comment.