diff options
author | Frank Becker | 2013-10-18 17:45:29 +0000 |
---|---|---|
committer | Steffen Pingel | 2013-10-23 20:55:49 +0000 |
commit | d0f959c177635edd9c5c4805c7b3d4ace3b400f7 (patch) | |
tree | 95e00a96d7b60f4a13d40b6a34000474bdffc718 /org.eclipse.mylyn.bugzilla.core | |
parent | 83f1a9c1db69b251c68a40a81eac2cc5dd1f8bc4 (diff) | |
download | org.eclipse.mylyn.tasks-d0f959c177635edd9c5c4805c7b3d4ace3b400f7.tar.gz org.eclipse.mylyn.tasks-d0f959c177635edd9c5c4805c7b3d4ace3b400f7.tar.xz org.eclipse.mylyn.tasks-d0f959c177635edd9c5c4805c7b3d4ace3b400f7.zip |
419869: Bugzilla Version update 4.5.1, 4.4.1, 4.2.7, and 4.0.11
Change-Id: I40bdc470325accc55908566f9a1573fbe6d6fabc
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=419869
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
2 files changed, 22 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java index b3d6f4cb4..b37898542 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java @@ -1600,6 +1600,9 @@ public class BugzillaClient { // Don't post any remaining non-bugzilla specific attributes continue; } + if (id.equals(BugzillaAttribute.DELTA_TS.getKey())) { + value = BugzillaUtil.removeTimezone(value); + } fields.put(id, new NameValuePair(id, value != null ? value : "")); //$NON-NLS-1$ } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java index b746a68c7..65af1d78f 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaUtil.java @@ -11,9 +11,16 @@ package org.eclipse.mylyn.internal.bugzilla.core; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskData; +import org.eclipse.osgi.util.NLS; public class BugzillaUtil { @@ -65,4 +72,16 @@ public class BugzillaUtil { String useParam = taskRepository.getProperty(property); return (useParam == null || (useParam != null && useParam.equals("true"))); //$NON-NLS-1$ } + + private static final Pattern TIME_STAMP_PATTERN = Pattern.compile( + "[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}", Pattern.CASE_INSENSITIVE); //$NON-NLS-1$ + + public static String removeTimezone(String timeWithTimezone) throws CoreException { + Matcher matcher = TIME_STAMP_PATTERN.matcher(timeWithTimezone); + if (matcher.find()) { + return matcher.group(); + } + throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, NLS.bind( + "{0} is not a valid time", timeWithTimezone))); //$NON-NLS-1$ + } } |