title: Long.parseLong gives java.lang.NumberFormatException
body: <p>So I've tried a whole bunch of things, but I'm unable to get around this. <code>id</code> in my <code>Service</code> class is of data type <code>long</code>. I've tried to convert <code>serviceAuth</code> to long but it throws a <code>java.lang.NumberFormatException</code>. How do I fix this?</p>
  
  <pre><code>String[] serviceList = getUser.serviceList.split(",");
  
  for(String serviceAuth: serviceList) {
      Long temp = Long.parseLong(serviceAuth.toString());
      Criteria ctr = sessionFactory.getCurrentSession().createCriteria(Service.class)
                          .add(Restrictions.eq("id",temp));
  }
  </code></pre>
  
  <p><code>serviceList</code> looks like this <code>5,18,19</code>. It is loaded from a csv file. </p>
  
  <p>When I print the values in the for loop, it looks like this:</p>
  
  <pre><code>1
  2
  14
  15
  </code></pre>
  
  <p>Error report:</p>
  
  <pre><code> java.lang.NumberFormatException: For input string: ""
      java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
      java.lang.Long.parseLong(Long.java:601)
      java.lang.Long.parseLong(Long.java:631)
      org.x.y.gateway.MainController.getUsers(MainController.java:1433)
      org.x.y.gateway.MainController$$FastClassBySpringCGLIB$$6e5db2d9.invoke(&amp;lt;generated&amp;gt;)
      org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
      org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
      org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
      org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:266)
      org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
      org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
      org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
      org.x.y.gateway.MainController$$EnhancerBySpringCGLIB$$149bedb6.getUsers(&amp;lt;generated&amp;gt;)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:483)
      org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
      org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
      org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
      org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
      org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.x.y.gateway.CrossOriginRequest.doFilter(CrossOriginRequest.java:18)
  </code></pre>