< prev index next >

src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java

Print this page
rev 10947 : 8055723: Replace concat String to append in StringBuilder parameters

*** 461,486 **** } // --------- ! private static void appendIfLiteralAddress(String addr, StringBuffer sb) { if (IPAddressUtil.isIPv4LiteralAddress(addr)) { ! sb.append("dns://" + addr + " "); } else { if (IPAddressUtil.isIPv6LiteralAddress(addr)) { ! sb.append("dns://[" + addr + "] "); } } } /* * @return String containing the JNDI-DNS provider URL * corresponding to the supplied List of nameservers. */ private static String createProviderURL(List<String> nsList) { ! StringBuffer sb = new StringBuffer(); for (String s: nsList) { appendIfLiteralAddress(s, sb); } return sb.toString(); } --- 461,486 ---- } // --------- ! private static void appendIfLiteralAddress(String addr, StringBuilder sb) { if (IPAddressUtil.isIPv4LiteralAddress(addr)) { ! sb.append("dns://").append(addr).append(' '); } else { if (IPAddressUtil.isIPv6LiteralAddress(addr)) { ! sb.append("dns://[").append(addr).append("] "); } } } /* * @return String containing the JNDI-DNS provider URL * corresponding to the supplied List of nameservers. */ private static String createProviderURL(List<String> nsList) { ! StringBuilder sb = new StringBuilder(); for (String s: nsList) { appendIfLiteralAddress(s, sb); } return sb.toString(); }
*** 489,499 **** * @return String containing the JNDI-DNS provider URL * corresponding to the list of nameservers * contained in the provided str. */ private static String createProviderURL(String str) { ! StringBuffer sb = new StringBuffer(); StringTokenizer st = new StringTokenizer(str, ","); while (st.hasMoreTokens()) { appendIfLiteralAddress(st.nextToken(), sb); } return sb.toString(); --- 489,499 ---- * @return String containing the JNDI-DNS provider URL * corresponding to the list of nameservers * contained in the provided str. */ private static String createProviderURL(String str) { ! StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(str, ","); while (st.hasMoreTokens()) { appendIfLiteralAddress(st.nextToken(), sb); } return sb.toString();
< prev index next >