slf4j:对类型为[java.util.arraylist]的对象调用String()失败

jk9hmnmh  于 2021-07-03  发布在  Java
关注(0)|答案(0)|浏览(297)

特定错误消息。。。

SLF4J: Failed toString() invocation on an object of type [java.util.ArrayList]
Reported exception:
java.lang.StackOverflowError
    at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:675)
    at java.lang.StringBuilder.append(StringBuilder.java:208)
    at java.time.LocalDate.toString(LocalDate.java:2032)
    at java.time.LocalDateTime.toString(LocalDateTime.java:1972)
    at java.time.ZonedDateTime.toString(ZonedDateTime.java:2206)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.sxy.sibemanagementapi.domain.OrderInfoPassenger.toString(OrderInfoPassenger.java:734)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.sxy.sibemanagementapi.domain.OrderChangeIssue.toString(OrderChangeIssue.java:1398)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at java.util.AbstractCollection.toString(AbstractCollection.java:462)
    at org.hibernate.collection.internal.PersistentSet.toString(PersistentSet.java:300)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.sxy.sibemanagementapi.domain.OrderChange.toString(OrderChange.java:753)
    at java.lang.String.valueOf(String.java:2994)
    at java.lang.StringBuilder.append(StringBuilder.java:131)
    at com.sxy.sibemanagementapi.domain.OrderChangeIssue.toString(OrderChangeIssue.java:1398)
    .
    .
    .

可能有问题的代码。。。

List<String> ticketNo = new ArrayList<>();
        issueListCopy.forEach(item -> {
            ticketNo.add(item.getOldTicketNo().equals(null) ? item.getTicketNo() : item.getOldTicketNo());
        });

item.getoldticketno()和item.getoldticketno()都是字符串类型,所以我应该如何优化这段代码?非常感谢你。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题