[ 
https://issues.apache.org/jira/browse/JXR-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Markus Spann updated JXR-170:
-----------------------------
    Description: 
I am encountering a {{NullPointerException}} in the aggregate goal while 
parsing a Java source that makes use of new Java 15 multi-line Strings 
containing a reserved Java keyword i.e. {{{}import{}}}.
{noformat}
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" 
because "name" is null
    at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
(JavaFileImpl.java:128)
    at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
(JavaFileImpl.java:144)
    at org.apache.maven.jxr.pacman.JavaFileImpl.parse (JavaFileImpl.java:74)
    at org.apache.maven.jxr.pacman.JavaFileImpl.<init> (JavaFileImpl.java:59)
{noformat}
Command-line: 
{noformat}
mvn org.apache.maven.plugins:maven-jxr-plugin:3.2.0:aggregate{noformat}
 

Cause: variable name is null in line 128

 
{code:java}
        if ( name.charAt( name.length() - 1 ) == '.' ){code}
 

This is the cause of the run-time exception.
The real cause is more likely a parsing issue.

The plugin stumbles at following statement in my project, a code generator 
(code abbreviated for clarity):
{code:java}
        Code code = new Code().addFormat("""
            import {0};
            import java.util.List;
            """,
            additionalImportClass.getName()
            );
{code}
Same error can be observed in older versions of the plugin.

The only work-around I found was to exclude this source from jxr in its Maven 
configuration:
{code:java}
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <configuration>
                        <linkJavadoc>false</linkJavadoc>
                        <skip>false</skip>
                        <excludes>
                            <exclude>**/ClassFailinginJxr.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
{code}
 

  was:
Encountering {{NullPointerException}} in the aggregate goal while parsing a 
Java source that makes use of new Java 15 multi-line Strings containing a 
reserved Java keyword i.e. {{{}import{}}}.
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" 
because "name" is null
    at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
(JavaFileImpl.java:128)
    at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
(JavaFileImpl.java:144)
    at org.apache.maven.jxr.pacman.JavaFileImpl.parse (JavaFileImpl.java:74)
    at org.apache.maven.jxr.pacman.JavaFileImpl.<init> (JavaFileImpl.java:59)
Command-line: {color:#e01e5a}mvn 
org.apache.maven.plugins:maven-jxr-plugin:3.2.0:aggregate{color}

The plugin stumbles at following statement in my project (a code generator):

 
{code:java}
        Code codeImport = new Code().addFormat("""
            import {0};
            import java.util.List;
            """,
            constantsClass.getName()
            );
{code}
Same error in older versions of the plugin.

The only work-around I found was to exclude the source from jxr in its Maven 
configuration:
{code:java}
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jxr-plugin</artifactId>
                    <configuration>
                        <linkJavadoc>false</linkJavadoc>
                        <skip>false</skip>
                        <excludes>
                            <exclude>**/ClassFailinginJxr.java</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
{code}
 


> NullPointerException while parsing Java 15 multi-line String source 
> containing reserved Java keyword
> ----------------------------------------------------------------------------------------------------
>
>                 Key: JXR-170
>                 URL: https://issues.apache.org/jira/browse/JXR-170
>             Project: Maven JXR
>          Issue Type: Bug
>          Components: maven2 jxr plugin
>    Affects Versions: 3.2.0
>            Reporter: Markus Spann
>            Priority: Minor
>
> I am encountering a {{NullPointerException}} in the aggregate goal while 
> parsing a Java source that makes use of new Java 15 multi-line Strings 
> containing a reserved Java keyword i.e. {{{}import{}}}.
> {noformat}
> Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" 
> because "name" is null
>     at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
> (JavaFileImpl.java:128)
>     at org.apache.maven.jxr.pacman.JavaFileImpl.parseRecursive 
> (JavaFileImpl.java:144)
>     at org.apache.maven.jxr.pacman.JavaFileImpl.parse (JavaFileImpl.java:74)
>     at org.apache.maven.jxr.pacman.JavaFileImpl.<init> (JavaFileImpl.java:59)
> {noformat}
> Command-line: 
> {noformat}
> mvn org.apache.maven.plugins:maven-jxr-plugin:3.2.0:aggregate{noformat}
>  
> Cause: variable name is null in line 128
>  
> {code:java}
>         if ( name.charAt( name.length() - 1 ) == '.' ){code}
>  
> This is the cause of the run-time exception.
> The real cause is more likely a parsing issue.
> The plugin stumbles at following statement in my project, a code generator 
> (code abbreviated for clarity):
> {code:java}
>         Code code = new Code().addFormat("""
>             import {0};
>             import java.util.List;
>             """,
>             additionalImportClass.getName()
>             );
> {code}
> Same error can be observed in older versions of the plugin.
> The only work-around I found was to exclude this source from jxr in its Maven 
> configuration:
> {code:java}
>         <pluginManagement>
>             <plugins>
>                 <plugin>
>                     <groupId>org.apache.maven.plugins</groupId>
>                     <artifactId>maven-jxr-plugin</artifactId>
>                     <configuration>
>                         <linkJavadoc>false</linkJavadoc>
>                         <skip>false</skip>
>                         <excludes>
>                             <exclude>**/ClassFailinginJxr.java</exclude>
>                         </excludes>
>                     </configuration>
>                 </plugin>
>             </plugins>
>         </pluginManagement>
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to