Yes OQL.
Here is the exception:
ava.lang.NullPointerException
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(Unknown Source)
at org.apache.ojb.odmg.oql.OQLQueryImpl.create(Unknown Source)
at com.lawton.data.ojb.HomeDAOImpl.updateHome(HomeDAOImpl.java:187)
at com.lawton.actions.EditHomeAction.executeAction(EditHomeAction.java:81)
at com.codepuccino.framework.BaseAction.execute(BaseAction.java:62)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestPr ocessor.java:465)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java: 274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 72)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja va:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 72)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:234 7)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java :180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa lve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java :170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468 )
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 72)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.ja va:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 72)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.j ava:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java: 1125)
at java.lang.Thread.run(Thread.java:554)
Easy to reproduce, just take out the space before the word where:
"select home from " + HomeBO.class.getName() + "where homeID = $1";
instead of:
"select home from " + HomeBO.class.getName() + " where homeID = $1";
As you can see the exception doesn't tell me much except that something is null... :-(
Thanks
R
On Sunday, Feb 16, 2003, at 11:56 US/Eastern, Thomas Mahler wrote:
Hi Robert,
Your are talking about an OQL query.create(..) ?
It could be difficult to change the behaviour, as the parser used to build up the Criteria object from the query string is generated from a OQL grammar file.
Could you please post a stacktrace? Maybe I can see clearer then.
It won't be a problem to get this into 1.0 once we know what to fix...
cheers,
Thomas
Robert S. Sfeir wrote:
Hi,
Been working my way through OJB, and ran into this issue once and though won't do it again probably, it would be good if there was a better exception thrown for it. The issue is that I wrote my query like this:
String sql = "select homes from " + HomeBO.class.getName();
sql += "where name = $1";
At first glance things look ok, but they're not, there is no space before the where. Now we all write code fast and miss little things like that. The issue I have is that the error thrown is a NullPointerException. In my mind I was thinking maybe the value of $1 was null and that's why it was throwing that, thereby sending me into a witch hunt, whereas in fact the issue is that HomeBO.class.getName() + where does not translate into the proper class name.
Since the exception is thrown when I do query.create(sql) It would be much better if the error thrown was a ClassNotFoundException, plus the class name, instead of an NPE. Is that possible to get? This way if the String of the class name printed to the error line returns as com.codepuccino.data.ojb.HomeImplwhere we know immediately that we missed a space somewhere.
Thanks
R
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
