📄 reply.java
字号:
// facility returned the SEND indicator. // 0x07 Object length less than four. For example, // a command parameter's length is specified // as two, or a command's length is specified as three. // 0x08 Object length does not match the number of bytes of data // found. For example, a RQSDSS with a length of 150 // contains a command whose length is 125 or a SRVDGN parameter // specifies a length of 200 but there are only 50 // bytes left in the DSS. // 0x09 Object length greater than maximum allowed. // For example, a RECCNT parameter specifies a // length of ten, but the parameter is defined // to have a maximum length of eight. // 0x0A Object length less than the minimum required. // For example, a SVRCOD parameter specifies a // length of five, but the parameter is defined // to have a fixed length of six. // 0x0B Object length not allowed. For example, // a FILEXDPT parameter is specified with a length of // 11, but this would indicate that only half of the hours // field is present instead of the complete hours field. // 0x0C Incorrect large object extended length field (see // description of DSS). For example, an extended // length field is present, but it is only three bytes // long when it is defined to be a multiple of two bytes. // 0x0D Object code point index not supported. // For example, a code point of 8032 is encountered // but x'8' is a reserved code point index. // 0x0E Required object not found. For example, a CLEAR // command does not have a filnam parameter present, // or a MODREC command is not followed by a RECORD // command data object. // 0x0F Too many command data objects sent. For example, // a MODREC command is followed by two RECORD command // command data objects, or a DECREC command is followed // by RECORD object. // 0x10 Mutually exclusive objects present. // For example, a CRTDIRF command specifies both // a DCLNAM and FILNAM parameters. // 0x11 Too few command data objects sent. // For example, an INSRECEF command that // specified RECCNT95) is followed by only // 4 RECORD command data objects. // 0x12 Duplicate object present. // For example, a LSTFAT command has tow FILNAM // parameters specified. // 0x13 Invalid request correlator specified. // Use PRCCNVRM with PRCCNVDC of 04 or 05 instead // of this error code. This error code is being retained // for compatibility with Level 1 of the architecture. // 0x14 Required value not found. // 0x15 Reserved value not allowed. For example, // a INSRECEF command specified a RECCNT(0) parameter. // 0x16 DSS continuation less than or equal to two. // For example, the length bytes of the DSS continuation // have the value of one. // 0x17 Objects not in required order. For example, a RECAL // object contains a RECORD object followed by a RECNBR // object with is not in the defined order. // 0x18 DSS chaining byt not b'1', but DSSFMT bit3 set to b'1'. // 0x19 Previous DSS indicated current DSS has the same // request correlator, but the request correlators are // not the same. // 0x1A DSS cahining bit not b'1', but error continuation requested. // 0x1B Mutually exclusive parameter values not specified. // For example, an OPEN command specified PRPSHD(TRUE) // and FILSHR(READER). // 0x1D Code point not valid command. For example, the first // code point in RQSDSS either is not in the dictionary // or is not a code point for a command. // // When the client detects these errors, it will be handled as if a SYNTAXRM is returned // from the server. In this SYNTAXRM case, PROTOCOL architects an SQLSTATE of 58008 or 58009. // // Messages // SQLSTATE : 58009 // Execution failed due to a distribution protocol error that caused deallocation of the conversation. // SQLCODE : -30020 // Execution failed because of a Distributed Protocol // Error that will affect the successful execution of subsequent // commands and SQL statements: Reason Code <reason-code>. // Some possible reason codes include: // 121C Indicates that the user is not authorized to perform the requested command. // 1232 The command could not be completed because of a permanent error. // In most cases, the server will be in the process of an abend. // 220A The target server has received an invalid data description. // If a user SQLDA is specified, ensure that the fields are // initialized correctly. Also, ensure that the length does not // exceed the maximum allowed length for the data type being used. // // The command or statement cannot be processed. The current // transaction is rolled back and the application is disconnected // from the remote database. final void doSyntaxrmSemantics(int syntaxErrorCode) throws org.apache.derby.client.am.DisconnectException { agent_.accumulateChainBreakingReadExceptionAndThrow(new org.apache.derby.client.am.DisconnectException(agent_, "Execution failed due to a distribution protocol error " + "that caused deallocation of the conversation. " + "A PROTOCOL Data Stream Syntax Error was detected. Reason: " + "0x" + Integer.toHexString(syntaxErrorCode), SqlState._58009)); }// the names of these methods start with a letter z.// the z will be removed when they are finalized... protected final void pushLengthOnCollectionStack() { ddmCollectionLenStack_[++topDdmCollectionStack_] = ddmScalarLen_; ddmScalarLen_ = 0; } protected final void adjustLengths(int length) { ddmScalarLen_ -= length; adjustCollectionAndDssLengths(length); /* for (int i = 0; i <= topDdmCollectionStack_; i++) { ddmCollectionLenStack_[i] -= length; } dssLength_ -= length; */ } protected int adjustDdmLength(int ddmLength, int length) { ddmLength -= length; if (ddmLength == 0) { adjustLengths(getDdmLength()); } return ddmLength; } // Pop the collection Length stack. // pre: The collection length stack must not be empty and the top value // on the stack must be 0. // post: The top 0 value on the stack will be popped. protected final void popCollectionStack() { topDdmCollectionStack_--; } protected final int peekCodePoint() throws org.apache.derby.client.am.DisconnectException { if (topDdmCollectionStack_ != EMPTY_STACK) { if (ddmCollectionLenStack_[topDdmCollectionStack_] == 0) { return END_OF_COLLECTION; } else if (ddmCollectionLenStack_[topDdmCollectionStack_] < 4) { // error } } // if there is no more data in the current dss, and the dss is not // continued, indicate the end of the same Id chain or read the next dss header. if ((dssLength_ == 0) && (!dssIsContinued_)) { if (!dssIsChainedWithSameID_) { return END_OF_SAME_ID_CHAIN; } readDssHeader(); } if (longBufferForDecryption_ == null) //we don't need to do this if it's data stream encryption { ensureBLayerDataInBuffer(4); } peekedLength_ = ((buffer_[pos_] & 0xff) << 8) + ((buffer_[pos_ + 1] & 0xff) << 0); peekedCodePoint_ = ((buffer_[pos_ + 2] & 0xff) << 8) + ((buffer_[pos_ + 3] & 0xff) << 0); // check for extended length if ((peekedLength_ & 0x8000) == 0x8000) { peekExtendedLength(); } else { peekedNumOfExtendedLenBytes_ = 0; } return peekedCodePoint_; } // Read out the 2-byte length without moving the pos_ pointer. protected final int peekLength() throws org.apache.derby.client.am.DisconnectException { ensureBLayerDataInBuffer(2); return (((buffer_[pos_] & 0xff) << 8) + ((buffer_[pos_ + 1] & 0xff) << 0)); } // Read "length" number of bytes from the buffer into the byte array b starting from offset // "offset". The current offset in the buffer does not change. protected final int peekFastBytes(byte[] b, int offset, int length) throws org.apache.derby.client.am.DisconnectException { for (int i = 0; i < length; i++) { b[offset + i] = buffer_[pos_ + i]; } return offset + length; } protected final void parseLengthAndMatchCodePoint(int expectedCodePoint) throws org.apache.derby.client.am.DisconnectException { int actualCodePoint = 0; if (peekedCodePoint_ == END_OF_COLLECTION) { actualCodePoint = readLengthAndCodePoint(); } else { actualCodePoint = peekedCodePoint_; pos_ += (4 + peekedNumOfExtendedLenBytes_); ddmScalarLen_ = peekedLength_; if (peekedNumOfExtendedLenBytes_ == 0 && ddmScalarLen_ != -1) { adjustLengths(4); } else { adjustCollectionAndDssLengths(4 + peekedNumOfExtendedLenBytes_); } peekedLength_ = 0; peekedCodePoint_ = END_OF_COLLECTION; peekedNumOfExtendedLenBytes_ = 0; } if (actualCodePoint != expectedCodePoint) { zThrowSyntaxError("actual code point, " + actualCodePoint + " does not match expected code point, " + expectedCodePoint); } } protected final int readLengthAndCodePoint() throws org.apache.derby.client.am.DisconnectException { if (topDdmCollectionStack_ != EMPTY_STACK) { if (ddmCollectionLenStack_[topDdmCollectionStack_] == 0) { return END_OF_COLLECTION; } else if (ddmCollectionLenStack_[topDdmCollectionStack_] < 4) { zThrowSyntaxError("ddm collection contains less than 4 bytes of data"); } } // if there is no more data in the current dss, and the dss is not // continued, indicate the end of the same Id chain or read the next dss header. if ((dssLength_ == 0) && (!dssIsContinued_)) { if (!dssIsChainedWithSameID_) { return END_OF_SAME_ID_CHAIN; } readDssHeader(); } ensureBLayerDataInBuffer(4); ddmScalarLen_ = ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0); int codePoint = ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0); adjustLengths(4); // check for extended length if ((ddmScalarLen_ & 0x8000) == 0x8000) { readExtendedLength(); } return codePoint; } private final void readExtendedLength() throws org.apache.derby.client.am.DisconnectException { int numberOfExtendedLenBytes = (ddmScalarLen_ - 0x8000); // fix scroll problem was - 4 int adjustSize = 0; switch (numberOfExtendedLenBytes) { case 4: ensureBLayerDataInBuffer(4); ddmScalarLen_ = ((buffer_[pos_++] & 0xff) << 24) + ((buffer_[pos_++] & 0xff) << 16) + ((buffer_[pos_++] & 0xff) << 8) + ((buffer_[pos_++] & 0xff) << 0); adjustSize = 4; break; case 0: ddmScalarLen_ = -1; adjustSize = 0; break; default: doSyntaxrmSemantics(CodePoint.SYNERRCD_INCORRECT_EXTENDED_LEN); } adjustCollectionAndDssLengths(adjustSize); /* // adjust the lengths here. this is a special case since the // extended length bytes do not include their own length. for (int i = 0; i <= topDdmCollectionStack_; i++) { ddmCollectionLenStack_[i] -= adjustSize; } dssLength_ -= adjustSize; */ } private final void adjustCollectionAndDssLengths(int length) { // adjust the lengths here. this is a special case since the // extended length bytes do not include their own length. for (int i = 0; i <= topDdmCollectionStack_; i++) { ddmCollectionLenStack_[i] -= length; } dssLength_ -= length; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -