Skip to content

Instantly share code, notes, and snippets.

@Fuud
Created May 13, 2014 18:04
Show Gist options
  • Save Fuud/a7951ef9315feea90c02 to your computer and use it in GitHub Desktop.
Save Fuud/a7951ef9315feea90c02 to your computer and use it in GitHub Desktop.
TestNPE (with devirtualization)
public class TestSt{
public static String prevMessage;
public static void main(String[] args) throws Exception {
while (true){
testNpe();
}
}
public static void testNpe() throws Exception{
try{
((String)null).length();
}catch (NullPointerException e){
if (e.getMessage()==null || e.getMessage().length()==0 || !e.getMessage().equals(prevMessage)){
if (e.getMessage()!=null){
prevMessage = e.getMessage();
}
e.printStackTrace();
Thread.sleep(500);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment