src/share/classes/java/io/ObjectOutputStream.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 30,39 ****
--- 30,40 ----
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+ import java.util.StringJoiner;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import static java.io.ObjectStreamClass.processQueue;
import sun.reflect.misc.ReflectUtil;
*** 2463,2480 ****
/**
* Returns a string representation of this object
*/
public String toString() {
! StringBuilder buffer = new StringBuilder();
! if (!stack.isEmpty()) {
! for(int i = stack.size(); i > 0; i-- ) {
! buffer.append(stack.get(i - 1));
! if (i != 1)
! buffer.append('\n');
}
! }
! return buffer.toString();
}
}
}
--- 2464,2477 ----
/**
* Returns a string representation of this object
*/
public String toString() {
! StringJoiner sj = new StringJoiner("\n");
! for (int i = stack.size() - 1; i >= 0; i--) {
! sj.add(stack.get(i));
}
! return sj.toString();
}
}
}