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;
case SERVER: {
try {
Optional.runServer(port);
- } catch (Exception e) {
- if (e instanceof IOException) {
- System.err
- .println("I/O Exception: Cannot start the server");
- } else {
+ } 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;
+ } else {
+ e.printStackTrace();
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR, ERR_INTERNAL);
+ return;
}
}
break;
try {
transService.updateFile(dir);
} catch (IOException e) {
- System.err.println(trans(StringId.CLI_ERR_CANNOT_CREATE_LANG,
- dir));
- e.printStackTrace();
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR_CANNOT_CREATE_LANG,
+ ERR_INTERNAL);
+ return;
}
break;
}
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);
+ } 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 {
- ERR(StringId.CLI_ERR, StringId.CLI_ERR_NO_TUI, ERR_INTERNAL);
+ e.printStackTrace();
+ ERR(StringId.CLI_ERR, StringId.CLI_ERR, ERR_INTERNAL);
return;
}
}
}
} catch (IOException ioe) {
throw ioe;
- } catch (Exception e) {
+ } catch (NotSupportedException e) {
throw new IOException("Remoting support not available", e);
}