Search in sources :

Example 1 with EmptyLineAndCommentSkippingInputStream

use of liquibase.io.EmptyLineAndCommentSkippingInputStream in project liquibase by liquibase.

the class LoadDataChange method generateCheckSum.

@Override
public CheckSum generateCheckSum() {
    InputStream stream = null;
    try {
        stream = Scope.getCurrentScope().getResourceAccessor().openStream(getRelativeTo(), file);
        if (stream == null) {
            throw new UnexpectedLiquibaseException(String.format(coreBundle.getString("file.not.found"), file));
        }
        stream = new EmptyLineAndCommentSkippingInputStream(stream, commentLineStartsWith);
        return CheckSum.compute(getTableName() + ":" + CheckSum.compute(stream, /*standardizeLineEndings*/
        true));
    } catch (IOException e) {
        throw new UnexpectedLiquibaseException(e);
    } finally {
        if (stream != null) {
            try {
                stream.close();
            } catch (IOException ignore) {
            // Do nothing
            }
        }
    }
}
Also used : EmptyLineAndCommentSkippingInputStream(liquibase.io.EmptyLineAndCommentSkippingInputStream) InputStream(java.io.InputStream) EmptyLineAndCommentSkippingInputStream(liquibase.io.EmptyLineAndCommentSkippingInputStream) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 EmptyLineAndCommentSkippingInputStream (liquibase.io.EmptyLineAndCommentSkippingInputStream)1