Examples of FormatException


Examples of com.asakusafw.testdriver.excel.ExcelRuleExtractor.FormatException

            return new DecimalCompare(operator);
        case DATE:
        case DATETIME:
            return new CalendarCompare(operator);
        default:
            throw new FormatException(MessageFormat.format(
                    "Property does not support compare(\"{0}\") expression: {1}",
                    operator.getSymbol(),
                    name));
        }
    }
View Full Code Here

Examples of com.asakusafw.testdriver.excel.ExcelRuleExtractor.FormatException

        if (expression.trim().startsWith(TRIGGER) == false) {
            return null;
        }
        Matcher matcher = PATTERN.matcher(expression);
        if (matcher.matches() == false) {
            throw new FormatException(MessageFormat.format(
                    "Invalid approx(~) expression: {0}",
                    name));
        }
        String sign = matcher.group(1);
        boolean plus = sign == null || sign.equals(SIGN_PLUS);
        boolean minus = sign == null || sign.equals(SIGN_MINUS);
        String magnitude = matcher.group(2).trim();

        switch (type) {
        case BYTE:
        case SHORT:
        case INT:
        case LONG:
            try {
                long value = Long.parseLong(magnitude);
                return Predicates.integerRange(minus ? -value : 0, plus ? +value : 0);
            } catch (NumberFormatException e) {
                throw new FormatException(MessageFormat.format(
                        "Invalid approx(~) error \"{1}\": {0}",
                        name,
                        magnitude), e);
            }
        case FLOAT:
        case DOUBLE:
            try {
                double value = Double.parseDouble(magnitude);
                return Predicates.floatRange(minus ? -value : 0, plus ? +value : 0);
            } catch (NumberFormatException e) {
                throw new FormatException(MessageFormat.format(
                        "Invalid approx(~) value \"{1}\": {0}",
                        name,
                        magnitude), e);
            }
        case DECIMAL:
            try {
                BigDecimal value = new BigDecimal(magnitude);
                return Predicates.decimalRange(
                        minus ? value.negate() : BigDecimal.ZERO,
                        plus ? value : BigDecimal.ZERO);
            } catch (NumberFormatException e) {
                throw new FormatException(MessageFormat.format(
                        "Invalid approx(~) error \"{1}\": {0}",
                        name,
                        magnitude), e);
            }
        case DATE:
        case DATETIME:
            try {
                int value = Integer.parseInt(magnitude);
                if (type == PropertyType.DATE) {
                    return Predicates.dateRange(minus ? -value : 0, plus ? +value : 0);
                } else {
                    return Predicates.timeRange(minus ? -value : 0, plus ? +value : 0);
                }
            } catch (NumberFormatException e) {
                throw new FormatException(MessageFormat.format(
                        "Invalid approx(~) error \"{1}\": {0}",
                        name,
                        magnitude), e);
            }
        default:
            throw new FormatException(MessageFormat.format(
                    "Property does not support approx(~) expression: {0}",
                    name));
        }
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

        int totallen = tcount * tsize;
        vals = new float[totallen];
        try {
            input.readFloatArray(vals, 0, totallen);
        } catch (EOFException e) {
            throw new FormatException("CoordFloatString EOFException");
        }
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

    public DcwCrossTileID(BinaryFile in) throws FormatException, EOFException {
        int format;
        try {
            format = in.read();
        } catch (IOException ioe) {
            throw new FormatException(ioe.getMessage());
        }
        if (format == -1) {
            throw new EOFException();
        }

        try {
            currentTileKey = readIntegerByKey(in, format >> 6);
            nextTileID = readIntegerByKey(in, format >> 4);
            nextTileKey = readIntegerByKey(in, format >> 2);
            /*int unusedDcwKey = */readIntegerByKey(in, format);
        } catch (EOFException e) {
            throw new FormatException("DcwCrossTileID: unexpected EOD "
                    + e.getMessage());
        }
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

        case 1: {
            int byteval;
            try {
                byteval = in.read();
            } catch (IOException ioe) {
                throw new FormatException(ioe.getMessage());
            }
            if (byteval == -1) {
                throw new EOFException();
            }
            return byteval;
        }
        case 2:
            return MoreMath.signedToInt(in.readShort());
        case 3:
            return in.readInteger();
        }
        throw new FormatException("This can't happen");
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

            case VPF_COLUMN_SHORT:
            case VPF_COLUMN_INT:
            case VPF_COLUMN_DATE:
            case VPF_COLUMN_NULL:
            case VPF_COLUMN_TRIPLET:
                throw new FormatException("Illegal array type: " + fieldType
                        + "for column " + columnName);
            default:
                //legal
                break;
            }
        }

        String tmpkeyType = readColumnText(inputFile);
        if (tmpkeyType == null) {
            throw new FormatException("keyType is required column info");
        }
        tmpkeyType = tmpkeyType.trim();
        if (tmpkeyType.length() == 1) {
            keyType = tmpkeyType.charAt(0);
        } else {
            throw new FormatException("keyType is supposed to be 1 character");
        }
        columnDescription = readColumnText(inputFile);
        if (columnDescription == null) {
            return;
        }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

     */
    public void assertSchema(char type, int length, boolean strictlength)
            throws FormatException {
        if ((type != fieldType)
                && !((type == 'i') && ((fieldType == VPF_COLUMN_INT) || (fieldType == VPF_COLUMN_SHORT)))) {
            throw new FormatException("AssertSchema failed on fieldType!");
        }
        if ((strictlength && (length != numberOfElements))
                || (!strictlength && (length != -1) && (length != numberOfElements))) {
            throw new FormatException("AssertSchema failed on length!");
        }
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

        case VPF_COLUMN_NULL: //nulls
            return 0;
        case VPF_COLUMN_TRIPLET: //cross-tile identifiers
            return -1; //variable length
        default: {
            throw new FormatException("Unknown field type: " + fieldType);
        }
        }
        //unreached
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

        }
        case VPF_COLUMN_TRIPLET: {
            return new DcwCrossTileID(inputFile);
        }
        default: {
            throw new FormatException("Unknown field type: " + fieldType);
        }
        }
        //unreached
    }
View Full Code Here

Examples of com.bbn.openmap.io.FormatException

            vals = new double[tuplecount][tuplesize];
            for (int i = 0; i < tuplecount; i++)
                for (int j = 0; j < tuplesize; j++)
                    vals[i][j] = input.readDouble();
        } catch (EOFException e) {
            throw new FormatException("CoordDoubleString EOFException");
        }
    }
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.