Tabnine Logo
RuntimeException.getMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
getMessage
method
in
java.lang.RuntimeException

Best Java code snippets using java.lang.RuntimeException.getMessage (Showing top 20 results out of 19,449)

origin: spring-projects/spring-framework

/**
 * Return the exception simple message without including the expression
 * that caused the failure.
 * @since 4.0
 */
public String getSimpleMessage() {
  return super.getMessage();
}
origin: spring-projects/spring-framework

public JpaSystemException(RuntimeException ex) {
  super(ex.getMessage(), ex);
}
origin: org.apache.commons/commons-lang3

/**
 * Provides the message explaining the exception without the contextual data.
 *
 * @see java.lang.Throwable#getMessage()
 * @return the message
 * @since 3.0.1
 */
public String getRawMessage() {
  return super.getMessage();
}
origin: org.apache.commons/commons-lang3

/**
 * Provides the message explaining the exception, including the contextual data.
 *
 * @see java.lang.Throwable#getMessage()
 * @return the message, never null
 */
@Override
public String getMessage(){
  return getFormattedExceptionMessage(super.getMessage());
}
origin: spring-projects/spring-framework

/**
 * Return the detail message, including the message from the nested exception
 * if there is one.
 */
@Override
@Nullable
public String getMessage() {
  return NestedExceptionUtils.buildMessage(super.getMessage(), getCause());
}
origin: apache/incubator-dubbo

  void serialize(AbstractHessianOutput out, Object obj, Field field)
      throws IOException {
    Object value = null;
    try {
      value = field.get(obj);
    } catch (IllegalAccessException e) {
      log.log(Level.FINE, e.toString(), e);
    }
    try {
      out.writeObject(value);
    } catch (RuntimeException e) {
      throw new RuntimeException(e.getMessage() + "\n Java field: " + field,
          e);
    } catch (IOException e) {
      throw new IOExceptionWrapper(e.getMessage() + "\n Java field: " + field,
          e);
    }
  }
}
origin: spring-projects/spring-framework

  @Override
  public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
    if (ex instanceof PersistenceException) {
      return new DataAccessResourceFailureException(ex.getMessage());
    }
    return null;
  }
}
origin: apache/incubator-dubbo

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
  try {
    return invoker.invoke(invocation);
  } catch (RuntimeException e) {
    logger.error("Got unchecked and undeclared exception which called by " + RpcContext.getContext().getRemoteHost()
        + ". service: " + invoker.getInterface().getName() + ", method: " + invocation.getMethodName()
        + ", exception: " + e.getClass().getName() + ": " + e.getMessage(), e);
    throw e;
  }
}
origin: apache/incubator-dubbo

@Override
public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
  try {
    return invoker.invoke(invocation);
  } catch (RuntimeException e) {
    logger.error("Got unchecked and undeclared exception which called by " + RpcContext.getContext().getRemoteHost()
        + ". service: " + invoker.getInterface().getName() + ", method: " + invocation.getMethodName()
        + ", exception: " + e.getClass().getName() + ": " + e.getMessage(), e);
    throw e;
  }
}
origin: libgdx/libgdx

public String getMessage () {
  if (trace == null) return super.getMessage();
  StringBuilder sb = new StringBuilder(512);
  sb.append(super.getMessage());
  if (sb.length() > 0) sb.append('\n');
  sb.append("Serialization trace:");
  sb.append(trace);
  return sb.toString();
}
origin: libgdx/libgdx

public String getMessage () {
  if (trace == null) return super.getMessage();
  StringBuilder sb = new StringBuilder(512);
  sb.append(super.getMessage());
  if (sb.length() > 0) sb.append('\n');
  sb.append("Serialization trace:");
  sb.append(trace);
  return sb.toString();
}
origin: spring-projects/spring-framework

@Test
public void testServiceIsAdvised() {
  ClassPathXmlApplicationContext ctx =
    new ClassPathXmlApplicationContext(getClass().getSimpleName() + ".xml", getClass());
  service = (Service) ctx.getBean("service");
  try {
    this.service.serveMe();
    fail("service operation has not been advised by transaction interceptor");
  }
  catch (RuntimeException ex) {
    assertEquals("advice invoked",ex.getMessage());
  }
}
origin: prestodb/presto

