Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blewitt2015-07-31 21:35:48 +0000
committerBrian de Alwis2015-08-04 14:04:23 +0000
commitabe0ea1fcdc0b40864ec95993f4e1d887265ed2c (patch)
tree35683717516e5bd6de8c366ed0ca4d66ae14c18b
parentb89af46eb192144779d9c76540eed014b2fe0036 (diff)
downloadeclipse.platform.ua-abe0ea1fcdc0b40864ec95993f4e1d887265ed2c.tar.gz
eclipse.platform.ua-abe0ea1fcdc0b40864ec95993f4e1d887265ed2c.tar.xz
eclipse.platform.ua-abe0ea1fcdc0b40864ec95993f4e1d887265ed2c.zip
Bug 474070 - Replace new Boolean with Boolean.valueOf
Using `new Boolean()` results in the creation of a new object on the heap, when the flyweight `Boolean.TRUE` and `Boolean.FALSE` are available. Java 1.4 added a `Boolean.valueOf()` which can be used in place of `new Boolean()` but which will use the existing flyweight values instead. Globally change `new Boolean(...)` to `Boolean.valueOf(...)` and replace `new Boolean(...).booleanValue()` with `Boolean.parseBoolean(...)` Bug: 474070 Change-Id: I673669144881f738006b8567e99e5760e851ad07 Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
-rw-r--r--org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteStatusData.java5
-rw-r--r--org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java5
-rw-r--r--org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java5
3 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteStatusData.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteStatusData.java
index c502cbdf3..ec6366119 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteStatusData.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteStatusData.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * Copyright (c) 2009, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alex Blewitt - Bug 474070
*******************************************************************************/
package org.eclipse.help.internal.base.remote;
@@ -178,7 +179,7 @@ public class RemoteStatusData {
public void put(URL url,boolean connected)
{
- cache.put(url,new Boolean(connected));
+ cache.put(url,Boolean.valueOf(connected));
}
}
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
index 4044c2592..0605f4963 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/RootScopePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Alex Blewitt - Bug 474070
*******************************************************************************/
package org.eclipse.help.ui;
@@ -173,7 +174,7 @@ public abstract class RootScopePage extends PreferencePage implements
if (child == masterButton)
continue;
if (!enabled) {
- disabledStates.put(child, new Boolean(child.isEnabled()));
+ disabledStates.put(child, Boolean.valueOf(child.isEnabled()));
child.setEnabled(false);
} else {
Boolean savedState = (Boolean) disabledStates.get(child);
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
index d026f69f6..a13acf068 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/data/SearchData.java
@@ -10,6 +10,7 @@
* Sebastian Davids <sdavids@gmx.de> - fix for Bug 182466
* Holger Voormann - fix for bug 365549 (http://eclip.se/365549)
* Holger Voormann - fix for bug 364324 (http://eclip.se/364324)
+ * Alex Blewitt - Bug 474070
*******************************************************************************/
package org.eclipse.help.internal.webapp.data;
@@ -458,8 +459,8 @@ public class SearchData extends ActivitiesData {
private ISearchQuery createSearchQuery() {
String fieldSearchStr = request.getParameter("fieldSearch"); //$NON-NLS-1$
- boolean fieldSearch = fieldSearchStr != null ? new Boolean(
- fieldSearchStr).booleanValue() : false;
+ boolean fieldSearch = fieldSearchStr != null ? Boolean.parseBoolean(
+ fieldSearchStr) : false;
return new SearchQuery(searchWord == null ? "" : searchWord, fieldSearch, new ArrayList<String>(), //$NON-NLS-1$
getLocale());
}

Back to the top