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 | |
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
5 files changed, 68 insertions, 5 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$ + } } diff --git a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp index 96f44b0f8..071a8c17d 100644 --- a/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp +++ b/org.eclipse.mylyn.bugzilla.releng/modules/bugzilla/manifests/defaultsites.pp @@ -51,25 +51,25 @@ define bugzilla::defaultsites($base = $bugzilla::bugzillaBase, $userOwner = $bug xmlrpc_enabled => false, } - bugzilla::site { "bugzilla-4.0.10": + bugzilla::site { "bugzilla-4.0.11": major => "4", minor => "0", } - bugzilla::site { "bugzilla-4.2.6": + bugzilla::site { "bugzilla-4.2.7": major => "4", minor => "2", envdefault => true, } - bugzilla::site { "bugzilla-4.2.6-bugaliases": + bugzilla::site { "bugzilla-4.2.7-bugaliases": major => "4", minor => "2", - branchTag => "bugzilla-4.2.6", + branchTag => "bugzilla-4.2.7", usebugaliases => true, } - bugzilla::site { "bugzilla-4.4": + bugzilla::site { "bugzilla-4.4.1": major => "4", minor => "4", } @@ -80,4 +80,5 @@ define bugzilla::defaultsites($base = $bugzilla::bugzillaBase, $userOwner = $bug branch => "trunk", branchTag => "trunk", } + }
\ No newline at end of file diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java index 23ab85a31..892e04fc0 100644 --- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java @@ -26,6 +26,7 @@ import org.eclipse.mylyn.bugzilla.tests.core.BugzillaFlagsTest; import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorConfigurationTest; import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorStandaloneTest; import org.eclipse.mylyn.bugzilla.tests.core.BugzillaTaskCompletionTest; +import org.eclipse.mylyn.bugzilla.tests.core.BugzillaUtilTest; import org.eclipse.mylyn.bugzilla.tests.core.BugzillaVersionTest; import org.eclipse.mylyn.bugzilla.tests.core.RepositoryConfigurationTest; import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture; @@ -74,6 +75,7 @@ public class AllBugzillaHeadlessStandaloneTests { fixture.add(BugzillaRepositoryConnectorStandaloneTest.class); fixture.add(BugzillaRepositoryConnectorConfigurationTest.class); fixture.add(BugzillaClientTest.class); + fixture.add(BugzillaUtilTest.class); // Only run these tests on > 3.2 repositories if (!fixture.getBugzillaVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_2)) { diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java new file mode 100644 index 000000000..44f4f809d --- /dev/null +++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2013 Frank Becker and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Frank Becker - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.bugzilla.tests.core; + +import junit.framework.TestCase; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.mylyn.internal.bugzilla.core.BugzillaUtil; +import org.junit.Test; + +public class BugzillaUtilTest extends TestCase { + + @Test + public void testValidTimezoneRemove() throws CoreException { + assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 +0000")); + assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 CEST")); + assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 GMT+02:00")); + } + + @Test + public void testInvalidTimezoneRemove() { + try { + BugzillaUtil.removeTimezone("2013-10-21T18:50:29"); + fail("Expected CoreException"); + } catch (CoreException e) { + assertEquals("2013-10-21T18:50:29 is not a valid time", e.getMessage()); + } + } +} |