donaldp 01/11/02 20:01:18
Modified: src/main/org/apache/tools/ant/taskdefs/optional/i18n
Translate.java
Log:
Added some validation to make sure delimiters are one character long.
Submitted by: "Magesh Umasankar" <[EMAIL PROTECTED]>
Revision Changes Path
1.2 +17 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Translate.java 2001/11/02 23:30:44 1.1
+++ Translate.java 2001/11/03 04:01:18 1.2
@@ -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]>