#5320 Fix whitespace problem
[taxeditor.git] / eu.etaxonomy.taxeditor.cdmlib / src / main / java / eu / etaxonomy / cdm / api / application / CdmApplicationState.java
index e9e489a53666ed112d83fa96a41385b61e67c993..8bee46bf9946ebd9e7472e970d04d4646aeb4827 100644 (file)
@@ -14,6 +14,7 @@ import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
+import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Dictionary;
@@ -245,7 +246,8 @@ public class CdmApplicationState {
                     URL fileURL = bundle.getEntry(jar);
                     File file = null;
                     try {
-                        file = new File(FileLocator.resolve(fileURL).toURI());
+                        String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");;
+                        file = new File(new URI(urlString));
                         JarFile jarFile = new JarFile(file);
                         Manifest manifest = jarFile.getManifest();
                         Attributes attributes = manifest.getMainAttributes();
@@ -256,6 +258,7 @@ public class CdmApplicationState {
                         cdmlibVersion = attributes.getValue("Bundle-Version");
                         cdmlibLastModified = attributes.getValue("Bnd-LastModified");
 
+                        jarFile.close();
                         if(cdmlibVersion == null || cdmlibLastModified == null) {
                             throw new IllegalStateException("Invalid cdmlib manifest info");
                         }