Modified tools : replaced CLIException by ClientException.
Replaced closeIfNotNull by Utils.closeSilently
Modified unit tests due to modifications in console application.
| | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.CLIException; |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ConsoleApplication; |
| | | import com.forgerock.opendj.cli.FileBasedArgument; |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | |
| | | app.readInput(LocalizableMessage.raw("Authentication ID:"), bindNameArg |
| | | .getDefaultValue() == null ? null : "dn: " |
| | | + bindNameArg.getDefaultValue()); |
| | | } catch (CLIException e) { |
| | | } catch (ClientException e) { |
| | | throw new ArgumentException(LocalizableMessage |
| | | .raw("Unable to read authentication ID"), e); |
| | | } |
| | |
| | | value = |
| | | app.readInput(LocalizableMessage.raw("Bind name:"), bindNameArg |
| | | .getDefaultValue() == null ? value : bindNameArg.getDefaultValue()); |
| | | } catch (CLIException e) { |
| | | } catch (ClientException e) { |
| | | throw new ArgumentException(LocalizableMessage.raw("Unable to read bind name"), e); |
| | | } |
| | | } |
| | |
| | | if (value.length == 0 && app.isInteractive()) { |
| | | try { |
| | | value = app.readPassword(LocalizableMessage.raw("Bind Password:")); |
| | | } catch (CLIException e) { |
| | | } catch (ClientException e) { |
| | | throw new ArgumentException(LocalizableMessage.raw("Unable to read password"), e); |
| | | } |
| | | } |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME; |
| | | import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | |
| | | } |
| | | return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue(); |
| | | } finally { |
| | | closeIfNotNull(sourceReader, targetReader, outputWriter); |
| | | closeIfNotNull(sourceInputStream, targetInputStream, outputStream); |
| | | closeSilently(sourceReader, targetReader, outputWriter); |
| | | closeSilently(sourceInputStream, targetInputStream, outputStream); |
| | | } |
| | | |
| | | return ResultCode.SUCCESS.intValue(); |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME; |
| | | import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | |
| | | import java.io.FileInputStream; |
| | | import java.io.FileNotFoundException; |
| | |
| | | } |
| | | return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue(); |
| | | } finally { |
| | | closeIfNotNull(sourceReader, changesReader, outputWriter); |
| | | closeIfNotNull(sourceInputStream, changesInputStream, outputStream); |
| | | closeSilently(sourceReader, changesReader, outputWriter); |
| | | closeSilently(sourceInputStream, changesInputStream, outputStream); |
| | | } |
| | | |
| | | return ResultCode.SUCCESS.intValue(); |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.FileInputStream; |
| | |
| | | errPrintln(LocalizableMessage.raw(e.toString())); |
| | | return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue(); |
| | | } finally { |
| | | closeIfNotNull(in); |
| | | closeSilently(in); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue(); |
| | | } finally { |
| | | closeIfNotNull(sourceReader, outputWriter); |
| | | closeIfNotNull(sourceInputStream, outputStream); |
| | | closeSilently(sourceReader, outputWriter); |
| | | closeSilently(sourceInputStream, outputStream); |
| | | } |
| | | |
| | | return ResultCode.SUCCESS.intValue(); |
| | |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; |
| | | import static com.forgerock.opendj.cli.Utils.filterExitCode; |
| | | import static org.forgerock.util.Utils.closeSilently; |
| | | |
| | | import java.io.BufferedWriter; |
| | | import java.io.File; |
| | |
| | | errPrintln(INFO_MAKELDIF_PROCESSING_COMPLETE.get(numberOfEntriesWritten)); |
| | | |
| | | } finally { |
| | | closeIfNotNull(generator, writer); |
| | | closeSilently(generator, writer); |
| | | } |
| | | |
| | | return EXIT_CODE_SUCCESS; |
| | |
| | | import org.forgerock.i18n.LocalizableMessageBuilder; |
| | | import org.forgerock.util.Reject; |
| | | |
| | | import com.forgerock.opendj.cli.CLIException; |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ConsoleApplication; |
| | | |
| | | /** |
| | |
| | | String choice; |
| | | try { |
| | | choice = app.readInput(promptMsg, defaultTrustMethod.getChoice().toString()); |
| | | } catch (final CLIException e) { |
| | | } catch (final ClientException e) { |
| | | // What can we do here? |
| | | throw new CertificateException(exception); |
| | | } finally { |
| | |
| | | |
| | | if (expectsResults) { |
| | | assertThat(out.size()).isGreaterThan(0); |
| | | assertThat(out.toString("UTF-8")).contains(wrapText(expectedErrOutput, MAX_LINE_WIDTH)); |
| | | } else { |
| | | assertThat(out.size()).isEqualTo(0); |
| | | if (makeLDIF.isInteractive()) { |
| | | assertThat(out.size()).isGreaterThan(0); |
| | | assertThat(err.size()).isEqualTo(0); |
| | | assertThat(out.toString("UTF-8")).contains(wrapText(expectedErrOutput, MAX_LINE_WIDTH)); |
| | | } else { |
| | | assertThat(out.size()).isEqualTo(0); |
| | | assertThat(err.size()).isGreaterThan(0); |
| | | assertThat(err.toString("UTF-8")).contains(wrapText(expectedErrOutput, MAX_LINE_WIDTH)); |
| | | } |
| | | } |
| | | |
| | | assertThat(err.toString("UTF-8")).contains(wrapText(expectedErrOutput, MAX_LINE_WIDTH)); |
| | | } finally { |
| | | closeSilently(outStream, errStream); |
| | | } |