Example usage for java.lang Byte byteValue

List of usage examples for java.lang Byte byteValue

Introduction

In this page you can find the example usage for java.lang Byte byteValue.

Prototype

@HotSpotIntrinsicCandidate
public byte byteValue() 

Source Link

Document

Returns the value of this Byte as a byte .

Usage

From source file:com.jaspersoft.jasperserver.api.engine.scheduling.quartz.ReportJobsQuartzScheduler.java

protected String enumerateCronVals(SortedSet vals, int totalCount) {
    if (vals == null || vals.isEmpty()) {
        throw new JSException("jsexception.no.values.to.enumerate");
    }//ww  w  .  j av  a 2s  . c  o  m

    if (vals.size() == totalCount) {
        return "*";
    }

    StringBuffer enumStr = new StringBuffer();
    for (Iterator it = vals.iterator(); it.hasNext();) {
        Byte val = (Byte) it.next();
        enumStr.append(val.byteValue());
        enumStr.append(',');
    }
    return enumStr.substring(0, enumStr.length() - 1);
}

From source file:org.apache.flex.forks.velocity.runtime.configuration.Configuration.java

/**
 * Get a byte associated with the given configuration key.
 *
 * @param key The configuration key./*  w  ww . j a  va  2s.  c  om*/
 * @return The associated byte.
 * @exception NoSuchElementException is thrown if the key doesn't
 * map to an existing object.
 * @exception ClassCastException is thrown if the key maps to an
 * object that is not a Byte.
 * @exception NumberFormatException is thrown if the value mapped
 * by the key has not a valid number format.
 */
public byte getByte(String key) {
    Byte b = getByte(key, null);
    if (b != null) {
        return b.byteValue();
    } else {
        throw new NoSuchElementException('\'' + key + " doesn't map to an existing object");
    }
}

From source file:br.com.topsys.util.TSArrayUtil.java

/**
 * <p>/*from   w w  w  . j ava  2  s.c  om*/
 * Converts an array of object Bytes to primitives handling
 * <code>null</code>.
 * </p>
 * 
 * <p>
 * This method returns <code>null</code> if <code>null</code> array
 * input.
 * </p>
 * 
 * @param array
 *            a <code>Byte</code> array, may be <code>null</code>
 * @param valueForNull
 *            the value to insert if <code>null</code> found
 * @return a <code>byte</code> array, <code>null</code> if null array
 *         input
 */
public static byte[] toPrimitive(final Byte[] array, final byte valueForNull) {
    if (array == null) {
        return null;
    } else if (array.length == 0) {
        return EMPTY_BYTE_ARRAY;
    }
    final byte[] result = new byte[array.length];
    for (int i = 0; i < array.length; i++) {
        Byte b = array[i];
        result[i] = (b == null ? valueForNull : b.byteValue());
    }
    return result;
}

From source file:org.apache.pig.newplan.logical.relational.LogToPhyTranslationVisitor.java

@Override
public void visit(LOJoin loj) throws FrontendException {

    String scope = DEFAULT_SCOPE;

    // List of join predicates
    List<Operator> inputs = loj.getPlan().getPredecessors(loj);

    // mapping of inner join physical plans corresponding to inner physical operators.
    MultiMap<PhysicalOperator, PhysicalPlan> joinPlans = new LinkedMultiMap<PhysicalOperator, PhysicalPlan>();

    // Outer list corresponds to join predicates. Inner list is inner physical plan of each predicate.
    List<List<PhysicalPlan>> ppLists = new ArrayList<List<PhysicalPlan>>();

    // List of physical operator corresponding to join predicates.
    List<PhysicalOperator> inp = new ArrayList<PhysicalOperator>();

    // Outer list corresponds to join predicates and inner list corresponds to type of keys for each predicate.
    List<List<Byte>> keyTypes = new ArrayList<List<Byte>>();

    boolean[] innerFlags = loj.getInnerFlags();
    String alias = loj.getAlias();
    SourceLocation location = loj.getLocation();
    int parallel = loj.getRequestedParallelism();

    for (int i = 0; i < inputs.size(); i++) {
        Operator op = inputs.get(i);//from   w ww.ja  va 2s .com
        PhysicalOperator physOp = logToPhyMap.get(op);
        inp.add(physOp);
        List<LogicalExpressionPlan> plans = (List<LogicalExpressionPlan>) loj.getJoinPlan(i);

        List<PhysicalPlan> exprPlans = translateExpressionPlans(loj, plans);

        ppLists.add(exprPlans);
        joinPlans.put(physOp, exprPlans);

        // Key could potentially be a tuple. So, we visit all exprPlans to get types of members of tuples.
        List<Byte> tupleKeyMemberTypes = new ArrayList<Byte>();
        for (PhysicalPlan exprPlan : exprPlans)
            tupleKeyMemberTypes.add(exprPlan.getLeaves().get(0).getResultType());
        keyTypes.add(tupleKeyMemberTypes);
    }

    if (loj.getJoinType() == LOJoin.JOINTYPE.SKEWED) {
        POSkewedJoin skj;
        try {
            skj = new POSkewedJoin(new OperatorKey(scope, nodeGen.getNextNodeId(scope)), parallel, inp,
                    innerFlags);
            skj.addOriginalLocation(alias, location);
            skj.setJoinPlans(joinPlans);
        } catch (Exception e) {
            int errCode = 2015;
            String msg = "Skewed Join creation failed";
            throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
        }
        skj.setResultType(DataType.TUPLE);

        for (int i = 0; i < inputs.size(); i++) {
            Operator op = inputs.get(i);
            if (!innerFlags[i]) {
                try {
                    LogicalSchema s = ((LogicalRelationalOperator) op).getSchema();
                    // if the schema cannot be determined
                    if (s == null) {
                        throw new FrontendException(loj, "Cannot determine skewed join schema", 2247);
                    }
                    skj.addSchema(Util.translateSchema(s));
                } catch (FrontendException e) {
                    int errCode = 2015;
                    String msg = "Couldn't set the schema for outer join";
                    throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
                }
            } else {
                // This will never be retrieved. It just guarantees that the index will be valid when
                // MRCompiler is trying to read the schema
                skj.addSchema(null);
            }
        }

        currentPlan.add(skj);

        for (Operator op : inputs) {
            try {
                currentPlan.connect(logToPhyMap.get(op), skj);
            } catch (PlanException e) {
                int errCode = 2015;
                String msg = "Invalid physical operators in the physical plan";
                throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
            }
        }
        logToPhyMap.put(loj, skj);
    } else if (loj.getJoinType() == LOJoin.JOINTYPE.REPLICATED) {
        Schema[] inputSchemas = new Schema[inputs.size()];
        Schema[] keySchemas = new Schema[inputs.size()];

        outer: for (int i = 0; i < inputs.size(); i++) {
            LogicalSchema logicalSchema = ((LogicalRelationalOperator) inputs.get(i)).getSchema();
            if (logicalSchema == null) {
                continue;
            }
            Schema toGen = Schema.getPigSchema(new ResourceSchema(logicalSchema));
            // This registers the value piece
            SchemaTupleFrontend.registerToGenerateIfPossible(toGen, false, GenContext.FR_JOIN);
            inputSchemas[i] = toGen;

            Schema keyToGen = new Schema();
            for (Byte byt : keyTypes.get(i)) {
                // We cannot generate any nested code because that information is thrown away
                if (byt == null || DataType.isComplex(byt.byteValue())) {
                    continue outer;
                }
                keyToGen.add(new FieldSchema(null, byt));
            }

            SchemaTupleFrontend.registerToGenerateIfPossible(keyToGen, false, GenContext.FR_JOIN);
            keySchemas[i] = keyToGen;
        }

        int fragment = 0;
        POFRJoin pfrj;
        try {
            boolean isLeftOuter = false;
            // We dont check for bounds issue as we assume that a join
            // involves atleast two inputs
            isLeftOuter = !innerFlags[1];

            Tuple nullTuple = null;
            if (isLeftOuter) {
                try {
                    // We know that in a Left outer join its only a two way
                    // join, so we assume index of 1 for the right input
                    LogicalSchema inputSchema = ((LogicalRelationalOperator) inputs.get(1)).getSchema();

                    // We check if we have a schema before the join
                    if (inputSchema == null) {
                        int errCode = 1109;
                        String msg = "Input (" + ((LogicalRelationalOperator) inputs.get(1)).getAlias() + ") "
                                + "on which outer join is desired should have a valid schema";
                        throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.INPUT);
                    }

                    // Using the schema we decide the number of columns/fields
                    // in the nullTuple
                    nullTuple = TupleFactory.getInstance().newTuple(inputSchema.size());
                    for (int j = 0; j < inputSchema.size(); j++) {
                        nullTuple.set(j, null);
                    }

                } catch (FrontendException e) {
                    int errCode = 2104;
                    String msg = "Error while determining the schema of input";
                    throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
                }
            }

            pfrj = new POFRJoin(new OperatorKey(scope, nodeGen.getNextNodeId(scope)), parallel, inp, ppLists,
                    keyTypes, null, fragment, isLeftOuter, nullTuple, inputSchemas, keySchemas);
            pfrj.addOriginalLocation(alias, location);
        } catch (ExecException e1) {
            int errCode = 2058;
            String msg = "Unable to set index on newly create POLocalRearrange.";
            throw new VisitorException(msg, errCode, PigException.BUG, e1);
        }
        pfrj.setResultType(DataType.TUPLE);
        currentPlan.add(pfrj);
        for (Operator op : inputs) {
            try {
                currentPlan.connect(logToPhyMap.get(op), pfrj);
            } catch (PlanException e) {
                int errCode = 2015;
                String msg = "Invalid physical operators in the physical plan";
                throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
            }
        }
        logToPhyMap.put(loj, pfrj);
    } else if ((loj.getJoinType() == LOJoin.JOINTYPE.MERGE || loj.getJoinType() == LOJoin.JOINTYPE.MERGESPARSE)
            && (new MapSideMergeValidator().validateMapSideMerge(inputs, loj.getPlan()))) {

        PhysicalOperator smj;
        boolean usePOMergeJoin = inputs.size() == 2 && innerFlags[0] && innerFlags[1];

        if (usePOMergeJoin) {
            // We register the merge join schema information for code generation
            LogicalSchema logicalSchema = ((LogicalRelationalOperator) inputs.get(0)).getSchema();
            Schema leftSchema = null;
            if (logicalSchema != null) {
                leftSchema = Schema.getPigSchema(new ResourceSchema(logicalSchema));
            }
            logicalSchema = ((LogicalRelationalOperator) inputs.get(1)).getSchema();
            Schema rightSchema = null;
            if (logicalSchema != null) {
                rightSchema = Schema.getPigSchema(new ResourceSchema(logicalSchema));
            }
            logicalSchema = loj.getSchema();
            Schema mergedSchema = null;
            if (logicalSchema != null) {
                mergedSchema = Schema.getPigSchema(new ResourceSchema(logicalSchema));
            }

            if (leftSchema != null) {
                SchemaTupleFrontend.registerToGenerateIfPossible(leftSchema, false, GenContext.MERGE_JOIN);
            }
            if (rightSchema != null) {
                SchemaTupleFrontend.registerToGenerateIfPossible(rightSchema, false, GenContext.MERGE_JOIN);
            }
            if (mergedSchema != null) {
                SchemaTupleFrontend.registerToGenerateIfPossible(mergedSchema, false, GenContext.MERGE_JOIN);
            }

            // inner join on two sorted inputs. We have less restrictive
            // implementation here in a form of POMergeJoin which doesn't
            // require loaders to implement collectable interface.
            try {
                smj = new POMergeJoin(new OperatorKey(scope, nodeGen.getNextNodeId(scope)), parallel, inp,
                        joinPlans, keyTypes, loj.getJoinType(), leftSchema, rightSchema, mergedSchema);
            } catch (PlanException e) {
                int errCode = 2042;
                String msg = "Merge Join creation failed";
                throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
            }
            logToPhyMap.put(loj, smj);
        } else {
            // in all other cases we fall back to POMergeCogroup + Flattening FEs
            smj = compileToMergeCogrp(loj, loj.getExpressionPlans());
        }

        smj.setResultType(DataType.TUPLE);
        currentPlan.add(smj);
        smj.addOriginalLocation(alias, location);
        for (Operator op : inputs) {
            try {
                currentPlan.connect(logToPhyMap.get(op), smj);
            } catch (PlanException e) {
                int errCode = 2015;
                String msg = "Invalid physical operators in the physical plan";
                throw new LogicalToPhysicalTranslatorException(msg, errCode, PigException.BUG, e);
            }
        }

        if (!usePOMergeJoin) {
            // Now create and configure foreach which will flatten the output
            // of cogroup.
            POForEach fe = compileFE4Flattening(innerFlags, scope, parallel, alias, location, inputs);
            currentPlan.add(fe);
            try {
                currentPlan.connect(smj, fe);
            } catch (PlanException e) {
                throw new LogicalToPhysicalTranslatorException(e.getMessage(), e.getErrorCode(),
                        e.getErrorSource(), e);
            }
            logToPhyMap.put(loj, fe);
        }

        return;
    } else if (loj.getJoinType() == LOJoin.JOINTYPE.HASH) {
        POPackage poPackage = compileToLR_GR_PackTrio(loj, loj.getCustomPartitioner(), innerFlags,
                loj.getExpressionPlans());
        POForEach fe = compileFE4Flattening(innerFlags, scope, parallel, alias, location, inputs);
        currentPlan.add(fe);
        try {
            currentPlan.connect(poPackage, fe);
        } catch (PlanException e) {
            throw new LogicalToPhysicalTranslatorException(e.getDetailedMessage(), e.getErrorCode(),
                    e.getErrorSource(), e);
        }
        logToPhyMap.put(loj, fe);
        poPackage.getPkgr().setPackageType(PackageType.JOIN);
    }
    translateSoftLinks(loj);
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 * 
 *
 * @param b
 */
public TreeObject(Byte b) {
    _object = b != null ? b.byteValue() : Byte.MIN_VALUE;
    _type = TYPE_BYTE;
}

From source file:net.ymate.platform.commons.lang.TreeObject.java

/**
 *  - Byte
 *
 * @param b
 */
public TreeObject add(Byte b) {
    return add(b != null ? b.byteValue() : 0, TYPE_BYTE);
}

From source file:edu.ku.brc.specify.conversion.ConvertVerifier.java

/**
 * @param oldNewIdStr//from   w w w.  j  a v  a2 s  .c o m
 * @param newColInx
 * @param oldColInx
 * @return
 * @throws SQLException
 */
private StatusType compareDates(final String oldNewIdStr, final int newColInx, final int oldColInx)
        throws SQLException {
    PartialDateConv datePair = new PartialDateConv();

    Object newObj = newDBRS.getObject(newColInx);
    Object oldObj = oldDBRS.getObject(oldColInx);

    ResultSetMetaData newRsmd = newDBRS.getMetaData();
    ResultSetMetaData oldRsmd = oldDBRS.getMetaData();

    String newColName = newRsmd.getColumnName(newColInx);
    String oldColName = oldRsmd.getColumnName(oldColInx);

    if (newObj == null) {
        String clsName = newRsmd.getColumnClassName(newColInx);

        if (compareTo6DBs) {
            if (!clsName.equals("java.sql.Date") || oldObj != null) {
                String msg = "New Value was null and shouldn't have been for Key Value New  Field ["
                        + newColName + "] [" + oldObj + "]";
                log.error(msg);
                tblWriter.logErrors(newColName, msg);
                return StatusType.NEW_VAL_NULL;
            }

        } else if (oldObj != null) {
            if (oldObj instanceof Number && ((Number) oldObj).intValue() == 0) {
                return StatusType.COMPARE_OK;

            } else if (!clsName.equals("java.sql.Date")
                    || (!(oldObj instanceof String) && ((Number) oldObj).intValue() != 0)) {
                String msg = "New Value was null and shouldn't have been for Key Value New Field [" + newColName
                        + "] [" + oldObj + "]";
                log.error(msg);
                tblWriter.logErrors(newColName, msg);
                return StatusType.NEW_VAL_NULL;
            }
        } else {
            return StatusType.COMPARE_OK;
        }
    }

    StringBuilder errSB = new StringBuilder();

    //System.out.println(newObj.getClass().getName()+"  "+oldObj.getClass().getName());

    if (newObj instanceof java.sql.Date) {
        boolean isPartialDate = false;
        Byte partialDateType = null;
        if (StringUtils.contains(newRsmd.getColumnName(newColInx + 1), "DatePrecision")) {
            partialDateType = newDBRS.getByte(newColInx);
            isPartialDate = true;
        }

        if (compareTo6DBs) {
            Object dateObj = oldDBRS.getObject(oldColInx);

            boolean isPartialDate2 = false;
            Byte partialDateType2 = null;
            if (StringUtils.contains(oldRsmd.getColumnName(oldColInx + 1), "DatePrecision")) {
                partialDateType2 = newDBRS.getByte(oldColInx);
                isPartialDate2 = true;

            } else {
                log.error("Next isn't DatePrecision and can't be!");
                tblWriter.logErrors(oldNewIdStr, errSB.toString());
            }

            if (!newObj.equals(dateObj) || (isPartialDate2 && !partialDateType2.equals(partialDateType))) {
                errSB.insert(0, oldColName + "  ");
                errSB.append("[");
                errSB.append(datePair);
                errSB.append("][");
                errSB.append(dateFormatter.format((Date) newObj));
                errSB.append("] oldDate[");
                errSB.append(dateFormatter.format((Date) dateObj));
                errSB.append("]");
                log.error(errSB.toString());
                tblWriter.logErrors(oldNewIdStr, errSB.toString());
                return StatusType.BAD_DATE;
            }

        } else {
            int oldIntDate = oldDBRS.getInt(oldColInx);
            if (oldIntDate == 0) {
                return StatusType.NO_OLD_REC;
            }

            BasicSQLUtils.getPartialDate(oldIntDate, datePair, false);

            if (partialDateType != null) {
                if (Byte.parseByte(datePair.getPartial()) != partialDateType.byteValue()) {
                    errSB.append("Partial Dates Type do not match. Old[" + datePair.getPartial() + "]  New ["
                            + partialDateType.byteValue() + "]");
                    // error partial dates don't match
                }
            }

            Calendar cal = Calendar.getInstance();
            cal.setTime((Date) newObj);

            int year = Integer.parseInt(datePair.getDateStr().substring(0, 4));
            int mon = Integer.parseInt(datePair.getDateStr().substring(5, 7));
            int day = Integer.parseInt(datePair.getDateStr().substring(8, 10));

            if (mon > 0)
                mon--;

            boolean isYearOK = true;

            int yr = cal.get(Calendar.YEAR);
            if (year != yr) {
                errSB.append("Year mismatch Old[" + year + "]  New [" + yr + "] ");
                isYearOK = false;
            }

            if (mon != cal.get(Calendar.MONTH)) {
                errSB.append("Month mismatch Old[" + mon + "]  New [" + cal.get(Calendar.MONTH) + "] ");
            }

            if (day != cal.get(Calendar.DAY_OF_MONTH)) {
                errSB.append("Day mismatch Old[" + day + "]  New [" + cal.get(Calendar.DAY_OF_MONTH) + "] ");
            }

            if (errSB.length() > 0 && (!isYearOK || !isPartialDate)) {
                errSB.insert(0, oldColName + "  ");
                errSB.append("[");
                errSB.append(datePair);
                errSB.append("][");
                errSB.append(dateFormatter.format((Date) newObj));
                errSB.append("]");
                log.error(errSB.toString());
                tblWriter.logErrors(oldNewIdStr, errSB.toString());
                return StatusType.BAD_DATE;
            }
        }
    }

    return StatusType.COMPARE_OK;
}

