diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalTable.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalTable.java index 33b7abfa68..b1cda0581f 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalTable.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalTable.java @@ -26,7 +26,6 @@ import java.util.List; import lombok.EqualsAndHashCode; import lombok.NonNull; -import lombok.RequiredArgsConstructor; import lombok.Value; import lombok.experimental.NonFinal; import lombok.experimental.SuperBuilder; @@ -122,24 +121,6 @@ public List getConstraintIds() { } - @RequiredArgsConstructor - public static class PrimitiveCatalogTable { - - public final String tableCat; - public final String tableSchem; - public final String tableName; - public final String tableType; - public final String remarks; - public final String typeCat; - public final String typeSchem; - public final String typeName; - public final String selfReferencingColName; - public final String refGeneration; - public final String owner; - - } - - @Override public String toString() { return "LogicalTable{" + diff --git a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalView.java b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalView.java index a156720d51..b8494656de 100644 --- a/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalView.java +++ b/core/src/main/java/org/polypheny/db/catalog/entity/logical/LogicalView.java @@ -102,17 +102,17 @@ public AlgNode prepareView( AlgCluster cluster ) { public void prepareView( AlgNode viewLogicalRoot, AlgCluster algCluster ) { - if ( viewLogicalRoot instanceof AbstractAlgNode ) { - ((AbstractAlgNode) viewLogicalRoot).setCluster( algCluster ); + if ( viewLogicalRoot instanceof AbstractAlgNode algNode ) { + algNode.setCluster( algCluster ); } - if ( viewLogicalRoot instanceof BiAlg ) { - prepareView( ((BiAlg) viewLogicalRoot).getLeft(), algCluster ); - prepareView( ((BiAlg) viewLogicalRoot).getRight(), algCluster ); - } else if ( viewLogicalRoot instanceof SingleAlg ) { - prepareView( ((SingleAlg) viewLogicalRoot).getInput(), algCluster ); + if ( viewLogicalRoot instanceof BiAlg biAlg ) { + prepareView( biAlg.getLeft(), algCluster ); + prepareView( biAlg.getRight(), algCluster ); + } else if ( viewLogicalRoot instanceof SingleAlg singleAlg ) { + prepareView( singleAlg.getInput(), algCluster ); } - if ( viewLogicalRoot instanceof LogicalRelViewScan ) { - prepareView( ((LogicalRelViewScan) viewLogicalRoot).getAlgNode(), algCluster ); + if ( viewLogicalRoot instanceof LogicalRelViewScan logicalRelViewScan ) { + prepareView( logicalRelViewScan.getAlgNode(), algCluster ); } } diff --git a/core/src/main/java/org/polypheny/db/docker/AutoDocker.java b/core/src/main/java/org/polypheny/db/docker/AutoDocker.java index 8ff49aa484..226c5402fd 100644 --- a/core/src/main/java/org/polypheny/db/docker/AutoDocker.java +++ b/core/src/main/java/org/polypheny/db/docker/AutoDocker.java @@ -75,7 +75,7 @@ public static AutoDocker getInstance() { private void updateStatus( String newStatus ) { status = newStatus; - log.info( "AutoDocker: " + newStatus ); + log.info( "AutoDocker: {}", newStatus ); } @@ -243,7 +243,7 @@ public void doAutoConnect() { try { handshake = DockerSetupHelper.reconnectToInstance( maybeDockerInstance.get().getKey() ); } catch ( DockerUserException e ) { - log.info( "AutoDocker: Reconnect failed: " + e ); + log.info( "AutoDocker: Reconnect failed: {}", String.valueOf( e ) ); updateStatus( "error: " + e.getMessage() ); throw new DockerUserException( e.getMessage() ); } @@ -255,7 +255,7 @@ public void doAutoConnect() { } handshake = res.get(); } catch ( DockerUserException e ) { - log.info( "AutoDocker: Setup failed: " + e ); + log.info( "AutoDocker: Setup failed: {}", String.valueOf( e ) ); updateStatus( "setup failed: " + e.getMessage() ); throw e; } diff --git a/core/src/main/java/org/polypheny/db/docker/DockerContainer.java b/core/src/main/java/org/polypheny/db/docker/DockerContainer.java index bd0f43c745..d13ba1f30f 100644 --- a/core/src/main/java/org/polypheny/db/docker/DockerContainer.java +++ b/core/src/main/java/org/polypheny/db/docker/DockerContainer.java @@ -138,7 +138,7 @@ public Optional getExposedPort( int port ) { } throw new IOException(); } catch ( IOException e ) { - log.error( "Failed to retrieve list of ports for container " + containerId ); + log.error( "Failed to retrieve list of ports for container {}", containerId ); return Optional.empty(); } } @@ -163,7 +163,7 @@ private Thread pipe( InputStream in, OutputStream out, String name ) { return; } } - log.error( "Pipe " + name, e ); + log.error( "Pipe {}", name, e ); } }, name ); t.start(); @@ -178,7 +178,7 @@ private void startProxyForConnection( DockerInstance dockerInstance, Socket loca } catch ( IOException e ) { if ( e instanceof SocketException || e instanceof EOFException ) { // ignore - } else if ( e instanceof TlsFatalAlert && ((TlsFatalAlert) e).getAlertDescription() == AlertDescription.handshake_failure ) { + } else if ( e instanceof TlsFatalAlert alert && alert.getAlertDescription() == AlertDescription.handshake_failure ) { // ignore } else { log.info( "startProxyForConnection", e ); @@ -189,8 +189,8 @@ private void startProxyForConnection( DockerInstance dockerInstance, Socket loca OutputStream remoteOut = client.getOutputStream().get(); try { remoteOut.write( (containerId + ":" + port + "\n").getBytes( StandardCharsets.UTF_8 ) ); - Thread copyToRemote = pipe( local.getInputStream(), remoteOut, String.format( "polypheny => %s", uniqueName ) ); - Thread copyFromRemote = pipe( client.getInputStream().get(), local.getOutputStream(), String.format( "polypheny <= %s", uniqueName ) ); + Thread copyToRemote = pipe( local.getInputStream(), remoteOut, String.format( "polypheny -> %s", uniqueName ) ); + Thread copyFromRemote = pipe( client.getInputStream().get(), local.getOutputStream(), String.format( "polypheny <- %s", uniqueName ) ); new Thread( () -> { while ( true ) { try { @@ -224,7 +224,7 @@ private ServerSocket startServer( int port ) { startProxyForConnection( dockerInstance, local, port ); } catch ( IOException e ) { if ( !(e instanceof SocketException) || !e.getMessage().equals( "Socket closed" ) ) { - log.info( "Server Socket for port " + port + " closed", e ); + log.info( "Server Socket for port {} closed", port, e ); } synchronized ( this ) { Util.closeNoThrow( proxies.remove( port ) ); @@ -257,7 +257,7 @@ public boolean waitTillStarted( Supplier isReadySupplier, long maxTimeo StopWatch stopWatch = new StopWatch(); stopWatch.start(); boolean isStarted = isReadySupplier.get(); - while ( !isStarted && (stopWatch.getTime() < maxTimeoutMs) ) { + while ( !isStarted && (stopWatch.getDuration().toMillis() < maxTimeoutMs) ) { try { TimeUnit.MILLISECONDS.sleep( 500 ); } catch ( InterruptedException e ) { diff --git a/core/src/main/java/org/polypheny/db/docker/DockerInstance.java b/core/src/main/java/org/polypheny/db/docker/DockerInstance.java index ee7816bf67..0a90853e4d 100644 --- a/core/src/main/java/org/polypheny/db/docker/DockerInstance.java +++ b/core/src/main/java/org/polypheny/db/docker/DockerInstance.java @@ -83,7 +83,7 @@ private enum Status { try { checkConnection(); } catch ( IOException e ) { - log.error( "Could not connect to docker instance " + host.alias() + ": " + e.getMessage() ); + log.error( "Could not connect to docker instance {}: {}", host.alias(), e.getMessage() ); } } @@ -117,7 +117,7 @@ private void handleNewDockerInstance() throws IOException { try { this.client.deleteContainer( containerInfo.getUuid() ); } catch ( IOException e ) { - log.error( "Failed to delete container " + containerInfo.getUuid(), e ); + log.error( "Failed to delete container {}", containerInfo.getUuid(), e ); } } ); @@ -170,7 +170,7 @@ public void reconnect() { } checkConnection(); } catch ( IOException e ) { - log.info( "Failed to reconnect: " + e ); + log.info( "Failed to reconnect: {}", String.valueOf( e ) ); } } } @@ -231,9 +231,9 @@ void destroyContainer( DockerContainer container ) { client.deleteContainer( container.getContainerId() ); } catch ( IOException e ) { if ( e.getMessage().startsWith( "No such container" ) ) { - log.info( "Cannot delete container: No container with UUID " + container.getContainerId() ); + log.info( "Cannot delete container: No container with UUID {}", container.getContainerId() ); } else { - log.error( "Failed to delete container with UUID " + container.getContainerId(), e ); + log.error( "Failed to delete container with UUID {}", container.getContainerId(), e ); } } } @@ -283,7 +283,7 @@ Optional updateConfig( String hostname, String alias, String regi this.host = newHost; checkConnection(); } catch ( IOException e ) { - log.info( "Failed to connect to '" + hostname + "': " + e.getMessage() ); + log.info( "Failed to connect to '{}': {}", hostname, e.getMessage() ); return Optional.of( HandshakeManager.getInstance().newHandshake( newHost, null, true ) ); } } diff --git a/core/src/main/java/org/polypheny/db/docker/DockerSetupHelper.java b/core/src/main/java/org/polypheny/db/docker/DockerSetupHelper.java index ef3fb53c57..da81dd8b55 100644 --- a/core/src/main/java/org/polypheny/db/docker/DockerSetupHelper.java +++ b/core/src/main/java/org/polypheny/db/docker/DockerSetupHelper.java @@ -92,7 +92,7 @@ public static void removeDockerInstance( int id ) { throw new DockerUserException( "Docker instance still in use by at least one container" ); } } catch ( IOException e ) { - log.info( "Failed to retrieve list of docker containers " + e ); + log.info( "Failed to retrieve list of docker containers {}", String.valueOf( e ) ); } HandshakeManager.getInstance().cancelHandshakes( dockerInstance.getHost().hostname() ); diff --git a/core/src/main/java/org/polypheny/db/docker/PolyphenyHandshakeClient.java b/core/src/main/java/org/polypheny/db/docker/PolyphenyHandshakeClient.java index 0dd30dbe48..9d68ad7559 100644 --- a/core/src/main/java/org/polypheny/db/docker/PolyphenyHandshakeClient.java +++ b/core/src/main/java/org/polypheny/db/docker/PolyphenyHandshakeClient.java @@ -277,7 +277,7 @@ boolean doHandshake() { return false; // Prevents a handshake successful message to be printed when cancelled } } else { - log.error( "Server " + hostname + " has send an invalid authentication value, aborting handshake" ); + log.error( "Server {} has send an invalid authentication value, aborting handshake", hostname ); // On purpose not NOT_RUNNING, because it could be an attack attempt. This forces regeneration // of the psk, so the attacker has one chance to guess. The more likely explanation is pasting // an old command, hence this error message. diff --git a/core/src/main/java/org/polypheny/db/type/PolySerializable.java b/core/src/main/java/org/polypheny/db/type/PolySerializable.java index b15115b7fd..acec7228e6 100644 --- a/core/src/main/java/org/polypheny/db/type/PolySerializable.java +++ b/core/src/main/java/org/polypheny/db/type/PolySerializable.java @@ -26,8 +26,6 @@ import io.activej.serializer.SerializerFactory; import io.activej.serializer.def.SimpleSerializerDef; import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import org.polypheny.db.catalog.exceptions.GenericRuntimeException; import org.polypheny.db.config.RuntimeConfig; @@ -47,7 +45,6 @@ static , T> BinarySerializer buildSerializer( C clazz ) { .create( CLASS_LOADER, clazz ); } - Map, BinarySerializer> cache = new HashMap<>(); int BUFFER_SIZE = RuntimeConfig.SERIALIZATION_BUFFER_SIZE.getInteger(); Charset CHARSET = Util.getDefaultCharset();