Package com.opensymphony.xwork2.conversion

Examples of com.opensymphony.xwork2.conversion.TypeConversionException


        // najpierw RegEx
        String regEx = this.getRegEx(action);
        if (StringUtils.isNotEmpty(regEx)) {
          if (!Pattern.matches(regEx, as[0])) {
            logger.warn("convertFromString(Map, String[], Class) - " + as[0] + " nie pasuje do RegEx-a:: " + regEx);
            throw new TypeConversionException(as[0] + " nie pasuje do RegEx-a:: " + regEx);
          }
        }
       
        mask = this.getMask(action);
        DecimalFormat nf = new DecimalFormat(mask);
        Number number = nf.parse(as[0]);
        res = Double.valueOf(number.doubleValue());

        if (logger.isDebugEnabled())
          logger.debug("convertFromString(Map, String[], Class) - " + as[0] + " -> " + res);
       
      } catch (ParseException ex) {
        logger.warn("convertFromString(Map, String[], Class) - " + as[0] + ", mask: " + mask);
        throw new TypeConversionException("No nie da sie tego przekonwertowac ciolku!", ex);
      }
    }

    if (logger.isDebugEnabled()) {
      logger.debug("convertFromString(Map, String[], Class) - end - return value=" + res);
View Full Code Here


            SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
            try {
                return sdf.parse(values[0]);
            }
            catch(ParseException e) {
                throw new TypeConversionException(e);
            }
        }
        return null;
    }
View Full Code Here

      try {
        return DateLibrary.getIso8601StringAsTime(value);
      } catch (ParseException e) {
        e.printStackTrace();
        throw new TypeConversionException(e);
      }
    }
    return null;
  }
View Full Code Here

        if( toClass == Long.TYPE || toClass == Long.class)
          return d.getTime();
        return d;
      } catch (ParseException e) {
        e.printStackTrace();
        throw new TypeConversionException(e);
      }
    }
    return null;
  }
View Full Code Here

        if( toClass == Long.TYPE || toClass == Long.class)
          return d.getTime();
        return d;
      } catch (ParseException e) {
        e.printStackTrace();
        throw new TypeConversionException(e);
      }
    }
    return null;
  }
View Full Code Here

        && values[0].length() > 0) {
      try {
        return _format.parse(values[0]);
      } catch (ParseException e) {
        e.printStackTrace();
        throw new TypeConversionException(e);
      }
    }
    return null;
  }
View Full Code Here

        // Initialize ActionContext
        ConfigurationManager configurationManager = new ConfigurationManager();
        configurationManager.addContainerProvider(new XWorkConfigurationProvider());
        Configuration config = configurationManager.getConfiguration();
        Container container = config.getContainer();

        ValueStack stack = container.getInstance(ValueStackFactory.class).createValueStack();
        stack.getContext().put(ActionContext.CONTAINER, container);
        ActionContext.setContext(new ActionContext(stack.getContext()));

        ActionContext.getContext().setSession(new HashMap<String, Object>());
View Full Code Here

    public <T> T getInstance(Class<T> type) {
      try {
        T obj = type.newInstance();
        if (obj instanceof ObjectFactory) {
          ((ObjectFactory) obj).setReflectionProvider(new OgnlReflectionProvider() {

            @Override
            public void setProperties(Map<String, String> properties, Object o) {
            }
View Full Code Here

    if (messageKey == null || StringUtils.isBlank(messageKey) && StringUtils.isNotBlank(defaultValue)) {
      message = StringUtils.capitalize(defaultValue);
    }
    // the titleKey attribute is used
    else {
      OgnlValueStack stack = (OgnlValueStack) TagUtils.getStack(pageContext);
     
      for (Object o : stack.getRoot()) {
        if (o instanceof TextProvider) {
          TextProvider tp = (TextProvider) o;
          message = tp.getText(messageKey, UNDEFINED_KEY + messageKey + UNDEFINED_KEY);
          break;
        }
View Full Code Here

   */
  @Override
  public Locale resolveLocale(HttpServletRequest request) {

    Locale result = null;
    OgnlValueStack stack = (OgnlValueStack) ActionContext.getContext().getValueStack();

    for (Object o : stack.getRoot()) {
      if (o instanceof LocaleProvider) {
        LocaleProvider lp = (LocaleProvider) o;
        result = lp.getLocale();
        break;
      }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.conversion.TypeConversionException

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.