Package javax.faces.convert

Examples of javax.faces.convert.ConverterException


    {
        Locale lokale = _locale != null ? _locale : facesContext.getViewRoot().getLocale();

        if (_pattern == null && _type == null)
        {
            throw new ConverterException("Cannot get NumberFormat, either type or pattern needed.");
        }

        // pattern
        if (_pattern != null)
        {
            return new DecimalFormat(_pattern, new DecimalFormatSymbols(lokale));
        }

        // type
        if (_type.equals("number"))
        {
            return NumberFormat.getNumberInstance(lokale);
        }
        else if (_type.equals("currency"))
        {
            return NumberFormat.getCurrencyInstance(lokale);
        }
        else if (_type.equals("percent"))
        {
            return NumberFormat.getPercentInstance(lokale);
        }
        throw new ConverterException("Cannot get NumberFormat, illegal type " + _type);
    }
View Full Code Here


            {
                format.setCurrency(Currency.getInstance(_currencyCode));
            }
            catch (Exception e)
            {
                throw new ConverterException("Unable to get Currency instance for currencyCode " +
                                             _currencyCode);
            }
        }
        else if (format instanceof DecimalFormat)
View Full Code Here

        } catch (IllegalArgumentException e) {
            Object[] params = new Object[]{value,
                                           firstConstantOfEnum(),
                                           MessageUtils.getLabel(facesContext, uiComponent)};
           
            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
                                                                       ENUM_ID,
                                                                       params));
        }
    }
View Full Code Here

    }

    private void checkTargetClass(FacesContext facesContext, UIComponent uiComponent, Object value, Class converterClass) {
        if (converterClass == null) {
            Object[] params = new Object[]{value, MessageUtils.getLabel(facesContext, uiComponent)};
            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
                                                                       ENUM_NO_CLASS_ID,
                                                                       params));
        }
        if (!converterClass.isEnum())
        {
            Object[] params = new Object[]{value, MessageUtils.getLabel(facesContext, uiComponent)};
            throw new ConverterException(MessageUtils.getMessage(FacesMessage.SEVERITY_ERROR,
                                                                       ENUM_NO_ENUM_CLASS,
                                                                       params));
        }
    }
View Full Code Here

        {
            converter = findUIOutputConverter(facesContext, output);
        }
        catch (FacesException e)
        {
            throw new ConverterException(e);
        }

        if (converter == null)
        {
            //No conversion needed
View Full Code Here

        }
        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

            }
            catch (ParseException e)
            {
                FacesMessage msg = MessageUtils.getMessage(CONVERSION_MESSAGE_ID,new Object[]{
                        uiComponent.getId(),s});
                throw new ConverterException(msg,e);
            }
        }
View Full Code Here

        {
            processValidation(facesContext, uiComponent, convertedObject);
        }
        catch (ValidatorException e)
        {
            throw new ConverterException(e.getFacesMessage(), e);
        }
    }
View Full Code Here

    if (submittedValue == null) {
      return null;
    } else {
      if (!(submittedValue instanceof String[])) {
        throw new ConverterException("Submitted value of type String[] for component : "
            + component.getClientId(facesContext) + "expected");
      }
    }
    return getConvertedUISelectManyValue(facesContext, (UISelectMany) component, (String[]) submittedValue);
  }
View Full Code Here

  public Object getAsObject(
      FacesContext facesContext, UIComponent component, String value) {
    Locale locale = createLocale(value);
    if (locale == null) {
      throw new ConverterException(MessageUtils.getLocalizedString(
          facesContext, "converterLocaleParserError", value));
    }
    return locale;
  }
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.