stevel      2005/06/12 16:15:57

  Modified:    src/main/org/apache/tools/ant/taskdefs defaults.properties
               src/main/org/apache/tools/ant Diagnostics.java
  Added:       src/main/org/apache/tools/ant/taskdefs DiagnosticsTask.java
  Log:
  Little something to make IDE debugging easier; <diagnostics/> prints the 
diagnostics out as per -diagnostics.
  1. Why does Netbeans4.1 keep javax.xml.parsers.SAXParserFactory a secret? 
SecurityException handling to Diagnostics to compensate.
  2. could add output file support, maybe?
  3. could add task="junit" for detailed task diags instead...
  
  Revision  Changes    Path
  1.171     +1 -0      
ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties
  
  Index: defaults.properties
  ===================================================================
  RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/defaults.properties,v
  retrieving revision 1.170
  retrieving revision 1.171
  diff -u -r1.170 -r1.171
  --- defaults.properties       24 May 2005 20:49:55 -0000      1.170
  +++ defaults.properties       12 Jun 2005 23:15:57 -0000      1.171
  @@ -83,6 +83,7 @@
   length=org.apache.tools.ant.taskdefs.Length
   clone=org.apache.tools.ant.taskdefs.Clone
   copypath=org.apache.tools.ant.taskdefs.CopyPath
  +diagnostics=org.apache.tools.ant.taskdefs.DiagnosticsTask
   
   # optional tasks
   image=org.apache.tools.ant.taskdefs.optional.image.Image
  
  
  
  1.1                  
ant/src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java
  
  Index: DiagnosticsTask.java
  ===================================================================
  package org.apache.tools.ant.taskdefs;
  
  import org.apache.tools.ant.Task;
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.Diagnostics;
  
  /*
   * Copyright  2005 The Apache Software Foundation
   *
   *  Licensed under the Apache License, Version 2.0 (the "License");
   *  you may not use this file except in compliance with the License.
   *  You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   *  Unless required by applicable law or agreed to in writing, software
   *  distributed under the License is distributed on an "AS IS" BASIS,
   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *  See the License for the specific language governing permissions and
   *  limitations under the License.
   *
   */
  
  /**
   * This is a task that hands off work to the Diagnostics module.
   * It lets you run diagnostics in an IDE.
   */
  public class DiagnosticsTask extends Task {
  
      private static final String[] args=new String[0];
      
      public void execute() throws BuildException {
          Diagnostics.main(args);
      }
  
  
  }
  
  
  
  1.30      +15 -2     ant/src/main/org/apache/tools/ant/Diagnostics.java
  
  Index: Diagnostics.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/Diagnostics.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- Diagnostics.java  6 Jun 2005 19:45:32 -0000       1.29
  +++ Diagnostics.java  12 Jun 2005 23:15:57 -0000      1.30
  @@ -259,10 +259,23 @@
        * @param out the stream to print the properties to.
        */
       private static void doReportSystemProperties(PrintStream out) {
  -        for (Enumeration keys = System.getProperties().propertyNames();
  +        Properties sysprops = null;
  +        try {
  +            sysprops = System.getProperties();
  +        } catch (SecurityException  e) {
  +            out.println("Access to System.getProperties() blocked " +
  +                    "by a security manager");
  +        }
  +        for (Enumeration keys = sysprops.propertyNames();
               keys.hasMoreElements();) {
               String key = (String) keys.nextElement();
  -            out.println(key + " : " + System.getProperty(key));
  +            String value;
  +            try {
  +                value = System.getProperty(key);
  +            } catch (SecurityException e) {
  +                value = "Access to this property blocked by a security 
manager";
  +            }
  +            out.println(key + " : " + value);
           }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to