Package com.salesforce.dataloader.exception

Examples of com.salesforce.dataloader.exception.DataAccessObjectInitializationException


            }
        } catch (SQLException sqe) {
            String errMsg = Messages.getFormattedString("DatabaseDAO.sqlExceptionConnect", new String[] { dbConfigName,
                    sqe.getMessage() });
            logger.error(errMsg, sqe);
            throw new DataAccessObjectInitializationException(errMsg, sqe);
        }
    }
View Full Code Here


            return dataStatement;
        } catch (SQLException sqe) {
            String errMsg = Messages.getFormattedString("DatabaseDAO.sqlExceptionPrepareStatement", new String[] {
                    dbConfigName, sqe.getMessage() });
            logger.error(errMsg, sqe);
            throw new DataAccessObjectInitializationException(errMsg, sqe);
        }
    }
View Full Code Here

            currentRowNumber = 0;
            setOpen(true);
        } catch (IOException e) {
            String errMsg = Messages.getFormattedString("CSVWriter.errorOpening", this.fileName);
            logger.error(errMsg, e);
            throw new DataAccessObjectInitializationException(errMsg, e);
        }
    }
View Full Code Here

            fileOut.newLine();
            visitor.newRow();
        } catch (IOException e) {
            String errMsg = Messages.getString("CSVWriter.errorWriting");
            logger.error(errMsg, e);
            throw new DataAccessObjectInitializationException(errMsg, e);
        }
    }
View Full Code Here

    @Override
    public synchronized void setColumnNames(List<String> columnNames) throws DataAccessObjectInitializationException {
        if(columnNames == null || columnNames.isEmpty()){
            String errMsg = Messages.getString("CSVFileDAO.errorOpenNoHeaderRow");
            logger.error(errMsg);
            throw new DataAccessObjectInitializationException(errMsg);
        }
        // save column names
        this.columnNames = columnNames;

        writeHeaderRow();
View Full Code Here

            synchronized (lock) {
                headerRow = csvReader.nextRecord();
            }
            if (headerRow == null) {
                LOGGER.error(Messages.getString("CSVFileDAO.errorHeaderRow"));
                throw new DataAccessObjectInitializationException(Messages.getString("CSVFileDAO.errorHeaderRow"));
            }
        } catch (IOException e) {
            String errMsg = Messages.getString("CSVFileDAO.errorHeaderRow");
            LOGGER.error(errMsg, e);
            throw new DataAccessObjectInitializationException(errMsg, e);
        } finally {
            // if there's a problem getting header row, the stream needs to be closed
            if (headerRow == null) {
                IOUtils.closeQuietly(input);
            }
View Full Code Here

            csvReader.setMaxRowsInFile(Integer.MAX_VALUE);
            csvReader.setMaxCharsInFile(Integer.MAX_VALUE);
        } catch (FileNotFoundException e) {
            String errMsg = Messages.getFormattedString("CSVFileDAO.errorOpen", file.getAbsolutePath());
            LOGGER.error(errMsg, e);
            throw new DataAccessObjectInitializationException(errMsg, e);
        } catch (UnsupportedEncodingException e) {
            String errMsg = Messages.getString("CSVFileDAO.errorUnsupportedEncoding");
            LOGGER.error(errMsg, e);
            throw new DataAccessObjectInitializationException(errMsg, e);
        } finally {
            if(csvReader == null) {
                IOUtils.closeQuietly(input);
            }
        }
View Full Code Here

        try {
            runProcess(argMap, 0);
            // fail("Did not expect empty CSV file to succeed");
        } catch (RuntimeException e) {
            if (e.getCause() instanceof DataAccessObjectInitializationException) {
                DataAccessObjectInitializationException ex = (DataAccessObjectInitializationException) e.getCause();
                String actualMessage = ex.getMessage();
                assertTrue("Wrong exception message: " + actualMessage,
                        actualMessage != null && actualMessage.contains("some error string"));
            } else {
                throw new RuntimeException("Wrong exception was thrown while processing empty CSV", e);
            }
View Full Code Here

        if (!(dao instanceof DataReader)) {
            final String errMsg = getMessage("errorWrongDao", getConfig().getString(Config.DAO_TYPE),
                    DataAccessObjectFactory.CSV_READ_TYPE + " or " + DataAccessObjectFactory.DATABASE_READ_TYPE,
                    getConfig().getString(Config.OPERATION));
            getLogger().fatal(errMsg);
            throw new DataAccessObjectInitializationException(errMsg);
        }
    }
View Full Code Here

     * @throws DataAccessObjectInitializationException
     */
    private DataWriter createErrorWriter() throws DataAccessObjectInitializationException {
        final String filename = getConfig().getString(Config.OUTPUT_ERROR);
        if (filename == null || filename.length() == 0)
            throw new DataAccessObjectInitializationException(getMessage("errorMissingErrorFile"));
        // TODO: Make sure that specific DAO is not mentioned: use DataReader, DataWriter, or DataAccessObject
        return new CSVFileWriter(filename, getConfig());
    }
View Full Code Here

TOP

Related Classes of com.salesforce.dataloader.exception.DataAccessObjectInitializationException

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.