Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfogell2006-02-06 17:32:08 +0000
committerjfogell2006-02-06 17:32:08 +0000
commit57f62dc5268846fb59aa63bbc7cd8b13e5529bd6 (patch)
tree3d0bc2df88987558641202313830e351ad43471d
parent1d7d80dca8634a2e75281b9d747a076b954ddfe3 (diff)
downloadrt.equinox.bundles-57f62dc5268846fb59aa63bbc7cd8b13e5529bd6.tar.gz
rt.equinox.bundles-57f62dc5268846fb59aa63bbc7cd8b13e5529bd6.tar.xz
rt.equinox.bundles-57f62dc5268846fb59aa63bbc7cd8b13e5529bd6.zip
removed compile warnings per bug #125839
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Activator.java12
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/AttributeDefinitionImpl.java27
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java13
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/LocalizationElement.java2
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Logging.java20
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java6
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderTracker.java6
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeServiceImpl.java31
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java7
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ValueTokenizer.java17
10 files changed, 64 insertions, 77 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Activator.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Activator.java
index 223fd9c04..ebba91abc 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Activator.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Activator.java
@@ -29,9 +29,9 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
protected final static String saxFactoryClazz = "javax.xml.parsers.SAXParserFactory"; //$NON-NLS-1$
private ServiceTracker _parserTracker;
- private BundleContext _context;
- private ServiceRegistration _mtsReg;
- private MetaTypeServiceImpl _mts = null;
+ BundleContext _context;
+ ServiceRegistration _mtsReg;
+ MetaTypeServiceImpl _mts = null;
/**
* The current SaxParserFactory being used by the WebContainer
@@ -55,7 +55,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
_parserTracker.open();
ServiceReference ref = context.getServiceReference(PackageAdmin.class.getName());
FragmentUtils.packageAdmin = ref == null ? null : (PackageAdmin) context.getService(ref);
- Logging.debug("====== Meta Type Service starting ! =====");
+ Logging.debug("====== Meta Type Service starting ! ====="); //$NON-NLS-1$
}
/*
@@ -65,7 +65,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
*/
public void stop(BundleContext context) throws Exception {
- Logging.debug("====== Meta Type Service stoping ! =====");
+ Logging.debug("====== Meta Type Service stoping ! ====="); //$NON-NLS-1$
_parserTracker.close();
_parserTracker = null;
FragmentUtils.packageAdmin = null;
@@ -97,7 +97,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer {
* java.lang.Object)
*/
public void modifiedService(ServiceReference ref, Object object) {
-
+ // do nothing
}
/*
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/AttributeDefinitionImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/AttributeDefinitionImpl.java
index de0373853..93ee05504 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/AttributeDefinitionImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/AttributeDefinitionImpl.java
@@ -231,7 +231,7 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
for (int index = 0; index < _labels.size(); index++) {
String reason = validate((String) _values.get(index));
if ((reason != null) && reason.length() > 0) {
- Logging.log(Logging.WARN, NLS.bind(MetaTypeMsg.INVALID_OPTIONS, (String) _values.get(index), reason));
+ Logging.log(Logging.WARN, NLS.bind(MetaTypeMsg.INVALID_OPTIONS, _values.get(index), reason));
_labels.remove(index);
_values.remove(index);
index--; // Because this one has been removed.
@@ -297,11 +297,10 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
if (_dataType != STRING) {
// No validation present
return null;
- } else {
- if (_values.size() < 1)
- // No validation present
- return null;
}
+ if (_values.size() < 1)
+ // No validation present
+ return null;
}
// Addtional validation for STRING.
@@ -326,11 +325,10 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
}
// No problems detected
return ""; //$NON-NLS-1$
- } else {
- // Only when cardinality is '0', it comes here.
- String return_msg = validateRange(value);
- return return_msg;
}
+ // Only when cardinality is '0', it comes here.
+ String return_msg = validateRange(value);
+ return return_msg;
} catch (Throwable t) {
return NLS.bind(MetaTypeMsg.EXCEPTION_MESSAGE, t.getClass().getName(), t.getMessage());
}
@@ -409,7 +407,7 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
break;
case BIGINTEGER :
try {
- Class bigIntClazz = Class.forName("java.math.BigInteger");
+ Class bigIntClazz = Class.forName("java.math.BigInteger"); //$NON-NLS-1$
Constructor bigIntConstructor = bigIntClazz.getConstructor(new Class[] {String.class});
Comparable bigIntObject = (Comparable) bigIntConstructor.newInstance(new Object[] {value});
if (_minValue != null && bigIntObject.compareTo(_minValue) < 0) {
@@ -442,7 +440,7 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
break;
case BIGDECIMAL :
try {
- Class bigDecimalClazz = Class.forName("java.math.BigDecimal");
+ Class bigDecimalClazz = Class.forName("java.math.BigDecimal"); //$NON-NLS-1$
Constructor bigDecimalConstructor = bigDecimalClazz.getConstructor(new Class[] {String.class});
Comparable bigDecimalObject = (Comparable) bigDecimalConstructor.newInstance(new Object[] {value});
if (_minValue != null && bigDecimalObject.compareTo(_minValue) < 0) {
@@ -474,16 +472,15 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Attr
}
break;
case BOOLEAN :
- // shouldn't ever get boolean - this is a range validation
+ // shouldn't ever get boolean - this is a range validation
default :
return null;
}
if (rangeError) {
return (NLS.bind(MetaTypeMsg.VALUE_OUT_OF_RANGE, value));
- } else {
- // No problems detected
- return (""); //$NON-NLS-1$
}
+ // No problems detected
+ return (""); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
index 3200e9419..53ba56df9 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
@@ -104,8 +104,7 @@ public class DataParser {
_dp_xmlReader.setErrorHandler(new MyErrorHandler(System.err));
InputStream is = _dp_url.openStream();
InputSource isource = new InputSource(is);
- Logging.log(Logging.DEBUG, "Starting to parse " //$NON-NLS-1$
- + _dp_url);
+ Logging.log(Logging.DEBUG, "Starting to parse " + _dp_url); //$NON-NLS-1$
_dp_xmlReader.parse(isource);
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
@@ -123,7 +122,7 @@ public class DataParser {
/*
* Convert String for expected data type.
*/
- private static Object convert(String value, int type) {
+ static Object convert(String value, int type) {
if (value == null) {
return null;
@@ -241,6 +240,7 @@ public class DataParser {
* handled.
*/
protected void finished() throws SAXException {
+ // do nothing by default
}
public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
@@ -273,6 +273,7 @@ public class DataParser {
}
public void setDocumentLocator(Locator locator) {
+ // do nothing
}
}
@@ -561,7 +562,6 @@ public class DataParser {
}
String ad_defaults_str = atts.getValue(DEFAULT);
- Vector ad_default_vector = new Vector(7);
if (ad_defaults_str == null) {
// Not a problem, because DEFAULT is an optional attribute.
if (ad_cardinality_val == 0) {
@@ -914,10 +914,9 @@ public class DataParser {
public static String getName(String localName, String qName) {
if (localName != null && localName.length() > 0) {
return localName;
- } else {
- int nameSpaceIndex = qName.indexOf(":");
- return nameSpaceIndex == -1 ? qName : qName.substring(nameSpaceIndex + 1);
}
+ int nameSpaceIndex = qName.indexOf(":"); //$NON-NLS-1$
+ return nameSpaceIndex == -1 ? qName : qName.substring(nameSpaceIndex + 1);
}
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/LocalizationElement.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/LocalizationElement.java
index e59cf487c..8ee9ef0b7 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/LocalizationElement.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/LocalizationElement.java
@@ -15,7 +15,7 @@ import java.util.ResourceBundle;
public class LocalizationElement {
- public static final char KEY_SIGN = '%'; //$NON-NLS-1$
+ public static final char KEY_SIGN = '%';
String _localization = null;
ResourceBundle _rb;
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Logging.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Logging.java
index 5d353751e..48d136f4e 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Logging.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/Logging.java
@@ -26,12 +26,6 @@ public class Logging {
private static PrintStream out = System.out;
/*
- * Constructor of class Logging.
- */
- public Logging() {
- }
-
- /*
*
*/
public static void log(int type, String message) {
@@ -47,25 +41,25 @@ public class Logging {
switch (type) {
case TRACE :
- out.println("[Trace log]");
+ out.println("[Trace log]"); //$NON-NLS-1$
break;
case DEBUG :
- out.println("[Debug log]");
+ out.println("[Debug log]"); //$NON-NLS-1$
break;
case WARN :
- out.println("[Warning log]");
+ out.println("[Warning log]"); //$NON-NLS-1$
break;
default :
- out.println("[Error log]");
+ out.println("[Error log]"); //$NON-NLS-1$
}
if (obj != null) {
- out.println("\tObject: " + obj.getClass().getName());
+ out.println("\tObject: " + obj.getClass().getName()); //$NON-NLS-1$
}
if (method != null) {
- out.println("\tMethod: " + method);
+ out.println("\tMethod: " + method); //$NON-NLS-1$
}
- out.println("\tMessage: " + message);
+ out.println("\tMessage: " + message); //$NON-NLS-1$
}
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
index 693cc3884..45a434350 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
@@ -30,7 +30,7 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
public static final String META_FILE_EXT = ".XML"; //$NON-NLS-1$
public static final String RESOURCE_FILE_CONN = "_"; //$NON-NLS-1$
public static final String RESOURCE_FILE_EXT = ".properties"; //$NON-NLS-1$
- public static final char DIRECTORY_SEP = '/'; //$NON-NLS-1$
+ public static final char DIRECTORY_SEP = '/';
Bundle _bundle;
@@ -142,11 +142,11 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
if (_allPidOCDs.containsKey(pid)) {
ocd = (ObjectClassDefinitionImpl) ((ObjectClassDefinitionImpl) _allPidOCDs.get(pid)).clone();
ocd.setResourceBundle(locale, _bundle);
- return (ObjectClassDefinition) ocd;
+ return ocd;
} else if (_allFPidOCDs.containsKey(pid)) {
ocd = (ObjectClassDefinitionImpl) ((ObjectClassDefinitionImpl) _allFPidOCDs.get(pid)).clone();
ocd.setResourceBundle(locale, _bundle);
- return (ObjectClassDefinition) ocd;
+ return ocd;
} else {
throw new IllegalArgumentException(NLS.bind(MetaTypeMsg.OCD_ID_NOT_FOUND, pid));
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderTracker.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderTracker.java
index 0228e7c1f..8a05d8864 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderTracker.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderTracker.java
@@ -17,9 +17,9 @@ import org.osgi.service.metatype.*;
import org.osgi.util.tracker.ServiceTracker;
public class MetaTypeProviderTracker implements MetaTypeInformation {
- public static final String MANAGED_SERVICE = "org.osgi.service.cm.ManagedService";
- public static final String MANAGED_SERVICE_FACTORY = "org.osgi.service.cm.ManagedServiceFactory";
- public static final String FILTER_STRING = "(|(" + Constants.OBJECTCLASS + '=' + MANAGED_SERVICE + ")(" + Constants.OBJECTCLASS + '=' + MANAGED_SERVICE_FACTORY + "))";
+ public static final String MANAGED_SERVICE = "org.osgi.service.cm.ManagedService"; //$NON-NLS-1$
+ public static final String MANAGED_SERVICE_FACTORY = "org.osgi.service.cm.ManagedServiceFactory"; //$NON-NLS-1$
+ public static final String FILTER_STRING = "(|(" + Constants.OBJECTCLASS + '=' + MANAGED_SERVICE + ")(" + Constants.OBJECTCLASS + '=' + MANAGED_SERVICE_FACTORY + "))"; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
Bundle _bundle;
BundleContext _context;
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeServiceImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeServiceImpl.java
index 4441ffc08..619a2204b 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeServiceImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeServiceImpl.java
@@ -23,8 +23,8 @@ import org.osgi.service.metatype.MetaTypeService;
*/
public class MetaTypeServiceImpl implements MetaTypeService, SynchronousBundleListener {
- private BundleContext _context;
- private SAXParserFactory _parserFactory;
+ BundleContext _context;
+ SAXParserFactory _parserFactory;
private Hashtable _mtps = new Hashtable(7);
/**
@@ -46,7 +46,7 @@ public class MetaTypeServiceImpl implements MetaTypeService, SynchronousBundleLi
try {
mti = getMetaTypeProvider(bundle);
} catch (IOException e) {
- Logging.log(Logging.ERROR, "IOException in MetaTypeInformation:getMetaTypeInformation(Bundle bundle)");
+ Logging.log(Logging.ERROR, "IOException in MetaTypeInformation:getMetaTypeInformation(Bundle bundle)"); //$NON-NLS-1$
e.printStackTrace();
mti = null;
}
@@ -61,20 +61,19 @@ public class MetaTypeServiceImpl implements MetaTypeService, SynchronousBundleLi
try {
Long bID = new Long(b.getBundleId());
synchronized (_mtps) {
- if (_mtps.containsKey(bID)) {
+ if (_mtps.containsKey(bID))
return (MetaTypeInformation) _mtps.get(bID);
- } else {
- MetaTypeInformation mti = (MetaTypeInformation) AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws IOException {
- MetaTypeInformationImpl mti = new MetaTypeInformationImpl(b, _parserFactory);
- if (!mti._isThereMeta)
- return new MetaTypeProviderTracker(_context, b);
- return mti;
- }
- });
- _mtps.put(bID, mti);
- return mti;
- }
+
+ MetaTypeInformation mti = (MetaTypeInformation) AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws IOException {
+ MetaTypeInformationImpl impl = new MetaTypeInformationImpl(b, _parserFactory);
+ if (!impl._isThereMeta)
+ return new MetaTypeProviderTracker(_context, b);
+ return impl;
+ }
+ });
+ _mtps.put(bID, mti);
+ return mti;
}
} catch (PrivilegedActionException pae) {
throw (IOException) pae.getException();
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
index 5e22a50ec..7e8b61e13 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
@@ -26,7 +26,7 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Ob
public static final int PID = 0;
public static final int FPID = 1;
- public static final char LOCALE_SEP = '_'; //$NON-NLS-1$
+ public static final char LOCALE_SEP = '_';
String _name;
String _id;
@@ -187,9 +187,8 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Ob
URL[] urls = FragmentUtils.findEntries(b, getLocalized(_icon.getIconName()));
if (urls != null && urls.length > 0) {
return urls[0].openStream();
- } else {
- return null;
}
+ return null;
}
/**
@@ -312,7 +311,7 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Ob
URL[] urls = null;
for (int idx = 0; (idx < searchCandidates.length) && (resourceUrl == null); idx++) {
- urls = (searchCandidates[idx] == null ? null : FragmentUtils.findEntries(bundle, resourceBase + searchCandidates[idx] + MetaTypeInformationImpl.RESOURCE_FILE_EXT));
+ urls = (searchCandidates[idx] == null ? null : FragmentUtils.findEntries(bundle, resourceBase + searchCandidates[idx] + MetaTypeProviderImpl.RESOURCE_FILE_EXT));
if (urls != null && urls.length > 0)
resourceUrl = urls[0];
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ValueTokenizer.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ValueTokenizer.java
index 3e92d0801..4320d3ce4 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ValueTokenizer.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ValueTokenizer.java
@@ -14,8 +14,8 @@ import java.util.Vector;
public class ValueTokenizer {
- private static final char SEPARATE = ','; //$NON-NLS-1$
- private static final char CONTROL = '\\'; //$NON-NLS-1$
+ private static final char SEPARATE = ',';
+ private static final char CONTROL = '\\';
Vector _value_vector = new Vector(7);
@@ -32,14 +32,13 @@ public class ValueTokenizer {
if (i + 1 < values_str.length()) {
buffer.append(values_str.charAt(++i));
continue;
- } else {
- // CONTROL char should not occur in last char.
- Logging.log(Logging.ERROR, this, "ValueTokenizer(String)", //$NON-NLS-1$
- MetaTypeMsg.TOKENIZER_GOT_INVALID_DATA);
- // It's an invalid char, but since it's the last one,
- // just ignore it.
- continue;
}
+ // CONTROL char should not occur in last char.
+ Logging.log(Logging.ERROR, this, "ValueTokenizer(String)", //$NON-NLS-1$
+ MetaTypeMsg.TOKENIZER_GOT_INVALID_DATA);
+ // It's an invalid char, but since it's the last one,
+ // just ignore it.
+ continue;
}
if (values_str.charAt(i) == SEPARATE) {
_value_vector.addElement(buffer.toString().trim());

Back to the top