public void assertFails(@Language("SQL") String sql, @Language("RegExp") String expectedMessageRegExp)
{
  try {
    runner.execute(runner.getDefaultSession(), sql).toTestTypes();
    fail(format("Expected query to fail: %s", sql));
  }
  catch (RuntimeException exception) {
    if (!nullToEmpty(exception.getMessage()).matches(expectedMessageRegExp)) {
      fail(format("Expected exception message '%s' to match '%s' for query: %s", exception.getMessage(), expectedMessageRegExp, sql), exception);
    }
  }
}
origin: prestodb/presto

  private static void assertCreateConnectorFails(String metastoreUri, String exceptionString)
  {
    try {
      assertCreateConnector(metastoreUri);
      fail("expected connector creation to fail:" + metastoreUri);
    }
    catch (RuntimeException e) {
      assertContains(e.getMessage(), exceptionString);
    }
  }
}
origin: spring-projects/spring-framework

public void testUncheckedThrowable(CacheableService<?> service) throws Exception {
  try {
    service.throwUnchecked(1L);
    fail("Excepted exception");
  }
  catch (RuntimeException ex) {
    assertEquals("Wrong exception type", UnsupportedOperationException.class, ex.getClass());
    assertEquals("1", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

public void testUncheckedThrowableSync(CacheableService<?> service) throws Exception {
  try {
    service.throwUncheckedSync(1L);
    fail("Excepted exception");
  }
  catch (RuntimeException ex) {
    assertEquals("Wrong exception type", UnsupportedOperationException.class, ex.getClass());
    assertEquals("1", ex.getMessage());
  }
}
origin: spring-projects/spring-framework

protected void assertException(
    Method method, String pointcut, String returning, String throwing, Class<?> exceptionType, String message) {
  AspectJAdviceParameterNameDiscoverer discoverer = new AspectJAdviceParameterNameDiscoverer(pointcut);
  discoverer.setRaiseExceptions(true);
  discoverer.setReturningName(returning);
  discoverer.setThrowingName(throwing);
  try {
    discoverer.getParameterNames(method);
    fail("Expecting " + exceptionType.getName() + " with message '" + message + "'");
  }
  catch (RuntimeException expected) {
    assertEquals("Expecting exception of type " + exceptionType.getName(),
        exceptionType, expected.getClass());
    assertEquals("Exception message does not match expected", message, expected.getMessage());
  }
}
origin: spring-projects/spring-framework

@Test
public void testGroovyBeanInterface() {
  context = new GenericXmlApplicationContext(getClass(), getClass().getSimpleName()+"-groovy-interface-context.xml");
  TestService bean = context.getBean("groovyBean", TestService.class);
  LogUserAdvice logAdvice = context.getBean(LogUserAdvice.class);
  assertEquals(0, logAdvice.getCountThrows());
  try {
    bean.sayHello();
    fail("Expected exception");
  }
  catch (RuntimeException ex) {
    assertEquals("GroovyServiceImpl", ex.getMessage());
  }
  assertEquals(1, logAdvice.getCountThrows());
}
origin: spring-projects/spring-framework

@Test
public void testJavaBean() {
  context = new GenericXmlApplicationContext(getClass(), getClass().getSimpleName()+"-java-context.xml");
  TestService bean = context.getBean("javaBean", TestService.class);
  LogUserAdvice logAdvice = context.getBean(LogUserAdvice.class);
  assertEquals(0, logAdvice.getCountThrows());
  try {
    bean.sayHello();
    fail("Expected exception");
  }
  catch (RuntimeException ex) {
    assertEquals("TestServiceImpl", ex.getMessage());
  }
  assertEquals(1, logAdvice.getCountThrows());
}
origin: spring-projects/spring-framework

@Test
public void testGroovyBeanDynamic() {
  context = new GenericXmlApplicationContext(getClass(), getClass().getSimpleName()+"-groovy-dynamic-context.xml");
  TestService bean = context.getBean("groovyBean", TestService.class);
  LogUserAdvice logAdvice = context.getBean(LogUserAdvice.class);
  assertEquals(0, logAdvice.getCountThrows());
  try {
    bean.sayHello();
    fail("Expected exception");
  }
  catch (RuntimeException ex) {
    assertEquals("GroovyServiceImpl", ex.getMessage());
  }
  // No proxy here because the pointcut only applies to the concrete class, not the interface
  assertEquals(0, logAdvice.getCountThrows());
  assertEquals(0, logAdvice.getCountBefore());
}
java.langRuntimeExceptiongetMessage

Popular methods of RuntimeException

  • <init>
  • printStackTrace
  • getCause
  • toString
  • getStackTrace
  • initCause
  • setStackTrace
  • getLocalizedMessage
  • fillInStackTrace
  • addSuppressed
  • getSuppressed
  • getSuppressed

Popular in Java

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Random (java.util)
    This class provides methods that return pseudo-random values.It is dangerous to seed Random with the
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now