Examples of ImportException


Examples of org.newinstance.gucoach.exception.ImportException

        final String[] firstLineInFile = fileContent.get(0);
        // data is in first cell
        final String dateLine = firstLineInFile[0];

        if (StringUtils.isBlank(dateLine)) {
            throw new ImportException(ResourceLoader.getMessage(MessageId.E005.getMessageKey()));
        } else {
            int dateStartPosition = 0;
            for (int i = 0; i < dateLine.length(); i++) {
                if (Character.isDigit(dateLine.charAt(i))) {
                    dateStartPosition = i;
                    break;
                }
            }

            // TODO this date format is valid in some countries only - maybe we have to try other formats as well
            final SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
            final Date date = df.parse(dateLine, new ParsePosition(dateStartPosition));
            if (date == null) {
                final String message = ResourceLoader.getMessage(MessageId.E006.getMessageKey(), dateLine.substring(dateStartPosition, dateLine.length() + 1));
                throw new ImportException(message);
            }
            // set import date for later use
            importDate = date;
        }
    }
View Full Code Here

Examples of org.rhq.enterprise.server.sync.ImportException

                            //fail fast on the import errors... This runs in a single transaction
                            //so all imports done so far will get rolled-back.
                            //(Even if we change our minds later and run a transaction per importer
                            //we should fail fast to prevent further damage due to possible
                            //constraint violations in the db, etc.)
                            throw new ImportException("Import failed.", e);
                        }
                    }
                    break;
                }
            }
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.