Archiviert
13
0

Fix nonexistent field messages

Dieser Commit ist enthalten in:
Dan Mulloy 2015-01-31 00:54:55 -05:00
Ursprung bfb0683b1f
Commit 391970b185
2 geänderte Dateien mit 16 neuen und 10 gelöschten Zeilen

Datei anzeigen

@ -48,4 +48,10 @@ public class FieldAccessException extends RuntimeException {
public static FieldAccessException fromFormat(String message, Object... params) { public static FieldAccessException fromFormat(String message, Object... params) {
return new FieldAccessException(String.format(message, params)); return new FieldAccessException(String.format(message, params));
} }
@Override
public String toString() {
String message = getMessage();
return "FieldAccessException" + (message != null ? ": " + message : "");
}
} }

Datei anzeigen

@ -194,8 +194,8 @@ public class StructureModifier<TField> {
throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex)); throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex));
if (data.size() == 0) if (data.size() == 0)
throw new FieldAccessException(String.format("No field with type %s exists in class %s.", targetType.getName(), throw new FieldAccessException(String.format("No field with type %s exists in class %s.", fieldType.getName(),
target.getClass().getName())); target.getClass().getSimpleName()));
if (fieldIndex >= data.size()) if (fieldIndex >= data.size())
throw new FieldAccessException(String.format("Field index out of bounds. (Index: %s, Size: %s)", fieldIndex, data.size())); throw new FieldAccessException(String.format("Field index out of bounds. (Index: %s, Size: %s)", fieldIndex, data.size()));
@ -295,8 +295,8 @@ public class StructureModifier<TField> {
throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex)); throw new FieldAccessException(String.format("Field index (%s) cannot be negative.", fieldIndex));
if (data.size() == 0) if (data.size() == 0)
throw new FieldAccessException(String.format("No field with type %s exists in class %s.", targetType.getName(), throw new FieldAccessException(String.format("No field with type %s exists in class %s.", fieldType.getName(),
target.getClass().getName())); target.getClass().getSimpleName()));
if (fieldIndex >= data.size()) if (fieldIndex >= data.size())
throw new FieldAccessException(String.format("Field index out of bounds. (Index: %s, Size: %s)", fieldIndex, data.size())); throw new FieldAccessException(String.format("Field index out of bounds. (Index: %s, Size: %s)", fieldIndex, data.size()));