[ 
https://issues.apache.org/jira/browse/FELIX-3234?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13152955#comment-13152955
 ] 

Francisco Olarte commented on FELIX-3234:
-----------------------------------------

I'm really a novice maven-scr user, and I do not know qdox, but it seems as if 
the plugin is somehow scanning the source when it shouldn't.

I mean, no matter wether you write 0L, 0, 00L the java compiler should turn 
this into 0L into the class file. To test this I've made two runs, one failed 
with 0L, one successful with 0 and compared the .class files from both runs, 
are they are in fact identical.

In the version which failed with the 0L I have this exception trace ( pruned 
and commented ):

java.lang.NumberFormatException: For input string: ""
        at 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Long.parseLong(Long.java:431)
** this is the error
        at com.thoughtworks.qdox.parser.impl.Parser.toLong(Parser.java:1180)
        at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1784)
        at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:999)
        at 
com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:353)
        at 
com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:381)
        at 
com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:377)
** this is qdox parsing sources 
        at 
org.apache.felix.scrplugin.JavaClassDescriptorManager.getSources(JavaClassDescriptorManager.java:115)
        at 
org.apache.felix.scrplugin.JavaClassDescriptorManager.getJavaClassesFromSources(JavaClassDescriptorManager.java:459)
        at 
org.apache.felix.scrplugin.JavaClassDescriptorManager.getSourceDescriptions(JavaClassDescriptorManager.java:361)
** this is the plugin parsing.
        at 
org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:234)
        at 
org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:184)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)

I'm not an expert in maven, qdox and scr. The problem seems to be the plugin 
needs to scan the sources looking for javadoc annotations, calls qdox for it 
and qdox barfs when it tries to compile the sources. (more on next comment)
                
> maven SCR plugin @Property annotation raises exceptions on longValue=0L use 
> ----------------------------------------------------------------------------
>
>                 Key: FELIX-3234
>                 URL: https://issues.apache.org/jira/browse/FELIX-3234
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin-1.7.2, maven-scr-plugin-1.7.4, scr 
> annotations 1.6.0
>         Environment: $ mvn -V
> Apache Maven 2.2.1 (rdebian-6)
> Java version: 1.6.0_26
> Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux" version: "3.0.0-12-generic" arch: "amd64" Family: "unix"
>            Reporter: Francisco Olarte
>            Priority: Minor
>
> When putting longValue =0L I get an exception on build, note it MUST be '0L'. 
> Exceptions does not hapen when using '0' ( without the long modifier ) or 
> 1234567 or 1234567L
> It seems problem occurs only with the '0L' value, as '00L' and '00000L' work 
> fine ( I have tested the values '0', '0L', '00L','00000L', '1234567' and 
> '1234567L' , and, after that, '0l', 00l' ( one and two zeroes, lowercase L ) 
> and the only ones which do not work are '0L' and '0l', all the other ones 
> build flawlessly ).
> The contens of metatype.xml for the property are correct: ( with 00l ):
>         <AD id="reload.period" type="Long" default="0" name="Auto reload 
> period" description="Sleep interval between reloading scans."/>
> Included below are captures for 0L and 0, results for the other ones are the 
> same.
> If needed I can try to strip the build to a minimum and send it.
> ----- with L modifier, raises exceptions: ------------
>     @Property(label = "Auto reload period",
>     description = "Sleep interval between reloading scans.",longValue=0L)
>     public final static String RELOAD_PERIOD = "reload.period";
> leads to:
> $ mvn clean install
> [INFO] Scanning for projects...
> [WARNING] POM for 'biz.aQute:bndlib:pom:1.43.0:runtime' is invalid.
> Its dependencies (if any) will NOT be available to the current build.
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building numclass-cmtport
> [INFO]    task-segment: [clean, install]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] [clean:clean {execution: default-clean}]
> [INFO] Deleting file set: 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target (included: 
> [**], excluded: [])
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 0 resource
> [INFO] [compiler:compile {execution: default-compile}]
> [INFO] Compiling 6 source files to 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/classes
> [INFO] [scr:scr {execution: generate-scr-scrdescriptor}]
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] For input string: ""
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Trace
> java.lang.NumberFormatException: For input string: ""
>       at 
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>       at java.lang.Long.parseLong(Long.java:431)
>       at com.thoughtworks.qdox.parser.impl.Parser.toLong(Parser.java:1180)
>       at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1784)
>       at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:999)
>       at 
> com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:353)
>       at 
> com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:381)
>       at 
> com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:377)
>       at 
> org.apache.felix.scrplugin.JavaClassDescriptorManager.getSources(JavaClassDescriptorManager.java:115)
>       at 
> org.apache.felix.scrplugin.JavaClassDescriptorManager.getJavaClassesFromSources(JavaClassDescriptorManager.java:459)
>       at 
> org.apache.felix.scrplugin.JavaClassDescriptorManager.getSourceDescriptions(JavaClassDescriptorManager.java:361)
>       at 
> org.apache.felix.scrplugin.SCRDescriptorGenerator.execute(SCRDescriptorGenerator.java:234)
>       at 
> org.apache.felix.scrplugin.mojo.SCRDescriptorMojo.execute(SCRDescriptorMojo.java:184)
>       at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>       at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>       at 
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:597)
>       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)
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 2 seconds
> [INFO] Finished at: Fri Nov 18 13:00:44 CET 2011
> [INFO] Final Memory: 23M/296M
> [INFO] 
> ------------------------------------------------------------------------
> ---------
> --------- without the L modifer ( no problems )--------------
>     @Property(label = "Auto reload period",
>     description = "Sleep interval between reloading scans.",longValue=0)
>     public final static String RELOAD_PERIOD = "reload.period";
> leads to:
> $ mvn clean install
> [INFO] Scanning for projects...
> [WARNING] POM for 'biz.aQute:bndlib:pom:1.43.0:runtime' is invalid.
> Its dependencies (if any) will NOT be available to the current build.
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building numclass-cmtport
> [INFO]    task-segment: [clean, install]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] [clean:clean {execution: default-clean}]
> [INFO] Deleting file set: 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target (included: 
> [**], excluded: [])
> [INFO] [resources:resources {execution: default-resources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 0 resource
> [INFO] [compiler:compile {execution: default-compile}]
> [INFO] Compiling 6 source files to 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/classes
> [INFO] [scr:scr {execution: generate-scr-scrdescriptor}]
> [INFO] Generating 2 MetaType Descriptors to 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/scr-plugin-generated/OSGI-INF/metatype/metatype.xml
> [INFO] Writing abstract service descriptor 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/scr-plugin-generated/OSGI-INF/scr-plugin/scrinfo.xml
>  with 1 entries.
> [INFO] Generating 1 Service Component Descriptors to 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/scr-plugin-generated/OSGI-INF/serviceComponents.xml
> [INFO] [resources:testResources {execution: default-testResources}]
> [INFO] Using 'UTF-8' encoding to copy filtered resources.
> [INFO] Copying 3 resources
> [INFO] [compiler:testCompile {execution: default-testCompile}]
> [INFO] Compiling 6 source files to 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/test-classes
> [INFO] [surefire:test {execution: default-test}]
> [INFO] Surefire report directory: 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/surefire-reports
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running TestSuite
> Nov 18, 2011 1:02:22 PM com.peoplecall.numclass.cmtport.CmtPortClassifier 
> loadCmtData
> WARNING: Error loading cmt data from ESTO NO EXISTE NI PATRAS previous 
> contents kept.
> Nov 18, 2011 1:02:22 PM com.peoplecall.numclass.cmtport.CmtPortClassifier 
> loadPortData
> WARNING: Error loading porting data from ESTO NO EXISTE NI PATRAS previous 
> contents kept.
> Tests run: 27, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.558 sec
> Results :
> Tests run: 27, Failures: 0, Errors: 0, Skipped: 0
> [INFO] [bundle:bundle {execution: default-bundle}]
> [INFO] [install:install {execution: default-install}]
> [INFO] Installing 
> /home/folarte/NetBeansProjects/numclass/numclass-cmtport/target/numclass-cmtport-1.0-SNAPSHOT.jar
>  to 
> /home/folarte/.m2/repository/com/peoplecall/numclass-cmtport/1.0-SNAPSHOT/numclass-cmtport-1.0-SNAPSHOT.jar
> [INFO] [bundle:install {execution: default-install}]
> [INFO] Installing 
> com/peoplecall/numclass-cmtport/1.0-SNAPSHOT/numclass-cmtport-1.0-SNAPSHOT.jar
> [INFO] Writing OBR metadata
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 4 seconds
> [INFO] Finished at: Fri Nov 18 13:02:23 CET 2011
> [INFO] Final Memory: 28M/247M
> [INFO] 
> ------------------------------------------------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to