Examples of InvalidFrameException


Examples of org.jaudiotagger.tag.InvalidFrameException

            //The read has extended further than the defined frame size (ok to extend upto
            //size because the next datatype may be of length 0.)
            if (offset > (size)) {
                //logger.warning("Invalid Size for FrameBody");
                throw new InvalidFrameException("Invalid size for Frame Body");
            }

            //Try and load it with data from the Buffer
            //if it fails frame is invalid
            try {
View Full Code Here

Examples of org.jaudiotagger.tag.InvalidFrameException

    private void initFromByteBuffer(ByteBuffer rawdata) throws IOException, InvalidFrameException {
        //Picture Type
        pictureType = rawdata.getInt();
        if (pictureType >= PictureTypes.getInstanceOf().getSize()) {
            throw new InvalidFrameException("PictureType was:" + pictureType + "but the maximum allowed is " + (PictureTypes.getInstanceOf().getSize() - 1));
        }

        //MimeType
        int mimeTypeSize = rawdata.getInt();
        mimeType = getString(rawdata, mimeTypeSize, "ISO-8859-1");
View Full Code Here

Examples of org.jaudiotagger.tag.InvalidFrameException

        } catch (DataFormatException dfe) {
            logger.log(Level.CONFIG, "Unable to decompress this frame:" + identifier, dfe);

            //Update position of main buffer, so no attempt is made to reread these bytes
            byteBuffer.position(byteBuffer.position() + realFrameSize);
            throw new InvalidFrameException(ErrorMessage.ID3_UNABLE_TO_DECOMPRESS_FRAME.getMsg(identifier, filename, dfe.getMessage()));
        }
        decompresser.end();
        return ByteBuffer.wrap(result);
    }
View Full Code Here

Examples of org.jaudiotagger.tag.InvalidFrameException

                }
            }
            // Unable to find a suitable frameBody, this should not happen
            else {
                logger.severe("Orig id is:" + frame.getIdentifier() + "Unable to create Frame Body");
                throw new InvalidFrameException("Orig id is:" + frame.getIdentifier() + "Unable to create Frame Body");
            }
        } else if (frame instanceof ID3v22Frame) {
            if (ID3Tags.isID3v22FrameIdentifier(frame.getIdentifier())) {
                identifier = ID3Tags.convertFrameID22To23(frame.getIdentifier());
                if (identifier != null) {
View Full Code Here

Examples of org.jaudiotagger.tag.InvalidFrameException

        }
        //Read the size field (as Big Endian Int - byte buffers always initialised to Big Endian order)
        frameSize = byteBuffer.getInt();
        if (frameSize < 0) {
            //logger.warning(getLoggingFilename() + ":Invalid Frame Size:" + identifier);
            throw new InvalidFrameException(identifier + " is invalid frame");
        } else if (frameSize == 0) {
            //logger.warning(getLoggingFilename() + ":Empty Frame Size:" + identifier);
            //We don't process this frame or add to frameMap because contains no useful information
            //Skip the two flag bytes so in correct position for subsequent frames
            byteBuffer.get();
            byteBuffer.get();
            throw new EmptyFrameException(identifier + " is empty frame");
        } else if (frameSize > byteBuffer.remaining()) {
            //logger.warning(getLoggingFilename() + ":Invalid Frame size of " + frameSize + " larger than size of" + byteBuffer.remaining() + " before mp3 audio:" + identifier);
            throw new InvalidFrameException(identifier + " is invalid frame");
        }

        //Read the flag bytes
        statusFlags = new StatusFlags(byteBuffer.get());
        encodingFlags = new EncodingFlags(byteBuffer.get());
View Full Code Here

Examples of org.java_websocket.exceptions.InvalidFrameException

      frames = readyframes;
      readingState = true;
      if( currentFrame == null )
        currentFrame = ByteBuffer.allocate( 2 );
      else {
        throw new InvalidFrameException();
      }
      if( buffer.remaining() > currentFrame.remaining() ) {
        throw new InvalidFrameException();
      } else {
        currentFrame.put( buffer );
      }
      if( !currentFrame.hasRemaining() ) {
        if( Arrays.equals( currentFrame.array(), closehandshake ) ) {
          frames.add( new CloseFrameBuilder( CloseFrame.NORMAL ) );
          return frames;
        }
        else{
          throw new InvalidFrameException();
        }
      } else {
        readyframes = new LinkedList<Framedata>();
        return frames;
      }
View Full Code Here

Examples of org.java_websocket.exceptions.InvalidFrameException

    while ( buffer.hasRemaining() ) {
      byte newestByte = buffer.get();
      if( newestByte == START_OF_FRAME ) { // Beginning of Frame
        if( readingState )
          throw new InvalidFrameException( "unexpected START_OF_FRAME" );
        readingState = true;
      } else if( newestByte == END_OF_FRAME ) { // End of Frame
        if( !readingState )
          throw new InvalidFrameException( "unexpected END_OF_FRAME" );
        // currentFrame will be null if END_OF_FRAME was send directly after
        // START_OF_FRAME, thus we will send 'null' as the sent message.
        if( this.currentFrame != null ) {
          currentFrame.flip();
          FramedataImpl1 curframe = new FramedataImpl1();
View Full Code Here

Examples of org.java_websocket.exceptions.InvalidFrameException

        return Opcode.PING;
      case 10:
        return Opcode.PONG;
        // 11-15 are not yet defined
      default :
        throw new InvalidFrameException( "unknow optcode " + (short) opcode );
    }
  }
View Full Code Here

Examples of org.java_websocket.exceptions.InvalidFrameException

      throw new IncompleteException( realpacketsize );
    byte b1 = buffer.get( /*0*/);
    boolean FIN = b1 >> 8 != 0;
    byte rsv = (byte) ( ( b1 & ~(byte) 128 ) >> 4 );
    if( rsv != 0 )
      throw new InvalidFrameException( "bad rsv " + rsv );
    byte b2 = buffer.get( /*1*/);
    boolean MASK = ( b2 & -128 ) != 0;
    int payloadlength = (byte) ( b2 & ~(byte) 128 );
    Opcode optcode = toOpcode( (byte) ( b1 & 15 ) );

    if( !FIN ) {
      if( optcode == Opcode.PING || optcode == Opcode.PONG || optcode == Opcode.CLOSING ) {
        throw new InvalidFrameException( "control frames may no be fragmented" );
      }
    }

    if( payloadlength >= 0 && payloadlength <= 125 ) {
    } else {
      if( optcode == Opcode.PING || optcode == Opcode.PONG || optcode == Opcode.CLOSING ) {
        throw new InvalidFrameException( "more than 125 octets" );
      }
      if( payloadlength == 126 ) {
        realpacketsize += 2; // additional length bytes
        if( maxpacketsize < realpacketsize )
          throw new IncompleteException( realpacketsize );
View Full Code Here

Examples of org.java_websocket.exceptions.InvalidFrameException

      bb.putShort( payload.getShort() );
      bb.position( 0 );
      code = bb.getInt();

      if( code == CloseFrame.ABNORMAL_CLOSE || code == CloseFrame.TLS_ERROR || code == CloseFrame.NOCODE || code > 4999 || code < 1000 || code == 1004 ) {
        throw new InvalidFrameException( "closecode must not be sent over the wire: " + code );
      }
    }
    payload.reset();
  }
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.