Examples of JRException


Examples of net.sf.jasperreports.engine.JRException

      writer = new BufferedWriter(new OutputStreamWriter(fileOutputStream, encoding));
      exportReportToStream(writer);
    }
    catch (IOException e)
    {
      throw new JRException("Error writing to file : " + destFile, e);
    }
    finally
    {
      if (writer != null)
      {
        try
        {
          writer.close();
        }
        catch(IOException e)
        {
        }
      }
    }
   
    if (!isEmbeddingImages)
    {
      Collection imageNames = imageNameToImageDataMap.keySet();
      if (imageNames != null && imageNames.size() > 0)
      {
        if (!imagesDir.exists())
        {
          imagesDir.mkdir();
        }
 
        for(Iterator it = imageNames.iterator(); it.hasNext();)
        {
          String imageName = (String)it.next();
          byte[] imageData = (byte[])imageNameToImageDataMap.get(imageName);

          File imageFile = new File(imagesDir, imageName);

          OutputStream fos = null;
          try
          {
            fos = new FileOutputStream(imageFile);
            fos.write(imageData, 0, imageData.length);
          }
          catch (IOException e)
          {
            throw new JRException("Error writing to image file : " + imageFile, e);
          }
          finally
          {
            if (fos != null)
            {
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

    {
      exportReportToStream(buffer);
    }
    catch (IOException e)
    {
      throw new JRException("Error while exporting report to buffer", e);
    }
    return buffer.getBuffer();
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

      JRPrintPage page = null;
      for(int i = startPageIndex; i <= endPageIndex; i++)
      {
        if (Thread.interrupted())
        {
          throw new JRException("Current thread interrupted.");
        }
       
        page = (JRPrintPage)pages.get(i);
 
        /*   */
 
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

         
          imageSource = new String(baos.toByteArray(), DEFAULT_XML_ENCODING);
        }
        catch (IOException e)
        {
          throw new JRException("Error embedding image into XML.", e);
        }
      }
      else
      {
        if (renderer.getType() == JRRenderable.TYPE_IMAGE && rendererToImagePathMap.containsKey(renderer))
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

      Class clazz = JRClassLoader.loadClassForName(factoryClassName);
      return (ExporterFilterFactory)clazz.newInstance();
    }
    catch (ClassNotFoundException e)
    {
      throw new JRException("Class " + factoryClassName + " not found.", e);
    }
    catch (InstantiationException e)
    {
      throw new JRException("Error instantiating class " + factoryClassName + ".", e);
    }
    catch (IllegalAccessException e)
    {
      throw new JRException("Error instantiating class " + factoryClassName + ".", e);
    }
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

      Class scriptletClass = JRClassLoader.loadClassForName(scriptletClassName)
      scriptlet = (JRAbstractScriptlet) scriptletClass.newInstance();
    }
    catch (ClassNotFoundException e)
    {
      throw new JRException("Error loading scriptlet class : " + scriptletClassName, e);
    }
    catch (Exception e)
    {
      throw new JRException("Error creating scriptlet class instance : " + scriptletClassName, e);
    }
   
    return scriptlet;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

   
      evaluator = (JREvaluator) clazz.newInstance();
    }
    catch (Exception e)
    {
      throw new JRException("Error loading expression class : " + className, e);
    }
   
    return evaluator;
  }
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

   */
  public void setShape(MeterShapeEnum shape) throws JRException
  {
    if (shape != null && (shape.getValue() < 0 || shape.getValue() > MeterShapeEnum.DIAL.getValue()))
    {
      throw new JRException("Unknown shape for MeterPlot");
    }

    MeterShapeEnum old = this.shapeValue;
    this.shapeValue = shape;
    getEventSupport().firePropertyChange(PROPERTY_SHAPE, old, this.shapeValue);
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

        exportReportToWriter();
        sb.append(writer.toString());
      }
      catch (IOException e)
      {
        throw new JRException("Error writing to StringBuffer writer : " + jasperPrint.getName(), e);
      }
      finally
      {
        if (writer != null)
        {
          try
          {
            writer.close();
          }
          catch(IOException e)
          {
          }
        }
      }
    }
    else
    {
      writer = (Writer)parameters.get(JRExporterParameter.OUTPUT_WRITER);
      if (writer != null)
      {
        try
        {
          exportReportToWriter();
        }
        catch (IOException e)
        {
          throw new JRException("Error writing to writer : " + jasperPrint.getName(), e);
        }
      }
      else
      {
        OutputStream os = (OutputStream)parameters.get(JRExporterParameter.OUTPUT_STREAM);
        if (os != null)
        {
          try
          {
            writer = new OutputStreamWriter(os, encoding);
            exportReportToWriter();
          }
          catch (IOException e)
          {
            throw new JRException("Error writing to OutputStream writer : " + jasperPrint.getName(), e);
          }
        }
        else
        {
          File destFile = (File)parameters.get(JRExporterParameter.OUTPUT_FILE);
          if (destFile == null)
          {
            String fileName = (String)parameters.get(JRExporterParameter.OUTPUT_FILE_NAME);
            if (fileName != null)
            {
              destFile = new File(fileName);
            }
            else
            {
              throw new JRException("No output specified for the exporter.");
            }
          }

          try
          {
            os = new FileOutputStream(destFile);
            writer = new OutputStreamWriter(os, encoding);
            exportReportToWriter();
          }
          catch (IOException e)
          {
            throw new JRException("Error writing to file writer : " + jasperPrint.getName(), e);
          }
          finally
          {
            if (writer != null)
            {
View Full Code Here

Examples of net.sf.jasperreports.engine.JRException

        JRTextExporterParameter.PROPERTY_CHARACTER_WIDTH,
        0
        );
    if (charWidth < 0)
    {
      throw new JRException("Character width in pixels must be greater than zero.");
    }
    else if (charWidth == 0)
    {
      pageWidthInChars =
        getIntegerParameter(
          JRTextExporterParameter.PAGE_WIDTH,
          JRTextExporterParameter.PROPERTY_PAGE_WIDTH,
          0
          );
      if (pageWidthInChars <= 0)
      {
        throw new JRException("Character width in pixels or page width in characters must be specified and must be greater than zero.");
      }
     
      charWidth = jasperPrint.getPageWidth() / (float)pageWidthInChars;
    }
    else
    {
      pageWidthInChars = (int)(jasperPrint.getPageWidth() / charWidth);
    }
   

    charHeight =
      getFloatParameter(
        JRTextExporterParameter.CHARACTER_HEIGHT,
        JRTextExporterParameter.PROPERTY_CHARACTER_HEIGHT,
        0
        );
    if (charHeight < 0)
    {
      throw new JRException("Character height in pixels must be greater than zero.");
    }
    else if (charHeight == 0)
    {
      pageHeightInChars =
        getIntegerParameter(
          JRTextExporterParameter.PAGE_HEIGHT,
          JRTextExporterParameter.PROPERTY_PAGE_HEIGHT,
          0
          );
      if (pageHeightInChars <= 0)
      {
        throw new JRException("Character height in pixels or page height in characters must be specified and must be greater than zero.");
      }

      charHeight = jasperPrint.getPageHeight() / (float)pageHeightInChars;
    }
    else
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.