throwable Questions

3

Solved

I am currently working on a stock management system. In the system there is option to register as seen below: The following code shows the register button method: btnRegister.setOnAction(e...
Ganof asked 21/5, 2020 at 4:49

2

Solved

I am catching a Throwable error. catch (Throwable t){ System.out.println(t.getCause().getMessage()); } When I put a breakpoint on a line System.out., and hover over (Eclipse) the t variable, ...
Pelargonium asked 7/4, 2014 at 6:1

6

Solved

I am currently using the play2 framework. I have several classes which are throwing exceptions but play2s global onError handler uses throwable instead of an exception. for example one of my clas...
Bunnybunow asked 10/9, 2012 at 20:45

6

Solved

Sometimes, I see try { } catch(Throwable e) { } And sometimes try { } catch(Exception e) { } What is the difference?
Supernova asked 16/2, 2010 at 15:49

3

Solved

I'm using gradle as the JavaFX plugin. Everything works perfectly even after building and runnig the excecutable at distribution/, except with one class: CloseableHttpClient For several purposes I...
Kaitlinkaitlyn asked 13/10, 2015 at 15:21

6

Solved

I have always seen Throwable/Exception in the context of errors. But I can think of situations where it would be really nice to extend a Throwable just to break out of a stack of recursive method c...
Albers asked 1/8, 2011 at 3:22

6

How can I get the error code from the Throwable? public void onFailure(Throwable exception) { } I saw that we can get the error messages, LocalizedMessage, etc.
Beckford asked 28/6, 2017 at 8:41

14

Solved

Is it a bad practice to catch Throwable? For example something like this: try { // Some code } catch(Throwable e) { // handle the exception } Is this a bad practice or we should be as specifi...
Pya asked 21/5, 2011 at 17:14

11

Solved

I'm trying to learn more about basic Java and the different types of Throwables, can someone let me know the differences between Exceptions and Errors?
Lupus asked 26/5, 2009 at 19:39

12

Solved

Given: Throwable is Exception's superclass. When I read texts on writing your own 'exceptions', I see examples of Throwable being used in the catch block and other texts show new Exception() being...
Minh asked 31/1, 2009 at 4:6

8

Solved

Effective Java (Second Edition), Item 4, discusses using private constructors to enforce noninstantiability. Here's the code sample from the book: public final class UtilityClass { private Utilit...
Rodrigues asked 29/12, 2008 at 22:44

6

Solved

I created a "producer" interface (to be used with method references, respectively to be easily mocked for unit tests): @FunctionalInterface public interface Factory<R, T, X extends Throwable&gt...
Lustreware asked 31/7, 2018 at 11:24

8

Solved

Can any of you explain what the differences are between throw, throws and Throwable and when to use which?
Tyro asked 15/10, 2010 at 7:18

1

Let's say I have my custom RuntimeException, where MyEntity is JPA @Entity: @Getter public class MyEntityAlreadyExistingException extends RuntimeException { private final MyEntity myEntity; pu...
Shaunna asked 24/1, 2018 at 10:35

8

Solved

I've got the following test: @Test(expected = IllegalStateException.class) public void testKey() { int key = 1; this.finder(key); } But JUnit reports, that the test fails, although it throws —...
Alexaalexander asked 5/4, 2011 at 10:3

5

Solved

Why does NetBeans IDE raise a flag on printing a Java stack trace? try { //try to do something there } catch (IOException e) { //handle the exception e.printStackTrace(); } For some reason th...

8

Solved

I know throw new Exception(); has a pretty large overhead, since it creates a full stackTrace, etc. Does throw new Throwable(); present the same problem? Is this behaviour inherited, or does...
Christman asked 25/1, 2010 at 1:9

1

Solved

I'd like to know the difference between handled and unhandeled Exceptions in Java. which one i should use a try/catch block and when I have to extend throwables. also, if i extend throwables, do ...
Deaconry asked 19/1, 2016 at 6:24

8

Solved

How do I print the entire stack trace using java.util.Logger? (without annoying Netbeans). The question should've originally specified staying within Java SE. Omitting that requirment was an error...

4

I can't find exact difference between NoSuchMethodException and NoSuchMethodError in Java. Could someone give explanation and example of these two things ?
Abbacy asked 14/1, 2015 at 8:42

2

Solved

What is the C# equivalent to Java's Throwable? In Java, the root of the exception class hierarchy is called Throwable, not Exception. The Throwable base class has two derived classes: Exception: ...
Divest asked 3/7, 2013 at 19:30

3

Solved

Compile time error: The generic class may not subclass java.lang.Throwable public class TestGenericClass<E> extends Exception { /*Above line will give compile error, the generic class TestG...

5

When I run this code the app exits with a ClassNotFoundException: //uncaught ClassNotFoundException try { Class<?> clazz = defineClass(null, bytes, 0, bytes.length, null); table.put(clazz....
Leastwise asked 2/4, 2013 at 1:39

15

Solved

Been doing Java for number of years so haven't been tracking C++. Has finally clause been added to C++ exception handling in the language definition? Is there a favored idiom that mimics Java's tr...
Mere asked 1/2, 2009 at 5:4

1

Solved

Possible Duplicate: JDK 1.7 Throwable `addSuppressed()` method So Java has a method in the Throwable public final void addSuppressed(Throwable exception) And this is what it does:...
Artful asked 6/12, 2012 at 18:2

© 2022 - 2024 — McMap. All rights reserved.