Skip to content

Commit

Permalink
Don't call System.exit() in a launcher step; throw something instead.
Browse files Browse the repository at this point in the history
At least don't use exit() for a normal completion.  That prevents
streaming multiple commands.
  • Loading branch information
mwoodiupui committed Feb 6, 2013
1 parent 3acfcab commit dfafcf6
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions dspace-api/src/main/java/org/dspace/eperson/EPerson.java
Expand Up @@ -1228,24 +1228,12 @@ public void updateLastModified()
* Tool for manipulating user accounts.
*/
public static void main(String argv[])
throws ParseException, SQLException
{
final PosixParser parser = new PosixParser();
CommandLine command = null;
CommandLine command = parser.parse(globalOptions, argv, true);

try {
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);
}
Context context = new Context();

// Disable authorization since this only runs from the local commandline.
context.turnOffAuthorisationSystem();
Expand Down Expand Up @@ -1277,6 +1265,7 @@ else if (command.hasOption('h'))
new HelpFormatter().printHelp("user [options]", globalOptions);
context.abort();
status = 1;
throw new IllegalArgumentException();
}

if (context.isValid())
Expand All @@ -1287,8 +1276,6 @@ else if (command.hasOption('h'))
System.err.println(ex.getMessage());
}
}

System.exit(status);
}

/** Command to create an EPerson. */
Expand Down

0 comments on commit dfafcf6

Please sign in to comment.