Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Treating this error as fatal and providing basic diagnostic information
  • Loading branch information
kohsuke committed Apr 15, 2014
1 parent 0ccbbc6 commit c9d61a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/main/java/hudson/remoting/Channel.java
Expand Up @@ -32,6 +32,7 @@
import hudson.remoting.forward.ForwarderFactory;
import hudson.remoting.forward.PortForwarder;

import javax.annotation.Nonnull;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -591,7 +592,7 @@ public <T> T export(Class<T> type, T instance) {
return exportedObjects.export(instance, automaticUnexport);
}

/*package*/ Object getExportedObject(int oid) {
/*package*/ @Nonnull Object getExportedObject(int oid) {
return exportedObjects.get(oid);
}

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/hudson/remoting/ExportTable.java
Expand Up @@ -23,6 +23,7 @@
*/
package hudson.remoting;

import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
Expand All @@ -44,11 +45,11 @@ final class ExportTable<T> {
private final ThreadLocal<ExportList> lists = new ThreadLocal<ExportList>();

/**
* Information about one exporetd object.
* Information about one exported object.
*/
private final class Entry {
final int id;
final T object;
final @Nonnull T object;
/**
* Where was this object first exported?
*/
Expand Down Expand Up @@ -181,10 +182,11 @@ public synchronized int export(T t, boolean notifyListener) {
e.pin();
}

public synchronized T get(int id) {
public synchronized @Nonnull T get(int id) {
Entry e = table.get(id);
if(e!=null) return e.object;
else return null;

throw new IllegalStateException("Invalid object ID "+id+" iota="+iota);
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/hudson/remoting/RemoteInvocationHandler.java
Expand Up @@ -290,8 +290,6 @@ public ClassLoader getClassLoader() {

protected Serializable perform(Channel channel) throws Throwable {
Object o = channel.getExportedObject(oid);
if(o==null)
throw new IllegalStateException("Unable to call "+methodName+". Invalid object ID "+oid);
try {
Method m = choose(o);
if(m==null)
Expand Down

0 comments on commit c9d61a3

Please sign in to comment.