Package sortpom.exception

Examples of sortpom.exception.FailureException


     * @param lineSeparatorString The line separator characters
     */
    LineSeparatorUtil(final String lineSeparatorString) {
        string = lineSeparatorString.replaceAll("\\\\r", "\r").replaceAll("\\\\n", "\n");
        if (isIllegalString()) {
            throw new FailureException(
                    "LineSeparator must be either \\n, \\r or \\r\\n, but separator characters were "
                            + Arrays.toString(lineSeparatorString.getBytes()));
        }
    }
View Full Code Here


        }
        if (nrOfIndentSpace == INDENT_TAB) {
            return "\t";
        }
        if (nrOfIndentSpace < INDENT_TAB || nrOfIndentSpace > MAX_INDENT_SPACES) {
            throw new FailureException("nrOfIndentSpace cannot be below -1 or above 255, was: " + nrOfIndentSpace);
        }
        char[] chars = new char[nrOfIndentSpace];
        Arrays.fill(chars, ' ');
        return new String(chars);
    }
View Full Code Here

            if (xmlProcessingInstructionParser.existsIgnoredSections()) {
                sortedXml = xmlProcessingInstructionParser.revertIgnoredSections(sortedXml);
            }
            return sortedXml;
        } catch (IOException e) {
            throw new FailureException(errorMsg + xml, e);
        } finally {
            IOUtils.closeQuietly(sortedXmlOutputStream);
        }

    }
View Full Code Here

     * Creates the backup file for pom.
     */
    private void createBackupFile() {
        if (createBackupFile) {
            if (backupFileExtension.trim().length() == 0) {
                throw new FailureException("Could not create backup file, extension name was empty");
            }
            fileUtil.backupFile();
            log.info(String.format("Saved backup of %s to %s%s", pomFile.getAbsolutePath(),
                    pomFile.getAbsolutePath(), backupFileExtension));
        }
View Full Code Here

                    sortPom();
                    break;
                case STOP:
                    log.error(xmlOrderedResult.getErrorMessage());
                    log.error(String.format(TEXT_FILE_NOT_SORTED, pomFileName));
                    throw new FailureException(String.format(TEXT_FILE_NOT_SORTED, pomFileName));
                default:
                    log.error(xmlOrderedResult.getErrorMessage());
                    throw new IllegalStateException(verifyFailType.toString());
            }
        }
View Full Code Here

        ByteArrayInputStream originalXmlInputStream = null;
        try {
            originalXmlInputStream = new ByteArrayInputStream(xml.getBytes(encoding));
            xmlProcessor.setOriginalXml(originalXmlInputStream);
        } catch (JDOMException e) {
            throw new FailureException(errorMsg + xml, e);
        } catch (IOException e) {
            throw new FailureException(errorMsg + xml, e);
        } finally {
            IOUtils.closeQuietly(originalXmlInputStream);
        }
    }
View Full Code Here

        verifyNoMoreInteractions(sortPom);
    }

    @Test
    public void thrownExceptionShouldBeConvertedToMojoExceptionInExecute() throws MojoFailureException {
        doThrow(new FailureException("Gurka")).when(sortPom).verifyPom();
       
        expectedException.expect(MojoFailureException.class);
       
        verifyMojo.execute();
    }
View Full Code Here

        verifyMojo.execute();
    }

    @Test
    public void thrownExceptionShouldBeConvertedToMojoExceptionInSetup() throws MojoFailureException {
        doThrow(new FailureException("Gurka")).when(sortPom).setup(any(SortPomLogger.class), any(PluginParameters.class));
       
        expectedException.expect(MojoFailureException.class);
       
        verifyMojo.setup();
    }
View Full Code Here

        verifyNoMoreInteractions(sortPom);
    }

    @Test
    public void thrownExceptionShouldBeConvertedToMojoException() throws MojoFailureException {
        doThrow(new FailureException("Gurka")).when(sortPom).sortPom();
       
        expectedException.expect(MojoFailureException.class);
       
        sortMojo.execute();
    }
View Full Code Here

        sortMojo.execute();
    }

    @Test
    public void thrownExceptionShouldBeConvertedToMojoExceptionInSetup() throws MojoFailureException {
        doThrow(new FailureException("Gurka")).when(sortPom).setup(any(SortPomLogger.class), any(PluginParameters.class));
       
        expectedException.expect(MojoFailureException.class);
       
        sortMojo.setup();
    }
View Full Code Here

TOP

Related Classes of sortpom.exception.FailureException

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.