Try catching it
catch (NullPointerException npe) {
npe.printStackTrace();
}
or
catch (IOException | NullPointerException npe) // you can multi-catch exceptions, java7 new feature
npe.printStackTrace();
}
Now the point is try to avoid this situation please go through this link
http://howtodoinjava.com/2013/04/05/how-to-effectively-handle-nullpointerexception-in-java/