From 58fcdb80bef402f0ef8b2ea5aad33b4dd01e8c2c Mon Sep 17 00:00:00 2001 From: Martin Vahlensieck Date: Thu, 18 Apr 2024 10:00:17 +0200 Subject: [PATCH] Update name of parameters and methods --- .../db/protointerface/transport/PlainTransport.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/transport/PlainTransport.java b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/transport/PlainTransport.java index 83cebc8ecf..314a0a27a2 100644 --- a/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/transport/PlainTransport.java +++ b/plugins/proto-interface/src/main/java/org/polypheny/db/protointerface/transport/PlainTransport.java @@ -47,28 +47,28 @@ public Optional getPeer() { } - void exchangeVersion( String protocol ) throws IOException { - if ( !protocol.matches( "\\A[a-z0-9@.-]+\\z" ) ) { + void exchangeVersion( String version ) throws IOException { + if ( !version.matches( "\\A[a-z0-9@.-]+\\z" ) ) { throw new IOException( "Invalid version name" ); } - byte len = (byte) (protocol.length() + 1); // Trailing '\n' + byte len = (byte) (version.length() + 1); // Trailing '\n' if ( len <= 0 ) { throw new IOException( "Version too long" ); } ByteBuffer bb = ByteBuffer.allocate( 1 + len ); // Leading size bb.put( len ); - bb.put( protocol.getBytes( StandardCharsets.US_ASCII ) ); + bb.put( version.getBytes( StandardCharsets.US_ASCII ) ); bb.put( (byte) '\n' ); bb.rewind(); writeEntireBuffer( bb ); - byte[] response = readProtocolResponse( len ); + byte[] response = readVersionResponse( len ); if ( !Arrays.equals( bb.array(), response ) ) { throw new IOException( "Invalid client version" ); } } - private byte[] readProtocolResponse( byte len ) throws IOException { + private byte[] readVersionResponse( byte len ) throws IOException { ByteBuffer bb = ByteBuffer.allocate( 1 + len ); // Leading size ByteBuffer length = bb.slice( 0, 1 ); bb.position( 1 );