Package javax.jdo

Examples of javax.jdo.JDODataStoreException


        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here


        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here

        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here

        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here

            {
                if (jpe.getNestedExceptions() != null)
                {
                    if (jpe.getFailedObject() != null)
                    {
                        return new JDODataStoreException(jpe.getMessage(), jpe.getNestedExceptions(), jpe.getFailedObject());
                    }
                    return new JDODataStoreException(jpe.getMessage(), jpe.getNestedExceptions());
                }
                else if (jpe.getFailedObject() != null)
                {
                    return new JDODataStoreException(jpe.getMessage(), jpe.getFailedObject());
                }
                else
                {
                    return new JDODataStoreException(jpe.getMessage(), jpe);
                }
            }
        }
        else if (jpe instanceof JPOXObjectNotFoundException)
        {           
            //sadly JDOObjectNotFoundException dont allow nested exceptions and failed objects together
            if (jpe.getFailedObject() != null)
            {
                return new JDOObjectNotFoundException(jpe.getMessage(), jpe.getFailedObject());
            }
            else if (jpe.getNestedExceptions() != null)
            {
                return new JDOObjectNotFoundException(jpe.getMessage(), jpe.getNestedExceptions());
            }
            else
            {
                return new JDOFatalDataStoreException(jpe.getMessage(), jpe);
            }
        }
        else if (jpe instanceof JPOXUserException)
        {
            if (jpe.isFatal())
            {
                if (jpe.getNestedExceptions() != null)
                {
                    if (jpe.getFailedObject() != null)
                    {
                        return new JDOFatalUserException(jpe.getMessage(), jpe.getNestedExceptions(), jpe.getFailedObject());
                    }
                    return new JDOFatalUserException(jpe.getMessage(), jpe.getNestedExceptions());
                }
                else if (jpe.getFailedObject() != null)
                {
                    return new JDOFatalUserException(jpe.getMessage(), jpe.getFailedObject());
                }
                else
                {
                    return new JDOFatalUserException(jpe.getMessage(), jpe);
                }
            }
            else
            {
                if (jpe.getNestedExceptions() != null)
                {
                    if (jpe.getFailedObject() != null)
                    {
                        return new JDOUserException(jpe.getMessage(), jpe.getNestedExceptions(), jpe.getFailedObject());
                    }
                    return new JDOUserException(jpe.getMessage(), jpe.getNestedExceptions());
                }
                else if (jpe.getFailedObject() != null)
                {
                    return new JDOUserException(jpe.getMessage(), jpe.getFailedObject());
                }
                else
                {
                    return new JDOUserException(jpe.getMessage(), jpe);
                }
            }
        }
        else if (jpe instanceof JPOXOptimisticException)
        {
            //sadly JDOOptimisticVerificationException dont allow nested exceptions and failed objects together
            if (jpe.getFailedObject() != null)
            {
                return new JDOOptimisticVerificationException(jpe.getMessage(), jpe.getFailedObject());
            }
            else if (jpe.getNestedExceptions() != null)
            {
                return new JDOOptimisticVerificationException(jpe.getMessage(), jpe.getNestedExceptions());
            }
            else
            {
                return new JDOOptimisticVerificationException(jpe.getMessage(), jpe);
            }
        }
        else if (jpe instanceof org.jpox.transaction.HeuristicRollbackException
                && jpe.getNestedExceptions().length==1
                && jpe.getNestedExceptions()[0].getCause() instanceof SQLException)
        {
            // if there was a single failure in the transaction, we want to properly propagate the
            // single nested SQLException that was the cause of the failure, so application code
            // can decide on what to do with it
            return new JDODataStoreException(jpe.getMessage(), ((XAException)jpe.getNestedExceptions()[0]).getCause());
        }
        else
        {
            if (jpe.isFatal())
            {
View Full Code Here

    private void assertNotRollbackOnly()
    {
        if (rollbackOnlyFlag)
        {
            throw new JDODataStoreException("Rollback Only !");
        }
    }
View Full Code Here

        {
            return new JDOQueryInterruptedException(ne.getMessage());
        }
        else if (ne instanceof QueryTimeoutException)
        {
            return new JDODataStoreException(ne.getMessage(), ne);
        }
        else if (ne instanceof NucleusUnsupportedOptionException)
        {
            return new JDOUnsupportedOptionException(ne.getMessage(), ne);
        }
        else if (ne instanceof DatastoreReadOnlyException)
        {
            ClassLoaderResolver clr = ((DatastoreReadOnlyException)ne).getClassLoaderResolver();
            try
            {
                Class cls = clr.classForName("javax.jdo.JDOReadOnlyException");
                throw (JDOUserException)ClassUtils.newInstance(cls,
                    new Class[] {String.class}, new Object[] {ne.getMessage()});
            }
            catch (NucleusException ne2)
            {
                // No JDOReadOnlyException so JDO1.0-JDO2.1
                throw new JDOUserException(ne2.getMessage());
            }
        }
        else if (ne instanceof NucleusDataStoreException)
        {
            if (ne.isFatal())
            {
                //sadly JDOFatalDataStoreException dont allow nested exceptions and failed objects together
                if (ne.getFailedObject() != null)
                {
                    return new JDOFatalDataStoreException(ne.getMessage(), ne.getFailedObject());
                }
                else if (ne.getNestedExceptions() != null)
                {
                    return new JDOFatalDataStoreException(ne.getMessage(), ne.getNestedExceptions());
                }
                else
                {
                    return new JDOFatalDataStoreException(ne.getMessage(), ne);
                }
            }
            else
            {
                if (ne.getNestedExceptions() != null)
                {
                    if (ne.getFailedObject() != null)
                    {
                        return new JDODataStoreException(ne.getMessage(), ne.getNestedExceptions(), ne.getFailedObject());
                    }
                    return new JDODataStoreException(ne.getMessage(), ne.getNestedExceptions());
                }
                else if (ne.getFailedObject() != null)
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDODataStoreException(ne.getMessage(), ne.getFailedObject());
                }
                else
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDODataStoreException(ne.getMessage(), ne);
                }
            }
        }
        else if (ne instanceof NucleusObjectNotFoundException)
        {
            if (ne.getFailedObject() != null)
            {
                if (ne.getNestedExceptions() != null)
                {
                    return new JDOObjectNotFoundException(ne.getMessage(), ne.getNestedExceptions(), ne.getFailedObject());
                }
                else
                {
                    return new JDOObjectNotFoundException(ne.getMessage(), ne, ne.getFailedObject());
                }
            }
            else if (ne.getNestedExceptions() != null)
            {
                return new JDOObjectNotFoundException(ne.getMessage(), ne.getNestedExceptions());
            }
            else
            {
                return new JDOObjectNotFoundException(ne.getMessage(), new Throwable[]{ne});
            }
        }
        else if (ne instanceof NucleusCanRetryException)
        {
            if (ne.getNestedExceptions() != null)
            {
                if (ne.getFailedObject() != null)
                {
                    return new JDOCanRetryException(ne.getMessage(), ne.getNestedExceptions(), ne.getFailedObject());
                }
                return new JDOCanRetryException(ne.getMessage(), ne.getNestedExceptions());
            }
            else if (ne.getFailedObject() != null)
            {
                JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                return new JDOCanRetryException(ne.getMessage(), ne.getFailedObject());
            }
            else
            {
                JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                return new JDOCanRetryException(ne.getMessage(), ne);
            }
        }
        else if (ne instanceof NucleusUserException)
        {
            if (ne.isFatal())
            {
                if (ne.getNestedExceptions() != null)
                {
                    if (ne.getFailedObject() != null)
                    {
                        return new JDOFatalUserException(ne.getMessage(), ne.getNestedExceptions(), ne.getFailedObject());
                    }
                    return new JDOFatalUserException(ne.getMessage(), ne.getNestedExceptions());
                }
                else if (ne.getFailedObject() != null)
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDOFatalUserException(ne.getMessage(), ne.getFailedObject());
                }
                else
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDOFatalUserException(ne.getMessage(), ne);
                }
            }
            else
            {
                if (ne.getNestedExceptions() != null)
                {
                    if (ne.getFailedObject() != null)
                    {
                        return new JDOUserException(ne.getMessage(), ne.getNestedExceptions(), ne.getFailedObject());
                    }
                    return new JDOUserException(ne.getMessage(), ne.getNestedExceptions());
                }
                else if (ne.getFailedObject() != null)
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDOUserException(ne.getMessage(), ne.getFailedObject());
                }
                else
                {
                    JDOPersistenceManager.LOGGER.info("Exception thrown", ne);
                    return new JDOUserException(ne.getMessage(), ne);
                }
            }
        }
        else if (ne instanceof NucleusOptimisticException)
        {
            //sadly JDOOptimisticVerificationException dont allow nested exceptions and failed objects together
            if (ne.getFailedObject() != null)
            {
                return new JDOOptimisticVerificationException(ne.getMessage(), ne.getFailedObject());
            }
            else if (ne.getNestedExceptions() != null)
            {
                return new JDOOptimisticVerificationException(ne.getMessage(), ne.getNestedExceptions());
            }
            else
            {
                return new JDOOptimisticVerificationException(ne.getMessage(), ne);
            }
        }
        else if (ne instanceof org.datanucleus.transaction.HeuristicRollbackException
                && ne.getNestedExceptions().length==1
                && ne.getNestedExceptions()[0].getCause() instanceof SQLException)
        {
            // if there was a single failure in the transaction, we want to properly propagate the
            // single nested SQLException that was the cause of the failure, so application code
            // can decide on what to do with it
            return new JDODataStoreException(ne.getMessage(), ((XAException)ne.getNestedExceptions()[0]).getCause());
        }
        else
        {
            if (ne.isFatal())
            {
View Full Code Here

                    }
                    catch (SQLException e)
                    {
                        String msg = LOCALISER.msg("017006", e);
                        JPOXLogger.JDO.error(msg);
                        throw new JDODataStoreException(msg,e);
                    }
                    return mconn;
                }

                public void releaseConnection()
                {
                    try
                    {
                        // Release the connection
                        mconn.close();
                    }
                    catch (JPOXException e)
                    {
                        String msg = LOCALISER.msg("017007", e);
                        JPOXLogger.JDO.error(msg);
                        throw new JDODataStoreException(msg, e);
                    }
                }
            };
        Class cls = null;
        ConfigurationElement elem =
View Full Code Here

        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here

        }
        catch (JPOXDataStoreException dse)
        {
            if (dse.getFailedObject() != null)
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getFailedObject());
            }
            else
            {
                throw new JDODataStoreException(dse.getMessage(), dse.getNestedExceptions());
            }
        }
    }
View Full Code Here

TOP

Related Classes of javax.jdo.JDODataStoreException

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.