Fix most precommit
Left so NOCOMMITs about things to think about. Original commit: elastic/x-pack-elasticsearch@446626d3a7
This commit is contained in:
parent
aa784f9f46
commit
0ffc0b5662
|
@ -3,24 +3,6 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
/*
|
||||
w * Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.sql.jdbc.net.protocol;
|
||||
|
||||
import java.io.DataOutput;
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.sql.jdbc.net.protocol;
|
||||
|
||||
import org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.Action;
|
||||
import org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.Status;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
import java.sql.JDBCType;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.Action;
|
||||
import org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.Status;
|
||||
|
||||
import static java.lang.String.format;
|
||||
import static java.sql.Types.BIGINT;
|
||||
import static java.sql.Types.BINARY;
|
||||
|
@ -32,7 +32,6 @@ import static java.sql.Types.TIMESTAMP_WITH_TIMEZONE;
|
|||
import static java.sql.Types.TINYINT;
|
||||
import static java.sql.Types.VARBINARY;
|
||||
import static java.sql.Types.VARCHAR;
|
||||
|
||||
import static org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.MAGIC_NUMBER;
|
||||
import static org.elasticsearch.xpack.sql.jdbc.net.protocol.Proto.VERSION;
|
||||
|
||||
|
@ -167,7 +166,7 @@ public abstract class ProtoUtils {
|
|||
result = in.readLong();
|
||||
break;
|
||||
default:
|
||||
throw new IOException(format("Don't know how to read type %d / %s", type, JDBCType.valueOf(type)));
|
||||
throw new IOException("Don't know how to read type [" + type + " / " + JDBCType.valueOf(type) + "]");
|
||||
}
|
||||
return (T) result;
|
||||
}
|
||||
|
|
|
@ -3,24 +3,6 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
/*
|
||||
\ * Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.xpack.sql.jdbc.net.client;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
|
|
|
@ -10,3 +10,9 @@ dependencies {
|
|||
* hard to configure and (hopefully) much less important for tests than
|
||||
* production code. */
|
||||
dependencyLicenses.enabled = false
|
||||
|
||||
forbiddenApisMain {
|
||||
//we are using jdk-internal instead of jdk-non-portable to allow for com.sun.net.httpserver.* usage
|
||||
bundledSignatures -= 'jdk-non-portable'
|
||||
bundledSignatures += 'jdk-internal'
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.xpack.sql.test.server;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
|
@ -30,7 +31,7 @@ public abstract class ProtoHttpServer<R> {
|
|||
}
|
||||
|
||||
public void start(int port) throws IOException {
|
||||
server = HttpServer.create(new InetSocketAddress(port), 0);
|
||||
server = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), port), 0);
|
||||
server.createContext(defaultPrefix, new RootHttpHandler());
|
||||
server.createContext(defaultPrefix + protoPrefix, handler);
|
||||
server.setExecutor(Executors.newCachedThreadPool());
|
||||
|
@ -47,7 +48,7 @@ public abstract class ProtoHttpServer<R> {
|
|||
}
|
||||
|
||||
public String url() {
|
||||
return server != null ? format("localhost:%d%s%s", address().getPort(), defaultPrefix, protoPrefix): "<not started>";
|
||||
return server != null ? "localhost:" + address().getPort() + defaultPrefix + protoPrefix : "<not started>";
|
||||
}
|
||||
|
||||
public Client client() {
|
||||
|
|
|
@ -5,18 +5,20 @@
|
|||
*/
|
||||
package org.elasticsearch.xpack.sql.test.server;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import com.sun.net.httpserver.HttpHandler;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.ESLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
class RootHttpHandler implements HttpHandler {
|
||||
private static final Logger logger = ESLoggerFactory.getLogger(RootHttpHandler.class);
|
||||
|
||||
@Override
|
||||
public void handle(HttpExchange t) throws IOException {
|
||||
System.out.println("Received ping call...");
|
||||
//String m = "SQL Proto testing server";
|
||||
//byte[] bytes = StringUtils.toUTF(m);
|
||||
logger.debug("Received ping call...");
|
||||
t.sendResponseHeaders(200, -1);
|
||||
t.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue