Database Plugin - Increase blob max length and attempt to render UTF-8
Summary: 512 is a pretty small blob length. Increasing it to 5120 and changing it to attempt to stringify UTF-8 if not ascii. Reviewed By: jknoxville Differential Revision: D21253132 fbshipit-source-id: 1cc9226b86a9b9ddfd73e29c8b0c04ac54b5b4b2
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3e0f07ac97
commit
56b4d43eb0
@@ -24,11 +24,12 @@ import java.io.UnsupportedEncodingException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class ObjectMapper {
|
||||
|
||||
private static final int MAX_BLOB_LENGTH = 512;
|
||||
private static final String UNKNOWN_BLOB_LABEL = "{blob}";
|
||||
private static final int MAX_BLOB_LENGTH = 5120;
|
||||
private static final String UNKNOWN_BLOB_LABEL_FORMAT = "{%d-byte %s blob}";
|
||||
|
||||
public static FlipperArray databaseListToFlipperArray(
|
||||
Collection<DatabaseDescriptorHolder> databaseDescriptorHolderList) {
|
||||
@@ -229,9 +230,17 @@ public class ObjectMapper {
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Fall through...
|
||||
}
|
||||
} else {
|
||||
// try UTF-8
|
||||
try {
|
||||
return new String(blob, "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Fall through...
|
||||
}
|
||||
}
|
||||
return String.format(Locale.US, UNKNOWN_BLOB_LABEL_FORMAT, blob.length, "binary");
|
||||
}
|
||||
return UNKNOWN_BLOB_LABEL;
|
||||
return String.format(Locale.US, UNKNOWN_BLOB_LABEL_FORMAT, blob.length, "large");
|
||||
}
|
||||
|
||||
private static boolean fastIsAscii(byte[] blob) {
|
||||
|
||||
Reference in New Issue
Block a user