Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-06-12 20:08:41 +0000
committerslewis2014-06-12 20:08:41 +0000
commitd3dfa412d7f20ca4dc540922537be8e1f3dce094 (patch)
tree406c481459d946b563b6168187b7aba44fa18766 /protocols
parentc28a9bebcf78dc077f1313504035a9db3cecbcad (diff)
parente6a34a588cbfec3b900de463ae0568f1743d0203 (diff)
downloadorg.eclipse.ecf-424059.tar.gz
org.eclipse.ecf-424059.tar.xz
org.eclipse.ecf-424059.zip
Merge remote-tracking branch 'origin/master' into 424059424059
Conflicts: framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF merged manually by sbl Change-Id: If086dde4fffb137f44a48d183f6280f068c8eb17
Diffstat (limited to 'protocols')
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF4
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml4
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java19
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java53
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java151
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/StringUtils.java58
-rw-r--r--protocols/bundles/org.jivesoftware.smack/about.html2
7 files changed, 168 insertions, 123 deletions
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF b/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
index c28658b9a..b999a71f0 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: ch.ethz.iks.r_osgi.remote
-Bundle-Version: 1.0.0.RC4_qualifier
+Bundle-Version: 1.0.1.RC1_qualifier
Bundle-Vendor: %plugin.provider
-Import-Package: org.objectweb.asm;version="[3.1.0,4.0.0)",
+Import-Package: org.objectweb.asm;version="[5.0.1,6.0.0)",
org.osgi.framework,
org.osgi.service.event,
org.osgi.service.log,
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml b/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
index 0ee6cf331..d13cf65fa 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
@@ -58,9 +58,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>asm</groupId>
+ <groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>3.0</version>
+ <version>5.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
index 85acd857e..b88d7178e 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
@@ -44,7 +44,6 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.StringTokenizer;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -85,6 +84,7 @@ import ch.ethz.iks.r_osgi.streams.InputStreamProxy;
import ch.ethz.iks.r_osgi.streams.OutputStreamHandle;
import ch.ethz.iks.r_osgi.streams.OutputStreamProxy;
import ch.ethz.iks.util.CollectionUtils;
+import ch.ethz.iks.util.StringUtils;
/**
* <p>
@@ -819,10 +819,10 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
// store the bundle for state updates and cleanup
proxyBundles.put(ref.getURI().getFragment(), bundle);
}
-
+
// start the bundle
- bundle.start();
-
+ bundle.start();
+
} catch (final BundleException e) {
final Throwable nested = e.getNestedException() == null ? e : e
.getNestedException();
@@ -866,13 +866,14 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
*/
private String[] getTokens(final String str) {
final ArrayList result = new ArrayList();
- final StringTokenizer tokenizer = new StringTokenizer(str, ",");
- while (tokenizer.hasMoreTokens()) {
- final String token = tokenizer.nextToken();
+ //final StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ final String[] tokens = StringUtils.stringToArray(str, ",");
+
+ for (int i=0; i<tokens.length; i++) {
final int pos;
// TODO: handle versions for R4!
- final String pkg = (pos = token.indexOf(";")) > -1 ? token
- .substring(0, pos).trim() : token.trim();
+ final String pkg = (pos = tokens[i].indexOf(";")) > -1 ? tokens[i]
+ .substring(0, pos).trim() : tokens[i].trim();
if (!RemoteOSGiServiceImpl.checkPackageImport(pkg)) {
result.add(pkg);
}
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
index 62dd55431..541ccf614 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
@@ -67,7 +67,7 @@ import ch.ethz.iks.util.StringUtils;
* @author Jan S. Rellermeyer, ETH Zurich
* @since 0.6
*/
-final class CodeAnalyzer implements ClassVisitor {
+final class CodeAnalyzer extends ClassVisitor {
/**
* the class loader of the service provider bundle.
@@ -128,6 +128,7 @@ final class CodeAnalyzer implements ClassVisitor {
*/
CodeAnalyzer(final ClassLoader loader, final String imports,
final String exports) {
+ super(Opcodes.ASM5);
this.loader = loader;
if (imports != null) {
@@ -136,8 +137,8 @@ final class CodeAnalyzer implements ClassVisitor {
for (int i = 0; i < tokens.length; i++) {
final int pos = tokens[i].indexOf(";"); //$NON-NLS-1$
if (pos > -1) {
- importsMap.put(tokens[i].substring(0, pos), tokens[i]
- .substring(pos + 1, tokens[i].length()));
+ importsMap.put(tokens[i].substring(0, pos),
+ tokens[i].substring(pos + 1, tokens[i].length()));
} else {
importsMap.put(tokens[i], null);
}
@@ -152,8 +153,8 @@ final class CodeAnalyzer implements ClassVisitor {
for (int i = 0; i < tokens.length; i++) {
final int pos = tokens[i].indexOf(";"); //$NON-NLS-1$
if (pos > -1) {
- exportsMap.put(tokens[i].substring(0, pos), tokens[i]
- .substring(pos + 1, tokens[i].length()));
+ exportsMap.put(tokens[i].substring(0, pos),
+ tokens[i].substring(pos + 1, tokens[i].length()));
} else {
exportsMap.put(tokens[i], null);
}
@@ -184,8 +185,8 @@ final class CodeAnalyzer implements ClassVisitor {
DeliverServiceMessage analyze(final String[] ifaces,
final String smartProxy, final String[] explicitInjections,
final String presentation) throws ClassNotFoundException,
- IOException {
-
+ IOException {
+
closure.addAll(Arrays.asList(ifaces));
if (smartProxy != null) {
@@ -197,11 +198,11 @@ final class CodeAnalyzer implements ClassVisitor {
if (explicitInjections != null) {
closure.addAll(Arrays.asList(explicitInjections));
}
-
+
while (!closure.isEmpty()) {
visit((String) closure.remove(0));
}
-
+
for (int i = 0; i < ifaces.length; i++) {
proxyImports.add(packageOf(ifaces[i]));
proxyExports.add(packageOf(ifaces[i]));
@@ -217,7 +218,7 @@ final class CodeAnalyzer implements ClassVisitor {
final StringBuffer exportDeclaration = new StringBuffer();
final String[] pi = (String[]) proxyImports
.toArray(new String[proxyImports.size()]);
-
+
for (int i = 0; i < pi.length; i++) {
importDeclaration.append(pi[i]);
final Object v = importsMap.get(pi[i]);
@@ -269,8 +270,8 @@ final class CodeAnalyzer implements ClassVisitor {
*/
private void visit(final String className) throws ClassNotFoundException {
currentClass = className.replace('.', '/');
- // remove array indicators
- if(currentClass.startsWith("[L")) {
+ // remove array indicators
+ if (currentClass.startsWith("[L")) {
currentClass = currentClass.substring(2);
} else if (currentClass.startsWith("L")) {
currentClass = currentClass.substring(1);
@@ -283,14 +284,14 @@ final class CodeAnalyzer implements ClassVisitor {
proxyExports.add(pkg);
}
try {
- final ClassReader reader = new ClassReader(loader
- .getResourceAsStream(classFile));
+ final ClassReader reader = new ClassReader(
+ loader.getResourceAsStream(classFile));
injections.put(classFile, reader.b);
if (exportsMap.containsKey(pkg)) {
proxyExports.add(pkg);
}
- reader.accept(this, ClassReader.SKIP_DEBUG
+ reader.accept(this, ClassReader.SKIP_DEBUG
+ ClassReader.SKIP_FRAMES);
} catch (final IOException ioe) {
throw new ClassNotFoundException(className);
@@ -316,7 +317,7 @@ final class CodeAnalyzer implements ClassVisitor {
* the type.
*/
void visitType(final Type t) {
-
+
if (t.getSort() < Type.ARRAY) {
visited.add(t.getClassName());
return;
@@ -367,7 +368,7 @@ final class CodeAnalyzer implements ClassVisitor {
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
-
+
if (superName != null && !visited.contains(superName)) {
visitType(Type.getType('L' + superName + ';'));
}
@@ -486,7 +487,11 @@ final class CodeAnalyzer implements ClassVisitor {
*
* @author Jan S. Rellermeyer, ETH Zurich
*/
- final class MethodAnalyzer implements MethodVisitor {
+ final class MethodAnalyzer extends MethodVisitor {
+
+ protected MethodAnalyzer() {
+ super(Opcodes.ASM5);
+ }
/**
*
@@ -495,6 +500,7 @@ final class CodeAnalyzer implements ClassVisitor {
*/
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
+
if (!visited.contains(desc)) {
visitType(Type.getType("L" + desc + ";")); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -639,6 +645,17 @@ final class CodeAnalyzer implements ClassVisitor {
}
/**
+ * @see org.objectweb.asm.MethodVisitor#visitMethodInsn(int,
+ * java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void visitMethodInsn(int opcode, String owner, String name,
+ String desc, boolean itf) {
+ if (!visited.contains(owner)) {
+ visitType(Type.getType("L" + owner + ";")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
*
* @see org.objectweb.asm.MethodVisitor#visitMultiANewArrayInsn(java.lang.String,
* int)
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
index a7936092a..32f8d3a54 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
@@ -46,13 +46,11 @@ import java.util.zip.CRC32;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
-import org.objectweb.asm.ClassAdapter;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodAdapter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
@@ -72,7 +70,7 @@ import ch.ethz.iks.r_osgi.types.ServiceUIComponent;
* @author Jan S. Rellermeyer, ETH Zurich.
* @since 0.1
*/
-class ProxyGenerator implements ClassVisitor, Opcodes {
+class ProxyGenerator extends ClassVisitor implements Opcodes {
/**
* sourceID.
@@ -185,7 +183,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
* constructor.
*/
ProxyGenerator() {
-
+ super(Opcodes.ASM5);
}
/**
@@ -207,9 +205,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
injections = deliv.getInjections();
final byte[] bytes = deliv.getSmartProxyName() == null ? generateProxyClass(
deliv.getInterfaceNames(), deliv.getInterfaceClass())
- : generateProxyClass(deliv.getInterfaceNames(), deliv
- .getInterfaceClass(), deliv.getSmartProxyName(), deliv
- .getProxyClass());
+ : generateProxyClass(deliv.getInterfaceNames(),
+ deliv.getInterfaceClass(), deliv.getSmartProxyName(),
+ deliv.getProxyClass());
final String className = implName.replace('/', '.');
JarEntry jarEntry;
@@ -221,15 +219,15 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
attr.putValue("Created-By", "R-OSGi Proxy Generator"); //$NON-NLS-1$ //$NON-NLS-2$
attr.putValue("Bundle-Activator", className); //$NON-NLS-1$
attr.putValue("Bundle-Classpath", "."); //$NON-NLS-1$ //$NON-NLS-2$
- attr.putValue("Bundle-SymbolicName", "R-OSGi Proxy Bundle generated for Endpoint " + uri.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- attr
- .putValue(
- "Import-Package", //$NON-NLS-1$
- "org.osgi.framework, ch.ethz.iks.r_osgi, ch.ethz.iks.r_osgi.types, ch.ethz.iks.r_osgi.channels" //$NON-NLS-1$
- + ("".equals(deliv.getOptionalImports()) ? "" : ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ attr.putValue(
+ "Bundle-SymbolicName", "R-OSGi Proxy Bundle generated for Endpoint " + uri.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ attr.putValue(
+ "Import-Package", //$NON-NLS-1$
+ "org.osgi.framework, ch.ethz.iks.r_osgi, ch.ethz.iks.r_osgi.types, ch.ethz.iks.r_osgi.channels" //$NON-NLS-1$
+ + ("".equals(deliv.getOptionalImports()) ? "" : ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ deliv.getOptionalImports())
- + ("".equals(deliv.getImports()) ? "" : ", ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- + deliv.getImports());
+ + ("".equals(deliv.getImports()) ? "" : ", ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + deliv.getImports());
if (!"".equals(deliv.getExports())) { //$NON-NLS-1$
attr.putValue("Export-Package", deliv.getExports()); //$NON-NLS-1$
}
@@ -374,10 +372,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
final ClassReader reader;
if (bytes == null) {
try {
- final Class clazz = Class.forName(
- superIface.replace('/', '.'));
- ClassLoader classLoader = clazz
- .getClassLoader();
+ final Class clazz = Class.forName(superIface
+ .replace('/', '.'));
+ ClassLoader classLoader = clazz.getClassLoader();
if (classLoader == null) {
// For classes loaded by the bootstrap CL, the
// CL will be null. This happens e.g. on classes
@@ -386,8 +383,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
// (see https://bugs.eclipse.org/420112)
classLoader = getClass().getClassLoader();
}
- reader = new ClassReader(classLoader.getResourceAsStream(
- superIface + ".class")); //$NON-NLS-1$
+ reader = new ClassReader(
+ classLoader.getResourceAsStream(superIface
+ + ".class")); //$NON-NLS-1$
} catch (final IOException ioe) {
throw new IOException("While processing " //$NON-NLS-1$
+ superIface.replace('/', '.') + ": " //$NON-NLS-1$
@@ -452,12 +450,11 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
ifaces.add("org/osgi/framework/BundleActivator"); //$NON-NLS-1$
ifaces.addAll(Arrays.asList(serviceInterfaces));
// V1_1
- writer
- .visit(
- (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
- : V1_2, ACC_PUBLIC + ACC_SUPER,
- implName, null, superName, (String[]) ifaces
- .toArray(new String[ifaces.size()]));
+ writer.visit(
+ (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
+ : V1_2, ACC_PUBLIC + ACC_SUPER, implName, null,
+ superName, (String[]) ifaces.toArray(new String[ifaces
+ .size()]));
if (java.util.Arrays.asList(interfaces).contains(
"ch/ethz/iks/r_osgi/SmartProxy")) { //$NON-NLS-1$
@@ -467,12 +464,10 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
} else {
// we have an interface
- writer
- .visit(
- (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
- : V1_2, ACC_PUBLIC + ACC_SUPER,
- implName, null,
- "java/lang/Object", serviceInterfaces); //$NON-NLS-1$
+ writer.visit(
+ (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
+ : V1_2, ACC_PUBLIC + ACC_SUPER, implName, null,
+ "java/lang/Object", serviceInterfaces); //$NON-NLS-1$
if (RemoteOSGiServiceImpl.PROXY_DEBUG) {
RemoteOSGiServiceImpl.log.log(LogService.LOG_DEBUG,
"Creating Proxy Bundle from Interfaces " //$NON-NLS-1$
@@ -510,16 +505,14 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitVarInsn(ALOAD, 1);
method.visitVarInsn(ALOAD, 1);
method.visitLdcInsn(Remoting.class.getName());
- method
- .visitMethodInsn(INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "getServiceReference", //$NON-NLS-1$
- "(Ljava/lang/String;)Lorg/osgi/framework/ServiceReference;"); //$NON-NLS-1$
- method
- .visitMethodInsn(INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "getService", //$NON-NLS-1$
- "(Lorg/osgi/framework/ServiceReference;)Ljava/lang/Object;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "getServiceReference", //$NON-NLS-1$
+ "(Ljava/lang/String;)Lorg/osgi/framework/ServiceReference;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "getService", //$NON-NLS-1$
+ "(Lorg/osgi/framework/ServiceReference;)Ljava/lang/Object;"); //$NON-NLS-1$
method.visitTypeInsn(CHECKCAST, REMOTING_I);
method.visitVarInsn(ASTORE, 2);
method.visitVarInsn(ALOAD, 0);
@@ -563,16 +556,14 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
"getProperties", //$NON-NLS-1$
"(Ljava/lang/String;)Ljava/util/Dictionary;"); //$NON-NLS-1$
- method
- .visitMethodInsn(
- INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "registerService", //$NON-NLS-1$
- "([Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
- method
- .visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
- "trackRegistration", //$NON-NLS-1$
- "(Ljava/lang/String;Lorg/osgi/framework/ServiceRegistration;)V"); //$NON-NLS-1$
+ method.visitMethodInsn(
+ INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "registerService", //$NON-NLS-1$
+ "([Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
+ "trackRegistration", //$NON-NLS-1$
+ "(Ljava/lang/String;Lorg/osgi/framework/ServiceRegistration;)V"); //$NON-NLS-1$
method.visitVarInsn(ALOAD, 0);
method.visitFieldInsn(GETFIELD, implName, "endpoint", "L" //$NON-NLS-1$ //$NON-NLS-2$
+ ENDPOINT_I + ";"); //$NON-NLS-1$
@@ -598,10 +589,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitVarInsn(ALOAD, 4);
method.visitVarInsn(ALOAD, 0);
method.visitVarInsn(ALOAD, 1);
- method
- .visitMethodInsn(INVOKEINTERFACE, UICOMP_I,
- "initComponent", //$NON-NLS-1$
- "(Ljava/lang/Object;Lorg/osgi/framework/BundleContext;)V"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, UICOMP_I,
+ "initComponent", //$NON-NLS-1$
+ "(Ljava/lang/Object;Lorg/osgi/framework/BundleContext;)V"); //$NON-NLS-1$
method.visitVarInsn(ALOAD, 1);
method.visitLdcInsn(ServiceUIComponent.class.getName());
method.visitVarInsn(ALOAD, 4);
@@ -612,12 +602,11 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
"getPresentationProperties", //$NON-NLS-1$
"(Ljava/lang/String;)Ljava/util/Dictionary;"); //$NON-NLS-1$
- method
- .visitMethodInsn(
- INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "registerService", //$NON-NLS-1$
- "(Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
+ method.visitMethodInsn(
+ INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "registerService", //$NON-NLS-1$
+ "(Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
method.visitInsn(POP);
method.visitLabel(l0);
if (addLifecycleSupport) {
@@ -852,10 +841,8 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
needsBoxing = true;
}
}
- method
- .visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
- "invokeMethod", //$NON-NLS-1$
- "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I, "invokeMethod", //$NON-NLS-1$
+ "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); //$NON-NLS-1$
// unboxing of primitive type return values.
final Type returnType = Type.getReturnType(desc);
@@ -918,18 +905,18 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
writer.visitEnd();
}
- private final class ClassRewriter extends ClassAdapter {
+ private final class ClassRewriter extends ClassVisitor {
/**
*
*/
ClassRewriter(final ClassWriter writer) {
- super(writer);
+ super(Opcodes.ASM5, writer);
}
/**
*
- * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String,
+ * @see org.objectweb.asm.ClassVisitor#visit(int, int, java.lang.String,
* java.lang.String, java.lang.String, java.lang.String[])
*/
public void visit(final int version, final int access,
@@ -945,7 +932,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String,
+ * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String,
* java.lang.String, java.lang.String, java.lang.Object)
*/
public FieldVisitor visitField(final int access, final String name,
@@ -978,7 +965,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitInnerClass(java.lang.String,
+ * @see org.objectweb.asm.ClassVisitor#visitInnerClass(java.lang.String,
* java.lang.String, java.lang.String, int)
*/
public void visitInnerClass(final String name, final String outerName,
@@ -989,7 +976,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitMethod(int,
+ * @see org.objectweb.asm.ClassVisitor#visitMethod(int,
* java.lang.String, java.lang.String, java.lang.String,
* java.lang.String[])
*/
@@ -1011,13 +998,13 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
*
* @author Jan S. Rellermeyer, ETH Zurich
*/
- private final class MethodRewriter extends MethodAdapter {
+ private final class MethodRewriter extends MethodVisitor {
/**
* @param methodWriter
* methodWriter
*/
MethodRewriter(final MethodVisitor methodWriter) {
- super(methodWriter);
+ super(Opcodes.ASM5, methodWriter);
}
/**
@@ -1070,6 +1057,16 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
}
/**
+ * @see org.objectweb.asm.MethodVisitor#visitMethodInsn(int,
+ * java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void visitMethodInsn(int opcode, String owner, String name,
+ String desc, boolean itf) {
+ super.mv.visitMethodInsn(opcode, checkRewrite(owner), name,
+ checkRewriteDesc(desc), itf);
+ }
+
+ /**
* @param desc
* desc
* @param dims
@@ -1134,8 +1131,8 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
*/
private static String generateSourceID(final String id) {
final int pos1 = id.indexOf("://"); //$NON-NLS-1$
- final char[] chars = id.substring(pos1 + 3).replace('/', '_').replace(
- ':', '_').replace('-', '_').toCharArray();
+ final char[] chars = id.substring(pos1 + 3).replace('/', '_')
+ .replace(':', '_').replace('-', '_').toCharArray();
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < chars.length; i++) {
if (chars[i] == '.') {
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/StringUtils.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/StringUtils.java
index 79f6bcec2..e0476f21b 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/StringUtils.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/util/StringUtils.java
@@ -32,7 +32,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.StringTokenizer;
/**
* String utilities.
@@ -58,34 +57,65 @@ public final class StringUtils {
* @return the array of strings.
* @since 0.2
*/
- public static String[] stringToArray(final String data, final String delim) {
- final StringTokenizer tokenizer = new StringTokenizer(data, delim);
- final String[] tokens = new String[tokenizer.countTokens()];
- final int tokenCount = tokenizer.countTokens();
- for (int i = 0; i < tokenCount; i++) {
- tokens[i] = tokenizer.nextToken().trim();
+ public static String[] stringToArray(final String data,
+ final String delim) {
+
+ if (data == null) {
+ return new String[0];
}
- return tokens;
+ final List tokens = new ArrayList(data.length() / 10);
+ int pointer = 0;
+ int quotePointer = 0;
+ int tokenStart = 0;
+ int nextDelimiter;
+ while ((nextDelimiter = data.indexOf(delim, pointer)) > -1) {
+ final int openingQuote = data.indexOf("\"", quotePointer);
+ int closingQuote = data.indexOf("\"", openingQuote + 1);
+ if (openingQuote > closingQuote) {
+ throw new IllegalArgumentException(
+ "Missing closing quotation mark.");
+ }
+ if (openingQuote > -1 && openingQuote < nextDelimiter
+ && closingQuote < nextDelimiter) {
+ quotePointer = ++closingQuote;
+ continue;
+ }
+ if (openingQuote < nextDelimiter && nextDelimiter < closingQuote) {
+ pointer = ++closingQuote;
+ continue;
+ }
+ // TODO: for performance, fold the trim into the splitting
+ tokens.add(data.substring(tokenStart, nextDelimiter).trim());
+ pointer = ++nextDelimiter;
+ quotePointer = pointer;
+ tokenStart = pointer;
+ }
+ tokens.add(data.substring(tokenStart).trim());
+ return (String[]) tokens.toArray(new String[tokens.size()]);
}
/**
* R \ L (comparison operation allows wildcards)
- * @param left A set of matchers (supports wildcard at end)
- * @param right A set of inputs
- * @return The subset of right with all elements removed matching left
+ *
+ * @param left
+ * A set of matchers (supports wildcard at end)
+ * @param right
+ * A set of inputs
+ * @return The subset of right with all elements removed matching left
* @since 1.0
*/
public static Collection rightDifference(Collection left, Collection right) {
// This is O(n²) due to substring (wildcard) matching
// It's also quick and dirty (better use pattern matcher instead)
// TODO use pattern matcher
- // (pattern matcher would increase the BREE dependency, but we could hide
- // the FilterUtils implementation behind an interface and provide different
+ // (pattern matcher would increase the BREE dependency, but we could
+ // hide
+ // the FilterUtils implementation behind an interface and provide
+ // different
// service implementations)
// A trie would also allow for faster lookup.
-
// Have to convert c1 into List to support remove operation
final List result = new ArrayList(right);
diff --git a/protocols/bundles/org.jivesoftware.smack/about.html b/protocols/bundles/org.jivesoftware.smack/about.html
index 55c15dae2..e2b700699 100644
--- a/protocols/bundles/org.jivesoftware.smack/about.html
+++ b/protocols/bundles/org.jivesoftware.smack/about.html
@@ -30,7 +30,7 @@
for informational purposes only, and you should look to the Redistributor's license for
terms and conditions of use.</p>
-<h4>Jive Software Smack API v3.1.0</h4>
+<h4>Jive Software Smack API v3.3.1</h4>
<p>This plugin is based on software developed by <a href="http://www.jivesoftware.org">Jive Software</a> project team at
<a href="http://www.igniterealtime.org/">http://www.igniterealtime.org/</a>.

Back to the top