Examples of TypeConversionException


Examples of com.opensymphony.xwork.util.TypeConversionException

      if(pt != null){
        pm.setPoint(pt);
      }         
      return pm;
    }
    throw new TypeConversionException("can't convert from string to PointMarker");
  }
View Full Code Here

Examples of com.opensymphony.xwork2.conversion.TypeConversionException

        }

        try {
            return DateUtil.convertStringToDate(value[0]);
        } catch (ParseException pe) {
            throw new TypeConversionException(pe.getMessage(), pe);
        }
    }
View Full Code Here

Examples of com.opensymphony.xwork2.conversion.TypeConversionException

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

Examples of com.opensymphony.xwork2.conversion.TypeConversionException

    DateFormat df = new SimpleDateFormat(dateFormat);
    try {
      return df.parse(values[0]);
    } catch (ParseException e) {
      e.printStackTrace();
      throw new TypeConversionException(values[0] + " is not one valid date.");
    }   
  }
View Full Code Here

Examples of com.opensymphony.xwork2.conversion.TypeConversionException

  }

  @SuppressWarnings("unchecked")
  @Override
  public String convertToString(Map context, Object o) {
    if(!(o instanceof Date)) throw new TypeConversionException();
    String dateFormat = LoxiaSupportSettings.getInstance().get(LoxiaSupportConstants.DATE_PATTERN);
    DateFormat df = new SimpleDateFormat(dateFormat);
    return df.format((Date)o);
  }
View Full Code Here

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);
        DateFormat df = new SimpleDateFormat(mask);
        res = df.parse(as[0]);

        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

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

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() - [{}] doesn't match RegEx [{}]", as[0], regEx);
            throw new TypeConversionException(as[0] + " doesn't match RegEx " + regEx);
          }
        }
       
        mask = this.getMask(action);
        DecimalFormat nf = new DecimalFormat(mask);
        Number number = nf.parse(as[0]);
        res = BigDecimal.valueOf(number.doubleValue());

        logger.debug("convertFromString() - [{}] -> [{}]", as[0], res);
       
      } catch (ParseException ex) {
        logger.warn("convertFromString() - [{}], mask [{}]", as[0], mask);
        throw new TypeConversionException("This one can not be converted!", ex);
      }
    }

    logger.debug("convertFromString() - end - return value=[{}]", res);
    return res;
View Full Code Here

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 = BigDecimal.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

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);
        DateFormat df = new SimpleDateFormat(mask);
        res = df.parse(as[0]);

        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
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.