Bug 666848

Summary: Apache (EWS-1.0.1) > Operation failed with exception - java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Product: [Other] RHQ Project Reporter: Lukas Krejci <lkrejci>
Component: OperationsAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: low    
Version: 4.0.0CC: mfoley, rtimaniy, skondkar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 665855 Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 665855    
Bug Blocks: 625146    

Description Lukas Krejci 2011-01-03 12:25:28 UTC
+++ This bug was initially created as a clone of Bug #665855 +++

Created attachment 470848 [details]
screenshot

Description of problem:
Apache (EWS-1.0.1) > Operation failed with exception - 
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1768)
        at org.rhq.plugins.apache.ApacheServerComponent.getControlScriptPath(ApacheServerComponent.java:663)
        at org.rhq.plugins.apache.ApacheServerOperationsDelegate.invokeOperation(ApacheServerOperationsDelegate.java:78)
        at org.rhq.plugins.apache.ApacheServerComponent.invokeOperation(ApacheServerComponent.java:299)
        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:592)
        at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
        at java.util.concurrent.FutureTask.run(FutureTask.java:123)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
        at java.lang.Thread.run(Thread.java:595)



Version-Release number of selected component (if applicable):
JON-2.4.1 build number: 10975:3cea406

How reproducible:
Always

Environment details:
OS: Win-2003 32bit
Java: Oracle JDK 1.5
Database: Postgres 8.4
EWS-1.0.1
Browser: IE-7 and FF-3.6.3

Steps to Reproduce:
1. Installed JON-2.4.1 and discover Apace (EWS-1.0.1)
2. Goto operations of Apache (EWS-1.0.1)
3. Perform operations like start, stop, restart, Restart Gracefully, etc.
4. Observe operation status
  
Actual results:
Apache (EWS-1.0.1) > Operation shows failed with exception - java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Expected results:
Apache (EWS-1.0.1) > Operation should completed without any error or failure. 

Additional info:
Please refer attached screenshot.

--- Additional comment from rtimaniy on 2010-12-27 08:32:09 EST ---

The bug will be tested on Apache-2.0.

--- Additional comment from skondkar on 2010-12-28 03:22:10 EST ---

Tested on JON-2.4.1 build number: 10975:3cea406 with standalone instance of apache 2.2 after installation of jon241 apache libs onto a Windows platform.

Environment details:
OS: Win-2003 32bit
Java: Oracle JDK 1.5
Database: Postgres 8.3.8
Standalone Apache 2.2
Browser: IE-7

1. Installed JON-2.4.1 on windows platform and discovered standalone instance of Apache 2.2.
2. Navigated to operations tab of Apache.
3. Performed operations like start, stop, restart, Restart Gracefully, etc.
4. Observed the same exception as below:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1768) at org.rhq.plugins.apache.ApacheServerComponent.getControlScriptPath(ApacheServerComponent.java:663) at org.rhq.plugins.apache.ApacheServerOperationsDelegate.invokeOperation(ApacheServerOperationsDelegate.java:78) at org.rhq.plugins.apache.ApacheServerComponent.invokeOperation(ApacheServerComponent.java:299) 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:592) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595)

--- Additional comment from skondkar on 2010-12-28 04:56:28 EST ---

Also tested on standalone instance of apache 2.0.64 with the rt-filter and
  snmp libs for Apache 2.0

Observed the same exception as below while performing operations like start, stop, restart etc

java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1768) at org.rhq.plugins.apache.ApacheServerComponent.getControlScriptPath(ApacheServerComponent.java:663) at org.rhq.plugins.apache.ApacheServerOperationsDelegate.invokeOperation(ApacheServerOperationsDelegate.java:78) at org.rhq.plugins.apache.ApacheServerComponent.invokeOperation(ApacheServerComponent.java:299) 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:592) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(ResourceContainer.java:525) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269) at java.util.concurrent.FutureTask.run(FutureTask.java:123) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676) at java.lang.Thread.run(Thread.java:595)

Comment 1 Lukas Krejci 2011-01-03 12:32:07 UTC
commit ff23902b5eba7b2fed45c2ec90861c53e73cc329
Author: Lukas Krejci <lkrejci>
Date:   Mon Jan 3 12:55:16 2011 +0100

    BZ 665855 - try to find the control script file only on the OSes that actually have a chance of having it.
    Be more careful about FS layout assumptions...

Comment 2 Mike Foley 2011-05-04 12:22:00 UTC
verified as follows:  RHQ 4.0 community release.  successfully scheduled and performed a variety of operations on Apache server.  reviewed server log for errors that may have occurred silently, and there were none.

Comment 3 Corey Welton 2011-05-24 01:13:57 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 4 Corey Welton 2011-05-24 01:13:57 UTC
Bookkeeping - closing bug - fixed in recent release.

Comment 5 Corey Welton 2011-05-24 01:13:58 UTC
Bookkeeping - closing bug - fixed in recent release.