Home > other >  Checkstyle, Unable to parse configuration stream
Checkstyle, Unable to parse configuration stream

Time:07-15

I am new to coding but was asked to install apache ofbiz software. I've gotten pretty far by doing my own research however, I've run into an error that I can't find an answer for online. this is the checkstyle.xml file that is having issues when i try to run the gradle build:

    <module name="Checker">
    <module name="LineLength">
    <property name="max" value="150"/>

   <module name="BeforeExecutionExclusionFileFilter">
        <property name="fileNamePattern" value="module\-info\.java$"/>
    </module>
    <property name="fileExtensions" value="java, properties, xml"/>

    <!-- General file conventions -->
    <module name="NewlineAtEndOfFile">
        <property name="lineSeparator" value="lf_cr_crlf" />
    </module>
    <module name="FileTabCharacter"/>
    <module name="RegexpSingleline">
        <property name="format" value="\s $"/>
        <property name="minimum" value="0"/>
        <property name="maximum" value="0"/>
        <property name="message" value="Line has trailing spaces."/>
    </module>

    <module name="TreeWalker">
        <!-- Naming conventions -->
        <module name="ConstantName"/>
        <module name="LocalFinalVariableName"/>
        <module name="LocalVariableName"/>
        <module name="MemberName"/>
        <module name="MethodName"/>
        <module name="PackageName"/>
        <module name="ParameterName"/>
        <module name="StaticVariableName"/>
        <module name="TypeName"/>
        
        <!-- Checks for imports -->
        <module name="AvoidStarImport"/>
        <module name="IllegalImport"/>
        <module name="RedundantImport"/>
        <module name="UnusedImports">
            <property name="processJavadoc" value="false"/>
        </module>

        <!-- Checks for Size Violations -->
        <module name="MethodLength"/>
        <module name="ParameterNumber"/>

        <!-- Checks for whitespace -->
            <module name="EmptyForIteratorPad"/>
        <module name="GenericWhitespace"/>
        <module name="MethodParamPad"/>
        <module name="NoWhitespaceAfter"/>
        <module name="NoWhitespaceBefore"/>
        <module name="OperatorWrap"/>
        <module name="SeparatorWrap">
            <property name="tokens"
                      value="COMMA,LPAREN,RPAREN,RBRACK,ARRAY_DECLARATOR"/>
            <property name="option" value="eol"/>
        </module>
        <module name="SeparatorWrap">
            <property name="tokens" value="DOT,METHOD_REF,ELLIPSIS,AT"/>
            <property name="option" value="nl"/>
        </module>
        <module name="ParenPad"/>
        <module name="TypecastParenPad"/>
        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>
        <module name="SingleSpaceSeparator"/>

        <!-- Modifier Checks -->
            <module name="ModifierOrder"/>
        <module name="RedundantModifier"/>

        <!-- Checks for blocks. You know, those {}'s -->
            <module name="AvoidNestedBlocks"/>
        <module name="EmptyBlock"/>
        <module name="LeftCurly"/>
        <module name="NeedBraces"/>
        <module name="RightCurly"/>

        <!-- Checks for common coding problems -->
            <module name="EmptyStatement"/>
        <module name="EqualsHashCode"/>
        <module name="IllegalInstantiation"/>
        <module name="InnerAssignment"/>
        <module name="MultipleVariableDeclarations"/>
        <module name="SimplifyBooleanExpression"/>
        <module name="SimplifyBooleanReturn"/>

        <!-- Checks for class design -->
            <module name="DesignForExtension"/>
        <module name="FinalClass"/>
        <module name="HideUtilityClassConstructor"/>
        <module name="InterfaceIsType"/>
        <module name="VisibilityModifier"/>

        <!-- Miscellaneous other checks -->
            <module name="ArrayTypeStyle"/>
        <module name="UpperEll"/>
        <module name="Indentation">
            <property name="caseIndent" value="0"/>
            <property name="lineWrappingIndentation" value="8"/>
        </module>

        <!-- Checks for annotations -->
            <module name="MissingOverride"/>
         </module>
</module>

heres the error that comes up

Caused by:
com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to parse configuration stream - XML document structures must start and end within the same entity.:134:10

Caused by:
org.xml.sax.SAXParseException; systemId: file:/C:/apache-ofbiz-18.12.05/config/checkstyle/checkstyle.xml; lineNumber: 134; columnNumber: 10; XML document structures must start and end within the same entity.

So I'm not sure what I should be putting or changing since its the last line. I've tried moving it around adding another </module> portion and adding spaces. If anyone could help that would be greatly appreciated.

CodePudding user response:

You are missing a closing </module> tag. Probably on the

<module name="TreeWalker">

element.
So add this closing element </module> at the end/the right place and your XML should be fine.

  • Related