Merged in changes between helma_1_3_0_M1 and helma_1_3_0_M2.

This commit is contained in:
hns 2003-07-09 16:37:58 +00:00
parent 57db6bd838
commit 6323a70cc8
20 changed files with 170 additions and 184 deletions

View file

@ -439,7 +439,7 @@ public final class Application implements IPathElement, Runnable {
// give it 3 more tries, waiting 3 seconds each time.
for (int i = 0; i < 4; i++) {
try {
Thread.currentThread().sleep(3000);
Thread.sleep(3000);
return (RequestEvaluator) freeThreads.pop();
} catch (EmptyStackException nothreads) {
@ -1434,12 +1434,15 @@ public final class Application implements IPathElement, Runnable {
long sleepInterval = CronJob.millisToNextFullMinute();
try {
sleepInterval = Integer.parseInt(props.getProperty("schedulerInterval"))*1000;
String sleepProp = props.getProperty("schedulerInterval");
if (sleepProp != null) {
sleepInterval = Math.max(1000, Integer.parseInt(sleepProp)*1000);
}
} catch (Exception ignore) {}
// sleep until the next full minute
try {
worker.sleep(sleepInterval);
Thread.sleep(sleepInterval);
} catch (InterruptedException x) {
logEvent("Scheduler for " + name + " interrupted");
worker = null;

View file

@ -103,8 +103,6 @@ public final class RequestEvaluator implements Runnable {
*
*/
public void run() {
int txcount = 0;
// first, set a local variable to the current transactor thread so we know
// when it's time to quit because another thread took over.
Transactor localrtx = (Transactor) Thread.currentThread();
@ -351,8 +349,7 @@ public final class RequestEvaluator implements Runnable {
// wait a bit longer with each try
int base = 800 * tries;
Thread.currentThread().sleep((long) (base +
(Math.random() * base * 2)));
Thread.sleep((long) (base + (Math.random() * base * 2)));
} catch (Exception ignore) {
}
@ -905,4 +902,5 @@ public final class RequestEvaluator implements Runnable {
return null;
}
}

View file

@ -86,8 +86,6 @@ public final class Skin {
private void parse() {
ArrayList partBuffer = new ArrayList();
int start = 0;
for (int i = 0; i < (sourceLength - 1); i++) {
if ((source[i] == '<') && (source[i + 1] == '%')) {
// found macro start tag
@ -101,7 +99,6 @@ public final class Skin {
if (j > (i + 2)) {
partBuffer.add(new Macro(i, j + 2));
start = j + 2;
}
i = j + 1;
@ -375,7 +372,7 @@ public final class Skin {
public void render(RequestEvaluator reval, Object thisObject, Map paramObject,
Map handlerCache) throws RedirectException {
if ((sandbox != null) && !sandbox.contains(fullName)) {
String h = (handler == null) ? "global" : handler;
//String h = (handler == null) ? "global" : handler;
reval.res.write("[Macro " + fullName + " not allowed in sandbox]");

View file

@ -87,16 +87,18 @@ public final class TypeManager {
zipfiles = new HashMap();
jarfiles = new HashSet();
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
URL helmajar = null;
URL helmajar = TypeManager.class.getResource("/");
for (int i = 0; i < urls.length; i++) {
String url = urls[i].toString().toLowerCase();
if (helmajar == null) {
// Helma classes are in jar file, get helma.jar URL
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
if (url.endsWith("helma.jar")) {
helmajar = urls[i];
break;
for (int i = 0; i < urls.length; i++) {
String url = urls[i].toString().toLowerCase();
if (url.endsWith("helma.jar")) {
helmajar = urls[i];
break;
}
}
}

View file

@ -309,7 +309,6 @@ public abstract class ImageWrapper {
StringTokenizer tk = new StringTokenizer(string);
StringBuffer buffer = new StringBuffer();
int spaceWidth = metrics.stringWidth(" ");
int currentLine = 0;
int currentWidth = 0;
int maxWidth = w - 2;
int maxHeight = (h + addedSpace) - 2;

View file

@ -50,17 +50,17 @@ public class ApplicationManager implements XmlRpcHandler {
/**
* Creates a new ApplicationManager object.
*
* @param port The RMI port we're binding to
* @param hopHome The Helma home directory
* @param props the properties defining the running apps
* @param server the server instance
* @param port The RMI port we're binding to
*/
public ApplicationManager(int port, File hopHome, SystemProperties props,
Server server) {
this.port = port;
public ApplicationManager(File hopHome, SystemProperties props,
Server server, int port) {
this.hopHome = hopHome;
this.props = props;
this.server = server;
this.port = port;
descriptors = new Hashtable();
applications = new Hashtable();
xmlrpcHandlers = new Hashtable();

View file

@ -59,10 +59,10 @@ public class Server implements IPathElement, Runnable {
private Thread mainThread;
// server ports
int rmiPort = 0;
int xmlrpcPort = 0;
int websrvPort = 0;
int ajp13Port = 0;
InetAddrPort rmiPort = null;
InetAddrPort xmlrpcPort = null;
InetAddrPort websrvPort = null;
InetAddrPort ajp13Port = null;
// map of server-wide database sources
Hashtable dbSources;
@ -100,25 +100,25 @@ public class Server implements IPathElement, Runnable {
propfile = args[++i];
} else if (args[i].equals("-p") && ((i + 1) < args.length)) {
try {
rmiPort = Integer.parseInt(args[++i]);
rmiPort = new InetAddrPort(args[++i]);
} catch (Exception portx) {
usageError = true;
}
} else if (args[i].equals("-x") && ((i + 1) < args.length)) {
try {
xmlrpcPort = Integer.parseInt(args[++i]);
xmlrpcPort = new InetAddrPort(args[++i]);
} catch (Exception portx) {
usageError = true;
}
} else if (args[i].equals("-w") && ((i + 1) < args.length)) {
try {
websrvPort = Integer.parseInt(args[++i]);
websrvPort = new InetAddrPort(args[++i]);
} catch (Exception portx) {
usageError = true;
}
} else if (args[i].equals("-jk") && ((i + 1) < args.length)) {
try {
ajp13Port = Integer.parseInt(args[++i]);
ajp13Port = new InetAddrPort(args[++i]);
} catch (Exception portx) {
usageError = true;
}
@ -145,72 +145,82 @@ public class Server implements IPathElement, Runnable {
sysProps = new SystemProperties(propfile);
// check if there's a property setting for those ports not specified via command line
if ((websrvPort == 0) && (sysProps.getProperty("webPort") != null)) {
if ((websrvPort == null) && (sysProps.getProperty("webPort") != null)) {
try {
websrvPort = Integer.parseInt(sysProps.getProperty("webPort"));
} catch (NumberFormatException fmt) {
websrvPort = new InetAddrPort(sysProps.getProperty("webPort"));
} catch (Exception fmt) {
System.err.println("Error parsing web server port property: " + fmt);
}
}
if ((ajp13Port == 0) && (sysProps.getProperty("ajp13Port") != null)) {
if ((ajp13Port == null) && (sysProps.getProperty("ajp13Port") != null)) {
try {
ajp13Port = Integer.parseInt(sysProps.getProperty("ajp13Port"));
} catch (NumberFormatException fmt) {
ajp13Port = new InetAddrPort(sysProps.getProperty("ajp13Port"));
} catch (Exception fmt) {
System.err.println("Error parsing AJP1.3 server port property: " + fmt);
}
}
if ((rmiPort == 0) && (sysProps.getProperty("rmiPort") != null)) {
if ((rmiPort == null) && (sysProps.getProperty("rmiPort") != null)) {
try {
rmiPort = Integer.parseInt(sysProps.getProperty("rmiPort"));
} catch (NumberFormatException fmt) {
rmiPort = new InetAddrPort(sysProps.getProperty("rmiPort"));
} catch (Exception fmt) {
System.err.println("Error parsing RMI server port property: " + fmt);
}
}
if ((xmlrpcPort == 0) && (sysProps.getProperty("xmlrpcPort") != null)) {
if ((xmlrpcPort == null) && (sysProps.getProperty("xmlrpcPort") != null)) {
try {
xmlrpcPort = Integer.parseInt(sysProps.getProperty("xmlrpcPort"));
} catch (NumberFormatException fmt) {
xmlrpcPort = new InetAddrPort(sysProps.getProperty("xmlrpcPort"));
} catch (Exception fmt) {
System.err.println("Error parsing XML-RPC server port property: " + fmt);
}
}
// check server ports. If no port is set, issue a warning and exit.
if (!usageError && ((websrvPort | ajp13Port | rmiPort | xmlrpcPort) == 0)) {
if (!usageError && websrvPort == null && ajp13Port == null &&
rmiPort == null && xmlrpcPort == null) {
System.out.println(" Error: No server port specified.");
usageError = true;
}
// if there's a usage error, output message and exit
if (usageError) {
System.out.println("usage: java helma.main.Server [-h dir] [-f file] [-p port] [-w port] [-x port]");
System.out.println(" -h dir Specify hop home directory");
System.out.println(" -f file Specify server.properties file");
System.out.println(" -p port Specify RMI port number");
System.out.println(" -w port Specify port number for embedded Web server");
System.out.println(" -x port Specify XML-RPC port number");
System.out.println(" -jk port Specify AJP13 port number");
System.out.println("");
System.out.println("Usage: java helma.main.Server [options]");
System.out.println("Possible options:");
System.out.println(" -h dir Specify hop home directory");
System.out.println(" -f file Specify server.properties file");
System.out.println(" -w [ip:]port Specify embedded web server address/port");
System.out.println(" -x [ip:]port Specify XML-RPC address/port");
System.out.println(" -jk [ip:]port Specify AJP13 address/port");
System.out.println(" -p [ip:]port Specify RMI address/port");
System.out.println("");
System.out.println("Supported formats for server ports:");
System.out.println(" <port-number>");
System.out.println(" <ip-address>:<port-number>");
System.out.println(" <hostname>:<port-number>");
System.out.println("");
System.err.println("Usage Error - exiting");
System.out.println("");
System.exit(0);
}
// check if any of the specified server ports is in use already
try {
if (websrvPort > 0) {
if (websrvPort != null) {
checkRunning(websrvPort);
}
if (rmiPort > 0) {
if (rmiPort != null) {
checkRunning(rmiPort);
}
if (xmlrpcPort > 0) {
if (xmlrpcPort != null) {
checkRunning(xmlrpcPort);
}
if (ajp13Port > 0) {
if (ajp13Port != null) {
checkRunning(ajp13Port);
}
} catch (Exception running) {
@ -366,7 +376,7 @@ public class Server implements IPathElement, Runnable {
*/
public void run() {
try {
if ((websrvPort > 0) || (ajp13Port > 0)) {
if ((websrvPort != null) || (ajp13Port != null)) {
http = new HttpServer();
// disable Jetty logging FIXME: seems to be a jetty bug; as soon
@ -399,14 +409,14 @@ public class Server implements IPathElement, Runnable {
}
// start embedded web server if port is specified
if (websrvPort > 0) {
http.addListener(new InetAddrPort(websrvPort));
if (websrvPort != null) {
http.addListener(websrvPort);
}
// activate the ajp13-listener
if (ajp13Port > 0) {
if (ajp13Port != null) {
// create AJP13Listener
ajp13 = new AJP13Listener(new InetAddrPort(ajp13Port));
ajp13 = new AJP13Listener(ajp13Port);
ajp13.setHttpServer(http);
String jkallow = sysProps.getProperty("allowAJP13");
@ -429,14 +439,18 @@ public class Server implements IPathElement, Runnable {
getLogger().log("Starting AJP13-Listener on port " + (ajp13Port));
}
if (xmlrpcPort > 0) {
if (xmlrpcPort != null) {
String xmlparser = sysProps.getProperty("xmlparser");
if (xmlparser != null) {
XmlRpc.setDriver(xmlparser);
}
xmlrpc = new WebServer(xmlrpcPort);
if (xmlrpcPort.getInetAddress() != null) {
xmlrpc = new WebServer(xmlrpcPort.getPort(), xmlrpcPort.getInetAddress());
} else {
xmlrpc = new WebServer(xmlrpcPort.getPort());
}
if (paranoid) {
xmlrpc.setParanoid(true);
@ -454,10 +468,13 @@ public class Server implements IPathElement, Runnable {
getLogger().log("Starting XML-RPC server on port " + (xmlrpcPort));
}
if (rmiPort > 0) {
if (rmiPort != null) {
if (paranoid) {
HelmaSocketFactory factory = new HelmaSocketFactory();
String rallow = sysProps.getProperty("allowWeb");
if (rallow == null) {
rallow = sysProps.getProperty("allowRMI");
}
if (rallow != null) {
StringTokenizer st = new StringTokenizer(rallow, " ,;");
@ -470,11 +487,14 @@ public class Server implements IPathElement, Runnable {
}
getLogger().log("Starting RMI server on port " + rmiPort);
LocateRegistry.createRegistry(rmiPort);
}
LocateRegistry.createRegistry(rmiPort.getPort());
// create application manager
appManager = new ApplicationManager(rmiPort, hopHome, appsProps, this);
// create application manager which binds to the given RMI port
appManager = new ApplicationManager(hopHome, appsProps, this, rmiPort.getPort());
} else {
// create application manager with RMI port 0
appManager = new ApplicationManager(hopHome, appsProps, this, 0);
}
if (xmlrpc != null) {
xmlrpc.addHandler("$default", appManager);
@ -525,11 +545,9 @@ public class Server implements IPathElement, Runnable {
}
}
int count = 0;
while (Thread.currentThread() == mainThread) {
try {
mainThread.sleep(3000L);
Thread.sleep(3000L);
} catch (InterruptedException ie) {
}
@ -603,15 +621,21 @@ public class Server implements IPathElement, Runnable {
/**
* A primitive method to check whether a server is already running on our port.
*/
private void checkRunning(int portNumber) throws Exception {
private void checkRunning(InetAddrPort addrPort) throws Exception {
InetAddress addr = addrPort.getInetAddress();
if (addr == null) {
addr = InetAddress.getLocalHost();
}
try {
java.net.Socket socket = new java.net.Socket("localhost", portNumber);
} catch (Exception x) {
new Socket(addr, addrPort.getPort());
} catch (IOException x) {
// we couldn't connect to the socket because no server
// is running on it yet. Everything's ok.
return;
}
// if we got so far, another server is already running on this port and db
throw new Exception("Error: Server already running on this port: " + portNumber);
throw new Exception("Error: Server already running on this port: " + addrPort);
}
/**

View file

@ -35,7 +35,7 @@ public class FilteredClassLoader extends URLClassLoader {
* so that they can load classes from jar files in the app directories.
*/
public FilteredClassLoader(URL[] urls) {
super(urls);
super(urls, null);
}
/**

View file

@ -27,7 +27,7 @@ import java.util.ArrayList;
/**
* Helma bootstrap class. Figures out Helma home directory, sets up class path and
* lauchnes main class.
* lauchnes main class. This class must be invoked from a jar file in order to work.
*/
public class Main {
public static final String[] jars = {
@ -69,21 +69,28 @@ public class Main {
// jar:<url>!/{entry}
// we strip away the jar: prefix and the !/{entry} suffix
// to get the original jar file URL
installDir = launcherUrl.toString().substring(4);
int excl = installDir.indexOf("!");
String jarUrl = launcherUrl.toString();
if (excl > -1) {
installDir = installDir.substring(0, excl);
launcherUrl = new URL(installDir);
File f = new File(launcherUrl.getPath());
installDir = f.getParentFile().getCanonicalPath();
if (!jarUrl.startsWith("jar:") || jarUrl.indexOf("!") < 0) {
throw new RuntimeException(" Unable to get JAR URL from "+jarUrl);
}
jarUrl = jarUrl.substring(4);
int excl = jarUrl.indexOf("!");
jarUrl = jarUrl.substring(0, excl);
launcherUrl = new URL(jarUrl);
File f = new File(launcherUrl.getPath());
installDir = f.getParentFile().getCanonicalPath();
} catch (Exception x) {
// unable to get Helma installation dir from launcher jar
System.err.println("Unable to get Helma installation directory: " + x);
System.err.println("Unable to get Helma installation directory: ");
System.err.println(x.getMessage());
System.exit(2);
}
}

View file

@ -167,7 +167,6 @@ public class TransientNode implements INode, Serializable {
* @return ...
*/
public String getFullName(INode root) {
String fullname = "";
String divider = null;
StringBuffer b = new StringBuffer();
TransientNode p = this;
@ -548,7 +547,7 @@ public class TransientNode implements INode, Serializable {
}
// nodes.remove (node);
Object what = nodeMap.remove(node.getName().toLowerCase());
nodeMap.remove(node.getName().toLowerCase());
// Server.throwNodeEvent (new NodeEvent (node, NodeEvent.NODE_REMOVED));
// Server.throwNodeEvent (new NodeEvent (this, NodeEvent.SUBNODE_REMOVED, node));
@ -923,7 +922,7 @@ public class TransientNode implements INode, Serializable {
}
try {
Property p = (Property) propMap.remove(propname.toLowerCase());
propMap.remove(propname.toLowerCase());
lastmodified = System.currentTimeMillis();
} catch (Exception ignore) {

View file

@ -184,63 +184,23 @@ public final class Node implements INode, Serializable {
String rawParentID = null;
id = in.readUTF();
name = in.readUTF();
if (version < 5) {
rawParentID = (String) in.readObject();
} else {
parentHandle = (NodeHandle) in.readObject();
if (version < 9) {
throw new IOException("Can't read pre 1.3.0 HopObject");
}
id = (String) in.readObject();
name = (String) in.readObject();
state = in.readInt();
parentHandle = (NodeHandle) in.readObject();
created = in.readLong();
lastmodified = in.readLong();
if (version < 4) {
// read away content and contentType, which were dropped
in.readObject();
in.readObject();
}
subnodes = (ExternalizableVector) in.readObject();
links = (ExternalizableVector) in.readObject();
if (version < 6) {
// read away obsolete proplinks list
in.readObject();
}
propMap = (Hashtable) in.readObject();
anonymous = in.readBoolean();
prototype = (String) in.readObject();
if (version == 2) {
prototype = in.readUTF();
} else if (version >= 3) {
prototype = (String) in.readObject();
}
// if the input version is < 5, we have to do some conversion to make this object work
if (version < 5) {
if (rawParentID != null) {
parentHandle = new NodeHandle(new DbKey(null, rawParentID));
}
if (subnodes != null) {
for (int i = 0; i < subnodes.size(); i++) {
String s = (String) subnodes.get(i);
subnodes.set(i, new NodeHandle(new DbKey(null, s)));
}
}
if (links != null) {
for (int i = 0; i < links.size(); i++) {
String s = (String) links.get(i);
links.set(i, new NodeHandle(new DbKey(null, s)));
}
}
}
} catch (ClassNotFoundException x) {
throw new IOException(x.toString());
}
@ -250,9 +210,10 @@ public final class Node implements INode, Serializable {
* Write out this instance to a stream
*/
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeShort(7); // serialization version
out.writeUTF(id);
out.writeUTF(name);
out.writeShort(9); // serialization version
out.writeObject(id);
out.writeObject(name);
out.writeInt(state);
out.writeObject(parentHandle);
out.writeLong(created);
out.writeLong(lastmodified);
@ -479,7 +440,6 @@ public final class Node implements INode, Serializable {
* @return ...
*/
public String getFullName(INode root) {
String fullname = "";
String divider = null;
StringBuffer b = new StringBuffer();
INode p = this;
@ -834,8 +794,6 @@ public final class Node implements INode, Serializable {
node.makePersistentCapable();
}
String n = node.getName();
// if (n.indexOf('/') > -1)
// throw new RuntimeException ("\"/\" found in Node name.");
// only mark this node as modified if subnodes are not in relational db
@ -1148,11 +1106,13 @@ public final class Node implements INode, Serializable {
return null;
}
/*
DbMapping smap = null;
if (dbmap != null) {
smap = dbmap.getSubnodeMapping();
}
*/
Node retval = null;
@ -1286,9 +1246,11 @@ public final class Node implements INode, Serializable {
// check if the subnode is in relational db and has a link back to this
// which needs to be unset
/*
if (dbmap != null) {
Relation srel = dbmap.getSubnodeRelation();
}
*/
// check if subnodes are also accessed as properties. If so, also unset the property
if ((dbmap != null) && (node.dbmap != null)) {
@ -1696,9 +1658,13 @@ public final class Node implements INode, Serializable {
} else if (propRel != null && propRel.isVirtual()) {
// prop was found and explicit property relation is collection -
// this is a collection node containing objects stored in the embedded db
INode pn = prop.getNodeValue();
Node pn = (Node) prop.getNodeValue();
if (pn != null) {
// do set DbMapping for embedded db collection nodes
pn.setDbMapping(propRel.getVirtualMapping());
// also set node manager in case this is a mountpoint node
// that came in through replication
pn.nmgr = nmgr;
}
}
}

View file

@ -183,8 +183,6 @@ public final class NodeManager {
*/
public void deleteNode(Node node) throws Exception {
if (node != null) {
String id = node.getID();
synchronized (this) {
Transactor tx = (Transactor) Thread.currentThread();
@ -362,7 +360,7 @@ public final class NodeManager {
} else {
// node fetched from db is null, cache result using nullNode
synchronized (cache) {
Node oldnode = (Node) cache.put(key, new Node());
cache.put(key, new Node());
// we ignore the case that onother thread has created the node in the meantime
return null;

View file

@ -79,13 +79,7 @@ public final class Property implements IProperty, Serializable, Cloneable {
switch (type) {
case STRING:
// try to convert from old format
if (node.version < 7) {
value = in.readUTF();
} else {
value = in.readObject();
}
value = in.readObject();
break;
@ -110,13 +104,7 @@ public final class Property implements IProperty, Serializable, Cloneable {
break;
case NODE:
// try to convert from old format
if (node.version > 4) {
value = (NodeHandle) in.readObject();
} else {
value = new NodeHandle(new DbKey(null, in.readUTF()));
}
value = (NodeHandle) in.readObject();
break;

View file

@ -109,7 +109,6 @@ public final class Relation {
////////////////////////////////////////////////////////////////////////////////////////////
public void update(String desc, Properties props) {
Application app = ownType.getApplication();
boolean notPrimitive = false;
if ((desc == null) || "".equals(desc.trim())) {
if (propName != null) {

View file

@ -91,7 +91,7 @@ public class Replicator implements Runnable {
try {
if (runner != null) {
runner.sleep(1000L);
Thread.sleep(1000L);
}
} catch (InterruptedException ir) {
runner = null;

View file

@ -18,10 +18,7 @@ package helma.objectmodel.db;
import helma.objectmodel.*;
import helma.objectmodel.dom.*;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import java.io.*;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
@ -200,7 +197,7 @@ public final class XmlDatabase implements IDatabase {
writer.setMaxLevels(1);
boolean result = writer.write((Node) node);
writer.write((Node) node);
writer.close();
}
@ -225,7 +222,7 @@ public final class XmlDatabase implements IDatabase {
*
* @param enc ...
*/
public void setEncoding(String enc) {
public void setEncoding(String encoding) {
this.encoding = encoding;
}

View file

@ -162,7 +162,7 @@ public abstract class AbstractServletClient extends HttpServlet {
}
}
} catch (Exception upx) {
sendError(response, response.SC_REQUEST_ENTITY_TOO_LARGE,
sendError(response, HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE,
"Sorry, upload size exceeds limit of " + uploadLimit +
"kB.");
@ -256,8 +256,6 @@ public abstract class AbstractServletClient extends HttpServlet {
ResponseTrans restrans = execute(reqtrans);
// set cookies
int ncookies = restrans.countCookies();
if (restrans.countCookies() > 0) {
CookieTrans[] resCookies = restrans.getCookies();
@ -275,11 +273,11 @@ public abstract class AbstractServletClient extends HttpServlet {
} catch (Exception x) {
try {
if (debug) {
sendError(response, response.SC_INTERNAL_SERVER_ERROR,
sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"Error in request handler:" + x);
x.printStackTrace();
} else {
sendError(response, response.SC_INTERNAL_SERVER_ERROR,
sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
"The server encountered an error while processing your request. " +
"Please check back later.");
}
@ -403,9 +401,9 @@ public abstract class AbstractServletClient extends HttpServlet {
// send status code 303 for HTTP 1.1, 302 otherwise
if (isOneDotOne(req.getProtocol())) {
res.setStatus(res.SC_SEE_OTHER);
res.setStatus(HttpServletResponse.SC_SEE_OTHER);
} else {
res.setStatus(res.SC_MOVED_TEMPORARILY);
res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
}
res.setContentType("text/html");
@ -517,9 +515,13 @@ public abstract class AbstractServletClient extends HttpServlet {
HashMap parameters = new HashMap();
// Parse any query string parameters from the request
try {
parseParameters(parameters, request.getQueryString().getBytes(), encoding);
} catch (Exception e) {
String queryString = request.getQueryString();
if (queryString != null) {
try {
parseParameters(parameters, queryString.getBytes(), encoding);
} catch (Exception e) {
System.err.println("Error parsing query string: "+e);
}
}
// Parse any posted parameters in the input stream
@ -573,7 +575,6 @@ public abstract class AbstractServletClient extends HttpServlet {
public static void parseParameters(Map map, byte[] data, String encoding)
throws UnsupportedEncodingException {
if ((data != null) && (data.length > 0)) {
int pos = 0;
int ix = 0;
int ox = 0;
String key = null;

View file

@ -1,4 +1,14 @@
/* $Log$
/*
* $Log$
* Revision 1.2 2003/07/08 13:52:35 hannes
* Checked in patch from Stefan Matthias Aust:
* * Don't call static methods as instance methods
* * Remove unused imports
* * Remove variables that are never read
*
* Revision 1.1 2002/10/31 08:39:34 hannes
* Added GNU Diff class from http://www.bmsi.com/java/#diff
*
* Revision 1.3 2000/03/03 21:58:03 stuart
* move discard_confusing_lines and shift_boundaries to class file_data
*
@ -312,7 +322,7 @@ public class Diff {
int d = diag (xoff, xlim, yoff, ylim);
int c = cost;
int f = fdiag[fdiagoff + d];
//int f = fdiag[fdiagoff + d];
int b = bdiag[bdiagoff + d];
if (c == 1)

View file

@ -473,8 +473,6 @@ public final class Logger {
}
public void run() {
long start = System.currentTimeMillis();
try {
GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(temp));
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));

View file

@ -64,7 +64,7 @@ public class XmlUtils {
if (obj instanceof String) {
try {
// first try to interpret string as URL
URL url = new URL(obj.toString());
new URL(obj.toString());
doc = parser.parse(obj.toString());
} catch (MalformedURLException nourl) {