Examples of CorruptPowerPointFileException


Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

     // Process any existing pictures if we haven't yet
     if(_pictures == null) {
         try {
            readPictures();
         } catch(IOException e) {
            throw new CorruptPowerPointFileException(e.getMessage());
         }
     }
    
     // Add the new picture in
      int offset = 0;
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

  public PictureData[] getPictures() {
     if(_pictures == null) {
        try {
           readPictures();
        } catch(IOException e) {
           throw new CorruptPowerPointFileException(e.getMessage());
        }
     }
    
    return _pictures.toArray(new PictureData[_pictures.size()]);
  }
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

      if(rleni < 0) { rleni = 0; }

      // Abort if first record is of type 0000 and length FFFF,
      //  as that's a sign of a screwed up record
      if(pos == 0 && type == 0l && rleni == 0xffff) {
        throw new CorruptPowerPointFileException("Corrupt document - starts with record of type 0000 and length 0xFFFF");
      }

      Record r = createRecordForType(type,b,pos,8+rleni);
      if(r != null) {
        children.add(r);
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

      // The image size must be 0 or greater
      // (0 is allowed, but odd, since we do wind on by the header each
      //  time, so we won't get stuck)
      if(imgsize < 0) {
        throw new CorruptPowerPointFileException("The file contains a picture, at position " + _pictures.size() + ", which has a negatively sized data length, so we can't trust any of the picture data");
      }

      // If they type (including the bonus 0xF018) is 0, skip it
      if(type == 0) {
        logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

     // Process any existing pictures if we haven't yet
     if(_pictures == null) {
         try {
            readPictures();
         } catch(IOException e) {
            throw new CorruptPowerPointFileException(e.getMessage());
         }
     }
    
     // Add the new picture in
      int offset = 0;
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

  public PictureData[] getPictures() {
     if(_pictures == null) {
        try {
           readPictures();
        } catch(IOException e) {
           throw new CorruptPowerPointFileException(e.getMessage());
        }
     }
    
    return _pictures.toArray(new PictureData[_pictures.size()]);
  }
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

    DocumentEntry docProps =
      (DocumentEntry)dir.getEntry("Current User");
   
    // If it's clearly junk, bail out
    if(docProps.getSize() > 131072) {
      throw new CorruptPowerPointFileException("The Current User stream is implausably long. It's normally 28-200 bytes long, but was " + docProps.getSize() + " bytes");
    }
   
    // Grab the contents
    _contents = new byte[docProps.getSize()];
    InputStream in = dir.createDocumentInputStream("Current User");
    in.read(_contents);

    // See how long it is. If it's under 28 bytes long, we can't
    //  read it
    if(_contents.length < 28) {
      if(_contents.length >= 4) {
        // PPT95 has 4 byte size, then data
        int size = LittleEndian.getInt(_contents);
        //System.err.println(size);
        if(size + 4 == _contents.length) {
          throw new OldPowerPointFormatException("Based on the Current User stream, you seem to have supplied a PowerPoint95 file, which isn't supported");
        }
      }
      throw new CorruptPowerPointFileException("The Current User stream must be at least 28 bytes long, but was only " + _contents.length);
    }

    // Set everything up
    init();
  }
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

   */
  private void buildSlidesAndNotes() {
    // Ensure we really found a Document record earlier
    // If we didn't, then the file is probably corrupt
    if (_documentRecord == null) {
      throw new CorruptPowerPointFileException(
          "The PowerPoint file didn't contain a Document Record in its PersistPtr blocks. It is probably corrupt.");
    }

    // Fetch the SlideListWithTexts in the most up-to-date Document Record
    //
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

      if(rleni < 0) { rleni = 0; }

      // Abort if first record is of type 0000 and length FFFF,
      //  as that's a sign of a screwed up record
      if(pos == 0 && type == 0l && rleni == 0xffff) {
        throw new CorruptPowerPointFileException("Corrupt document - starts with record of type 0000 and length 0xFFFF");
      }

      Record r = createRecordForType(type,b,pos,8+rleni);
      if(r != null) {
        children.add(r);
View Full Code Here

Examples of org.apache.poi.hslf.exceptions.CorruptPowerPointFileException

    _contents = new byte[docProps.getSize()];

    // Check it's big enough - if it's not at least 28 bytes long, then
    //  the record is corrupt
    if(_contents.length < 28) {
      throw new CorruptPowerPointFileException("The Current User stream must be at least 28 bytes long, but was only " + _contents.length);
    }

    // Grab the contents
    InputStream in = dir.createDocumentInputStream("Current User");
    in.read(_contents);
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.