You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Matthias Bläsing (JIRA)" <ji...@apache.org> on 2018/02/17 13:32:04 UTC

[jira] [Resolved] (NETBEANS-247) Exception thrown if sources artifact does not contain sources

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

Matthias Bläsing resolved NETBEANS-247.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 9.0

After the merge of the fix for NETBEANS-299 I also checked this case. With a nightly build for 2018-02-02 I'm not able to reproduce the problem anymore.

I therefore mark this as resolved. If it is still reproducible feel free to reopen.

> Exception thrown if sources artifact does not contain sources
> -------------------------------------------------------------
>
>                 Key: NETBEANS-247
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-247
>             Project: NetBeans
>          Issue Type: Bug
>          Components: java - Editor
>         Environment: Product Version: Apache NetBeans IDE Dev (Build incubator-netbeans-release-159-on-20180102)
> Updates: Updates available
> Java: 9.0.1; Java HotSpot(TM) 64-Bit Server VM 9.0.1+11
> Runtime: Java(TM) SE Runtime Environment 9.0.1+11
> System: Windows 10 version 10.0 running on amd64; Cp1252; en_CA (nb)
> User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev
> Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev
>            Reporter: Gili
>            Priority: Major
>             Fix For: 9.0
>
>
> It seems some people are publishing invalid artifacts to Maven Central and ignoring bug reports asking them to fix it ;)
> When Netbeans encounters this (example below) it blows up. Let's see if we can improve our error handling.
> Given:
> 		<dependency>
> 			<groupId>com.pusher</groupId>
> 			<artifactId>pusher-java-client</artifactId>
> 			<version>1.6.0</version>
> 		</dependency>
> If you download Sources and Javadoc from Maven central you will discover that the sources jar contains the javadoc and javadoc jar contains the sources. If you open the dependency in the Projects tab, expand the artifact, and click on any of the class files you will get the following exception:
> {code}
> java.lang.IllegalArgumentException: Compilation unit is not of SOURCE kind: "Authorizer.class"
> 	at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:161)
> 	at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:873)
> 	at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:727)
> 	at org.netbeans.modules.java.source.parsing.CompilationInfoImpl.getJavacTask(CompilationInfoImpl.java:374)
> 	at org.netbeans.modules.java.source.parsing.ClassParser.getResult(ClassParser.java:160)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
> 	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:239)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
> 	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
> 	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
> [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
> 	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
> 	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
> 	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
> 	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
> 	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
> 	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
> {code}
> Expected behavior: Treat the file as if no sources are available (open the decompiled representation). Don't throw an exception.
> Bonus points: Consider ignoring the artifact type and using the sources/javadoc regardless of where you find them. If, however, multiple JARs contain the sources or javadoc then favor the ones coming out of the "correct" type JAR.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists