You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Mark Struberg (JIRA)" <ji...@apache.org> on 2010/07/05 18:41:51 UTC

[jira] Created: (GERONIMO-5427) using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE

using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE
------------------------------------------------------------------------

                 Key: GERONIMO-5427
                 URL: https://issues.apache.org/jira/browse/GERONIMO-5427
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: buildsystem
    Affects Versions: 3.0-M1
            Reporter: Mark Struberg


This is somehow related to GERONIMO-5392:

It seems that a very similar thing also happens while building plugins which reference to SNAPSHOT versions.

While upgrading the plugins/myfaces to myfaces-2.0.1-SNAPSHOT locally and trying to compile the plugin, I get the following Exception:

java.lang.NumberFormatException: For input string: "1-SNAPSHOT"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:458)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.osgi.framework.Version.<init>(Version.java:133)
	at org.osgi.framework.Version.parseVersion(Version.java:218)
	at org.eclipse.osgi.service.resolver.VersionRange.<init>(VersionRange.java:92)
	at org.eclipse.osgi.internal.resolver.StateBuilder.getVersionRange(StateBuilder.java:532)
	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundle(StateBuilder.java:217)
	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundles(StateBuilder.java:210)
	at org.eclipse.osgi.internal.resolver.StateBuilder.createBundleDescription(StateBuilder.java:101)
	at org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.createBundleDescription(StateObjectFactoryImpl.java:32)
	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:173)
	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:129)
	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:119)
	at org.apache.geronimo.mavenplugins.osgi.VerifyManifestMojo.execute(VerifyManifestMojo.java:101)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (GERONIMO-5427) using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE

Posted by "Mark Struberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-5427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Struberg updated GERONIMO-5427:
------------------------------------

    Attachment: GERONIMO-5427.patch

The reason is the Require-Bundle manifest entry which doesn't get polished by the BND util. 
This patch is _only_ to show the effect and shall _not_ get applied in this way!
Instead this should get properly fixed in the underlying OSGi libraries which got used to create the bundle.

I'm not sure if we should add some invalid bundle detection in geronimo to prevent such things.

> using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE
> ------------------------------------------------------------------------
>
>                 Key: GERONIMO-5427
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5427
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: buildsystem
>    Affects Versions: 3.0-M1
>            Reporter: Mark Struberg
>         Attachments: GERONIMO-5427.patch
>
>
> This is somehow related to GERONIMO-5392:
> It seems that a very similar thing also happens while building plugins which reference to SNAPSHOT versions.
> While upgrading the plugins/myfaces to myfaces-2.0.1-SNAPSHOT locally and trying to compile the plugin, I get the following Exception:
> java.lang.NumberFormatException: For input string: "1-SNAPSHOT"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 	at java.lang.Integer.parseInt(Integer.java:458)
> 	at java.lang.Integer.parseInt(Integer.java:499)
> 	at org.osgi.framework.Version.<init>(Version.java:133)
> 	at org.osgi.framework.Version.parseVersion(Version.java:218)
> 	at org.eclipse.osgi.service.resolver.VersionRange.<init>(VersionRange.java:92)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.getVersionRange(StateBuilder.java:532)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundle(StateBuilder.java:217)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundles(StateBuilder.java:210)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createBundleDescription(StateBuilder.java:101)
> 	at org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.createBundleDescription(StateObjectFactoryImpl.java:32)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:173)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:129)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:119)
> 	at org.apache.geronimo.mavenplugins.osgi.VerifyManifestMojo.execute(VerifyManifestMojo.java:101)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (GERONIMO-5427) using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE

Posted by "Shawn Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-5427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12924517#action_12924517 ] 

Shawn Jiang commented on GERONIMO-5427:
---------------------------------------

We can't modified the org.osgi.framework.Version class because it comes from the OSGi spec.  From the javadoc[1], the third part of OSGI version must be a number.

{noformat}

public Version(java.lang.String version)

    Created a version identifier from the specified string.

    Here is the grammar for version strings.

     version ::= major('.'minor('.'micro('.'qualifier)?)?)?
     major ::= digit+
     minor ::= digit+
     micro ::= digit+
     qualifier ::= (alpha|digit|'_'|'-')+
     digit ::= [0..9]
     alpha ::= [a..zA..Z]
     

    There must be no whitespace in version.

    Parameters:
        version - String representation of the version identifier. 
    Throws:
        java.lang.IllegalArgumentException - If version is improperly formatted.
{noformat}


There's similar workaround in current Geronimo code.  



{code:title="org.apache.geronimo.aries.builder.ApplicationInstaller.getVersion(Version)"}
private static String getVersion(Version version) {
        String str = version.getMajor() + "." + version.getMinor() + "." + version.getMicro();
        String qualifier = version.getQualifier();
        if (qualifier != null && qualifier.trim().length() > 0) {
            str += "-" + version.getQualifier().trim();
        }
        return str;
    }
{code}




[1]http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Version.html#Version%28java.lang.String%29

> using a maven snapshot in a plugin causes the osgi-plugin to throw a NFE
> ------------------------------------------------------------------------
>
>                 Key: GERONIMO-5427
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5427
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: buildsystem
>    Affects Versions: 3.0-M1
>            Reporter: Mark Struberg
>         Attachments: GERONIMO-5427.patch
>
>
> This is somehow related to GERONIMO-5392:
> It seems that a very similar thing also happens while building plugins which reference to SNAPSHOT versions.
> While upgrading the plugins/myfaces to myfaces-2.0.1-SNAPSHOT locally and trying to compile the plugin, I get the following Exception:
> java.lang.NumberFormatException: For input string: "1-SNAPSHOT"
> 	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
> 	at java.lang.Integer.parseInt(Integer.java:458)
> 	at java.lang.Integer.parseInt(Integer.java:499)
> 	at org.osgi.framework.Version.<init>(Version.java:133)
> 	at org.osgi.framework.Version.parseVersion(Version.java:218)
> 	at org.eclipse.osgi.service.resolver.VersionRange.<init>(VersionRange.java:92)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.getVersionRange(StateBuilder.java:532)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundle(StateBuilder.java:217)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createRequiredBundles(StateBuilder.java:210)
> 	at org.eclipse.osgi.internal.resolver.StateBuilder.createBundleDescription(StateBuilder.java:101)
> 	at org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl.createBundleDescription(StateObjectFactoryImpl.java:32)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:173)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:129)
> 	at org.apache.geronimo.mavenplugins.osgi.utils.BundleResolver.addBundle(BundleResolver.java:119)
> 	at org.apache.geronimo.mavenplugins.osgi.VerifyManifestMojo.execute(VerifyManifestMojo.java:101)
> 	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.