--- old/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeUtility.java 2015-10-16 12:58:14.000000000 +0200 +++ new/src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/packaging/mime/internet/MimeUtility.java 2015-10-16 12:58:14.000000000 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2012, 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 @@ -510,8 +510,8 @@ // Encoded words found. Start decoding ... st = new StringTokenizer(etext, lwsp, true); - StringBuffer sb = new StringBuffer(); // decode buffer - StringBuffer wsb = new StringBuffer(); // white space buffer + StringBuilder sb = new StringBuilder(); // decode buffer + StringBuilder wsb = new StringBuilder(); // white space buffer boolean prevWasEncoded = false; while (st.hasMoreTokens()) { @@ -648,7 +648,7 @@ throw new UnsupportedEncodingException( "Unknown transfer encoding: " + encoding); - StringBuffer outb = new StringBuffer(); // the output buffer + StringBuilder outb = new StringBuilder(); // the output buffer doEncode(string, b64, jcharset, // As per RFC 2047, size of an encoded string should not // exceed 75 bytes. @@ -662,7 +662,7 @@ private static void doEncode(String string, boolean b64, String jcharset, int avail, String prefix, - boolean first, boolean encodingWord, StringBuffer buf) + boolean first, boolean encodingWord, StringBuilder buf) throws UnsupportedEncodingException { // First find out what the length of the encoded version of @@ -812,7 +812,7 @@ private static String decodeInnerWords(String word) throws UnsupportedEncodingException { int start = 0, i; - StringBuffer buf = new StringBuffer(); + StringBuilder buf = new StringBuilder(); while ((i = word.indexOf("=?", start)) >= 0) { buf.append(word.substring(start, i)); int end = word.indexOf("?=", i); @@ -862,7 +862,7 @@ char c = word.charAt(i); if (c == '"' || c == '\\' || c == '\r' || c == '\n') { // need to escape them and then quote the whole string - StringBuffer sb = new StringBuffer(len + 3); + StringBuilder sb = new StringBuilder(len + 3); sb.append('"'); sb.append(word.substring(0, i)); int lastc = 0; @@ -885,7 +885,7 @@ } if (needQuoting) { - StringBuffer sb = new StringBuffer(len + 2); + StringBuilder sb = new StringBuilder(len + 2); sb.append('"').append(word).append('"'); return sb.toString(); } else @@ -927,7 +927,7 @@ return s; // have to actually fold the string - StringBuffer sb = new StringBuffer(s.length() + 4); + StringBuilder sb = new StringBuilder(s.length() + 4); char lastc = 0; while (used + s.length() > 76) { int lastspace = -1; @@ -969,7 +969,7 @@ if (!foldText) return s; - StringBuffer sb = null; + StringBuilder sb = null; int i; while ((i = indexOfAny(s, "\r\n")) >= 0) { int start = i; @@ -986,7 +986,7 @@ while (i < l && ((c = s.charAt(i)) == ' ' || c == '\t')) i++; if (sb == null) - sb = new StringBuffer(s.length()); + sb = new StringBuilder(s.length()); if (start != 0) { sb.append(s.substring(0, start)); sb.append(' '); @@ -996,14 +996,14 @@ } // it's not a continuation line, just leave it in if (sb == null) - sb = new StringBuffer(s.length()); + sb = new StringBuilder(s.length()); sb.append(s.substring(0, i)); s = s.substring(i); } else { // there's a backslash at "start - 1" // strip it out, but leave in the line break if (sb == null) - sb = new StringBuffer(s.length()); + sb = new StringBuilder(s.length()); sb.append(s.substring(0, start - 1)); sb.append(s.substring(start, i)); s = s.substring(i); @@ -1051,7 +1051,7 @@ // no mapping table, or charset parameter is null return charset; - String alias = (String)mime2java.get(charset.toLowerCase()); + String alias = mime2java.get(charset.toLowerCase()); return alias == null ? charset : alias; } @@ -1073,7 +1073,7 @@ // no mapping table or charset param is null return charset; - String alias = (String)java2mime.get(charset.toLowerCase()); + String alias = java2mime.get(charset.toLowerCase()); return alias == null ? charset : alias; } @@ -1140,12 +1140,12 @@ // Tables to map MIME charset names to Java names and vice versa. // XXX - Should eventually use J2SE 1.4 java.nio.charset.Charset - private static Hashtable mime2java; - private static Hashtable java2mime; + private static Hashtable mime2java; + private static Hashtable java2mime; static { - java2mime = new Hashtable(40); - mime2java = new Hashtable(10); + java2mime = new Hashtable(40); + mime2java = new Hashtable(10); try { // Use this class's classloader to load the mapping file @@ -1229,7 +1229,7 @@ } } - private static void loadMappings(LineInputStream is, Hashtable table) { + private static void loadMappings(LineInputStream is, Hashtable table) { String currLine; while (true) {