jaxrs-analyzer icon indicating copy to clipboard operation
jaxrs-analyzer copied to clipboard

Media type not supported (Javadoc?)

Open dizzzz opened this issue 5 years ago • 12 comments

When running the plugin I have the following trace; is there any way to work around this?

[ERROR] Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.18-SNAPSHOT:analyze-jaxrs (default) on project rest.api: Execution default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.18-SNAPSHOT:analyze-jaxrs failed: Javadoc param type (MediaType.APPLICATION_OCTET_STREAM) not supported. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.18-SNAPSHOT:analyze-jaxrs (default) on project rest.api: Execution default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.18-SNAPSHOT:analyze-jaxrs failed: Javadoc param type (MediaType.APPLICATION_OCTET_STREAM) not supported.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal com.sebastian-daschner:jaxrs-analyzer-maven-plugin:0.18-SNAPSHOT:analyze-jaxrs failed: Javadoc param type (MediaType.APPLICATION_OCTET_STREAM) not supported.
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)

Caused by: java.lang.IllegalArgumentException: Javadoc param type (MediaType.APPLICATION_OCTET_STREAM) not supported.
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.createMemberParamValue (JavaDocParserVisitor.java:154)
    at java.util.stream.Collectors.lambda$toMap$58 (Collectors.java:1321)
    at java.util.stream.ReduceOps$3ReducingSink.accept (ReduceOps.java:169)
    at java.util.stream.ReferencePipeline$2$1.accept (ReferencePipeline.java:175)
    at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1382)
    at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:471)
    at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:708)
    at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:499)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.createMemberParamTag (JavaDocParserVisitor.java:141)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.createFieldComment (JavaDocParserVisitor.java:102)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.lambda$visit$1 (JavaDocParserVisitor.java:92)
    at java.util.Optional.ifPresent (Optional.java:159)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:92)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:38)
    at com.github.javaparser.ast.body.FieldDeclaration.accept (FieldDeclaration.java:125)
    at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$visit$29 (VoidVisitorAdapter.java:170)
    at java.util.ArrayList.forEach (ArrayList.java:1257)
    at com.github.javaparser.ast.NodeList.forEach (NodeList.java:255)
    at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit (VoidVisitorAdapter.java:170)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:64)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocParserVisitor.visit (JavaDocParserVisitor.java:38)
    at com.github.javaparser.ast.body.ClassOrInterfaceDeclaration.accept (ClassOrInterfaceDeclaration.java:104)
    at com.github.javaparser.ast.visitor.VoidVisitorAdapter.lambda$visit$40 (VoidVisitorAdapter.java:192)
    at java.util.ArrayList.forEach (ArrayList.java:1257)
    at com.github.javaparser.ast.NodeList.forEach (NodeList.java:255)
    at com.github.javaparser.ast.visitor.VoidVisitorAdapter.visit (VoidVisitorAdapter.java:192)
    at com.github.javaparser.ast.CompilationUnit.accept (CompilationUnit.java:126)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.parseJavaDoc (JavaDocAnalyzer.java:64)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.lambda$invokeParser$0 (JavaDocAnalyzer.java:58)
    at java.lang.Iterable.forEach (Iterable.java:75)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.invokeParser (JavaDocAnalyzer.java:58)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.invokeParser (JavaDocAnalyzer.java:38)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.javadoc.JavaDocAnalyzer.analyze (JavaDocAnalyzer.java:31)
    at com.sebastian_daschner.jaxrs_analyzer.analysis.ProjectAnalyzer.analyze (ProjectAnalyzer.java:107)
    at com.sebastian_daschner.jaxrs_analyzer.JAXRSAnalyzer.analyze (JAXRSAnalyzer.java:47)
    at com.sebastian_daschner.jaxrs_analyzer.maven.JAXRSAnalyzerMojo.execute (JAXRSAnalyzerMojo.java:226)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]

dizzzz avatar Jul 02 '19 09:07 dizzzz

Hi @dizzzz,

Could you isolate the issue? do you have an example endpoint which reproduces it?

rmpestano avatar Jul 02 '19 13:07 rmpestano

I will try! One question I have (to understand the design a bit better): what is the purpose of reading javadoc details? I guess somewhere some rotten javadoc code is written, how robust is this part of the code? If it is left out... what is missing?

dizzzz avatar Jul 02 '19 15:07 dizzzz

Is there a way to see on which .java file an issue occurs?

dizzzz avatar Jul 02 '19 15:07 dizzzz

It is on the stacktrace (JavaDocParserVisitor.java:141)

rmpestano avatar Jul 02 '19 16:07 rmpestano

@rmpestano :-) I meant the file that is being parsed by the tool. My question is related to my earlier question. I think we have some missing / wrong / inconsistent javadoc syntax, but can't yet figure out which one.

dizzzz avatar Jul 02 '19 16:07 dizzzz

Ohh my bad, I don't think so, If you can zip your project I can try to find out by debuging (probably something related to the javadoc as the error is on the javadoc parser)

rmpestano avatar Jul 02 '19 16:07 rmpestano

@rmpestano unfortunately I cannot send the code (completely), an 'anonymized' part would be feasible but for this I need to know which file I need to check.

dizzzz avatar Jul 02 '19 16:07 dizzzz

maybe the debugger can help here?

dizzzz avatar Jul 02 '19 16:07 dizzzz

Yes, install this project locally (mvn install)

then install https://github.com/sdaschner/jaxrs-analyzer-maven-plugin and then upgrade your project to use the installed maven plugin and finally run mvnDebug clean package on your project, you'll need to remote debug on port 8000.

If find any problems trying to debug just ask for help here.

the error is here, if you put a breakpoint here you may find the endpoint which has the invalid javadoc tag.

rmpestano avatar Jul 02 '19 16:07 rmpestano

@rmpestano My question remains: how is the contents of the javadoc used in the end result?

dizzzz avatar Jul 02 '19 17:07 dizzzz

it is used to enhance the generated swagger.json, e.g add description to endpoint params, return types and so on, see an example here.

rmpestano avatar Jul 02 '19 17:07 rmpestano

I guess I need something as

image

but I am not yet sure what will happen 'downstream'....

dizzzz avatar Jul 03 '19 15:07 dizzzz