You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2010/12/28 13:11:01 UTC

svn commit: r1053323 - /incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java

Author: peter_firmstone
Date: Tue Dec 28 12:11:01 2010
New Revision: 1053323

URL: http://svn.apache.org/viewvc?rev=1053323&view=rev
Log:
Minor refactoring

Modified:
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java

Modified: incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java?rev=1053323&r1=1053322&r2=1053323&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java (original)
+++ incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java Tue Dec 28 12:11:01 2010
@@ -18,6 +18,7 @@
 
 package org.apache.river.api.lookup;
 
+import java.security.CodeSource;
 import org.apache.river.api.lookup.MarshalledServiceItem;
 import org.apache.river.api.util.ResultStream;
 import net.jini.core.lookup.*;
@@ -33,7 +34,8 @@ import net.jini.core.lookup.*;
  * @see StreamServiceRegistrar
  */
 public class ServiceResultStreamUnmarshaller implements ResultStream<ServiceItem> {
-    ResultStream input;
+    private final ResultStream input;
+    private final CodeSource[] codebase;
     
     /** 
      * Note the methods of ServiceResultStreamUnmarshaller, implement the 
@@ -41,15 +43,18 @@ public class ServiceResultStreamUnmarsha
      * doesn't to ensure type safety at the client, where runtime binding 
      * prevents the compiler from checking the type.
      */ 
-    public ServiceResultStreamUnmarshaller(ResultStream rs){
+    public ServiceResultStreamUnmarshaller(ResultStream rs, CodeSource[] cs){
         input = rs;
+	if (cs == null) { cs = new CodeSource[0];}
+	codebase = cs;
     }
 
     public ServiceItem get() {
+	if (input == null) return null;
         for(Object item = input.get(); item != null; item = input.get()) {
             if (item instanceof MarshalledServiceItem){
                 MarshalledServiceItem msi = (MarshalledServiceItem) item;
-                ServiceItem it = new ServiceItem(msi.serviceID, msi.getService(null),
+                ServiceItem it = new ServiceItem(msi.serviceID, msi.getService(codebase),
                         msi.getEntries());
                 return it;
             } else if (item instanceof ServiceItem) {
@@ -63,6 +68,7 @@ public class ServiceResultStreamUnmarsha
     }
 
     public void close() {
+	if (input == null) return;
         input.close();
     }