Package org.springframework.expression.spel

Examples of org.springframework.expression.spel.SpelEvaluationException


            accessor.write(eContext, contextObject.getValue(), name, newValue);
            return;
          }
        }
      } catch (AccessException ae) {
        throw new SpelEvaluationException(getStartPosition(), ae, SpelMessage.EXCEPTION_DURING_PROPERTY_WRITE,
            name, ae.getMessage());
      }
    }
    if (contextObject.getValue()==null) {
      throw new SpelEvaluationException(getStartPosition(),SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE_ON_NULL, name);
    } else {
      throw new SpelEvaluationException(getStartPosition(),SpelMessage.PROPERTY_OR_FIELD_NOT_WRITABLE, name, FormatHelper
          .formatClassNameForMessage(contextObjectClass));
    }
  }
View Full Code Here


    try {
      this.cachedExecutor = executorToUse;
      TypedValue result = executorToUse.execute(state.getEvaluationContext(), arguments);
      return result;
    } catch (AccessException ae) {
      throw new SpelEvaluationException(getStartPosition(), ae, SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM, typename,
          FormatHelper.formatMethodForMessage("", argumentTypes));

    }
  }
View Full Code Here

              argumentTypes);
          if (cEx != null) {
            return cEx;
          }
        } catch (AccessException ex) {
          throw new SpelEvaluationException(getStartPosition(),ex, SpelMessage.CONSTRUCTOR_INVOCATION_PROBLEM, typename,
              FormatHelper.formatMethodForMessage("", argumentTypes));
        }
      }
    }
    throw new SpelEvaluationException(getStartPosition(),SpelMessage.CONSTRUCTOR_NOT_FOUND, typename, FormatHelper.formatMethodForMessage("",
        argumentTypes));
  }
View Full Code Here

  public Object convertValue(Object value, TypeDescriptor typeDescriptor) throws EvaluationException {
    try {
      return this.conversionService.convert(value, TypeDescriptor.forObject(value), typeDescriptor);
    }
    catch (ConverterNotFoundException cenfe) {
      throw new SpelEvaluationException(cenfe, SpelMessage.TYPE_CONVERSION_ERROR,
          (value != null ? value.getClass() : null), typeDescriptor.asString());
    }
    catch (ConversionException ce) {
      throw new SpelEvaluationException(ce, SpelMessage.TYPE_CONVERSION_ERROR,
          (value != null ? value.getClass() : null), typeDescriptor.asString());
    }
  }
View Full Code Here

      if (closeMatch != null) {
        return new ReflectiveMethodExecutor(closeMatch, null);
      }
      else if (matchRequiringConversion != null) {
        if (multipleOptions) {
          throw new SpelEvaluationException(SpelMessage.MULTIPLE_POSSIBLE_METHODS, name);
        }
        return new ReflectiveMethodExecutor(matchRequiringConversion, argsToConvert);
      }
      else {
        return null;
View Full Code Here

        targetType = parameterTypes[i];
      }
      try {
        if (arguments[i] != null && arguments[i].getClass() != targetType) {
          if (converter == null) {
            throw new SpelEvaluationException(SpelMessage.TYPE_CONVERSION_ERROR, arguments[i].getClass().getName(),targetType);
          }
          arguments[i] = converter.convertValue(arguments[i], TypeDescriptor.valueOf(targetType));
        }
      }
      catch (EvaluationException ex) {
        // allows for another type converter throwing a different kind of EvaluationException
        if (ex instanceof SpelEvaluationException) {
          throw (SpelEvaluationException)ex;
        }
        else {
          throw new SpelEvaluationException(ex, SpelMessage.TYPE_CONVERSION_ERROR,arguments[i].getClass().getName(),targetType);
        }
      }
    }
  }
View Full Code Here

    } else {
      if (operand==null) {
        if (nullSafe) {
          return TypedValue.NULL;
        } else {         
          throw new SpelEvaluationException(getStartPosition(),SpelMessage.PROJECTION_NOT_SUPPORTED_ON_TYPE, "null");
        }
      } else {
        throw new SpelEvaluationException(getStartPosition(),SpelMessage.PROJECTION_NOT_SUPPORTED_ON_TYPE, operand.getClass().getName());
      }
    }
  }
View Full Code Here

      }
      catch (ClassNotFoundException ex) {
        // might be a different prefix
      }
    }
    throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typename);
  }
View Full Code Here

  public Object convertValue(Object value, TypeDescriptor sourceType, TypeDescriptor targetType) {
    try {
      return this.conversionService.convert(value, sourceType, targetType);
    }
    catch (ConverterNotFoundException cenfe) {
      throw new SpelEvaluationException(cenfe, SpelMessage.TYPE_CONVERSION_ERROR,
          sourceType.toString(), targetType.asString());
    }
    catch (ConversionException ce) {
      throw new SpelEvaluationException(ce, SpelMessage.TYPE_CONVERSION_ERROR,
          sourceType.toString(), targetType.asString());
    }
  }
View Full Code Here

      if (closeMatch != null) {
        return new ReflectiveMethodExecutor(closeMatch, null);
      }
      else if (matchRequiringConversion != null) {
        if (multipleOptions) {
          throw new SpelEvaluationException(SpelMessage.MULTIPLE_POSSIBLE_METHODS, name);
        }
        return new ReflectiveMethodExecutor(matchRequiringConversion, argsToConvert);
      }
      else {
        return null;
View Full Code Here

TOP

Related Classes of org.springframework.expression.spel.SpelEvaluationException

Copyright © 2018 www.massapicom. 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.