test/jdk/java/lang/StringBuilder/CompactStringBuilder.java
changeset 51994 7577686cc9bd
parent 47216 71c04702a3d5
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.
   394                 "Get (%s) but expect (%s), ", escapeNonASCIIs(str),
   394                 "Get (%s) but expect (%s), ", escapeNonASCIIs(str),
   395                 escapeNonASCIIs(expected)));
   395                 escapeNonASCIIs(expected)));
   396     }
   396     }
   397 
   397 
   398     /*
   398     /*
   399      * Because right now system default charset in JPRT environment is only
   399      * Escape non-ASCII characters since not all systems support them.
   400      * guaranteed to support ASCII characters in log, so we escape them.
       
   401      */
   400      */
   402     private String escapeNonASCIIs(String str) {
   401     private String escapeNonASCIIs(String str) {
   403         StringBuilder sb = new StringBuilder();
   402         StringBuilder sb = new StringBuilder();
   404         for (int i = 0; i < str.length(); i++) {
   403         for (int i = 0; i < str.length(); i++) {
   405             char c = str.charAt(i);
   404             char c = str.charAt(i);