Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Honnen2020-10-02 12:37:21 +0000
committerJulian Honnen2020-10-02 12:37:35 +0000
commit23239f8df4dc8f6081f8abb3d0ca403999724bd8 (patch)
tree00b722a5204fe8438878449f6cb89f8e1c1208dc
parentf03516f8e776c403293a9c6f1a923d2deaa60c14 (diff)
downloadeclipse.pde.ui-23239f8df4dc8f6081f8abb3d0ca403999724bd8.tar.gz
eclipse.pde.ui-23239f8df4dc8f6081f8abb3d0ca403999724bd8.tar.xz
eclipse.pde.ui-23239f8df4dc8f6081f8abb3d0ca403999724bd8.zip
- NON-NLS - redundant null/instanceof checks - suppress deprecation - declared exception not actually thrown Change-Id: Ic48ca3c5742d08a1aaf708d211ea9c6372359fd0 Signed-off-by: Julian Honnen <julian.honnen@vector.com>
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Configuration.java10
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/ConfigurationParser.java22
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/FeatureEntry.java1
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/PlatformConfiguration.java12
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/SiteEntry.java12
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Utils.java8
-rw-r--r--ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/XMLPrintHandler.java2
7 files changed, 30 insertions, 37 deletions
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Configuration.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Configuration.java
index 68ce85026b..76c6f9797e 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Configuration.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Configuration.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
+@SuppressWarnings("deprecation")
class Configuration implements IConfigurationConstants {
private HashMap<String, SiteEntry> sites = new HashMap<>();
@@ -83,11 +84,11 @@ class Configuration implements IConfigurationConstants {
URL pURL;
try {
URL relSite = null;
- if (url != null && url.startsWith("platform:/config")) {
+ if (url.startsWith("platform:/config")) { //$NON-NLS-1$
// url for location of configuration is relative to
// platform.xml
URL config_loc = getURL();
- relSite = new URL(config_loc, "..");
+ relSite = new URL(config_loc, ".."); //$NON-NLS-1$
} else {
relSite = getInstallURL();
}
@@ -110,11 +111,11 @@ class Configuration implements IConfigurationConstants {
URL pURL;
try {
URL relSite = null;
- if (url != null && url.startsWith("platform:/config")) {
+ if (url.startsWith("platform:/config")) { //$NON-NLS-1$
// url for location of configuration is relative to
// platform.xml
URL config_loc = getURL();
- relSite = new URL(config_loc, "..");
+ relSite = new URL(config_loc, ".."); //$NON-NLS-1$
} else {
relSite = getInstallURL();
}
@@ -185,7 +186,6 @@ class Configuration implements IConfigurationConstants {
* unchanged
*
* @param url
- * @return
*/
public URL asPlatformURL(URL url) {
try {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/ConfigurationParser.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/ConfigurationParser.java
index cc7f5017a9..74c42307f0 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/ConfigurationParser.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/ConfigurationParser.java
@@ -26,7 +26,6 @@ import java.util.StringTokenizer;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.osgi.util.NLS;
import org.xml.sax.Attributes;
@@ -37,7 +36,7 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* parse the default site.xml
*/
-
+@SuppressWarnings("deprecation")
class ConfigurationParser extends DefaultHandler implements IConfigurationConstants {
private static final String URL_PROPERTY = "org.eclipse.update.resolution_url"; //$NON-NLS-1$
@@ -133,16 +132,13 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
} catch (MalformedURLException e) {
throw new SAXException(
NLS.bind(Messages.InstalledSiteParser_UnableToCreateURL, (new String[] { e.getMessage() })), e);
- } catch (CoreException e) {
- throw new SAXException(
- NLS.bind(Messages.InstalledSiteParser_ErrorParsingFile, (new String[] { e.toString() })), e);
}
}
/**
* process the Site info
*/
- private void processSite(Attributes attributes) throws MalformedURLException, CoreException {
+ private void processSite(Attributes attributes) throws MalformedURLException {
if (config == null) {
return;
@@ -211,7 +207,7 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
String flag = attributes.getValue(CFG_UPDATEABLE);
if (flag != null) {
- if (flag.equals("true")) {
+ if (flag.equals("true")) { //$NON-NLS-1$
site.setUpdateable(true);
} else {
site.setUpdateable(false);
@@ -219,7 +215,7 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
}
flag = attributes.getValue(CFG_ENABLED);
- if (flag != null && flag.equals("false")) {
+ if (flag != null && flag.equals("false")) { //$NON-NLS-1$
site.setEnabled(false);
} else {
site.setEnabled(true);
@@ -240,7 +236,7 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
/**
* process the DefaultFeature info
*/
- private void processFeature(Attributes attributes) throws MalformedURLException, CoreException {
+ private void processFeature(Attributes attributes) {
if (currentSiteURL == null)
{
@@ -280,7 +276,7 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
boolean primary = false;
String flag = attributes.getValue(CFG_FEATURE_ENTRY_PRIMARY);
if (flag != null) {
- if (flag.equals("true")) {
+ if (flag.equals("true")) { //$NON-NLS-1$
primary = true;
}
}
@@ -341,7 +337,7 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
ConfigurationParser parser = new ConfigurationParser();
Configuration sharedConfig = parser.parse(sharedURL, installLocation);
if (sharedConfig == null) {
- throw new Exception("Failed to parse shared configuration: " + sharedURL);
+ throw new Exception("Failed to parse shared configuration: " + sharedURL); //$NON-NLS-1$
}
config.setLinkedConfig(sharedConfig);
}
@@ -365,8 +361,8 @@ class ConfigurationParser extends DefaultHandler implements IConfigurationConsta
if (url.getProtocol().equals("platform")) { //$NON-NLS-1$
try {
// resolve the config location relative to the configURL
- if (url.getPath().startsWith("/config")) {
- URL config_loc = new URL(configURL, "..");
+ if (url.getPath().startsWith("/config")) { //$NON-NLS-1$
+ URL config_loc = new URL(configURL, ".."); //$NON-NLS-1$
resolvedURL = PlatformConfiguration.resolvePlatformURL(url, config_loc); // 19536
}
else {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/FeatureEntry.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/FeatureEntry.java
index bc0fc2e3b2..4d8af1da64 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/FeatureEntry.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/FeatureEntry.java
@@ -19,6 +19,7 @@ import java.net.URL;
*
* Feature information
*/
+@SuppressWarnings("deprecation")
class FeatureEntry implements IConfigurationConstants {
private String id;
private String version;
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/PlatformConfiguration.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/PlatformConfiguration.java
index 670c287897..95acd503d9 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/PlatformConfiguration.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/PlatformConfiguration.java
@@ -51,8 +51,8 @@ public class PlatformConfiguration implements IConfigurationConstants {
URL installLocation = Utils.getInstallURL();
// Retrieve install location with respect to given url if possible
try {
- if (url != null && url.getProtocol().equals("file")
- && url.getPath().endsWith("configuration/org.eclipse.update/platform.xml")) {
+ if (url != null && url.getProtocol().equals("file") //$NON-NLS-1$
+ && url.getPath().endsWith("configuration/org.eclipse.update/platform.xml")) { //$NON-NLS-1$
installLocation = new Path(url.getPath()).removeLastSegments(3).toFile().toURL();
}
} catch (Exception e) {
@@ -129,7 +129,7 @@ public class PlatformConfiguration implements IConfigurationConstants {
File workingDir = cfigFile.getParentFile();
if (workingDir != null && workingDir.exists()) {
File[] backups = workingDir.listFiles(
- (FileFilter) pathname -> pathname.isFile() && pathname.getName().endsWith(".xml"));
+ (FileFilter) pathname -> pathname.isFile() && pathname.getName().endsWith(".xml")); //$NON-NLS-1$
if (backups != null && backups.length > 0) {
URL backupUrl = backups[backups.length - 1].toURL();
config = parser.parse(backupUrl, installLocation);
@@ -153,7 +153,7 @@ public class PlatformConfiguration implements IConfigurationConstants {
public static boolean supportsDetection(URL url, URL installLocation) {
String protocol = url.getProtocol();
- if (protocol.equals("file")) {
+ if (protocol.equals("file")) { //$NON-NLS-1$
return true;
} else if (protocol.equals("platform")) { //$NON-NLS-1$
URL resolved = null;
@@ -175,8 +175,8 @@ public class PlatformConfiguration implements IConfigurationConstants {
File f = new File(url.getFile());
url = f.toURL();
} else {
- final String BASE = "platform:/base/";
- final String CONFIG = "platform:/config/";
+ final String BASE = "platform:/base/"; //$NON-NLS-1$
+ final String CONFIG = "platform:/config/"; //$NON-NLS-1$
String toResolve = url.toExternalForm();
if (toResolve.startsWith(BASE)) {
url = new URL(base_path_Location, toResolve.substring(BASE.length()));
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/SiteEntry.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/SiteEntry.java
index ccde2ba016..a1118fc994 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/SiteEntry.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/SiteEntry.java
@@ -86,9 +86,9 @@ public class SiteEntry implements IConfigurationConstants {
if (url.getProtocol().equals("platform")) { //$NON-NLS-1$
try {
// resolve the config location relative to the configURL
- if (url.getPath().startsWith("/config")) {
+ if (url.getPath().startsWith("/config")) { //$NON-NLS-1$
URL configURL = config.getURL();
- URL config_loc = new URL(configURL, "..");
+ URL config_loc = new URL(configURL, ".."); //$NON-NLS-1$
resolvedURL = PlatformConfiguration.resolvePlatformURL(url, config_loc); // 19536
}
else {
@@ -239,7 +239,6 @@ public class SiteEntry implements IConfigurationConstants {
return featuresChangeStamp;
}
- long start = 0;
String[] features = getFeatures();
// compute stamp for the features directory
@@ -334,8 +333,7 @@ public class SiteEntry implements IConfigurationConstants {
pluginsChangeStamp = 0;
} else if (existingVersion.equals(newVersion)) {
// log error if same feature version/id but a different url
- if (feature instanceof FeatureEntry && existing instanceof FeatureEntry
- && !feature.getURL().equals(existing.getURL())) {
+ if (!feature.getURL().equals(existing.getURL())) {
Utils.log(NLS.bind(Messages.SiteEntry_duplicateFeature,
(new String[] { getURL().toExternalForm(), existing.getFeatureIdentifier() })));
}
@@ -344,9 +342,7 @@ public class SiteEntry implements IConfigurationConstants {
featureEntries.put(feature.getFeatureIdentifier(), feature);
pluginsChangeStamp = 0;
}
- if (feature instanceof FeatureEntry) {
- feature.setSite(this);
- }
+ feature.setSite(this);
}
public FeatureEntry[] getFeatureEntries() {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Utils.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Utils.java
index 07bd56aab4..c36e75d3ed 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Utils.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/Utils.java
@@ -113,7 +113,7 @@ class Utils {
if (siteValues == null) {
return false;
}
- if ("*".equalsIgnoreCase(candidateValues)) {
+ if ("*".equalsIgnoreCase(candidateValues)) { //$NON-NLS-1$
return true;
}
siteValues = siteValues.toUpperCase();
@@ -134,7 +134,7 @@ class Utils {
if (locale == null) {
return false;
}
- if ("*".equalsIgnoreCase(candidateValues)) {
+ if ("*".equalsIgnoreCase(candidateValues)) { //$NON-NLS-1$
return true;
}
@@ -160,7 +160,7 @@ class Utils {
* return it as is.
*/
public static URL makeAbsolute(URL base, URL relativeLocation) {
- if (!"file".equals(base.getProtocol())) {
+ if (!"file".equals(base.getProtocol())) { //$NON-NLS-1$
// we only deal with file: URLs
return relativeLocation;
}
@@ -188,7 +188,7 @@ class Utils {
* separator, drive letter in lower case, etc)
*/
public static String canonicalizeURL(String url) {
- if (!(isWindows && url.startsWith("file:"))) {
+ if (!(isWindows && url.startsWith("file:"))) { //$NON-NLS-1$
return url;
}
try {
diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/XMLPrintHandler.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/XMLPrintHandler.java
index 224252b3c2..a45176b1d0 100644
--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/XMLPrintHandler.java
+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/update/configurator/XMLPrintHandler.java
@@ -52,7 +52,7 @@ class XMLPrintHandler {
xmlWriter.write(temp.toString());
}
- public static String wrapAttributeForPrint(String attribute, String value) throws IOException {
+ public static String wrapAttributeForPrint(String attribute, String value) {
StringBuilder temp = new StringBuilder(XML_SPACE);
temp.append(attribute).append(XML_EQUAL).append(XML_DBL_QUOTES).append(encode(value).toString())
.append(XML_DBL_QUOTES);

Back to the top