cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Schmid <coc...@sa-lsa.com>
Subject ClassCastException when initialising String with null Value
Date Mon, 14 Jun 2004 06:46:40 GMT
I just tried to create a function inside a flowScript


...
private void doAnything(){
    String foo = null;
    FooManager manager =  (FooManager)getComponent(FooManager.ROLE);
    manager.doMyWishes(foo);
}

...

this throws an ClassCastException...

as long as the my variable is filled up later on in the function ... it 
works... (I tried something like this)

...
private void doAnything(){
    String foo = null;
    if(true)
       foo = "HELLO";
    FooManager manager =  (FooManager)getComponent(FooManager.ROLE);
    manager.doMyWishes(foo);
}
...


but if it looks like this (Variable is not filled...)
...
private void doAnything(){
    String foo = null;
    if(false)
       foo = "HELLO";
    FooManager manager =  (FooManager)getComponent(FooManager.ROLE);
    manager.doMyWishes(foo);
}
...

the same Exception is thrown...

java.lang.ClassCastException
	at org.apache.bcel.generic.InstructionFactory.createCast(InstructionFactory.java:501)
	at org.apache.cocoon.components.flow.java.ContinuationClassLoader.restoreFrame(ContinuationClassLoader.java:596)
	at org.apache.cocoon.components.flow.java.ContinuationClassLoader.rewrite(ContinuationClassLoader.java:296)
	at org.apache.cocoon.components.flow.java.ContinuationClassLoader.transform(ContinuationClassLoader.java:148)
	at org.apache.cocoon.components.flow.java.ContinuationClassLoader.loadClass(ContinuationClassLoader.java:114)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
	at org.apache.cocoon.components.flow.java.JavaInterpreter.initialize(JavaInterpreter.java:93)
	at org.apache.cocoon.components.flow.java.JavaInterpreter.callFunction(JavaInterpreter.java:130)
	at org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
	at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:103)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:49)
	at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:130)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:126)
	at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:72)
	at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:101)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:336)
	at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:277)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
	at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1098)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
	at java.lang.Thread.run(Thread.java:534)






Thanks for your help...

Andreas


Mime
View raw message