[ 
https://issues.apache.org/jira/browse/MAPREDUCE-6298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14550063#comment-14550063
 ] 

Lars Francke commented on MAPREDUCE-6298:
-----------------------------------------

Thanks for taking a look.

1. Usage of StringBuffer is discouraged as it's slower than StringBuilder. But 
as this is static String concatenation Java will do the correct thing under the 
hood anyway. I changed this when I thought I needed to change the generated 
String and left my changes in. Happy to submit it as a new JIRA or change the 
title of this one to something along the lines of "Clean up Job#toString & fix 
exception".

2. I don't understand. Could you elaborate? The existing test already tests the 
{{FAILED}} status. Do you want me to add another one similar to the existing 
one for {{RUNNING}}? If I got that right I'll provide a new patch.

> Job#toString throws an exception when not in state RUNNING
> ----------------------------------------------------------
>
>                 Key: MAPREDUCE-6298
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-6298
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>            Reporter: Lars Francke
>            Assignee: Lars Francke
>            Priority: Minor
>              Labels: BB2015-05-TBR
>         Attachments: MAPREDUCE-6298.1.patch, MAPREDUCE-6298.2.patch, 
> MAPREDUCE-6298.3.patch
>
>
> Job#toString calls {{ensureState(JobState.RUNNING);}} as the very first 
> thing. That method causes an Exception to be thrown which is not nice.
> One thing this breaks is usage of Job on the Scala (e.g. Spark) REPL as that 
> calls toString after every invocation and that fails every time.
> I'll attach a patch that checks state and if it's RUNNING prints the original 
> message and if not prints something else.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to