Package org.dbunit.dataset.datatype

Examples of org.dbunit.dataset.datatype.TypeCastException


            Method setValueMethod = aPGObjectClass.getMethod("setValue", new Class[]{String.class});
            setValueMethod.invoke(tempEnum, new Object[]{value.toString()});

        } catch (ClassNotFoundException e) {
            throw new TypeCastException(value, this, e);
        } catch (InvocationTargetException e) {
            throw new TypeCastException(value, this, e);
        } catch (NoSuchMethodException e) {
            throw new TypeCastException(value, this, e);
        } catch (IllegalAccessException e) {
            throw new TypeCastException(value, this, e);
        } catch (InstantiationException e) {
            throw new TypeCastException(value, this, e);
        }

        return tempEnum;
    }
View Full Code Here


        try {
            Class aPGIntervalClass = super.loadClass("org.postgresql.util.PGInterval", connection);
            Constructor ct = aPGIntervalClass.getConstructor(new Class[]{String.class});
            tempInterval = ct.newInstance(new Object[]{value});
        } catch (ClassNotFoundException e) {
            throw new TypeCastException(value, this, e);
        } catch (InvocationTargetException e) {
            throw new TypeCastException(value, this, e);
        } catch (NoSuchMethodException e) {
            throw new TypeCastException(value, this, e);
        } catch (IllegalAccessException e) {
            throw new TypeCastException(value, this, e);
        } catch (InstantiationException e) {
            throw new TypeCastException(value, this, e);
        }

        return tempInterval;
    }
View Full Code Here

            Method setValueMethod = aPGObjectClass.getMethod("setValue", new Class[]{String.class});
            setValueMethod.invoke(tempInet, new Object[]{value.toString()});

        } catch (ClassNotFoundException e) {
            throw new TypeCastException(value, this, e);
        } catch (InvocationTargetException e) {
            throw new TypeCastException(value, this, e);
        } catch (NoSuchMethodException e) {
            throw new TypeCastException(value, this, e);
        } catch (IllegalAccessException e) {
            throw new TypeCastException(value, this, e);
        } catch (InstantiationException e) {
            throw new TypeCastException(value, this, e);
        }

        return tempInet;
    }
View Full Code Here

            Method setValueMethod = aPGObjectClass.getMethod("setValue", new Class[]{String.class});
            setValueMethod.invoke(tempUUID, new Object[]{value.toString()});

        } catch (ClassNotFoundException e) {
            throw new TypeCastException(value, this, e);
        } catch (InvocationTargetException e) {
            throw new TypeCastException(value, this, e);
        } catch (NoSuchMethodException e) {
            throw new TypeCastException(value, this, e);
        } catch (IllegalAccessException e) {
            throw new TypeCastException(value, this, e);
        } catch (InstantiationException e) {
            throw new TypeCastException(value, this, e);
        }

        return tempUUID;
    }
View Full Code Here

                {
                                  statement.addValue(table.getValue(row, column.getColumnName()), column.getDataType());
                }
                                catch (TypeCastException e)
                {
                          throw new TypeCastException("Error casting value for table '" + table.getTableMetaData().getTableName()
                              +"' and column '" + column.getColumnName() + "'", e);
                }
                            }
                        }
                        statement.addBatch();
