mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-03 07:05:55 +00:00
Merge branch 'refactoring/JENKINS-47896-serializableOnlyOverRemoting' of github.com:oleg-nenashev/jenkins into SerializableOnlyOverRemoting-JENKINS-47896
This commit is contained in:
3 files changed
+15
-12
No files matched your search
@@ -130,6 +130,7 @@ import org.apache.tools.zip.ZipEntry;
|
||||
import org.apache.tools.zip.ZipFile;
|
||||
import org.jenkinsci.remoting.RoleChecker;
|
||||
import org.jenkinsci.remoting.RoleSensitive;
|
||||
import org.jenkinsci.remoting.SerializableOnlyOverRemoting;
|
||||
import org.kohsuke.accmod.Restricted;
|
||||
import org.kohsuke.accmod.restrictions.NoExternalUse;
|
||||
import org.kohsuke.stapler.Function;
|
||||
@@ -207,7 +208,7 @@ import org.apache.tools.ant.BuildException;
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see VirtualFile
|
||||
*/
|
||||
public final class FilePath implements Serializable {
|
||||
public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
/**
|
||||
* Maximum http redirects we will follow. This defaults to the same number as Firefox/Chrome tolerates.
|
||||
*/
|
||||
@@ -2985,18 +2986,17 @@ public final class FilePath implements Serializable {
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream oos) throws IOException {
|
||||
Channel target = Channel.current();
|
||||
|
||||
if(channel!=null && channel!=target)
|
||||
throw new IllegalStateException("Can't send a remote FilePath to a different remote channel");
|
||||
Channel target = getChannelForSerialization();
|
||||
if (channel != null && channel != target) {
|
||||
throw new IllegalStateException("Can't send a remote FilePath to a different remote channel (current=" + channel + ", target=" + target + ")");
|
||||
}
|
||||
|
||||
oos.defaultWriteObject();
|
||||
oos.writeBoolean(channel==null);
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
|
||||
Channel channel = Channel.current();
|
||||
assert channel!=null;
|
||||
Channel channel = getChannelForSerialization();
|
||||
|
||||
ois.defaultReadObject();
|
||||
if(ois.readBoolean()) {
|
||||
|
||||
Reference in new issue
Block a user