On Tue, 31 May 2022 09:37:57 GMT, Tejesh R <d...@openjdk.java.net> wrote:
>>> Yeah, wanted to change to automatic, but wasn't sure about whether its ok >>> for NPE check or not. >> >> What can be wrong with it? It's just a regular test. If you can automate the >> test, you should. >> >>> Actually if the current test executes then its a pass right......? >> >> I don't understand your question, sorry. What surprises me is that the test >> fails automatically without the fix. But I can't see how the NPE is >> re-thrown on the main thread. >> >> I thought the NPE would be just printed in the jtreg log file and the tester >> wouldn't even see it. >> >> So your test is already automated to some extent. What we want is to make it >> pass automatically if NPE isn't thrown. >> >>> Painting it to bufferedImage and then catching NPE is required........? >> >> No, it's not, however, I think it's a more effective way than showing UI. >> The exception occurs when `paint` is called. Painting to `BufferedImage` >> gives you control when and how `paint` is called: you do it _explicitly_. So >> you wrap the call to `paint` in a try-catch block, if the exception is >> thrown you re-throw it on main thread to fail the test; if the exception >> isn't thrown, the test completed successfully. Perhaps, try-catch block >> isn't necessary, just let the exception propagate. > >> _Actually if the current test executes then its a pass right......?_ This >> means, if there is no NPE raised then its a pass case right.......? Yeah to >> some extent it is automatic, I actually didn't get how to handle the caught >> NPE, so just left it so that the Test case will be failed by NPE. Ok, then will try with the _bufferedImage paint_ logic, If I'm able to get the exception without it been handled by internal code then it'll be really helpful to make it automatic. ------------- PR: https://git.openjdk.java.net/jdk/pull/8830