diff options
author | Thomas Watson | 2020-08-10 13:21:01 +0000 |
---|---|---|
committer | Thomas Watson | 2020-08-10 13:21:01 +0000 |
commit | cee5e90dacf7c6883d49836466f35d86e0a540e7 (patch) | |
tree | 9b7cfdc6c27489373a4d85f0d5b507aa9d3f7efb | |
parent | d6f3389dcd17a567462c3f19be53a494992cb1b1 (diff) | |
download | rt.equinox.framework-cee5e90dacf7c6883d49836466f35d86e0a540e7.tar.gz rt.equinox.framework-cee5e90dacf7c6883d49836466f35d86e0a540e7.tar.xz rt.equinox.framework-cee5e90dacf7c6883d49836466f35d86e0a540e7.zip |
Bug 565949 - Use Long.valueOf and Double.valueOf where possibleY20200810-1200I20200810-1800
Change-Id: I9553166260b836f09f7b53b7bd4bcdbd09574810
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
9 files changed, 40 insertions, 27 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java index 4a4836d62..619dec164 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleContainer.java @@ -1092,7 +1092,7 @@ public final class ModuleContainer implements DebugOptionsListener { if (initial == null) { return; } - Long zero = new Long(0); + Long zero = Long.valueOf(0); for (Iterator<Module> iModules = initial.iterator(); iModules.hasNext();) { Module m = iModules.next(); if (m.getId().equals(zero)) { diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java index e1af37150..9ce10750f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2019 IBM Corporation and others. + * Copyright (c) 2012, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -1516,9 +1516,9 @@ public class ModuleDatabase { case VALUE_STRING : return readString(in, objectTable); case VALUE_LONG : - return new Long(in.readLong()); + return Long.valueOf(in.readLong()); case VALUE_DOUBLE : - return new Double(in.readDouble()); + return Double.valueOf(in.readDouble()); case VALUE_VERSION : return readVersion(in, objectTable); case VALUE_LIST : @@ -1599,9 +1599,9 @@ public class ModuleDatabase { case VALUE_STRING : return readString(in, objectTable); case VALUE_LONG : - return new Long(in.readLong()); + return Long.valueOf(in.readLong()); case VALUE_DOUBLE : - return new Double(in.readDouble()); + return Double.valueOf(in.readDouble()); case VALUE_VERSION : return readVersion(in, objectTable); default : diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java index 31f9e80a9..3c541989f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/SystemModule.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2016 IBM Corporation and others. + * Copyright (c) 2012, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -38,7 +38,7 @@ public abstract class SystemModule extends Module { private volatile AtomicReference<ContainerEvent> forStop = new AtomicReference<>(); public SystemModule(ModuleContainer container) { - super(new Long(0), Constants.SYSTEM_BUNDLE_LOCATION, container, EnumSet.of(Settings.AUTO_START, Settings.USE_ACTIVATION_POLICY), Integer.valueOf(0)); + super(Long.valueOf(0), Constants.SYSTEM_BUNDLE_LOCATION, container, EnumSet.of(Settings.AUTO_START, Settings.USE_ACTIVATION_POLICY), Integer.valueOf(0)); } /** diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java index c4d98263d..91c379b3f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2018 IBM Corporation and others. + * Copyright (c) 2012, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -680,9 +680,9 @@ public final class OSGiManifestBuilderFactory { String trimmed = value.trim(); if (ATTR_TYPE_DOUBLE.equalsIgnoreCase(type)) { - return new Double(trimmed); + return Double.valueOf(trimmed); } else if (ATTR_TYPE_LONG.equalsIgnoreCase(type)) { - return new Long(trimmed); + return Long.valueOf(trimmed); } else if (ATTR_TYPE_URI.equalsIgnoreCase(type)) { // we no longer actually create URIs here; just use the string return trimmed; diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java index 1fc169312..207bb1fec 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2016 IBM Corporation and others. + * Copyright (c) 2003, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -14,14 +14,27 @@ package org.eclipse.osgi.framework.util; -import java.io.*; -import java.net.*; -import java.security.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLStreamHandler; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.Properties; import java.util.zip.ZipException; import java.util.zip.ZipFile; import org.eclipse.osgi.container.Module; -import org.osgi.framework.*; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; /** @@ -161,7 +174,7 @@ public class SecureAction { return AccessController.doPrivileged(new PrivilegedAction<Long>() { @Override public Long run() { - return new Long(file.length()); + return Long.valueOf(file.length()); } }, controlContext).longValue(); } @@ -287,7 +300,7 @@ public class SecureAction { return AccessController.doPrivileged(new PrivilegedAction<Long>() { @Override public Long run() { - return new Long(file.lastModified()); + return Long.valueOf(file.lastModified()); } }, controlContext).longValue(); } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java index c9ade4c9b..32ce76d0e 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/hooks/EclipseLazyStarter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2017 IBM Corporation and others. + * Copyright (c) 2006, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -118,7 +118,7 @@ public class EclipseLazyStarter extends ClassLoaderHook { } catch (BundleException e) { Bundle bundle = managerElement.getGeneration().getRevision().getBundle(); if (e.getType() == BundleException.STATECHANGE_ERROR) { - String message = NLS.bind(Msg.ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP, new Object[] {Thread.currentThread(), name, m.getStateChangeOwner(), bundle, new Long(System.currentTimeMillis() - startTime)}); + String message = NLS.bind(Msg.ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP, new Object[] {Thread.currentThread(), name, m.getStateChangeOwner(), bundle, Long.valueOf(System.currentTimeMillis() - startTime)}); container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.WARNING, message, e); continue; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java index b1544ea89..b196c592a 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/EventAdminLogListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation + * Copyright (c) 2007, 2020 IBM Corporation * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -131,7 +131,7 @@ public class EventAdminLogListener implements SynchronousLogListener { properties.put(LOG_LEVEL, Integer.valueOf(entry.getLevel())); if (entry.getMessage() != null) properties.put(MESSAGE, entry.getMessage()); - properties.put(TIMESTAMP, new Long(entry.getTime())); + properties.put(TIMESTAMP, Long.valueOf(entry.getTime())); return event.newInstance(topic, properties); } @@ -149,7 +149,7 @@ public class EventAdminLogListener implements SynchronousLogListener { } public static void putBundleProperties(Hashtable<String, Object> properties, Bundle bundle) { - properties.put(BUNDLE_ID, new Long(bundle.getBundleId())); + properties.put(BUNDLE_ID, Long.valueOf(bundle.getBundleId())); String symbolicName = bundle.getSymbolicName(); if (symbolicName != null) { properties.put(BUNDLE_SYMBOLICNAME, symbolicName); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java index 13b5c50de..b01dc35df 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogEntryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2018 Cognos Incorporated, IBM Corporation and others + * Copyright (c) 2006, 2020 Cognos Incorporated, IBM Corporation and others * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 which @@ -53,7 +53,7 @@ public class ExtendedLogEntryImpl implements ExtendedLogEntry, LogEntry { Long threadId = threadIds.get(thread); if (threadId == null) { - threadId = new Long(nextThreadId++); + threadId = Long.valueOf(nextThreadId++); threadIds.put(thread, threadId); } return threadId.longValue(); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 3ee884790..7a09eb350 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2019 IBM Corporation and others. + * Copyright (c) 2012, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -2209,7 +2209,7 @@ public class Storage { // // This bit of code attempts to do that by using the bundle ID as an ID for the temp dir along with an incrementing ID // in cases where the temp dir may already exist. - Long bundleID = new Long(generation.getBundleInfo().getBundleId()); + Long bundleID = Long.valueOf(generation.getBundleInfo().getBundleId()); for (int i = 0; i < Integer.MAX_VALUE; i++) { bundleTempDir = new File(libTempDir, bundleID.toString() + "_" + Integer.valueOf(i).toString()); //$NON-NLS-1$ libTempFile = new File(bundleTempDir, libName); |