< prev index next >

langtools/test/tools/javadoc/6964914/TestUserDoclet.java

Print this page




  42     static final String docletWarning = "warning from test doclet";
  43 
  44     /** Main doclet method. */
  45     public static boolean start(RootDoc root) {
  46         root.printWarning(null, docletWarning);
  47         return true;
  48     }
  49 
  50     /** Main test method. */
  51     void run() throws Exception {
  52         File javaHome = new File(System.getProperty("java.home"));
  53         File javadoc = new File(new File(javaHome, "bin"), "javadoc");
  54         File testSrc = new File(System.getProperty("test.src"));
  55         File testClasses = new File(System.getProperty("test.classes"));
  56 
  57         // run javadoc in separate process to ensure doclet executed under
  58         // normal user conditions w.r.t. classloader
  59         String thisClassName = TestUserDoclet.class.getName();
  60         List<String> cmdArgs = new ArrayList<>();
  61         cmdArgs.add(javadoc.getPath());
  62         int i = 0;
  63         String prop;
  64         while ((prop = System.getProperty("jdk.launcher.patch." + (i++))) != null) {
  65             cmdArgs.add("-J-Xpatch:" + prop);
  66         }
  67         cmdArgs.addAll(Arrays.asList(
  68                 "-doclet", thisClassName,
  69                 "-docletpath", testClasses.getPath(),
  70                 new File(testSrc, thisClassName + ".java").getPath()
  71         ));
  72         Process p = new ProcessBuilder()
  73             .command(cmdArgs)
  74             .redirectErrorStream(true)
  75             .start();
  76 
  77         int actualDocletWarnCount = 0;
  78         int reportedDocletWarnCount = 0;
  79         BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
  80         try {
  81             String line;
  82             while ((line = in.readLine()) != null) {
  83                 System.err.println(line);
  84                 if (line.contains(docletWarning))
  85                     actualDocletWarnCount++;
  86                 if (line.matches("[0-9]+ warning(s)?"))




  42     static final String docletWarning = "warning from test doclet";
  43 
  44     /** Main doclet method. */
  45     public static boolean start(RootDoc root) {
  46         root.printWarning(null, docletWarning);
  47         return true;
  48     }
  49 
  50     /** Main test method. */
  51     void run() throws Exception {
  52         File javaHome = new File(System.getProperty("java.home"));
  53         File javadoc = new File(new File(javaHome, "bin"), "javadoc");
  54         File testSrc = new File(System.getProperty("test.src"));
  55         File testClasses = new File(System.getProperty("test.classes"));
  56 
  57         // run javadoc in separate process to ensure doclet executed under
  58         // normal user conditions w.r.t. classloader
  59         String thisClassName = TestUserDoclet.class.getName();
  60         List<String> cmdArgs = new ArrayList<>();
  61         cmdArgs.add(javadoc.getPath());





  62         cmdArgs.addAll(Arrays.asList(
  63                 "-doclet", thisClassName,
  64                 "-docletpath", testClasses.getPath(),
  65                 new File(testSrc, thisClassName + ".java").getPath()
  66         ));
  67         Process p = new ProcessBuilder()
  68             .command(cmdArgs)
  69             .redirectErrorStream(true)
  70             .start();
  71 
  72         int actualDocletWarnCount = 0;
  73         int reportedDocletWarnCount = 0;
  74         BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
  75         try {
  76             String line;
  77             while ((line = in.readLine()) != null) {
  78                 System.err.println(line);
  79                 if (line.contains(docletWarning))
  80                     actualDocletWarnCount++;
  81                 if (line.matches("[0-9]+ warning(s)?"))


< prev index next >