From 2ff75f78795298efecfebeaa896dc0722ae6b077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 17:14:47 +0200 Subject: [PATCH 1/4] Replace new Long() with Long.valueOf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobi Schäfer --- src/main/java/helma/framework/core/TypeManager.java | 10 +++++----- src/main/java/helma/objectmodel/TransientProperty.java | 2 +- src/main/java/helma/objectmodel/db/Property.java | 6 +++--- src/main/java/helma/objectmodel/db/Transactor.java | 4 ++-- .../java/helma/objectmodel/dom/XmlDatabaseReader.java | 4 ++-- src/main/java/helma/objectmodel/dom/XmlReader.java | 8 ++++---- src/main/java/helma/scripting/rhino/HopObject.java | 6 +++--- src/main/java/helma/scripting/rhino/RhinoCore.java | 4 ++-- .../java/helma/scripting/rhino/debug/Profiler.java | 2 +- .../scripting/rhino/extensions/DatabaseObject.java | 4 ++-- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/helma/framework/core/TypeManager.java b/src/main/java/helma/framework/core/TypeManager.java index b982ac09..7d7efdf7 100644 --- a/src/main/java/helma/framework/core/TypeManager.java +++ b/src/main/java/helma/framework/core/TypeManager.java @@ -129,7 +129,7 @@ public final class TypeManager { protected synchronized void checkRepository(Repository repository, boolean update) throws IOException { Repository[] list = repository.getRepositories(); for (int i = 0; i < list.length; i++) { - + // ignore dir name found - compare to shortname (= Prototype name) if (ignoreDirs.contains(list[i].getShortName())) { // jump this repository @@ -140,7 +140,7 @@ public final class TypeManager { } if (list[i].isScriptRoot()) { - // this is an embedded top-level script repository + // this is an embedded top-level script repository if (app.addRepository(list[i], list[i].getParentRepository())) { // repository is new, check it checkRepository(list[i], update); @@ -153,7 +153,7 @@ public final class TypeManager { // if prototype doesn't exist, create it if (proto == null) { // create new prototype if type name is valid - if (isValidTypeName(name)) + if (isValidTypeName(name)) createPrototype(name, list[i], null); } else { proto.addRepository(list[i], update); @@ -192,7 +192,7 @@ public final class TypeManager { long lastScan = lastRepoScan.containsKey(repository) ? ((Long) lastRepoScan.get(repository)).longValue() : 0; if (repository.lastModified() != lastScan) { - lastRepoScan.put(repository, new Long(repository.lastModified())); + lastRepoScan.put(repository, Long.valueOf(repository.lastModified())); checkRepository(repository, false); } } @@ -210,7 +210,7 @@ public final class TypeManager { if (debug) { System.err.println("CHECK: " + proto.getName() + " in " + Thread.currentThread()); - } + } // update prototype's type mapping DbMapping dbmap = proto.getDbMapping(); diff --git a/src/main/java/helma/objectmodel/TransientProperty.java b/src/main/java/helma/objectmodel/TransientProperty.java index acb89160..79f7b615 100644 --- a/src/main/java/helma/objectmodel/TransientProperty.java +++ b/src/main/java/helma/objectmodel/TransientProperty.java @@ -79,7 +79,7 @@ public final class TransientProperty implements IProperty, Serializable { return new Boolean(bvalue); case INTEGER: - return new Long(lvalue); + return Long.valueOf(lvalue); case FLOAT: return new Double(dvalue); diff --git a/src/main/java/helma/objectmodel/db/Property.java b/src/main/java/helma/objectmodel/db/Property.java index e5bf1e7b..199e2b0f 100644 --- a/src/main/java/helma/objectmodel/db/Property.java +++ b/src/main/java/helma/objectmodel/db/Property.java @@ -93,7 +93,7 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa break; case INTEGER: - value = new Long(in.readLong()); + value = Long.valueOf(in.readLong()); break; @@ -231,7 +231,7 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa */ public void setIntegerValue(long l) { type = INTEGER; - value = new Long(l); + value = Long.valueOf(l); dirty = true; } @@ -544,4 +544,4 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa Property p = (Property) obj; return value == null ? p.value == null : value.equals(p.value); } -} \ No newline at end of file +} diff --git a/src/main/java/helma/objectmodel/db/Transactor.java b/src/main/java/helma/objectmodel/db/Transactor.java index 7b366066..74f5e5c7 100644 --- a/src/main/java/helma/objectmodel/db/Transactor.java +++ b/src/main/java/helma/objectmodel/db/Transactor.java @@ -240,7 +240,7 @@ public class Transactor { public void registerConnection(DbSource src, Connection con) { sqlConnections.put(src, con); // we assume a freshly created connection is ok. - testedConnections.put(src, new Long(System.currentTimeMillis())); + testedConnections.put(src, Long.valueOf(System.currentTimeMillis())); } /** @@ -262,7 +262,7 @@ public class Transactor { stmt.execute("SELECT 1"); } stmt.close(); - testedConnections.put(src, new Long(now)); + testedConnections.put(src, Long.valueOf(now)); } catch (SQLException sx) { try { con.close(); diff --git a/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java b/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java index cb34cacd..d4b98dca 100644 --- a/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java +++ b/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java @@ -32,7 +32,7 @@ import java.util.Date; import java.util.Hashtable; /** - * + * */ public final class XmlDatabaseReader extends DefaultHandler implements XmlConstants { static SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -227,7 +227,7 @@ public final class XmlDatabaseReader extends DefaultHandler implements XmlConsta } else if ("float".equals(elementType)) { prop.setFloatValue((new Double(charValue)).doubleValue()); } else if ("integer".equals(elementType)) { - prop.setIntegerValue((new Long(charValue)).longValue()); + prop.setIntegerValue((Long.valueOf(charValue)).longValue()); } else { prop.setStringValue(charValue); } diff --git a/src/main/java/helma/objectmodel/dom/XmlReader.java b/src/main/java/helma/objectmodel/dom/XmlReader.java index aa427029..b711d9b0 100644 --- a/src/main/java/helma/objectmodel/dom/XmlReader.java +++ b/src/main/java/helma/objectmodel/dom/XmlReader.java @@ -34,7 +34,7 @@ import java.util.HashMap; import java.util.Stack; /** - * + * */ public final class XmlReader extends DefaultHandler implements XmlConstants { static SAXParserFactory factory = SAXParserFactory.newInstance(); @@ -213,9 +213,9 @@ public final class XmlReader extends DefaultHandler implements XmlConstants { if (propName == null) { propName = qName; } - + if ("hop:parent".equals(qName)) { - // FIXME: we ought to set parent here, but we're + // FIXME: we ought to set parent here, but we're // dealing with INodes, which don't have a setParent(). } else { currentNode.setNode(propName, n); @@ -301,7 +301,7 @@ public final class XmlReader extends DefaultHandler implements XmlConstants { } else if ("float".equals(elementType)) { currentNode.setFloat(elementName, (new Double(charValue)).doubleValue()); } else if ("integer".equals(elementType)) { - currentNode.setInteger(elementName, (new Long(charValue)).longValue()); + currentNode.setInteger(elementName, (Long.valueOf(charValue)).longValue()); } else { currentNode.setString(elementName, charValue); } diff --git a/src/main/java/helma/scripting/rhino/HopObject.java b/src/main/java/helma/scripting/rhino/HopObject.java index 85b19492..3682da40 100644 --- a/src/main/java/helma/scripting/rhino/HopObject.java +++ b/src/main/java/helma/scripting/rhino/HopObject.java @@ -217,7 +217,7 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco INode node = getNode(); if (skin != null) { - skin.render(engine.reval, node, + skin.render(engine.reval, node, (paramobj == Undefined.instance) ? null : paramobj); } @@ -711,7 +711,7 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco public int jsFunction_contains(Object obj) { return jsFunction_indexOf(obj); } - + /** * Set a property in this HopObject * @@ -879,7 +879,7 @@ public class HopObject extends ScriptableObject implements Wrapper, PropertyReco if (d == null) { return null; } else { - Object[] args = { new Long(d.getTime()) }; + Object[] args = { Long.valueOf(d.getTime()) }; try { return cx.newObject(core.global, "Date", args); } catch (JavaScriptException nafx) { diff --git a/src/main/java/helma/scripting/rhino/RhinoCore.java b/src/main/java/helma/scripting/rhino/RhinoCore.java index ab1fc57d..0e47ca48 100644 --- a/src/main/java/helma/scripting/rhino/RhinoCore.java +++ b/src/main/java/helma/scripting/rhino/RhinoCore.java @@ -569,7 +569,7 @@ public final class RhinoCore implements ScopeProvider { return arg; if (arg instanceof Date) { Date d = (Date) arg; - Object[] args = { new Long(d.getTime()) }; + Object[] args = { Long.valueOf(d.getTime()) }; return Context.getCurrentContext().newObject(global, "Date", args); } return Context.toObject(arg, global); @@ -1146,7 +1146,7 @@ public final class RhinoCore implements ScopeProvider { // Convert java.util.Date objects to JavaScript Dates if (obj instanceof Date) { - Object[] args = { new Long(((Date) obj).getTime()) }; + Object[] args = { Long.valueOf(((Date) obj).getTime()) }; try { return cx.newObject(global, "Date", args); } catch (JavaScriptException nafx) { diff --git a/src/main/java/helma/scripting/rhino/debug/Profiler.java b/src/main/java/helma/scripting/rhino/debug/Profiler.java index 500d7ad4..cd6d5c96 100644 --- a/src/main/java/helma/scripting/rhino/debug/Profiler.java +++ b/src/main/java/helma/scripting/rhino/debug/Profiler.java @@ -106,7 +106,7 @@ public class Profiler implements Debugger { Scriptable thisObj, Object[] args) { long time = System.nanoTime(); - timer.push(new Long(time)); + timer.push(Long.valueOf(time)); } /** diff --git a/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java b/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java index ba9a1d29..7f64745f 100644 --- a/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java +++ b/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java @@ -515,7 +515,7 @@ public class DatabaseObject { case Types.BIGINT: case Types.SMALLINT: case Types.INTEGER: - return new Long(resultSet.getLong(index)); + return Long.valueOf(resultSet.getLong(index)); case Types.REAL: case Types.FLOAT: @@ -532,7 +532,7 @@ public class DatabaseObject { if (num.scale() > 0) { return new Double(num.doubleValue()); } else { - return new Long(num.longValue()); + return Long.valueOf(num.longValue()); } case Types.VARBINARY: From a68c478dd5467ae62e8981f2cc2a5309d66f4e93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 17:15:48 +0200 Subject: [PATCH 2/4] Replace new Double() with Double.valueOf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobi Schäfer --- src/main/java/helma/objectmodel/TransientProperty.java | 2 +- src/main/java/helma/objectmodel/db/Property.java | 4 ++-- src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java | 2 +- src/main/java/helma/objectmodel/dom/XmlReader.java | 2 +- src/main/java/helma/scripting/rhino/RhinoCore.java | 2 +- .../java/helma/scripting/rhino/extensions/DatabaseObject.java | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/helma/objectmodel/TransientProperty.java b/src/main/java/helma/objectmodel/TransientProperty.java index 79f7b615..0ba21330 100644 --- a/src/main/java/helma/objectmodel/TransientProperty.java +++ b/src/main/java/helma/objectmodel/TransientProperty.java @@ -82,7 +82,7 @@ public final class TransientProperty implements IProperty, Serializable { return Long.valueOf(lvalue); case FLOAT: - return new Double(dvalue); + return Double.valueOf(dvalue); case DATE: return new Date(lvalue); diff --git a/src/main/java/helma/objectmodel/db/Property.java b/src/main/java/helma/objectmodel/db/Property.java index 199e2b0f..9bcf326b 100644 --- a/src/main/java/helma/objectmodel/db/Property.java +++ b/src/main/java/helma/objectmodel/db/Property.java @@ -103,7 +103,7 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa break; case FLOAT: - value = new Double(in.readDouble()); + value = Double.valueOf(in.readDouble()); break; @@ -242,7 +242,7 @@ public final class Property implements IProperty, Serializable, Cloneable, Compa */ public void setFloatValue(double d) { type = FLOAT; - value = new Double(d); + value = Double.valueOf(d); dirty = true; } diff --git a/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java b/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java index d4b98dca..35ee1724 100644 --- a/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java +++ b/src/main/java/helma/objectmodel/dom/XmlDatabaseReader.java @@ -225,7 +225,7 @@ public final class XmlDatabaseReader extends DefaultHandler implements XmlConsta prop.setStringValue(charValue); } } else if ("float".equals(elementType)) { - prop.setFloatValue((new Double(charValue)).doubleValue()); + prop.setFloatValue((Double.valueOf(charValue)).doubleValue()); } else if ("integer".equals(elementType)) { prop.setIntegerValue((Long.valueOf(charValue)).longValue()); } else { diff --git a/src/main/java/helma/objectmodel/dom/XmlReader.java b/src/main/java/helma/objectmodel/dom/XmlReader.java index b711d9b0..caa41799 100644 --- a/src/main/java/helma/objectmodel/dom/XmlReader.java +++ b/src/main/java/helma/objectmodel/dom/XmlReader.java @@ -299,7 +299,7 @@ public final class XmlReader extends DefaultHandler implements XmlConstants { currentNode.setString(elementName, charValue); } } else if ("float".equals(elementType)) { - currentNode.setFloat(elementName, (new Double(charValue)).doubleValue()); + currentNode.setFloat(elementName, (Double.valueOf(charValue)).doubleValue()); } else if ("integer".equals(elementType)) { currentNode.setInteger(elementName, (Long.valueOf(charValue)).longValue()); } else { diff --git a/src/main/java/helma/scripting/rhino/RhinoCore.java b/src/main/java/helma/scripting/rhino/RhinoCore.java index 0e47ca48..fe2285cc 100644 --- a/src/main/java/helma/scripting/rhino/RhinoCore.java +++ b/src/main/java/helma/scripting/rhino/RhinoCore.java @@ -618,7 +618,7 @@ public final class RhinoCore implements ScopeProvider { } else if (arg instanceof Number) { Number n = (Number) arg; if (arg instanceof Float || arg instanceof Long) { - return new Double(n.doubleValue()); + return Double.valueOf(n.doubleValue()); } else if (!(arg instanceof Double)) { return new Integer(n.intValue()); } diff --git a/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java b/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java index 7f64745f..05025191 100644 --- a/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java +++ b/src/main/java/helma/scripting/rhino/extensions/DatabaseObject.java @@ -520,7 +520,7 @@ public class DatabaseObject { case Types.REAL: case Types.FLOAT: case Types.DOUBLE: - return new Double(resultSet.getDouble(index)); + return Double.valueOf(resultSet.getDouble(index)); case Types.DECIMAL: case Types.NUMERIC: @@ -530,7 +530,7 @@ public class DatabaseObject { } if (num.scale() > 0) { - return new Double(num.doubleValue()); + return Double.valueOf(num.doubleValue()); } else { return Long.valueOf(num.longValue()); } From 8ffb7b0b086047eee0ba3a07648d82267248d99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 17:16:54 +0200 Subject: [PATCH 3/4] Replace new Integer() with Integer.valueOf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobi Schäfer --- .../java/helma/scripting/rhino/JSAdapter.java | 92 +++++++++---------- .../helma/scripting/rhino/PathWrapper.java | 2 +- .../java/helma/scripting/rhino/RhinoCore.java | 2 +- .../rhino/extensions/DatabaseObject.java | 2 +- src/main/java/helma/util/CronJob.java | 56 +++++------ 5 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/main/java/helma/scripting/rhino/JSAdapter.java b/src/main/java/helma/scripting/rhino/JSAdapter.java index 6af3000e..8ddcd9ec 100644 --- a/src/main/java/helma/scripting/rhino/JSAdapter.java +++ b/src/main/java/helma/scripting/rhino/JSAdapter.java @@ -1,26 +1,26 @@ /* - * The contents of this file are subject to the terms - * of the Common Development and Distribution License + * The contents of this file are subject to the terms + * of the Common Development and Distribution License * (the License). You may not use this file except in * compliance with the License. - * - * You can obtain a copy of the license at + * + * You can obtain a copy of the license at * https://glassfish.dev.java.net/public/CDDLv1.0.html or * glassfish/bootstrap/legal/CDDLv1.0.txt. - * See the License for the specific language governing + * See the License for the specific language governing * permissions and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at glassfish/bootstrap/legal/CDDLv1.0.txt. - * If applicable, add the following below the CDDL Header, + * + * When distributing Covered Code, include this CDDL + * Header Notice in each file and include the License file + * at glassfish/bootstrap/legal/CDDLv1.0.txt. + * If applicable, add the following below the CDDL Header, * with the fields enclosed by brackets [] replaced by - * you own identifying information: + * you own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" - * + * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. */ - + package helma.scripting.rhino; import org.mozilla.javascript.*; @@ -71,7 +71,7 @@ public final class JSAdapter implements Scriptable, Function { private JSAdapter(Scriptable obj) { setAdaptee(obj); } - + // initializer to setup JSAdapter prototype in the given scope public static void init(Context cx, Scriptable scope, boolean sealed) throws RhinoException { @@ -82,11 +82,11 @@ public final class JSAdapter implements Scriptable, Function { ScriptableObject.defineProperty(scope, "JSAdapter", obj, ScriptableObject.DONTENUM); } - + public String getClassName() { return "JSAdapter"; } - + public Object get(String name, Scriptable start) { Function func = getAdapteeFunction(GET_PROP); if (func != null) { @@ -96,17 +96,17 @@ public final class JSAdapter implements Scriptable, Function { return start.get(name, start); } } - + public Object get(int index, Scriptable start) { Function func = getAdapteeFunction(GET_PROP); if (func != null) { - return call(func, new Object[] { new Integer(index) }); + return call(func, new Object[] { Integer.valueOf(index) }); } else { start = getAdaptee(); return start.get(index, start); } } - + public boolean has(String name, Scriptable start) { Function func = getAdapteeFunction(HAS_PROP); if (func != null) { @@ -117,18 +117,18 @@ public final class JSAdapter implements Scriptable, Function { return start.has(name, start); } } - + public boolean has(int index, Scriptable start) { Function func = getAdapteeFunction(HAS_PROP); if (func != null) { - Object res = call(func, new Object[] { new Integer(index) }); + Object res = call(func, new Object[] { Integer.valueOf(index) }); return Context.toBoolean(res); } else { start = getAdaptee(); return start.has(index, start); } } - + public void put(String name, Scriptable start, Object value) { if (start == this) { Function func = getAdapteeFunction(PUT_PROP); @@ -142,12 +142,12 @@ public final class JSAdapter implements Scriptable, Function { start.put(name, start, value); } } - + public void put(int index, Scriptable start, Object value) { if (start == this) { Function func = getAdapteeFunction(PUT_PROP); if( func != null) { - call(func, new Object[] { new Integer(index), value }); + call(func, new Object[] { Integer.valueOf(index), value }); } else { start = getAdaptee(); start.put(index, start, value); @@ -156,7 +156,7 @@ public final class JSAdapter implements Scriptable, Function { start.put(index, start, value); } } - + public void delete(String name) { Function func = getAdapteeFunction(DEL_PROP); if (func != null) { @@ -165,32 +165,32 @@ public final class JSAdapter implements Scriptable, Function { getAdaptee().delete(name); } } - + public void delete(int index) { Function func = getAdapteeFunction(DEL_PROP); if (func != null) { - call(func, new Object[] { new Integer(index) }); + call(func, new Object[] { Integer.valueOf(index) }); } else { getAdaptee().delete(index); } } - + public Scriptable getPrototype() { return prototype; } - + public void setPrototype(Scriptable prototype) { this.prototype = prototype; } - + public Scriptable getParentScope() { return parent; } - + public void setParentScope(Scriptable parent) { this.parent = parent; } - + public Object[] getIds() { Function func = getAdapteeFunction(GET_PROPIDS); if (func != null) { @@ -226,7 +226,7 @@ public final class JSAdapter implements Scriptable, Function { return getAdaptee().getIds(); } } - + public boolean hasInstance(Scriptable scriptable) { if (scriptable instanceof JSAdapter) { return true; @@ -239,11 +239,11 @@ public final class JSAdapter implements Scriptable, Function { return false; } } - + public Object getDefaultValue(Class hint) { return ScriptableObject.getDefaultValue(this, hint); } - + public Object call(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) throws RhinoException { @@ -258,7 +258,7 @@ public final class JSAdapter implements Scriptable, Function { } } } - + public Scriptable construct(Context cx, Scriptable scope, Object[] args) throws RhinoException { if (isPrototype) { @@ -279,38 +279,38 @@ public final class JSAdapter implements Scriptable, Function { } } } - + public Scriptable getAdaptee() { return adaptee; } - + public void setAdaptee(Scriptable adaptee) { if (adaptee == null) { throw new NullPointerException("adaptee can not be null"); } this.adaptee = adaptee; } - + //-- internals only below this point - + // map a property id. Property id can only be an Integer or String private Object mapToId(Object tmp) { if (tmp instanceof Double) { - return new Integer(((Double)tmp).intValue()); + return Integer.valueOf(((Double)tmp).intValue()); } else { return Context.toString(tmp); } } - + private static Scriptable getFunctionPrototype(Scriptable scope) { return ScriptableObject.getFunctionPrototype(scope); } - + private Function getAdapteeFunction(String name) { Object o = ScriptableObject.getProperty(getAdaptee(), name); return (o instanceof Function)? (Function)o : null; } - + private Object call(Function func, Object[] args) { Context cx = Context.getCurrentContext(); Scriptable thisObj = getAdaptee(); @@ -321,12 +321,12 @@ public final class JSAdapter implements Scriptable, Function { throw Context.reportRuntimeError(re.getMessage()); } } - + private Scriptable prototype; private Scriptable parent; private Scriptable adaptee; private boolean isPrototype; - + // names of adaptee JavaScript functions private static final String GET_PROP = "__get__"; private static final String HAS_PROP = "__has__"; diff --git a/src/main/java/helma/scripting/rhino/PathWrapper.java b/src/main/java/helma/scripting/rhino/PathWrapper.java index 393fa62c..fdecc0ca 100644 --- a/src/main/java/helma/scripting/rhino/PathWrapper.java +++ b/src/main/java/helma/scripting/rhino/PathWrapper.java @@ -106,7 +106,7 @@ public class PathWrapper extends ScriptableObject { Object[] ids = new Object[path.size()]; for (int i=0; i

* * And delivers corresponding CronJob objects in a collection. @@ -450,27 +450,27 @@ public class CronJob { cal.setTime(date); // try and short-circuit as fast as possible. - Integer theYear = new Integer(cal.get(Calendar.YEAR)); + Integer theYear = Integer.valueOf(cal.get(Calendar.YEAR)); if (!year.contains(ALL_VALUE) && !year.contains(theYear)) return false; - Integer theMonth = new Integer(cal.get(Calendar.MONTH)); + Integer theMonth = Integer.valueOf(cal.get(Calendar.MONTH)); if (!month.contains(ALL_VALUE) && !month.contains(theMonth)) return false; - Integer theDay = new Integer(cal.get(Calendar.DAY_OF_MONTH)); + Integer theDay = Integer.valueOf(cal.get(Calendar.DAY_OF_MONTH)); if (!day.contains(ALL_VALUE) && !day.contains(theDay)) return false; - Integer theWeekDay = new Integer(cal.get(Calendar.DAY_OF_WEEK)); + Integer theWeekDay = Integer.valueOf(cal.get(Calendar.DAY_OF_WEEK)); if (!weekday.contains(ALL_VALUE) && !weekday.contains(theWeekDay)) return false; - Integer theHour = new Integer(cal.get(Calendar.HOUR_OF_DAY)); + Integer theHour = Integer.valueOf(cal.get(Calendar.HOUR_OF_DAY)); if (!hour.contains(ALL_VALUE) && !hour.contains(theHour)) return false; - Integer theMinute = new Integer(cal.get(Calendar.MINUTE)); + Integer theMinute = Integer.valueOf(cal.get(Calendar.MINUTE)); if (!minute.contains(ALL_VALUE) && !minute.contains(theMinute)) return false; @@ -484,7 +484,7 @@ public class CronJob { public void addYear(int year) { this.year.remove(ALL_VALUE); - this.year.add(new Integer(year)); + this.year.add(Integer.valueOf(year)); } /** @@ -492,7 +492,7 @@ public class CronJob { */ public void removeYear(int year) { - this.year.remove(new Integer(year)); + this.year.remove(Integer.valueOf(year)); } /** @@ -520,7 +520,7 @@ public class CronJob { public void addMonth(int month) { this.month.remove(ALL_VALUE); - this.month.add(new Integer(month)); + this.month.add(Integer.valueOf(month)); } /** @@ -530,7 +530,7 @@ public class CronJob { */ public void removeMonth(int month) { - this.month.remove(new Integer(month)); + this.month.remove(Integer.valueOf(month)); } /** @@ -556,7 +556,7 @@ public class CronJob { public void addDay(int day) { this.day.remove(ALL_VALUE); - this.day.add(new Integer(day)); + this.day.add(Integer.valueOf(day)); } /** @@ -564,7 +564,7 @@ public class CronJob { */ public void removeDay(int day) { - this.day.remove(new Integer(day)); + this.day.remove(Integer.valueOf(day)); } /** @@ -592,7 +592,7 @@ public class CronJob { public void addWeekday(int weekday) { this.weekday.remove(ALL_VALUE); - this.weekday.add(new Integer(weekday)); + this.weekday.add(Integer.valueOf(weekday)); } /** @@ -602,7 +602,7 @@ public class CronJob { */ public void removeWeekday(int weekday) { - this.weekday.remove(new Integer(weekday)); + this.weekday.remove(Integer.valueOf(weekday)); } /** @@ -628,7 +628,7 @@ public class CronJob { public void addHour(int hour) { this.hour.remove(ALL_VALUE); - this.hour.add(new Integer(hour)); + this.hour.add(Integer.valueOf(hour)); } /** @@ -636,7 +636,7 @@ public class CronJob { */ public void removeHour(int hour) { - this.hour.remove(new Integer(hour)); + this.hour.remove(Integer.valueOf(hour)); } /** @@ -662,7 +662,7 @@ public class CronJob { public void addMinute(int minute) { this.minute.remove(ALL_VALUE); - this.minute.add(new Integer(minute)); + this.minute.add(Integer.valueOf(minute)); } /** @@ -670,7 +670,7 @@ public class CronJob { */ public void removeMinute(int minute) { - this.minute.remove(new Integer(minute)); + this.minute.remove(Integer.valueOf(minute)); } /** From 0bfa585cb9ce83b1ecef4f07828d667c632ad547 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sat, 25 May 2024 17:18:43 +0200 Subject: [PATCH 4/4] Replace new Boolean() with Boolean.valueOf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobi Schäfer --- src/main/java/helma/objectmodel/TransientProperty.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/helma/objectmodel/TransientProperty.java b/src/main/java/helma/objectmodel/TransientProperty.java index 0ba21330..e3d1d6bf 100644 --- a/src/main/java/helma/objectmodel/TransientProperty.java +++ b/src/main/java/helma/objectmodel/TransientProperty.java @@ -76,7 +76,7 @@ public final class TransientProperty implements IProperty, Serializable { return svalue; case BOOLEAN: - return new Boolean(bvalue); + return Boolean.valueOf(bvalue); case INTEGER: return Long.valueOf(lvalue);