strip fat jar, strip exception messages

This commit is contained in:
Peter Hormanns 2016-08-31 17:50:15 +02:00
parent 664136d563
commit ff67ca8c96
3 changed files with 19 additions and 7 deletions

View File

@ -44,6 +44,16 @@
<groupId>org.apache.xmlrpc</groupId> <groupId>org.apache.xmlrpc</groupId>
<artifactId>xmlrpc-client</artifactId> <artifactId>xmlrpc-client</artifactId>
<version>3.1.3</version> <version>3.1.3</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jline</groupId> <groupId>jline</groupId>
@ -55,10 +65,5 @@
<artifactId>commons-cli</artifactId> <artifactId>commons-cli</artifactId>
<version>1.3.1</version> <version>1.3.1</version>
</dependency> </dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -62,7 +62,7 @@ public class Main {
} }
if (cmdParser.isInteractive()) { if (cmdParser.isInteractive()) {
String command = console.readInput(); String command = console.readInput();
while (!("bye".equals(command.trim()) || "exit".equals(command.trim()) || "quit".equals(command.trim()))) { while (!isExitCommand(command)) {
try { try {
scriptClient.execute(command); scriptClient.execute(command);
console.println(formatter.format(scriptClient.getLastRpcResult())); console.println(formatter.format(scriptClient.getLastRpcResult()));
@ -78,6 +78,11 @@ public class Main {
} }
} }
private static boolean isExitCommand(String command) {
String trimmedCommand = command.trim();
return "bye".equals(trimmedCommand) || "exit".equals(trimmedCommand) || "quit".equals(trimmedCommand);
}
private static String findRootException(final Exception exp) { private static String findRootException(final Exception exp) {
Throwable cause = exp; Throwable cause = exp;
while (cause.getCause() != null && cause.getCause() != cause) { while (cause.getCause() != null && cause.getCause() != cause) {

View File

@ -75,7 +75,9 @@ public class RpcClient {
} }
return list; return list;
} catch (XmlRpcException e) { } catch (XmlRpcException e) {
throw new JSCliException(e); final String message = e.getLocalizedMessage();
final int messageStartIndex = message.lastIndexOf("Exception:") + 10;
throw new JSCliException(message.substring(messageStartIndex).trim());
} }
} }