1 /* |
1 /* |
2 * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2007, 2012, 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. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
372 if (locale == null) |
372 if (locale == null) |
373 locale = Locale.getDefault(); |
373 locale = Locale.getDefault(); |
374 task_locale = locale; |
374 task_locale = locale; |
375 } |
375 } |
376 |
376 |
377 public void setLog(PrintWriter log) { |
377 public void setLog(Writer log) { |
378 this.log = log; |
378 this.log = getPrintWriterForWriter(log); |
379 } |
379 } |
380 |
380 |
381 public void setLog(OutputStream s) { |
381 public void setLog(OutputStream s) { |
382 setLog(getPrintWriterForStream(s)); |
382 setLog(getPrintWriterForStream(s)); |
383 } |
383 } |
384 |
384 |
385 private static PrintWriter getPrintWriterForStream(OutputStream s) { |
385 private static PrintWriter getPrintWriterForStream(OutputStream s) { |
386 return new PrintWriter(s, true); |
386 return new PrintWriter(s == null ? System.err : s, true); |
387 } |
387 } |
388 |
388 |
389 private static PrintWriter getPrintWriterForWriter(Writer w) { |
389 private static PrintWriter getPrintWriterForWriter(Writer w) { |
390 if (w == null) |
390 if (w == null) |
391 return getPrintWriterForStream(null); |
391 return getPrintWriterForStream(null); |