Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-02-01 03:41:07 +0000
committerspingel2011-02-01 03:41:07 +0000
commit31218923fcadeca30d92c829b6146518e4db7f87 (patch)
tree1c19169a94f3976e22bf32311652212369aff0e5 /org.eclipse.mylyn.tasks.tests/src
parenta09efd4e5f647bc54ead918a78afe9b02eb3ddd6 (diff)
downloadorg.eclipse.mylyn.tasks-31218923fcadeca30d92c829b6146518e4db7f87.tar.gz
org.eclipse.mylyn.tasks-31218923fcadeca30d92c829b6146518e4db7f87.tar.xz
org.eclipse.mylyn.tasks-31218923fcadeca30d92c829b6146518e4db7f87.zip
REOPENED - bug 268456: reading of task data fails with fatal error
https://bugs.eclipse.org/bugs/show_bug.cgi?id=268456
Diffstat (limited to 'org.eclipse.mylyn.tasks.tests/src')
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataStoreTest.java15
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java15
2 files changed, 21 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataStoreTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataStoreTest.java
index e40d78f73..4b951d6ec 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataStoreTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskDataStoreTest.java
@@ -241,10 +241,19 @@ public class TaskDataStoreTest extends TestCase {
file.deleteOnExit();
storage.putTaskData(file, state);
- try {
+ if (System.getProperty("java.version").compareTo("1.5") <= 0) {
+ // Java 1.5 fails to parse C1 characters with XML 1.1
+ try {
+ TaskDataState state2 = storage.getTaskDataState(file);
+ fail("Expected CoreException, got '" + state2.getRepositoryData().getRoot().toString() + "'");
+ } catch (CoreException expected) {
+ }
+ } else {
+ // Java 1.6 is apparently able to parse C1 characters with XML 1.1
TaskDataState state2 = storage.getTaskDataState(file);
- fail("Expected CoreException, got '" + state2.getRepositoryData().getRoot().toString() + "'");
- } catch (CoreException expected) {
+ assertEquals(state.getRepositoryData().getRoot().toString(), state2.getRepositoryData()
+ .getRoot()
+ .toString());
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
index de0cbd45c..35ee29840 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/data/XmlExternalizationTest.java
@@ -80,6 +80,7 @@ public class XmlExternalizationTest extends TestCase {
}
public void testWriteandReadBadCharacterXml10() throws Exception {
+ System.err.println("= XML 1.0 =");
for (int i = 0; i < 0xFFFF; i++) {
char badChar = (char) i;
@@ -100,15 +101,15 @@ public class XmlExternalizationTest extends TestCase {
SimpleCharacterReader readHandler = new SimpleCharacterReader();
parser.setErrorHandler(new ErrorHandler() {
public void warning(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
public void fatalError(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
public void error(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
});
parser.setContentHandler(readHandler);
@@ -119,6 +120,7 @@ public class XmlExternalizationTest extends TestCase {
}
public void testWriteandReadBadCharacterXml11() throws Exception {
+ System.err.println("= XML 1.1 =");
for (int i = 0; i < 0xFFFF; i++) {
char badChar = (char) i;
@@ -139,19 +141,20 @@ public class XmlExternalizationTest extends TestCase {
SimpleCharacterReader readHandler = new SimpleCharacterReader();
parser.setErrorHandler(new ErrorHandler() {
public void warning(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
public void fatalError(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
public void error(SAXParseException exception) throws SAXException {
- exception.printStackTrace();
+ System.err.println(exception.getMessage());
}
});
parser.setContentHandler(readHandler);
parser.parse(new InputSource(new ByteArrayInputStream(out.toByteArray())));
+
char character = readHandler.getCharacter();
assertEquals(badChar, character);
}

Back to the top