Skip to content

Commit ac762fb

Browse files
committed
Check for empty string before parsing endtime
1 parent 80ceead commit ac762fb

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/hudson/plugins/robot/model/RobotCaseResult.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,14 @@ public long getDuration() {
118118
return duration;
119119
if (elapsedtime != 0)
120120
return Double.valueOf(elapsedtime * 1000).longValue(); // convert seconds to milliseconds
121-
try{
122-
return timeDifference(this.starttime, this.endtime);
123-
} catch (ParseException e){
124-
LOGGER.warn("Couldn't parse duration for test case " + name);
125-
return 0;
121+
if (StringUtils.isNotEmpty(this.endtime)) {
122+
try {
123+
return timeDifference(this.starttime, this.endtime);
124+
} catch (ParseException e) {
125+
LOGGER.warn("Couldn't parse duration for test case " + name);
126+
}
126127
}
128+
return 0;
127129
}
128130

129131
public String getStarttime() {

0 commit comments

Comments
 (0)