more information (BASE64)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4324 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 17 years ago
parent b3636f5ba8
commit 53367d941a

@ -155,7 +155,7 @@ public class blogBoard {
public byte[] subject() {
String m = (String) record.get("subject");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.subject()");
if (b == null) return "".getBytes();
return b;
}
@ -185,7 +185,7 @@ public class blogBoard {
public byte[] author() {
String m = (String) record.get("author");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.author()");
if (b == null) return "".getBytes();
return b;
}
@ -213,7 +213,7 @@ public class blogBoard {
public byte[] page() {
String m = (String) record.get("page");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.page()");
if (b == null) return "".getBytes();
return b;
}

@ -164,7 +164,7 @@ public class blogBoardComments {
public byte[] subject() {
String m = (String) record.get("subject");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.subject()");
if (b == null) return "".getBytes();
return b;
}
@ -196,7 +196,7 @@ public class blogBoardComments {
public byte[] author() {
String m = (String) record.get("author");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.author()");
if (b == null) return "".getBytes();
return b;
}
@ -210,7 +210,7 @@ public class blogBoardComments {
public byte[] page() {
String m = (String) record.get("page");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.page()");
if (b == null) return "".getBytes();
return b;
}

@ -195,7 +195,7 @@ public class messageBoard {
String m = (String) record.get("message");
if (m == null) return new byte[0];
record.put("read", "true");
return kelondroBase64Order.enhancedCoder.decode(m);
return kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.messageBoard.message()");
}
public boolean read() {

@ -137,7 +137,7 @@ public final class userDB {
auth=auth.trim().substring(6);
try{
auth=kelondroBase64Order.standardCoder.decodeString(auth);
auth=kelondroBase64Order.standardCoder.decodeString(auth, "de.anomic.data.userDB.proxyAuth()");
}catch(RuntimeException e){} //no valid Base64
String[] tmp=auth.split(":");
if(tmp.length == 2){

@ -184,7 +184,7 @@ public class wikiBoard {
public String author() {
String a = (String) record.get("author");
if (a == null) return "anonymous";
byte[] b = kelondroBase64Order.enhancedCoder.decode(a);
byte[] b = kelondroBase64Order.enhancedCoder.decode(a, "de.anomic.data.wikiBoard.author()");
if (b == null) return "anonymous";
return new String(b);
}
@ -192,7 +192,7 @@ public class wikiBoard {
public String reason() {
String r = (String) record.get("reason");
if (r == null) return "";
byte[] b = kelondroBase64Order.enhancedCoder.decode(r);
byte[] b = kelondroBase64Order.enhancedCoder.decode(r, "de.anomic.data.wikiBoard.reason()");
if (b == null) return "unknown";
return new String(b);
}
@ -200,7 +200,7 @@ public class wikiBoard {
public byte[] page() {
String m = (String) record.get("page");
if (m == null) return new byte[0];
byte[] b = kelondroBase64Order.enhancedCoder.decode(m);
byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.wikiBoard.page()");
if (b == null) return "".getBytes();
return b;
}
@ -246,7 +246,7 @@ public class wikiBoard {
private String getChildName() {
String c = (String) record.get("child");
if (c == null) return null;
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c);
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.getChildName()");
if (subject == null) return null;
return new String(subject);
}
@ -254,7 +254,7 @@ public class wikiBoard {
public boolean hasChild() {
String c = (String) record.get("child");
if (c == null) return false;
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c);
byte[] subject = kelondroBase64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.hasChild()");
return (subject != null);
}

@ -243,7 +243,7 @@ public class indexURLEntry {
this.word = null;
if (prop.containsKey("word")) throw new kelondroException("old database structure is not supported");
if (prop.containsKey("wi")) {
this.word = new indexRWIRowEntry(kelondroBase64Order.enhancedCoder.decodeString(prop.getProperty("wi", "")));
this.word = new indexRWIRowEntry(kelondroBase64Order.enhancedCoder.decodeString(prop.getProperty("wi", ""), "de.anomic.index.indexURLEntry.indexURLEntry()"));
}
this.ranking = 0;
}

@ -219,17 +219,17 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implement
return new String(out);
}
public final String decodeString(String in) {
public final String decodeString(String in, String info) {
try {
//return new String(decode(in), "ISO-8859-1");
return new String(decode(in), "UTF-8");
return new String(decode(in, info), "UTF-8");
} catch (java.io.UnsupportedEncodingException e) {
System.out.println("internal error in base64: " + e.getMessage());
return null;
}
}
public final byte[] decode(String in) {
public final byte[] decode(String in, String info) {
if ((in == null) || (in.length() == 0)) return new byte[0];
try {
int posIn = 0;
@ -267,7 +267,7 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implement
} catch (ArrayIndexOutOfBoundsException e) {
// maybe the input was not base64
// throw new RuntimeException("input probably not base64");
this.log.logFine("wrong string receive: [" + in + "]");
this.log.logFine("wrong string receive: " + in + ", call: " + info);
return new byte[0];
}
}
@ -395,7 +395,17 @@ public class kelondroBase64Order extends kelondroAbstractOrder<byte[]> implement
}
if (s[0].equals("-ds")) {
// generate a b64 decoding from a given string
System.out.println(b64.decodeString(s[1]));
System.out.println(b64.decodeString(s[1], ""));
}
}
public byte[] decode(String in) {
// TODO Auto-generated method stub
return null;
}
public String decodeString(String in) {
// TODO Auto-generated method stub
return null;
}
}

@ -45,7 +45,7 @@ public class kelondroBitfield implements Cloneable {
public kelondroBitfield(int bytelength, String exported) {
// imports a b64-encoded bitfield
byte[] b = kelondroBase64Order.enhancedCoder.decode(exported);
byte[] b = kelondroBase64Order.enhancedCoder.decode(exported, "de.anomic.kelondro.kelondroBitfield.kelondroBitfield(...)");
if (b.length == bytelength) {
bb = b;
} else {

@ -820,7 +820,7 @@ public class kelondroCollectionIndex {
newcommon.sort();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
String filename = serverCodings.encodeHex(kelondroBase64Order.enhancedCoder.decode(new String(key))) + "_" + formatter.format(new Date()) + ".collection";
String filename = serverCodings.encodeHex(kelondroBase64Order.enhancedCoder.decode(new String(key), "de.anomic.kelondro.kelondroCollectionIndex.shrinkCollection(...)")) + "_" + formatter.format(new Date()) + ".collection";
File storagePath = new File(commonsPath, filename.substring(0, 2)); // make a subpath
storagePath.mkdirs();
File file = new File(storagePath, filename);

@ -122,8 +122,8 @@ public class crypt {
if (encoded == null || encoded.length() < 3) { return null; }
if (encoded.charAt(1) != '|') { return encoded; } // not encoded
switch (encoded.charAt(0)) {
case 'b' : return kelondroBase64Order.enhancedCoder.decodeString(encoded.substring(2));
case 'z' : return gzip.gunzipString(kelondroBase64Order.enhancedCoder.decode(encoded.substring(2)));
case 'b' : return kelondroBase64Order.enhancedCoder.decodeString(encoded.substring(2), "de.anomic.tools.crypt.simpleDecode()");
case 'z' : return gzip.gunzipString(kelondroBase64Order.enhancedCoder.decode(encoded.substring(2), "de.anomic.tools.crypt.simpleDecode()"));
case 'p' : return encoded.substring(2);
default : return null;
}

@ -406,7 +406,7 @@ public class yacySeed {
* @return the octal representation of the given base64 hash
*/
public static String b64Hash2octalHash(String b64Hash) {
return serverCodings.encodeOctal(kelondroBase64Order.enhancedCoder.decode(b64Hash));
return serverCodings.encodeOctal(kelondroBase64Order.enhancedCoder.decode(b64Hash, "de.anomic.yacy.yacySeed.b64Hash2octalHash()"));
}
/**
@ -416,7 +416,7 @@ public class yacySeed {
*/
public static String b64Hash2hexHash(String b64Hash) {
// the hash string represents 12 * 6 bit = 72 bits. This is too much for a long integer.
return serverCodings.encodeHex(kelondroBase64Order.enhancedCoder.decode(b64Hash));
return serverCodings.encodeHex(kelondroBase64Order.enhancedCoder.decode(b64Hash, "de.anomic.yacy.yacySeed.b64Hash2hexHash()"));
}
/**
@ -434,7 +434,7 @@ public class yacySeed {
*/
public static byte[] b64Hash2b256Hash(String b64Hash) {
assert b64Hash.length() == 12;
return kelondroBase64Order.enhancedCoder.decode(b64Hash);
return kelondroBase64Order.enhancedCoder.decode(b64Hash, "de.anomic.yacy.yacySeed.b64Hash2b256Hash()");
}
/**

@ -10,7 +10,7 @@
# INFO regular action information (i.e. any httpd request URL)
# CONFIG regular system status information (i.e. start-up messages)
# FINE in-function status debug output
BASE64.level = FINE
BASE64.level = OFF
PARSER.level = INFO
PROXY.level = INFO
YACY.level = INFO

Loading…
Cancel
Save