Signed-off-by: Emmanuel Bigeon <emmanuel@bigeon.fr>
This commit is contained in:
parent
3960b10e8e
commit
9cf30ef7d2
@ -139,7 +139,7 @@ public final class ScriptExecution extends Command {
|
|||||||
try (InputStreamReader fReader = new InputStreamReader(
|
try (InputStreamReader fReader = new InputStreamReader(
|
||||||
Files.newInputStream(Paths.get(scriptFile)), charset);
|
Files.newInputStream(Paths.get(scriptFile)), charset);
|
||||||
BufferedReader reader = new BufferedReader(fReader)) {
|
BufferedReader reader = new BufferedReader(fReader)) {
|
||||||
String[] emptyArray = new String[0];
|
final String[] emptyArray = new String[0];
|
||||||
while ((cmd = reader.readLine()) != null) {
|
while ((cmd = reader.readLine()) != null) {
|
||||||
lineNo++;
|
lineNo++;
|
||||||
final String cmdLine = readCommandLine(cmd, params);
|
final String cmdLine = readCommandLine(cmd, params);
|
||||||
@ -237,10 +237,16 @@ public final class ScriptExecution extends Command {
|
|||||||
* @return the exception to actually throw */
|
* @return the exception to actually throw */
|
||||||
private static CommandRunException manageRunException(final CommandRunException e,
|
private static CommandRunException manageRunException(final CommandRunException e,
|
||||||
final int lineNo) {
|
final int lineNo) {
|
||||||
|
final StringBuilder builder = new StringBuilder(e.getLocalizedMessage());
|
||||||
|
int index = builder.indexOf("\n");
|
||||||
|
while (index > 0) {
|
||||||
|
builder.insert(index + 1, " ");
|
||||||
|
index = builder.indexOf("\n", index + 1);
|
||||||
|
}
|
||||||
return new CommandRunException(CommandRunExceptionType.EXECUTION,
|
return new CommandRunException(CommandRunExceptionType.EXECUTION,
|
||||||
MessageFormat.format(
|
MessageFormat.format(
|
||||||
"The script could not complete due to command failure at line {0} ({1})", //$NON-NLS-1$
|
"The script could not complete due to command failure at line {0}\n {1})", //$NON-NLS-1$
|
||||||
Integer.valueOf(lineNo), e.getLocalizedMessage()),
|
Integer.valueOf(lineNo + 1), builder.toString()),
|
||||||
e);
|
e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user