Package org.pentaho.reporting.libraries.xmlns.parser

Examples of org.pentaho.reporting.libraries.xmlns.parser.ParseException


{
  public Object convertFromString(final String s, final Locator locator) throws ParseException
  {
    if (s == null)
    {
      throw new ParseException("s must not be null");
    }

    try
    {
      final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSSZ");
      simpleDateFormat.setLenient(false);
      return simpleDateFormat.parse(s);
    }
    catch (Exception e)
    {
      throw new ParseException(e, locator);
    }
  }
View Full Code Here


    }

    int i = s.indexOf(',');
    if (i == -1)
    {
      throw new ParseException("Malformed format");
    }
    int i2 = s.indexOf(',', i + 1);
    if (i2 == -1)
    {
      throw new ParseException("Malformed format");
    }
    int i3 = s.indexOf(',', i2 + 1);
    if (i3 == -1)
    {
      throw new ParseException("Malformed format");
    }

    int d1 = Integer.parseInt(s.substring(0, i).trim());
    int d2 = Integer.parseInt(s.substring(i + 1, i2).trim());
    int d3 = Integer.parseInt(s.substring(i2 + 1, i3).trim());
View Full Code Here

    }

    int i = s.indexOf(',');
    if (i == -1)
    {
      throw new ParseException("Malformed format");
    }
    int i2 = s.indexOf(',', i + 1);
    if (i2 == -1)
    {
      throw new ParseException("Malformed format");
    }
    int i3 = s.indexOf(',', i2 + 1);
    if (i3 == -1)
    {
      throw new ParseException("Malformed format");
    }

    double d1 = Double.parseDouble(s.substring(0, i).trim());
    double d2 = Double.parseDouble(s.substring(i + 1, i2).trim());
    double d3 = Double.parseDouble(s.substring(i2 + 1, i3).trim());
View Full Code Here

    }

    int i = s.indexOf(',');
    if (i == -1)
    {
      throw new ParseException("Malformed format");
    }

    double d1 = Double.parseDouble(s.substring(0, i).trim());
    double d2 = Double.parseDouble(s.substring(i + 1).trim());
    return new Point2D.Double(d1, d2);
View Full Code Here

  {
    super.startParsing(attrs);
    final String type = attrs.getValue(getUri(), "type");
    if (type.endsWith("_DesignerWrapper") == false)
    {
      throw new ParseException("Magic-Token not found");
    }

    final String realType = CompatibilityMapperUtil.mapClassName
        (type.substring(0, type.length() - "_DesignerWrapper".length()));
    final Object expression = ObjectUtilities.loadAndInstantiate
        (realType, ReportFunctionReadHandler.class, Expression.class);
    if (expression == null)
    {
      throw new ParseException("Specified expression does not exist");
    }

    try
    {
      this.expression = (Expression) expression;
      this.beanUtility = new BeanUtility(expression);
    }
    catch (IntrospectionException e)
    {
      throw new ParseException("Specified expression cannot be beaned");
    }
  }
View Full Code Here

  {
    super.startParsing(attrs);
    propertyName = attrs.getValue(getUri(), "name");
    if (propertyName == null)
    {
      throw new ParseException("Required attribute 'name' is null.", getLocator());
    }

    // yes, this is how the report designer parses this property, so we have to follow that strange road too
    array = (attrs.getValue(getUri(), "array") != null);
  }
View Full Code Here

        beanUtility.setProperty(propertyName, value);
      }
    }
    catch (BeanException e)
    {
      throw new ParseException("Failed to set property", getLocator());
    }
  }
View Full Code Here

      {
        report = (TocElement) performExternalParsing(file, TocElement.class, parameters);
      }
      catch (ResourceLoadingException e)
      {
        throw new ParseException("The specified subreport was not found or could not be loaded.", e);
      }
    }
    else
    {
      throw new ParseException("Required attribute 'href' is missing.", getLocator());
    }

    initialize("toc");
    super.startParsing(attrs);
View Full Code Here

    propertyType = CompatibilityMapperUtil.mapClassName
        (attrs.getValue(getUri(), DesignerExpressionPropertyReadHandler.CLASS_ATT));
    propertyName = attrs.getValue(getUri(), DesignerExpressionPropertyReadHandler.NAME_ATT);
    if (propertyName == null)
    {
      throw new ParseException("Required attribute 'name' is null.", getLocator());
    }

    final String value = attrs.getValue(getUri(), "array");
    if (value != null)
    {
View Full Code Here

  {
    super.doneParsing();
    final String result = getResult();
    if (beanUtility == null)
    {
      throw new ParseException("No current beanUtility", getLocator());
    }

    try
    {

      if (array)
      {
        final Class type = beanUtility.getPropertyType(propertyName);


        final HashMap values = new HashMap();
        final int elementCount = arrayProperties.size();
        for (int i = 0; i < elementCount; i++)
        {
          final PropertyReadHandler handler = (PropertyReadHandler) arrayProperties.get(i);
          values.put(handler.getName(), handler.getResult());
        }

        final Class componentType = type.getComponentType();
        final ArrayList realValues = new ArrayList();
        for (int i = 0; i < elementCount; i++)
        {
          final String text = (String) values.get(String.valueOf(i));
          if (text == null)
          {
            throw new ParseException("Disrupted array - dont play games with me!", getLocator());
          }
          realValues.add(ObjectConverterFactory.convert(componentType, text, getLocator()));
        }

        final Object[] o = (Object[]) Array.newInstance(type.getComponentType(), realValues.size());
        final Object[] objects = realValues.toArray(o);
        beanUtility.setProperty(propertyName, objects);
        return;
      }

      if (propertyType != null)
      {
        final ClassLoader cl = ObjectUtilities.getClassLoader(DesignerExpressionPropertyReadHandler.class);
        final Class c = Class.forName(propertyType, false, cl);
        beanUtility.setPropertyAsString(propertyName, c, result);
      }
      else
      {
        beanUtility.setProperty(propertyName, ObjectConverterFactory.convert
            (beanUtility.getPropertyType(propertyName), result, getLocator()));
      }
    }
    catch (BeanException e)
    {
      if (isIgnorable())
      {
        return;
      }

      throw new ParseException("Unable to assign property '" + propertyName
          + "' to expression '" + expressionName + '\'', e, getLocator());
    }
    catch (ClassNotFoundException e)
    {
      if (isIgnorable())
      {
        return;
      }

      throw new ParseException("Unable to assign property '" + propertyName
          + "' to expression '" + expressionName + '\'', e, getLocator());
    }
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.xmlns.parser.ParseException

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.