sonar优化
This commit is contained in:
@@ -859,6 +859,7 @@ public class ClassWriter extends ClassVisitor {
|
||||
|
||||
@Override
|
||||
public final void visitEnd() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -215,6 +215,7 @@ final class FieldWriter extends FieldVisitor {
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -287,6 +287,7 @@ public class Label {
|
||||
* Constructs a new label.
|
||||
*/
|
||||
public Label() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -623,6 +623,7 @@ class MethodWriter extends MethodVisitor {
|
||||
|
||||
@Override
|
||||
public void visitCode() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1700,6 +1701,7 @@ class MethodWriter extends MethodVisitor {
|
||||
|
||||
@Override
|
||||
public void visitEnd() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
@@ -386,18 +386,18 @@ public final class ApiDocCommand {
|
||||
if (!swaggerComponentsMap.isEmpty()) {
|
||||
swaggerResultMap.put("components", Utility.ofMap("schemas", swaggerComponentsMap));
|
||||
}
|
||||
final FileOutputStream out = new FileOutputStream(new File(app.getHome(), "openapi-doc.json"));
|
||||
out.write(JsonConvert.root().convertTo(swaggerResultMap).getBytes(StandardCharsets.UTF_8));
|
||||
out.close();
|
||||
try (FileOutputStream out = new FileOutputStream(new File(app.getHome(), "openapi-doc.json"))) {
|
||||
out.write(JsonConvert.root().convertTo(swaggerResultMap).getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
{
|
||||
Map<String, Object> oldapisResultMap = new LinkedHashMap<>();
|
||||
oldapisResultMap.put("servers", serverList);
|
||||
oldapisResultMap.put("types", typesMap);
|
||||
final String json = JsonConvert.root().convertTo(oldapisResultMap);
|
||||
final FileOutputStream out = new FileOutputStream(new File(app.getHome(), "apidoc.json"));
|
||||
out.write(json.getBytes(StandardCharsets.UTF_8));
|
||||
out.close();
|
||||
try (FileOutputStream out = new FileOutputStream(new File(app.getHome(), "apidoc.json"))) {
|
||||
out.write(json.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
File doctemplate = new File(app.getConfPath().toString(), "apidoc-template.html");
|
||||
InputStream in = null;
|
||||
if (doctemplate.isFile() && doctemplate.canRead()) {
|
||||
@@ -406,9 +406,9 @@ public final class ApiDocCommand {
|
||||
if (in != null) {
|
||||
String content = Utility.read(in).replace("'#{content}'", json);
|
||||
in.close();
|
||||
FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "apidoc.html"));
|
||||
outhtml.write(content.getBytes(StandardCharsets.UTF_8));
|
||||
outhtml.close();
|
||||
try (FileOutputStream outhtml = new FileOutputStream(new File(app.getHome(), "apidoc.html"))) {
|
||||
outhtml.write(content.getBytes(StandardCharsets.UTF_8));
|
||||
}
|
||||
}
|
||||
}
|
||||
return "apidoc success";
|
||||
|
||||
@@ -240,10 +240,12 @@ public class LoggingSearchHandler extends LoggingBaseHandler {
|
||||
|
||||
@Override
|
||||
public void flush() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SecurityException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Entity
|
||||
|
||||
@@ -22,7 +22,7 @@ public class NodeInterceptor {
|
||||
* @param server NodeServer
|
||||
*/
|
||||
public void preStart(NodeServer server) {
|
||||
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +32,7 @@ public class NodeInterceptor {
|
||||
* @param server NodeServer
|
||||
*/
|
||||
public void preShutdown(NodeServer server) {
|
||||
|
||||
//do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -352,9 +352,6 @@ public class CacheClusterAgent extends ClusterAgent implements Resourcable {
|
||||
|
||||
public String resname;
|
||||
|
||||
public AddressEntry() {
|
||||
}
|
||||
|
||||
public AddressEntry refresh() {
|
||||
this.time = System.currentTimeMillis();
|
||||
return this;
|
||||
|
||||
@@ -111,7 +111,7 @@ public class HttpLocalRpcClient extends HttpRpcClient {
|
||||
if (logger.isLoggable(Level.FINE)) {
|
||||
logger.log(Level.FINE, "sendMessage: request=" + request + ", not found servlet");
|
||||
}
|
||||
future.completeExceptionally(new RuntimeException("404 Not Found " + topic));
|
||||
future.completeExceptionally(new HttpException("404 Not Found " + topic));
|
||||
return future;
|
||||
}
|
||||
HttpRequest req = new HttpMessageLocalRequest(context(), request, userid);
|
||||
|
||||
@@ -23,6 +23,7 @@ public class AnyValueEncoder<W extends Writer> implements Encodeable<W, AnyValue
|
||||
|
||||
@Override
|
||||
public void convertTo(W out, AnyValue value) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -396,9 +396,11 @@ public class ObjectDecoder<R extends Reader, T> implements Decodeable<R, T> {
|
||||
|
||||
//---------------------------------- 可定制方法 ----------------------------------
|
||||
protected void initForEachDeMember(ConvertFactory factory, DeMember member) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected void afterInitDeMember(ConvertFactory factory) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected boolean hasNext(R in, boolean first) {
|
||||
|
||||
@@ -313,9 +313,11 @@ public class ObjectEncoder<W extends Writer, T> implements Encodeable<W, T> {
|
||||
|
||||
//---------------------------------- 可定制方法 ----------------------------------
|
||||
protected void initForEachEnMember(ConvertFactory factory, EnMember member) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected void afterInitEnMember(ConvertFactory factory) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected W objectWriter(W out, T value) {
|
||||
|
||||
@@ -230,7 +230,8 @@ public final class BsonFactory extends ConvertFactory<BsonReader, BsonWriter> {
|
||||
return skipMapDecoder;
|
||||
case 127:
|
||||
return BsonFactory.objectDecoder;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,6 +180,7 @@ public class BsonReader extends Reader {
|
||||
|
||||
@Override
|
||||
public final void readMapE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,6 +206,7 @@ public class BsonReader extends Reader {
|
||||
|
||||
@Override
|
||||
public final void readArrayE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,6 +214,7 @@ public class BsonReader extends Reader {
|
||||
*/
|
||||
@Override
|
||||
public final void readBlank() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -316,10 +316,12 @@ public class BsonWriter extends Writer implements ByteTuple {
|
||||
|
||||
@Override
|
||||
public final void writeArrayMark() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeArrayE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -332,10 +334,12 @@ public class BsonWriter extends Writer implements ByteTuple {
|
||||
|
||||
@Override
|
||||
public final void writeMapMark() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void writeMapE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class ProtobufReader extends Reader {
|
||||
|
||||
@Override
|
||||
public final void readObjectE(final Class clazz) {
|
||||
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,6 +135,7 @@ public class ProtobufReader extends Reader {
|
||||
|
||||
@Override
|
||||
public final void readMapE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +169,7 @@ public class ProtobufReader extends Reader {
|
||||
|
||||
@Override
|
||||
public final void readArrayE() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,6 +178,7 @@ public class ProtobufReader extends Reader {
|
||||
*/
|
||||
@Override
|
||||
public final void readBlank() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,6 +39,7 @@ class ProtocolCodec implements CompletionHandler<Integer, ByteBuffer> {
|
||||
}
|
||||
|
||||
public void prepare() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected boolean recycle() {
|
||||
|
||||
@@ -155,6 +155,13 @@ public abstract class Request<C extends Context> {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @see #getCreateTime()
|
||||
*
|
||||
* @return long
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated(since = "2.7.0") //replace by getCreateTime()
|
||||
@ConvertDisabled
|
||||
public long getCreatetime() {
|
||||
|
||||
@@ -466,7 +466,7 @@ public abstract class Response<C extends Context, R extends Request<C>> {
|
||||
finishBuffers(kill, buffer);
|
||||
}
|
||||
|
||||
protected <A> void send(final ByteTuple array, final CompletionHandler<Integer, Void> handler) {
|
||||
protected void send(final ByteTuple array, final CompletionHandler<Integer, Void> handler) {
|
||||
ByteBuffer buffer = this.writeBuffer;
|
||||
if (buffer != null && buffer.capacity() >= array.length()) {
|
||||
buffer.clear();
|
||||
|
||||
@@ -92,10 +92,12 @@ public class SSLBuilder {
|
||||
trustManagers = new TrustManager[]{new X509TrustManager() {
|
||||
@Override
|
||||
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,9 +40,7 @@ public class ClientAddress implements java.io.Serializable {
|
||||
if (this.weights == null) {
|
||||
this.weights = new ArrayList<>();
|
||||
}
|
||||
for (WeightAddress addr : addrs) {
|
||||
this.weights.add(addr);
|
||||
}
|
||||
this.weights.addAll(Arrays.asList(addrs));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public abstract class ClientConnection<R extends ClientRequest, P extends Client
|
||||
|
||||
@Override
|
||||
public void completed(Integer result, ClientConnection attachment) {
|
||||
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -174,10 +174,12 @@ public class HttpServlet extends Servlet<HttpContext, HttpRequest, HttpResponse>
|
||||
}
|
||||
|
||||
void postDestroy(Application application, HttpContext context, AnyValue config) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
//Server执行start后运行此方法
|
||||
public void postStart(HttpContext context, AnyValue config) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ class HttpSimpleCodec extends ClientCodec<HttpSimpleRequest, HttpSimpleResult> {
|
||||
|
||||
@Override
|
||||
public void decodeMessages(ByteBuffer buffer, ByteArray array) {
|
||||
|
||||
//do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class SncpClientRequest extends ClientRequest {
|
||||
private byte[] bodyContent;
|
||||
|
||||
public SncpClientRequest() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public SncpClientRequest prepare(SncpHeader header, long seqid, String traceid, byte[] bodyContent) {
|
||||
@@ -40,6 +41,7 @@ public class SncpClientRequest extends ClientRequest {
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SncpClientResult implements ClientResult {
|
||||
private byte[] bodyContent;
|
||||
|
||||
protected void prepare() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected boolean recycle() {
|
||||
|
||||
@@ -84,6 +84,7 @@ public final class CacheMemorySource extends AbstractCacheSource {
|
||||
@Override
|
||||
@ResourceListener
|
||||
public void onResourceChange(ResourceEvent[] events) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
protected ExecutorService subExecutor() {
|
||||
|
||||
@@ -48,6 +48,7 @@ public class DataMemorySource extends AbstractDataSource {
|
||||
@Override
|
||||
@ResourceListener
|
||||
public void onResourceChange(ResourceEvent[] events) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
public static boolean acceptsConf(AnyValue config) {
|
||||
|
||||
@@ -57,12 +57,12 @@ public abstract class AnyValue {
|
||||
* 区分name大小写的比较策略
|
||||
*
|
||||
*/
|
||||
public static final BiPredicate<String, String> EQUALS = (name1, name2) -> name1.equals(name2);
|
||||
public static final BiPredicate<String, String> EQUALS_PREDICATE = (name1, name2) -> name1.equals(name2);
|
||||
|
||||
/**
|
||||
* 不区分name大小写的比较策略
|
||||
*/
|
||||
public static final BiPredicate<String, String> EQUALSIGNORE = (name1, name2) -> name1.equalsIgnoreCase(name2);
|
||||
public static final BiPredicate<String, String> EQUALS_IGNORE = (name1, name2) -> name1.equalsIgnoreCase(name2);
|
||||
|
||||
private boolean ignoreCase;
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class AnyValue {
|
||||
*/
|
||||
public DefaultAnyValue(boolean ignoreCase) {
|
||||
this.ignoreCase = ignoreCase;
|
||||
this.predicate = ignoreCase ? EQUALSIGNORE : EQUALS;
|
||||
this.predicate = ignoreCase ? EQUALS_IGNORE : EQUALS_PREDICATE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,7 +430,7 @@ public abstract class AnyValue {
|
||||
public void setIgnoreCase(boolean ignoreCase) {
|
||||
this.ignoreCase = ignoreCase;
|
||||
if (this.predicate == null) {
|
||||
this.predicate = ignoreCase ? EQUALSIGNORE : EQUALS;
|
||||
this.predicate = ignoreCase ? EQUALS_IGNORE : EQUALS_PREDICATE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public final class ByteArray implements ByteTuple {
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
//do nothing
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -545,6 +545,7 @@ public interface Creator<T> {
|
||||
return new URLConnection(u) {
|
||||
@Override
|
||||
public void connect() throws IOException {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -459,6 +459,7 @@ public class NonBlockingHashMap<TypeK, TypeV> extends AbstractMap<TypeK, TypeV>
|
||||
// tests hang until it gets called... by somebody ... for some reason,
|
||||
// any reason....
|
||||
protected void rehash() {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user