Bug 1146611

Summary: Cannot discover EAP6.0.1: supportsMatching method fails with IllegalArgumentException
Product: [JBoss] JBoss Operations Network Reporter: Thomas Segismont <tsegismo>
Component: Plugin -- JBoss EAP 6Assignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Sunil Kondkar <skondkar>
Severity: high Docs Contact:
Priority: unspecified    
Version: JON 3.3.0CC: loleary, miburman, myarboro, skondkar
Target Milestone: ER04   
Target Release: JON 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-12-11 14:04:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Segismont 2014-09-25 15:23:05 UTC
Description of problem:
Cannot discover EAP6.0.1: supportsMatching methods fails with IllegalArgumentException

Version-Release number of selected component (if applicable):
3.3.ER03

How reproducible:
Always

Steps to Reproduce:
1.Setup JON Server + Agent environment
2.Start EAP6.0.1 Standalone or Domain
3.Run Autodiscovery operation on Platform resource

Actual results:
EAP6.0.1 is not discovered and agent.log shows:

2014-09-25 16:00:16,802 ERROR [ResourceDiscoveryComponent.invoker.daemon-5] (rhq.modules.plugins.jbossas7.BaseProcessDiscovery)- Discovery of a JBossAS7 Host Controller Resource failed for process: pid=[19681], name=[/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.2.5.fc20.x86_64/bin/java], ppid=[19665].
java.lang.IllegalArgumentException: Malformed version string [6.0.1 GA]
	at org.rhq.core.domain.util.OSGiVersion.<init>(OSGiVersion.java:82)

Expected results:
EAP6.0.1 is discovered

Comment 1 Thomas Segismont 2014-09-25 15:33:04 UTC
Fixed in master

commit b95683ae6366745f53923c8d8d4c2d88cf21e17c
Author: Thomas Segismont <tsegismo>
Date:   Thu Sep 25 17:31:49 2014 +0200
    
    EAP 6.1.0 version.txt file content is: "JBoss Enterprise Application Platform - Version 6.0.1 GA"
    As a consequence, the version detected will be "6.0.1 GA" (notice the space instead of a dot)
    
    Give such version strings a chance to make a valid OSGiVersion instance (avoid IllegalArgumentException)
    
    If the version is still not matching the expected pattern, then supportsPatching default to false
    
    Also:
    * some perf improvements:
    ** use already compiled PATTERN instead of recompiling on each call of String#split or String.replaceAll
    ** use some OSGiVersion constants to avoid parsing over and over again
    * some code cleanup (no longer use deprecated methods, remove unused param in private method, unchecked warning)

Comment 2 Thomas Segismont 2014-09-25 15:33:33 UTC
Not yet in the release branch. Needs review and cherry-picking.

Comment 3 Thomas Segismont 2014-09-25 16:44:33 UTC
(In reply to Thomas Segismont from comment #1)
> Fixed in master
> 
> commit b95683ae6366745f53923c8d8d4c2d88cf21e17c
> Author: Thomas Segismont <tsegismo>
> Date:   Thu Sep 25 17:31:49 2014 +0200
>     

Reverted commit due to a compilation failure in CoreGUI (regex.Pattern is not a GWT compatible type)

Comment 4 Thomas Segismont 2014-09-26 09:03:39 UTC
Fixed in master

commit 640a88cb2f126d583e46fc6b5a24f075df8d7535
Author: Thomas Segismont <tsegismo>
Date:   Thu Sep 25 18:47:02 2014 +0200

    Bug 1146611 - Cannot discover EAP6.0.1: supportsMatching method fails with IllegalArgumentException
    
    EAP 6.1.0 version.txt file content is: "JBoss Enterprise Application Platform - Version 6.0.1 GA"
    As a consequence, the version detected will be "6.0.1 GA" (notice the space instead of a dot)
    
    Give such version strings a chance to make a valid OSGiVersion instance (avoid IllegalArgumentException)
    
    If the version is still not matching the expected pattern, then supportsPatching default to false
    
    Also:
    * some perf improvements:
    ** use already compiled PATTERN instead of recompiling on each call of String#split or String.replaceAll
    ** use some OSGiVersion constants to avoid parsing over and over again
    * some code cleanup (no longer use deprecated methods, remove unused param in private method, unchecked warning)

Comment 5 Simeon Pinder 2014-09-29 08:12:55 UTC
Moving into ER05 as didn't make the ER04 cut.

Comment 6 Michael Burman 2014-09-29 13:06:01 UTC
Cherry-picked to release/jon3.3.x:

commit 702e61b7e25d290f9dd8f5e523c9ba439b455615
Author: Thomas Segismont <tsegismo>
Date:   Thu Sep 25 18:47:02 2014 +0200

    Bug 1146611 - Cannot discover EAP6.0.1: supportsMatching method fails with IllegalArgumentException
    
    EAP 6.1.0 version.txt file content is: "JBoss Enterprise Application Platform - Version 6.0.1 GA"
    As a consequence, the version detected will be "6.0.1 GA" (notice the space instead of a dot)
    
    Give such version strings a chance to make a valid OSGiVersion instance (avoid IllegalArgumentException)
    
    If the version is still not matching the expected pattern, then supportsPatching default to false
    
    Also:
    * some perf improvements:
    ** use already compiled PATTERN instead of recompiling on each call of String#split or String.replaceAll
    ** use some OSGiVersion constants to avoid parsing over and over again
    * some code cleanup (no longer use deprecated methods, remove unused param in private method, unchecked warning)
    
    (cherry picked from commit 640a88cb2f126d583e46fc6b5a24f075df8d7535)

Comment 7 Michael Burman 2014-09-29 13:12:52 UTC
Cherry-picked to rc/jon3.3.0.ER04 (allowed by spinder):

commit 160483d00f7f17d8da1f57b0823f2ab64818a2c4
Author: Thomas Segismont <tsegismo>
Date:   Thu Sep 25 18:47:02 2014 +0200

    Bug 1146611 - Cannot discover EAP6.0.1: supportsMatching method fails with IllegalArgumentException
    
    EAP 6.1.0 version.txt file content is: "JBoss Enterprise Application Platform - Version 6.0.1 GA"
    As a consequence, the version detected will be "6.0.1 GA" (notice the space instead of a dot)
    
    Give such version strings a chance to make a valid OSGiVersion instance (avoid IllegalArgumentException)
    
    If the version is still not matching the expected pattern, then supportsPatching default to false
    
    Also:
    * some perf improvements:
    ** use already compiled PATTERN instead of recompiling on each call of String#split or String.replaceAll
    ** use some OSGiVersion constants to avoid parsing over and over again
    * some code cleanup (no longer use deprecated methods, remove unused param in private method, unchecked warning)
    
    (cherry picked from commit 640a88cb2f126d583e46fc6b5a24f075df8d7535)

Comment 9 Sunil Kondkar 2014-10-31 09:28:07 UTC
Verified on JON 3.3 ER05

On autodiscovery, EAP6.0.1 is discovered and agent.log does not show any errors. Verified that EAP6.0.1 is imported successfully and is green.