java.lang.IllegalArgumentException.getLocalizedMessage()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(297)

本文整理了Java中java.lang.IllegalArgumentException.getLocalizedMessage()方法的一些代码示例,展示了IllegalArgumentException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalArgumentException.getLocalizedMessage()方法的具体详情如下:
包路径:java.lang.IllegalArgumentException
类名称:IllegalArgumentException
方法名:getLocalizedMessage

IllegalArgumentException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

@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;
 }
}

代码示例来源:origin: oracle/opengrok

/**
   * 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);
    }
  }
}

代码示例来源:origin: alibaba/jstorm

/**
 * @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);
}

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

/**
 * 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);
  }
}

代码示例来源:origin: goldmansachs/gs-collections

throw new AssertionError(e.getLocalizedMessage());

代码示例来源:origin: apache/nifi

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());

代码示例来源:origin: apache/geode

} 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());

代码示例来源:origin: org.apache.poi/poi-ooxml

logger.log(POILogger.INFO, "Format not supported yet", e.getLocalizedMessage());
} catch (XmlException | OpenXML4JException e) {
  throw new IOException(e.getMessage(), e);

代码示例来源:origin: apache/geode

} 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());

代码示例来源:origin: Alluxio/alluxio

return response;
} catch (IllegalArgumentException e) {
 response.setFatalError(e.getLocalizedMessage());
 return response;

代码示例来源:origin: Alluxio/alluxio

return response;
} catch (IllegalArgumentException e) {
 response.setFatalError(e.getLocalizedMessage());
 return response;

代码示例来源:origin: apache/geode

String indexNotFoundMessage = String.format("Lucene index %s was not found in region %s",
  this.indexName, fullRegionPath);
if (!e.getLocalizedMessage().equals(indexNotFoundMessage)) {
 throw e;

代码示例来源:origin: Alluxio/alluxio

return response;
} catch (IllegalArgumentException e) {
 response.setFatalError(e.getLocalizedMessage());
 return response;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

return def;
} catch (IllegalArgumentException e) {
  throw new BlenderFileException(e.getLocalizedMessage(), e);
} catch (SecurityException e) {
  throw new BlenderFileException(e.getLocalizedMessage(), e);

代码示例来源:origin: org.apache.hadoop/hadoop-common

e.printStackTrace(System.err);
} else {
 displayError(cmd, e.getLocalizedMessage());

代码示例来源:origin: Alluxio/alluxio

return response;
} catch (IllegalArgumentException e) {
 response.setFatalError(e.getLocalizedMessage());
 return response;

代码示例来源:origin: apache/nifi

@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();
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

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
  }
}

代码示例来源:origin: apache/metron

/**
 * @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);
}

代码示例来源:origin: geotools/geotools

return null;
} catch (IllegalArgumentException e) {
  LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
  throw new FactoryException(e.getLocalizedMessage(), e);
} finally {
  try {

相关文章