Package javax.faces.convert

Examples of javax.faces.convert.ConverterException


          }
         
          clientSelection.addRange(new SelectionRange(fi, il));
         
        } catch (NumberFormatException e) {
          throw new ConverterException(e);
        }
      }
    }

    return clientSelection;
View Full Code Here


      String value) {
    try {
      int i = Integer.parseInt(value);
      return new SimpleRowKey(i);
    } catch(Exception e) {
      throw new ConverterException("Unable to convert value " + value + "to " + SimpleRowKey.class, e);
    }
  }
View Full Code Here

      Object value) {
    if (value instanceof SimpleRowKey) {
      SimpleRowKey key = (SimpleRowKey) value;
      return key.toString();
    }
    throw new ConverterException("Value " + value + " is not supported by this converter");
  }
View Full Code Here

        setRowKey(key);
        restoreOrigValue(context);

      } catch (IOException e) {
        throw new ConverterException(e.getLocalizedMessage(), e);
      }
     
      newSourceValue = createContainer(sourceList, oldSourceValue);
      newTargetValue = createContainer(targetList, oldTargetValue);
    }
View Full Code Here

        setRowKey(key);
        restoreOrigValue(context);

        newValue = createContainer(list, previousValue);
      } catch (IOException e) {
        throw new ConverterException(e.getLocalizedMessage(), e);
      }
    }
    catch (ConverterException ce) {
      Object submittedValue = submittedValueHolder;
      addConversionErrorMessage(context, ce, submittedValue);
View Full Code Here

  if ((component instanceof UISelectMany) && (submittedValue instanceof String[])) {
      return SelectUtils.getConvertedUISelectManyValue(context, (UISelectMany) component, (String[]) submittedValue);
  } else if ((component instanceof UISelectOne) && (submittedValue instanceof String)) {
      return SelectUtils.getConvertedUIInputValue(context, (UISelectOne) component, (String) submittedValue);
  } else {
      throw new ConverterException("Unsupported component class " + component.getClass().getName());
  }

    }
View Full Code Here

    {
      int numberOfDaysInMonth = day - calendar.get(Calendar.DAY_OF_MONTH);
      FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                    "Invalid date.",
                    "This month only has " + numberOfDaysInMonth + " days!");
      throw new ConverterException(message);
    }

    return calendar.getTime();
  }
View Full Code Here

      String tValue = value.trim();

      int length = tValue.length();
      if ( length < 9 )
      {
        throw new ConverterException(_getMessage(component, _SHORT_ERROR_TEXT));
      }

      if ( length > 11 )
      {
        throw new ConverterException(_getMessage(component, _LONG_ERROR_TEXT));
      }

      if (length == 9)
      {
        try
        {
          return Integer.valueOf(tValue);
        }
        catch(NumberFormatException nfe)
        {
          throw new ConverterException(_getMessage(component,
                                                   _INVALID_ERROR_TEXT));
        }
      }

      if ( length == 11 &&
           tValue.charAt(3) == '-' &&
           tValue.charAt(6) == '-')
      {
        String v = tValue.substring(0,3) +
                   tValue.substring(4,6) +
                   tValue.substring(7);

        try
        {
          return Integer.valueOf(v);
        }
        catch(NumberFormatException nfe)
        {
          throw new ConverterException(_getMessage(component,
                                                   _INVALID_ERROR_TEXT));
        }

      }
      throw new ConverterException(_getMessage(component, _INVALID_ERROR_TEXT));
    }
View Full Code Here

        if (submittedValue == null) {
            return null;
        }
        else {
            if (!(submittedValue instanceof String[])) {
                throw new ConverterException("Submitted value of type String[] for component : "
                    + getPathToComponent(selectMany) + "expected");
            }
        }
        return org.apache.myfaces.shared_impl.renderkit._SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
                                                                                                      selectMany,
View Full Code Here

        UserData userData = (UserData) submittedValue;
        try {
            return userData.parse();
        } catch (ParseException e) {
            Object[] args = {uiComponent.getId()};
            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR, DATE_MESSAGE_ID, args));
        }
    }
View Full Code Here

TOP

Related Classes of javax.faces.convert.ConverterException

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.