Simplity some code (#7179)
This commit is contained in:
parent
f7c639630e
commit
6c0886661b
|
|
@ -50,9 +50,7 @@ public final class ArrayUtils {
|
|||
}
|
||||
|
||||
public static int indexOf(String[] array, String valueToFind, int startIndex) {
|
||||
if (isEmpty(array) || valueToFind == null) {
|
||||
return -1;
|
||||
} else {
|
||||
if (!isEmpty(array) && valueToFind != null) {
|
||||
if (startIndex < 0) {
|
||||
startIndex = 0;
|
||||
}
|
||||
|
|
@ -63,8 +61,8 @@ public final class ArrayUtils {
|
|||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public abstract class StrategyMetadataReport implements MetadataReport {
|
|||
* @return true store metadata to the specified URL.
|
||||
*/
|
||||
protected boolean shouldRegister(URL url) {
|
||||
return this.strategy == null ? true : this.strategy.shouldRegister(url);
|
||||
return this.strategy == null || this.strategy.shouldRegister(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,7 +70,7 @@ public abstract class StrategyMetadataReport implements MetadataReport {
|
|||
* @return true read metadata from specified URL.
|
||||
*/
|
||||
protected boolean shouldQuery(URL url) {
|
||||
return this.strategy == null ? true : this.strategy.shouldQuery(url);
|
||||
return this.strategy == null || this.strategy.shouldQuery(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -82,7 +82,7 @@ public abstract class StrategyMetadataReport implements MetadataReport {
|
|||
* @return
|
||||
*/
|
||||
protected boolean isLocalDataCenter(URL url) {
|
||||
return this.strategy == null ? true : this.strategy.isLocalDataCenter(url);
|
||||
return this.strategy == null || this.strategy.isLocalDataCenter(url);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ public class MultipleRegistry extends AbstractRegistry {
|
|||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
boolean available = serviceRegistries.isEmpty() ? true : false;
|
||||
boolean available = serviceRegistries.isEmpty();
|
||||
for (Registry serviceRegistry : serviceRegistries.values()) {
|
||||
if (serviceRegistry.isAvailable()) {
|
||||
available = true;
|
||||
|
|
@ -128,7 +128,7 @@ public class MultipleRegistry extends AbstractRegistry {
|
|||
return false;
|
||||
}
|
||||
|
||||
available = referenceRegistries.isEmpty() ? true : false;
|
||||
available = referenceRegistries.isEmpty();
|
||||
for (Registry referenceRegistry : referenceRegistries.values()) {
|
||||
if (referenceRegistry.isAvailable()) {
|
||||
available = true;
|
||||
|
|
|
|||
|
|
@ -128,10 +128,8 @@ public class GrizzlyCodecAdapter extends BaseFilter {
|
|||
}
|
||||
if (msg != null) {
|
||||
context.setMessage(msg);
|
||||
return context.getInvokeAction();
|
||||
} else {
|
||||
return context.getInvokeAction();
|
||||
}
|
||||
return context.getInvokeAction();
|
||||
}
|
||||
} while (frame.readable());
|
||||
} else { // Other events are passed down directly
|
||||
|
|
|
|||
|
|
@ -3680,8 +3680,6 @@ public class DemoService {
|
|||
public boolean equals(timeOut_result that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -3930,8 +3928,6 @@ public class DemoService {
|
|||
public boolean equals(customException_args that) {
|
||||
if (that == null)
|
||||
return false;
|
||||
if (this == that)
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class RedisProtocol extends AbstractProtocol {
|
|||
}
|
||||
} catch (Throwable t) {
|
||||
RpcException re = new RpcException("Failed to invoke redis service method. interface: " + type.getName() + ", method: " + invocation.getMethodName() + ", url: " + url + ", cause: " + t.getMessage(), t);
|
||||
if (t instanceof TimeoutException || t instanceof SocketTimeoutException) {
|
||||
if (t instanceof SocketTimeoutException) {
|
||||
re.setCode(RpcException.TIMEOUT_EXCEPTION);
|
||||
} else if (t instanceof JedisConnectionException || t instanceof IOException) {
|
||||
re.setCode(RpcException.NETWORK_EXCEPTION);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class $__ClassNameTestDubboStub {
|
|||
|
||||
public interface Iface {
|
||||
|
||||
public String echo(String arg);
|
||||
String echo(String arg);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue