Package com.taobao.tdhs.client.exception

Examples of com.taobao.tdhs.client.exception.TDHSEncodeException


        return tableInfo;
    }

    public void isValid(TDHSCommon.ProtocolVersion version) throws TDHSEncodeException {
        if (tableInfo == null) {
            throw new TDHSEncodeException("tableInfo can't be empty!");
        }
        tableInfo.isValid(version);
        if (_values.size() != tableInfo.getFields().size()) {
            throw new TDHSEncodeException("field's size not match values's size");
        }
        if (_values.size() > TDHSCommon.REQUEST_MAX_FIELD_NUM) {
            throw new TDHSEncodeException("too many insert values , larger than 256!");
        }
    }
View Full Code Here


    }


    public void isValid(TDHSCommon.ProtocolVersion version) throws TDHSEncodeException {
        if (StringUtils.isBlank(_db)) {
            throw new TDHSEncodeException("db can't be empty!");
        }
        if (StringUtils.isBlank(_table)) {
            throw new TDHSEncodeException("table can't be empty!");
        }
        if (needField && (_fields == null || _fields.size() == 0)) {
            throw new TDHSEncodeException("field can't be empty!");
        }
        if (needField && _fields != null && _fields.size() > TDHSCommon.REQUEST_MAX_FIELD_NUM) {
            throw new TDHSEncodeException("too many field , larger than 256!");
        }

    }
View Full Code Here

        filters.addFilter(field, flag, value);
    }

    public void isValid(TDHSCommon.ProtocolVersion version) throws TDHSEncodeException {
        if (tableInfo == null) {
            throw new TDHSEncodeException("tableInfo can't be empty!");
        }
        tableInfo.isValid(version);
        if (_key == null || _key.size() == 0) {
            throw new TDHSEncodeException("key can't be missing!");
        }
        if (version.equals(TDHSCommon.ProtocolVersion.V1)) {
            if (_key.size() > TDHSCommon.REQUEST_MAX_KEY_NUM) {
                throw new TDHSEncodeException("too many keys(in) ,larger than 10!");
            }
        }

        for (String[] k : _key) {
            if (k == null || k.length == 0) {
                throw new TDHSEncodeException("key can't be empty!");
            }
            if (k.length > TDHSCommon.REQUEST_MAX_KEY_NUM) {
                throw new TDHSEncodeException("too many keys ,larger than 10!");
            }
        }
        if (filters != null) {
            filters.isValid(version);
        }

        if (____find_flag == TDHSCommon.FindFlag.TDHS_BETWEEN.getValue() && _key.size() < 2) {
            throw new TDHSEncodeException("between need at least 2 keys");
        }

    }
View Full Code Here

    }


    public void isValid(TDHSCommon.ProtocolVersion version) throws TDHSEncodeException {
        if (_filter != null && _filter.size() > TDHSCommon.REQUEST_MAX_FIELD_NUM) {
            throw new TDHSEncodeException("too many filter , larger than 256!");
        }
    }
View Full Code Here

        return get;
    }

    public void isValid(TDHSCommon.ProtocolVersion version) throws TDHSEncodeException {
        if (get == null) {
            throw new TDHSEncodeException("get can't be empty!");
        }
        get.isValid(version);
        if (_valueEntries.size() != get.getTableInfo().getFields().size()) {
            throw new TDHSEncodeException("field's size not match updateEntries's size");
        }
        if (_valueEntries.size() > TDHSCommon.REQUEST_MAX_FIELD_NUM) {
            throw new TDHSEncodeException("too many updateEntries , larger than 256!");
        }
    }
View Full Code Here

            o.isValid(getProtocolVersion());
            ByteArrayOutputStream out = new ByteArrayOutputStream(2 * 1024);
            encodeRequest(o, out, o.getCharsetName());
            return out.toByteArray();
        } catch (IllegalAccessException e) {
            throw new TDHSEncodeException(e);
        } catch (IOException e) {
            throw new TDHSEncodeException(e);
        }
    }
View Full Code Here

        } else if (o instanceof Collection) {
            writeToStream(((Collection) o).toArray(), out, charsetName);
        } else if (o instanceof Object[]) {
            writeToStream((Object[]) o, out, charsetName);
        } else {
            throw new TDHSEncodeException("unknown type!");
        }
    }
View Full Code Here

            } else if (o instanceof Collection) {
                writeToStream(((Collection) o).toArray(), out, charsetName);
            } else if (o instanceof Object[]) {
                writeToStream((Object[]) o, out, charsetName);
            } else {
                throw new TDHSEncodeException("unknown type!");
            }

        }
    }
View Full Code Here

TOP

Related Classes of com.taobao.tdhs.client.exception.TDHSEncodeException

Copyright © 2018 www.massapicom. 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.