My Checkstyle configuration cannot seem to find my suppressions.xml, but it does exist and the filepath it is using works. Both my checkstyle.xml and suppressions.xml are in config/checkstyle. My checkstyle.xml has this:
<module name="SuppressionFilter">
<property name="file" value="${config_loc}\suppressions.xml"/>
<property name="optional" value="false"/>
</module>
When I run gradlew check --stacktrace
, the stack trace shows this:
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Unable to find: C:\Users\ntroncoso\Online Drive\projects\test-project\test-project-sdk\config\checkstyle\suppressions.xml
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:287)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:238)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.loadSuppressions(SuppressionsLoader.java:224)
at com.puppycrawl.tools.checkstyle.filters.SuppressionFilter.finishLocalSetup(SuppressionFilter.java:269)
at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:197)
at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:477)
... 206 more
Caused by: java.io.FileNotFoundException: http://www.puppycrawl.com/dtds/configuration_1_3.dtd
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:86)
at com.puppycrawl.tools.checkstyle.filters.SuppressionsLoader.getSuppressionLoader(SuppressionsLoader.java:283)
As I mentioned, I can copy and paste that file path into file explorer and it'll open. I tried just hardcoding the full path as well, but I get the same error. The only thing I can think of is the \ntroncoso part. Some systems will treat that as a new line in the path. But typically, the error would also print the new line, so I don't feel like that's the issue.
FileNotFoundException: http://www.puppycrawl.com/dtds/configuration_1_3.dtd
This is your true error. The DTD of your suppression file is wrong. First, you are using a configuration DTD for a suppression file. Second, puppycrawl domain is outdated and has since moved to checkstyle.org .
The DTD should be changed to https://checkstyle.org/dtds/suppressions_1_2.dtd
which is the latest DTD for the latest version of Checkstyle at this time.
Please see https://github.com/checkstyle/checkstyle/blob/master/config/suppressions.xml for an example of a proper suppression file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With