10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.security.util;
27
28 import java.io.PrintStream;
29 import java.math.BigInteger;
30 import java.util.regex.Pattern;
31 import java.util.regex.Matcher;
32 import java.util.Locale;
33 import sun.security.action.GetPropertyAction;
34
35 /**
36 * A utility class for debugging.
37 *
38 * @author Roland Schemers
39 */
40 public class Debug {
41
42 private String prefix;
43
44 private static String args;
45
46 static {
47 args = GetPropertyAction.privilegedGetProperty("java.security.debug");
48
49 String args2 = GetPropertyAction
307 matcher.appendReplacement(left, "");
308 }
309 matcher.appendTail(left);
310 source = left;
311
312 // convert the rest to lower-case characters
313 target.append(source.toString().toLowerCase(Locale.ENGLISH));
314
315 return target.toString();
316 }
317
318 return null;
319 }
320
321 private static final char[] hexDigits = "0123456789abcdef".toCharArray();
322
323 public static String toString(byte[] b) {
324 if (b == null) {
325 return "(null)";
326 }
327 StringBuilder sb = new StringBuilder(b.length * 3);
328 for (int i = 0; i < b.length; i++) {
329 int k = b[i] & 0xff;
330 if (i != 0) {
331 sb.append(':');
332 }
333 sb.append(hexDigits[k >>> 4]);
334 sb.append(hexDigits[k & 0xf]);
335 }
336 return sb.toString();
337 }
338
339 }
|
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.security.util;
27
28 import java.io.PrintStream;
29 import java.math.BigInteger;
30 import java.util.Hex;
31 import java.util.regex.Pattern;
32 import java.util.regex.Matcher;
33 import java.util.Locale;
34 import sun.security.action.GetPropertyAction;
35
36 /**
37 * A utility class for debugging.
38 *
39 * @author Roland Schemers
40 */
41 public class Debug {
42
43 private String prefix;
44
45 private static String args;
46
47 static {
48 args = GetPropertyAction.privilegedGetProperty("java.security.debug");
49
50 String args2 = GetPropertyAction
308 matcher.appendReplacement(left, "");
309 }
310 matcher.appendTail(left);
311 source = left;
312
313 // convert the rest to lower-case characters
314 target.append(source.toString().toLowerCase(Locale.ENGLISH));
315
316 return target.toString();
317 }
318
319 return null;
320 }
321
322 private static final char[] hexDigits = "0123456789abcdef".toCharArray();
323
324 public static String toString(byte[] b) {
325 if (b == null) {
326 return "(null)";
327 }
328 return Hex.encoder(":", "", "", false).encode(b);
329 }
330
331 }
|