Archiviert
13
0

Fixed a number of simple bugs discovered by FindBugs.

Dieser Commit ist enthalten in:
Kristian S. Stangeland 2012-09-20 18:35:45 +02:00
Ursprung 3899704774
Commit 8839c03948
5 geänderte Dateien mit 23 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -62,7 +62,7 @@ public class ListeningWhitelist {
* @return TRUE if there are any packets, FALSE otherwise.
*/
public boolean isEnabled() {
return whitelist != null || whitelist.size() > 0;
return whitelist != null && whitelist.size() > 0;
}
/**

Datei anzeigen

@ -88,8 +88,8 @@ class MinecraftRegistry {
Map<Integer, Class> lookup = forceVanilla ? previousValues : overwrittenPackets;
// Optimized lookup
if (lookup.containsKey(packetToID)) {
return lookup.get(packetToID);
if (lookup.containsKey(packetID)) {
return lookup.get(packetID);
}
// Will most likely not be used

Datei anzeigen

@ -48,7 +48,7 @@ class NetworkFieldInjector extends PlayerInjector {
}
@Override
protected void initialize() throws IllegalAccessException {
protected synchronized void initialize() throws IllegalAccessException {
super.initialize();
// Get the sync field as well

Datei anzeigen

@ -522,12 +522,12 @@ public final class PacketFilterManager implements ProtocolManager {
if (!hasClosed && player != null) {
PlayerInjector injector = playerInjection.get(player);
DataInputStream input = injector.getInputStream(true);
if (injector != null) {
DataInputStream input = injector.getInputStream(true);
injector.cleanupAll();
playerInjection.remove(injector);
playerInjection.remove(player);
connectionLookup.remove(input);
}
}

Datei anzeigen

@ -63,8 +63,20 @@ public class StructureModifier<TField> {
initialize(targetType, Object.class, fields, defaults, null, new HashMap<Class, StructureModifier>());
}
private StructureModifier() {
// Consumers of this method should call "initialize"
/**
* Consumers of this method should call "initialize".
*/
protected StructureModifier() {
}
/**
* Initialize using the same field types.
* @param other - information to set.
*/
protected void initialize(StructureModifier<TField> other) {
initialize(other.targetType, other.fieldType, other.data,
other.defaultFields, other.converter, other.subtypeCache);
}
/**
@ -358,7 +370,7 @@ public class StructureModifier<TField> {
public List<Field> getFields() {
return ImmutableList.copyOf(data);
}
/**
* Retrieve every value stored in the fields of the current type.
* @return Every field value.
@ -367,8 +379,9 @@ public class StructureModifier<TField> {
public List<TField> getValues() throws FieldAccessException {
List<TField> values = new ArrayList<TField>();
for (int i = 0; i < size(); i++)
for (int i = 0; i < size(); i++) {
values.add(read(i));
}
return values;
}