diff options
author | Steffen Pingel | 2012-09-13 21:22:41 +0000 |
---|---|---|
committer | Steffen Pingel | 2012-09-13 21:22:41 +0000 |
commit | 6c4e1eba3c3048829d1f2a4d70dcecdc95edb91d (patch) | |
tree | dce8ac275a0830e75aa27f4860d86c88070d37b9 /org.eclipse.mylyn.trac.core | |
parent | 2ae43597001255763babb158ef43b1e96d48b166 (diff) | |
download | org.eclipse.mylyn.tasks-6c4e1eba3c3048829d1f2a4d70dcecdc95edb91d.tar.gz org.eclipse.mylyn.tasks-6c4e1eba3c3048829d1f2a4d70dcecdc95edb91d.tar.xz org.eclipse.mylyn.tasks-6c4e1eba3c3048829d1f2a4d70dcecdc95edb91d.zip |
389130: fix web tests for Trac 1.0
Change-Id: I66144790aa8d1d7a4006e9759571dbae1935af00
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=389130
Diffstat (limited to 'org.eclipse.mylyn.trac.core')
-rw-r--r-- | org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java index 307a254f8..078a16f2a 100644 --- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java +++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/client/TracWebClient.java @@ -404,8 +404,8 @@ public class TracWebClient extends AbstractTracClient { ticket.putBuiltinValue(Key.REPORTER, getText(tokenizer)); } // TODO handle custom fields - } else if (tag.getTagType() == Tag.H2 - && ("summary".equals(tag.getAttribute("class")) || "summary searchable".equals(tag.getAttribute("class")))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } else if ((tag.getTagType() == Tag.H2 && ("summary".equals(tag.getAttribute("class")) || "summary searchable".equals(tag.getAttribute("class")))) + || tag.getTagType() == Tag.SPAN && ("summary".equals(tag.getAttribute("class")))) { //$NON-NLS-1$ //$NON-NLS-2$ ticket.putBuiltinValue(Key.SUMMARY, getText(tokenizer)); } else if (tag.getTagType() == Tag.H3 && "status".equals(tag.getAttribute("class"))) { //$NON-NLS-1$ //$NON-NLS-2$ String text = getStrongText(tokenizer); @@ -436,7 +436,19 @@ public class TracWebClient extends AbstractTracClient { ticket.putBuiltinValue(Key.RESOLUTION, t.nextToken()); } } + } else if ("trac-status".equals(clazz)) { //$NON-NLS-1$ + ticket.putBuiltinValue(Key.STATUS, getText(tokenizer)); + } else if ("trac-type".equals(clazz)) { //$NON-NLS-1$ + ticket.putBuiltinValue(Key.TYPE, getText(tokenizer)); + } else if ("trac-resolution".equals(clazz)) { //$NON-NLS-1$ + String text = getText(tokenizer); + if (text.startsWith("(") && text.endsWith(")")) { //$NON-NLS-1$ //$NON-NLS-2$ + ticket.putBuiltinValue(Key.RESOLUTION, text.substring(1, text.length() - 1).trim()); + } else { + ticket.putBuiltinValue(Key.RESOLUTION, text); + } } + } // TODO parse description } @@ -483,7 +495,9 @@ public class TracWebClient extends AbstractTracClient { if (line == null) { throw new InvalidTicketException(); } - StringTokenizer t = new StringTokenizer(line, "\t"); //$NON-NLS-1$ + // the utf-8 output in Trac 1.0 starts with a byte-order mark which + // is passed to the tokenizer since it would otherwise end up in the first token + StringTokenizer t = new StringTokenizer(line, "\ufeff\t"); //$NON-NLS-1$ Key[] fields = new Key[t.countTokens()]; for (int i = 0; i < fields.length; i++) { fields[i] = Key.fromKey(t.nextToken()); @@ -583,10 +597,11 @@ public class TracWebClient extends AbstractTracClient { HtmlTag tag = (HtmlTag) token.getValue(); if (tag.getTagType() == Tag.SCRIPT) { String text = getText(tokenizer).trim(); - if (text.startsWith("var properties=")) { //$NON-NLS-1$ - if (!parseAttributesJSon(text)) { + int i = text.indexOf("var properties="); + if (i != -1) { + if (!parseAttributesJSon(text.substring(i))) { // fall back - parseAttributesTokenizer(text); + parseAttributesTokenizer(text.substring(i)); } } } |