Package net.sf.jasperreports.engine

Examples of net.sf.jasperreports.engine.JRException


    String location = atts.getValue(ATTRIBUTE_valueLocation);
    ValueLocationEnum loc = ValueLocationEnum.getByName(atts.getValue(ATTRIBUTE_valueLocation));
    if (loc == null)
    {
      throw new JRException("Invalid thermometer value location: " + location);
    }
    else
    {
      thermometerPlot.setValueLocation(loc);
    }
View Full Code Here


          {
            destFile = new File(fileName);
          }
          else
          {
            throw new JRException("No output specified for the exporter.");
          }
        }

        try
        {
          os = new FileOutputStream(destFile);
          exportReportToStream(os);
          os.flush();
        }
        catch (IOException e)
        {
          throw new JRException("Error trying to export to file : " + destFile, e);
        }
        finally
        {
          if (os != null)
          {
View Full Code Here

          for(int pageIndex = startPageIndex; pageIndex <= endPageIndex; pageIndex++)
          {
            if (Thread.interrupted())
            {
              throw new JRException("Current thread interrupted.");
            }

            JRPrintPage page = (JRPrintPage)pages.get(pageIndex);

            document.newPage();
           
            pdfContentByte = pdfWriter.getDirectContent();

            pdfContentByte.setLineCap(2);//PdfContentByte.LINE_CAP_PROJECTING_SQUARE since iText 1.02b

            writePageAnchor(pageIndex);

            /*   */
            exportPage(page);
          }
        }
        else
        {
          document.newPage();
          pdfContentByte = pdfWriter.getDirectContent();
          pdfContentByte.setLiteral("\n");
        }
      }

      closeDocuments = false;
      document.close();
      imageTesterDocument.close();
    }
    catch(DocumentException e)
    {
      throw new JRException("PDF Document error : " + jasperPrint.getName(), e);
    }
    catch(IOException e)
    {
      throw new JRException("Error generating PDF report : " + jasperPrint.getName(), e);
    }
    finally
    {
      if (closeDocuments) //only on exception
      {
View Full Code Here

            /*
             * Everything in the result is a string, apart from Member
             */
            if (valueClass.equals(mondrian.olap.Member.class)) {
                if (!(value instanceof mondrian.olap.Member)) {
                    throw new JRException("Field '" + jrField.getName() + "' is of class '"
                        + value.getClass()
                        + "' and can not be converted to class " + valueClass.getName());
                }

                return value;
            }

            /*
             * Convert the rest from String
             */
            String fieldValue = (String) value;

            if (fieldValue == null)
            { 
              return null;
            }
            if (Number.class.isAssignableFrom(valueClass)){
                fieldValue = fieldValue.trim();
            }
            if (fieldValue.length() == 0){
               fieldValue = "0";
            }

            if (valueClass.equals(String.class)) {
                return fieldValue;
            } else if (valueClass.equals(Boolean.class)) {
                return fieldValue.equalsIgnoreCase("true") ? Boolean.TRUE : Boolean.FALSE;
            } else if (valueClass.equals(Byte.class)) {
                return new Byte(fieldValue);
            } else if (valueClass.equals(Integer.class)) {
                return Integer.valueOf(fieldValue);
            } else if (valueClass.equals(Long.class)) {
                return new Long(fieldValue);
            } else if (valueClass.equals(Short.class)) {
                return new Short(fieldValue);
            } else if (valueClass.equals(Double.class)) {
                return new Double(fieldValue);
            } else if (valueClass.equals(Float.class)) {
                return new Float(fieldValue);
            } else if (valueClass.equals(java.math.BigDecimal.class)) {
                return new java.math.BigDecimal(fieldValue);
            } else if (valueClass.equals(java.util.Date.class)) {
                return dateFormat.parse(fieldValue);
            } else if (valueClass.equals(java.sql.Timestamp.class)) {
                return new java.sql.Timestamp(dateFormat.parse(fieldValue).getTime());
            } else if (valueClass.equals(java.sql.Time.class)) {
                return new java.sql.Time(dateFormat.parse(fieldValue).getTime());
            } else if (valueClass.equals(java.lang.Number.class)) {
                return new Double(fieldValue);
            } else {
                throw new JRException("Field '" + jrField.getName() + "', string value '" + fieldValue + "' is of class '"
                + fieldValues.get(jrField.getName()).getClass()
                + "' and can not be converted to class " + valueClass.getName());
            }
        } catch (Exception e) {
            throw new JRException("Unable to get value for field '" + jrField.getName() + "' of class '" + valueClass.getName() + "'", e);
        }
    }
View Full Code Here

    {
       ds = new JRCsvDataSource(reader);
    }
    else
    {
      throw new JRException("Cannot find a source to read the data from");
    }

    ds.setDateFormat(dateFormat);
    ds.setNumberFormat(numberFormat);
    ds.setFieldDelimiter(fieldDelimiter);
View Full Code Here

      {
        value = PropertyUtils.getProperty(bean, propertyName);
      }
      catch (java.lang.IllegalAccessException e)
      {
        throw new JRException("Error retrieving field value from bean : " + propertyName, e);
      }
      catch (java.lang.reflect.InvocationTargetException e)
      {
        throw new JRException("Error retrieving field value from bean : " + propertyName, e);
      }
      catch (java.lang.NoSuchMethodException e)
      {
        throw new JRException("Error retrieving field value from bean : " + propertyName, e);
      }
      catch (IllegalArgumentException e)
      {
        //FIXME replace with NestedNullException when upgrading to BeanUtils 1.7
        if (!e.getMessage().startsWith("Null property value for "))
View Full Code Here

      for (int i = 0; i < sourceFiles.length; ++i)
      {
        files.append(sourceFiles[i].getPath());
        files.append(' ');
      }
      throw new JRException("Error compiling report java source files : " + files, e);
    }
  }
View Full Code Here

    {
      return createDocumentBuilder().parse(is);
    }
    catch (SAXException e)
    {
      throw new JRException("Failed to parse the xml document", e);
    }
    catch (IOException e)
    {
      throw new JRException("Failed to parse the xml document", e);
    }
  }
View Full Code Here

    {
      return createDocumentBuilder().parse(file);
    }
    catch (SAXException e)
    {
      throw new JRException("Failed to parse the xml document", e);
    }
    catch (IOException e)
    {
      throw new JRException("Failed to parse the xml document", e);
    }
  }
View Full Code Here

      is = url.openStream();
      return createDocumentBuilder().parse(is);
    }
    catch (SAXException e)
    {
      throw new JRException("Failed to parse the xmlf document", e);
    }
    catch (IOException e)
    {
      throw new JRException("Failed to parse the xml document", e);
    }
    finally
    {
      if (is != null)
      {
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.JRException

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.