]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java
Refactor / rename
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.ui.launch / src / main / java / org / argeo / slc / ui / launch / script / SlcScriptLaunchDelegate.java
index 28f9671c14155da78bb1aabcfc0ca3ce1d49d8cf..3fb6e3c97c49a3d81b7e58f955ec72221fd9ad90 100644 (file)
@@ -1,7 +1,7 @@
 package org.argeo.slc.ui.launch.script;\r
 \r
+import java.io.ByteArrayInputStream;\r
 import java.io.IOException;\r
-import java.io.StringReader;\r
 import java.util.List;\r
 import java.util.Properties;\r
 import java.util.Vector;\r
@@ -10,7 +10,7 @@ import org.argeo.slc.ui.launch.DeployedSlcSystem;
 import org.argeo.slc.ui.launch.EmbeddedSlcSystem;\r
 import org.argeo.slc.ui.launch.SlcSystem;\r
 import org.argeo.slc.ui.launch.SlcUiLaunchPlugin;\r
-import org.argeo.slc.ui.launch.preferences.SlcPreferencePage;\r
+import org.argeo.slc.ui.launch.preferences.SlcLaunchPreferencePage;\r
 import org.eclipse.core.resources.IFile;\r
 import org.eclipse.core.resources.IProject;\r
 import org.eclipse.core.resources.ResourcesPlugin;\r
@@ -43,6 +43,7 @@ public class SlcScriptLaunchDelegate extends
        public final static String ANT_MAIN = "org.apache.tools.ant.Main";\r
        public final static String SLC_MAIN = "org.argeo.slc.cli.SlcMain";\r
 \r
+       @SuppressWarnings("deprecation")\r
        public void launch(ILaunchConfiguration configuration, String mode,\r
                        ILaunch launch, IProgressMonitor monitor) throws CoreException {\r
                if (!saveBeforeLaunch(configuration, mode, monitor))\r
@@ -100,7 +101,7 @@ public class SlcScriptLaunchDelegate extends
                if (slcSystem == null) {\r
                        String slcRuntimePath = SlcUiLaunchPlugin.getDefault()\r
                                        .getPreferenceStore().getString(\r
-                                                       SlcPreferencePage.PREF_SLC_RUNTIME_LOCATION);\r
+                                                       SlcLaunchPreferencePage.PREF_SLC_RUNTIME_LOCATION);\r
                        if (slcRuntimePath == null || slcRuntimePath.equals("")) {\r
                                showError("SLC Runtime path is not set. Set it in Windows > Preferences > SLC");\r
                                return null;\r
@@ -181,15 +182,20 @@ public class SlcScriptLaunchDelegate extends
 \r
                // Properties\r
                Properties properties = new Properties();\r
-               StringReader reader = new StringReader(configuration.getAttribute(\r
-                               SlcScriptUtils.ATTR_PROPERTIES, ""));\r
+               String str = configuration.getAttribute(SlcScriptUtils.ATTR_PROPERTIES,\r
+                               "");\r
+               ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes());\r
                try {\r
-                       properties.load(reader);\r
+                       properties.load(in);\r
                } catch (IOException e) {\r
                        throw new RuntimeException("Cannot read properties", e);\r
                } finally {\r
-                       if (reader != null)\r
-                               reader.close();\r
+                       if (in != null)\r
+                               try {\r
+                                       in.close();\r
+                               } catch (IOException e) {\r
+                                       // silent\r
+                               }\r
                }\r
 \r
                for (Object key : properties.keySet()) {\r