mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-16 22:43:12 +00:00
Don't call System.exit() in a launcher step; throw something instead.
At least don't use exit() for a normal completion. That prevents streaming multiple commands.
This commit is contained in:
@@ -1228,24 +1228,12 @@ public class EPerson extends DSpaceObject
|
|||||||
* Tool for manipulating user accounts.
|
* Tool for manipulating user accounts.
|
||||||
*/
|
*/
|
||||||
public static void main(String argv[])
|
public static void main(String argv[])
|
||||||
|
throws ParseException, SQLException
|
||||||
{
|
{
|
||||||
final PosixParser parser = new PosixParser();
|
final PosixParser parser = new PosixParser();
|
||||||
CommandLine command = null;
|
CommandLine command = parser.parse(globalOptions, argv, true);
|
||||||
|
|
||||||
try {
|
Context context = new Context();
|
||||||
command = parser.parse(globalOptions, argv, true);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
System.err.println(e.getMessage());
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
Context context = null;
|
|
||||||
try {
|
|
||||||
context = new Context();
|
|
||||||
} catch (SQLException ex) {
|
|
||||||
System.err.println(ex.getMessage());
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable authorization since this only runs from the local commandline.
|
// Disable authorization since this only runs from the local commandline.
|
||||||
context.turnOffAuthorisationSystem();
|
context.turnOffAuthorisationSystem();
|
||||||
@@ -1277,6 +1265,7 @@ public class EPerson extends DSpaceObject
|
|||||||
new HelpFormatter().printHelp("user [options]", globalOptions);
|
new HelpFormatter().printHelp("user [options]", globalOptions);
|
||||||
context.abort();
|
context.abort();
|
||||||
status = 1;
|
status = 1;
|
||||||
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.isValid())
|
if (context.isValid())
|
||||||
@@ -1287,8 +1276,6 @@ public class EPerson extends DSpaceObject
|
|||||||
System.err.println(ex.getMessage());
|
System.err.println(ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.exit(status);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Command to create an EPerson. */
|
/** Command to create an EPerson. */
|
||||||
|
Reference in New Issue
Block a user