test/com/sun/javadoc/lib/JavadocTester.java

changeset 1052
409b104f8b86
parent 554
9d9f26857129
child 2036
8df12c315ea3
     1.1 --- a/test/com/sun/javadoc/lib/JavadocTester.java	Thu Jun 30 14:33:45 2011 -0700
     1.2 +++ b/test/com/sun/javadoc/lib/JavadocTester.java	Fri Jul 01 13:34:37 2011 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -197,8 +197,13 @@
    1.11          initOutputBuffers();
    1.12  
    1.13          ByteArrayOutputStream stdout = new ByteArrayOutputStream();
    1.14 -        PrintStream prev = System.out;
    1.15 +        PrintStream prevOut = System.out;
    1.16          System.setOut(new PrintStream(stdout));
    1.17 +
    1.18 +        ByteArrayOutputStream stderr = new ByteArrayOutputStream();
    1.19 +        PrintStream prevErr = System.err;
    1.20 +        System.setErr(new PrintStream(stderr));
    1.21 +
    1.22          int returnCode = com.sun.tools.javadoc.Main.execute(
    1.23                  getBugName(),
    1.24                  new PrintWriter(errors, true),
    1.25 @@ -207,8 +212,11 @@
    1.26                  docletClass,
    1.27                  getClass().getClassLoader(),
    1.28                  args);
    1.29 -        System.setOut(prev);
    1.30 +        System.setOut(prevOut);
    1.31          standardOut = new StringBuffer(stdout.toString());
    1.32 +        System.setErr(prevErr);
    1.33 +        errors.write(NL + stderr.toString());
    1.34 +
    1.35          printJavadocOutput();
    1.36          return returnCode;
    1.37      }

mercurial