Mercurial > hg > monetdb-java
changeset 847:4d80fd66541d monetdbs
formatting
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Fri, 05 Jan 2024 10:41:24 +0100 (15 months ago) |
parents | f2689a3e9a95 |
children | ac56897d3452 |
files | src/main/java/org/monetdb/jdbc/MonetConnection.java src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java src/main/java/org/monetdb/mcl/net/MapiSocket.java src/main/java/org/monetdb/mcl/net/Parameter.java src/main/java/org/monetdb/mcl/net/ParameterType.java tests/javaspecific.md |
diffstat | 6 files changed, 22 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java @@ -1245,6 +1245,7 @@ public class MonetConnection * Passing this to {@link DriverManager.getConnection()} together * with the URL "jdbc:monetdb:" will create a new connection identical to * the current one. + * * @return */
--- a/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java +++ b/src/main/java/org/monetdb/mcl/io/BufferedMCLReader.java @@ -96,6 +96,7 @@ public final class BufferedMCLReader { /** * Return a substring of the current line, or null if we're at the end or before the beginning. + * * @return the current line or null */ public String getLine(int start) {
--- a/src/main/java/org/monetdb/mcl/net/MapiSocket.java +++ b/src/main/java/org/monetdb/mcl/net/MapiSocket.java @@ -83,7 +83,7 @@ import org.monetdb.mcl.parser.MCLParseEx */ public final class MapiSocket { /* an even number of NUL bytes used during the handshake */ - private static final byte[] NUL_BYTES = new byte[]{ 0, 0, 0, 0, 0, 0, 0, 0, }; + private static final byte[] NUL_BYTES = new byte[]{ 0, 0, 0, 0, 0, 0, 0, 0 }; /* A mapping between hash algorithm names as used in the MAPI * protocol, and the names by which the Java runtime knows them. @@ -273,15 +273,15 @@ public final class MapiSocket { return connect(new Target(url, props), null); } - /** + /** * Connect according to the settings in the 'target' parameter. * If followRedirect is false, a RedirectionException is * thrown when a redirect is encountered. - * + * * Some settings, such as the initial reply size, can already be configured * during the handshake, saving a command round-trip later on. * To do so, create and pass a subclass of {@link MapiSocket.OptionsCallback}. - * + * * @param target the connection settings * @param callback will be called if the server allows options to be set during the * initial handshake @@ -461,17 +461,14 @@ public final class MapiSocket { return false; // we need another go } - private String challengeResponse( - Target.Validated validated, final String challengeLine, - OptionsCallback callback - ) throws MCLException { + private String challengeResponse(Target.Validated validated, final String challengeLine, OptionsCallback callback) throws MCLException { // The challengeLine looks like this: // // 45IYyVyRnbgEnK92ad:merovingian:9:RIPEMD160,SHA512,SHA384,SHA256,SHA224,SHA1:LIT:SHA512: // WgHIibSyH:mserver:9:RIPEMD160,SHA512,SHA384,SHA256,SHA224,SHA1:LIT:SHA512:sql=6:BINARY=1: // 0 1 2 3 4 5 6 7 - String parts[] = challengeLine.split(":"); + String[] parts = challengeLine.split(":"); if (parts.length < 3) throw new MCLException("Invalid challenge: expect at least 3 fields"); String saltPart = parts[0]; @@ -520,7 +517,7 @@ public final class MapiSocket { private String hashPassword(StringBuilder responseBuffer, String salt, String password, String passwordAlgo, String configuredHashes, String serverSupportedAlgos) throws MCLException { // First determine which hash algorithms we can choose from for the challenge response. // This defaults to whatever the server offers but may be restricted by the user. - Set<String> algoSet = new HashSet<>(Arrays.asList(serverSupportedAlgos.split(","))); + Set<String> algoSet = new HashSet<>(Arrays.asList(serverSupportedAlgos.split(","))); if (!configuredHashes.isEmpty()) { String[] allowedList = configuredHashes.toUpperCase().split("[, ]"); Set<String> allowedSet = new HashSet<>(Arrays.asList(allowedList)); @@ -558,13 +555,14 @@ public final class MapiSocket { /** * Pick the most preferred digest algorithm and return a MessageDigest instance for that. - * @param algos the MAPI names of permitted algorithms + * + * @param algos the MAPI names of permitted algorithms * @param appendMapiName if not null, append MAPI name of chose algorithm here * @return instance of the chosen digester * @throws MCLException if none of the options is supported */ private MessageDigest pickBestAlgorithm(Set<String> algos, StringBuilder appendMapiName) throws MCLException { - for (String[] choice: KNOWN_ALGORITHMS) { + for (String[] choice : KNOWN_ALGORITHMS) { String mapiName = choice[0]; String algoName = choice[1]; MessageDigest digest; @@ -588,15 +586,16 @@ public final class MapiSocket { /** * Hash the text into the digest and append the hexadecimal form of the * resulting digest to buffer. + * * @param buffer where the hex digits are appended * @param digest where the hex digits come from after the text has been digested - * @param text text to digest + * @param text text to digest */ private void hexhash(StringBuilder buffer, MessageDigest digest, String text) { byte[] bytes = text.getBytes(StandardCharsets.UTF_8); digest.update(bytes); byte[] output = digest.digest(); - for (byte b: output) { + for (byte b : output) { int hi = (b & 0xF0) >> 4; int lo = b & 0x0F; buffer.append(HEXDIGITS[hi]); @@ -610,7 +609,7 @@ public final class MapiSocket { StringBuilder buffer = new StringBuilder(); callback.setBuffer(buffer); - for (String optlevel: optionsPart.split(",")) { + for (String optlevel : optionsPart.split(",")) { int eqindex = optlevel.indexOf('='); if (eqindex < 0) throw new MCLException("Invalid options part in server challenge: " + optionsPart);
--- a/src/main/java/org/monetdb/mcl/net/Parameter.java +++ b/src/main/java/org/monetdb/mcl/net/Parameter.java @@ -115,6 +115,7 @@ public enum Parameter { * The ground rule is that if we encounter an unknown setting * without an underscore in the name, it is an error. If it has * an underscore in its name, it can be ignored. + * * @param name the name of the setting to check * @return true if it can safely be ignored */ @@ -128,6 +129,7 @@ public enum Parameter { * Return a default value for the given setting, as an Object of the appropriate type. * Note that the value returned for TIMEZONE may change if the system time zone * is changed or if Daylight Saving Time starts or ends. + * * @return */ public Object getDefault() {
--- a/src/main/java/org/monetdb/mcl/net/ParameterType.java +++ b/src/main/java/org/monetdb/mcl/net/ParameterType.java @@ -26,6 +26,7 @@ public enum ParameterType { * Convert a string to a boolean, accepting true/false/yes/no/on/off. * * Uppercase is also accepted. + * * @param value text to be parsed * @return boolean interpretation of the text */ @@ -55,7 +56,8 @@ public enum ParameterType { /** * Convert text into an Object of the appropriate type - * @param name name of the setting for use in error messages + * + * @param name name of the setting for use in error messages * @param value text to be converted * @return Object representation of the text * @throws ValidationError if the text cannot be converted @@ -84,6 +86,7 @@ public enum ParameterType { /** * Represent the object as a string. + * * @param value, must be of the appropriate type * @return textual representation */