Michael Peter Christen 11 years ago
parent 47b1c81d08
commit 554c0351dd

@ -90,6 +90,17 @@ public class RSSMessage implements Hit, Comparable<RSSMessage>, Comparator<RSSMe
} }
} }
private static Map<String, Token> tokenNick2Token = new HashMap<String, Token>();
static {
for (Token t: Token.values()) {
for (String nick: t.keys) tokenNick2Token.put(nick, t);
}
}
public static Token valueOfNick(String nick) {
return tokenNick2Token.get(nick);
}
private static String artificialGuidPrefix = "c0_"; private static String artificialGuidPrefix = "c0_";
private static String calculatedGuidPrefix = "c1_"; private static String calculatedGuidPrefix = "c1_";
public static final RSSMessage POISON = new RSSMessage("", "", ""); public static final RSSMessage POISON = new RSSMessage("", "", "");

@ -210,11 +210,11 @@ public class RSSReader extends DefaultHandler {
} else if (this.parsingItem) { } else if (this.parsingItem) {
final String value = this.buffer.toString().trim(); final String value = this.buffer.toString().trim();
this.buffer.setLength(0); this.buffer.setLength(0);
if (RSSMessage.tags.contains(tag) && value.length() > 0) this.item.setValue(Token.valueOf(tag), value); if (RSSMessage.tags.contains(tag) && value.length() > 0) this.item.setValue(RSSMessage.valueOfNick(tag), value);
} else if (this.parsingChannel) { } else if (this.parsingChannel) {
final String value = this.buffer.toString().trim(); final String value = this.buffer.toString().trim();
this.buffer.setLength(0); this.buffer.setLength(0);
if (RSSMessage.tags.contains(tag)) this.item.setValue(Token.valueOf(tag), value); if (RSSMessage.tags.contains(tag)) this.item.setValue(RSSMessage.valueOfNick(tag), value);
} }
} }

Loading…
Cancel
Save