[
https://issues.apache.org/jira/browse/PIG-80?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Benjamin Francisoud updated PIG-80:
-----------------------------------
Attachment: PIG-80-generics.patch
PIG-80-generics.patch contains only 2 classes ExceptionWrapper and
ExceptionWrapperTest as a proof of concept.
I tried to use generics as explain by alan.
I improved it by using Class<Throwable> instead of a real instance of the class
(T toThrow)
But I couldn't use the static methods anymore because using a generic in class
signature prevent it.
The resulting code would look like this:
{code:java}
throw (new ExceptionWrapper<IOException>()).wrap("Deserialization error: " +
e.getMessage(), e, IOException.class);
{code}
or a more verbose version:
{code:java}
ExceptionWrapper<IOException> wrapper = new ExceptionWrapper<IOException>();
IOException ioe = wrapper.wrap("Deserialization error: " + e.getMessage(), e,
IOException.class);
throw ioe;
{code}
I'm not sure the gain we get from using generics balance the lost of
readability...
May be there is a better way to use generics but I couldn't find one :(
> Stacktrace information is lost at MapReduceLauncher.java:289
> ------------------------------------------------------------
>
> Key: PIG-80
> URL: https://issues.apache.org/jira/browse/PIG-80
> Project: Pig
> Issue Type: Bug
> Components: impl
> Affects Versions: 0.1.0
> Reporter: Benjamin Francisoud
> Priority: Minor
> Attachments: PIG-80-generics.patch, PIG-80-v01.patch,
> PIG-80-v02.patch, PIG-80-v03.patch, PIG-80-v04.patch, PIG-80-v05.patch
>
>
> {code:java}
> ...
> }catch (Exception e) {
> // Do we need different handling for different exceptions
> e.printStackTrace();
> throw new IOException(e.getMessage());
> }finally{ ...
> {code}
> in my case the sandard output is redirtected to /dev/null so
> "e.printStackTrace();" is lost.
> it should be :
> {code:java}throw new IOException(e);{code}
> no getMessage() because we loose the rest of the stacktrace
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.