tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Einfeldt" <ralph.einfe...@uptime-isc.de>
Subject AW: Bean Error
Date Mon, 01 Oct 2001 07:51:01 GMT
You should change
  if (telepon.equals("") || (telepon==null)) {
to
  if ((telepon==null) || telepon.equals("")) {

Expressions are evaluated from left to right, so if 
telepon is null you will get a NullPointerException
for telepon.equals("").

> -----Urspr√ľngliche Nachricht-----
> Von: Isak Rickyanto [mailto:iseec@telkom.net]
> Gesendet: Sonntag, 30. September 2001 10:03
> An: Tomcat User Group
> Betreff: Bean Error
> 
> 
> Hello I have a bean to manage form registration....
> 
> I think it is because nullpointerexception... (from the error 
> below) at the
> foo.FormBean1.validate .. right?
> I read the error say (FormBean1.java.52)... it means that the 
> error code in
> the line 52 right?
> the code :
> it is on line 52:    if (telepon.equals("") || (telepon==null)) {
>                           errors.put("telepon","Please enter your last
> name");
>                           telepon="";
>                           allOk=false;
>                            }
> 
> and I don't know how to solve it
> ...........
> 
> Please hellp me.......
> 
> Error: 500
> Location: /vcdshop/pendaftaran.jsp
> Internal Servlet Error:
> 
> 
> Root cause:
> java.lang.NullPointerException
>  at foo.FormBean1.validate(FormBean1.java:52) --------------> 
> it mean the
> error on line 52 of FormBean.java ... right or not?
> 
>  at
> _0002fpendaftaran_0002ejsppendaftaran_jsp_0._jspService(_0002f
> pendaftaran_00
> 02ejsppendaftaran_jsp_0.java:106)
>  at 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
> org.apache.jasper.servlet.JspServlet$JspCountedServlet.service
> (JspServlet.ja
> va:130)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service
> (JspServlet.ja
> va:282)
>  at 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:429)
>  at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>  at 
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper
> .java:405)
>  at org.apache.tomcat.core.Handler.service(Handler.java:287)
>  at 
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>  at
> org.apache.tomcat.core.ContextManager.internalService(ContextM
> anager.java:81
> 2)
>  at 
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
>  at
> org.apache.tomcat.service.http.HttpConnectionHandler.processCo
> nnection(HttpC
> onnectionHandler.java:213)
>  at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoin
> t.java:416)
>  at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPo
> ol.java:501)
>  at java.lang.Thread.run(Thread.java:484)
> 
> 
> 
> 
> 
> 
> 

Mime
View raw message