removed strange debugging strings

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6177 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 4320f69574
commit 77d2a3782c

@ -377,7 +377,7 @@ public class blogBoard {
public byte[] getSubject() {
final String m = record.get("subject");
if (m == null) return new byte[0];
final byte[] b = Base64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoard.subject()");
final byte[] b = Base64Order.enhancedCoder.decode(m);
if (b == null) return "".getBytes();
return b;
}
@ -420,7 +420,7 @@ public class blogBoard {
public byte[] getAuthor() {
final String author = record.get("author");
if (author == null) return new byte[0];
final byte[] b = Base64Order.enhancedCoder.decode(author, "de.anomic.data.blogBoard.author()");
final byte[] b = Base64Order.enhancedCoder.decode(author);
if (b == null) return "".getBytes();
return b;
}
@ -469,7 +469,7 @@ public class blogBoard {
public byte[] getPage() {
final String page = record.get("page");
if (page == null) return new byte[0];
final byte[] page_as_byte = Base64Order.enhancedCoder.decode(page, "de.anomic.data.blogBoard.page()");
final byte[] page_as_byte = Base64Order.enhancedCoder.decode(page);
if (page_as_byte == null) return "".getBytes();
return page_as_byte;
}

@ -256,7 +256,7 @@ public class blogBoardComments {
public byte[] getSubject() {
final String subject = record.get("subject");
if (subject == null) return new byte[0];
final byte[] subject_bytes = Base64Order.enhancedCoder.decode(subject, "de.anomic.data.blogBoardComments.subject()");
final byte[] subject_bytes = Base64Order.enhancedCoder.decode(subject);
if (subject_bytes == null) return "".getBytes();
return subject_bytes;
}
@ -298,7 +298,7 @@ public class blogBoardComments {
final String author = record.get("author");
if (author == null)
return new byte[0];
final byte[] author_byte = Base64Order.enhancedCoder.decode(author, "de.anomic.data.blogBoardComments.author()");
final byte[] author_byte = Base64Order.enhancedCoder.decode(author);
if (author_byte == null)
return "".getBytes();
return author_byte;
@ -324,7 +324,7 @@ public class blogBoardComments {
final String page = record.get("page");
if (page == null)
return new byte[0];
final byte[] page_byte = Base64Order.enhancedCoder.decode(page, "de.anomic.data.blogBoardComments.page()");
final byte[] page_byte = Base64Order.enhancedCoder.decode(page);
if (page_byte == null)
return "".getBytes();
return page_byte;

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

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

@ -166,7 +166,7 @@ public class wikiBoard {
public String author() {
final String a = record.get("author");
if (a == null) return "anonymous";
final byte[] b = Base64Order.enhancedCoder.decode(a, "de.anomic.data.wikiBoard.author()");
final byte[] b = Base64Order.enhancedCoder.decode(a);
if (b == null) return "anonymous";
return new String(b);
}
@ -174,7 +174,7 @@ public class wikiBoard {
public String reason() {
final String r = record.get("reason");
if (r == null) return "";
final byte[] b = Base64Order.enhancedCoder.decode(r, "de.anomic.data.wikiBoard.reason()");
final byte[] b = Base64Order.enhancedCoder.decode(r);
if (b == null) return "unknown";
return new String(b);
}
@ -182,7 +182,7 @@ public class wikiBoard {
public byte[] page() {
final String m = record.get("page");
if (m == null) return new byte[0];
final byte[] b = Base64Order.enhancedCoder.decode(m, "de.anomic.data.wikiBoard.page()");
final byte[] b = Base64Order.enhancedCoder.decode(m);
if (b == null) return "".getBytes();
return b;
}
@ -228,7 +228,7 @@ public class wikiBoard {
private String getChildName() {
final String c = record.get("child");
if (c == null) return null;
final byte[] subject = Base64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.getChildName()");
final byte[] subject = Base64Order.enhancedCoder.decode(c);
if (subject == null) return null;
return new String(subject);
}
@ -236,7 +236,7 @@ public class wikiBoard {
public boolean hasChild() {
final String c = record.get("child");
if (c == null) return false;
final byte[] subject = Base64Order.enhancedCoder.decode(c, "de.anomic.data.wikiBoard.hasChild()");
final byte[] subject = Base64Order.enhancedCoder.decode(c);
return (subject != null);
}

@ -186,8 +186,8 @@ public class Stack {
public class Entry {
private long h;
private byte[] b;
long h;
byte[] b;
/**
* create a new entry object using a long handle

@ -31,8 +31,8 @@ import java.util.concurrent.ConcurrentHashMap;
public class Stacks {
private File stacksLocation;
private String stacksPrefix;
File stacksLocation;
String stacksPrefix;
private ConcurrentHashMap<String, StackInstance> stacks;
/**
@ -65,9 +65,9 @@ public class Stacks {
}
private class StackInstance {
private String name;
String name;
private File location;
private Stack stack;
Stack stack;
public StackInstance(File location) throws IOException {
String filename = location.getName();

@ -36,7 +36,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
import java.util.TreeMap;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;

@ -32,7 +32,7 @@ import java.util.Comparator;
import de.anomic.yacy.logging.Log;
public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Coding, Comparator<byte[]>, Cloneable {
public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Comparator<byte[]>, Cloneable {
protected static final char[] alpha_standard = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
protected static final char[] alpha_enhanced = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".toCharArray();
@ -252,17 +252,17 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Cod
return out;
}
public final String decodeString(final String in, final String info) {
public final String decodeString(final String in) {
try {
//return new String(decode(in), "ISO-8859-1");
return new String(decode(in, info), "UTF-8");
return new String(decode(in), "UTF-8");
} catch (final java.io.UnsupportedEncodingException e) {
System.out.println("internal error in base64: " + e.getMessage());
return null;
}
}
public final byte[] decode(String in, final String info) {
public final byte[] decode(String in) {
if ((in == null) || (in.length() == 0)) return new byte[0];
try {
int posIn = 0;
@ -300,24 +300,11 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Cod
} catch (final ArrayIndexOutOfBoundsException e) {
// maybe the input was not base64
// throw new RuntimeException("input probably not base64");
if (this.log.isFine()) this.log.logFine("wrong string receive: " + in + ", call: " + info);
if (this.log.isFine()) this.log.logFine("wrong string receive: " + in);
return new byte[0];
}
}
/*
private final long cardinalI(final byte[] key) {
// returns a cardinal number in the range of 0 .. Long.MAX_VALUE
long c = 0;
int p = 0;
while ((p < 10) && (p < key.length)) c = (c << 6) | ahpla[key[p++]];
while (p++ < 10) c = (c << 6);
c = c << 3;
assert c >= 0;
return c;
}
*/
private final long cardinalI(final String key) {
// returns a cardinal number in the range of 0 .. Long.MAX_VALUE
long c = 0;
@ -578,7 +565,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Cod
}
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]));
}
if (s[0].equals("-cl")) {
// return the cardinal of a given string as long value with the enhanced encoder

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

@ -1,44 +0,0 @@
// kelondroCoder.java
// -----------------------
// part of The Kelondro Database
// (C) by Michael Peter Christen; mc@yacy.net
// first published on http://www.anomic.de
// Frankfurt, Germany, 2005
// created 04.01.2006
//
// $LastChangedDate: 2005-09-22 22:01:26 +0200 (Thu, 22 Sep 2005) $
// $LastChangedRevision: 774 $
// $LastChangedBy: orbiter $
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package de.anomic.kelondro.order;
public interface Coding {
public char encodeByte(byte b);
public byte decodeByte(char b);
public String encodeLongSmart(long c, int length);
public String encodeLong(long c, int length);
public long decodeLong(String s);
public String encodeString(String in);
public String decodeString(String in, String info);
public String encode(byte[] in);
public byte[] decode(String in, String info);
}

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

@ -151,7 +151,7 @@ public class vcfParser extends AbstractParser implements Parser {
if (!useLastLine) value += line.trim();
else break;
} while (line.length()!=0);
value = Base64Order.standardCoder.decodeString(value, "de.anomic.plasma.parser.vcf.vcfParser.parse(...)");
value = Base64Order.standardCoder.decodeString(value);
}
} catch (final Exception ey) {
// Encoding error: This could occure e.g. if the base64 doesn't

@ -753,7 +753,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
try {
String publicKeyString = getConfig("network.unit.update.location" + i + ".key", null);
if(publicKeyString != null) {
byte[] publicKeyBytes = Base64Order.standardCoder.decode(publicKeyString.trim(), "decode public Key");
byte[] publicKeyBytes = Base64Order.standardCoder.decode(publicKeyString.trim());
publicKey = cryptoLib.getPublicKeyFromBytes(publicKeyBytes);
}
} catch (InvalidKeySpecException e) {

@ -141,8 +141,7 @@ public class CryptoLib {
} else if(args[0].equals("--sign") && args.length==3) {
CryptoLib cl = new CryptoLib();
serverCharBuffer privKeyBuffer = new serverCharBuffer(new File(args[1]));
byte[] privKeyByteBuffer = Base64Order.standardCoder.decode(
privKeyBuffer.toString(), "Private Key");
byte[] privKeyByteBuffer = Base64Order.standardCoder.decode(privKeyBuffer.toString());
PrivateKey privKey = cl.getPrivateKeyFromBytes(privKeyByteBuffer);
FileInputStream dataStream = new FileInputStream(args[2]);
@ -154,15 +153,13 @@ public class CryptoLib {
} else if(args[0].equals("--verify") && args.length==3) {
CryptoLib cl = new CryptoLib();
serverCharBuffer pubKeyBuffer = new serverCharBuffer(new File(args[1]));
byte[] pubKeyByteBuffer = Base64Order.standardCoder.decode(
pubKeyBuffer.toString().trim(), "Private Key");
byte[] pubKeyByteBuffer = Base64Order.standardCoder.decode(pubKeyBuffer.toString().trim());
PublicKey pubKey = cl.getPublicKeyFromBytes(pubKeyByteBuffer);
FileInputStream dataStream = new FileInputStream(args[2]);
serverCharBuffer signBuffer = new serverCharBuffer(new File(args[2] + ".sig"));
byte[] signByteBuffer = Base64Order.standardCoder.decode(
signBuffer.toString().trim(), "Signature");
byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
if(cl.verifySignature(pubKey, dataStream, signByteBuffer)) {
System.out.println("Signature OK!");
} else {

@ -91,11 +91,11 @@ public class crypt {
} // not encoded
switch (encoded.charAt(0)) {
case 'b': {
return Base64Order.enhancedCoder.decodeString(encoded.substring(2), "de.anomic.tools.crypt.simpleDecode()");
return Base64Order.enhancedCoder.decodeString(encoded.substring(2));
}
case 'z':
try {
return gzip.gunzipString(Base64Order.enhancedCoder.decode(encoded.substring(2), "de.anomic.tools.crypt.simpleDecode()"));
return gzip.gunzipString(Base64Order.enhancedCoder.decode(encoded.substring(2)));
} catch (final Exception e) {
e.printStackTrace();
return null;

@ -141,7 +141,7 @@ public class cryptbig {
// Decode a string into a new string using b64, crypt and utf-8
public String decryptString(final String str) {
try {
final byte[] b64dec = Base64Order.standardCoder.decode(str, "de.anomic.tools.cryptbig.decryptString()");
final byte[] b64dec = Base64Order.standardCoder.decode(str);
if (b64dec == null) return null; // error in input string (inconsistency)
final byte[] dec = decryptArray(b64dec);
if (dec == null) return null;
@ -390,7 +390,7 @@ public class cryptbig {
final boolean gzFlag = (s.charAt(8) == '1');
s = s.substring(9);
final cryptbig c = new cryptbig(key, salt);
final byte[] b64dec = Base64Order.enhancedCoder.decode(s, "de.anomic.tools.cryptbig.descrambleString()");
final byte[] b64dec = Base64Order.enhancedCoder.decode(s);
if (b64dec == null) return null; // error in input string (inconsistency)
final byte[] dec = c.decryptArray(b64dec);
if (dec == null) return null;
@ -432,8 +432,8 @@ public class cryptbig {
final char method = encoded.charAt(0);
encoded = encoded.substring(2);
if (method == 'p') return encoded;
if (method == 'b') return Base64Order.enhancedCoder.decodeString(encoded, "de.anomic.tools.cryptbig.simpleDecode()");
if (method == 'z') return gzip.gunzipString(Base64Order.enhancedCoder.decode(encoded, "de.anomic.tools.cryptbig.simpleDecode()"));
if (method == 'b') return Base64Order.enhancedCoder.decodeString(encoded);
if (method == 'z') return gzip.gunzipString(Base64Order.enhancedCoder.decode(encoded));
if (method == 'c') return descrambleString(key, encoded);
return null;
}
@ -597,7 +597,7 @@ public class cryptbig {
if (s[0].equals("-ds64")) {
// generate a b64 decoding from a given string
if (s.length != 2) {help(); System.exit(-1);}
System.out.println(Base64Order.standardCoder.decodeString(s[1], ""));
System.out.println(Base64Order.standardCoder.decodeString(s[1]));
System.exit(0);
}
if (s[0].equals("-ess")) {

@ -285,7 +285,7 @@ public final class yacyRelease extends yacyVersion {
if (signatureData == null) {
Log.logWarning("yacyVersion", "download of signature " + this.getUrl().toString() + " failed. ignoring signature file.");
} else try {
signatureBytes = Base64Order.standardCoder.decode(new String(signatureData, "UTF8").trim(), "decode signature");
signatureBytes = Base64Order.standardCoder.decode(new String(signatureData, "UTF8").trim());
} catch (UnsupportedEncodingException e) {
Log.logWarning("yacyVersion", "download of signature " + this.getUrl().toString() + " failed: unsupported encoding");
}
@ -351,8 +351,7 @@ public final class yacyRelease extends yacyVersion {
try {
serverCharBuffer signBuffer;
signBuffer = new serverCharBuffer(getSignatureFile());
byte[] signByteBuffer = Base64Order.standardCoder.decode(
signBuffer.toString().trim(), "Signature");
byte[] signByteBuffer = Base64Order.standardCoder.decode(signBuffer.toString().trim());
CryptoLib cl = new CryptoLib();
for(yacyUpdateLocation updateLocation : latestReleaseLocations) {
try {

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

Loading…
Cancel
Save