View Full Code Here

                // parse out sdo_geometry
                Matcher sdoGeometryMatcher = sdoGeometryPattern.matcher(upperVal);
                if (! sdoGeometryMatcher.find())
                {
                    throw new TypeCastException(value, this);
                }
                BigDecimal gtype = NULL.equals(sdoGeometryMatcher.group(1)) ?
                    null : new BigDecimal(sdoGeometryMatcher.group(1));
                BigDecimal srid = NULL.equals(sdoGeometryMatcher.group(2)) ?
                    null : new BigDecimal(sdoGeometryMatcher.group(2));

                // parse out sdo_point_type
                upperVal = upperVal.substring(sdoGeometryMatcher.end());
                Matcher sdoPointTypeMatcher = sdoPointTypePattern.matcher(upperVal);
                if (! sdoPointTypeMatcher.find())
                {
                    throw new TypeCastException(value, this);
                }

                OracleSdoPointType sdoPoint;
                if (NULL.equals(sdoPointTypeMatcher.group(4)))
                {
                    sdoPoint = null;
                }
                else
                {
                    sdoPoint = new OracleSdoPointType(
                        NULL.equals(sdoPointTypeMatcher.group(1)) ? null :
                            new BigDecimal(sdoPointTypeMatcher.group(1)),
                        NULL.equals(sdoPointTypeMatcher.group(2)) ? null :
                            new BigDecimal(sdoPointTypeMatcher.group(2)),
                        NULL.equals(sdoPointTypeMatcher.group(3)) ? null :
                            new BigDecimal(sdoPointTypeMatcher.group(3)));
                }

                // parse out sdo_elem_info_array
                upperVal = upperVal.substring(sdoPointTypeMatcher.end());
                Matcher sdoElemInfoArrayMatcher = sdoElemInfoArrayPattern.matcher(upperVal);
                if (! sdoElemInfoArrayMatcher.find())
                {
                    throw new TypeCastException(value, this);
                }

                OracleSdoElemInfoArray sdoElemInfoArray;
                if (NULL.equals(sdoElemInfoArrayMatcher.group(2)))
                {
                    sdoElemInfoArray = null;
                }
                else
                {
                    String [] elemInfoStrings = sdoElemInfoArrayMatcher.group(1).
                        trim().split("\\s*,\\s*");
                    if (elemInfoStrings.length == 1 && "".equals(elemInfoStrings[0]))
                    {
                        sdoElemInfoArray = new OracleSdoElemInfoArray();
                    }
                    else
                    {
                        BigDecimal [] elemInfos = new BigDecimal[elemInfoStrings.length];
                        for (int index = 0; index < elemInfoStrings.length; index++)
                        {
                            elemInfos[index] = NULL.equals(elemInfoStrings[index]) ?
                                null : new BigDecimal(elemInfoStrings[index]);
                        }
                        sdoElemInfoArray = new OracleSdoElemInfoArray(elemInfos);
                    }
                }

                // parse out sdo_ordinate_array
                upperVal = upperVal.substring(sdoElemInfoArrayMatcher.end());
                Matcher sdoOrdinateArrayMatcher = sdoOrdinateArrayPattern.matcher(upperVal);
                if (! sdoOrdinateArrayMatcher.find())
                {
                    throw new TypeCastException(value, this);
                }

                OracleSdoOrdinateArray sdoOrdinateArray;
                if (NULL.equals(sdoOrdinateArrayMatcher.group(2)))
                {
                    sdoOrdinateArray = null;
                }
                else
                {
                    String [] ordinateStrings = sdoOrdinateArrayMatcher.group(1).
                        trim().split("\\s*,\\s*");
                    if (ordinateStrings.length == 1 && "".equals(ordinateStrings[0]))
                    {
                        sdoOrdinateArray = new OracleSdoOrdinateArray();
                    }
                    else
                    {
                        BigDecimal [] ordinates = new BigDecimal[ordinateStrings.length];
                        for (int index = 0; index < ordinateStrings.length; index++)
                        {
                            ordinates[index] = NULL.equals(ordinateStrings[index]) ?
                                null : new BigDecimal(ordinateStrings[index]);
                        }
                        sdoOrdinateArray = new OracleSdoOrdinateArray(ordinates);
                    }
                }

                OracleSdoGeometry sdoGeometry = new OracleSdoGeometry(
                    gtype, srid, sdoPoint, sdoElemInfoArray, sdoOrdinateArray);

                return sdoGeometry;
            }
            catch (SQLException e)
            {
                throw new TypeCastException(value, this, e);
            }
            catch (NumberFormatException e)
            {
                throw new TypeCastException(value, this, e);
            }
        }

        throw new TypeCastException(value, this);
    }
View Full Code Here

            }

        }
        catch (SQLException e)
        {
            throw new TypeCastException(data, this, e);
        }
    }
View Full Code Here

            return compareNonNulls(value1, value2);

        }
        catch (ClassCastException e)
        {
            throw new TypeCastException(e);
        }
    }
View Full Code Here

        catch (IOException e)
        {
            // JH_TODO: shouldn't freeTemporary be called in finally {} ?
            // It wasn't done like that in the original reflection-styled DbUnit code.
            freeTemporaryClob(tempClob);
            throw new TypeCastException(value, this, e);
        }
        catch (SQLException e)
        {
            freeTemporaryClob(tempClob);
            throw new TypeCastException(value, this, e);
        }

        return tempClob;
    }
View Full Code Here

        {
            tempClob.freeTemporary();
        }
        catch (SQLException e)
        {
            throw new TypeCastException("error freeing Oracle CLOB", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.dbunit.dataset.datatype.TypeCastException

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.