You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2011/07/18 12:15:00 UTC
svn commit: r1147826 -
/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
Author: jlboudart
Date: Mon Jul 18 12:15:00 2011
New Revision: 1147826
URL: http://svn.apache.org/viewvc?rev=1147826&view=rev
Log:
Fix handling of optional properties file
Modified:
incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java?rev=1147826&r1=1147825&r2=1147826&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/services/impl/DefaultPluginServiceImpl.java Mon Jul 18 12:15:00 2011
@@ -248,27 +248,30 @@ public class DefaultPluginServiceImpl im
throws IOException {
Map<String, String> attributes = task.getRuntimeConfigurableWrapper()
.getAttributeMap();
- if (attributes.get("file") != null
- && !Project.toBoolean(attributes.get("optional"))) {
+ if (attributes.get("file") != null) {
Properties propToLoad = new Properties();
File f = new File(PropertyHelper.getPropertyHelper(
task.getProject())
.replaceProperties(attributes.get("file")));
- try {
- propToLoad.load(new FileInputStream(f));
- for (Iterator iter = propToLoad.keySet().iterator(); iter
- .hasNext();) {
- String key = (String) iter.next();
- PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
- key);
- propertyDescriptor.setValue(propToLoad.getProperty(key));
- eaReport.addPropertyDescriptor(
- propertyDescriptor.getName(), propertyDescriptor);
- }
+ if (f.exists()) {
+ try {
+ propToLoad.load(new FileInputStream(f));
+ for (Iterator iter = propToLoad.keySet().iterator(); iter
+ .hasNext();) {
+ String key = (String) iter.next();
+ PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
+ key);
+ propertyDescriptor
+ .setValue(propToLoad.getProperty(key));
+ eaReport.addPropertyDescriptor(
+ propertyDescriptor.getName(),
+ propertyDescriptor);
+ }
- } catch (IOException e) {
- throw new IOException("Unable to parse the property file :"
- + attributes.get("file"), e);
+ } catch (IOException e) {
+ throw new IOException("Unable to parse the property file :"
+ + attributes.get("file"), e);
+ }
}
}
}
@@ -449,7 +452,8 @@ public class DefaultPluginServiceImpl im
PluginDescriptor plugin = (PluginDescriptor) iterator
.next();
ImportedModuleReport pluginReport = new ImportedModuleReport();
- ModuleRevisionId mrid = ModuleRevisionId.parse(plugin.getMrid());
+ ModuleRevisionId mrid = ModuleRevisionId.parse(plugin
+ .getMrid());
pluginReport.setModuleMrid(plugin.getMrid());
if (plugin.getAs() == null) {
pluginReport.setAs(mrid.getName());