fixed some more bad handling of byte[]

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5865 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 1bcc1450cb
commit 09987e93fd

@ -97,7 +97,7 @@ public class IndexControlRWIs_p {
} }
if (post.containsKey("keyhashsearch")) { if (post.containsKey("keyhashsearch")) {
if (keystring.length() == 0 || !Word.word2hash(keystring).equals(keyhash)) { if (keystring.length() == 0 || !new String(Word.word2hash(keystring)).equals(new String(keyhash))) {
prop.put("keystring", "<not possible to compute word from hash>"); prop.put("keystring", "<not possible to compute word from hash>");
} }
final plasmaSearchRankingProcess ranking = plasmaSearchAPI.genSearchresult(prop, sb, keyhash, null); final plasmaSearchRankingProcess ranking = plasmaSearchAPI.genSearchresult(prop, sb, keyhash, null);
@ -171,7 +171,7 @@ public class IndexControlRWIs_p {
} }
if (post.containsKey("urllist")) { if (post.containsKey("urllist")) {
if (keystring.length() == 0 || !Word.word2hash(keystring).equals(keyhash)) { if (keystring.length() == 0 || !new String(Word.word2hash(keystring)).equals(new String(keyhash))) {
prop.put("keystring", "<not possible to compute word from hash>"); prop.put("keystring", "<not possible to compute word from hash>");
} }
final Bitfield flags = plasmaSearchAPI.compileFlags(post); final Bitfield flags = plasmaSearchAPI.compileFlags(post);
@ -182,7 +182,7 @@ public class IndexControlRWIs_p {
// transfer to other peer // transfer to other peer
if (post.containsKey("keyhashtransfer")) try { if (post.containsKey("keyhashtransfer")) try {
if (keystring.length() == 0 || !Word.word2hash(keystring).equals(keyhash)) { if (keystring.length() == 0 || !new String(Word.word2hash(keystring)).equals(new String(keyhash))) {
prop.put("keystring", "<not possible to compute word from hash>"); prop.put("keystring", "<not possible to compute word from hash>");
} }

@ -123,7 +123,7 @@ public class ViewImage {
// read image // read image
final Image image = ymageImageParser.parse(urlString, imgb); final Image image = ymageImageParser.parse(urlString, imgb);
if ((auth) && ((width == 0) || (height == 0)) && (maxwidth == 0) && (maxheight == 0)) return image; if (image == null || (auth && (width == 0 || height == 0) && maxwidth == 0 && maxheight == 0)) return image;
// find original size // find original size
final int h = image.getHeight(null); final int h = image.getHeight(null);

@ -733,7 +733,7 @@ public final class Condenser {
final String s = p.getProperty("keywords" + i); final String s = p.getProperty("keywords" + i);
final String[] l = s.split(","); final String[] l = s.split(",");
for (int j = 0; j < l.length; j++) { for (int j = 0; j < l.length; j++) {
sb.append(Word.word2hash(l[j])); sb.append(new String(Word.word2hash(l[j])));
} }
if (i < 15) sb.append(",\n"); if (i < 15) sb.append(",\n");
} }

@ -313,7 +313,7 @@ public final class plasmaSearchQuery {
"*" + this.domType + "*" + this.domType +
"*" + this.contentdom + "*" + this.contentdom +
"*" + this.zonecode + "*" + this.zonecode +
"*" + Word.word2hash(this.ranking.toExternalString()) + "*" + new String(Word.word2hash(this.ranking.toExternalString())) +
"*" + this.prefer + "*" + this.prefer +
"*" + this.urlMask + "*" + this.urlMask +
"*" + this.targetlang + "*" + this.targetlang +

@ -230,14 +230,14 @@ public class plasmaSnippetCache {
for(int k=0; k < word.length(); k++) { for(int k=0; k < word.length(); k++) {
//is character a special character? //is character a special character?
if(p4.matcher(word.substring(k,k+1)).find()) { if(p4.matcher(word.substring(k,k+1)).find()) {
if (Word.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>"; if (new String(Word.word2hash(temp)).equals(new String(h))) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
out = out + temp + htmlFilterCharacterCoding.unicode2html(word.substring(k,k+1), false); out = out + temp + htmlFilterCharacterCoding.unicode2html(word.substring(k,k+1), false);
temp = ""; temp = "";
} }
//last character //last character
else if(k == (word.length()-1)) { else if(k == (word.length()-1)) {
temp = temp + word.substring(k,k+1); temp = temp + word.substring(k,k+1);
if (Word.word2hash(temp).equals(h)) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>"; if (new String(Word.word2hash(temp)).equals(new String(h))) temp = "<b>" + htmlFilterCharacterCoding.unicode2html(temp, false) + "</b>";
out = out + temp; out = out + temp;
temp = ""; temp = "";
} }
@ -247,7 +247,7 @@ public class plasmaSnippetCache {
} }
//end contrib [MN] //end contrib [MN]
else if (Word.word2hash(word).equals(h)) word = "<b>" + htmlFilterCharacterCoding.unicode2html(word, false) + "</b>"; else if (new String(Word.word2hash(word)).equals(new String(h))) word = "<b>" + htmlFilterCharacterCoding.unicode2html(word, false) + "</b>";
word = htmlFilterCharacterCoding.unicode2html(prefix, false) word = htmlFilterCharacterCoding.unicode2html(prefix, false)
+ word + word

@ -102,7 +102,12 @@ public class serverObjects extends HashMap<String, String> implements Cloneable
* @return the previous value as String. * @return the previous value as String.
*/ */
public String put(final String key, final byte[] value) { public String put(final String key, final byte[] value) {
return this.put(key, new String(value)); //TODO: do we need an encoding method for byte[]? try {
return this.put(key, new String(value, "UTF-8"));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
} }
/** /**

@ -88,6 +88,7 @@ public class ymageICOParser {
} }
public BufferedImage getImage(final int index) { public BufferedImage getImage(final int index) {
if (imagemaps == null || index >= imagemaps.length) return null;
return imagemaps[index].image; return imagemaps[index].image;
} }

Loading…
Cancel
Save