From 7120ea42f1cd2afa70ff4292b5c6d6852750399f Mon Sep 17 00:00:00 2001 From: reger Date: Sun, 15 Mar 2015 03:37:32 +0100 Subject: [PATCH] fix for path with char code > 255 (causing index out of bound exception) + test cas for it --- source/net/yacy/cora/document/id/MultiProtocolURL.java | 5 +++-- test/net/yacy/cora/document/id/MultiProtocolURLTest.java | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/net/yacy/cora/document/id/MultiProtocolURL.java b/source/net/yacy/cora/document/id/MultiProtocolURL.java index 0875aa66f..6442eddd7 100644 --- a/source/net/yacy/cora/document/id/MultiProtocolURL.java +++ b/source/net/yacy/cora/document/id/MultiProtocolURL.java @@ -487,9 +487,10 @@ public class MultiProtocolURL implements Serializable, Comparable 255 or 2-byte chars here ?) if (UNRESERVED_PATH.get(b)) { ptmp.append((char) b); } else { diff --git a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java b/test/net/yacy/cora/document/id/MultiProtocolURLTest.java index c29b9700b..e4ccb9abd 100644 --- a/test/net/yacy/cora/document/id/MultiProtocolURLTest.java +++ b/test/net/yacy/cora/document/id/MultiProtocolURLTest.java @@ -152,7 +152,9 @@ public class MultiProtocolURLTest { // teststring , expectedresult new String[]{"http://www.heise.de/newsticker/thema/%23saukontrovers", "http://www.heise.de/newsticker/thema/%23saukontrovers"}, // http://mantis.tokeek.de/view.php?id=519 new String[]{"http://www.heise.de/newsticker/thema/#saukontrovers", "http://www.heise.de/newsticker/thema/"}, - new String[]{"http://www.liferay.com/community/wiki/-/wiki/Main/Wiki+Portlet", "http://www.liferay.com/community/wiki/-/wiki/Main/Wiki+Portlet"} // http://mantis.tokeek.de/view.php?id=559 + new String[]{"http://www.liferay.com/community/wiki/-/wiki/Main/Wiki+Portlet", "http://www.liferay.com/community/wiki/-/wiki/Main/Wiki+Portlet"}, // http://mantis.tokeek.de/view.php?id=559 + new String[]{"http://de.wikipedia.org/wiki/Philippe_Ariès", "http://de.wikipedia.org/wiki/Philippe_Ari%E8s"} // utf-8 2 byte char + // new String[]{"http://de.wikipedia.org/wiki/Philippe_Ariès", "http://de.wikipedia.org/wiki/Philippe_Ari%C3%A8s"} // above formal correct for utf8 codepage }; for (String[] testString : testStrings) {