Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfogell2006-02-06 17:25:52 +0000
committerjfogell2006-02-06 17:25:52 +0000
commit1d7d80dca8634a2e75281b9d747a076b954ddfe3 (patch)
treef01ec9cfd4d5e235467e658b292b9c143e228cdf
parent50135199bb7070c4a14a6ec54f29b3e2191e062a (diff)
downloadrt.equinox.bundles-1d7d80dca8634a2e75281b9d747a076b954ddfe3.tar.gz
rt.equinox.bundles-1d7d80dca8634a2e75281b9d747a076b954ddfe3.tar.xz
rt.equinox.bundles-1d7d80dca8634a2e75281b9d747a076b954ddfe3.zip
removed compile warnings per bug #125838
-rw-r--r--bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/Activator.java44
-rw-r--r--bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogReaderService.java30
-rw-r--r--bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceImpl.java (renamed from bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogService.java)31
-rw-r--r--bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LoggedException.java9
5 files changed, 60 insertions, 58 deletions
diff --git a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/Activator.java b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/Activator.java
index 8c1283b41..6af7eedbb 100644
--- a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/Activator.java
+++ b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/Activator.java
@@ -16,6 +16,7 @@ import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
+import org.osgi.service.log.LogService;
/**
* An array of LogEntries which wraps when full.
@@ -57,16 +58,13 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
/** Pid that log service uses when it registers a CM Managed Service */
protected static final String LOGSERVICEPID = "org.eclipse.equinox.log.Log"; //$NON-NLS-1$
- public Activator() {
- }
-
/**
* BundleActivator.start method. We can now initialize the bundle
* and register the services.
*
*/
- public void start(BundleContext context) {
- this.context = context;
+ public void start(BundleContext bundleContext) {
+ this.context = bundleContext;
eventManager = new EventManager("Log Event Dispatcher"); //$NON-NLS-1$
logEvent = new EventListeners();
@@ -75,11 +73,11 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
head = 0;
tail = 0;
String initmessage = NLS.bind(LogMsg.Log_created_Log_Size, String.valueOf(logSize), String.valueOf(logThreshold));
- logEntries[0] = new LogEntry(LogService.LOG_INFO, initmessage, context.getBundle(), null, null);
+ logEntries[0] = new LogEntry(LogService.LOG_INFO, initmessage, bundleContext.getBundle(), null, null);
- context.addBundleListener(this);
- context.addServiceListener(this);
- context.addFrameworkListener(this);
+ bundleContext.addBundleListener(this);
+ bundleContext.addServiceListener(this);
+ bundleContext.addFrameworkListener(this);
registerLogService();
registerLogReaderService();
@@ -92,7 +90,7 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
* execution.
*
*/
- public synchronized void stop(BundleContext context) {
+ public synchronized void stop(BundleContext bundleContext) {
if (logmanagedservice != null) {
logmanagedservice.unregister();
logmanagedservice = null;
@@ -203,10 +201,10 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
}
protected synchronized Enumeration logEntries() {
- final int head = this.head;
- final int tail = this.tail;
- final int logSize = this.logSize;
- final LogEntry[] logEntries = this.logEntries;
+ final int tempHead = this.head;
+ final int tempTail = this.tail;
+ final int templogSize = this.logSize;
+ final LogEntry[] tempLogEntries = this.logEntries;
return (new Enumeration() {
private int item;
@@ -214,16 +212,16 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
{
// The array is created in the log reader's memory space
- if (head <= tail) {
- item = tail - head + 1;
+ if (tempHead <= tempTail) {
+ item = tempTail - tempHead + 1;
enumentries = new LogEntry[item];
- System.arraycopy(logEntries, head, enumentries, 0, item);
+ System.arraycopy(tempLogEntries, tempHead, enumentries, 0, item);
} else { // log is full
- int firstcopy = logSize - head;
- item = firstcopy + tail + 1;
+ int firstcopy = templogSize - tempHead;
+ item = firstcopy + tempTail + 1;
enumentries = new LogEntry[item];
- System.arraycopy(logEntries, head, enumentries, 0, firstcopy);
- System.arraycopy(logEntries, 0, enumentries, firstcopy, item - firstcopy);
+ System.arraycopy(tempLogEntries, tempHead, enumentries, 0, firstcopy);
+ System.arraycopy(tempLogEntries, 0, enumentries, firstcopy, item - firstcopy);
}
}
@@ -517,9 +515,9 @@ public class Activator implements BundleActivator, EventDispatcher, BundleListen
properties.put(Constants.SERVICE_VENDOR, "IBM"); //$NON-NLS-1$
properties.put(Constants.SERVICE_DESCRIPTION, LogMsg.OSGi_Log_Service_IBM_Implementation);
- properties.put(Constants.SERVICE_PID, LogService.class.getName());
+ properties.put(Constants.SERVICE_PID, LogServiceImpl.class.getName());
- logservice = context.registerService(org.osgi.service.log.LogService.class.getName(), new LogServiceFactory(this), properties);
+ logservice = context.registerService(LogService.class.getName(), new LogServiceFactory(this), properties);
}
diff --git a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogReaderService.java b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogReaderService.java
index 96bb6644d..b6f92e3d2 100644
--- a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogReaderService.java
+++ b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogReaderService.java
@@ -12,8 +12,8 @@ package org.eclipse.equinox.log;
import java.util.Enumeration;
import java.util.Vector;
-import org.eclipse.osgi.framework.eventmgr.EventListeners;
import org.eclipse.osgi.framework.eventmgr.EventDispatcher;
+import org.eclipse.osgi.framework.eventmgr.EventListeners;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogListener;
@@ -33,21 +33,21 @@ public class LogReaderService implements org.osgi.service.log.LogReaderService,
}
protected void close() {
- Activator log = this.log;
+ Activator tempLog = this.log;
this.log = null;
this.bundle = null;
if (logEvent != null) {
- log.logEvent.removeListener(this);
+ tempLog.logEvent.removeListener(this);
logEvent.removeAllListeners();
logEvent = null;
}
}
public void dispatchEvent(Object l, Object lo, int action, Object object) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
@@ -66,16 +66,16 @@ public class LogReaderService implements org.osgi.service.log.LogReaderService,
* time a message is logged. The requester must have Admin permission.
*/
public void addLogListener(LogListener listener) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
- synchronized (log.logEvent) {
+ synchronized (tempLog.logEvent) {
if (logEvent == null) {
logEvent = new EventListeners();
- log.logEvent.addListener(this, this);
+ tempLog.logEvent.addListener(this, this);
} else {
logEvent.removeListener(listener);
}
@@ -88,14 +88,14 @@ public class LogReaderService implements org.osgi.service.log.LogReaderService,
* Unsubscribe to log events. The requester must have Admin permission.
*/
public void removeLogListener(LogListener listener) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
if (logEvent != null) {
- synchronized (log.logEvent) {
+ synchronized (tempLog.logEvent) {
logEvent.removeListener(listener);
}
}
@@ -109,13 +109,13 @@ public class LogReaderService implements org.osgi.service.log.LogReaderService,
* is implementation specific. The requester must have Admin permission.
*/
public Enumeration getLog() {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return (new Vector(0).elements());
}
- return (log.logEntries());
+ return (tempLog.logEntries());
}
}
diff --git a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceFactory.java b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceFactory.java
index e5e138668..c038d61f8 100644
--- a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceFactory.java
+++ b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceFactory.java
@@ -27,13 +27,13 @@ public class LogServiceFactory implements ServiceFactory {
* ServiceFactory.getService method.
*/
public Object getService(Bundle bundle, ServiceRegistration registration) {
- return (new LogService(log, bundle));
+ return (new LogServiceImpl(log, bundle));
}
/**
* ServiceFactory.ungetService method.
*/
public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) {
- ((LogService) service).close();
+ ((LogServiceImpl) service).close();
}
}
diff --git a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogService.java b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceImpl.java
index 2462161bc..2a7e1a8ed 100644
--- a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogService.java
+++ b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LogServiceImpl.java
@@ -12,16 +12,17 @@ package org.eclipse.equinox.log;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
/**
- * LogService class.
+ * LogServiceImpl class.
*/
-public class LogService implements org.osgi.service.log.LogService {
+public class LogServiceImpl implements LogService {
protected Activator log;
protected Bundle bundle;
- protected LogService(Activator log, Bundle bundle) {
+ protected LogServiceImpl(Activator log, Bundle bundle) {
this.log = log;
this.bundle = bundle;
}
@@ -46,13 +47,13 @@ public class LogService implements org.osgi.service.log.LogService {
* @param String message - Human readable string describing the condition.
*/
public void log(int level, String message) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
- log.log(level, message, bundle, null, null);
+ tempLog.log(level, message, bundle, null, null);
}
/**
@@ -65,13 +66,13 @@ public class LogService implements org.osgi.service.log.LogService {
* @param Throwable exception - The exception that reflects the condition.
*/
public void log(int level, String message, Throwable exception) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
- log.log(level, message, bundle, null, exception);
+ tempLog.log(level, message, bundle, null, exception);
}
/**
@@ -85,13 +86,13 @@ public class LogService implements org.osgi.service.log.LogService {
* @param message Human readable string describing the condition.
*/
public void log(ServiceReference reference, int level, String message) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
- log.log(level, message, bundle, reference, null);
+ tempLog.log(level, message, bundle, reference, null);
}
/**
@@ -105,13 +106,13 @@ public class LogService implements org.osgi.service.log.LogService {
* @param exception The exception that reflects the condition.
*/
public void log(ServiceReference reference, int level, String message, Throwable exception) {
- Activator log = this.log;
+ Activator tempLog = this.log;
- if (log == null) {
+ if (tempLog == null) {
return;
}
- log.log(level, message, bundle, reference, exception);
+ tempLog.log(level, message, bundle, reference, exception);
}
}
diff --git a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LoggedException.java b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LoggedException.java
index 8bef48892..6417ceed7 100644
--- a/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LoggedException.java
+++ b/bundles/org.eclipse.equinox.log/src/org/eclipse/equinox/log/LoggedException.java
@@ -37,6 +37,8 @@ import java.lang.reflect.*;
/* This class MUST be public for nested exception printing to work */
public class LoggedException extends Throwable implements Cloneable {
+ private static final long serialVersionUID = -7432693545895678645L;
+
/** The fully qualified name of exception or error type. */
String exceptionClassName;
@@ -119,7 +121,9 @@ public class LoggedException extends Throwable implements Cloneable {
break;
}
} catch (IllegalAccessException e) {
+ // TODO: Consider wrapping and throwing a RuntimeException
} catch (InvocationTargetException e) {
+ // TODO: Consider wrapping and throwing a RuntimeException
}
}
}
@@ -193,9 +197,8 @@ public class LoggedException extends Throwable implements Cloneable {
public String toString() {
if (message == null) {
return exceptionClassName;
- } else {
- int length = exceptionClassName.length() + message.length() + 2;
- return new StringBuffer(length).append(exceptionClassName).append(": ").append(message).toString(); //$NON-NLS-1$
}
+ int length = exceptionClassName.length() + message.length() + 2;
+ return new StringBuffer(length).append(exceptionClassName).append(": ").append(message).toString(); //$NON-NLS-1$
}
} \ No newline at end of file

Back to the top