Removed ``e.printStacktrace`` and used an proper logger

This commit is contained in:
litetex 2021-11-05 18:04:49 +01:00
parent b5ad24eb47
commit 272be36dd9
4 changed files with 15 additions and 10 deletions

View File

@ -25,6 +25,7 @@ import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.os.Parcelable
import android.util.Log
import android.view.LayoutInflater
import android.view.Menu
import android.view.MenuInflater
@ -464,7 +465,7 @@ class FeedFragment : BaseStateFragment<FeedState>() {
errors.subList(i + 1, errors.size)
)
},
{ throwable -> throwable.printStackTrace() }
{ throwable -> Log.e(TAG, "Unable to process", throwable) }
)
return // this will be called on the remaining errors by handleFeedNotAvailable()
}

View File

@ -695,7 +695,7 @@ public final class Player implements
},
error -> {
if (DEBUG) {
error.printStackTrace();
Log.w(TAG, "Failed to start playback", error);
}
// In case any error we can start playback without history
initPlayback(newQueue, repeatMode, playbackSpeed, playbackPitch,
@ -4184,8 +4184,7 @@ public final class Player implements
} catch (@NonNull final IndexOutOfBoundsException e) {
// Why would this even happen =(... but lets log it anyway, better safe than sorry
if (DEBUG) {
Log.d(TAG, "player.isCurrentWindowDynamic() failed: " + e.getMessage());
e.printStackTrace();
Log.d(TAG, "player.isCurrentWindowDynamic() failed: ", e);
}
return false;
}

View File

@ -1,6 +1,7 @@
package org.schabi.newpipe.settings
import android.content.SharedPreferences
import android.util.Log
import org.schabi.newpipe.streams.io.SharpOutputStream
import org.schabi.newpipe.streams.io.StoredFileHelper
import org.schabi.newpipe.util.ZipHelper
@ -13,6 +14,9 @@ import java.io.ObjectOutputStream
import java.util.zip.ZipOutputStream
class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
companion object {
const val TAG = "ContentSetManager"
}
/**
* Exports given [SharedPreferences] to the file in given outputPath.
@ -31,7 +35,7 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
output.flush()
}
} catch (e: IOException) {
e.printStackTrace()
Log.e(TAG, "Unable to exportDatabase", e)
}
ZipHelper.addFileToZip(outZip, fileLocator.settings.path, "newpipe.settings")
@ -101,9 +105,9 @@ class ContentSettingsManager(private val fileLocator: NewPipeFileLocator) {
preferenceEditor.commit()
}
} catch (e: IOException) {
e.printStackTrace()
Log.e(TAG, "Unable to loadSharedPreferences", e)
} catch (e: ClassNotFoundException) {
e.printStackTrace()
Log.e(TAG, "Unable to loadSharedPreferences", e)
}
}
}

View File

@ -14,6 +14,8 @@ import javax.net.ssl.TrustManager;
import static org.schabi.newpipe.MainActivity.DEBUG;
import android.util.Log;
/**
* This is an extension of the SSLSocketFactory which enables TLS 1.2 and 1.1.
@ -21,6 +23,7 @@ import static org.schabi.newpipe.MainActivity.DEBUG;
*/
public class TLSSocketFactoryCompat extends SSLSocketFactory {
private static final String TAG = "TLSSocketFactoryCom";
private static TLSSocketFactoryCompat instance = null;
@ -53,9 +56,7 @@ public class TLSSocketFactoryCompat extends SSLSocketFactory {
try {
HttpsURLConnection.setDefaultSSLSocketFactory(getInstance());
} catch (NoSuchAlgorithmException | KeyManagementException e) {
if (DEBUG) {
e.printStackTrace();
}
Log.e(TAG, "Unable to setAsDefault", e);
}
}