Hi,

Running the DeploymentPackageTask on Windows leads to the this weird error: "Error building deployment package: C" ....?

This is caused by a file URL that is constructed in a platform dependent way that does not work in windows. The "C" in the message comes from the root cause: UnknownHostException ;-).

The platform independent way is to use File.toURI().toURL(). I attached a patch (tested on windows and osx).

This patch also includes a warning when no files were selected, which, in cases no files are found, is a lot more usefull than logging the files that are found ;-) (especially for newbies)

Do you want me to open a Jira issue?

Regards
Peter


Index: src/org/apache/ace/ant/deploymentpackage/DeploymentPackageTask.java
===================================================================
--- src/org/apache/ace/ant/deploymentpackage/DeploymentPackageTask.java 
(revision 1453967)
+++ src/org/apache/ace/ant/deploymentpackage/DeploymentPackageTask.java 
(working copy)
@@ -134,11 +134,14 @@
         for (String file : files) {
             log("Found file: " + file);
         }
-        
+       if (files.size() == 0) {
+           log("No files found, creating empty deployment package!", 
Project.MSG_ERR);
+       }
+
         try {
                DeploymentPackageBuilder dp = 
DeploymentPackageBuilder.createDeploymentPackage(m_name, m_version);
                for (String file : files) {
-                       dp.addBundle(new URL("file://" + 
m_dir.getAbsolutePath() + "/" + file));
+                   dp.addBundle(new File(m_dir, file).toURI().toURL());
                }
                        dp.generate(new FileOutputStream(m_destination));
                }

Reply via email to