Skip to content
Permalink
Browse files

Fixed checkstyle violations

  • Loading branch information...
lwj5 committed Oct 10, 2019
1 parent 4ef78f7 commit 32fa6c371f61ee7bac58dd33ff9957a5cc716656
@@ -196,10 +196,6 @@
<phase>validate</phase>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>false</consoleOutput>
<failsOnError>false</failsOnError>
<failOnViolation>false</failOnViolation>
</configuration>
<goals>
<goal>check</goal>
@@ -188,15 +188,15 @@ protected final synchronized ContentType getContentType(final HttpEntity entity)
}

if (contentType == null) {
try (final TikaInputStream stream = TikaInputStream.get(bytes)) {
try (TikaInputStream stream = TikaInputStream.get(bytes)) {
final Tika tika = new Tika();
final String fileType = tika.detect(stream);
contentType = ContentType.create(fileType);
}
}

if (contentType.getCharset() == null) {
try (final TikaInputStream stream = TikaInputStream.get(bytes)) {
try (TikaInputStream stream = TikaInputStream.get(bytes)) {
final CharsetMatch match = new CharsetDetector()
.setText(stream)
.detect();
@@ -91,7 +91,7 @@ private String write(final InputStream in, final File parentDir, final String fi
throw new IOException("The path is not a dir: " + parentDir);
}
final File htmlFile = new File(parentDir, filename);
try (final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(htmlFile))) {
try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(htmlFile))) {
IOUtils.copy(in, out);
}

@@ -140,8 +140,8 @@ private DataSource setupDataSource(final String url, final String username, fina
* @param table name of table in the database to use for record storage
*/
private void ensureTable(final String table) {
try (final Connection conn = dataSource.getConnection();
final Statement statement = conn.createStatement()) {
try (Connection conn = dataSource.getConnection();
Statement statement = conn.createStatement()) {
final String sql = "CREATE TABLE IF NOT EXISTS `" + table + "` ("
+ "`id` int(11) NOT NULL AUTO_INCREMENT,\n"
+ "`url` varchar(1024) NOT NULL,\n"
@@ -181,7 +181,7 @@ private void createFile(final InputStream in, final File recordDir, final String
throw new IOException("The record path is not a dir: " + recordDir);
}
final File recordFile = new File(recordDir, recordName);
try (final BufferedOutputStream out = new BufferedOutputStream(
try (BufferedOutputStream out = new BufferedOutputStream(
new GZIPOutputStream(new FileOutputStream(recordFile)))) {
IOUtils.copy(in, out);
}
@@ -418,8 +418,8 @@ public final String put(final Request request, final Response response) throws S

@Override
public final Record<Integer> get(final Integer id) throws StorageException {
try (final Connection conn = dataSource.getConnection();
final PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM `" + table + "` WHERE id = ?")) {
try (Connection conn = dataSource.getConnection();
PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM `" + table + "` WHERE id = ?")) {
pstmt.setInt(1, id);
final ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
@@ -436,8 +436,8 @@ public final String put(final Request request, final Response response) throws S

@Override
public final Record<Integer> get(final Request request) throws StorageException {
try (final Connection conn = dataSource.getConnection();
final PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM `" + table + "` "
try (Connection conn = dataSource.getConnection();
PreparedStatement pstmt = conn.prepareStatement("SELECT * FROM `" + table + "` "
+ "WHERE url = ? "
+ "AND method = ? "
+ "AND request_headers = CAST(? AS JSON) "

0 comments on commit 32fa6c3

Please sign in to comment.
You can’t perform that action at this time.