RE: getxml in XSP throws NPE if @path is invalid
Thank you! On Tue, 21 Oct 2003, Carsten Ziegeler wrote: > Hi, > > I just reverted the change. The behaviour now should be as you > descripe it. But this means, that you get your NPE again if you > don't take care of it. > > Carsten > > > -Original Message- > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 15, 2003 9:14 AM > > To: [EMAIL PROTECTED] > > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > > > > Hi Carsten, > > > > I'd say null is the way to go, no matter what @as is. Isn't empty > > DocumentFragment just like an empty string? Empty string is still a > > string, and sometimes usefull in XSP. > > > > So, returning null if: > > > > @path does not exist in the session context (or @path is an empty string) > > @path does not exits as an attribute > > > > -Tuomo > > > > On Tue, 14 Oct 2003, Carsten Ziegeler wrote: > > > > > Antonio Gallardo wrote: > > > > > > > > Antonio Gallardo dijo: > > > > > Please comment if this works for you. I am not sure if this > > will work, > > > > > since Carsten did changes in the Helperclass in order to helps you. > > > > > > > > Hi, I am again! > > > > > > > > Sometimes I am lazy! :-D But I decided to check the > > Helperclass mentioned > > > > in my last mail: > > > > > > > > The Carsten's change is if the value of @path does not exists, then > > > > instead of return null, it will return a emptry String (""). > > > > > > > > I am not sure if this will meet your request since there are > > 2 diferents > > > > objects to be returned: > > > > > > > > If there is a value at @path, then as="object" returns a > > DocumentFragment > > > > If there is NOT a value, then it will return a String "". > > > > > > > > I don't like the idea. But I am not a Java guru. I think we > > need to revert > > > > the change to allow return null again. What you think? > > > > > > > Ok, you're right. I think returning either null or an empty > > DocumentFragment > > > is the way to go. I can change it in any way, but as I'm not a > > user of XSP > > > I don't know which solution is better for developing XSP. Just tell and > > > I will change it the way you want. > > > > > > Carsten > > > > > >
RE: getxml in XSP throws NPE if @path is invalid
Hi, I just reverted the change. The behaviour now should be as you descripe it. But this means, that you get your NPE again if you don't take care of it. Carsten > -Original Message- > From: Tuomo L [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 15, 2003 9:14 AM > To: [EMAIL PROTECTED] > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > Hi Carsten, > > I'd say null is the way to go, no matter what @as is. Isn't empty > DocumentFragment just like an empty string? Empty string is still a > string, and sometimes usefull in XSP. > > So, returning null if: > > @path does not exist in the session context (or @path is an empty string) > @path does not exits as an attribute > > -Tuomo > > On Tue, 14 Oct 2003, Carsten Ziegeler wrote: > > > Antonio Gallardo wrote: > > > > > > Antonio Gallardo dijo: > > > > Please comment if this works for you. I am not sure if this > will work, > > > > since Carsten did changes in the Helperclass in order to helps you. > > > > > > Hi, I am again! > > > > > > Sometimes I am lazy! :-D But I decided to check the > Helperclass mentioned > > > in my last mail: > > > > > > The Carsten's change is if the value of @path does not exists, then > > > instead of return null, it will return a emptry String (""). > > > > > > I am not sure if this will meet your request since there are > 2 diferents > > > objects to be returned: > > > > > > If there is a value at @path, then as="object" returns a > DocumentFragment > > > If there is NOT a value, then it will return a String "". > > > > > > I don't like the idea. But I am not a Java guru. I think we > need to revert > > > the change to allow return null again. What you think? > > > > > Ok, you're right. I think returning either null or an empty > DocumentFragment > > is the way to go. I can change it in any way, but as I'm not a > user of XSP > > I don't know which solution is better for developing XSP. Just tell and > > I will change it the way you want. > > > > Carsten > > >
RE: getxml in XSP throws NPE if @path is invalid
Hi Carsten, I'd say null is the way to go, no matter what @as is. Isn't empty DocumentFragment just like an empty string? Empty string is still a string, and sometimes usefull in XSP. So, returning null if: @path does not exist in the session context (or @path is an empty string) @path does not exits as an attribute -Tuomo On Tue, 14 Oct 2003, Carsten Ziegeler wrote: > Antonio Gallardo wrote: > > > > Antonio Gallardo dijo: > > > Please comment if this works for you. I am not sure if this will work, > > > since Carsten did changes in the Helperclass in order to helps you. > > > > Hi, I am again! > > > > Sometimes I am lazy! :-D But I decided to check the Helperclass mentioned > > in my last mail: > > > > The Carsten's change is if the value of @path does not exists, then > > instead of return null, it will return a emptry String (""). > > > > I am not sure if this will meet your request since there are 2 diferents > > objects to be returned: > > > > If there is a value at @path, then as="object" returns a DocumentFragment > > If there is NOT a value, then it will return a String "". > > > > I don't like the idea. But I am not a Java guru. I think we need to revert > > the change to allow return null again. What you think? > > > Ok, you're right. I think returning either null or an empty DocumentFragment > is the way to go. I can change it in any way, but as I'm not a user of XSP > I don't know which solution is better for developing XSP. Just tell and > I will change it the way you want. > > Carsten >
RE: getxml in XSP throws NPE if @path is invalid
Thanks, sounds like a solution. I'll give it a try! :) -Tuomo On Tue, 14 Oct 2003, Antonio Gallardo wrote: > Tuomo L dijo: > > Here's the line of code, that gives the error (No error, if > > /authentication/data/bar/ is actually available. The "data" section is > > created dynamically for every user, so "bar" is not always there and > > error happens) > > > > String foo = > path="/authentication/data/bar"/>; > > Hi Tuomo: > > There is another attribute that can help you: > > as="string" (default) - returns the value of the given path as a String. > > as="object" returns the value of the given path as an Object > (org.w3c.dom.DocumentFragment). > > as="xml" returns the value of the given path as an > org.w3c.dom.DocumentFragment. The root of the DocumentFragment is > . > > Are you tried this attribute? Maybe it can helps you. > > The idea of the default as="string" is to let you add easily inside your > XSP some strings. We are using to show the user name in a welcome page. > Example: > > Hipath="/authentication/data/full_name"/>, welcome back to the System > > Of course in this example the @path always exists, so we don't need to > test if the @path exists in the given session context. > > So, I recommend you use as="object", get the object and if the object is > null, then there is nothing. Else the path exists so you can get the > string. > > Please comment if this works for you. I am not sure if this will work, > since Carsten did changes in the Helperclass in order to helps you. > > Best Regards, > > Antonio Gallardo. > > >
RE: getxml in XSP throws NPE if @path is invalid
Antonio Gallardo wrote: > > Antonio Gallardo dijo: > > Please comment if this works for you. I am not sure if this will work, > > since Carsten did changes in the Helperclass in order to helps you. > > Hi, I am again! > > Sometimes I am lazy! :-D But I decided to check the Helperclass mentioned > in my last mail: > > The Carsten's change is if the value of @path does not exists, then > instead of return null, it will return a emptry String (""). > > I am not sure if this will meet your request since there are 2 diferents > objects to be returned: > > If there is a value at @path, then as="object" returns a DocumentFragment > If there is NOT a value, then it will return a String "". > > I don't like the idea. But I am not a Java guru. I think we need to revert > the change to allow return null again. What you think? > Ok, you're right. I think returning either null or an empty DocumentFragment is the way to go. I can change it in any way, but as I'm not a user of XSP I don't know which solution is better for developing XSP. Just tell and I will change it the way you want. Carsten
RE: getxml in XSP throws NPE if @path is invalid
Antonio Gallardo dijo: > Please comment if this works for you. I am not sure if this will work, > since Carsten did changes in the Helperclass in order to helps you. Hi, I am again! Sometimes I am lazy! :-D But I decided to check the Helperclass mentioned in my last mail: The Carsten's change is if the value of @path does not exists, then instead of return null, it will return a emptry String (""). I am not sure if this will meet your request since there are 2 diferents objects to be returned: If there is a value at @path, then as="object" returns a DocumentFragment If there is NOT a value, then it will return a String "". I don't like the idea. But I am not a Java guru. I think we need to revert the change to allow return null again. What you think? Anyway you can test the type of the object to be returned, but this is not elegant for me. Best Regards, Antonio Gallardo
RE: getxml in XSP throws NPE if @path is invalid
Tuomo L dijo: > Here's the line of code, that gives the error (No error, if > /authentication/data/bar/ is actually available. The "data" section is > created dynamically for every user, so "bar" is not always there and > error happens) > > String foo = path="/authentication/data/bar"/>; Hi Tuomo: There is another attribute that can help you: as="string" (default) - returns the value of the given path as a String. as="object" returns the value of the given path as an Object (org.w3c.dom.DocumentFragment). as="xml" returns the value of the given path as an org.w3c.dom.DocumentFragment. The root of the DocumentFragment is . Are you tried this attribute? Maybe it can helps you. The idea of the default as="string" is to let you add easily inside your XSP some strings. We are using to show the user name in a welcome page. Example: Hi , welcome back to the System Of course in this example the @path always exists, so we don't need to test if the @path exists in the given session context. So, I recommend you use as="object", get the object and if the object is null, then there is nothing. Else the path exists so you can get the string. Please comment if this works for you. I am not sure if this will work, since Carsten did changes in the Helperclass in order to helps you. Best Regards, Antonio Gallardo.
RE: getxml in XSP throws NPE if @path is invalid
Here's the line of code, that gives the error (No error, if /authentication/data/bar/ is actually available. The "data" section is created dynamically for every user, so "bar" is not always there and error happens) String foo = ; -Tuomo On Mon, 13 Oct 2003, Antonio Gallardo wrote: > Tuomo L dijo: > > Hi, > > > > I finally had the chance to try this, but now I get: > > > > java.lang.ClassCastException > > Can you show the code from where are you calling the tag? > > Antonio Gallardo > > >
RE: getxml in XSP throws NPE if @path is invalid
va:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:132) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84) at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.Cocoon.process(Cocoon.java:639) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1104) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Unknown Source) > > -Original Message- > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > Sent: Monday, October 13, 2003 12:44 PM > > To: [EMAIL PROTECTED] > > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > > > > Hi, > > > > I finally had the chance to try this, but now I get: > > > > java.lang.ClassCastException > > > > -Tuomo > > > > On Fri, 10 Oct 2003, Carsten Ziegeler wrote: > > > > > Hi, > > > > > > you have to update the session jar. > > > > > > Carsten > > > > > > > -Original Message----- > > > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > > > Sent: Friday, October 10,
RE: getxml in XSP throws NPE if @path is invalid
Tuomo L dijo: > Hi, > > I finally had the chance to try this, but now I get: > > java.lang.ClassCastException Can you show the code from where are you calling the tag? Antonio Gallardo
RE: getxml in XSP throws NPE if @path is invalid
Hi, can you please give the full stacktrace? Carsten > -Original Message- > From: Tuomo L [mailto:[EMAIL PROTECTED] > Sent: Monday, October 13, 2003 12:44 PM > To: [EMAIL PROTECTED] > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > Hi, > > I finally had the chance to try this, but now I get: > > java.lang.ClassCastException > > -Tuomo > > On Fri, 10 Oct 2003, Carsten Ziegeler wrote: > > > Hi, > > > > you have to update the session jar. > > > > Carsten > > > > > -Original Message- > > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > > Sent: Friday, October 10, 2003 4:46 PM > > > To: [EMAIL PROTECTED] > > > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > > > > > > > Thanks Carsten, I'll try it out... > > > > > > How can I update my Cocoon installation (2.1.2), with this patch? > > > Which jar do I need to update and how? (Haven't done this before) :| > > > > > > BTW, The build seems to be broken right now... > > > > > > -Tuomo > > > > > > On Thu, 9 Oct 2003, Carsten Ziegeler wrote: > > > > > > > Hi, > > > > > > > > I just checked in a patch that should fix this problem. > > > > Could you please test it? > > > > > > > > Thanks > > > > Carsten > > > > > > > > > -Original Message- > > > > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > > > > Sent: Wednesday, October 08, 2003 10:26 PM > > > > > To: [EMAIL PROTECTED] > > > > > Subject: getxml in XSP throws NPE if @path is invalid > > > > > > > > > > > > > > > Hi, > > > > > > > > > > This gives me a nasty NPE in XSP: > > > > > > > > > > String foo = > > > > path="/authentication/data/bar"/>; > > > > > > > > > > This does not: > > > > > > > > > > String foo = > > > > path="/authentication/ID"/>; > > > > > > > > > > Shouldn't it return null, if the given path is not > available? It seems > > > > > that there's a bug. Could someone please fix this? I didn't > > > find the cause > > > > > to this by looking at the code. > > > > > > > > > > Using Cocoon-2.1.2. > > > > > > > > > > Thanks, > > > > > Tuomo > > > > > > > > > > > > > > >
RE: getxml in XSP throws NPE if @path is invalid
Hi, I finally had the chance to try this, but now I get: java.lang.ClassCastException -Tuomo On Fri, 10 Oct 2003, Carsten Ziegeler wrote: > Hi, > > you have to update the session jar. > > Carsten > > > -Original Message- > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > Sent: Friday, October 10, 2003 4:46 PM > > To: [EMAIL PROTECTED] > > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > > > > Thanks Carsten, I'll try it out... > > > > How can I update my Cocoon installation (2.1.2), with this patch? > > Which jar do I need to update and how? (Haven't done this before) :| > > > > BTW, The build seems to be broken right now... > > > > -Tuomo > > > > On Thu, 9 Oct 2003, Carsten Ziegeler wrote: > > > > > Hi, > > > > > > I just checked in a patch that should fix this problem. > > > Could you please test it? > > > > > > Thanks > > > Carsten > > > > > > > -Original Message- > > > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > > > Sent: Wednesday, October 08, 2003 10:26 PM > > > > To: [EMAIL PROTECTED] > > > > Subject: getxml in XSP throws NPE if @path is invalid > > > > > > > > > > > > Hi, > > > > > > > > This gives me a nasty NPE in XSP: > > > > > > > > String foo = > > > path="/authentication/data/bar"/>; > > > > > > > > This does not: > > > > > > > > String foo = > > > path="/authentication/ID"/>; > > > > > > > > Shouldn't it return null, if the given path is not available? It seems > > > > that there's a bug. Could someone please fix this? I didn't > > find the cause > > > > to this by looking at the code. > > > > > > > > Using Cocoon-2.1.2. > > > > > > > > Thanks, > > > > Tuomo > > > > > > > > > >
RE: getxml in XSP throws NPE if @path is invalid
Hi, you have to update the session jar. Carsten > -Original Message- > From: Tuomo L [mailto:[EMAIL PROTECTED] > Sent: Friday, October 10, 2003 4:46 PM > To: [EMAIL PROTECTED] > Subject: RE: getxml in XSP throws NPE if @path is invalid > > > Thanks Carsten, I'll try it out... > > How can I update my Cocoon installation (2.1.2), with this patch? > Which jar do I need to update and how? (Haven't done this before) :| > > BTW, The build seems to be broken right now... > > -Tuomo > > On Thu, 9 Oct 2003, Carsten Ziegeler wrote: > > > Hi, > > > > I just checked in a patch that should fix this problem. > > Could you please test it? > > > > Thanks > > Carsten > > > > > -Original Message- > > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > > Sent: Wednesday, October 08, 2003 10:26 PM > > > To: [EMAIL PROTECTED] > > > Subject: getxml in XSP throws NPE if @path is invalid > > > > > > > > > Hi, > > > > > > This gives me a nasty NPE in XSP: > > > > > > String foo = > > path="/authentication/data/bar"/>; > > > > > > This does not: > > > > > > String foo = > > path="/authentication/ID"/>; > > > > > > Shouldn't it return null, if the given path is not available? It seems > > > that there's a bug. Could someone please fix this? I didn't > find the cause > > > to this by looking at the code. > > > > > > Using Cocoon-2.1.2. > > > > > > Thanks, > > > Tuomo > > > > > >
RE: getxml in XSP throws NPE if @path is invalid
Thanks Carsten, I'll try it out... How can I update my Cocoon installation (2.1.2), with this patch? Which jar do I need to update and how? (Haven't done this before) :| BTW, The build seems to be broken right now... -Tuomo On Thu, 9 Oct 2003, Carsten Ziegeler wrote: > Hi, > > I just checked in a patch that should fix this problem. > Could you please test it? > > Thanks > Carsten > > > -Original Message- > > From: Tuomo L [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 08, 2003 10:26 PM > > To: [EMAIL PROTECTED] > > Subject: getxml in XSP throws NPE if @path is invalid > > > > > > Hi, > > > > This gives me a nasty NPE in XSP: > > > > String foo = > path="/authentication/data/bar"/>; > > > > This does not: > > > > String foo = > path="/authentication/ID"/>; > > > > Shouldn't it return null, if the given path is not available? It seems > > that there's a bug. Could someone please fix this? I didn't find the cause > > to this by looking at the code. > > > > Using Cocoon-2.1.2. > > > > Thanks, > > Tuomo > > >
RE: getxml in XSP throws NPE if @path is invalid
Carsten Ziegeler dijo: > Hi, > > I just checked in a patch that should fix this problem. > Could you please test it? Thanks Carsten, I am really busy with the OJB block. Antonio Gallardo
RE: getxml in XSP throws NPE if @path is invalid
Hi, I just checked in a patch that should fix this problem. Could you please test it? Thanks Carsten > -Original Message- > From: Tuomo L [mailto:[EMAIL PROTECTED] > Sent: Wednesday, October 08, 2003 10:26 PM > To: [EMAIL PROTECTED] > Subject: getxml in XSP throws NPE if @path is invalid > > > Hi, > > This gives me a nasty NPE in XSP: > > String foo = path="/authentication/data/bar"/>; > > This does not: > > String foo = path="/authentication/ID"/>; > > Shouldn't it return null, if the given path is not available? It seems > that there's a bug. Could someone please fix this? I didn't find the cause > to this by looking at the code. > > Using Cocoon-2.1.2. > > Thanks, > Tuomo >