[JBoss JIRA] (JASSIST-207) Inconsistent Stack Map when inserting throw Expression with Java 7
by Ben Romberg (JIRA)
[ https://issues.jboss.org/browse/JASSIST-207?page=com.atlassian.jira.plugi... ]
Ben Romberg commented on JASSIST-207:
-------------------------------------
I guess this is because there is no StackMap Table to corrupt in the first place. Try it with a method using local variables. For example, using
{code}
public int test() {
int i = 1;
return i;
}
{code}
will corrupt the local variable table.
If the Javassist compiler is skipping cleaning up the local variable table or stack map table because of unreachable code, that would be a good explanation. As a library user I would then expect a BadBytecode exception to be thrown during Javassist compile-time, and not a non-related exception during class-loading time.
> Inconsistent Stack Map when inserting throw Expression with Java 7
> ------------------------------------------------------------------
>
> Key: JASSIST-207
> URL: https://issues.jboss.org/browse/JASSIST-207
> Project: Javassist
> Issue Type: Bug
> Affects Versions: 3.18.0-GA
> Reporter: Ben Romberg
> Assignee: Shigeru Chiba
> Priority: Critical
>
> I wrote a unit-test for javassist, reproducing the issue:
> {code}
> public class ThrowExpressionCorruptsStackMapTableTest extends JvstTestRoot {
> public ThrowExpressionCorruptsStackMapTableTest(String name) {
> super(name);
> }
> public void testInsertLocalVars() throws Exception {
> CtClass cc = sloader.get("test4.LocalVars");
> CtMethod m1 = cc.getDeclaredMethod("run");
> m1.insertBefore("throw new AssertionError((Object) \"assertion error\");");
> cc.writeFile();
> Object obj = make(cc.getName());
> assertEquals(10, invoke(obj, "run"));
> }
> }
> {code}
> Throws:
> java.lang.VerifyError: Expecting a stack map frame in method test4.LocalVars.run()I at offset 45
> My use-case is almost the same, inserting a "throw AssertionError(...)" expression with insertBefore. However, I get a slightly different error message:
> Stack map does not match the one at exception handler 37 in method timeofday.TimeOfDay.getSecond()I at offset 27
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1737) org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
by Tomaz Cerar (JIRA)
[ https://issues.jboss.org/browse/WFLY-1737?page=com.atlassian.jira.plugin.... ]
Tomaz Cerar updated WFLY-1737:
------------------------------
Fix Version/s: 8.0.0.Beta1
> org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
> --------------------------------------------------------------------------------------------------
>
> Key: WFLY-1737
> URL: https://issues.jboss.org/browse/WFLY-1737
> Project: WildFly
> Issue Type: Bug
> Components: Test Suite
> Affects Versions: 8.0.0.Beta1
> Reporter: Cheng Fang
> Assignee: Tomaz Cerar
> Fix For: 8.0.0.Beta1
>
>
> children is a Set<String>, but pe.getKeyValuePair() is String[], so it will always return false.
> {code}
> } else {
> if (children.contains(pe.getKeyValuePair())) {
> String name = pe.getValue();
> ModelNode value = model.get(pe.getKeyValuePair());
> ManagementResourceRegistration sub = rr.getSubModel(PathAddress.pathAddress(pe));
> Assert.assertNotNull(getComparePathAsString(stack) + " Child with name '" + name + "' not found", sub);
> if (value.isDefined()) {
> stack.push(pe);
> checkModelAgainstDefinition(value, sub, stack);
> stack.pop();
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1740) ManagedSocketBinding class Impossible cast from java.net.InetAddress to java.net.InetSocketAddress
by Cheng Fang (JIRA)
Cheng Fang created WFLY-1740:
--------------------------------
Summary: ManagedSocketBinding class Impossible cast from java.net.InetAddress to java.net.InetSocketAddress
Key: WFLY-1740
URL: https://issues.jboss.org/browse/WFLY-1740
Project: WildFly
Issue Type: Bug
Components: Server
Affects Versions: 8.0.0.Beta1
Reporter: Cheng Fang
Assignee: Emanuel Muckenhuber
Reported by FindBugs:
Impossible cast from java.net.InetAddress to java.net.InetSocketAddress
Class:
ManagedSocketBinding (org.jboss.as.network) line 55
Method:
getBindAddress (org.jboss.as.network.ManagedSocketBinding.getBindAddress())
Priority:
High Confidence Correctness
Problem classification:
Correctness (Bad casts of object references)
BC_IMPOSSIBLE_CAST (Impossible cast)
Notes:
Actual type java.net.InetAddress
Expected java.net.InetSocketAddress
Return value of Class.cast(Object)
FindBadCast2 (BC|NP)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1737) org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
by Tomaz Cerar (JIRA)
[ https://issues.jboss.org/browse/WFLY-1737?page=com.atlassian.jira.plugin.... ]
Tomaz Cerar reassigned WFLY-1737:
---------------------------------
Assignee: Tomaz Cerar (was: Kabir Khan)
> org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
> --------------------------------------------------------------------------------------------------
>
> Key: WFLY-1737
> URL: https://issues.jboss.org/browse/WFLY-1737
> Project: WildFly
> Issue Type: Bug
> Components: Test Suite
> Affects Versions: 8.0.0.Beta1
> Reporter: Cheng Fang
> Assignee: Tomaz Cerar
>
> children is a Set<String>, but pe.getKeyValuePair() is String[], so it will always return false.
> {code}
> } else {
> if (children.contains(pe.getKeyValuePair())) {
> String name = pe.getValue();
> ModelNode value = model.get(pe.getKeyValuePair());
> ManagementResourceRegistration sub = rr.getSubModel(PathAddress.pathAddress(pe));
> Assert.assertNotNull(getComparePathAsString(stack) + " Child with name '" + name + "' not found", sub);
> if (value.isDefined()) {
> stack.push(pe);
> checkModelAgainstDefinition(value, sub, stack);
> stack.pop();
> }
> }
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1739) Certain methods unconditionally invokes itself and may cause infinit loop
by Cheng Fang (JIRA)
Cheng Fang created WFLY-1739:
--------------------------------
Summary: Certain methods unconditionally invokes itself and may cause infinit loop
Key: WFLY-1739
URL: https://issues.jboss.org/browse/WFLY-1739
Project: WildFly
Issue Type: Bug
Components: Clustering
Affects Versions: 8.0.0.Beta1
Reporter: Cheng Fang
Assignee: Paul Ferraro
FindBugs found 2 instances of such recursive calls:
{code:title=org.jboss.as.clustering.msc.DelegatingServiceTarget}
@Override
public Set<ServiceListener<Object>> getListeners() {
return this.getListeners();
}
{code}
{code:title=org.wildfly.clustering.web.catalina.session.SessionFacade}
@Override
public boolean isValidInternal() {
return this.isValidInternal();
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1738) JSFSubsystemTransformers and JBossStandaloneEJBContainerProvider classes comparing ModelNode and String always returns false
by Cheng Fang (JIRA)
[ https://issues.jboss.org/browse/WFLY-1738?page=com.atlassian.jira.plugin.... ]
Cheng Fang updated WFLY-1738:
-----------------------------
Summary: JSFSubsystemTransformers and JBossStandaloneEJBContainerProvider classes comparing ModelNode and String always returns false (was: JSFSubsystemTransformers comparing ModelNode and String always returns false)
> JSFSubsystemTransformers and JBossStandaloneEJBContainerProvider classes comparing ModelNode and String always returns false
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: WFLY-1738
> URL: https://issues.jboss.org/browse/WFLY-1738
> Project: WildFly
> Issue Type: Bug
> Components: JSF
> Affects Versions: 8.0.0.Beta1
> Reporter: Cheng Fang
> Assignee: Jeff Mesnil
>
> JSFSubsystemTransformers class has the following block, FindBugs detects the equals method between ModelNode and String:
> {code}
> final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
> if (SLOT_ATTRIBUTE_NAME.equals(name)) {
> if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
> return DISCARD.transformOperation(context, address, operation);
> } else {
> return new TransformedOperation(operation,
> new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
> OperationResultTransformer.ORIGINAL_RESULT);
> }
> }
> {code}
> The same problem in another class JBossStandaloneEJBContainerProvider:
> {code}
> final ModelNode result = server.getModelControllerClient().execute(add);
> if (!result.get(OUTCOME).equals(SUCCESS)) {
> throw new EJBException(result.asString());
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1738) JSFSubsystemTransformers comparing ModelNode and String always returns false
by Cheng Fang (JIRA)
[ https://issues.jboss.org/browse/WFLY-1738?page=com.atlassian.jira.plugin.... ]
Cheng Fang updated WFLY-1738:
-----------------------------
Description:
JSFSubsystemTransformers class has the following block, FindBugs detects the equals method between ModelNode and String:
{code}
final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
if (SLOT_ATTRIBUTE_NAME.equals(name)) {
if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
return DISCARD.transformOperation(context, address, operation);
} else {
return new TransformedOperation(operation,
new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
OperationResultTransformer.ORIGINAL_RESULT);
}
}
{code}
The same problem in another class JBossStandaloneEJBContainerProvider:
{code}
final ModelNode result = server.getModelControllerClient().execute(add);
if (!result.get(OUTCOME).equals(SUCCESS)) {
throw new EJBException(result.asString());
}
{code}
was:
JSFSubsystemTransformers class has the following block, FindBugs detects the equals method between ModelNode and String:
{code}
final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
if (SLOT_ATTRIBUTE_NAME.equals(name)) {
if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
return DISCARD.transformOperation(context, address, operation);
} else {
return new TransformedOperation(operation,
new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
OperationResultTransformer.ORIGINAL_RESULT);
}
}
{code}
> JSFSubsystemTransformers comparing ModelNode and String always returns false
> ----------------------------------------------------------------------------
>
> Key: WFLY-1738
> URL: https://issues.jboss.org/browse/WFLY-1738
> Project: WildFly
> Issue Type: Bug
> Components: JSF
> Affects Versions: 8.0.0.Beta1
> Reporter: Cheng Fang
> Assignee: Jeff Mesnil
>
> JSFSubsystemTransformers class has the following block, FindBugs detects the equals method between ModelNode and String:
> {code}
> final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
> if (SLOT_ATTRIBUTE_NAME.equals(name)) {
> if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
> return DISCARD.transformOperation(context, address, operation);
> } else {
> return new TransformedOperation(operation,
> new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
> OperationResultTransformer.ORIGINAL_RESULT);
> }
> }
> {code}
> The same problem in another class JBossStandaloneEJBContainerProvider:
> {code}
> final ModelNode result = server.getModelControllerClient().execute(add);
> if (!result.get(OUTCOME).equals(SUCCESS)) {
> throw new EJBException(result.asString());
> }
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1738) JSFSubsystemTransformers comparing ModelNode and String always returns false
by Cheng Fang (JIRA)
Cheng Fang created WFLY-1738:
--------------------------------
Summary: JSFSubsystemTransformers comparing ModelNode and String always returns false
Key: WFLY-1738
URL: https://issues.jboss.org/browse/WFLY-1738
Project: WildFly
Issue Type: Bug
Components: JSF
Affects Versions: 8.0.0.Beta1
Reporter: Cheng Fang
Assignee: Jeff Mesnil
JSFSubsystemTransformers class has the following block, FindBugs detects the equals method between ModelNode and String:
{code}
final ModelNode value = operation.get(ModelDescriptionConstants.VALUE);
if (SLOT_ATTRIBUTE_NAME.equals(name)) {
if (value.isDefined() && value.equals(SLOT_DEFAULT_VALUE)) {
return DISCARD.transformOperation(context, address, operation);
} else {
return new TransformedOperation(operation,
new RejectionWithFailurePolicy(MESSAGES.invalidJSFSlotValue(value.asString())),
OperationResultTransformer.ORIGINAL_RESULT);
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1737) org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
by Cheng Fang (JIRA)
Cheng Fang created WFLY-1737:
--------------------------------
Summary: org.jboss.as.model.test.ModelTestUtils String[] is incompatible with expected argument type String
Key: WFLY-1737
URL: https://issues.jboss.org/browse/WFLY-1737
Project: WildFly
Issue Type: Bug
Components: Test Suite
Affects Versions: 8.0.0.Beta1
Reporter: Cheng Fang
Assignee: Kabir Khan
children is a Set<String>, but pe.getKeyValuePair() is String[], so it will always return false.
{code}
} else {
if (children.contains(pe.getKeyValuePair())) {
String name = pe.getValue();
ModelNode value = model.get(pe.getKeyValuePair());
ManagementResourceRegistration sub = rr.getSubModel(PathAddress.pathAddress(pe));
Assert.assertNotNull(getComparePathAsString(stack) + " Child with name '" + name + "' not found", sub);
if (value.isDefined()) {
stack.push(pe);
checkModelAgainstDefinition(value, sub, stack);
stack.pop();
}
}
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months
[JBoss JIRA] (WFLY-1736) CommandLineArgumentUsage class substring value discarded
by Cheng Fang (JIRA)
Cheng Fang created WFLY-1736:
--------------------------------
Summary: CommandLineArgumentUsage class substring value discarded
Key: WFLY-1736
URL: https://issues.jboss.org/browse/WFLY-1736
Project: WildFly
Issue Type: Bug
Components: CLI
Affects Versions: 8.0.0.Beta1
Reporter: Cheng Fang
Assignee: Alexey Loubyansky
CommandLineArgumentUsage class has a substring call but return value discarded:
{code}
if( input.get(0).length() > width ){
String tooLong = input.remove(0);
tooLong.substring(0, width-5);
input.add("Command removed. Too long.");
}
{code}
FindBugs also finds a static field should be final:
{code}
protected static List<String> instructions = new ArrayList<String>();
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
12 years, 9 months