Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-01-05 02:58:25 +0000
committerrelves2007-01-05 02:58:25 +0000
commit074f0216ff89daa54d4007eddb46c67603ecea5b (patch)
treebb83fa56cc0a7d377a293562e73bbdcf27251233
parentc2393ba2756ba1e1784cfaa2dc47c5aacf605751 (diff)
downloadorg.eclipse.mylyn.tasks-074f0216ff89daa54d4007eddb46c67603ecea5b.tar.gz
org.eclipse.mylyn.tasks-074f0216ff89daa54d4007eddb46c67603ecea5b.tar.xz
org.eclipse.mylyn.tasks-074f0216ff89daa54d4007eddb46c67603ecea5b.zip
NEW - bug 167694: Info: "Error while parsing date field " in org.eclipse.mylar.core
https://bugs.eclipse.org/bugs/show_bug.cgi?id=167694
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java21
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java3
3 files changed, 14 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
index 6d8b8a2ef..f30d91cc7 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
@@ -80,18 +80,17 @@ public class BugzillaTaskDataHandler implements ITaskDataHandler {
private static final String DATE_FORMAT_1 = "yyyy-MM-dd HH:mm";
private static final String DATE_FORMAT_2 = "yyyy-MM-dd HH:mm:ss";
-
- private static final SimpleDateFormat delta_ts_format = new SimpleDateFormat(DATE_FORMAT_2);
-
- private static final SimpleDateFormat creation_ts_format = new SimpleDateFormat(DATE_FORMAT_1);
+
+ private static final String delta_ts_format = DATE_FORMAT_2;
+
+ private static final String creation_ts_format = DATE_FORMAT_1;
/**
* public for testing Bugzilla 2.18 uses DATE_FORMAT_1 but later versions
* use DATE_FORMAT_2 Using lowest common denominator DATE_FORMAT_1
*/
- public static final SimpleDateFormat comment_creation_ts_format = new SimpleDateFormat(DATE_FORMAT_1);
-
- private static final SimpleDateFormat attachment_creation_ts_format = new SimpleDateFormat(DATE_FORMAT_1);
+ public static final String comment_creation_ts_format = DATE_FORMAT_1;
+ private static final String attachment_creation_ts_format = DATE_FORMAT_1;
private AbstractAttributeFactory attributeFactory = new BugzillaAttributeFactory();
@@ -178,13 +177,13 @@ public class BugzillaTaskDataHandler implements ITaskDataHandler {
String mappedKey = attributeFactory.mapCommonAttributeKey(attributeKey);
Date parsedDate = null;
if (mappedKey.equals(BugzillaReportElement.DELTA_TS.getKeyString())) {
- parsedDate = delta_ts_format.parse(dateString);
+ parsedDate = new SimpleDateFormat(delta_ts_format).parse(dateString);
} else if (mappedKey.equals(BugzillaReportElement.CREATION_TS.getKeyString())) {
- parsedDate = creation_ts_format.parse(dateString);
+ parsedDate = new SimpleDateFormat(creation_ts_format).parse(dateString);
} else if (mappedKey.equals(BugzillaReportElement.BUG_WHEN.getKeyString())) {
- parsedDate = comment_creation_ts_format.parse(dateString);
+ parsedDate = new SimpleDateFormat(comment_creation_ts_format).parse(dateString);
} else if (mappedKey.equals(BugzillaReportElement.DATE.getKeyString())) {
- parsedDate = attachment_creation_ts_format.parse(dateString);
+ parsedDate = new SimpleDateFormat(attachment_creation_ts_format).parse(dateString);
}
return parsedDate;
} catch (Exception e) {
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
index ef7b868ce..6ecb16f21 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTaskTest.java
@@ -11,6 +11,7 @@
package org.eclipse.mylar.bugzilla.tests;
+import java.text.SimpleDateFormat;
import java.util.Date;
import junit.framework.TestCase;
@@ -56,7 +57,7 @@ public class BugzillaTaskTest extends TestCase {
assertNull(task.getCompletionDate());
Date now = new Date();
- String nowTimeStamp = BugzillaTaskDataHandler.comment_creation_ts_format.format(now);
+ String nowTimeStamp = new SimpleDateFormat(BugzillaTaskDataHandler.comment_creation_ts_format).format(now);
TaskComment taskComment = new TaskComment(new BugzillaAttributeFactory(), 1);
RepositoryTaskAttribute attribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_WHEN
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
index 312301401..d7ffcc6ba 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaTestUtil.java
@@ -18,6 +18,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
+import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.runtime.FileLocator;
@@ -75,7 +76,7 @@ public class BugzillaTestUtil {
TaskComment taskComment = new TaskComment(new BugzillaAttributeFactory(), 1);
RepositoryTaskAttribute attribute = attributeFactory.createAttribute(BugzillaReportElement.BUG_WHEN
.getKeyString());
- attribute.setValue(BugzillaTaskDataHandler.comment_creation_ts_format.format(new Date()));
+ attribute.setValue(new SimpleDateFormat(BugzillaTaskDataHandler.comment_creation_ts_format).format(new Date()));
taskComment.addAttribute(BugzillaReportElement.BUG_WHEN.getKeyString(), attribute);
report.addComment(taskComment);
} else {

Back to the top