From source file:edu.ku.brc.specify.conversion.ConvertVerifier.java

/**
 * @param oldSQL/*  ww w.  j a  v a  2s  .co  m*/
 * @param newSQL
 * @return
 * @throws SQLException
 */
private StatusType compareRecords(final String desc, final String oldCatNumArg, final String newCatNumArg,
        final String oldSQLArg, final String newSQLArg, final boolean nullsAreOK, final boolean notRetarded)
        throws SQLException {
    boolean dbg = false;
    if (dbg) {
        System.out.println(oldSQLArg);
        System.out.println(newSQLArg);
    }
    if (dbg) {
        System.out.println("\n" + desc);
        dump(desc, oldDBConn, compareTo6DBs ? newSQLArg : oldSQLArg);
        dump(desc, newDBConn, newSQLArg);
    }

    String oldCatNum = oldCatNumArg;
    String newCatNum = newCatNumArg;
    if (compareTo6DBs) {
        oldCatNum = newCatNumArg;
    }

    if (notRetarded) {
        getResultSetsNotRetarded(oldSQLArg, newSQLArg, oldCatNum, newCatNum);
    } else {
        getResultSets(oldSQLArg, newSQLArg);
    }

    try {

        boolean hasOldRec = oldDBRS.next();
        boolean hasNewRec = newDBRS.next();

        if (!hasOldRec && !hasNewRec) {
            return StatusType.COMPARE_OK;
        }

        if (!hasOldRec) {
            if (nullsAreOK) {
                log.error(desc + " - No Old Record for [" + oldCatNum + "]");
                tblWriter.logErrors(oldCatNum, "No Old Record");
                return StatusType.NO_OLD_REC;
            }
            return StatusType.COMPARE_OK;
        }
        if (!hasNewRec) {
            log.error(desc + " - No New Record for [" + newCatNum + "]");
            tblWriter.logErrors(newCatNum, "No New Record");
            return StatusType.NO_NEW_REC;
        }

        //check number of rows, if not equal don't try to compare
        oldDBRS.last();
        newDBRS.last();
        if (oldDBRS.getRow() != newDBRS.getRow()) {
            String msg = desc + " Cat Num [" + oldCatNum + "]: Sp5 DB has " + oldDBRS.getRow()
                    + " related records. Sp6 DB has " + newDBRS.getRow();
            log.error(msg);
            tblWriter.logErrors(newCatNum, msg);
            return oldDBRS.getRow() < newDBRS.getRow() ? StatusType.NO_NEW_REC : StatusType.NO_OLD_REC;
        }
        oldDBRS.first();
        newDBRS.first();

        String oldNewIdStr = oldCatNum + " / " + newCatNum;

        boolean checkForAgent = newSQL.indexOf("a.LastName") > -1;

        ResultSetMetaData oldRsmd = oldDBRS.getMetaData();
        ResultSetMetaData newRsmd = newDBRS.getMetaData();

        PartialDateConv datePair = new PartialDateConv();
        Calendar cal = Calendar.getInstance();
        StringBuilder errSB = new StringBuilder();

        while (hasNewRec && hasOldRec) {
            errSB.setLength(0);

            int oldColInx = 0;
            int newColInx = 0;
            String idMsgStr = "";

            int numCols = newRsmd.getColumnCount();

            for (int col = 0; col < numCols; col++) {
                newColInx++;
                oldColInx++;

                if (dbg) {
                    System.out.println("\ncol       " + col + " / " + oldRsmd.getColumnCount());
                    System.out.println("newColInx " + newColInx);
                    System.out.println("oldColInx " + oldColInx);
                    System.out.println(oldRsmd.getColumnName(oldColInx));
                    System.out.println(newRsmd.getColumnName(newColInx));
                }

                Object newObj = newDBRS.getObject(newColInx);
                Object oldObj = oldDBRS.getObject(oldColInx);

                if (oldObj == null && newObj == null) {
                    String colName = newRsmd.getColumnName(newColInx);

                    if (StringUtils.contains(colName, "Date")
                            && StringUtils.contains(newRsmd.getColumnName(newColInx + 1), "DatePrecision")) {
                        newColInx++;
                        numCols--;
                        if (compareTo6DBs)
                            oldColInx++;
                    }
                    continue;
                }

                if (col == 0) {
                    idMsgStr = String.format(" - Rec Ids[%s / %s] ", (oldObj != null ? oldObj : -1),
                            (newObj != null ? newObj : -1));
                    continue;
                }

                String oldColName = oldRsmd.getColumnName(oldColInx);
                if (oldColName.equals("PreparationMethod") && newObj != null) {
                    String newObjStr = newObj.toString();
                    if ((oldObj == null && !newObjStr.equalsIgnoreCase("Misc"))
                            || (oldObj != null && !newObjStr.equalsIgnoreCase(oldObj.toString()))) {
                        String msg = idMsgStr + "Old Value was null and shouldn't have been for Old CatNum ["
                                + oldCatNum + "] Field [" + oldColName + "] oldObj[" + oldObj + "] newObj ["
                                + newObj + "]";
                        log.error(desc + " - " + msg);
                        tblWriter.logErrors(oldCatNum, msg);
                        return StatusType.OLD_VAL_NULL;
                    }
                    continue;
                }

                if (oldObj == null && !StringUtils.contains(oldColName, "LastName")) {
                    if (!oldColName.equals("PreparationMethod") || !newObj.equals("Misc")) {
                        String msg = idMsgStr + "Old Value was null and shouldn't have been for Old CatNum ["
                                + oldCatNum + "] Field [" + oldColName + "]  New Val[" + newObj + "]";
                        log.error(desc + " - " + msg);
                        tblWriter.logErrors(oldCatNum, msg);
                        return StatusType.OLD_VAL_NULL;
                    }
                }

                if (newObj == null) {
                    String clsName = newRsmd.getColumnClassName(newColInx);
                    String colName = newRsmd.getColumnName(newColInx);

                    if (compareTo6DBs) {
                        if (!clsName.equals("java.sql.Date") || oldObj != null) {
                            String msg = "New Value was null and shouldn't have been for Key Value New CatNo["
                                    + newCatNum + "] Field [" + colName + "] [" + oldObj + "]";
                            log.error(desc + " - " + msg);
                            tblWriter.logErrors(newCatNum, msg);
                            return StatusType.NEW_VAL_NULL;
                        }

                    } else {
                        if (!clsName.equals("java.sql.Date")
                                || (!(oldObj instanceof String) && ((Number) oldObj).intValue() != 0)) {
                            String msg = "New Value was null and shouldn't have been for Key Value New CatNo["
                                    + newCatNum + "] Field [" + colName + "] [" + oldObj + "]";
                            log.error(desc + " - " + msg);
                            if (tblWriter != null && newCatNum != null && msg != null)
                                tblWriter.logErrors(newCatNum, msg);
                            dbg = true;
                            return StatusType.NEW_VAL_NULL;
                        }
                    }

                    if (StringUtils.contains(colName, "Date")
                            && StringUtils.contains(newRsmd.getColumnName(newColInx + 1), "DatePrecision")) {
                        newColInx++;
                        numCols--;
                        if (compareTo6DBs)
                            oldColInx++;
                    }
                    continue;
                }

                //String colName = newRsmd.getColumnName(col);
                //System.out.println(newObj.getClass().getName()+"  "+oldObj.getClass().getName());

                if (newObj instanceof java.sql.Date) {
                    boolean isPartialDate = false;
                    Byte partialDateType = null;
                    if (StringUtils.contains(newRsmd.getColumnName(newColInx + 1), "DatePrecision")) {
                        newColInx++;
                        numCols--;
                        partialDateType = newDBRS.getByte(newColInx);
                        isPartialDate = true;
                    }

                    if (compareTo6DBs) {
                        Object dateObj = oldDBRS.getObject(oldColInx);

                        boolean isPartialDate2 = false;
                        Byte partialDateType2 = null;
                        if (StringUtils.contains(oldRsmd.getColumnName(oldColInx + 1), "DatePrecision")) {
                            oldColInx++;
                            partialDateType2 = newDBRS.getByte(oldColInx);
                            isPartialDate2 = true;

                        } else {
                            log.error("Next isn't DatePrecision and can't be!");
                            tblWriter.logErrors(oldNewIdStr, errSB.toString());
                        }

                        if (!newObj.equals(dateObj)
                                || (isPartialDate2 && !partialDateType2.equals(partialDateType))) {
                            errSB.insert(0, oldColName + "  ");
                            errSB.append("[");
                            errSB.append(datePair);
                            errSB.append("][");
                            errSB.append(dateFormatter.format((Date) newObj));
                            errSB.append("] oldDate[");
                            errSB.append(dateFormatter.format((Date) dateObj));
                            errSB.append("]");
                            log.error(errSB.toString());
                            tblWriter.logErrors(oldNewIdStr, errSB.toString());
                            return StatusType.BAD_DATE;
                        }

                    } else {
                        int oldIntDate = oldDBRS.getInt(oldColInx);
                        if (oldIntDate == 0) {
                            continue;
                        }

                        BasicSQLUtils.getPartialDate(oldIntDate, datePair, false);

                        if (partialDateType != null) {
                            boolean ok = StringUtils.isNotEmpty(datePair.getPartial())
                                    && StringUtils.isNumeric(datePair.getPartial());
                            if (!ok || (Byte.parseByte(datePair.getPartial()) != partialDateType.byteValue())) {
                                errSB.append("Partial Dates Type do not match. Old[" + datePair.getPartial()
                                        + "]  New [" + partialDateType.byteValue() + "]");
                                // error partial dates don't match
                            }
                        }

                        cal.setTime((Date) newObj);

                        if (StringUtils.isNotEmpty(datePair.getDateStr())
                                && !datePair.getDateStr().equalsIgnoreCase("null")) {
                            int year = Integer.parseInt(datePair.getDateStr().substring(0, 4));
                            int mon = Integer.parseInt(datePair.getDateStr().substring(5, 7));
                            int day = Integer.parseInt(datePair.getDateStr().substring(8, 10));

                            if (mon > 0)
                                mon--;

                            boolean isYearOK = true;

                            int yr = cal.get(Calendar.YEAR);
                            if (year != yr) {
                                errSB.append("Year mismatch Old[" + year + "]  New [" + yr + "] ");
                                isYearOK = false;
                            }

                            if (mon != cal.get(Calendar.MONTH)) {
                                errSB.append("Month mismatch Old[" + mon + "]  New [" + cal.get(Calendar.MONTH)
                                        + "] ");
                            }

                            if (day != cal.get(Calendar.DAY_OF_MONTH)) {
                                errSB.append("Day mismatch Old[" + day + "]  New ["
                                        + cal.get(Calendar.DAY_OF_MONTH) + "] ");
                            }

                            if (errSB.length() > 0 && (!isYearOK || !isPartialDate)) {
                                errSB.insert(0, oldColName + "  ");
                                errSB.append("[");
                                errSB.append(datePair);
                                errSB.append("][");
                                errSB.append(dateFormatter.format((Date) newObj));
                                errSB.append("]");
                                log.error(errSB.toString());
                                tblWriter.logErrors(oldNewIdStr, errSB.toString());
                                return StatusType.BAD_DATE;
                            }
                        } else {
                            //String msg = "Date contains the string 'NULL'";
                            //log.error(msg);
                            //tblWriter.logErrors(oldNewIdStr, msg);
                            //return StatusType.BAD_DATE;
                        }
                    }
                } else if (newObj instanceof Float || newObj instanceof Double) {
                    String s1 = String.format("%10.5f",
                            newObj instanceof Float ? (Float) newObj : (Double) newObj);
                    String s2 = String.format("%10.5f",
                            oldObj instanceof Float ? (Float) oldObj : (Double) oldObj);
                    if (!s1.equals(s2)) {
                        String msg = idMsgStr + "Columns don't compare[" + s1 + "][" + s2 + "]  ["
                                + newRsmd.getColumnName(col) + "][" + oldRsmd.getColumnName(oldColInx) + "]";
                        log.error(desc + " - " + msg);
                        tblWriter.logErrors(oldNewIdStr, msg);
                        return StatusType.NO_COMPARE;
                    }

                } else {
                    String newColName = newRsmd.getColumnName(newColInx);
                    if (checkForAgent && StringUtils.contains(newColName, "LastName")) {
                        String lastName = oldDBRS.getString(oldColInx);
                        String agentName = oldDBRS.getString(oldColInx + 1); // The 'Name' Column
                        String newLastName = newDBRS.getString(newColInx);
                        if (!newLastName.equals(lastName) && !newLastName.equals(agentName)) {
                            String msg = idMsgStr + "Name Columns don't compare[" + newObj + "][" + oldObj
                                    + "]  [" + newColName + "][" + oldColName + "]";
                            log.error(desc + " - " + msg);
                            tblWriter.logErrors(oldNewIdStr, msg);
                            log.error(oldSQLArg + "\n" + newSQLArg);
                            return StatusType.NO_COMPARE;
                        }

                    } else if (StringUtils.contains(newColName, "YesNo")) {
                        boolean yesNoNew = newDBRS.getBoolean(newColInx);
                        boolean yesNoOld = oldDBRS.getInt(oldColInx) != 0;

                        if (yesNoNew != yesNoOld) {
                            String msg = idMsgStr + "Columns don't Cat Num[" + oldCatNum + "] compare["
                                    + yesNoNew + "][" + yesNoOld + "]  [" + newColName + "][" + oldColName
                                    + "]";
                            log.error(desc + " - " + msg);
                            tblWriter.logErrors(oldNewIdStr, msg);
                            return StatusType.NO_COMPARE;
                        }

                    } else if (!newObj.equals(oldObj)) {
                        String msg = idMsgStr + "Columns don't Cat Num[" + oldCatNum + "] compare[" + newObj
                                + "][" + oldObj + "]  [" + newColName + "][" + oldColName + "]";
                        log.error(desc + " - " + msg);
                        tblWriter.logErrors(oldNewIdStr, msg);
                        return StatusType.NO_COMPARE;

                        /*boolean isOK = false;
                        if (oldObj instanceof String)
                        {
                        String oldStr = (String)oldObj;
                        String newStr = (String)newObj;
                        String lof    = "\\r\\n";
                        int    inx    = newStr.indexOf(lof);
                        if (inx > -1)
                        {
                            String tok = oldStr.substring(0, inx);
                            if (newStr.equals(tok))
                            {
                                isOK = true;
                            }
                        }
                        }
                        if (!isOK)
                        {
                        log.error(desc+ " - Columns don't compare["+newObj+"]["+oldObj+"]  ["+newRsmd.getColumnName(newColInx)+"]["+oldRsmd.getColumnName(oldColInx)+"]");
                        return false;
                        }*/
                    }
                }
            }

            hasOldRec = oldDBRS.next();
            hasNewRec = newDBRS.next();

            if (!hasOldRec && !hasNewRec) {
                return StatusType.COMPARE_OK;
            }

            if (!hasOldRec) {
                log.error(desc + idMsgStr + " - No Old Record for [" + oldCatNum + "]");
                tblWriter.logErrors(oldNewIdStr, "No Old Record for [" + oldCatNum + "]");
                return StatusType.NO_OLD_REC;
            }
            if (!hasNewRec) {
                log.error(desc + idMsgStr + " No New Record for [" + newCatNum + "]");
                tblWriter.logErrors(oldNewIdStr, "No New Record for [" + newCatNum + "]");
                return StatusType.NO_NEW_REC;
            }
        }
    } finally {
        doneWithRS();
    }

    return StatusType.COMPARE_OK;
}