Skip to content

Commit 628ce9d

Browse files
committed
[refactor] Use pattern Variable of Java14
1 parent 8ea53f9 commit 628ce9d

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

extensions/expath/src/test/java/org/expath/exist/HttpClientTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ private boolean hasInternetAccess() {
8181
try {
8282
final URL url = new URL("http://www.exist-db.org");
8383
final URLConnection con = url.openConnection();
84-
if (con instanceof HttpURLConnection) {
85-
final HttpURLConnection httpConnection = (HttpURLConnection) con;
84+
if (con instanceof HttpURLConnection httpConnection) {
8685
hasInternetAccess = (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK);
8786
}
8887
} catch(final MalformedURLException e) {

extensions/modules/file/src/test/java/org/exist/xquery/modules/file/EmbeddedBinariesTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ protected boolean isBooleanType(final Item item) throws IOException {
143143

144144
@Override
145145
protected byte[] getBytes(final Item item) throws IOException {
146-
if (item instanceof Base64BinaryDocument) {
147-
final Base64BinaryDocument doc = (Base64BinaryDocument) item;
146+
if (item instanceof Base64BinaryDocument doc) {
148147
try (final UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
149148
doc.streamBinaryTo(baos);
150149
return baos.toByteArray();

extensions/modules/sql/src/test/java/org/exist/xquery/modules/sql/ImplicitConnectionCloseIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ public static class StubDataSourceFactory implements ObjectFactory {
247247

248248
@Override
249249
public Object getObjectInstance(final Object obj, final Name name, final Context nameCtx, final Hashtable<?, ?> environment) throws Exception {
250-
if (obj instanceof Reference) {
251-
final Reference reference = (Reference)obj;
250+
if (obj instanceof Reference reference) {
252251
if (reference.getClassName().equals(StubDataSource.class.getName())) {
253252
final StubDataSource dataSource = new StubDataSource();
254253
dataSource.setURL((String)reference.get("url").getContent());

0 commit comments

Comments
 (0)