Hello,
it's possible that I have found another bug in Cocoon. Using getComponent within a JavaFlow causes a cryptical exception. I wrote an example using Cocoon 2.1.6 which doesn't work. Can someone please verify whether it is really a bug or just a mistake of mine?
# The Component Interface:
package foo.bar;
public interface TestComponent {
public static final String ROLE = TestComponent.class.getName();
public void dummy();
}
# The component implementation:
package foo.bar;
public class TestComponentImpl implements TestComponent{
public void dummy() {} }
# The component registration in cocoon.xconf:
<component role="foo.bar.TestComponent" class="foo.bar.TestComponentImpl"/>
# The TestFlow-Java class:
package foo.bar;
import org.apache.cocoon.components.flow.java.AbstractContinuable;
class TestFlow extends AbstractContinuable {
public void doFlowTest() throws Exception {
while(true) {
TestComponent component = null;
try {
component = (TestComponent)this.getComponent(TestComponent.ROLE);
} finally {this.releaseComponent(component);}
this.sendPageAndWait("somewhat");
}
}
}
The sitemap:
<?xml version="1.0" encoding="ISO-8859-1"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:flow language="java"> <map:script src="foo.bar.TestFlow"/> </map:flow>
<map:pipelines> <map:pipeline> <map:match pattern="test"> <map:call function="flowTest"/> </map:match> <map:match pattern="somewhat"> <map:read type="resource" src="test.xml"/> </map:match> </map:pipeline> </map:pipelines> </map:sitemap>
The exception I got is:
Instruction GETSTATIC constraint violated: Class 'foo.bar.TestComponent' is referenced, but cannot be loaded and resolved: 'VERIFIED_REJECTED Number of LocalVariableTable attributes of Code attribute '<CODE>' (method 'static void <clinit>()') exceeds number of local variable slots '0' ('There may be no more than one LocalVariableTable attribute per local variable in the Code attribute.'). '. InstructionHandle: 3: getstatic[178](3) 23 Execution Frame: Local Variables: 0: foo.bar.TestFlow 1: <null object> 2: <unknown object> 3: <unknown object> OperandStack: Slots used: 1 MaxStack: 2. foo.bar.TestFlow (Size: 1) Execution flow: 0: aconst_null [InstructionContext] 1: astore_1 [InstructionContext] 2: aload_0 [InstructionContext] 3: getstatic 23 [InstructionContext]
Thank you.
Regards Stephan