ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From umag...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n Translate.java
Date Fri, 25 Jan 2002 16:15:44 GMT
umagesh     02/01/25 08:15:44

  Modified:    src/main/org/apache/tools/ant/taskdefs Checksum.java
                        Copy.java Move.java Unpack.java
               src/main/org/apache/tools/ant/taskdefs/condition Os.java
               src/main/org/apache/tools/ant/taskdefs/optional/i18n
                        Translate.java
  Log:
  Reverting argument naming changes to discuss a standardized way to change the names (if
at all needed).
  
  Revision  Changes    Path
  1.11      +24 -24    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java
  
  Index: Checksum.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Checksum.java	25 Jan 2002 15:10:00 -0000	1.10
  +++ Checksum.java	25 Jan 2002 16:15:44 -0000	1.11
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -129,55 +129,55 @@
       /**
        * Sets the file for which the checksum is to be calculated.
        */
  -    public void setFile(File aFile) {
  -        this.file = aFile;
  +    public void setFile(File file) {
  +        this.file = file;
       }
   
       /**
        * Sets the MessageDigest algorithm to be used
        * to calculate the checksum.
        */
  -    public void setAlgorithm(String aAlgorithm) {
  -        this.algorithm = aAlgorithm;
  +    public void setAlgorithm(String algorithm) {
  +        this.algorithm = algorithm;
       }
   
       /**
        * Sets the MessageDigest algorithm provider to be used
        * to calculate the checksum.
        */
  -    public void setProvider(String aProvider) {
  -        this.provider = aProvider;
  +    public void setProvider(String provider) {
  +        this.provider = provider;
       }
   
       /**
        * Sets the File Extension that is be to used to
        * create or identify destination file
        */
  -    public void setFileext(String aFileext) {
  -        this.fileext = aFileext;
  +    public void setFileext(String fileext) {
  +        this.fileext = fileext;
       }
   
       /**
        * Sets the property to hold the generated checksum
        */
  -    public void setProperty(String aProperty) {
  -        this.property = aProperty;
  +    public void setProperty(String property) {
  +        this.property = property;
       }
   
       /**
        * Sets verify property.  This project property holds
        * the result of a checksum verification - "true" or "false"
        */
  -    public void setVerifyproperty(String aVerifyProperty) {
  -        this.verifyProperty = aVerifyProperty;
  +    public void setVerifyproperty(String verifyProperty) {
  +        this.verifyProperty = verifyProperty;
       }
   
       /**
        * Overwrite existing file irrespective of whether it is newer than
        * the source file?  Defaults to false.
        */
  -    public void setForceOverwrite(boolean aForceOverwrite) {
  -        this.forceOverwrite = aForceOverwrite;
  +    public void setForceOverwrite(boolean forceOverwrite) {
  +        this.forceOverwrite = forceOverwrite;
       }
   
       /**
  @@ -311,24 +311,24 @@
        * Add key-value pair to the hashtable upon which
        * to later operate upon.
        */
  -    private void addToIncludeFileMap(File aFile) throws BuildException {
  -        if (aFile != null) {
  -            if (aFile.exists()) {
  +    private void addToIncludeFileMap(File file) throws BuildException {
  +        if (file != null) {
  +            if (file.exists()) {
                   if (property == null) {
  -                    File dest = new File(aFile.getParent(), aFile.getName() + fileext);
  +                    File dest = new File(file.getParent(), file.getName() + fileext);
                       if (forceOverwrite || isCondition ||
  -                        (aFile.lastModified() > dest.lastModified())) {
  -                        includeFileMap.put(aFile, dest);
  +                        (file.lastModified() > dest.lastModified())) {
  +                        includeFileMap.put(file, dest);
                       } else {
  -                        log(aFile + " omitted as " + dest + " is up to date.",
  +                        log(file + " omitted as " + dest + " is up to date.",
                               Project.MSG_VERBOSE);
                       }
                   } else {
  -                    includeFileMap.put(aFile, property);
  +                    includeFileMap.put(file, property);
                   }
               } else {
                   String message = "Could not find file "
  -                                 + aFile.getAbsolutePath()
  +                                 + file.getAbsolutePath()
                                    + " to generate checksum for.";
                   log(message);
                   throw new BuildException(message, location);
  
  
  
  1.29      +13 -13    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Copy.java	25 Jan 2002 15:10:00 -0000	1.28
  +++ Copy.java	25 Jan 2002 16:15:44 -0000	1.29
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -119,22 +119,22 @@
       /**
        * Sets a single source file to copy.
        */
  -    public void setFile(File aFile) {
  -        this.file = aFile;
  +    public void setFile(File file) {
  +        this.file = file;
       }
   
       /**
        * Sets the destination file.
        */
  -    public void setTofile(File aDestFile) {
  -        this.destFile = aDestFile;
  +    public void setTofile(File destFile) {
  +        this.destFile = destFile;
       }
   
       /**
        * Sets the destination directory.
        */
  -    public void setTodir(File aDestDir) {
  -        this.destDir = aDestDir;
  +    public void setTodir(File destDir) {
  +        this.destDir = destDir;
       }
   
       /**
  @@ -175,8 +175,8 @@
       /**
        * Sets filtering.
        */
  -    public void setFiltering(boolean aFiltering) {
  -        this.filtering = aFiltering;
  +    public void setFiltering(boolean filtering) {
  +        this.filtering = filtering;
       }
   
       /**
  @@ -193,8 +193,8 @@
        * file will be copied into the "flattened" directory, unless
        * the forceoverwrite attribute is true.
        */
  -    public void setFlatten(boolean aFlatten) {
  -        this.flatten = aFlatten;
  +    public void setFlatten(boolean flatten) {
  +        this.flatten = flatten;
       }
   
       /**
  @@ -211,8 +211,8 @@
       /**
        * Used to copy empty directories.
        */
  -    public void setIncludeEmptyDirs(boolean aIncludeEmpty) {
  -        this.includeEmpty = aIncludeEmpty;
  +    public void setIncludeEmptyDirs(boolean includeEmpty) {
  +        this.includeEmpty = includeEmpty;
       }
   
       /**
  
  
  
  1.15      +9 -9      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Move.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Move.java	25 Jan 2002 15:10:00 -0000	1.14
  +++ Move.java	25 Jan 2002 16:15:44 -0000	1.15
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -264,15 +264,15 @@
        *
        * @throws IOException
        */
  -    protected boolean renameFile(File sourceFile, File aDestFile,
  -                                 boolean aFiltering, boolean overwrite)
  +    protected boolean renameFile(File sourceFile, File destFile,
  +                                 boolean filtering, boolean overwrite)
           throws IOException, BuildException {
   
           boolean renamed = true;
  -        if (!aFiltering) {
  +        if (!filtering) {
               // ensure that parent dir of dest file exists!
               // not using getParentFile method to stay 1.1 compat
  -            String parentPath = aDestFile.getParent();
  +            String parentPath = destFile.getParent();
               if (parentPath != null) {
                   File parent = new File(parentPath);
                   if (!parent.exists()) {
  @@ -280,13 +280,13 @@
                   }
               }
   
  -            if (aDestFile.exists()) {
  -                if (!aDestFile.delete()) {
  +            if (destFile.exists()) {
  +                if (!destFile.delete()) {
                       throw new BuildException("Unable to remove existing file "
  -                                             + aDestFile);
  +                                             + destFile);
                   }
               }
  -            renamed = sourceFile.renameTo(aDestFile);
  +            renamed = sourceFile.renameTo(destFile);
           } else {
               renamed = false;
           }
  
  
  
  1.8       +5 -5      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Unpack.java
  
  Index: Unpack.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Unpack.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Unpack.java	25 Jan 2002 15:10:00 -0000	1.7
  +++ Unpack.java	25 Jan 2002 16:15:44 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -88,18 +88,18 @@
        *             mechanism do the work and also to encapsulate operations on
        *             the type in its own class.
        */
  -    public void setDest(String aDest) {
  +    public void setDest(String dest) {
           log("DEPRECATED - The setDest(String) method has been deprecated."
               + " Use setDest(File) instead.");
  -        setDest(project.resolveFile(aDest));
  +        setDest(project.resolveFile(dest));
       }
   
       public void setSrc(File src) {
           source = src;
       }
   
  -    public void setDest(File aDest) {
  -        this.dest = aDest;
  +    public void setDest(File dest) {
  +        this.dest = dest;
       }
   
       private void validate() throws BuildException {
  
  
  
  1.11      +36 -36    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
  
  Index: Os.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Os.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Os.java	25 Jan 2002 15:10:00 -0000	1.10
  +++ Os.java	25 Jan 2002 16:15:44 -0000	1.11
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -63,7 +63,7 @@
    *
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public class Os implements Condition {
       private final static String osName =
  @@ -81,8 +81,8 @@
   
       public Os() {}
   
  -    public Os(String aFamily) {
  -        setFamily(aFamily);
  +    public Os(String family) {
  +        setFamily(family);
       }
   
       /**
  @@ -104,8 +104,8 @@
        *
        * @param name   The OS name
        */
  -    public void setName(String aName) {
  -        this.name = aName.toLowerCase(Locale.US);
  +    public void setName(String name) {
  +        this.name = name.toLowerCase(Locale.US);
       }
   
       /**
  @@ -113,8 +113,8 @@
        *
        * @param arch   The OS architecture
        */
  -    public void setArch(String aArch) {
  -        this.arch = aArch.toLowerCase(Locale.US);
  +    public void setArch(String arch) {
  +        this.arch = arch.toLowerCase(Locale.US);
       }
   
       /**
  @@ -122,8 +122,8 @@
        *
        * @param version   The OS version
        */
  -    public void setVersion(String aVersion) {
  -        this.version = aVersion.toLowerCase(Locale.US);
  +    public void setVersion(String version) {
  +        this.version = version.toLowerCase(Locale.US);
       }
   
       /**
  @@ -141,8 +141,8 @@
        *
        * @since 1.5
        */
  -    public static boolean isFamily(String aFamily) {
  -        return isOs(aFamily, null, null, null);
  +    public static boolean isFamily(String family) {
  +        return isOs(family, null, null, null);
       }
   
       /**
  @@ -151,8 +151,8 @@
        *
        * @since 1.7
        */
  -    public static boolean isName(String aName) {
  -        return isOs(null, aName, null, null);
  +    public static boolean isName(String name) {
  +        return isOs(null, name, null, null);
       }
   
       /**
  @@ -161,8 +161,8 @@
        *
        * @since 1.7
        */
  -    public static boolean isArch(String aArch) {
  -        return isOs(null, null, aArch, null);
  +    public static boolean isArch(String arch) {
  +        return isOs(null, null, arch, null);
       }
   
       /**
  @@ -171,8 +171,8 @@
        *
        * @since 1.7
        */
  -    public static boolean isVersion(String aVersion) {
  -        return isOs(null, null, null, aVersion);
  +    public static boolean isVersion(String version) {
  +        return isOs(null, null, null, version);
       }
   
       /**
  @@ -186,46 +186,46 @@
        *
        * @since 1.7
        */
  -    public static boolean isOs(String aFamily, String aName, String aArch,
  -                               String aVersion) {
  +    public static boolean isOs(String family, String name, String arch,
  +                               String version) {
           boolean retValue = false;
   
  -        if (aFamily != null || aName != null || aArch != null
  -            || aVersion != null) {
  +        if (family != null || name != null || arch != null
  +            || version != null) {
   
               boolean isFamily = true;
               boolean isName = true;
               boolean isArch = true;
               boolean isVersion = true;
   
  -            if (aFamily != null) {
  -                if (aFamily.equals("windows")) {
  +            if (family != null) {
  +                if (family.equals("windows")) {
                       isFamily = osName.indexOf("windows") > -1;
  -                } else if (aFamily.equals("os/2")) {
  +                } else if (family.equals("os/2")) {
                       isFamily = osName.indexOf("os/2") > -1;
  -                } else if (aFamily.equals("netware")) {
  +                } else if (family.equals("netware")) {
                       isFamily = osName.indexOf("netware") > -1;
  -                } else if (aFamily.equals("dos")) {
  +                } else if (family.equals("dos")) {
                       isFamily = pathSep.equals(";") && !isFamily("netware");
  -                } else if (aFamily.equals("mac")) {
  +                } else if (family.equals("mac")) {
                       isFamily = osName.indexOf("mac") > -1;
  -                } else if (aFamily.equals("unix")) {
  +                } else if (family.equals("unix")) {
                       isFamily = pathSep.equals(":")
                           && (!isFamily("mac") || osName.endsWith("x"));
                   } else {
                       throw new BuildException(
                           "Don\'t know how to detect os family \""
  -                        + aFamily + "\"");
  +                        + family + "\"");
                   }
               }
  -            if (aName != null) {
  -                isName = aName.equals(osName);
  +            if (name != null) {
  +                isName = name.equals(osName);
               }
  -            if (aArch != null) {
  -                isArch = aArch.equals(osArch);
  +            if (arch != null) {
  +                isArch = arch.equals(osArch);
               }
  -            if (aVersion != null) {
  -                isVersion = aVersion.equals(osVersion);
  +            if (version != null) {
  +                isVersion = version.equals(osVersion);
               }
               retValue = isFamily && isName && isArch && isVersion;
           }
  
  
  
  1.7       +84 -84    jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  
  Index: Translate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Translate.java	25 Jan 2002 15:10:00 -0000	1.6
  +++ Translate.java	25 Jan 2002 16:15:44 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001-2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -158,72 +158,72 @@
       /**
        * Sets Family name of resource bundle
        */
  -    public void setBundle(String aBundle) {
  -        this.bundle = aBundle;
  +    public void setBundle(String bundle) {
  +        this.bundle = bundle;
       }
   
       /**
        * Sets locale specific language of resource bundle
        */
  -    public void setBundleLanguage(String aBundleLanguage ) {
  -        this.bundleLanguage = aBundleLanguage;
  +    public void setBundleLanguage(String bundleLanguage ) {
  +        this.bundleLanguage = bundleLanguage;
       }
   
       /**
        * Sets locale specific country of resource bundle
        */
  -    public void setBundleCountry(String aBundleCountry) {
  -        this.bundleCountry = aBundleCountry;
  +    public void setBundleCountry(String bundleCountry) {
  +        this.bundleCountry = bundleCountry;
       }
   
       /**
        * Sets locale specific variant of resource bundle
        */
  -    public void setBundleVariant(String aBundleVariant) {
  -        this.bundleVariant = aBundleVariant;
  +    public void setBundleVariant(String bundleVariant) {
  +        this.bundleVariant = bundleVariant;
       }
   
       /**
        * Sets Destination directory
        */
  -    public void setToDir(File aToDir) {
  -        this.toDir = aToDir;
  +    public void setToDir(File toDir) {
  +        this.toDir = toDir;
       }
   
       /**
        * Sets starting token to identify keys
        */
  -    public void setStartToken(String aStartToken) {
  -        this.startToken = aStartToken;
  +    public void setStartToken(String startToken) {
  +        this.startToken = startToken;
       }
   
       /**
        * Sets ending token to identify keys
        */
  -    public void setEndToken(String aEndToken) {
  -        this.endToken = aEndToken;
  +    public void setEndToken(String endToken) {
  +        this.endToken = endToken;
       }
   
       /**
        * Sets source file encoding scheme
        */
  -    public void setSrcEncoding(String aSrcEncoding) {
  -        this.srcEncoding = aSrcEncoding;
  +    public void setSrcEncoding(String srcEncoding) {
  +        this.srcEncoding = srcEncoding;
       }
   
       /**
        * Sets destination file encoding scheme.  Defaults to source file
        * encoding
        */
  -    public void setDestEncoding(String aDestEncoding) {
  -        this.destEncoding = aDestEncoding;
  +    public void setDestEncoding(String destEncoding) {
  +        this.destEncoding = destEncoding;
       }
   
       /**
        * Sets Resource Bundle file encoding scheme
        */
  -    public void setBundleEncoding(String aBundleEncoding) {
  -        this.bundleEncoding = aBundleEncoding;
  +    public void setBundleEncoding(String bundleEncoding) {
  +        this.bundleEncoding = bundleEncoding;
       }
   
       /**
  @@ -231,8 +231,8 @@
        * the source file as well as the resource bundle file?  Defaults to
        * false.
        */
  -    public void setForceOverwrite(boolean aForceOverwrite) {
  -        this.forceOverwrite = aForceOverwrite;
  +    public void setForceOverwrite(boolean forceOverwrite) {
  +        this.forceOverwrite = forceOverwrite;
       }
   
       /**
  @@ -339,17 +339,17 @@
        * but with bundle encoding also considered while loading.
        */
       private void loadResourceMaps() throws BuildException {
  -        Locale aLocale = new Locale(bundleLanguage,
  +        Locale locale = new Locale(bundleLanguage,
                                      bundleCountry,
                                      bundleVariant);
  -        String language = aLocale.getLanguage().length() > 0 ?
  -            "_" + aLocale.getLanguage() :
  +        String language = locale.getLanguage().length() > 0 ?
  +            "_" + locale.getLanguage() :
               "";
  -        String country = aLocale.getCountry().length() > 0 ?
  -            "_" + aLocale.getCountry() :
  +        String country = locale.getCountry().length() > 0 ?
  +            "_" + locale.getCountry() :
               "";
  -        String variant = aLocale.getVariant().length() > 0 ?
  -            "_" + aLocale.getVariant() :
  +        String variant = locale.getVariant().length() > 0 ?
  +            "_" + locale.getVariant() :
               "";
           String bundleFile = bundle + language + country + variant;
           processBundle(bundleFile, 0, false);
  @@ -365,16 +365,16 @@
   
           //Load default locale bundle files
           //using default file encoding scheme.
  -        aLocale = Locale.getDefault();
  +        locale = Locale.getDefault();
   
  -        language = aLocale.getLanguage().length() > 0 ?
  -            "_" + aLocale.getLanguage() :
  +        language = locale.getLanguage().length() > 0 ?
  +            "_" + locale.getLanguage() :
               "";
  -        country = aLocale.getCountry().length() > 0 ?
  -            "_" + aLocale.getCountry() :
  +        country = locale.getCountry().length() > 0 ?
  +            "_" + locale.getCountry() :
               "";
  -        variant = aLocale.getVariant().length() > 0 ?
  -            "_" + aLocale.getVariant() :
  +        variant = locale.getVariant().length() > 0 ?
  +            "_" + locale.getVariant() :
               "";
           bundleEncoding = System.getProperty("file.encoding");
   
  @@ -391,19 +391,18 @@
       /**
        * Process each file that makes up this bundle.
        */
  -    private void processBundle(final String bundleFile, final int i,
  -                               final boolean checkLoaded)
  -        throws BuildException {
  -        String lBundleFile = bundleFile + ".properties";
  +    private void processBundle(String bundleFile, int i,
  +                                 boolean checkLoaded) throws BuildException {
  +        bundleFile += ".properties";
           FileInputStream ins = null;
           try {
  -            ins = new FileInputStream(lBundleFile);
  +            ins = new FileInputStream(bundleFile);
               loaded = true;
  -            bundleLastModified[i] = new File(lBundleFile).lastModified();
  -            log("Using " + lBundleFile, Project.MSG_DEBUG);
  +            bundleLastModified[i] = new File(bundleFile).lastModified();
  +            log("Using " + bundleFile, Project.MSG_DEBUG);
               loadResourceMap(ins);
           } catch (IOException ioe) {
  -            log(lBundleFile + " not found.", Project.MSG_DEBUG);
  +            log(bundleFile + " not found.", Project.MSG_DEBUG);
               //if all resource files associated with this bundle
               //have been scanned for and still not able to
               //find a single resrouce file, throw exception
  @@ -525,49 +524,50 @@
                                                                                        srcEncoding));
                           String line;
                           while((line = in.readLine()) != null) {
  +                            StringBuffer newline = new StringBuffer(line);
                               int startIndex = -1;
                               int endIndex = -1;
  -outer:                      while (true) {
  -                                startIndex = line.indexOf(startToken, endIndex + 1);
  -                                if (startIndex < 0 ||
  -                                    startIndex + 1 >= line.length()) {
  -                                    break;
  -                                }
  -                                endIndex = line.indexOf(endToken, startIndex + 1);
  -                                if (endIndex < 0) {
  -                                    break;
  -                                }
  -                                String matches = line.substring(startIndex + 1,
  -                                                                endIndex);
  -                                    //If there is a white space or = or :, then
  -                                    //it isn't to be treated as a valid key.
  -                                for (int k = 0; k < matches.length(); k++) {
  -                                    char c = matches.charAt(k);
  -                                    if (c == ':' ||
  -                                        c == '=' ||
  -                                        Character.isSpaceChar(c)) {
  -                                        endIndex = endIndex - 1;
  -                                        continue outer;
  -                                    }
  -                                }
  -                                String replace = null;
  -                                replace = (String) resourceMap.get(matches);
  -                                    //If the key hasn't been loaded into resourceMap,
  -                                    //use the key itself as the value also.
  -                                if (replace == null) {
  -                                    log("Warning: The key: " + matches
  -                                        + " hasn't been defined.",
  -                                        Project.MSG_DEBUG);
  -                                    replace = matches;
  -                                }
  -                                line = line.substring(0, startIndex)
  -                                    + replace
  -                                    + line.substring(endIndex + 1);
  -                                endIndex = startIndex + replace.length() + 1;
  -                                if (endIndex + 1 >= line.length()) {
  -                                    break;
  +                        outer:                      while (true) {
  +                            startIndex = line.indexOf(startToken, endIndex + 1);
  +                            if (startIndex < 0 ||
  +                                startIndex + 1 >= line.length()) {
  +                                break;
  +                            }
  +                            endIndex = line.indexOf(endToken, startIndex + 1);
  +                            if (endIndex < 0) {
  +                                break;
  +                            }
  +                            String matches = line.substring(startIndex + 1,
  +                                                            endIndex);
  +                                //If there is a white space or = or :, then
  +                                //it isn't to be treated as a valid key.
  +                            for (int k = 0; k < matches.length(); k++) {
  +                                char c = matches.charAt(k);
  +                                if (c == ':' ||
  +                                    c == '=' ||
  +                                    Character.isSpaceChar(c)) {
  +                                    endIndex = endIndex - 1;
  +                                    continue outer;
                                   }
                               }
  +                            String replace = null;
  +                            replace = (String) resourceMap.get(matches);
  +                                //If the key hasn't been loaded into resourceMap,
  +                                //use the key itself as the value also.
  +                            if (replace == null) {
  +                                log("Warning: The key: " + matches
  +                                    + " hasn't been defined.",
  +                                    Project.MSG_DEBUG);
  +                                replace = matches;
  +                            }
  +                            line = line.substring(0, startIndex)
  +                                + replace
  +                                + line.substring(endIndex + 1);
  +                            endIndex = startIndex + replace.length() + 1;
  +                            if (endIndex + 1 >= line.length()) {
  +                                break;
  +                            }
  +                        }
                               out.write(line);
                               out.newLine();
                           }
  
  
  

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


Mime
View raw message