@Override public int run(String[] argv) throws Exception { try { return runCmd(argv); } catch (IllegalArgumentException iae) { errOut.println("Illegal argument: " + iae.getLocalizedMessage()); return -1; } catch (IOException ioe) { errOut.println("Operation failed: " + ioe.getLocalizedMessage()); if (LOG.isDebugEnabled()) { LOG.debug("Operation failed", ioe); } return -1; } }
/** * Get the enum value for the string parameter. * * @param flag parameter describing the desired enum value * @return the flag representing the parameter value * * @throws IllegalArgumentException when there is no such value in the enum */ public static AuthControlFlag get(String flag) throws IllegalArgumentException { try { return AuthControlFlag.valueOf(flag.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { // flag does not exist -> add some more info about which flags do exist throw new IllegalArgumentException( String.format("No control flag \"%s\", available flags are [%s]. %s", flag, Arrays.asList(AuthControlFlag.values()) .stream() .map(AuthControlFlag::toString) .collect(Collectors.joining(", ")), ex.getLocalizedMessage()), ex); } } }
/** * @param args Command line arguments */ public static void main(String[] args) { boolean result = false; try { JstormOnYarn client = new JstormOnYarn(); LOG.info("Initializing Client"); try { boolean doRun = client.init(args); if (!doRun) { System.exit(JOYConstants.EXIT_SUCCESS); } } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); client.printUsage(); System.exit(JOYConstants.EXIT_FAIL); } result = client.run(); } catch (Throwable t) { LOG.fatal("Error running Client", t); System.exit(JOYConstants.EXIT_FAIL); } if (result) { LOG.info("Application completed successfully"); System.exit(JOYConstants.EXIT_SUCCESS); } LOG.error("Application failed to complete successfully"); System.exit(JOYConstants.EXIT_FAIL); }
/** * Adds a URL-valued attribute. * @param attr the attribute name * @param value the attribute value, e.g. {@code "/my/module/resource.html"} * or {@code "nbresloc:/my/module/resource.html"}; relative values permitted * but not likely useful as base URL would be e.g. {@code "jar:...!/META-INF/"} * @return this builder * @throws LayerGenerationException in case {@code value} cannot be parsed as a URI or is opaque */ public File urlvalue(String attr, String value) throws LayerGenerationException { try { return urlvalue(attr, URI.create(value)); } catch (IllegalArgumentException x) { throw new LayerGenerationException(x.getLocalizedMessage(), originatingElement); } }
throw new AssertionError(e.getLocalizedMessage());
logger.error("Encountered an error decoding Base64 for " + keyId + ": " + e.getLocalizedMessage()); } catch (BadPaddingException | IllegalBlockSizeException e) { logger.error("Encountered an error decrypting key for " + keyId + ": " + e.getLocalizedMessage());
} catch (IllegalArgumentException e) { Assert.assertTrue(false, "Illegal argument trying to set field " + e.getLocalizedMessage()); } catch (InvocationTargetException e) { Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());
logger.log(POILogger.INFO, "Format not supported yet", e.getLocalizedMessage()); } catch (XmlException | OpenXML4JException e) { throw new IOException(e.getMessage(), e);
} catch (IllegalArgumentException e) { Assert.assertTrue(false, "Illegal argument trying to set field " + e.getLocalizedMessage()); } catch (InvocationTargetException e) { Assert.assertTrue(false, "Failed trying to invoke method " + e.getLocalizedMessage());
return response; } catch (IllegalArgumentException e) { response.setFatalError(e.getLocalizedMessage()); return response;
return response; } catch (IllegalArgumentException e) { response.setFatalError(e.getLocalizedMessage()); return response;
String indexNotFoundMessage = String.format("Lucene index %s was not found in region %s", this.indexName, fullRegionPath); if (!e.getLocalizedMessage().equals(indexNotFoundMessage)) { throw e;
return response; } catch (IllegalArgumentException e) { response.setFatalError(e.getLocalizedMessage()); return response;
return def; } catch (IllegalArgumentException e) { throw new BlenderFileException(e.getLocalizedMessage(), e); } catch (SecurityException e) { throw new BlenderFileException(e.getLocalizedMessage(), e);
e.printStackTrace(System.err); } else { displayError(cmd, e.getLocalizedMessage());
return response; } catch (IllegalArgumentException e) { response.setFatalError(e.getLocalizedMessage()); return response;
@Override public ValidationResult validate(final String subject, final String input, final ValidationContext context) { final String value = context.newPropertyValue(input).evaluateAttributeExpressions().getValue(); try { SiteToSiteRestApiClient.parseClusterUrls(value); return new ValidationResult.Builder() .input(input) .subject(subject) .valid(true) .build(); } catch (IllegalArgumentException ex) { return new ValidationResult.Builder() .input(input) .subject(subject) .valid(false) .explanation(ex.getLocalizedMessage()) .build(); } } }
private void updateButtonAccessibleDescription() { assert SwingUtilities.isEventDispatchThread() : "Call only in AWT queue."; String stepName = ((contentData != null) && (contentSelectedIndex > 0) && ((contentSelectedIndex - 1) < contentData.length)) ? contentData[contentSelectedIndex - 1] : ""; // NOI18N try { previousButton.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(WizardDescriptor.class, "ACSD_PREVIOUS", new Integer(contentSelectedIndex), stepName) ); } catch (IllegalArgumentException iae) { err.log (Level.INFO, iae.getLocalizedMessage() + " while setting ACSD_PREVIOUS with params " + stepName + ", " + contentSelectedIndex, iae); // NOI18N } stepName = ((contentData != null) && (contentSelectedIndex < (contentData.length - 1)) && ((contentSelectedIndex + 1) >= 0)) ? contentData[contentSelectedIndex + 1] : ""; // NOI18N try { nextButton.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(WizardDescriptor.class, "ACSD_NEXT", new Integer(contentSelectedIndex + 2), stepName) ); } catch (IllegalArgumentException iae) { err.log (Level.INFO, iae.getLocalizedMessage() + " while setting ACSD_NEXT with params " + stepName + ", " + (contentSelectedIndex + 2), iae); // NOI18N } }
/** * @param args Command line arguments */ public static void main(String[] args) { boolean result = false; try { Client client = new Client(); LOG.info("Initializing Client"); try { boolean doRun = client.init(args); if (!doRun) { System.exit(0); } } catch (IllegalArgumentException e) { System.err.println(e.getLocalizedMessage()); System.exit(-1); } result = client.run(); } catch (Throwable t) { LOG.fatal("Error running Client", t); System.exit(1); } if (result) { LOG.info("Application completed successfully"); System.exit(0); } LOG.error("Application failed to complete successfully"); System.exit(2); }
return null; } catch (IllegalArgumentException e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); throw new FactoryException(e.getLocalizedMessage(), e); } finally { try {