You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2004/04/06 03:37:18 UTC
[Javaflow] - Recalling a contianuation throws a NPE
Hi:
I am back to work. While figuring out how to implement Groovy Flow Engine
on the base of JavaFlow I meet the following error:
1-Go to calculator demo and give the value of "a" variable.
2-Send the page.
3-Copy the current URI.
4-Open a new browser window and paste the URI.
5-You got a NPE:
java.lang.NullPointerException
at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:980)
at java.lang.Float.parseFloat(Float.java:222)
at
org.apache.cocoon.samples.flow.java.CalculatorFlow.getNumber(CalculatorFlow.java:53)
at
org.apache.cocoon.samples.flow.java.CalculatorFlow.doCalculator(CalculatorFlow.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.cocoon.components.flow.java.JavaInterpreter.handleContinuation(JavaInterpreter.java:238)
at
org.apache.cocoon.components.treeprocessor.sitemap.CallFunctionNode.invoke(CallFunctionNode.java:120)
Best Regards,
Antonio Gallardo
Re: [Javaflow] - Recalling a contianuation throws a NPE
Posted by Stephan Michels <st...@apache.org>.
Am Di, den 06.04.2004 schrieb Antonio Gallardo um 13:12:
> Hi:
>
> Stephan Michels dijo:
> > Uhmm, yes, you know that you C&P the uri of an POST request? So in this
> > case all request parameters get lost, and you got a
> > NullPointerException.
>
> Yes it can look weird the idea of C&P this URI, but in the real life we
> can find similar cases. Suppose I need to send the URI to someone to view
> the same as me. i.e.: Desk support. In this case they will not see the
> same as you.
Hmm, yes, but this problem has nothing to do with the NPE. And the
javascript flow has the same problem. The problem can be solve by
sending a redirect to a new continuation id. And in this new
continuation you store the execution after processing the request
parameter of the previuos request.
> BTW, I was following the the discussion between Christopher Oliver and
> you. It is very interesting an remember us the need to know deep inside
> the used programming languages. :-D
Yes, I learned a lot by writing the javaflow.
> Are you trying to make Groovy continuations? I also want to see them work.
> I need here help in this. AFAIK, you are one of the people good know the
> Java continuation code.
No, I'm not writing Groovy continuations. I will not replace one script
language by an other script language. The reason to write the javaflow
was to use java instead of javascript.
> I am trying to make Groovy Flow Engine inside the JavaFlow Block. Because
> thy are too close and I think they can share the same continuation base. I
> already configured the Groovy calculator sample. Not sure if it will work,
> but it is just a initial draft. If you want, I can post the code to the
> CVS.
Hmm, why not, but then you should add another directory like
org/apache/cocoon/components/flow/groovy
> I also copied the JavaInterpreted to GroovyInterpreted and changed some
> little things inside, nothing important, but work needed to be done too
> :-D
>
> I was reviewing the continuation code to identify the insertion point once
> the Groovy class was compiled and loaded in memory. My idea is to write
> additional method in "ContinuationClassLoader" to load the requiered
> Groovy class.
I try to assemble a different concept in my head. Something I call
ClassLoaderPipelines. So, you can conect different ClassLoader for
example:
ReloadingClassLoader -> CompilingClassLoader -> GroovyClassLoader ->
ContinuationClassLoader
To make this possible you must replace findResource() instead of
loadClass(), because you can't uncompile classes, change them, define
them.
> 1-"Classes" - Classes are defined in Groovy similarly to Java.
> 2-"Scripts" - Groovy support plain scripts (as the Javascript case).
>
> Not sure how it will work under both, but I think we need to support both.
> Maybe I am breaking my head with this without a valid reason, but this is
> the price for not not know the internals of JavaFlow block. :-(
The instrumention of the classes by the ContinuationClassLoader should
be interesting. The instrumented classes should also work without
that any Continuation is registered for the current Thread.
> Are you willing to give me a hand? :-D
Yes, will help you as much as I can.
Stephan.
Re: [Javaflow] - Recalling a contianuation throws a NPE
Posted by Brian McCallister <br...@apache.org>.
I would highly suggest dropping in on #groovy on irc.codehaus.org for
any assistance on the best way to plug it into Groovy, though I
strongly suspect that a number of people there would jump on the chance
to put continuations in the normal groovy distro -- and at least one of
the people who regularly hangs out there has (sort of) implemented
continuations in java (Geert Bevin).
It is quite possible that adding continuation support directly into the
GroovyClassLoader would be very acceptable to them, or at a minimum,
removing any problems with setting the continuation class loader for
JavaFlow as a the upstream class loader would be happily cleared by the
people who know the language best =)
-Brian
On Apr 6, 2004, at 7:12 AM, Antonio Gallardo wrote:
> Hi:
>
> Stephan Michels dijo:
>> Uhmm, yes, you know that you C&P the uri of an POST request? So in
>> this
>> case all request parameters get lost, and you got a
>> NullPointerException.
>
> Yes it can look weird the idea of C&P this URI, but in the real life we
> can find similar cases. Suppose I need to send the URI to someone to
> view
> the same as me. i.e.: Desk support. In this case they will not see the
> same as you.
>
> BTW, I was following the the discussion between Christopher Oliver and
> you. It is very interesting an remember us the need to know deep inside
> the used programming languages. :-D
>
> Are you trying to make Groovy continuations? I also want to see them
> work.
> I need here help in this. AFAIK, you are one of the people good know
> the
> Java continuation code.
>
> I am trying to make Groovy Flow Engine inside the JavaFlow Block.
> Because
> thy are too close and I think they can share the same continuation
> base. I
> already configured the Groovy calculator sample. Not sure if it will
> work,
> but it is just a initial draft. If you want, I can post the code to the
> CVS.
>
> I also copied the JavaInterpreted to GroovyInterpreted and changed some
> little things inside, nothing important, but work needed to be done too
> :-D
>
> I was reviewing the continuation code to identify the insertion point
> once
> the Groovy class was compiled and loaded in memory. My idea is to write
> additional method in "ContinuationClassLoader" to load the requiered
> Groovy class.
>
> Also there is meet another interesting issue. Under "Dynamically
> loading
> and running Groovy code inside Java" in:
> http://groovy.codehaus.org/embedding.html
>
> While loading Groovy class we also need to know that a Groovy class
> can be
> of both types defined. See in http://groovy.codehaus.org/classes.html
>
> 1-"Classes" - Classes are defined in Groovy similarly to Java.
> 2-"Scripts" - Groovy support plain scripts (as the Javascript case).
>
> Not sure how it will work under both, but I think we need to support
> both.
> Maybe I am breaking my head with this without a valid reason, but this
> is
> the price for not not know the internals of JavaFlow block. :-(
>
> Are you willing to give me a hand? :-D
>
> Best Regards,
>
> Antonio Gallardo
>
>
Re: [Javaflow] - Recalling a contianuation throws a NPE
Posted by Antonio Gallardo <ag...@agssa.net>.
Hi:
Stephan Michels dijo:
> Uhmm, yes, you know that you C&P the uri of an POST request? So in this
> case all request parameters get lost, and you got a
> NullPointerException.
Yes it can look weird the idea of C&P this URI, but in the real life we
can find similar cases. Suppose I need to send the URI to someone to view
the same as me. i.e.: Desk support. In this case they will not see the
same as you.
BTW, I was following the the discussion between Christopher Oliver and
you. It is very interesting an remember us the need to know deep inside
the used programming languages. :-D
Are you trying to make Groovy continuations? I also want to see them work.
I need here help in this. AFAIK, you are one of the people good know the
Java continuation code.
I am trying to make Groovy Flow Engine inside the JavaFlow Block. Because
thy are too close and I think they can share the same continuation base. I
already configured the Groovy calculator sample. Not sure if it will work,
but it is just a initial draft. If you want, I can post the code to the
CVS.
I also copied the JavaInterpreted to GroovyInterpreted and changed some
little things inside, nothing important, but work needed to be done too
:-D
I was reviewing the continuation code to identify the insertion point once
the Groovy class was compiled and loaded in memory. My idea is to write
additional method in "ContinuationClassLoader" to load the requiered
Groovy class.
Also there is meet another interesting issue. Under "Dynamically loading
and running Groovy code inside Java" in:
http://groovy.codehaus.org/embedding.html
While loading Groovy class we also need to know that a Groovy class can be
of both types defined. See in http://groovy.codehaus.org/classes.html
1-"Classes" - Classes are defined in Groovy similarly to Java.
2-"Scripts" - Groovy support plain scripts (as the Javascript case).
Not sure how it will work under both, but I think we need to support both.
Maybe I am breaking my head with this without a valid reason, but this is
the price for not not know the internals of JavaFlow block. :-(
Are you willing to give me a hand? :-D
Best Regards,
Antonio Gallardo
Re: [Javaflow] - Recalling a contianuation throws a NPE
Posted by Stephan Michels <st...@apache.org>.
Am Di, den 06.04.2004 schrieb Antonio Gallardo um 3:37:
> Hi:
>
> I am back to work. While figuring out how to implement Groovy Flow Engine
> on the base of JavaFlow I meet the following error:
>
> 1-Go to calculator demo and give the value of "a" variable.
> 2-Send the page.
> 3-Copy the current URI.
> 4-Open a new browser window and paste the URI.
> 5-You got a NPE:
>
> java.lang.NullPointerException
> at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:980)
> at java.lang.Float.parseFloat(Float.java:222)
Uhmm, yes, you know that you C&P the uri of an POST request? So in this
case all request parameters get lost, and you got a
NullPointerException.
BTW, thank you for the formating of the javaflow code.
Stephan.