[PATCH] jvyaml sanity: printStackTrace for client object creation exceptions
Zenaan Harkness <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Hello, here's patch #2 :)
This one adds a simple printStackTrace, around object creation time.
Without this, when a ctor or a newly-created object (I think), and a
setXXX method of such an object (I have tested - faced this problem),
throws an exception, eg a NullPointerException, the name of the
exception (eg "NullPointerException") as well as the stack trace for my
own code (the client code of jvYaml) which would normally pinpoint the
exception, is completely consumed and is not displayed to the user when
running their (my) code.
So, dumping the stack at the specified point in SafeConstructorImpl
solves this problem.
Both this and the previous patch I am using on a daily basis in my
running code.
Regards
Zen
---
src/org/jvyaml/SafeConstructorImpl.java | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/org/jvyaml/SafeConstructorImpl.java b/src/org/jvyaml/SafeConstructorImpl.java
index 33da8f5..c3e29e2 100644
--- a/src/org/jvyaml/SafeConstructorImpl.java
+++ b/src/org/jvyaml/SafeConstructorImpl.java
@@ -366,6 +366,8 @@ public class SafeConstructorImpl extends BaseConstructorImpl {
}
}
} catch(final Exception e) {
+ // to make debugging for YAML client code sane, we must dump stack:
+ e.printStackTrace();
throw new YAMLException("Can't construct a java object from class " + pref + ": " + e.toString());
}
return outp;
--
1.5.3.7.1066.g7a4a2e
--
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace