[
http://jira.jboss.com/jira/browse/JBMICROCONT-229?page=all ]
Adrian Brock closed JBMICROCONT-229.
------------------------------------
Fix Version/s: JBossMC-2.0.0.CR1
Resolution: Done
Assignee: Adrian Brock
"Alternatively, change getBeanProperties() to not call getUpperPropertyName() until
it has already determined the method is a getter or a setter."
This was the correct fix.
I added tests for other possible pathological methods names
that are not getters or setters.
"
public long a() { return 0; };
public long ab() { return 0; };
public boolean is() { return false; };
public long get() { return 0; };
public void x(long x) {}
public void xy(long xy) {}
public void set(long xy) {}
"
AbstractBeanInfoFactory throws StringIndexOutOfBoundsException for
short method names
-------------------------------------------------------------------------------------
Key: JBMICROCONT-229
URL:
http://jira.jboss.com/jira/browse/JBMICROCONT-229
Project: JBoss MicroContainer
Issue Type: Bug
Components: Container
Affects Versions: JBossMC-2.0.0.Beta7
Reporter: Brian Stansberry
Assigned To: Adrian Brock
Fix For: JBossMC-2.0.0.CR1
Creating a bean of a type that contains a method whose name is 2 chars or less results in
the following:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at java.lang.String.substring(String.java:1735)
at
org.jboss.beans.info.plugins.AbstractBeanInfoFactory.getUpperPropertyName(AbstractBeanInfoFactory.java:93)
at
org.jboss.beans.info.plugins.AbstractBeanInfoFactory.getBeanProperties(AbstractBeanInfoFactory.java:234)
at
org.jboss.beans.info.plugins.AbstractBeanInfoFactory.getBeanInfo(AbstractBeanInfoFactory.java:141)
at
org.jboss.config.plugins.AbstractConfiguration.getBeanInfo(AbstractConfiguration.java:71)
at
org.jboss.kernel.plugins.config.AbstractKernelConfig.getBeanInfo(AbstractKernelConfig.java:55)
at
org.jboss.kernel.plugins.config.AbstractKernelConfigurator.getBeanInfo(AbstractKernelConfigurator.java:65)
at
org.jboss.kernel.plugins.config.AbstractKernelConfigurator.getBeanInfo(AbstractKernelConfigurator.java:84)
at
org.jboss.kernel.plugins.dependency.PreInstallAction.installActionInternal(PreInstallAction.java:62)
at
org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135)
at
org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46)
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:327)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)
at
org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:69)
...
This is from attempt to create an instance of org.jgroups.JChannel, which includes a
method named up().
Problem is in AbstractBeanInfoFactory:
protected static String getUpperPropertyName(String name)
{
int start = 3;
if (name.startsWith("is"))
start = 2;
return name.substring(start);
}
A simple fix is to make the first line
int start = Math.min(3, name.length);
which will result in a return value of "" from name.substring(start) if name is
3 chars or less.
Alternatively, change getBeanProperties() to not call getUpperPropertyName() until it has
already determined the method is a getter or a setter.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira