X-Git-Url: http://git.nikiroo.be/?p=jvcard.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fjvcard%2Flauncher%2FMain.java;fp=src%2Fbe%2Fnikiroo%2Fjvcard%2Flauncher%2FMain.java;h=a10d68c51a5fd85f6c0c00f4a123421d0bbf5423;hp=6d552febfae8c16955cde0ad95480f32ef5bdc40;hb=e643219c4836b74a022a23d232f7ad80b521bf2f;hpb=d459d7e12a3398344e021b1b12c94a8d647cb6c4 diff --git a/src/be/nikiroo/jvcard/launcher/Main.java b/src/be/nikiroo/jvcard/launcher/Main.java index 6d552fe..a10d68c 100644 --- a/src/be/nikiroo/jvcard/launcher/Main.java +++ b/src/be/nikiroo/jvcard/launcher/Main.java @@ -15,6 +15,7 @@ import be.nikiroo.jvcard.Contact; import be.nikiroo.jvcard.Data; import be.nikiroo.jvcard.TypeInfo; import be.nikiroo.jvcard.launcher.CardResult.MergeCallback; +import be.nikiroo.jvcard.launcher.Optional.NotSupportedException; import be.nikiroo.jvcard.parsers.Format; import be.nikiroo.jvcard.remote.Command; import be.nikiroo.jvcard.remote.SimpleSocket; @@ -286,12 +287,12 @@ public class Main { case SERVER: { try { Optional.runServer(port); - } catch (Exception e) { - if (e instanceof IOException) { - ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_START, - ERR_INTERNAL); - return; - } else if (e instanceof ClassNotFoundException) { + } catch (IOException e) { + ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_START, + ERR_INTERNAL); + return; + } catch (NotSupportedException e) { + if (!e.isCompiledIn()) { ERR(StringId.CLI_ERR, StringId.CLI_ERR_NO_REMOTING, ERR_INTERNAL); return; @@ -392,12 +393,12 @@ public class Main { case CONTACT_MANAGER: { try { Optional.startTui(textMode, files); - } catch (Exception e) { - if (e instanceof IOException) { - ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_START, - ERR_NO_FILE); - return; - } else if (e instanceof ClassNotFoundException) { + } catch (IOException e) { + ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_START, + ERR_NO_FILE); + return; + } catch (NotSupportedException e) { + if (!e.isCompiledIn()) { ERR(StringId.CLI_ERR, StringId.CLI_ERR_NO_TUI, ERR_INTERNAL); return; } else { @@ -499,7 +500,7 @@ public class Main { } } catch (IOException ioe) { throw ioe; - } catch (Exception e) { + } catch (NotSupportedException e) { throw new IOException("Remoting support not available", e); }