com.google.inject.spi.Message.getMessage()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(145)

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

Message.getMessage介绍

[英]Gets the error message text.
[中]获取错误消息文本。

代码示例

代码示例来源:origin: com.google.inject/guice

/** Prepends the list of sources to the given {@link Message} */
static Message mergeSources(List<Object> sources, Message message) {
 List<Object> messageSources = message.getSources();
 // It is possible that the end of getSources() and the beginning of message.getSources() are
 // equivalent, in this case we should drop the repeated source when joining the lists.  The
 // most likely scenario where this would happen is when a scoped binding throws an exception,
 // due to the fact that InternalFactoryToProviderAdapter applies the binding source when
 // merging errors.
 if (!sources.isEmpty()
   && !messageSources.isEmpty()
   && Objects.equal(messageSources.get(0), sources.get(sources.size() - 1))) {
  messageSources = messageSources.subList(1, messageSources.size());
 }
 return new Message(
   ImmutableList.builder().addAll(sources).addAll(messageSources).build(),
   message.getMessage(),
   message.getCause());
}

代码示例来源:origin: Graylog2/graylog2-server

protected void annotateInjectorExceptions(Collection<Message> messages) {
  for (Message message : messages) {
    //noinspection ThrowableResultOfMethodCallIgnored
    final Throwable rootCause = ExceptionUtils.getRootCause(message.getCause());
    if (rootCause instanceof NodeIdPersistenceException) {
      LOG.error(UI.wallString(
          "Unable to read or persist your NodeId file. This means your node id file (" + configuration.getNodeIdFile() + ") is not readable or writable by the current user. The following exception might give more information: " + message));
      System.exit(-1);
    } else if (rootCause instanceof AccessDeniedException) {
      LOG.error(UI.wallString("Unable to access file " + rootCause.getMessage()));
      System.exit(-2);
    } else {
      // other guice error, still print the raw messages
      // TODO this could potentially print duplicate messages depending on what a subclass does...
      LOG.error("Guice error (more detail on log level debug): {}", message.getMessage());
      if (rootCause != null) {
        LOG.debug("Stacktrace:", rootCause);
      }
    }
  }
}

代码示例来源:origin: com.google.inject/guice

for (Message errorMessage : errorMessages) {
 int thisIdx = index++;
 fmt.format("%s) %s%n", thisIdx, errorMessage.getMessage());

代码示例来源:origin: com.google.inject/guice

fmt.format("Encountered circular dependency spanning several threads.");
if (proxyCreationError != null) {
 fmt.format(" %s", proxyCreationError.getMessage());

代码示例来源:origin: torodb/stampede

LOGGER.error(m.getCause().getMessage());
} else {
 LOGGER.error(m.getMessage());

代码示例来源:origin: com.proofpoint.platform/configuration

@Override
public String toString()
{
  StringBuilder builder = new StringBuilder();
  for (Message error : errors) {
    builder.append(error.getMessage()).append('\n');
  }
  for (Message warning : warnings) {
    builder.append(warning.getMessage()).append('\n');
  }
  return builder.toString();
}

代码示例来源:origin: com.teradata.airlift/configuration

public String toString()
{
  StringBuilder builder = new StringBuilder();
  for (Message error : errors) {
    builder.append(error.getMessage()).append('\n');
  }
  for (Message warning : warnings) {
    builder.append(warning.getMessage()).append('\n');
  }
  return builder.toString();
}

代码示例来源:origin: io.airlift/configuration

public String toString()
{
  StringBuilder builder = new StringBuilder();
  for (Message error : errors) {
    builder.append(error.getMessage()).append('\n');
  }
  for (Message warning : warnings) {
    builder.append(warning.getMessage()).append('\n');
  }
  return builder.toString();
}

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

public String toString()
{
  StringBuilder builder = new StringBuilder();
  for (Message error : errors) {
    builder.append(error.getMessage()).append('\n');
  }
  for (Message warning : warnings) {
    builder.append(warning.getMessage()).append('\n');
  }
  return builder.toString();
}

代码示例来源:origin: com.proofpoint.platform/configuration

@Override
  public void onWarning(Message warningMessage)
  {
    warningsMonitor.onWarning(warningMessage.getMessage());
  }
};

代码示例来源:origin: com.proofpoint.platform/configuration

@Override
  public void onWarning(Message warningMessage)
  {
    problems.addWarning("Configuration setter method [%s] Map value type %s: %s",
        method.toGenericString(),
        valueClass.getSimpleName(),
        warningMessage.getMessage());
  }
});

代码示例来源:origin: com.google.code.guice/guice

private static String createErrorMessage(Collection<Message> errorMessages) {
 Formatter fmt = new Formatter().format("Guice configuration errors:%n%n");
 int index = 1;
 for (Message errorMessage : errorMessages) {
  fmt.format("%s) Error at %s:%n", index++, errorMessage.getSourceString())
    .format(" %s%n%n", errorMessage.getMessage());
 }
 return fmt.format("%s error[s]", errorMessages.size()).toString();
}

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

public void onError(Message error)
{
  result = result + "E-" + error.getMessage() + ", ";
}

代码示例来源:origin: org.xbib/guice

private Message merge(Message message) {
  List<Object> sources = Lists.newArrayList();
  sources.addAll(getSources());
  sources.addAll(message.getSources());
  return new Message(sources, message.getMessage(), message.getCause());
}

代码示例来源:origin: com.teradata.airlift/configuration

private String messageListAsString(List<Message> list)
{
  StringBuilder builder = new StringBuilder();
  for (Message message : list) {
    builder.append(message.getMessage()).append(", ");
  }
  return builder.toString();
}

代码示例来源:origin: io.airlift/configuration

private String messageListAsString(List<Message> list)
  {
    StringBuilder builder = new StringBuilder();
    for (Message message : list) {
      builder.append(message.getMessage()).append(", ");
    }
    return builder.toString();
  }
}

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

private String messageListAsString(List<Message> list)
  {
    StringBuilder builder = new StringBuilder();
    for (Message message : list) {
      builder.append(message.getMessage()).append(", ");
    }
    return builder.toString();
  }
}

代码示例来源:origin: com.google/inject

private Message merge(Message message) {
 List<Object> sources = Lists.newArrayList();
 sources.addAll(getSources());
 sources.addAll(message.getSources());
 return new Message(sources, message.getMessage(), message.getCause());
}

代码示例来源:origin: Nextdoor/bender

private Message merge(Message message) {
 List<Object> sources = Lists.newArrayList();
 sources.addAll(getSources());
 sources.addAll(message.getSources());
 return new Message(sources, message.getMessage(), message.getCause());
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.inject

private Message merge(Message message) {
 List<Object> sources = Lists.newArrayList();
 sources.addAll(getSources());
 sources.addAll(message.getSources());
 return new Message(sources, message.getMessage(), message.getCause());
}

相关文章