Thanks for pointing that out, this change makes sense to me.  I fixed it
here https://issues.apache.org/jira/browse/AMQ-6337

On Thu, Jun 23, 2016 at 3:34 PM, Pierre Ernst <[email protected]>
wrote:

> I found an issue at these 2 lines:
>
>
> https://github.com/apache/activemq/blob/e2b4ca2c59a316be91cf391c758a10e518dd3a1f/activemq-broker/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java#L244
>
>
> https://github.com/apache/activemq/blob/e2b4ca2c59a316be91cf391c758a10e518dd3a1f/activemq-broker/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java#L256
>
> the test:
> paramTypes.length != 0
> should be replaced by:
> paramTypes.length ==1
>
> Otherwise, the code might attempt to call a constructor/setter for which
> the 1st parameter is a String (but having potentially other parameters)
> with only a single value.
>
> e.g. imagine this class:
>
> public class MyClass {
>
>   public MyClass (String s, int i) {
>   }
>
>   public MyClass (String s) {
>   }
> }
>
> Depending on the order in the bytecode, the 1st constructor (String, int)
> might be selected and the class will be initialized with constructors[i].
> newInstance(new Object[]{name}), resulting
> in java.lang.IllegalArgumentException: wrong number of arguments
>
> Hoping it helps
>
>
> --
> Pierre Ernst
>

Reply via email to