Browse Source

Added some validation to make sure delimiters are one character long.

Submitted by: "Magesh Umasankar" <umagesh@rediffmail.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269861 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
b3d619d507
1 changed files with 17 additions and 2 deletions
  1. +17
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java

+ 17
- 2
src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java View File

@@ -139,6 +139,10 @@ public class Translate extends MatchingTask {
* 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 @@ public class Translate extends MatchingTask {
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 @@ public class Translate extends MatchingTask {
* 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 @@ public class Translate extends MatchingTask {
*/
private void processBundle(String bundleFile, int i,
boolean checkLoaded) throws BuildException {
boolean loaded = false;
bundleFile += ".properties";
FileInputStream ins = null;
try {


Loading…
Cancel
Save