Skip to content

Commit

Permalink
Merge pull request #698 from bytedance/fix-serialize
Browse files Browse the repository at this point in the history
fix serializer exception
  • Loading branch information
yoloyyh authored Oct 18, 2024
2 parents ba96a4b + 6eee29a commit f3452be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public JsonElement serialize(ClassFilter src, Type typeOfSrc, JsonSerializationC

private String[] convertStackTrace(StackTraceElement[] stackTrace) {
if (stackTrace.length <= 2)
return null;
return new String[0];

StackTraceElement[] elements = Arrays.copyOfRange(stackTrace, 2, stackTrace.length);
String[] result = new String[elements.length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ private String convertRet(Object value) {
}

private String[] convertArgs(Object[] value) {
if (value == null)
return new String[0];
String[] result = new String[value.length];
for (int i = 0; i < value.length; i++) {
result[i] = String.valueOf(value[i]);
Expand All @@ -37,8 +39,8 @@ private String[] convertArgs(Object[] value) {
}

private String[] convertStackTrace(StackTraceElement[] stackTrace) {
if (stackTrace.length <= 2)
return null;
if (stackTrace == null || stackTrace.length <= 2)
return new String[0];

StackTraceElement[] elements = Arrays.copyOfRange(stackTrace, 2, stackTrace.length);
String[] result = new String[elements.length];
Expand Down

0 comments on commit f3452be

Please sign in to comment.