Remove System.out.print's. Replace with Logs where appropriate.

Some were removed and left removed if they were run during tests,
because the tests are supposed to be automated and the noise they added
would not have helped diagnose a failure.

Also removed the dead code around "uses-feature" which will never
get implemented, especially as it is in the XML index.
This commit is contained in:
Peter Serwylo 2017-06-13 08:15:52 +10:00
parent de149cf589
commit f7d9be9cd5
4 changed files with 9 additions and 18 deletions

View File

@ -6,6 +6,7 @@ import android.os.Build;
import android.os.Environment; import android.os.Environment;
import android.support.test.InstrumentationRegistry; import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4; import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import org.fdroid.fdroid.AssetUtils; import org.fdroid.fdroid.AssetUtils;
import org.fdroid.fdroid.data.SanitizedFile; import org.fdroid.fdroid.data.SanitizedFile;
@ -30,6 +31,8 @@ import static org.junit.Assume.assumeTrue;
@RunWith(AndroidJUnit4.class) @RunWith(AndroidJUnit4.class)
public class FileCompatTest { public class FileCompatTest {
private static final String TAG = "FileCompatTest";
private SanitizedFile sourceFile; private SanitizedFile sourceFile;
private SanitizedFile destFile; private SanitizedFile destFile;
@ -47,11 +50,11 @@ public class FileCompatTest {
@After @After
public void tearDown() { public void tearDown() {
if (!sourceFile.delete()) { if (!sourceFile.delete()) {
System.out.println("Can't delete " + sourceFile.getAbsolutePath() + "."); Log.w(TAG, "Can't delete " + sourceFile.getAbsolutePath() + ".");
} }
if (!destFile.delete()) { if (!destFile.delete()) {
System.out.println("Can't delete " + destFile.getAbsolutePath() + "."); Log.w(TAG, "Can't delete " + destFile.getAbsolutePath() + ".");
} }
} }

View File

@ -46,16 +46,12 @@ public class HttpDownloaderTest {
final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch = new CountDownLatch(1);
String urlString = "https://f-droid.org/repo/index.jar"; String urlString = "https://f-droid.org/repo/index.jar";
receivedProgress = false; receivedProgress = false;
System.out.println("downloadUninterruptedTestWithProgress: " + urlString);
receivedProgress = false;
URL url = new URL(urlString); URL url = new URL(urlString);
File destFile = File.createTempFile("dl-", ""); File destFile = File.createTempFile("dl-", "");
final HttpDownloader httpDownloader = new HttpDownloader(url, destFile); final HttpDownloader httpDownloader = new HttpDownloader(url, destFile);
httpDownloader.setListener(new ProgressListener() { httpDownloader.setListener(new ProgressListener() {
@Override @Override
public void onProgress(URL sourceUrl, int bytesRead, int totalBytes) { public void onProgress(URL sourceUrl, int bytesRead, int totalBytes) {
System.out.println("DownloaderProgressListener.sendProgress "
+ sourceUrl + " " + bytesRead + " / " + totalBytes);
receivedProgress = true; receivedProgress = true;
} }
}); });
@ -118,7 +114,6 @@ public class HttpDownloaderTest {
httpDownloader.setListener(new ProgressListener() { httpDownloader.setListener(new ProgressListener() {
@Override @Override
public void onProgress(URL sourceUrl, int bytesRead, int totalBytes) { public void onProgress(URL sourceUrl, int bytesRead, int totalBytes) {
System.out.println("DownloaderProgressListener.sendProgress " + bytesRead + " / " + totalBytes);
receivedProgress = true; receivedProgress = true;
latch.countDown(); latch.countDown();
} }

View File

@ -379,9 +379,6 @@ public class RepoXMLHandler extends DefaultHandler {
} else { } else {
removeRequestedPermission(attributes.getValue("name")); removeRequestedPermission(attributes.getValue("name"));
} }
} else if ("uses-feature".equals(localName) && curapk != null) {
System.out.println("TODO startElement " + uri + " " + localName + " " + qName);
// TODO
} }
curchars.setLength(0); curchars.setLength(0);
} }

View File

@ -1,6 +1,7 @@
package org.fdroid.fdroid.updater; package org.fdroid.fdroid.updater;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonParser;
@ -177,7 +178,6 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
Repo.PUSH_REQUEST_ACCEPT_ALWAYS); Repo.PUSH_REQUEST_ACCEPT_ALWAYS);
indexV0Details.apps.size(); indexV0Details.apps.size();
System.out.println("total apps: " + apps.length + " " + indexV0Details.apps.size());
assertEquals(indexV0Details.apps.size(), apps.length); assertEquals(indexV0Details.apps.size(), apps.length);
assertEquals(apps.length, packages.size()); assertEquals(apps.length, packages.size());
@ -336,13 +336,10 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
fields.remove(field); fields.remove(field);
} }
if (fields.size() > 0) { if (fields.size() > 0) {
System.out.print(instance.getClass() + " has fields not setup for Jackson: "); String sb = String.valueOf(instance.getClass()) + " has fields not setup for Jackson: " +
for (String field : fields) { TextUtils.join(", ", fields) + "\nRead class javadoc for more info.";
System.out.print("\"" + field + "\", "); fail(sb);
}
System.out.println("\nRead class javadoc for more info.");
} }
assertEquals(0, fields.size());
} }
@Test @Test
@ -408,7 +405,6 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
} }
private Repo parseRepo(ObjectMapper mapper, JsonParser parser) throws IOException { private Repo parseRepo(ObjectMapper mapper, JsonParser parser) throws IOException {
System.out.println("parseRepo ");
parser.nextToken(); parser.nextToken();
parser.nextToken(); parser.nextToken();
ObjectReader repoReader = mapper.readerFor(Repo.class); ObjectReader repoReader = mapper.readerFor(Repo.class);