diff options
author | Stefan Bodewig <bodewig@apache.org> | 2008-08-21 07:57:03 +0000 |
---|---|---|
committer | Stefan Bodewig <bodewig@apache.org> | 2008-08-21 07:57:03 +0000 |
commit | 01a000d122b42cdc5d5e8c730e10835158df0c09 (patch) | |
tree | 518c24792d529097eafbe27a76011db9b05529fc /src | |
parent | 7a1f5b527506ff4568d94be524a8e67fa6f79459 (diff) | |
download | ant-01a000d122b42cdc5d5e8c730e10835158df0c09.tar.gz |
style
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@687620 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java index f247a6614..46df19b48 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java @@ -110,9 +110,9 @@ import org.apache.tools.ant.types.EnumeratedAttribute; public class PropertyFile extends Task { /* ======================================================================== - * - * Instance variables. - */ + * + * Instance variables. + */ // Use this to prepend a message to the properties file private String comment; @@ -124,14 +124,14 @@ public class PropertyFile extends Task { private Vector entries = new Vector(); /* ======================================================================== - * - * Constructors - */ + * + * Constructors + */ /* ======================================================================== - * - * Methods - */ + * + * Methods + */ /** * Execute the task. @@ -163,7 +163,8 @@ public class PropertyFile extends Task { private void readFile() throws BuildException { if (useJDKProperties) { - // user chose to use standard Java properties, which loose comments and layout + // user chose to use standard Java properties, which loose + // comments and layout properties = new Properties(); } else { properties = new LayoutPreservingProperties(); @@ -202,7 +203,8 @@ public class PropertyFile extends Task { private void checkParameters() throws BuildException { if (!checkParam(propertyfile)) { - throw new BuildException("file token must not be null.", getLocation()); + throw new BuildException("file token must not be null.", + getLocation()); } } @@ -223,12 +225,13 @@ public class PropertyFile extends Task { } /** - * optional flag to use original Java properties (as opposed to layout preserving properties) + * optional flag to use original Java properties (as opposed to + * layout preserving properties) */ public void setJDKProperties(boolean val) { useJDKProperties = val; } - + private void writeFile() throws BuildException { BufferedOutputStream bos = null; try { @@ -356,7 +359,7 @@ public class PropertyFile extends Task { executeString(oldValue); } else { throw new BuildException("Unknown operation type: " - + type); + + type); } } catch (NullPointerException npe) { // Default to string type @@ -373,17 +376,17 @@ public class PropertyFile extends Task { } /** - * Handle operations for type <code>date</code>. - * - * @param oldValue the current value read from the property file or - * <code>null</code> if the <code>key</code> was - * not contained in the property file. - */ + * Handle operations for type <code>date</code>. + * + * @param oldValue the current value read from the property file or + * <code>null</code> if the <code>key</code> was + * not contained in the property file. + */ private void executeDate(String oldValue) throws BuildException { Calendar currentValue = Calendar.getInstance(); if (pattern == null) { - pattern = "yyyy/MM/dd HH:mm"; + pattern = "yyyy/MM/dd HH:mm"; } DateFormat fmt = new SimpleDateFormat(pattern); @@ -420,19 +423,19 @@ public class PropertyFile extends Task { /** - * Handle operations for type <code>int</code>. - * - * @param oldValue the current value read from the property file or - * <code>null</code> if the <code>key</code> was - * not contained in the property file. - */ + * Handle operations for type <code>int</code>. + * + * @param oldValue the current value read from the property file or + * <code>null</code> if the <code>key</code> was + * not contained in the property file. + */ private void executeInteger(String oldValue) throws BuildException { int currentValue = DEFAULT_INT_VALUE; int newV = DEFAULT_INT_VALUE; DecimalFormat fmt = (pattern != null) ? new DecimalFormat(pattern) - : new DecimalFormat(); + : new DecimalFormat(); try { String curval = getCurrentValue(oldValue); if (curval != null) { @@ -471,12 +474,12 @@ public class PropertyFile extends Task { } /** - * Handle operations for type <code>string</code>. - * - * @param oldValue the current value read from the property file or - * <code>null</code> if the <code>key</code> was - * not contained in the property file. - */ + * Handle operations for type <code>string</code>. + * + * @param oldValue the current value read from the property file or + * <code>null</code> if the <code>key</code> was + * not contained in the property file. + */ private void executeString(String oldValue) throws BuildException { String newV = DEFAULT_STRING_VALUE; @@ -503,18 +506,18 @@ public class PropertyFile extends Task { if (type == Type.STRING_TYPE && operation == Operation.DECREMENT_OPER) { throw new BuildException("- is not supported for string " - + "properties (key:" + key + ")"); + + "properties (key:" + key + ")"); } if (value == null && defaultValue == null) { throw new BuildException("\"value\" and/or \"default\" " - + "attribute must be specified (key:" + key + ")"); + + "attribute must be specified (key:" + key + ")"); } if (key == null) { throw new BuildException("key is mandatory"); } if (type == Type.STRING_TYPE && pattern != null) { throw new BuildException("pattern is not supported for string " - + "properties (key:" + key + ")"); + + "properties (key:" + key + ")"); } } @@ -651,7 +654,7 @@ public class PropertyFile extends Task { /** no arg constructor */ public Unit() { calendarFields.put(MILLISECOND, - new Integer(Calendar.MILLISECOND)); + new Integer(Calendar.MILLISECOND)); calendarFields.put(SECOND, new Integer(Calendar.SECOND)); calendarFields.put(MINUTE, new Integer(Calendar.MINUTE)); calendarFields.put(HOUR, new Integer(Calendar.HOUR_OF_DAY)); |