Bug 780776 (SOA-3229) - StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb name shorter then 4 chars
Summary: StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb ...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: SOA-3229
Product: JBoss Enterprise SOA Platform 5
Classification: JBoss
Component: JBossESB, Deployment
Version: 5.2.0 ER1
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 5.2.0 GA,5.2.0.ER2
Assignee: tcunning
QA Contact:
URL: http://jira.jboss.org/jira/browse/SOA...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-08-01 15:46 UTC by Pavel Macik
Modified: 2011-10-07 11:01 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-10-07 11:01:53 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker SOA-3229 0 None Closed StringIndexOutOfBoundsException when deploying esb with HTTPGateway with esb name shorter then 4 chars 2012-05-03 10:03:23 UTC

Description Pavel Macik 2011-08-01 15:46:03 UTC
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 12:44:34 UTC
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 17:29:31 UTC
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 16:38:27 UTC
Link: Added: This issue is related to JBESB-3657


Comment 4 tcunning 2011-08-08 17:04:26 UTC
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 04:07:58 UTC
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 11:01:53 UTC
Verified in 520ER4


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