Examples of FormattingException


Examples of de.innovationgate.utils.FormattingException

            }
            return text;
           
        }
        catch (ParseException e) {
           throw new FormattingException("Exception on RTF-Encoding", e);
        }
        catch (WGAPIException e) {
            throw new FormattingException("Exception on RTF-Encoding", e);
        }
  }
View Full Code Here

Examples of de.innovationgate.utils.FormattingException

    public String format(Object obj) throws FormattingException {
        try {
            return URLEncoder.encode(String.valueOf(obj), _context.getwgacore().getCharacterEncoding());
        }
        catch (UnsupportedEncodingException e) {
            throw new FormattingException("Exception in URL encoder", e);
        }
    }
View Full Code Here

Examples of de.innovationgate.utils.FormattingException

    public String format(Object obj) throws FormattingException {
        try {
            return WGUtils.toPlainText(String.valueOf(obj), "", false);
        }
        catch (IOException e) {
            throw new FormattingException(e);
        }
    }
View Full Code Here

Examples of de.innovationgate.utils.FormattingException

        String result = de.innovationgate.utils.WGUtils.serializeCollection(results, (includeFormatting ? status.divider : ""), formatters);
       
        // Set formatting errors as warnings
        Iterator errors = formatters.getErrors().iterator();
        while (errors.hasNext()) {
            FormattingException e = (FormattingException) errors.next();
            addWarning("Formatting/Encoding error: " + WGUtils.getRootCause(e).getMessage());
        }

        // Append prefix and suffix and return, maybe trimmed
        String prefix = getPrefix();
View Full Code Here

Examples of de.innovationgate.utils.FormattingException

                if (modDef != null) {
                    try {
                        modDef.testDependencies();
                    }
                    catch (ModuleDependencyException e) {
                        throw new FormattingException("WebTML encoder '" + encode + "' not available bc. of missing dependency: " + e.getMessage());
                    }
                    formatterClass = modDef.getImplementationClass();
                }
            }
           
            if (formatterClass != null) {
                try {
                    if (modDef != null) {
                        formatter = (ObjectFormatter) getModuleRegistry().instantiate(modDef);
                    }
                    else {
                        formatter = (ObjectFormatter) formatterClass.newInstance();
                    }
                }
                catch (Exception e) {
                    throw new FormattingException("The encoder class " + formatterClass.getName() + " is not instantiable", e);
                }
            }
            else {
                throw new FormattingException("Unknown encoder " + encode);
        }
        }

        if (formatter instanceof TMLContextAwareFormatter) {
            ((TMLContextAwareFormatter) formatter).setContext(context);
View Full Code Here

Examples of de.innovationgate.utils.FormattingException

                restriction.setHostIP(new IPv4Address(str));
                return restriction;
            }
        }
        catch (Exception e) {
            throw new FormattingException("Exception parsing restriction string", e);
        }
       
    }
View Full Code Here

Examples of de.xanders.common.exception.FormattingException

            BigDecimal bigDecValue = (BigDecimal) value;
            bigDecValue = bigDecValue.setScale(CURRENCY_SCALE,
                    BigDecimal.ROUND_HALF_UP);
            stringValue = NumberFormat.getInstance().format(bigDecValue.doubleValue());
        } catch (IllegalArgumentException iae) {
            throw new FormattingException("Unable to format " + value +
                "as a currency value", iae);
        }

        return stringValue;
    }
View Full Code Here

Examples of de.xanders.common.exception.FormattingException

        if (mode == OBJECT_TO_STRING) {
            return format(target);
        } else if (mode == STRING_TO_OBJECT) {
            return unformat((String) target);
        } else {
            throw new FormattingException("Invalid mode: " + String.valueOf(mode));
        }
    }
View Full Code Here

Examples of de.xanders.common.exception.FormattingException

        try {
            DecimalFormat formatter = new DecimalFormat(PERCENTAGE_FORMAT);
            Number parsedNumber = formatter.parse(target.trim());
            value = new BigDecimal(parsedNumber.doubleValue());
        } catch (NumberFormatException nfe) {
            throw new FormattingException(errorMsg, nfe);
        } catch (ParseException pe) {
            throw new FormattingException(errorMsg, pe);
        }

        return value;
    }
View Full Code Here

Examples of de.xanders.common.exception.FormattingException

        SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT);
        formatter.setLenient(false);
        date = formatter.parse(target, new ParsePosition(0));

        if (date == null) {
            throw new FormattingException(errorMsg);
        }

        return date;
    }
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.