[ 
http://jira.codehaus.org/browse/MTAGLIST-11?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Lundberg updated MTAGLIST-11:
------------------------------------

    Affects Version/s:     (was: 2.1)

> NullPointerException in plugin if the java file does not have a package
> -----------------------------------------------------------------------
>
>                 Key: MTAGLIST-11
>                 URL: http://jira.codehaus.org/browse/MTAGLIST-11
>             Project: Maven 2.x Taglist Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Andreas Wuest
>         Attachments: FileReportPatch.txt, FileReportPatch2.txt
>
>   Original Estimate: 10 minutes
>  Remaining Estimate: 10 minutes
>
> Hello,
> the taglib plugin crashes with a nullpointerexception if there is a java file 
> that does not have a package.
> the problem occurs if the "reader.readLine()" returns null so the trim cannot 
> be executed. anyway what
> is the reason for the trim ? i just do not understand why there is a need for 
> the trim. 
> if you look at the code you will see that the while loop cannot work for 
> classes without packages.
> because currentLine will never be null, because in the last line of the loop 
> you will always get a 
> nullpointer if the currentLine is expected to be null. 
> i am wondering why nobody else is experiencing this bug ? maybe nobody is 
> using classes without
> a package definition ;-)
> attached you will find a patch for the problem (one possible solution).
> here comes the exception :
> java.lang.NullPointerException
>         at 
> org.codehaus.mojo.taglist.beans.FileReport.getClassName(FileReport.ja
> va:116)
>         at 
> org.codehaus.mojo.taglist.ReportGenerator.doFileDetailedPart(ReportGe
> nerator.java:192)
>         at 
> org.codehaus.mojo.taglist.ReportGenerator.doTagDetailedPart(ReportGen
> erator.java:177)
>         at 
> org.codehaus.mojo.taglist.ReportGenerator.doDetailSection(ReportGener
> ator.java:149)
>         at 
> org.codehaus.mojo.taglist.ReportGenerator.generateReport(ReportGenera
> tor.java:85)
>         at 
> org.codehaus.mojo.taglist.TagListReport.executeReport(TagListReport.j
> ava:214)
>         at 
> org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMaven
> Report.java:98)
>         at 
> org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(R
> eportDocumentRenderer.java:67)
>         at 
> org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(
> DefaultSiteRenderer.java:239)
>         at 
> org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(Defaul
> tSiteRenderer.java:115)
>         at 
> org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:124
> )
>         at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:92)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
> nManager.java:412)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> ultLifecycleExecutor.java:534)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
> fecycle(DefaultLifecycleExecutor.java:475)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
> ltLifecycleExecutor.java:454)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> dleFailures(DefaultLifecycleExecutor.java:306)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> ts(DefaultLifecycleExecutor.java:273)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
> fecycleExecutor.java:140)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:585)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to