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] 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: