You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by co...@apache.org on 2003/07/15 16:54:15 UTC

cvs commit: ant/src/main/org/apache/tools/zip ZipEntry.java ZipFile.java ZipLong.java ZipOutputStream.java ZipShort.java

conor       2003/07/15 07:54:15

  Modified:    src/main/org/apache/tools/ant/taskdefs ExecuteJava.java
                        Zip.java
               src/main/org/apache/tools/ant/types Path.java
                        XMLCatalog.java ZipFileSet.java ZipScanner.java
               src/main/org/apache/tools/zip ZipEntry.java ZipFile.java
                        ZipLong.java ZipOutputStream.java ZipShort.java
  Log:
  style
  
  Revision  Changes    Path
  1.33      +3 -3      ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
  
  Index: ExecuteJava.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -w -u -r1.32 -r1.33
  --- ExecuteJava.java	14 Jul 2003 13:42:32 -0000	1.32
  +++ ExecuteJava.java	15 Jul 2003 14:54:14 -0000	1.33
  @@ -112,7 +112,7 @@
       }
   
       /**
  -     * @since 1.19, Ant 1.5
  +     * @since Ant 1.5
        */
       public void setTimeout(Long timeout) {
           this.timeout = timeout;
  @@ -201,7 +201,7 @@
       }
   
       /**
  -     * @since 1.19, Ant 1.5
  +     * @since Ant 1.5
        */
       public void run() {
           final Object[] argument = { javaCommand.getArguments() };
  @@ -222,7 +222,7 @@
       }
   
       /**
  -     * @since 1.19, Ant 1.5
  +     * @since Ant 1.5
        */
       public synchronized void timeoutOccured(Watchdog w) {
           if (thread != null) {
  
  
  
  1.110     +15 -15    ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -w -u -r1.109 -r1.110
  --- Zip.java	6 Jul 2003 09:57:37 -0000	1.109
  +++ Zip.java	15 Jul 2003 14:54:14 -0000	1.110
  @@ -317,8 +317,7 @@
               executeMain();
               skipWriting = false;
               executeMain();
  -        }
  -        else {
  +        } else {
               executeMain();
           }
       }
  @@ -464,8 +463,8 @@
                   // temporary file
                   if (doUpdate) {
                       if (!renamedFile.delete()) {
  -                        log ("Warning: unable to delete temporary file " +
  -                             renamedFile.getName(), Project.MSG_WARN);
  +                        log ("Warning: unable to delete temporary file "
  +                            + renamedFile.getName(), Project.MSG_WARN);
                       }
                   }
                   success = true;
  @@ -504,8 +503,8 @@
                   try {
                       fileUtils.rename(renamedFile, zipFile);
                   } catch (IOException e) {
  -                    msg += " (and I couldn't rename the temporary file " +
  -                        renamedFile.getName() + " back)";
  +                    msg += " (and I couldn't rename the temporary file "
  +                            + renamedFile.getName() + " back)";
                   }
               }
   
  @@ -665,6 +664,7 @@
                   try {
                       os.close();
                   } catch (IOException e) {
  +                    //ignore
                   }
               }
           }
  @@ -744,8 +744,8 @@
                   }
               } else if (emptyBehavior.equals("fail")) {
                   throw new BuildException("Cannot create " + archiveType
  -                                         + " archive " + zipFile +
  -                                         ": no files were included.",
  +                                         + " archive " + zipFile
  +                                         + ": no files were included.",
                                            getLocation());
               } else {
                   // Create.
  @@ -1123,7 +1123,7 @@
        *
        * @since Ant 1.5.2
        */
  -    protected final static boolean isEmpty(Resource[][] r) {
  +    protected static final boolean isEmpty(Resource[][] r) {
           for (int i = 0; i < r.length; i++) {
               if (r[i].length > 0) {
                   return false;
  
  
  
  1.51      +31 -31    ant/src/main/org/apache/tools/ant/types/Path.java
  
  Index: Path.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Path.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -w -u -r1.50 -r1.51
  
  
  
  1.27      +93 -100   ant/src/main/org/apache/tools/ant/types/XMLCatalog.java
  
  Index: XMLCatalog.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/XMLCatalog.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -w -u -r1.26 -r1.27
  --- XMLCatalog.java	23 Jun 2003 12:07:20 -0000	1.26
  +++ XMLCatalog.java	15 Jul 2003 14:54:14 -0000	1.27
  @@ -190,6 +190,9 @@
   
       //-- Methods ---------------------------------------------------------------
   
  +    /**
  +     * Default constructor
  +     */
       public XMLCatalog() {
           setChecked( false );
       }
  @@ -233,6 +236,8 @@
        * is itself a reference to another catalog -- that is, a catalog
        * cannot both refer to another <em>and</em> contain elements or
        * other attributes.
  +     *
  +     * @return a Path instance to be configured.
        */
       public Path createClasspath() {
           if (isReference()) {
  @@ -250,6 +255,8 @@
        * itself a reference to another catalog -- that is, a catalog
        * cannot both refer to another <em>and</em> contain elements or
        * other attributes.
  +     *
  +     * @param classpath the classpath to use to look up entities.
        */
       public void setClasspath(Path classpath) {
           if (isReference()) {
  @@ -268,6 +275,8 @@
        * itself a reference to another catalog -- that is, a catalog
        * cannot both refer to another <em>and</em> contain elements or
        * other attributes.
  +     *
  +     * @param r an Ant reference containing a classpath.
        */
       public void setClasspathRef(Reference r) {
           if (isReference()) {
  @@ -282,6 +291,7 @@
        * catalog -- that is, a catalog cannot both refer to another
        * <em>and</em> contain elements or other attributes.
        *
  +     * @return a path to be configured as the catalog path.
        * @exception BuildException
        * if this is a reference and no nested elements are allowed.
        */
  @@ -301,6 +311,9 @@
        * itself a reference to another catalog -- that is, a catalog
        * cannot both refer to another <em>and</em> contain elements or
        * other attributes.
  +     *
  +     * @param r an Ant reference containing a classpath to be used as
  +     * the catalog path.
        */
       public void setCatalogPathRef(Reference r) {
           if (isReference()) {
  @@ -439,8 +452,8 @@
               getCatalogResolver().resolveEntity(publicId, systemId);
   
           if (inputSource == null) {
  -            log("No matching catalog entry found, parser will use: '" +
  -                systemId + "'", Project.MSG_DEBUG);
  +            log("No matching catalog entry found, parser will use: '"
  +                + systemId + "'", Project.MSG_DEBUG);
           }
   
           return inputSource;
  @@ -470,8 +483,8 @@
           source = (SAXSource)getCatalogResolver().resolve(uri, base);
   
           if (source == null) {
  -            log("No matching catalog entry found, parser will use: '" +
  -                href + "'", Project.MSG_DEBUG);
  +            log("No matching catalog entry found, parser will use: '"
  +                + href + "'", Project.MSG_DEBUG);
               //
               // Cannot return a null source, because we have to call
               // setEntityResolver (see setEntityResolver javadoc comment)
  @@ -481,14 +494,12 @@
               try {
                   if (base == null) {
                       baseURL = fileUtils.getFileURL(getProject().getBaseDir());
  -                }
  -                else {
  +                } else {
                       baseURL = new URL(base);
                   }
                   URL url = (uri.length() == 0 ? baseURL : new URL(baseURL, uri));
                   source.setInputSource(new InputSource(url.toString()));
  -            }
  -            catch (MalformedURLException ex) {
  +            } catch (MalformedURLException ex) {
                   // At this point we are probably in failure mode, but
                   // try to use the bare URI as a last gasp
                   source.setInputSource(new InputSource(uri));
  @@ -530,18 +541,16 @@
                   // available, so use it.
                   //
                   catalogResolver = new ApacheResolver(clazz, obj);
  -            }
  -            catch (Throwable ex) {
  +            } catch (Throwable ex) {
                   //
                   // The xml-commons resolver library is not
                   // available, so we can't use it.
                   //
                   catalogResolver = new InternalResolver();
  -                if (getCatalogPath() != null &&
  -                    getCatalogPath().list().length != 0) {
  -                        log("Warning: catalogpath listing external catalogs"+
  -                                " will be ignored",
  -                            Project.MSG_WARN);
  +                if (getCatalogPath() != null
  +                    && getCatalogPath().list().length != 0) {
  +                        log("Warning: catalogpath listing external catalogs"
  +                            + " will be ignored", Project.MSG_WARN);
                           log("Failed to load Apache resolver: " 
                               + ex, Project.MSG_DEBUG);
                       }
  @@ -577,11 +586,9 @@
               spFactory.setNamespaceAware(true);
               try {
                   reader = spFactory.newSAXParser().getXMLReader();
  -            }
  -            catch (ParserConfigurationException ex) {
  +            } catch (ParserConfigurationException ex) {
                   throw new TransformerException(ex);
  -            }
  -            catch (SAXException ex) {
  +            } catch (SAXException ex) {
                   throw new TransformerException(ex);
               }
           }
  @@ -652,8 +659,7 @@
           } else {
               try {
                   baseURL = fileUtils.getFileURL(getProject().getBaseDir());
  -            }
  -            catch (MalformedURLException ex) {
  +            } catch (MalformedURLException ex) {
                   throw new BuildException("Project basedir cannot be converted to a URL");
               }
           }
  @@ -663,8 +669,7 @@
   
           try {
               url = new URL(baseURL, uri);
  -        }
  -        catch (MalformedURLException ex) {
  +        } catch (MalformedURLException ex) {
               // ignore
           }
   
  @@ -678,8 +683,8 @@
                           source = new InputSource(new FileInputStream(resFile));
                           String sysid = JAXPUtils.getSystemId(resFile);
                           source.setSystemId(sysid);
  -                        log("catalog entry matched a readable file: '" +
  -                            sysid + "'", Project.MSG_DEBUG);
  +                        log("catalog entry matched a readable file: '"
  +                            + sysid + "'", Project.MSG_DEBUG);
                       } catch(FileNotFoundException ex) {
                           // ignore
                       } catch(IOException ex) {
  @@ -721,8 +726,8 @@
               URL entryURL = loader.getResource(matchingEntry.getLocation());
               String sysid = entryURL.toExternalForm();
               source.setSystemId(sysid);
  -            log("catalog entry matched a resource in the classpath: '" +
  -                sysid + "'", Project.MSG_DEBUG);
  +            log("catalog entry matched a resource in the classpath: '"
  +                + sysid + "'", Project.MSG_DEBUG);
           }
   
           return source;
  @@ -749,8 +754,7 @@
           } else {
               try {
                   baseURL = fileUtils.getFileURL(getProject().getBaseDir());
  -            }
  -            catch (MalformedURLException ex) {
  +            } catch (MalformedURLException ex) {
                   throw new BuildException("Project basedir cannot be converted to a URL");
               }
           }
  @@ -760,8 +764,7 @@
   
           try {
               url = new URL(baseURL, uri);
  -        }
  -        catch (MalformedURLException ex) {
  +        } catch (MalformedURLException ex) {
               // ignore
           }
   
  @@ -772,8 +775,8 @@
                       source = new InputSource(is);
                       String sysid = url.toExternalForm();
                       source.setSystemId(sysid);
  -                    log("catalog entry matched as a URL: '" +
  -                        sysid + "'", Project.MSG_DEBUG);
  +                    log("catalog entry matched as a URL: '"
  +                        + sysid + "'", Project.MSG_DEBUG);
                   }
               } catch(IOException ex) {
                   // ignore
  @@ -816,9 +819,9 @@
   
               if (matchingEntry != null) {
   
  -                log("Matching catalog entry found for publicId: '" +
  -                    matchingEntry.getPublicId() + "' location: '" +
  -                    matchingEntry.getLocation() + "'",
  +                log("Matching catalog entry found for publicId: '"
  +                    + matchingEntry.getPublicId() + "' location: '"
  +                    + matchingEntry.getLocation() + "'",
                       Project.MSG_DEBUG);
   
                   result = filesystemLookup(matchingEntry);
  @@ -844,9 +847,9 @@
   
               if (matchingEntry != null) {
   
  -                log("Matching catalog entry found for uri: '" +
  -                    matchingEntry.getPublicId() + "' location: '" +
  -                    matchingEntry.getLocation() + "'",
  +                log("Matching catalog entry found for uri: '"
  +                    + matchingEntry.getPublicId() + "' location: '"
  +                    + matchingEntry.getLocation() + "'",
                       Project.MSG_DEBUG);
   
                   //
  @@ -865,8 +868,7 @@
                           URL baseURL = new URL(base);
                           entryCopy = new ResourceLocation();
                           entryCopy.setBase(baseURL);
  -                    }
  -                    catch (MalformedURLException ex) {
  +                    } catch (MalformedURLException ex) {
                           // ignore
                       }
                   }
  @@ -942,8 +944,7 @@
                       resolverImplClass.getMethod("resolve",
                                                   new Class[]
                           { String.class, String.class });
  -            }
  -            catch (NoSuchMethodException ex) {
  +            } catch (NoSuchMethodException ex) {
                   throw new BuildException(ex);
               }
   
  @@ -961,9 +962,9 @@
   
               if (matchingEntry != null) {
   
  -                log("Matching catalog entry found for publicId: '" +
  -                    matchingEntry.getPublicId() + "' location: '" +
  -                    matchingEntry.getLocation() + "'",
  +                log("Matching catalog entry found for publicId: '"
  +                    + matchingEntry.getPublicId() + "' location: '"
  +                    + matchingEntry.getLocation() + "'",
                       Project.MSG_DEBUG);
   
                   result = filesystemLookup(matchingEntry);
  @@ -978,13 +979,11 @@
                               (InputSource)resolveEntity.invoke(resolverImpl,
                                                                 new Object[]
                                   { publicId, systemId });
  -                    }
  -                    catch (Exception ex) {
  +                    } catch (Exception ex) {
                           throw new BuildException(ex);
                       }
                   }
  -            }
  -            else {
  +            } else {
                   //
                   // We didn't match a ResourceLocation, but since we
                   // only support PUBLIC and URI entry types internally,
  @@ -998,8 +997,7 @@
                           (InputSource)resolveEntity.invoke(resolverImpl,
                                                             new Object[]
                               { publicId, systemId });
  -                }
  -                catch (Exception ex) {
  +                } catch (Exception ex) {
                       throw new BuildException(ex);
                   }
               }
  @@ -1019,9 +1017,9 @@
   
               if (matchingEntry != null) {
   
  -                log("Matching catalog entry found for uri: '" +
  -                    matchingEntry.getPublicId() + "' location: '" +
  -                    matchingEntry.getLocation() + "'",
  +                log("Matching catalog entry found for uri: '"
  +                    + matchingEntry.getPublicId() + "' location: '"
  +                    + matchingEntry.getLocation() + "'",
                       Project.MSG_DEBUG);
   
                   //
  @@ -1042,8 +1040,7 @@
                           URL baseURL = new URL(base);
                           entryCopy = new ResourceLocation();
                           entryCopy.setBase(baseURL);
  -                    }
  -                    catch (MalformedURLException ex) {
  +                    } catch (MalformedURLException ex) {
                           // ignore
                       }
                   }
  @@ -1064,13 +1061,11 @@
                               (SAXSource)resolve.invoke(resolverImpl,
                                                         new Object[]
                                   { href, base });
  -                    }
  -                    catch (Exception ex) {
  +                    } catch (Exception ex) {
                           throw new BuildException(ex);
                       }
                   }
  -            }
  -            else {
  +            } else {
                   //
                   // We didn't match a ResourceLocation, but since we
                   // only support PUBLIC and URI entry types internally,
  @@ -1084,8 +1079,7 @@
                           (SAXSource)resolve.invoke(resolverImpl,
                                                     new Object[]
                               { href, base });
  -                }
  -                catch (Exception ex) {
  +                } catch (Exception ex) {
                       throw new BuildException(ex);
                   }
               }
  @@ -1101,21 +1095,21 @@
            */
           private void processExternalCatalogs() {
   
  -            if (externalCatalogsProcessed == false) {
  +            if (!externalCatalogsProcessed) {
   
                   try {
                       setXMLCatalog.invoke(resolverImpl,
                                            new Object[]
                       { XMLCatalog.this });
  -                }
  -                catch (Exception ex) {
  +                } catch (Exception ex) {
                       throw new BuildException(ex);
                   }
   
                   // Parse each catalog listed in nested <catalogpath> elements
                   Path catPath = getCatalogPath();
                   if (catPath != null) {
  -                    log("Using catalogpath '" + getCatalogPath()+"'", Project.MSG_DEBUG);
  +                    log("Using catalogpath '" + getCatalogPath() + "'",
  +                        Project.MSG_DEBUG);
                       String[] catPathList = getCatalogPath().list();
   
                       for (int i=0; i< catPathList.length; i++) {
  @@ -1125,8 +1119,7 @@
                               parseCatalog.invoke(resolverImpl,
                                       new Object[]
                                       { catFile.getPath() });
  -                        }
  -                        catch (Exception ex) {
  +                        } catch (Exception ex) {
                               throw new BuildException(ex);
                           }
                       }
  
  
  
  1.22      +7 -7      ant/src/main/org/apache/tools/ant/types/ZipFileSet.java
  
  Index: ZipFileSet.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/ZipFileSet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -w -u -r1.21 -r1.22
  
  
  
  1.20      +7 -8      ant/src/main/org/apache/tools/ant/types/ZipScanner.java
  
  Index: ZipScanner.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/ZipScanner.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -w -u -r1.19 -r1.20
  --- ZipScanner.java	3 Jul 2003 15:43:09 -0000	1.19
  +++ ZipScanner.java	15 Jul 2003 14:54:14 -0000	1.20
  @@ -55,7 +55,6 @@
   package org.apache.tools.ant.types;
   
   import java.io.File;
  -import java.io.FileInputStream;
   import java.io.IOException;
   import java.util.Vector;
   import java.util.Hashtable;
  
  
  
  1.12      +5 -5      ant/src/main/org/apache/tools/zip/ZipEntry.java
  
  Index: ZipEntry.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipEntry.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -w -u -r1.11 -r1.12
  
  
  
  1.6       +7 -7      ant/src/main/org/apache/tools/zip/ZipFile.java
  
  Index: ZipFile.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipFile.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- ZipFile.java	7 Jul 2003 13:50:57 -0000	1.5
  +++ ZipFile.java	15 Jul 2003 14:54:15 -0000	1.6
  @@ -220,7 +220,7 @@
   
       /**
        * Returns an InputStream for reading the contents of the given entry.
  -     * @param the entry to get the stream for.
  +     * @param ze the entry to get the stream for.
        * @return a stream to read the entry from.
        */
       public InputStream getInputStream(ZipEntry ze)
  
  
  
  1.6       +3 -4      ant/src/main/org/apache/tools/zip/ZipLong.java
  
  Index: ZipLong.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipLong.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- ZipLong.java	7 Mar 2003 11:23:10 -0000	1.5
  +++ ZipLong.java	15 Jul 2003 14:54:15 -0000	1.6
  @@ -89,7 +89,7 @@
        * @since 1.1
        */
       public ZipLong (byte[] bytes, int offset) {
  -        value = (bytes[offset + 3] << 24) & 0xFF000000l;
  +        value = (bytes[offset + 3] << 24) & 0xFF000000L;
           value += (bytes[offset + 2] << 16) & 0xFF0000;
           value += (bytes[offset + 1] << 8) & 0xFF00;
           value += (bytes[offset] & 0xFF);
  @@ -138,5 +138,4 @@
       public int hashCode() {
           return (int) value;
       }
  -
  -}// ZipLong
  +}
  
  
  
  1.14      +16 -16    ant/src/main/org/apache/tools/zip/ZipOutputStream.java
  
  Index: ZipOutputStream.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipOutputStream.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -w -u -r1.13 -r1.14
  --- ZipOutputStream.java	7 Mar 2003 11:23:10 -0000	1.13
  +++ ZipOutputStream.java	15 Jul 2003 14:54:15 -0000	1.14
  @@ -659,7 +659,7 @@
           result[0] = (byte) ((value & 0xFF));
           result[1] = (byte) ((value & 0xFF00) >> 8);
           result[2] = (byte) ((value & 0xFF0000) >> 16);
  -        result[3] = (byte) ((value & 0xFF000000l) >> 24);
  +        result[3] = (byte) ((value & 0xFF000000L) >> 24);
           return new ZipLong(result);
       }
   
  
  
  
  1.6       +2 -3      ant/src/main/org/apache/tools/zip/ZipShort.java
  
  Index: ZipShort.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/zip/ZipShort.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -w -u -r1.5 -r1.6
  --- ZipShort.java	7 Mar 2003 11:23:10 -0000	1.5
  +++ ZipShort.java	15 Jul 2003 14:54:15 -0000	1.6
  @@ -134,5 +134,4 @@
       public int hashCode() {
           return value;
       }
  -
  -}// ZipShort
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org