Examples of TypeMismatchException


Examples of org.hibernate.TypeMismatchException

      // an instance of Element...
    }
    else {
      Class idClass = persister.getIdentifierType().getReturnedClass();
      if ( idClass != null && ! idClass.isInstance( event.getEntityId() ) ) {
        throw new TypeMismatchException(
            "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
        );
      }
    }
View Full Code Here

Examples of org.hibernate.TypeMismatchException

                return;
              }
            }
          }
        }
        throw new TypeMismatchException(
            "Provided id of the wrong type for class " + persister.getEntityName() + ". Expected: " + idClass + ", got " + event.getEntityId().getClass()
        );
      }
    }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

        try {
            result = AttributableUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Attributable not supported: " + kind);

            throw new TypeMismatchException(kind, AttributableUtil.class, e);
        }

        return result;
    }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

        try {
            result = TaskUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Task not supported: " + kind);

            throw new TypeMismatchException(kind, TaskUtil.class, e);
        }

        return result;
    }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

                                        : null;

        if (result == null) {
            LOG.error("Task not supported: " + task.getClass().getName());

            throw new TypeMismatchException(task.getClass().getName(), TaskUtil.class);
        }

        return result;
    }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

                                : null;

        if (result == null) {
            LOG.error("Task not supported: " + taskTO.getClass().getName());

            throw new TypeMismatchException(taskTO.getClass().getName(), TaskUtil.class);
        }

        return result;
    }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

      if (value instanceof String && Float.class.isAssignableFrom(requiredType)) {
        try {
          return new Float(this.numberFormat.parse((String) value).floatValue());
        }
        catch (ParseException ex) {
          throw new TypeMismatchException(value, requiredType, ex);
        }
      }
      else if (value instanceof String && int.class.isAssignableFrom(requiredType)) {
        return new Integer(5);
      }
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

  protected Object readFromSource(Class<?> clazz, HttpHeaders headers, Source source) throws IOException {
    Assert.notNull(this.unmarshaller, "Property 'unmarshaller' is required");
    try {
      Object result = this.unmarshaller.unmarshal(source);
      if (!clazz.isInstance(result)) {
        throw new TypeMismatchException(result, clazz);
      }
      return result;
    }
    catch (UnmarshallingFailureException ex) {
      throw new HttpMessageNotReadableException("Could not read [" + clazz + "]", ex);
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

  }

  public void testGetMessageCodeForException() {
    DefaultBindingErrorMessageProvider provider = new DefaultBindingErrorMessageProvider();

    assertEquals("typeMismatch", provider.getMessageCodeForException(new TypeMismatchException(new Object(),
        String.class)));
    assertEquals("required", provider.getMessageCodeForException(new NullPointerException()));
    assertEquals("typeMismatch", provider.getMessageCodeForException(new InvalidFormatException("", "")));
    assertEquals("typeMismatch", provider.getMessageCodeForException(new IllegalArgumentException()));
    assertEquals("required", provider.getMessageCodeForException(new RuntimeException(new NullPointerException())));
View Full Code Here

Examples of org.springframework.beans.TypeMismatchException

        try {
            result = AttributableUtil.valueOf(kind.toUpperCase());
        } catch (Exception e) {
            LOG.error("Attributable not supported: " + kind);

            throw new TypeMismatchException(kind, AttributableUtil.class, e);
        }

        return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.