Bug 780776 - (SOA-3229) StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb name shorter then 4 chars
StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb ...
Status: CLOSED NEXTRELEASE
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: JBossESB, Deployment (Show other bugs)
5.2.0 ER1
Unspecified Unspecified
high Severity high
: ---
: 5.2.0 GA,5.2.0.ER2
Assigned To: tcunning
http://jira.jboss.org/jira/browse/SOA...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-01 11:46 EDT by Pavel Macik
Modified: 2011-10-07 07:01 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-10-07 07:01:53 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SOA-3229 None Closed StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb name shorter then 4 chars 2012-05-03 06:03:23 EDT

  None (edit)
Description Pavel Macik 2011-08-01 11:46:03 EDT
project_key: SOA

When deploying ESB that contains a http-gateway as one of listeners of an ESB service and the archive name is shorter than 4 chars following exception is thrown.

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1937)
        at org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory.addEndpointAddress(HttpGatewayDeploymentFactory.java:89)
        at org.jboss.internal.soa.esb.listeners.war.HttpGatewayDeploymentFactory.updateWebModel(HttpGatewayDeploymentFactory.java:75)
        at org.jboss.soa.esb.listeners.config.ModelUtil.updateWebModel(ModelUtil.java:97)
        at org.jboss.soa.esb.listeners.config.WebGatewayBuilder.build(WebGatewayBuilder.java:115)
        at org.jboss.soa.esb.listeners.deployers.mc.EsbDeployment.create(EsbDeployment.java:191)
        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.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
        at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
        at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
        at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:243)
        at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
        at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:111)
        at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
        at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
        at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
        at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
        at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
        at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
        at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
        at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
        at org.jboss.system.ServiceController.start(ServiceController.java:460)
        at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
        at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
        at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
        at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
        at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
        at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
        at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
        at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
        at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
        at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
        at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
        at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
        at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
        at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
        at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)
Comment 1 Kevin Conner 2011-08-04 08:44:34 EDT
Problem line

        path = path.substring(0, path.length() - 4) + urlMapping; // remove ".war" and add urlMapping

It assumes that the ending is .war but this cannot be the case given the exception.  We need to investigate the value of the path in this example and add a check around this code.
Comment 2 Kevin Conner 2011-08-05 13:29:31 EDT
JBESB-3657 may be another symptom of this issue.

We need to check the path to see if it ends in '.war' before trying to remove it.
Comment 3 tcunning 2011-08-08 12:38:27 EDT
Link: Added: This issue is related to JBESB-3657
Comment 4 tcunning 2011-08-08 13:04:26 EDT
Committed fix to ESB - only truncate the path if it ends in .WAR.

tcunning@localhost:rosetta]$ svn commit
Sending rosetta/src/org/jboss/internal/soa/esb/listeners/war/HttpGatewayDeploymentFactory.java
Transmitting file data .
Committed revision 37369.
Comment 5 David Le Sage 2011-08-26 00:07:58 EDT
Release Notes Docs Status: Added: Documented as Resolved Issue
Writer: Added: dlesage
Release Notes Text: Added: https://issues.jboss.org/browse/SOA-3229

if the user deployed an ESB that contained an http-gateway as one of its ESB Service listeners and the archive name was less than four characters in length, an 
java.lang.StringIndexOutOfBoundsException would occur.  This was because the code was trying to strip .war file extensions, which were not applicable in this case.  The code has now been modified and, as a result, users will no longer encounter this exception.
Comment 6 Pavel Macik 2011-10-07 07:01:53 EDT
Verified in 520ER4

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