Refactoring

See github line by line comments in 'File changed'
This commit is contained in:
vraskulin 2016-12-29 16:49:12 +03:00
parent c0cf22bbf7
commit f04ba151f7
52 changed files with 87 additions and 220 deletions

View file

@ -64,12 +64,9 @@ public class Copier<T> {
ObjectInputStream in = new CopierObjectInputStream(loader, fbos.getInputStream());
copy = (T) in.readObject();
}
catch(IOException e) {
catch(IOException | ClassNotFoundException e) {
e.printStackTrace();
}
catch(ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
return copy;
}
@ -99,12 +96,9 @@ public class Copier<T> {
try (ObjectInputStream in = new CopierObjectInputStream(loader, new GZIPInputStream(new ByteArrayInputStream(buffer)))) {
copy = (T) in.readObject();
}
catch(IOException e) {
catch(IOException | ClassNotFoundException e) {
e.printStackTrace();
}
catch(ClassNotFoundException cnfe) {
cnfe.printStackTrace();
}
return copy;
}
}

View file

@ -41,7 +41,7 @@ import java.io.StreamCorruptedException;
public class CopierObjectInputStream extends ObjectInputStream {
ClassLoader myLoader = null;
public CopierObjectInputStream(ClassLoader newLoader, InputStream theStream) throws IOException, StreamCorruptedException {
public CopierObjectInputStream(ClassLoader newLoader, InputStream theStream) throws IOException {
super(theStream);
myLoader = newLoader;
}

View file

@ -10,7 +10,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import mage.cards.Card;

View file

@ -83,9 +83,7 @@ public class CopyTokenFunction implements Function<Token, Card> {
} else {
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
target.setOriginalCardNumber(source.getCardNumber());
if (source instanceof Card) {
target.setCopySourceCard(source);
}
target.setCopySourceCard(source);
}
target.setName(sourceObj.getName());