Skip to content

Commit

Permalink
Merge pull request #63 from jazz-community/Fix-conversion-CSV-import
Browse files Browse the repository at this point in the history
Fix conversion csv import
  • Loading branch information
rsjazz authored Feb 16, 2024
2 parents 3bfdf7c + 1c72f4a commit e74a085
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,10 @@ private Object getRepresentation(ParameterValue parameter, List<Exception> 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);
Expand Down Expand Up @@ -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
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ 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;
if (hoursIndex > 0) {
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public class WorkItemUtil {
*/
public static IWorkItem findWorkItemByID(String id, ItemProfile<IWorkItem> 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);
}
Expand Down

0 comments on commit e74a085

Please sign in to comment.