Skip to content
Snippets Groups Projects
Verified Commit d26941f2 authored by Anian Bühler's avatar Anian Bühler
Browse files

fixed try/catch errors when not in IDE

parent 2f9e3cc8
Branches
No related tags found
1 merge request!1dev_prefereences to master
...@@ -140,7 +140,7 @@ public class Context ...@@ -140,7 +140,7 @@ public class Context
try { try {
//TODO: set defaultFileName in ardublock.properties //TODO: set defaultFileName in ardublock.properties
loadPath = new File(URLDecoder.decode(getClass().getProtectionDomain().getCodeSource().getLocation().getFile(), "UTF-8")).getParentFile().getPath()+ File.separator +"defaultProgram.abp"; loadPath = new File(URLDecoder.decode(getClass().getProtectionDomain().getCodeSource().getLocation().getFile(), "UTF-8")).getParentFile().getPath()+ File.separator +"defaultProgram.abp";
} catch (UnsupportedEncodingException e2) { } catch (Exception e2) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
//e2.printStackTrace(); //e2.printStackTrace();
System.out.println("No default programm."); System.out.println("No default programm.");
...@@ -152,7 +152,7 @@ public class Context ...@@ -152,7 +152,7 @@ public class Context
workspaceController.loadProjectFromPath(loadPath, "default"); workspaceController.loadProjectFromPath(loadPath, "default");
} }
} catch (IOException e1) { } catch (Exception e1) {
try { try {
InputStream is = getClass().getResourceAsStream(DEFAULT_ARDUBLOCK_PROGRAM_PATH); InputStream is = getClass().getResourceAsStream(DEFAULT_ARDUBLOCK_PROGRAM_PATH);
InputStreamReader isr = new InputStreamReader(is); InputStreamReader isr = new InputStreamReader(is);
...@@ -168,13 +168,20 @@ public class Context ...@@ -168,13 +168,20 @@ public class Context
isr.close(); isr.close();
is.close(); is.close();
try {
if(PreferencesData.get("ardublock.workspace.mode").contains("custom") || PreferencesData.get("ardublock.workspace.mode").contains("page") || PreferencesData.get("ardublock.workspace.mode").contains("default") ) { if(PreferencesData.get("ardublock.workspace.mode").contains("custom") || PreferencesData.get("ardublock.workspace.mode").contains("page") || PreferencesData.get("ardublock.workspace.mode").contains("default") ) {
workspaceController.loadProject(defaultFileString, null , PreferencesData.get("ardublock.workspace.mode")); workspaceController.loadProject(defaultFileString, null , PreferencesData.get("ardublock.workspace.mode"));
} else { } else {
workspaceController.loadProject(defaultFileString, null , "default"); workspaceController.loadProject(defaultFileString, null , "default");
} }
} catch (Exception e) {
workspaceController.loadProject(defaultFileString, null , "default");
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) { } catch (Exception e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment