Bug 916790 - bundle creation fails even when using a valid version string
bundle creation fails even when using a valid version string
Status: ON_QA
Product: RHQ Project
Classification: Other
Component: Provisioning (Show other bugs)
Unspecified Unspecified
high Severity high (vote)
: ---
: ---
Assigned To: John Mazzitelli
Mike Foley
Depends On:
Blocks: 916793
  Show dependency treegraph
Reported: 2013-02-28 17:27 EST by John Mazzitelli
Modified: 2013-02-28 17:50 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 916793 (view as bug list)
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
see the version string in this bundle's recipe - this causes the error (667 bytes, application/x-java-archive)
2013-02-28 17:27 EST, John Mazzitelli
no flags Details

  None (edit)
Description John Mazzitelli 2013-02-28 17:27:36 EST
Created attachment 704013 [details]
see the version string in this bundle's recipe - this causes the error

If I have a bundle whose version string is "", the bundle fails to be created.

Recipe snippet:

    <rhq:bundle name="Test Version String"
                description="a small bundle with a small.properties file">

The bundle upload wizard gives error:

[Distribution File] Failed to upload bundle distribution file
javax.ejb.EJBException: java.lang.NumberFormatException: For input string: "201302221022"

server log:

17:21:58,004 ERROR [org.jboss.ejb3.invocation] (http-- JBAS014134: EJB Invocation failed on component BundleManagerBean for method public abstract org.rhq.core.domain.bundle.BundleVersion org.rhq.enterprise.server.bundle.BundleManagerLocal.createBundleVersion(org.rhq.core.domain.auth.Subject,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: java.lang.NumberFormatException: For input string: "201302221022"
Caused by: java.lang.NumberFormatException: For input string: "201302221022"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) [rt.jar:1.7.0_11]
	at java.lang.Integer.parseInt(Integer.java:495) [rt.jar:1.7.0_11]
	at java.lang.Integer.<init>(Integer.java:677) [rt.jar:1.7.0_11]
	at org.apache.maven.artifact.versioning.ComparableVersion.parseItem(ComparableVersion.java:427) [rhq-core-util-4.7.0-SNAPSHOT.jar:4.7.0-SNAPSHOT]
	at org.apache.maven.artifact.versioning.ComparableVersion.parseVersion(ComparableVersion.java:413) [rhq-core-util-4.7.0-SNAPSHOT.jar:4.7.0-SNAPSHOT]
	at org.apache.maven.artifact.versioning.ComparableVersion.<init>(ComparableVersion.java:322) [rhq-core-util-4.7.0-SNAPSHOT.jar:4.7.0-SNAPSHOT]
	at org.rhq.enterprise.server.bundle.BundleManagerBean.createBundleVersion(BundleManagerBean.java:496) [rhq-enterprise-server-ejb3.jar:4.7.0-SNAPSHOT]

Looks like a bug in ComparableVersion.
Comment 1 John Mazzitelli 2013-02-28 17:50:06 EST
fixed ComparableVersion so it treats long numbers as strings (which is what they probably are meant to be treated as anyway, as in a timestamp such as 201302221030 which refers to 10:30 AM on February 22, 2013.

git commit to master: 8beb34b

Note You need to log in before you can comment on or make changes to this bug.