Skip to content

Commit da25786

Browse files
committed
Resolve edge-case where Piccolo is on the project classpath (#668)
1 parent db1fc64 commit da25786

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
# CheckStyle-IDEA Changelog
33

4+
* **5.108.1** Fixed: Resolved edge case if Piccolo is in the project classpath (#668).
45
* **5.108.0** New: Added Checkstyle 10.25.1 & 10.26.0.
56
* **5.107.0** New: Added Checkstyle 10.25.0.
67
* **5.106.0** New: Added Checkstyle 10.24.0.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919
id("org.infernus.idea.checkstyle.build")
2020
}
2121

22-
version = "5.108.0"
22+
version = "5.108.1"
2323

2424
intellijPlatform {
2525
pluginConfiguration {

src/main/java/org/infernus/idea/checkstyle/CheckstyleProjectService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,22 @@ private CheckstyleProjectService(@NotNull final Project project,
4343
this.project = project;
4444
supportedVersions = new VersionListReader().getSupportedVersions();
4545

46+
ensureAValidatingParsingIsSetIfPiccoloIsInClasspath();
47+
4648
activateCheckstyleVersion(requestedVersion, thirdPartyJars);
4749
}
4850

51+
private static void ensureAValidatingParsingIsSetIfPiccoloIsInClasspath() {
52+
// Piccolo is non-validating, but CS needs a validating parser, so we need to ensure that a validating parser
53+
// is available if Piccolo is on the project classpath
54+
try {
55+
Class.forName("org.apache.xerces.jaxp.SAXParserFactoryImpl");
56+
System.setProperty("com.bluecast.xml.ValidatingSAXParserFactory", "org.apache.xerces.jaxp.SAXParserFactoryImpl");
57+
} catch (ClassNotFoundException ignored) {
58+
// ignored
59+
}
60+
}
61+
4962
@NotNull
5063
public static CheckstyleProjectService forVersion(@NotNull final Project project,
5164
@Nullable final String requestedVersion,

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<change-notes>
2626
<![CDATA[
2727
<ul>
28+
<li>5.108.1: Fixed: Resolved edge case if Piccolo is in the project classpath (#668).</li>
2829
<li>5.108.0: New: Added Checkstyle 10.25.1 & 10.26.0.</li>
2930
<li>5.107.0: New: Added Checkstyle 10.25.0.</li>
3031
<li>5.106.0: New: Added Checkstyle 10.24.0.</li>
@@ -40,11 +41,6 @@
4041
<li>5.99.0: New: Added Checkstyle 10.20.2.</li>
4142
<li>5.99.0: New: Problems in the static scan now show the rules file that was the source of the check (#5).</li>
4243
<li>5.99.0: New: Added option to group results by package, severity, and rules file (#3).</li>
43-
<li>5.98.0: New: Added Checkstyle 10.20.1.</li>
44-
<li>5.97.0: Fixed: Refactored code to fix exception around API dependencies at initialisation (#655).</li>
45-
<li>5.97.0: New: Added Checkstyle 10.19.0.</li>1
46-
<li>5.96.0: Fixed: Refactored code to avoid IDEA triggering the wrong constructor (#653).</li>
47-
<li>5.96.0: New: Added Checkstyle 10.18.2.</li>
4844
<li><em>For older changes please see the changelog.</em></li>
4945
</ul>
5046
]]>

0 commit comments

Comments
 (0)