fixed utf-8 decoding in htmlFilterAbstractScraper and removed httpd timing

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@323 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent 3addf58046
commit abba8fe61b

@ -357,12 +357,27 @@ public abstract class htmlFilterAbstractScraper implements htmlFilterScraper {
public static serverByteBuffer convertUmlaute(serverByteBuffer bb) {
serverByteBuffer t = new serverByteBuffer(bb.length() + 20);
byte b;
int b0, b1, b2;
String z;
for (int i = 0; i < bb.length(); i++) {
b = bb.byteAt(i);
z = code_iso8859s(b & 0xff);
if (z == null) t.append(b); else t.append(z);
int i = 0;
while (i < bb.length()) {
b0 = bb.byteAt(i) & 0xff;
// check utf-8 encoding
if (b0 < 128) {
t.append(b0);
i++;
} else {
b1 = bb.byteAt(i + 1) & 0xff;
if ((b0 > 0xbf) && (b0 < 0xe0)) {
z = code_iso8859s(((b0 & 0x1f) << 0x6) | (b1 & 0x3f));
i += 2;
} else {
b2 = bb.byteAt(i + 2) & 0xff;
z = code_iso8859s(((b0 & 0xf) << 0xc) | ((b1 & 0x3f) << 0x6) | (b2 & 0x3f));
i += 3;
}
if (z == null) t.append(b0); else t.append(z);
}
}
return t;
}

@ -637,6 +637,9 @@ public final class serverCore extends serverAbstractThread implements serverThre
public Session(ThreadGroup theThreadGroup) {
super(theThreadGroup,"Session");
// setting the session startup time
this.start = System.currentTimeMillis();
}
public void setStopped(boolean stopped) {
@ -730,15 +733,12 @@ public final class serverCore extends serverAbstractThread implements serverThre
synchronized (this) {
try {
this.wait(); //Wait until we get a request to process.
}
catch (InterruptedException e) {
} catch (InterruptedException e) {
this.stopped = true;
// log.error("", e);
}
}
}
else
{
} else {
//There is a task....let us execute it.
try {
execute();
@ -750,16 +750,14 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
} catch (Exception e) {
// log.error("", e);
}
finally {
} finally {
reset();
if (!this.stopped && !this.isInterrupted()) {
try {
this.setName("Session_inPool");
serverCore.this.theSessionPool.returnObject(this);
}
catch (Exception e1) {
} catch (Exception e1) {
// e1.printStackTrace();
this.stopped = true;
}
@ -772,8 +770,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
private void execute() throws InterruptedException {
try {
// setting the session startup time
this.start = System.currentTimeMillis();
// settin the session identity
this.identity = "-";
@ -820,7 +817,6 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
//log.logDebug("* session " + handle + " completed. time = " + (System.currentTimeMillis() - handle));
announceMoreExecTime(System.currentTimeMillis() - this.start);
}
private void listen() {
@ -877,7 +873,9 @@ public final class serverCore extends serverAbstractThread implements serverThre
stringParameter[0] = this.request.trim();
}
}
//long commandStart = System.currentTimeMillis();
result = ((Method)commandMethod).invoke(this.commandObj, stringParameter);
//announceMoreExecTime(commandStart - System.currentTimeMillis()); // shall be negative!
//log.logDebug("* session " + handle + " completed command '" + request + "'. time = " + (System.currentTimeMillis() - handle));
this.out.flush();
if (result == null) {
@ -939,6 +937,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
} catch (java.io.IOException e) {
// connection interruption: more or less normal
}
//announceMoreExecTime(System.currentTimeMillis() - this.start);
}
}

Loading…
Cancel
Save