Skip to content

Commit

Permalink
Merge pull request #13076 from nextcloud/bugfix/npe-SslUntrustedCertD…
Browse files Browse the repository at this point in the history
…ialog

Bugfix NPE & Convert to Kotlin SSL Untrusted Cert Dialog
  • Loading branch information
alperozturk96 authored Jun 7, 2024
2 parents 009bb25 + 3a932b0 commit 4f2fdbc
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@
import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;

import androidx.annotation.NonNull;

public class CertificateCombinedExceptionViewAdapter implements SslUntrustedCertDialog.ErrorViewAdapter {

//private final static String TAG = CertificateCombinedExceptionViewAdapter.class.getSimpleName();

private CertificateCombinedException mSslException;
private final CertificateCombinedException mSslException;

public CertificateCombinedExceptionViewAdapter(CertificateCombinedException sslException) {
mSslException = sslException;
}

@Override
public void updateErrorView(SslUntrustedCertLayoutBinding binding) {
public void updateErrorView(@NonNull SslUntrustedCertLayoutBinding binding) {
/// clean
binding.reasonNoInfoAboutError.setVisibility(View.GONE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SslCertificateViewAdapter implements SslUntrustedCertDialog.Certifi

//private final static String TAG = SslCertificateViewAdapter.class.getSimpleName();

private SslCertificate mCertificate;
private final SslCertificate mCertificate;

/**
* Constructor
Expand All @@ -36,7 +36,7 @@ public SslCertificateViewAdapter(SslCertificate certificate) {
}

@Override
public void updateCertificateView(SslUntrustedCertLayoutBinding binding) {
public void updateCertificateView(@NonNull SslUntrustedCertLayoutBinding binding) {
if (mCertificate != null) {
binding.nullCert.setVisibility(View.GONE);
showSubject(mCertificate.getIssuedTo(), binding);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
import com.owncloud.android.databinding.SslUntrustedCertLayoutBinding;
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog;

import androidx.annotation.NonNull;

/**
* Dialog to show an Untrusted Certificate
*/
public class SslErrorViewAdapter implements SslUntrustedCertDialog.ErrorViewAdapter {

//private final static String TAG = SslErrorViewAdapter.class.getSimpleName();

private SslError mSslError;
private final SslError mSslError;

public SslErrorViewAdapter(SslError sslError) {
mSslError = sslError;
}

@Override
public void updateErrorView(SslUntrustedCertLayoutBinding binding) {
public void updateErrorView(@NonNull SslUntrustedCertLayoutBinding binding) {
/// clean
binding.reasonNoInfoAboutError.setVisibility(View.GONE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class X509CertificateViewAdapter implements SslUntrustedCertDialog.CertificateViewAdapter {

private X509Certificate mCertificate;
private final X509Certificate mCertificate;

private static final String TAG = X509CertificateViewAdapter.class.getSimpleName();

Expand All @@ -46,7 +46,7 @@ public X509CertificateViewAdapter(X509Certificate certificate) {
}

@Override
public void updateCertificateView(SslUntrustedCertLayoutBinding binding) {
public void updateCertificateView(@NonNull SslUntrustedCertLayoutBinding binding) {
if (mCertificate != null) {
binding.nullCert.setVisibility(View.GONE);
showSubject(mCertificate.getSubjectX500Principal(), binding);
Expand Down Expand Up @@ -97,7 +97,7 @@ private String getDigestString(Context context, byte[] cert) {

private String getDigestHexBytesWithColonsAndNewLines(Context context, final String digestType, final byte [] cert) {
final byte[] rawDigest;
final String newLine = System.getProperty("line.separator");
final String newLine = System.lineSeparator();

rawDigest = getDigest(digestType, cert);

Expand Down

This file was deleted.

Loading

0 comments on commit 4f2fdbc

Please sign in to comment.