Checked in patch from Stefan Matthias Aust:
* Don't call static methods as instance methods * Remove unused imports * Remove variables that are never read
This commit is contained in:
parent
cc29ebbaf4
commit
2f39d4f908
27 changed files with 64 additions and 95 deletions
|
@ -116,7 +116,6 @@ public class GifEncoder extends ImageEncoder
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for ( int row = 0; row < height; ++row )
|
for ( int row = 0; row < height; ++row )
|
||||||
{
|
{
|
||||||
int rowOffset = row * width;
|
|
||||||
for ( int col = 0; col < width; ++col )
|
for ( int col = 0; col < width; ++col )
|
||||||
{
|
{
|
||||||
int rgb = rgbPixels[row][col];
|
int rgb = rgbPixels[row][col];
|
||||||
|
|
|
@ -90,11 +90,11 @@ public class DocFunction extends DocFileElement {
|
||||||
|
|
||||||
// if we're currently parsing a functionbody and come to the start
|
// if we're currently parsing a functionbody and come to the start
|
||||||
// of the next function or eof -> read function body
|
// of the next function or eof -> read function body
|
||||||
if (curFunction != null && (tok== ts.FUNCTION || ts.eof())) {
|
if (curFunction != null && (tok== TokenStream.FUNCTION || ts.eof())) {
|
||||||
curFunction.content = "function " + Util.getStringFromFile(location, curFunctionStart, endOfLastToken);
|
curFunction.content = "function " + Util.getStringFromFile(location, curFunctionStart, endOfLastToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tok == ts.FUNCTION) {
|
if (tok == TokenStream.FUNCTION) {
|
||||||
// store the function start for parsing the function body later
|
// store the function start for parsing the function body later
|
||||||
curFunctionStart = getPoint (ts);
|
curFunctionStart = getPoint (ts);
|
||||||
// get and chop the comment
|
// get and chop the comment
|
||||||
|
@ -111,12 +111,12 @@ public class DocFunction extends DocFileElement {
|
||||||
// subloop on the tokenstream: find the parameters of a function
|
// subloop on the tokenstream: find the parameters of a function
|
||||||
// only if it's a function (and not a macro or an action)
|
// only if it's a function (and not a macro or an action)
|
||||||
if (curFunction.type == FUNCTION) {
|
if (curFunction.type == FUNCTION) {
|
||||||
while (!ts.eof() && tok != ts.RP) {
|
while (!ts.eof() && tok != TokenStream.RP) {
|
||||||
// store the position of the last token
|
// store the position of the last token
|
||||||
endOfLastToken = getPoint (ts);
|
endOfLastToken = getPoint (ts);
|
||||||
// new token
|
// new token
|
||||||
tok = ts.getToken();
|
tok = ts.getToken();
|
||||||
if (tok==ts.NAME) {
|
if (tok==TokenStream.NAME) {
|
||||||
curFunction.addParameter (ts.getString());
|
curFunction.addParameter (ts.getString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,6 @@ public class DocSkin extends DocFileElement {
|
||||||
ArrayList partBuffer = new ArrayList();
|
ArrayList partBuffer = new ArrayList();
|
||||||
char[] source = content.toCharArray();
|
char[] source = content.toCharArray();
|
||||||
int sourceLength = source.length;
|
int sourceLength = source.length;
|
||||||
int start = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < (sourceLength - 1); i++) {
|
for (int i = 0; i < (sourceLength - 1); i++) {
|
||||||
if ((source[i] == '<') && (source[i + 1] == '%')) {
|
if ((source[i] == '<') && (source[i + 1] == '%')) {
|
||||||
|
@ -92,8 +91,6 @@ public class DocSkin extends DocFileElement {
|
||||||
partBuffer.add(str);
|
partBuffer.add(str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
start = j + 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = j + 1;
|
i = j + 1;
|
||||||
|
|
|
@ -447,7 +447,7 @@ public final class Application implements IPathElement, Runnable {
|
||||||
// give it 3 more tries, waiting 3 seconds each time.
|
// give it 3 more tries, waiting 3 seconds each time.
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
try {
|
try {
|
||||||
Thread.currentThread().sleep(3000);
|
Thread.sleep(3000);
|
||||||
|
|
||||||
return (RequestEvaluator) freeThreads.pop();
|
return (RequestEvaluator) freeThreads.pop();
|
||||||
} catch (EmptyStackException nothreads) {
|
} catch (EmptyStackException nothreads) {
|
||||||
|
@ -1450,7 +1450,7 @@ public final class Application implements IPathElement, Runnable {
|
||||||
|
|
||||||
// sleep until the next full minute
|
// sleep until the next full minute
|
||||||
try {
|
try {
|
||||||
worker.sleep(sleepInterval);
|
Thread.sleep(sleepInterval);
|
||||||
} catch (InterruptedException x) {
|
} catch (InterruptedException x) {
|
||||||
logEvent("Scheduler for " + name + " interrupted");
|
logEvent("Scheduler for " + name + " interrupted");
|
||||||
worker = null;
|
worker = null;
|
||||||
|
|
|
@ -103,8 +103,6 @@ public final class RequestEvaluator implements Runnable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
int txcount = 0;
|
|
||||||
|
|
||||||
// first, set a local variable to the current transactor thread so we know
|
// first, set a local variable to the current transactor thread so we know
|
||||||
// when it's time to quit because another thread took over.
|
// when it's time to quit because another thread took over.
|
||||||
Transactor localrtx = (Transactor) Thread.currentThread();
|
Transactor localrtx = (Transactor) Thread.currentThread();
|
||||||
|
@ -351,8 +349,7 @@ public final class RequestEvaluator implements Runnable {
|
||||||
// wait a bit longer with each try
|
// wait a bit longer with each try
|
||||||
int base = 800 * tries;
|
int base = 800 * tries;
|
||||||
|
|
||||||
Thread.currentThread().sleep((long) (base +
|
Thread.sleep((long) (base + (Math.random() * base * 2)));
|
||||||
(Math.random() * base * 2)));
|
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -905,4 +902,5 @@ public final class RequestEvaluator implements Runnable {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,8 +87,6 @@ public final class Skin {
|
||||||
private void parse() {
|
private void parse() {
|
||||||
ArrayList partBuffer = new ArrayList();
|
ArrayList partBuffer = new ArrayList();
|
||||||
|
|
||||||
int start = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < (sourceLength - 1); i++) {
|
for (int i = 0; i < (sourceLength - 1); i++) {
|
||||||
if ((source[i] == '<') && (source[i + 1] == '%')) {
|
if ((source[i] == '<') && (source[i + 1] == '%')) {
|
||||||
// found macro start tag
|
// found macro start tag
|
||||||
|
@ -102,7 +100,6 @@ public final class Skin {
|
||||||
|
|
||||||
if (j > (i + 2)) {
|
if (j > (i + 2)) {
|
||||||
partBuffer.add(new Macro(i, j + 2));
|
partBuffer.add(new Macro(i, j + 2));
|
||||||
start = j + 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
i = j + 1;
|
i = j + 1;
|
||||||
|
@ -376,7 +373,7 @@ public final class Skin {
|
||||||
public void render(RequestEvaluator reval, Object thisObject, Map paramObject,
|
public void render(RequestEvaluator reval, Object thisObject, Map paramObject,
|
||||||
Map handlerCache) throws RedirectException {
|
Map handlerCache) throws RedirectException {
|
||||||
if ((sandbox != null) && !sandbox.contains(fullName)) {
|
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]");
|
reval.res.write("[Macro " + fullName + " not allowed in sandbox]");
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,6 @@ public abstract class ImageWrapper {
|
||||||
StringTokenizer tk = new StringTokenizer(string);
|
StringTokenizer tk = new StringTokenizer(string);
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
int spaceWidth = metrics.stringWidth(" ");
|
int spaceWidth = metrics.stringWidth(" ");
|
||||||
int currentLine = 0;
|
|
||||||
int currentWidth = 0;
|
int currentWidth = 0;
|
||||||
int maxWidth = w - 2;
|
int maxWidth = w - 2;
|
||||||
int maxHeight = (h + addedSpace) - 2;
|
int maxHeight = (h + addedSpace) - 2;
|
||||||
|
|
|
@ -545,11 +545,9 @@ public class Server implements IPathElement, Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
while (Thread.currentThread() == mainThread) {
|
while (Thread.currentThread() == mainThread) {
|
||||||
try {
|
try {
|
||||||
mainThread.sleep(3000L);
|
Thread.sleep(3000L);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +627,7 @@ public class Server implements IPathElement, Runnable {
|
||||||
addr = InetAddress.getLocalHost();
|
addr = InetAddress.getLocalHost();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Socket socket = new Socket(addr, addrPort.getPort());
|
new Socket(addr, addrPort.getPort());
|
||||||
} catch (IOException x) {
|
} catch (IOException x) {
|
||||||
// we couldn't connect to the socket because no server
|
// we couldn't connect to the socket because no server
|
||||||
// is running on it yet. Everything's ok.
|
// is running on it yet. Everything's ok.
|
||||||
|
|
|
@ -167,7 +167,6 @@ public class TransientNode implements INode, Serializable {
|
||||||
* @return ...
|
* @return ...
|
||||||
*/
|
*/
|
||||||
public String getFullName(INode root) {
|
public String getFullName(INode root) {
|
||||||
String fullname = "";
|
|
||||||
String divider = null;
|
String divider = null;
|
||||||
StringBuffer b = new StringBuffer();
|
StringBuffer b = new StringBuffer();
|
||||||
TransientNode p = this;
|
TransientNode p = this;
|
||||||
|
@ -548,7 +547,7 @@ public class TransientNode implements INode, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nodes.remove (node);
|
// 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 (node, NodeEvent.NODE_REMOVED));
|
||||||
// Server.throwNodeEvent (new NodeEvent (this, NodeEvent.SUBNODE_REMOVED, node));
|
// Server.throwNodeEvent (new NodeEvent (this, NodeEvent.SUBNODE_REMOVED, node));
|
||||||
|
@ -923,7 +922,7 @@ public class TransientNode implements INode, Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Property p = (Property) propMap.remove(propname.toLowerCase());
|
propMap.remove(propname.toLowerCase());
|
||||||
|
|
||||||
lastmodified = System.currentTimeMillis();
|
lastmodified = System.currentTimeMillis();
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
|
|
@ -484,7 +484,6 @@ public final class Node implements INode, Serializable {
|
||||||
* @return ...
|
* @return ...
|
||||||
*/
|
*/
|
||||||
public String getFullName(INode root) {
|
public String getFullName(INode root) {
|
||||||
String fullname = "";
|
|
||||||
String divider = null;
|
String divider = null;
|
||||||
StringBuffer b = new StringBuffer();
|
StringBuffer b = new StringBuffer();
|
||||||
INode p = this;
|
INode p = this;
|
||||||
|
@ -839,8 +838,6 @@ public final class Node implements INode, Serializable {
|
||||||
node.makePersistentCapable();
|
node.makePersistentCapable();
|
||||||
}
|
}
|
||||||
|
|
||||||
String n = node.getName();
|
|
||||||
|
|
||||||
// if (n.indexOf('/') > -1)
|
// if (n.indexOf('/') > -1)
|
||||||
// throw new RuntimeException ("\"/\" found in Node name.");
|
// throw new RuntimeException ("\"/\" found in Node name.");
|
||||||
// only mark this node as modified if subnodes are not in relational db
|
// only mark this node as modified if subnodes are not in relational db
|
||||||
|
@ -1153,11 +1150,13 @@ public final class Node implements INode, Serializable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
DbMapping smap = null;
|
DbMapping smap = null;
|
||||||
|
|
||||||
if (dbmap != null) {
|
if (dbmap != null) {
|
||||||
smap = dbmap.getSubnodeMapping();
|
smap = dbmap.getSubnodeMapping();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
Node retval = null;
|
Node retval = null;
|
||||||
|
|
||||||
|
@ -1291,9 +1290,11 @@ public final class Node implements INode, Serializable {
|
||||||
|
|
||||||
// check if the subnode is in relational db and has a link back to this
|
// check if the subnode is in relational db and has a link back to this
|
||||||
// which needs to be unset
|
// which needs to be unset
|
||||||
|
/*
|
||||||
if (dbmap != null) {
|
if (dbmap != null) {
|
||||||
Relation srel = dbmap.getSubnodeRelation();
|
Relation srel = dbmap.getSubnodeRelation();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// check if subnodes are also accessed as properties. If so, also unset the property
|
// check if subnodes are also accessed as properties. If so, also unset the property
|
||||||
if ((dbmap != null) && (node.dbmap != null)) {
|
if ((dbmap != null) && (node.dbmap != null)) {
|
||||||
|
|
|
@ -183,8 +183,6 @@ public final class NodeManager {
|
||||||
*/
|
*/
|
||||||
public void deleteNode(Node node) throws Exception {
|
public void deleteNode(Node node) throws Exception {
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
String id = node.getID();
|
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
Transactor tx = (Transactor) Thread.currentThread();
|
Transactor tx = (Transactor) Thread.currentThread();
|
||||||
|
|
||||||
|
@ -362,7 +360,7 @@ public final class NodeManager {
|
||||||
} else {
|
} else {
|
||||||
// node fetched from db is null, cache result using nullNode
|
// node fetched from db is null, cache result using nullNode
|
||||||
synchronized (cache) {
|
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
|
// we ignore the case that onother thread has created the node in the meantime
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -109,7 +109,6 @@ public final class Relation {
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
public void update(String desc, Properties props) {
|
public void update(String desc, Properties props) {
|
||||||
Application app = ownType.getApplication();
|
Application app = ownType.getApplication();
|
||||||
boolean notPrimitive = false;
|
|
||||||
|
|
||||||
if ((desc == null) || "".equals(desc.trim())) {
|
if ((desc == null) || "".equals(desc.trim())) {
|
||||||
if (propName != null) {
|
if (propName != null) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class Replicator implements Runnable {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (runner != null) {
|
if (runner != null) {
|
||||||
runner.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ir) {
|
} catch (InterruptedException ir) {
|
||||||
runner = null;
|
runner = null;
|
||||||
|
|
|
@ -18,10 +18,7 @@ package helma.objectmodel.db;
|
||||||
|
|
||||||
import helma.objectmodel.*;
|
import helma.objectmodel.*;
|
||||||
import helma.objectmodel.dom.*;
|
import helma.objectmodel.dom.*;
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.w3c.dom.Element;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Date;
|
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
@ -200,7 +197,7 @@ public final class XmlDatabase implements IDatabase {
|
||||||
|
|
||||||
writer.setMaxLevels(1);
|
writer.setMaxLevels(1);
|
||||||
|
|
||||||
boolean result = writer.write((Node) node);
|
writer.write((Node) node);
|
||||||
|
|
||||||
writer.close();
|
writer.close();
|
||||||
}
|
}
|
||||||
|
@ -225,7 +222,7 @@ public final class XmlDatabase implements IDatabase {
|
||||||
*
|
*
|
||||||
* @param enc ...
|
* @param enc ...
|
||||||
*/
|
*/
|
||||||
public void setEncoding(String enc) {
|
public void setEncoding(String encoding) {
|
||||||
this.encoding = encoding;
|
this.encoding = encoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import helma.objectmodel.db.*;
|
||||||
import helma.util.HtmlEncoder;
|
import helma.util.HtmlEncoder;
|
||||||
import helma.util.MimePart;
|
import helma.util.MimePart;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -63,8 +64,8 @@ public class GlobalObject extends ScriptableObject {
|
||||||
};
|
};
|
||||||
|
|
||||||
defineFunctionProperties(globalFuncs, GlobalObject.class, 0);
|
defineFunctionProperties(globalFuncs, GlobalObject.class, 0);
|
||||||
put("app", this, cx.toObject(new ApplicationBean(app), this));
|
put("app", this, Context.toObject(new ApplicationBean(app), this));
|
||||||
put("Xml", this, cx.toObject(new XmlObject(core), this));
|
put("Xml", this, Context.toObject(new XmlObject(core), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,6 +22,7 @@ import helma.framework.core.*;
|
||||||
import helma.objectmodel.*;
|
import helma.objectmodel.*;
|
||||||
import helma.objectmodel.db.*;
|
import helma.objectmodel.db.*;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -91,7 +92,7 @@ public class HopObject extends ScriptableObject {
|
||||||
for (int i=0; i<cnst.length; i++) try {
|
for (int i=0; i<cnst.length; i++) try {
|
||||||
FunctionObject fo = new FunctionObject("ctor", cnst[i], engine.global);
|
FunctionObject fo = new FunctionObject("ctor", cnst[i], engine.global);
|
||||||
Object obj = fo.call(cx, engine.global, null, args);
|
Object obj = fo.call(cx, engine.global, null, args);
|
||||||
return cx.toObject(obj, engine.global);
|
return Context.toObject(obj, engine.global);
|
||||||
} catch (JavaScriptException x) {
|
} catch (JavaScriptException x) {
|
||||||
Object value = x.getValue();
|
Object value = x.getValue();
|
||||||
if (value instanceof Throwable) {
|
if (value instanceof Throwable) {
|
||||||
|
@ -262,7 +263,6 @@ public class HopObject extends ScriptableObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context cx = Context.getCurrentContext();
|
|
||||||
Object n = null;
|
Object n = null;
|
||||||
|
|
||||||
if (id instanceof Number) {
|
if (id instanceof Number) {
|
||||||
|
@ -274,7 +274,7 @@ public class HopObject extends ScriptableObject {
|
||||||
if (n == null) {
|
if (n == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return cx.toObject(n, core.global);
|
return Context.toObject(n, core.global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,6 @@ public class HopObject extends ScriptableObject {
|
||||||
* @return ...
|
* @return ...
|
||||||
*/
|
*/
|
||||||
public Object[] jsFunction_list() {
|
public Object[] jsFunction_list() {
|
||||||
int l = node.numberOfNodes();
|
|
||||||
Enumeration e = node.getSubnodes();
|
Enumeration e = node.getSubnodes();
|
||||||
ArrayList a = new ArrayList();
|
ArrayList a = new ArrayList();
|
||||||
|
|
||||||
|
@ -358,11 +357,11 @@ public class HopObject extends ScriptableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child instanceof HopObject) {
|
if (child instanceof HopObject) {
|
||||||
INode added = node.addNode(((HopObject) child).node);
|
node.addNode(((HopObject) child).node);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (child instanceof INode) {
|
} else if (child instanceof INode) {
|
||||||
INode added = node.addNode((INode) child);
|
node.addNode((INode) child);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -384,11 +383,11 @@ public class HopObject extends ScriptableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child instanceof HopObject) {
|
if (child instanceof HopObject) {
|
||||||
INode added = node.addNode(((HopObject) child).node, index);
|
node.addNode(((HopObject) child).node, index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (child instanceof INode) {
|
} else if (child instanceof INode) {
|
||||||
INode added = node.addNode((INode) child, index);
|
node.addNode((INode) child, index);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +415,7 @@ public class HopObject extends ScriptableObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
System.err.println("XXX: " + x);
|
System.err.println("Error in HopObject.remove(): " + x);
|
||||||
x.printStackTrace();
|
x.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,7 +609,7 @@ public class HopObject extends ScriptableObject {
|
||||||
if (n == null) {
|
if (n == null) {
|
||||||
return NOT_FOUND;
|
return NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
return cx.toObject(n, core.global);
|
return Context.toObject(n, core.global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -620,7 +619,7 @@ public class HopObject extends ScriptableObject {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
return NOT_FOUND;
|
return NOT_FOUND;
|
||||||
} else {
|
} else {
|
||||||
return cx.toObject(obj, core.global);
|
return Context.toObject(obj, core.global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -723,12 +722,8 @@ public class HopObject extends ScriptableObject {
|
||||||
public Object get(int idx, Scriptable start) {
|
public Object get(int idx, Scriptable start) {
|
||||||
if (node != null) {
|
if (node != null) {
|
||||||
INode n = node.getSubnodeAt(idx);
|
INode n = node.getSubnodeAt(idx);
|
||||||
|
if (n != null) {
|
||||||
if (n == null) {
|
return Context.toObject(n, core.global);
|
||||||
return NOT_FOUND;
|
|
||||||
} else {
|
|
||||||
Context cx = Context.getCurrentContext();
|
|
||||||
return cx.toObject(n, core.global);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,13 +82,11 @@ public class MapWrapper extends ScriptableObject {
|
||||||
Object obj = map.get(name);
|
Object obj = map.get(name);
|
||||||
|
|
||||||
if (obj != null && !(obj instanceof Scriptable)) {
|
if (obj != null && !(obj instanceof Scriptable)) {
|
||||||
Context cx = Context.getCurrentContext();
|
|
||||||
|
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cx.toObject(obj, core.global);
|
return Context.toObject(obj, core.global);
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -151,9 +149,7 @@ public class MapWrapper extends ScriptableObject {
|
||||||
Object obj = map.get(Integer.toString(idx));
|
Object obj = map.get(Integer.toString(idx));
|
||||||
|
|
||||||
if (obj != null && !(obj instanceof Scriptable)) {
|
if (obj != null && !(obj instanceof Scriptable)) {
|
||||||
Context cx = Context.getCurrentContext();
|
return Context.toObject(obj, core.global);
|
||||||
|
|
||||||
return cx.toObject(obj, core.global);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|
|
@ -29,6 +29,7 @@ import helma.util.SystemMap;
|
||||||
import helma.util.SystemProperties;
|
import helma.util.SystemProperties;
|
||||||
import helma.util.Updatable;
|
import helma.util.Updatable;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -109,7 +110,7 @@ public final class RhinoCore {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new RuntimeException(e.getMessage());
|
throw new RuntimeException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
context.exit();
|
Context.exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,8 +169,6 @@ public final class RhinoCore {
|
||||||
|
|
||||||
if (op == null) {
|
if (op == null) {
|
||||||
try {
|
try {
|
||||||
Context context = Context.getCurrentContext();
|
|
||||||
|
|
||||||
op = new HopObject(name); // context.newObject (global /*, "HopObject" */);
|
op = new HopObject(name); // context.newObject (global /*, "HopObject" */);
|
||||||
op.setPrototype(opp);
|
op.setPrototype(opp);
|
||||||
op.setParentScope(global);
|
op.setParentScope(global);
|
||||||
|
@ -237,8 +236,6 @@ public final class RhinoCore {
|
||||||
|
|
||||||
if (op == null) {
|
if (op == null) {
|
||||||
try {
|
try {
|
||||||
Context context = Context.getCurrentContext();
|
|
||||||
|
|
||||||
op = new HopObject(name); // context.newObject (global /*, "HopObject" */);
|
op = new HopObject(name); // context.newObject (global /*, "HopObject" */);
|
||||||
op.setPrototype(opp);
|
op.setPrototype(opp);
|
||||||
op.setParentScope(global);
|
op.setParentScope(global);
|
||||||
|
|
|
@ -29,6 +29,7 @@ import helma.scripting.*;
|
||||||
import helma.util.CacheMap;
|
import helma.util.CacheMap;
|
||||||
import helma.util.Updatable;
|
import helma.util.Updatable;
|
||||||
import org.mozilla.javascript.*;
|
import org.mozilla.javascript.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -190,7 +191,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
// register path elements with their prototype
|
// register path elements with their prototype
|
||||||
for (int j = 0; j < path.size(); j++) {
|
for (int j = 0; j < path.size(); j++) {
|
||||||
Object pathElem = path.get(j);
|
Object pathElem = path.get(j);
|
||||||
Scriptable wrappedElement = context.toObject(pathElem, global);
|
Scriptable wrappedElement = Context.toObject(pathElem, global);
|
||||||
|
|
||||||
arr.put(j, arr, wrappedElement);
|
arr.put(j, arr, wrappedElement);
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
v = arr;
|
v = arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
scriptable = context.toObject(v, global);
|
scriptable = Context.toObject(v, global);
|
||||||
global.put(k, global, scriptable);
|
global.put(k, global, scriptable);
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
app.logEvent("Error setting global variable " + k + ": " + x);
|
app.logEvent("Error setting global variable " + k + ": " + x);
|
||||||
|
@ -223,7 +224,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
public void exitContext() {
|
public void exitContext() {
|
||||||
context.removeThreadLocal("reval");
|
context.removeThreadLocal("reval");
|
||||||
context.removeThreadLocal("engine");
|
context.removeThreadLocal("engine");
|
||||||
context.exit();
|
Context.exit();
|
||||||
thread = null;
|
thread = null;
|
||||||
|
|
||||||
// loop through previous globals and unset them, if necessary.
|
// loop through previous globals and unset them, if necessary.
|
||||||
|
@ -250,7 +251,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
if (thisObject == null) {
|
if (thisObject == null) {
|
||||||
eso = global;
|
eso = global;
|
||||||
} else {
|
} else {
|
||||||
eso = context.toObject(thisObject, global);
|
eso = Context.toObject(thisObject, global);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
@ -258,7 +259,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
if (xmlrpc) {
|
if (xmlrpc) {
|
||||||
args[i] = core.processXmlRpcArgument (args[i]);
|
args[i] = core.processXmlRpcArgument (args[i]);
|
||||||
} else if (args[i] != null) {
|
} else if (args[i] != null) {
|
||||||
args[i] = context.toObject(args[i], global);
|
args[i] = Context.toObject(args[i], global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +328,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
if (t != null && t.isAlive()) {
|
if (t != null && t.isAlive()) {
|
||||||
t.interrupt();
|
t.interrupt();
|
||||||
try {
|
try {
|
||||||
Thread.currentThread().sleep(5000);
|
Thread.sleep(5000);
|
||||||
if (t.isAlive()) {
|
if (t.isAlive()) {
|
||||||
// thread is still running, gotta stop it.
|
// thread is still running, gotta stop it.
|
||||||
t.stop();
|
t.stop();
|
||||||
|
@ -377,7 +378,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Scriptable so = context.toObject(obj, global);
|
Scriptable so = Context.toObject(obj, global);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object prop = so.get(propname, so);
|
Object prop = so.get(propname, so);
|
||||||
|
@ -459,7 +460,7 @@ public class RhinoEngine implements ScriptingEngine {
|
||||||
// retrieve res.skinpath, an array of objects that tell us where to look for skins
|
// retrieve res.skinpath, an array of objects that tell us where to look for skins
|
||||||
// (strings for directory names and INodes for internal, db-stored skinsets)
|
// (strings for directory names and INodes for internal, db-stored skinsets)
|
||||||
Object[] skinpath = reval.res.getSkinpath();
|
Object[] skinpath = reval.res.getSkinpath();
|
||||||
core.unwrapSkinpath(skinpath);
|
RhinoCore.unwrapSkinpath(skinpath);
|
||||||
skin = app.getSkin(protoName, skinName, skinpath);
|
skin = app.getSkin(protoName, skinName, skinpath);
|
||||||
reval.res.cacheSkin(key, skin);
|
reval.res.cacheSkin(key, skin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -407,7 +407,6 @@ class RowSet {
|
||||||
if (!firstRowSeen) {
|
if (!firstRowSeen) {
|
||||||
throw new SQLException("Attempt to access data before the first row is read");
|
throw new SQLException("Attempt to access data before the first row is read");
|
||||||
}
|
}
|
||||||
int hash = propertyName.hashCode();
|
|
||||||
try {
|
try {
|
||||||
int index = -1; // indicates not a valid index value
|
int index = -1; // indicates not a valid index value
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class ImageObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FunctionObject ctor = new FunctionObject("Image", ctorMember, scope);
|
FunctionObject ctor = new FunctionObject("Image", ctorMember, scope);
|
||||||
((ScriptableObject)scope).defineProperty(scope, "Image", ctor, ScriptableObject.DONTENUM);
|
ScriptableObject.defineProperty(scope, "Image", ctor, ScriptableObject.DONTENUM);
|
||||||
global = scope;
|
global = scope;
|
||||||
// ctor.addAsConstructor(scope, proto);
|
// ctor.addAsConstructor(scope, proto);
|
||||||
}
|
}
|
||||||
|
@ -105,6 +105,6 @@ public class ImageObject {
|
||||||
throw new RuntimeException("Error creating image: Bad parameters or setup problem.");
|
throw new RuntimeException("Error creating image: Bad parameters or setup problem.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return cx.toObject(img, global);
|
return Context.toObject(img, global);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class XmlObject {
|
||||||
|
|
||||||
writer.setDatabaseMode(false);
|
writer.setDatabaseMode(false);
|
||||||
|
|
||||||
boolean result = writer.write(node);
|
writer.write(node);
|
||||||
|
|
||||||
writer.close();
|
writer.close();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class XmlObject {
|
||||||
// writer.setMaxLevels(arguments[1].toInt32());
|
// writer.setMaxLevels(arguments[1].toInt32());
|
||||||
writer.setDatabaseMode(false);
|
writer.setDatabaseMode(false);
|
||||||
|
|
||||||
boolean result = writer.write(node);
|
writer.write(node);
|
||||||
|
|
||||||
writer.flush();
|
writer.flush();
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class XmlRpcObject extends BaseFunction {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FunctionObject ctor = new FunctionObject("Remote", ctorMember, scope);
|
FunctionObject ctor = new FunctionObject("Remote", ctorMember, scope);
|
||||||
((ScriptableObject)scope).defineProperty(scope, "Remote", ctor, ScriptableObject.DONTENUM);
|
ScriptableObject.defineProperty(scope, "Remote", ctor, ScriptableObject.DONTENUM);
|
||||||
// ctor.addAsConstructor(scope, proto);
|
// ctor.addAsConstructor(scope, proto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception upx) {
|
} 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 +
|
"Sorry, upload size exceeds limit of " + uploadLimit +
|
||||||
"kB.");
|
"kB.");
|
||||||
|
|
||||||
|
@ -256,8 +256,6 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
ResponseTrans restrans = execute(reqtrans);
|
ResponseTrans restrans = execute(reqtrans);
|
||||||
|
|
||||||
// set cookies
|
// set cookies
|
||||||
int ncookies = restrans.countCookies();
|
|
||||||
|
|
||||||
if (restrans.countCookies() > 0) {
|
if (restrans.countCookies() > 0) {
|
||||||
CookieTrans[] resCookies = restrans.getCookies();
|
CookieTrans[] resCookies = restrans.getCookies();
|
||||||
|
|
||||||
|
@ -275,11 +273,11 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
} catch (Exception x) {
|
} catch (Exception x) {
|
||||||
try {
|
try {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
sendError(response, response.SC_INTERNAL_SERVER_ERROR,
|
sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
"Error in request handler:" + x);
|
"Error in request handler:" + x);
|
||||||
x.printStackTrace();
|
x.printStackTrace();
|
||||||
} else {
|
} else {
|
||||||
sendError(response, response.SC_INTERNAL_SERVER_ERROR,
|
sendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
|
||||||
"The server encountered an error while processing your request. " +
|
"The server encountered an error while processing your request. " +
|
||||||
"Please check back later.");
|
"Please check back later.");
|
||||||
}
|
}
|
||||||
|
@ -403,9 +401,9 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
|
|
||||||
// send status code 303 for HTTP 1.1, 302 otherwise
|
// send status code 303 for HTTP 1.1, 302 otherwise
|
||||||
if (isOneDotOne(req.getProtocol())) {
|
if (isOneDotOne(req.getProtocol())) {
|
||||||
res.setStatus(res.SC_SEE_OTHER);
|
res.setStatus(HttpServletResponse.SC_SEE_OTHER);
|
||||||
} else {
|
} else {
|
||||||
res.setStatus(res.SC_MOVED_TEMPORARILY);
|
res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.setContentType("text/html");
|
res.setContentType("text/html");
|
||||||
|
@ -577,7 +575,6 @@ public abstract class AbstractServletClient extends HttpServlet {
|
||||||
public static void parseParameters(Map map, byte[] data, String encoding)
|
public static void parseParameters(Map map, byte[] data, String encoding)
|
||||||
throws UnsupportedEncodingException {
|
throws UnsupportedEncodingException {
|
||||||
if ((data != null) && (data.length > 0)) {
|
if ((data != null) && (data.length > 0)) {
|
||||||
int pos = 0;
|
|
||||||
int ix = 0;
|
int ix = 0;
|
||||||
int ox = 0;
|
int ox = 0;
|
||||||
String key = null;
|
String key = null;
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
/* $Log$
|
/* $Log$
|
||||||
|
/* 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
|
* Revision 1.3 2000/03/03 21:58:03 stuart
|
||||||
* move discard_confusing_lines and shift_boundaries to class file_data
|
* move discard_confusing_lines and shift_boundaries to class file_data
|
||||||
*
|
*
|
||||||
|
@ -312,7 +315,7 @@ public class Diff {
|
||||||
|
|
||||||
int d = diag (xoff, xlim, yoff, ylim);
|
int d = diag (xoff, xlim, yoff, ylim);
|
||||||
int c = cost;
|
int c = cost;
|
||||||
int f = fdiag[fdiagoff + d];
|
//int f = fdiag[fdiagoff + d];
|
||||||
int b = bdiag[bdiagoff + d];
|
int b = bdiag[bdiagoff + d];
|
||||||
|
|
||||||
if (c == 1)
|
if (c == 1)
|
||||||
|
|
|
@ -473,8 +473,6 @@ public final class Logger {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(temp));
|
GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(temp));
|
||||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class XmlUtils {
|
||||||
if (obj instanceof String) {
|
if (obj instanceof String) {
|
||||||
try {
|
try {
|
||||||
// first try to interpret string as URL
|
// first try to interpret string as URL
|
||||||
URL url = new URL(obj.toString());
|
new URL(obj.toString());
|
||||||
|
|
||||||
doc = parser.parse(obj.toString());
|
doc = parser.parse(obj.toString());
|
||||||
} catch (MalformedURLException nourl) {
|
} catch (MalformedURLException nourl) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue