Loading scripts/analysis/findbugs-results.txt +1 −1 Original line number Diff line number Diff line 195 194 No newline at end of file src/androidTest/java/com/owncloud/android/AbstractIT.java +5 −4 Original line number Diff line number Diff line Loading @@ -27,19 +27,20 @@ import java.util.ArrayList; @RunWith(AndroidJUnit4.class) public abstract class AbstractIT { protected static OwnCloudClient client; protected static String userId; protected static Context context; @BeforeClass public static void beforeAll() { Bundle arguments = InstrumentationRegistry.getArguments(); Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); context = InstrumentationRegistry.getInstrumentation().getTargetContext(); Uri url = Uri.parse(arguments.getString("TEST_SERVER_URL")); userId = arguments.getString("TEST_SERVER_USERNAME"); String loginName = arguments.getString("TEST_SERVER_USERNAME"); String password = arguments.getString("TEST_SERVER_PASSWORD"); client = OwnCloudClientFactory.createOwnCloudClient(url, context, true); client.setCredentials(new OwnCloudBasicCredentials(userId, password)); client.setCredentials(new OwnCloudBasicCredentials(loginName, password)); client.setUserId(loginName); // for test same as userId } @After Loading src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -40,8 +40,7 @@ public class SearchRemoteOperationTest extends AbstractIT { public void testSearchByFileIdEmpty() { SearchRemoteOperation sut = new SearchRemoteOperation("123123", SearchRemoteOperation.SearchType.FILE_ID_SEARCH, false, userId); false); RemoteOperationResult result = sut.execute(client); assertTrue(result.isSuccess()); Loading @@ -60,8 +59,7 @@ public class SearchRemoteOperationTest extends AbstractIT { SearchRemoteOperation sut = new SearchRemoteOperation(localId, SearchRemoteOperation.SearchType.FILE_ID_SEARCH, false, userId); false); RemoteOperationResult result = sut.execute(client); assertTrue(result.isSuccess()); Loading src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.javadeleted 100644 → 0 +0 −54 Original line number Diff line number Diff line package com.owncloud.android.lib.common; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.content.Context; import com.owncloud.android.lib.common.accounts.AccountUtils; import java.io.IOException; /** * Dynamic implementation of {@link OwnCloudClientManager}. * <p> * Wraps instances of {@link SingleSessionManager} and {@link SimpleFactoryManager} and delegates on one * or the other depending on the known version of the server corresponding to the {@link OwnCloudAccount} * * @author David A. Velasco */ public class DynamicSessionManager implements OwnCloudClientManager { private SimpleFactoryManager mSimpleFactoryManager = new SimpleFactoryManager(); private SingleSessionManager mSingleSessionManager = new SingleSessionManager(); @Override public OwnCloudClient getClientFor(OwnCloudAccount account, Context context) throws AccountUtils.AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException { return mSingleSessionManager.getClientFor(account, context); } @Override public OwnCloudClient removeClientFor(OwnCloudAccount account) { OwnCloudClient clientRemovedFromFactoryManager = mSimpleFactoryManager.removeClientFor(account); OwnCloudClient clientRemovedFromSingleSessionManager = mSingleSessionManager.removeClientFor(account); if (clientRemovedFromSingleSessionManager != null) { return clientRemovedFromSingleSessionManager; } else { return clientRemovedFromFactoryManager; } // clientRemoved and clientRemoved2 should not be != null at the same time } @Override public void saveAllClients(Context context, String accountType) throws AccountUtils.AccountNotFoundException, AuthenticatorException, IOException, OperationCanceledException { mSimpleFactoryManager.saveAllClients(context, accountType); mSingleSessionManager.saveAllClients(context, accountType); } } src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +13 −7 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class OwnCloudClient extends HttpClient { @Getter private Uri baseUri; @Getter @Setter private OwnCloudVersion ownCloudVersion = null; @Getter @Setter private String userId; @Setter private String userId; /** * Constructor Loading @@ -91,7 +91,7 @@ public class OwnCloudClient extends HttpClient { String userAgent; userAgent = OwnCloudClientManagerFactory.getNextcloudUserAgent(); userAgent = OwnCloudClientManagerFactory.getUserAgent(); getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent); getParams().setParameter(PARAM_PROTOCOL_VERSION, HttpVersion.HTTP_1_1); Loading Loading @@ -211,12 +211,9 @@ public class OwnCloudClient extends HttpClient { // Update User Agent HttpParams params = method.getParams(); String userAgent; userAgent = OwnCloudClientManagerFactory.getNextcloudUserAgent(); params.setParameter(HttpMethodParams.USER_AGENT, userAgent); params.setParameter(HttpMethodParams.USER_AGENT, OwnCloudClientManagerFactory.getUserAgent()); Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " + method.getName() + " " + method.getPath()); Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " + method.getName() + " " + method.getPath()); // logCookiesAtRequest(method.getRequestHeaders(), "before"); // logCookiesAtState("before"); Loading Loading @@ -439,4 +436,13 @@ public class OwnCloudClient extends HttpClient { Log_OC.d(TAG, " comment: "+ cookie.getComment() ); Log_OC.d(TAG, " secure: "+ cookie.getSecure() ); } /** * Returns internally, never changing id of user * * @return uri-encoded userId */ public String getUserId() { return Uri.encode(userId); } } Loading
scripts/analysis/findbugs-results.txt +1 −1 Original line number Diff line number Diff line 195 194 No newline at end of file
src/androidTest/java/com/owncloud/android/AbstractIT.java +5 −4 Original line number Diff line number Diff line Loading @@ -27,19 +27,20 @@ import java.util.ArrayList; @RunWith(AndroidJUnit4.class) public abstract class AbstractIT { protected static OwnCloudClient client; protected static String userId; protected static Context context; @BeforeClass public static void beforeAll() { Bundle arguments = InstrumentationRegistry.getArguments(); Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); context = InstrumentationRegistry.getInstrumentation().getTargetContext(); Uri url = Uri.parse(arguments.getString("TEST_SERVER_URL")); userId = arguments.getString("TEST_SERVER_USERNAME"); String loginName = arguments.getString("TEST_SERVER_USERNAME"); String password = arguments.getString("TEST_SERVER_PASSWORD"); client = OwnCloudClientFactory.createOwnCloudClient(url, context, true); client.setCredentials(new OwnCloudBasicCredentials(userId, password)); client.setCredentials(new OwnCloudBasicCredentials(loginName, password)); client.setUserId(loginName); // for test same as userId } @After Loading
src/androidTest/java/com/owncloud/android/lib/resources/files/SearchRemoteOperationTest.java +2 −4 Original line number Diff line number Diff line Loading @@ -40,8 +40,7 @@ public class SearchRemoteOperationTest extends AbstractIT { public void testSearchByFileIdEmpty() { SearchRemoteOperation sut = new SearchRemoteOperation("123123", SearchRemoteOperation.SearchType.FILE_ID_SEARCH, false, userId); false); RemoteOperationResult result = sut.execute(client); assertTrue(result.isSuccess()); Loading @@ -60,8 +59,7 @@ public class SearchRemoteOperationTest extends AbstractIT { SearchRemoteOperation sut = new SearchRemoteOperation(localId, SearchRemoteOperation.SearchType.FILE_ID_SEARCH, false, userId); false); RemoteOperationResult result = sut.execute(client); assertTrue(result.isSuccess()); Loading
src/main/java/com/owncloud/android/lib/common/DynamicSessionManager.javadeleted 100644 → 0 +0 −54 Original line number Diff line number Diff line package com.owncloud.android.lib.common; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.content.Context; import com.owncloud.android.lib.common.accounts.AccountUtils; import java.io.IOException; /** * Dynamic implementation of {@link OwnCloudClientManager}. * <p> * Wraps instances of {@link SingleSessionManager} and {@link SimpleFactoryManager} and delegates on one * or the other depending on the known version of the server corresponding to the {@link OwnCloudAccount} * * @author David A. Velasco */ public class DynamicSessionManager implements OwnCloudClientManager { private SimpleFactoryManager mSimpleFactoryManager = new SimpleFactoryManager(); private SingleSessionManager mSingleSessionManager = new SingleSessionManager(); @Override public OwnCloudClient getClientFor(OwnCloudAccount account, Context context) throws AccountUtils.AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException { return mSingleSessionManager.getClientFor(account, context); } @Override public OwnCloudClient removeClientFor(OwnCloudAccount account) { OwnCloudClient clientRemovedFromFactoryManager = mSimpleFactoryManager.removeClientFor(account); OwnCloudClient clientRemovedFromSingleSessionManager = mSingleSessionManager.removeClientFor(account); if (clientRemovedFromSingleSessionManager != null) { return clientRemovedFromSingleSessionManager; } else { return clientRemovedFromFactoryManager; } // clientRemoved and clientRemoved2 should not be != null at the same time } @Override public void saveAllClients(Context context, String accountType) throws AccountUtils.AccountNotFoundException, AuthenticatorException, IOException, OperationCanceledException { mSimpleFactoryManager.saveAllClients(context, accountType); mSingleSessionManager.saveAllClients(context, accountType); } }
src/main/java/com/owncloud/android/lib/common/OwnCloudClient.java +13 −7 Original line number Diff line number Diff line Loading @@ -73,7 +73,7 @@ public class OwnCloudClient extends HttpClient { @Getter private Uri baseUri; @Getter @Setter private OwnCloudVersion ownCloudVersion = null; @Getter @Setter private String userId; @Setter private String userId; /** * Constructor Loading @@ -91,7 +91,7 @@ public class OwnCloudClient extends HttpClient { String userAgent; userAgent = OwnCloudClientManagerFactory.getNextcloudUserAgent(); userAgent = OwnCloudClientManagerFactory.getUserAgent(); getParams().setParameter(HttpMethodParams.USER_AGENT, userAgent); getParams().setParameter(PARAM_PROTOCOL_VERSION, HttpVersion.HTTP_1_1); Loading Loading @@ -211,12 +211,9 @@ public class OwnCloudClient extends HttpClient { // Update User Agent HttpParams params = method.getParams(); String userAgent; userAgent = OwnCloudClientManagerFactory.getNextcloudUserAgent(); params.setParameter(HttpMethodParams.USER_AGENT, userAgent); params.setParameter(HttpMethodParams.USER_AGENT, OwnCloudClientManagerFactory.getUserAgent()); Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " + method.getName() + " " + method.getPath()); Log_OC.d(TAG + " #" + mInstanceNumber, "REQUEST " + method.getName() + " " + method.getPath()); // logCookiesAtRequest(method.getRequestHeaders(), "before"); // logCookiesAtState("before"); Loading Loading @@ -439,4 +436,13 @@ public class OwnCloudClient extends HttpClient { Log_OC.d(TAG, " comment: "+ cookie.getComment() ); Log_OC.d(TAG, " secure: "+ cookie.getSecure() ); } /** * Returns internally, never changing id of user * * @return uri-encoded userId */ public String getUserId() { return Uri.encode(userId); } }