[
https://issues.apache.org/jira/browse/OOZIE-1101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13526043#comment-13526043
]
Robert Kanter commented on OOZIE-1101:
--------------------------------------
It was hard to follow the code, so I just wrote something quick to test it.
You're right, it will do something like toString() on the Exception. The
output is slightly different though (in my test, I tried to read a file that
didn't exist and used E0011):
{{throw new XException(ErrorCode.E0011, ioe);}} produces:
{code}
org.apache.oozie.XException: E0011: Log4j file must be a file name
[java.io.FileNotFoundException: /does/not/exist (No such file or directory)]
at blah blah
...
Caused by: java.io.FileNotFoundException: /does/not/exist (No such file or
directory)
at blah blah
...
{code}
and {{throw new XException(ErrorCode.E0011, ioe.getMessage(), ioe);}} produces:
{code}
org.apache.oozie.XException: E0011: Log4j file must be a file name
[/does/not/exist (No such file or directory)]
at blah blah
...
Caused by: java.io.FileNotFoundException: /does/not/exist (No such file or
directory)
at blah blah
...
{code}
While they're basically the same so its not a huge deal, I'd be inclined to go
with putting {{.getMessage()}} (the second example) because:
1) The fields in the error messages are usually used for values, not Exception
types; plus, the Exception type is shown later in the stack trace, so its
redundant in the error message.
2) I think we should at least be consistent with how we do this, and most of
the time we called {{.getMessage()}}, so its simpler to add it to these (which
I've already done in the patch), than to go and find the ones that have it and
remove it.
Do you agree?
> Fix log messages that contain {0} or similar
> --------------------------------------------
>
> Key: OOZIE-1101
> URL: https://issues.apache.org/jira/browse/OOZIE-1101
> Project: Oozie
> Issue Type: Bug
> Affects Versions: trunk
> Reporter: Robert Kanter
> Assignee: Robert Kanter
> Priority: Minor
> Fix For: trunk
>
> Attachments: OOZIE-1101.patch, OOZIE-1101.patch, OOZIE-1101.patch,
> OOZIE-1101.patch
>
>
> Working on various parts of Oozie and looking at the logs, I've noticed on
> multiple occasions that the {0}, {1}, etc are sometimes still in the log
> messages. We should go through all occurrences of {0} and verify/fix them.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira