NullPointerException on using java.util.Scanner

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using below piece of code to parse text data by using java.util.Scanner
class-

Scanner scannner = new Scanner(upLoadFile.getInputStream());

              while(scannner.hasNextLine()){
                  licenseKey.append(scannner.nextLine());
              }
              scannner.close();

But i am getting following exception on invoking hasNextLine API on Scanner
object -

java.lang.NullPointerException
   at java.util.regex.Matcher.toMatchResult(Matcher.java:606)
   at java.util.Scanner.myCoreNext(Scanner.java:1706)
   at java.util.Scanner.myPrepareForNext(Scanner.java:2182)
   at java.util.Scanner.myNextLine(Scanner.java:2092)
   at java.util.Scanner.hasNextLine(Scanner.java:781)
   at
com.ipolicynet.dm.system.beans.DmLicenseBaseInsertFormBean.validate(DmLicenseBaseInsertFormBean.java:49)
   at
org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:921)
   at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:206)
   at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
   at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
   at
com.ipolicynet.dm.common.framework.DmActionServlet.doGet(DmActionServlet.java:132)
   at
com.ipolicynet.dm.common.framework.DmActionServlet.doPost(DmActionServlet.java:147)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
   at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
   at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
   at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
   at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
   at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
   at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
   at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
   at org.mortbay.jetty.Server.handle(Server.java:324)
   at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
   at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:842)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:205)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
   at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
   at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)


Please help me in resolving above issue.
-- 
View this message in context: http://www.nabble.com/NullPointerException-on-using-java.util.Scanner-tp24091796p24091796.html
Sent from the Gnu - Classpath - General mailing list archive at Nabble.com.



[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux