Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.6.0
-
None
-
Reviewed
Description
This code will reproduce the issue:
new TaskAttemptID().toString();
The issue is that the default constructor leaves the type null. The get() in CharTaskTypesMaps.getRepresentingCharacter() then throws an NPE on the null type key.
The simplest solution would be to only call the get() on line 288 of TaskID.java if type is not null and return some other literal otherwise. Since no part of the code is tripping on the NPE, what we choose for the literal shouldn't matter. How about "x"?
Curious, what code is trying to print an invalid task attempt ID? The only reason there's a default constructor is so something can call readFields on it. It's not a valid task ID until it's been initialized, and the next step of fixing toString is that the type converters will then say they can't convert the string back into a task attempt ID, etc.