Bug 527018 - [refactoring] Replace use of Number constructors by valueOf

Change-Id: Iaf97601ee4244dc9e751a30cf4ac94250ede03bd
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
index c1fd426..4e1df58 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/HttpsUtility.java
@@ -56,7 +56,7 @@
 	public static InputStream getHttpsInputStream(String thisProtocol,String thisHost, String thisPort, String thisPath, String locale)
 	{
 		try {
-			URL url = new URL(thisProtocol, thisHost, new Integer(thisPort) .intValue(),
+			URL url = new URL(thisProtocol, thisHost, Integer.valueOf(thisPort) .intValue(),
 					thisPath + PATH_TOC + '?' + PARAM_LANG + '=' + locale);
 	        return getHttpsStream(url);
 		} catch (Exception e) {
@@ -68,7 +68,7 @@
 	public static URL getHttpsURL(String thisProtocol,String thisHost, int thisPort, String thisPath)
 	{
 		try {
-			return new URL(thisProtocol, thisHost, new Integer(thisPort) .intValue(),
+			return new URL(thisProtocol, thisHost, Integer.valueOf(thisPort) .intValue(),
 					thisPath + PATH_TOC);
 		} catch (Exception e) {
 			e.printStackTrace();
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
index 173e204..de4c31e 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteContextProvider.java
@@ -60,7 +60,7 @@
 						HttpURLConnection connection;
 						if(protocols[i].equals(PROTOCOL))
 						{
-							url = new URL(PROTOCOL, host[i], new Integer(port[i]).intValue(), path[i]+ PATH_CONTEXT + '?' + PARAM_ID + '=' + id + '&' + PARAM_LANG + '=' + locale);
+							url = new URL(PROTOCOL, host[i], Integer.valueOf(port[i]).intValue(), path[i]+ PATH_CONTEXT + '?' + PARAM_ID + '=' + id + '&' + PARAM_LANG + '=' + locale);
 							connection = (HttpURLConnection)ProxyUtil.getConnection(url);
 							if (connection.getResponseCode() == 200) {
 								in = connection.getInputStream();
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteSearchManager.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteSearchManager.java
index 25527e9..420f0eb 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteSearchManager.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteSearchManager.java
@@ -61,7 +61,7 @@
 
 							if(protocols[i].equals(PROTOCOL_HTTP))
 							{
-								url = new URL("http", host[i], new Integer(port[i]).intValue(), path[i] + PATH_SEARCH + '?' + PARAM_PHRASE + '=' + URLCoder.encode(searchQuery.getSearchWord()) + '&' + PARAM_LANG + '=' + searchQuery.getLocale()); //$NON-NLS-1$
+								url = new URL("http", host[i], Integer.valueOf(port[i]).intValue(), path[i] + PATH_SEARCH + '?' + PARAM_PHRASE + '=' + URLCoder.encode(searchQuery.getSearchWord()) + '&' + PARAM_LANG + '=' + searchQuery.getLocale()); //$NON-NLS-1$
 								in = ProxyUtil.getStream(url);
 							}
 							else
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
index bc794d9..b5322c6 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/base/remote/RemoteTocProvider.java
@@ -81,7 +81,7 @@
 
 						if(protocol[i].equalsIgnoreCase(PROTOCOL))
 						{
-							url = new URL(protocol[i], host[i], new Integer(port[i]) .intValue(),
+							url = new URL(protocol[i], host[i], Integer.valueOf(port[i]) .intValue(),
 									path[i] + PATH_TOC + '?' + PARAM_LANG + '=' + locale);
 
 							in = ProxyUtil.getStream(url);
diff --git a/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java b/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
index d9dba9b..4f1035c 100644
--- a/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
+++ b/org.eclipse.help.base/src/org/eclipse/help/internal/server/JettyHelpServer.java
@@ -62,12 +62,12 @@
 				final Dictionary<String, Object> d = new Hashtable<>();
 				final int SESSION_TIMEOUT_INTERVAL_IN_SECONDS = 30*60;  // 30 minutes
 				configurePort();
-				d.put("http.port", new Integer(getPortParameter())); //$NON-NLS-1$
+				d.put("http.port", Integer.valueOf(getPortParameter())); //$NON-NLS-1$
 
 				// set the base URL
 				d.put("context.path", getContextPath()); //$NON-NLS-1$
 				d.put("other.info", getOtherInfo()); //$NON-NLS-1$
-				d.put(JettyConstants.CONTEXT_SESSIONINACTIVEINTERVAL, new Integer(SESSION_TIMEOUT_INTERVAL_IN_SECONDS));
+				d.put(JettyConstants.CONTEXT_SESSIONINACTIVEINTERVAL, Integer.valueOf(SESSION_TIMEOUT_INTERVAL_IN_SECONDS));
 
 				// suppress Jetty INFO/DEBUG messages to stderr
 				Logger.getLogger("org.mortbay").setLevel(Level.WARNING); //$NON-NLS-1$
diff --git a/org.eclipse.help.base/src_demo/org/apache/lucene/demo/html/Entities.java b/org.eclipse.help.base/src_demo/org/apache/lucene/demo/html/Entities.java
index f541ec0..5aee04f 100644
--- a/org.eclipse.help.base/src_demo/org/apache/lucene/demo/html/Entities.java
+++ b/org.eclipse.help.base/src_demo/org/apache/lucene/demo/html/Entities.java
@@ -33,7 +33,7 @@
 	radix = 16;
       }
       Character c =
-	new Character((char)Integer.parseInt(entity.substring(start), radix));
+	Character.valueOf((char)Integer.parseInt(entity.substring(start), radix));
       return c.toString();
     } else {
       String s = decoder.get(entity);
@@ -64,7 +64,7 @@
   }
 
   static final void add(String entity, int value) {
-    decoder.put(entity, (new Character((char)value)).toString());
+    decoder.put(entity, (Character.valueOf((char)value)).toString());
     if (value < 0x100)
       encoder[value] = entity;
   }
diff --git a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineDescriptorManager.java b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineDescriptorManager.java
index a90956b..ba64805 100644
--- a/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineDescriptorManager.java
+++ b/org.eclipse.help.ui/src/org/eclipse/help/ui/internal/views/EngineDescriptorManager.java
@@ -268,7 +268,7 @@
 				if (loc!= -1) {
 					String cvalue = edId.substring(loc+1);
 					int ivalue = Integer.parseInt(cvalue);
-					used.add(new Integer(ivalue));
+					used.add(Integer.valueOf(ivalue));
 				}
 			}
 		}
diff --git a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
index ec2741d..5afd975 100644
--- a/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
+++ b/org.eclipse.help.webapp/src/org/eclipse/help/internal/webapp/servlet/IndexFragmentServlet.java
@@ -238,7 +238,7 @@
 			while (nextEntry < entries.length) {
 				int entrySize = enabledEntryCount(entries[nextEntry]);
 				if (remaining == size || remaining > entrySize) {
-                    entryList.add(new Integer(nextEntry));
+                    entryList.add(Integer.valueOf(nextEntry));
                     setFlags(nextEntry);
                     remaining -= entrySize;
 				} else {
@@ -254,7 +254,7 @@
 			while (nextEntry >= 0) {
 				int entrySize = enabledEntryCount(entries[nextEntry]);
 				if (remaining == size || remaining > entrySize) {
-                    entryList.add(0, new Integer(nextEntry));
+                    entryList.add(0, Integer.valueOf(nextEntry));
 
                     setFlags(nextEntry);
                     remaining -= entrySize;
diff --git a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
index 18edf37..ecbdf4e 100644
--- a/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
+++ b/org.eclipse.help/src/org/eclipse/help/internal/toc/TocManager.java
@@ -142,13 +142,13 @@
 				UAElement element = (UAElement) topic;
 				while (!(element instanceof Toc)) {
 					UAElement parent = element.getParentElement();
-					path.add(new Integer(indexOf(parent, (Topic)element)));
+					path.add(Integer.valueOf(indexOf(parent, (Topic)element)));
 					element = parent;
 				}
 				Toc[] tocs = getTocs(locale);
 				for (int i=0;i<tocs.length;++i) {
 					if (tocs[i] == element) {
-						path.add(new Integer(i));
+						path.add(Integer.valueOf(i));
 						int[] array = new int[path.size()];
 						for (int j=0;j<array.length;++j) {
 							array[j] = path.get(array.length - 1 - j).intValue();
diff --git a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
index 7df6325..6ac3842 100644
--- a/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
+++ b/org.eclipse.ua.tests/cheatsheet/org/eclipse/ua/tests/cheatsheet/execution/NegateIntegerHandler.java
@@ -20,7 +20,7 @@
 	public Object execute(ExecutionEvent event) throws ExecutionException {
 
 		Integer val = (Integer)event.getObjectParameterForExecution("number");
-		return new Integer(-val.intValue());
+		return Integer.valueOf(-val.intValue());
 
 	}
 
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
index a9bd61e..f6d080b 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/composite/parser/CompositeCheatSheetParser.java
@@ -115,7 +115,7 @@
 			addStatus(IStatus.ERROR,  message,  e);
 			return null;
 		} catch (SAXParseException spe) {
-			String message = NLS.bind(Messages.ERROR_SAX_PARSING_WITH_LOCATION, (new Object[] {filename, new Integer(spe.getLineNumber()), new Integer(spe.getColumnNumber())}));
+			String message = NLS.bind(Messages.ERROR_SAX_PARSING_WITH_LOCATION, (new Object[] {filename, Integer.valueOf(spe.getLineNumber()), new Integer(spe.getColumnNumber())}));
 			addStatus(IStatus.ERROR,  message,  spe);
 			return null;
 		} catch (SAXException se) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
index 4fe5ddf..99ab064 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/data/CheatSheetParser.java
@@ -939,7 +939,7 @@
 			addStatus(IStatus.ERROR, message, e);
 			return null;
 		} catch (SAXParseException spe) {
-			String message = NLS.bind(Messages.ERROR_SAX_PARSING_WITH_LOCATION, (new Object[] {filename, new Integer(spe.getLineNumber()), new Integer(spe.getColumnNumber())}));
+			String message = NLS.bind(Messages.ERROR_SAX_PARSING_WITH_LOCATION, (new Object[] {filename, Integer.valueOf(spe.getLineNumber()), new Integer(spe.getColumnNumber())}));
 			addStatus(IStatus.ERROR, message, spe);
 			return null;
 		} catch (SAXException se) {
diff --git a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java
index 6ee7826..2839111 100644
--- a/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java
+++ b/org.eclipse.ui.cheatsheets/src/org/eclipse/ui/internal/cheatsheets/handlers/DialogIntegerValueConverter.java
@@ -28,7 +28,7 @@
 
 		try {
 			int i = Integer.parseInt(parameterValue);
-			return new Integer(i);
+			return Integer.valueOf(i);
 		} catch (NumberFormatException ex) {
 			throw new ParameterValueConversionException(
 					"error converting to integer: " + parameterValue); //$NON-NLS-1$
diff --git a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
index d769bbc..c0ae8c4 100644
--- a/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
+++ b/org.eclipse.ui.intro.universal/src/org/eclipse/ui/internal/intro/universal/CustomizationContentsArea.java
@@ -1025,7 +1025,7 @@
 				if (element instanceof ExtensionData) {
 					ExtensionData ed = (ExtensionData) element;
 					if (property.equals(IUniversalIntroConstants.P_IMPORTANCE))
-						return new Integer(ed.getImportance());
+						return Integer.valueOf(ed.getImportance());
 				}
 				return null;
 			}
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
index 4292433..fa50f2b 100644
--- a/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
+++ b/org.eclipse.ui.intro/src/org/eclipse/ui/intro/contentproviders/EclipseRSSViewer.java
@@ -523,7 +523,7 @@
 			try {
 				Method timeoutMethod = conClass.getMethod(
 						"setConnectTimeout", new Class[]{ int.class } ); //$NON-NLS-1$
-				timeoutMethod.invoke(conn, new Object[] { new Integer(milliseconds)} );
+				timeoutMethod.invoke(conn, new Object[] { Integer.valueOf(milliseconds)} );
 			} catch (Exception e) {
 			     // If running on a 1.4 JRE an exception is expected, fall through
 			}