Created
May 13, 2014 18:04
-
-
Save Fuud/a7951ef9315feea90c02 to your computer and use it in GitHub Desktop.
TestNPE (with devirtualization)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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