Author: prasanthj
Date: Tue Feb 3 18:15:28 2015
New Revision: 1656873
URL: http://svn.apache.org/r1656873
Log:
HIVE-9151: Checking s against null in TezJobMonitor#getNameWithProgress()
should be done earlier (Prasanth Jayachandran reviewed by Ashutosh Chauhan)
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java
Modified:
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java
URL:
http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java?rev=1656873&r1=1656872&r2=1656873&view=diff
==============================================================================
---
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java
(original)
+++
hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezJobMonitor.java
Tue Feb 3 18:15:28 2015
@@ -699,22 +699,25 @@ public class TezJobMonitor {
// Map 1 ..........
private String getNameWithProgress(String s, int complete, int total) {
- float percent = total == 0 ? 0.0f : (float) complete / (float) total;
- // lets use the remaining space in column 1 as progress bar
- int spaceRemaining = COLUMN_1_WIDTH - s.length() - 1;
- String trimmedVName = s;
+ String result = "";
+ if (s != null) {
+ float percent = total == 0 ? 0.0f : (float) complete / (float) total;
+ // lets use the remaining space in column 1 as progress bar
+ int spaceRemaining = COLUMN_1_WIDTH - s.length() - 1;
+ String trimmedVName = s;
- // if the vertex name is longer than column 1 width, trim it down
- // "Tez Merge File Work" will become "Tez Merge File.."
- if (s != null && s.length() > COLUMN_1_WIDTH) {
- trimmedVName = s.substring(0, COLUMN_1_WIDTH - 1);
- trimmedVName = trimmedVName + "..";
- }
+ // if the vertex name is longer than column 1 width, trim it down
+ // "Tez Merge File Work" will become "Tez Merge File.."
+ if (s.length() > COLUMN_1_WIDTH) {
+ trimmedVName = s.substring(0, COLUMN_1_WIDTH - 1);
+ trimmedVName = trimmedVName + "..";
+ }
- String result = trimmedVName + " ";
- int toFill = (int) (spaceRemaining * percent);
- for (int i = 0; i < toFill; i++) {
- result += ".";
+ result = trimmedVName + " ";
+ int toFill = (int) (spaceRemaining * percent);
+ for (int i = 0; i < toFill; i++) {
+ result += ".";
+ }
}
return result;
}