private void visit_OP_ADD_or_OP_CLOSE ( FSEditLogOpCodes editsOpCode ) throws IOException { visitTxId ( ) ; if ( ! LayoutVersion . supports ( Feature . EDITLOG_OP_OPTIMIZATION , editsVersion ) ) { IntToken opAddLength = v . visitInt ( EditsElement . LENGTH ) ; // this happens if the edits is not properly ended (-1 op code), // it is padded at the end with all zeros, OP_ADD is zero so // without this check we would treat all zeros as empty OP_ADD) if ( opAddLength . value == 0 ) { throw new IOException ( "OpCode " + editsOpCode + " has zero length (corrupted edits)" ) ; } } v . visitStringUTF8 ( EditsElement . PATH ) ; if ( LayoutVersion . supports ( Feature . ADD_INODE_ID , editsVersion ) ) { v . visitLong ( EditsElement . INODE_ID ) ; } if ( LayoutVersion . supports ( Feature . EDITLOG_OP_OPTIMIZATION , editsVersion ) ) { v . visitShort ( EditsElement . REPLICATION ) ; v . visitLong ( EditsElement . MTIME ) ; v . visitLong ( EditsElement . ATIME ) ; v . visitLong ( EditsElement . BLOCKSIZE ) ; } else { v . visitStringUTF8 ( EditsElement . REPLICATION ) ; v . visitStringUTF8 ( EditsElement . MTIME ) ; v . visitStringUTF8 ( EditsElement . ATIME ) ; v . visitStringUTF8 ( EditsElement . BLOCKSIZE ) ; } // now read blocks visit_Blocks ( ) ; // PERMISSION_STATUS v . visitEnclosingElement ( EditsElement . PERMISSION_STATUS ) ; v . visitStringText ( EditsElement . USERNAME ) ; v . visitStringText ( EditsElement . GROUPNAME ) ; v . visitShort ( EditsElement . FS_PERMISSIONS ) ; v . leaveEnclosingElement ( ) ; if ( editsOpCode == FSEditLogOpCodes . OP_ADD ) { v . visitStringUTF8 ( EditsElement . CLIENT_NAME ) ; v . visitStringUTF8 ( EditsElement . CLIENT_MACHINE ) ; } }
Visit OP_ADD and OP_CLOSE they are almost the same