diff --git a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/helper/WorkItemUpdateHelper.java b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/helper/WorkItemUpdateHelper.java index 22ab703..7091ead 100644 --- a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/helper/WorkItemUpdateHelper.java +++ b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/helper/WorkItemUpdateHelper.java @@ -653,10 +653,10 @@ private Object getRepresentation(ParameterValue parameter, List excep isEmpty = true; } if (attribType.equals(AttributeTypes.INTEGER)) { - return Integer.getInteger(value); + return Integer.valueOf(value); } if (attribType.equals(AttributeTypes.LONG)) { - return Long.getLong(value); + return Long.valueOf(value); } if (attribType.equals(AttributeTypes.FLOAT)) { return Float.parseFloat(value); @@ -2727,9 +2727,17 @@ private void setWorkFlowAction(ParameterValue parameter) throws TeamRepositoryEx * representation like "1 hour 3 minutes" */ private long getDurationFromString(String value) { - return SimpleDateFormatUtil.convertDurationToMiliseconds(value); + long duration; + try { + duration = SimpleDateFormatUtil.convertDurationToMiliseconds(value); + } catch (Exception e) { + throw new WorkItemCommandLineException( + "can not convert duration, value was: " + value, e); + } + return duration; } - + + /** * Gets a list of Tags * diff --git a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/SimpleDateFormatUtil.java b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/SimpleDateFormatUtil.java index 571d56f..9b1d196 100644 --- a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/SimpleDateFormatUtil.java +++ b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/SimpleDateFormatUtil.java @@ -114,11 +114,11 @@ public static Long convertDurationToMiliseconds(String duration) { int hoursIndex = duration.indexOf(DURATION_HOURS); int minsIndex = duration.indexOf(DURATION_MINUTES); if (hoursIndex < 0 && minsIndex < 0) { - return Long.getLong(duration); + return Long.valueOf(duration); } if (hoursIndex > 0) { String hours = duration.substring(0, hoursIndex - 1).trim(); - time += TimeUnit.HOURS.toMillis(Long.getLong(hours)); + time += TimeUnit.HOURS.toMillis(Long.valueOf(hours)); } if (minsIndex > 0) { int start = 0; @@ -126,7 +126,7 @@ public static Long convertDurationToMiliseconds(String duration) { start = hoursIndex + DURATION_HOURS.length(); } String minutes = duration.substring(start, duration.length() - DURATION_MINUTES.length()).trim(); - time += TimeUnit.MINUTES.toMillis(Long.getLong(minutes)); + time += TimeUnit.MINUTES.toMillis(Long.valueOf(minutes)); } return time; } diff --git a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/WorkItemUtil.java b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/WorkItemUtil.java index 9d803d9..5e4f6cb 100644 --- a/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/WorkItemUtil.java +++ b/com.ibm.js.team.workitem.commandline/src/main/java/com/ibm/js/team/workitem/commandline/utils/WorkItemUtil.java @@ -38,9 +38,9 @@ public class WorkItemUtil { */ public static IWorkItem findWorkItemByID(String id, ItemProfile profile, IWorkItemCommon workitemCommon, IProgressMonitor monitor) throws TeamRepositoryException { - Integer idVal; + Integer idVal=null; try { - idVal = Integer.getInteger(id); + idVal = Integer.valueOf(id); } catch (NumberFormatException e) { throw new WorkItemCommandLineException(" WorkItem ID: Number format exception, ID is not a number: " + id); }