You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/07/26 06:10:32 UTC
[shardingsphere] branch master updated: fix checkstyle for PR#6189
(#6440)
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 91ff35a fix checkstyle for PR#6189 (#6440)
91ff35a is described below
commit 91ff35a747f59efc99f0ecad4d48c7e7ef8f7073
Author: zhaojun <zh...@126.com>
AuthorDate: Sun Jul 26 14:10:23 2020 +0800
fix checkstyle for PR#6189 (#6440)
---
.../manager/DataSourceXAResourceRecoveryHelper.java | 6 +++---
.../manager/DataSourceXAResourceRecoveryHelperTest.java | 15 ++++++++-------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
index f25bbaf..5865e96 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/main/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelper.java
@@ -81,7 +81,7 @@ public final class DataSourceXAResourceRecoveryHelper implements XAResourceRecov
}
private boolean connect() {
- if (this.delegate == null) {
+ if (null == this.delegate) {
try {
this.xaConnection = getXaConnection();
this.delegate = this.xaConnection.getXAResource();
@@ -94,7 +94,7 @@ public final class DataSourceXAResourceRecoveryHelper implements XAResourceRecov
}
private XAConnection getXaConnection() throws SQLException {
- if (this.user == null && this.password == null) {
+ if (null == this.user && null == this.password) {
return this.xaDataSource.getXAConnection();
}
return this.xaDataSource.getXAConnection(this.user, this.password);
@@ -168,7 +168,7 @@ public final class DataSourceXAResourceRecoveryHelper implements XAResourceRecov
}
private XAResource getDelegate() {
- if (this.delegate == null) {
+ if (null == this.delegate) {
throw new IllegalStateException("Connection has not been opened");
}
return this.delegate;
diff --git a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelperTest.java b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelperTest.java
index 09d6496..d763272 100644
--- a/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelperTest.java
+++ b/shardingsphere-transaction/shardingsphere-transaction-2pc/shardingsphere-transaction-xa/shardingsphere-transaction-xa-narayana/src/test/java/org/apache/shardingsphere/transaction/xa/narayana/manager/DataSourceXAResourceRecoveryHelperTest.java
@@ -17,21 +17,22 @@
package org.apache.shardingsphere.transaction.xa.narayana.manager;
-import javax.sql.XAConnection;
-import javax.sql.XADataSource;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
import lombok.SneakyThrows;
import org.apache.shardingsphere.transaction.xa.narayana.manager.fixture.ReflectiveUtil;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import javax.sql.XAConnection;
+import javax.sql.XADataSource;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+
import static org.hamcrest.CoreMatchers.sameInstance;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -64,7 +65,7 @@ public class DataSourceXAResourceRecoveryHelperTest {
recoveryHelper.getXAResources();
XAResource[] xaResources = recoveryHelper.getXAResources();
assertEquals(1, xaResources.length);
- Assert.assertThat(xaResources[0], sameInstance(recoveryHelper));
+ assertThat(xaResources[0], sameInstance(recoveryHelper));
verify(xaConnection, times(1)).getXAResource();
verify(xaDataSource, times(1)).getXAConnection();
}
@@ -76,7 +77,7 @@ public class DataSourceXAResourceRecoveryHelperTest {
recoveryHelper.getXAResources();
XAResource[] xaResources = recoveryHelper.getXAResources();
assertEquals(1, xaResources.length);
- Assert.assertThat(xaResources[0], sameInstance(recoveryHelper));
+ assertThat(xaResources[0], sameInstance(recoveryHelper));
verify(xaConnection, times(0)).getXAResource();
verify(xaDataSource, times(0)).getXAConnection();
}