Skip to content

Commit

Permalink
Merge pull request #72 from firewave/column-fix
Browse files Browse the repository at this point in the history
Fixed NullPointerException with Cppcheck < 1.89 caused by missing 'column' attribute in XML result
  • Loading branch information
firewave authored Jan 25, 2022
2 parents 8586656 + 28a94d4 commit 6bec888
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ Deployment.

## Releases

### X.X.X - Unreleased
### 1.6.2 - 2022-01-25

- Fixed `NullPointerException` with Cppcheck < 1.89 caused by missing `column` attribute in XML result.

### 1.6.1 - 2022-01-14

- Fixed missing `commons-lang3` dependency.
- Fixed `.idea` project provided by repository.

### 1.6.0 - 2021-12-26

Expand Down
11 changes: 2 additions & 9 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.github.johnthagen.cppcheck</id>
<name>cppcheck</name>
<version>1.6.1</version>
<version>1.6.2</version>
<vendor email="[email protected]" url="http://github.com/johnthagen">johnthagen</vendor>

<description><![CDATA[
Expand Down Expand Up @@ -60,14 +60,7 @@
]]></description>

<change-notes><![CDATA[
- Parse --xml output instead of text output. (Contribution by @firewave)<br/>
- Fixed scanning of files with whitespaces in name. (Contribution by @firewave)
- Only scan files which actually exist. (Contribution by @firewave)
- Use unique file names for temporary files used for analysis. (Contribution by @firewave)
- Properly handle "debug" messages generated by --debug-warnings. (Contribution by @firewave)
- Added .cl, .hxx, .tpp and .txx to list of supported file extensions - now matches the ones supported by Cppcheck internally. (Contribution by @firewave)
- Internally suppress "unusedFunction" and "unusedStructMember" (for header files only) warnings to avoid false positives. (Contribution by @firewave)
- Fixed "information" messages not being shown at all. (Contribution by @firewave)
- Fixed `NullPointerException` with Cppcheck < 1.89 caused by missing 'column' attribute in XML result.
]]>
</change-notes>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ public static List<ProblemDescriptor> parseOutput(@NotNull final PsiFile psiFile
final NamedNodeMap locationAttributes = location.getAttributes();
final String fileName = new File(locationAttributes.getNamedItem("file").getNodeValue()).getName();
int lineNumber = Integer.parseInt(locationAttributes.getNamedItem("line").getNodeValue());
final int column = Integer.parseInt(locationAttributes.getNamedItem("column").getNodeValue()); // TODO
final Node columnAttr = locationAttributes.getNamedItem("column");
// TODO: use in ProblemDescriptor
int column = -1;
// the "column" attribute was added in Cppcheck 1.89
if (columnAttr != null) {
column = Integer.parseInt(columnAttr.getNodeValue());
}

// If a file #include's header files, Cppcheck will also run on the header files and print
// any errors. These errors don't apply to the current file and should not be drawn. They can
Expand Down

0 comments on commit 6bec888

Please sign in to comment.