On Sat, 03 Nov 2001 Peter Donald wrote :
> I should note that I changed all protected members to 
> private. Tell me if this causes any issues ;)


No, it doesn't cause any issues - the idea was to open 
up the methods that may be overridden if at all a task 
is going to be extending this one in the future...

I had noticed s small problem after I had submitted this
task and I had followed it up with a revision.  I see 
that the revision did not get applied.  Here is a patch 
that will get rid of this bug.

Please note that currently, the starttoken and endtoken 
values must be just a single character instead of a 
string of tokens (I am still working on making this task
recognize from a set of starttokens and endtokens.  I
have temporarily introduced validations to make sure
that these values are indeed 1 character in length.  

Please apply this patch.

Thanks,
Magesh

 
cvs diff -u Translate.java 
Index: Translate.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java,v
retrieving revision 1.1
diff -u -r1.1 Translate.java
--- Translate.java      2001/11/02 23:30:44     1.1
+++ Translate.java      2001/11/03 02:35:18
@@ -139,6 +139,10 @@
      * Last Modified Timestamp of destination file being used.
      */
     private long destLastModified;
+    /**
+     * Has at least one file from the bundle been loaded?
+     */
+    private boolean loaded = false;
 
     /**
      * Sets Family name of resource bundle
@@ -241,11 +245,23 @@
                                      location);
         }
 
+        if (startToken.length() != 1) {
+            throw new BuildException(
+                "The starttoken attribute must be a single character.",
+                                         location);
+        }
+
         if (endToken == null) {
             throw new BuildException("The endtoken attribute must be set.",
                                      location);
         }
 
+        if (endToken.length() != 1) {
+            throw new BuildException(
+                "The endtoken attribute must be a single character.",
+                                         location);
+        }
+
         if (bundleLanguage == null) {
             Locale l = Locale.getDefault();
             bundleLanguage  = l.getLanguage();
@@ -311,7 +327,7 @@
      * once this file is located, it is treated just like a properties file
      * but with bundle encoding also considered while loading.
      */
-    public void loadResourceMaps() throws BuildException {
+    private void loadResourceMaps() throws BuildException {
         Locale locale = new Locale(bundleLanguage,
                                    bundleCountry,
                                    bundleVariant);
@@ -366,7 +382,6 @@
      */
     private void processBundle(String bundleFile, int i,
                                  boolean checkLoaded) throws BuildException {
-        boolean loaded = false;
         bundleFile += ".properties";
         FileInputStream ins = null;
         try {

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

Reply via email to