@@ -343,17 +343,17 @@ else if (headerFound)
343343 {
344344 try
345345 {
346- String id = StringUtils . trimToNull ( extractField (line , fieldWidths , jobIdx ) );
347- if (id .equals (job .getClusterId ()))
346+ String id =extractField (line , fieldWidths , jobIdx );
347+ if (id != null && id .equals (job .getClusterId ()))
348348 {
349- statuses .add (StringUtils . trimToNull ( extractField (line , fieldWidths , stateIdx ) ));
349+ statuses .add (extractField (line , fieldWidths , stateIdx ));
350350 }
351351
352352 Map <String , Object > propsToUpdate = new HashMap <>();
353353
354354 if (hostnameIdx > -1 )
355355 {
356- String hostname = StringUtils . trimToNull ( extractField (line , fieldWidths , hostnameIdx ) );
356+ String hostname = extractField (line , fieldWidths , hostnameIdx );
357357 if (hostname != null )
358358 {
359359 if (job .getHostname () == null || !job .getHostname ().equals (hostname ))
@@ -366,7 +366,7 @@ else if (headerFound)
366366
367367 if (reqMemIdx > -1 )
368368 {
369- String val = StringUtils . trimToNull ( extractField (line , fieldWidths , reqMemIdx ) );
369+ String val = extractField (line , fieldWidths , reqMemIdx );
370370 if (val != null )
371371 {
372372 reqMem = val ;
@@ -391,10 +391,14 @@ else if (headerFound)
391391
392392 if (elapsedIdx > -1 )
393393 {
394- job . setDuration ( Integer . parseInt ( extractField (line , fieldWidths , elapsedIdx )) );
395- if (job . getDuration () != null )
394+ String durationString = extractField (line , fieldWidths , elapsedIdx );
395+ if (durationString != null )
396396 {
397- propsToUpdate .put ("duration" , job .getDuration ());
397+ job .setDuration (Integer .parseInt (durationString ));
398+ if (job .getDuration () != null )
399+ {
400+ propsToUpdate .put ("duration" , job .getDuration ());
401+ }
398402 }
399403 }
400404
@@ -408,7 +412,7 @@ else if (headerFound)
408412 {
409413 try
410414 {
411- String maxRSS = StringUtils . trimToNull ( extractField (line , fieldWidths , maxRssIdx ) );
415+ String maxRSS = extractField (line , fieldWidths , maxRssIdx );
412416 if (maxRSS != null )
413417 {
414418 double bytes = FileSizeFormatter .convertStringRepresentationToBytes (maxRSS );
@@ -493,7 +497,7 @@ private String extractField(String line, List<String> fieldWidths, int idx)
493497
494498 int end = start + fieldWidths .get (idx ).length ();
495499
496- return line .substring (start , end );
500+ return StringUtils . trimToNull ( line .substring (start , end ) );
497501 }
498502
499503 @ Override
0 commit comments