Skip to content

Commit 1a7748b

Browse files
committed
fix some javadoc and try with resources coverage results
1 parent 74f0701 commit 1a7748b

4 files changed

Lines changed: 15 additions & 8 deletions

File tree

jooby-hotreload/src/main/java/org/jooby/Watcher.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttribut
9191
});
9292
}
9393

94-
/**
95-
* Creates a WatchService and registers the given directory
96-
*/
9794
public Watcher(final BiConsumer<Kind<?>, Path> listener, final Path... dirs)
9895
throws IOException {
9996
this.watcher = FileSystems.getDefault().newWatchService();

jooby-jdbc/src/main/java/org/jooby/jdbc/Jdbc.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ private Optional<String> dbtype(final String key, final Config config) {
307307
*
308308
* @param type A type to bind.
309309
* @param callback A generated key.
310+
* @param <T> Consumer type.
310311
*/
311312
protected final <T> void keys(final Class<T> type, final Consumer<Key<T>> callback) {
312313
if (DEFAULT_DB.equals(dbName)) {

jooby-jedis/src/main/java/org/jooby/jedis/RedisSessionStore.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ public RedisSessionStore(final JedisPool pool,
133133

134134
@Override
135135
public Session get(final Builder builder) {
136-
try (Jedis jedis = pool.getResource()) {
136+
Jedis jedis = pool.getResource();
137+
try {
137138
String key = key(builder.sessionId());
138139
Map<String, String> attrs = jedis.hgetAll(key);
139140
if (timeout > 0) {
@@ -146,12 +147,15 @@ public Session get(final Builder builder) {
146147
.savedAt(Long.parseLong(attrs.remove("_savedAt")))
147148
.set(attrs)
148149
.build();
150+
} finally {
151+
jedis.close();
149152
}
150153
}
151154

152155
@Override
153156
public void save(final Session session) {
154-
try (Jedis jedis = pool.getResource()) {
157+
Jedis jedis = pool.getResource();
158+
try {
155159
String key = key(session);
156160
Map<String, String> attrs = new HashMap<>(session.attributes());
157161
attrs.put("_createdAt", Long.toString(session.createdAt()));
@@ -161,6 +165,8 @@ public void save(final Session session) {
161165
if (timeout > 0) {
162166
jedis.expire(key, timeout);
163167
}
168+
} finally {
169+
jedis.close();
164170
}
165171
}
166172

@@ -171,8 +177,11 @@ public void create(final Session session) {
171177

172178
@Override
173179
public void delete(final String id) {
174-
try (Jedis jedis = pool.getResource()) {
180+
Jedis jedis = pool.getResource();
181+
try {
175182
jedis.del(key(id));
183+
} finally {
184+
jedis.close();
176185
}
177186

178187
}

jooby/src/main/java/org/jooby/spi/NativeResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ public interface NativeResponse {
8383
* property file.
8484
* If the <code>Content-Length</code> header was set and it is less than buffer size, the
8585
* the <code>Content-Length</code> will be used it as buffer size.
86-
* @return
87-
* @throws IOException
86+
* @return An output stream.
87+
* @throws IOException If output stream can be acquire it.
8888
*/
8989
OutputStream out(int bufferSize) throws IOException;
9090

0 commit comments

Comments
 (0)