test/jdk/java/lang/StringBuffer/CompactStringBuffer.java
changeset 51994 7577686cc9bd
parent 47216 71c04702a3d5
child 54481 f847a42ddc01
equal deleted inserted replaced
51993:c0d05cf1d19d 51994:7577686cc9bd
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   469                 "Get (%s) but expect (%s), ", escapeNonASCIIs(str),
   469                 "Get (%s) but expect (%s), ", escapeNonASCIIs(str),
   470                 escapeNonASCIIs(expected)));
   470                 escapeNonASCIIs(expected)));
   471     }
   471     }
   472 
   472 
   473     /*
   473     /*
   474      * Because right now system default charset in JPRT environment is only
   474      * Escape non-ASCII characters since not all systems support them.
   475      * guaranteed to support ASCII characters in log, so we escape them.
       
   476      */
   475      */
   477     private String escapeNonASCIIs(String str) {
   476     private String escapeNonASCIIs(String str) {
   478         StringBuilder sb = new StringBuilder();
   477         StringBuilder sb = new StringBuilder();
   479         for (int i = 0; i < str.length(); i++) {
   478         for (int i = 0; i < str.length(); i++) {
   480             char c = str.charAt(i);
   479             char c = str.charAt(i);