Skip to content
Advertisement

Tag: exception

Handling an exception as a method argument

I am looking for a design pattern to handle Exception instances received as method arguments. To put some context into the question, I am using GWT and have various asynchronous handlers that usually come in a form similar to: So, the onFailure method receives a Throwable instance that I need to handle. Now, I have a number of exceptions I

Code in “catch” block not executing

please help me understand why:) My program reach the “try” line, but seems to skip the “catch”, Although its printing the stacktrace… I’m using JOptionPane in my catch, but also System.out.println() not working. Code: Exception: Answer There is an NullPointerException internally just before the FileNotFoundException From your log. You can make sure it from following. This code here only for

How do I put something on an FX thread?

I’m new to JavaFX (trying to move from Swing), and am trying to make a very basic window first. However, I keep getting the following runtime exception: However, looking at the JFXPanel source code, the constructor calls its initFX() method, which initializes the FX application thread. Why, then, am I getting this error, and how do I fix it? Answer

Difference between e.getMessage() and e.getLocalizedMessage()

What is the difference between the getMessage and getLocalizedMessage methods on Java exceptions? I am using these both methods to get the message thrown by the catch block while performing error handling. Both of them get me the message from the error handling, but how exactly do these two differ? I did some searching on the Internet and found this

Throw exception vs Logging

Is the following way to code good practice? Moreover, should I.. use only the logger? throw only the exception? do both? I understand that with throw I can catch the exception in another part of the callstack, but maybe additional logging has some hidden benefits and is useful as well. Answer I use both in some cases, logging and throwing

java, OutOfMemoryError: Java heap space

This class is designed to determine the language of a text; the user has to enter 4 text in english, danish, italian and latin, and then the text whose language he wants to determine. The console says I use eclipse, in Run Configurations – Arguments I wrote -Xms2g-Xmx3g. I don’t understand where is the problem. The code is Answer This

Java catch block, caught exception is not final

I am checking out the new features of Java SE7 and I am currently at this point: http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html regarding the catch multiple feature, when I came across this statement: Note: If a catch block handles more than one exception type, then the catch parameter is implicitly final. In this example, the catch parameter ex is final and therefore you cannot

Advertisement