title: SEVERE: Servlet.service() for servlet [ProfileServlet] in context with path [/Homework] threw exception java.lang.NumberFormatException: null
body: <p>I'm getting this exception and i have no idea why. It says its a number format exception is null. I have looked at other posts about this but none of them fixes my problem. My profile class is a simple class that has id username lastname age and favTeam with setters and getters and a constructor. Anyone know why this is happening?</p>
  
  <p>My Servlet</p>
  
  <pre><code>public ProfileServlet() {
      super();
  }
  
  /**
   * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
   */
  HashMap&lt;Integer, Profile&gt; team = new HashMap&lt;Integer, Profile&gt;();
  
  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
  {
      response.setContentType("application/json; charset=UTF-8");
      //String requestUrl = request.getRequestURI();
      PrintWriter out = response.getWriter(); 
  
      Profile test = new Profile();
      int id;
  
      test = team.get(id = Integer.parseInt(request.getParameter("ID")));
  
      if(test != null)
      {
          out.println("ID: " + test.getId());
          out.println("name: " + test.getUsername());
          out.println("lastname: " + test.getLastname());
          out.println("age: " + test.getAge());
          out.println("favTeam: " + test.getFavTeam());
      }
      else
      {
          //ERROR
  
      }
  }
  
  /**
   * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
   */
  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
  {
      String id = request.getParameter("id");
      String age  = request.getParameter("id");
  
      int x = 0;
      if(id!=null){
        try{
          x = Integer.parseInt(id);
         }catch(Exception e){
         }
  
      }
  
      String username = request.getParameter("username");
      String lastname = request.getParameter("lastname");
      String favTeam = request.getParameter("favTeam");
  
      int numage = 0;
      if(id!=null){
        try{
          numage = Integer.parseInt(age);
         }catch(Exception e){
         }
  
      }
  
      Profile profile = new Profile(x,username,lastname,favTeam,numage);
  
      team.put(profile.getId(),profile);
  
  }
  
  }
  </code></pre>
  
  <p>My .xml</p>
  
  <pre><code> &lt;display-name&gt;Homework&lt;/display-name&gt;
  
    &lt;servlet&gt;
      &lt;servlet-name&gt;ProfileServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;ntrut.ProfileServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
  
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;ProfileServlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/profile&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
  
    &lt;/web-app&gt;
  </code></pre>