Examples of ConvertException


Examples of org.openoffice.xmerge.ConvertException

               
        try {
            pswDoc.addParagraph(pstyle, inList);
        }
        catch (Exception e) {
            throw new ConvertException(
                                "Error adding paragraph to PocketWordDocument.\n"
                                + e.toString());
        }
       
        traverseParagraphContents(node, tstyle);
View Full Code Here

Examples of org.openoffice.xmerge.ConvertException

                        if (s.length() > 0) {
                            try {
                                pswDoc.addParagraphData(s, tStyle);
                            }
                            catch (Exception e) {
                                throw new ConvertException(
                                    "Error adding data to paragraph in " +
                                    "PocketWordDocument.\n" + e.toString());
                                   
                            }
                        }
                        break;
                       
                    case Node.ELEMENT_NODE:
                        if (child.getNodeName().equals(TAG_SPACE)) {
                            StringBuffer sb = new StringBuffer("");
                            int count = 1;
                           
                            NamedNodeMap map = child.getAttributes();
                           
                            if (map.getLength() > 0) {
                                Node attr = map.getNamedItem(ATTRIBUTE_SPACE_COUNT);
                                count = Integer.parseInt(attr.getNodeValue().trim());
                            }
                           
                            for ( ; count > 0; count--) {
                                sb.append(" ");
                            }
                           
                            /*
                             * May want to look at style info for spaces.  Could 
                             * be important when calculating font metrics.
                             */
                            try {
                                pswDoc.addParagraphData(sb.toString(), tStyle);
                            }
                            catch (Exception e) {
                                throw new ConvertException(
                                    "Error adding data to paragraph in " +
                                    "PocketWordDocument.\n" + e.toString());
                                   
                            }
                        }
                        else if (child.getNodeName().equals(TAG_TAB_STOP)) {
                            try {
                                pswDoc.addParagraphData("\t", tStyle);
                            }
                            catch (Exception e) {
                                throw new ConvertException(
                                    "Error adding data to paragraph in " +
                                    "PocketWordDocument.\n" + e.toString());
                                   
                            }
                        }
View Full Code Here

Examples of org.openoffice.xmerge.ConvertException

        try {
            buildDocument(pe);       
        }
        catch (Exception e) {
            e.printStackTrace();
            throw new ConvertException("Error building OpenOffice Writer DOM: "
                                        + e.toString());
           
        }
               
        return sxwDoc;
View Full Code Here

Examples of org.pirkaengine.form.exception.ConvertException

    protected Date convert(String text) {
        if (text == null || text.isEmpty()) return null;
        try {
            return new SimpleDateFormat(dateFormat).parse(text);
        } catch (ParseException e) {
            throw new ConvertException(e, dateFormat);
        }
    }
View Full Code Here

Examples of org.pirkaengine.form.exception.ConvertException

     * @see org.pirkaengine.form.field.BaseField#convert(java.lang.String)
     */
    @Override
    protected String convert(String text) {
        if (text == null || text.isEmpty()) return null;
        if (!options.isEmpty() && !options.contains(text)) throw new ConvertException(options.toString());
        return text;
    }
View Full Code Here

Examples of org.pirkaengine.form.exception.ConvertException

    protected Integer convert(String text) {
        if (text == null || text.isEmpty()) return null;
        try {
            return Integer.parseInt(text);
        } catch (NumberFormatException e) {
            throw new ConvertException(e);
        }
    }
View Full Code Here

Examples of org.pirkaengine.form.exception.ConvertException

    protected Float convert(String text) throws ConvertException {
        if (text == null || text.isEmpty()) return null;
        try {
            return Float.parseFloat(text);
        } catch (NumberFormatException e) {
            throw new ConvertException(e);
        }
    }
View Full Code Here

Examples of org.pirkaengine.form.exception.ConvertException

    protected T convert(String text) {
        if (text == null || text.isEmpty()) return null;
        try {
            return Enum.valueOf(enumClass, text);
        } catch (IllegalArgumentException e) {
            throw new ConvertException(e);
        }
    }
View Full Code Here

Examples of org.soybeanMilk.core.bean.ConvertException

   
    //空字符串到其他类型认为是null
    if(sourceStr==null || "".equals(sourceStr))
    {
      if(tc.isPrimitive())
        throw new ConvertException(sourceObj, targetType, "can not convert "+SbmUtils.toString(sourceObj)+" to primitive type "+SbmUtils.toString(targetType));
      else
        return null;
    }
    else
    {
      try
      {
        return (T)convertStringToType(sourceStr, tc);
      }
      catch(Exception e)
      {
        if(e instanceof ConvertException)
          throw (ConvertException)e;
        else
          throw new ConvertException(sourceObj, targetType, e);
      }
    }
  }
View Full Code Here

Examples of org.soybeanMilk.core.bean.ConvertException

   * @throws ConvertException
   * @date 2012-5-23
   */
  protected Object convertNotSupportedThrow(Object sourceObj, Type targetType) throws ConvertException
  {
    throw new ConvertException(sourceObj, targetType, "convert "+SbmUtils.toString(sourceObj)+" to "+SbmUtils.toString(targetType)+" is not supported");
  }
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.