Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/UrlInputOpenerPreference.java

Issue 29480569: Issue 5254 - Improve URL verification when whitelisting domains (Closed)
Patch Set: Created July 5, 2017, 9:05 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« adblockplussbrowser/build.gradle ('K') | « adblockplussbrowser/proguard-rules.pro ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/UrlInputOpenerPreference.java
===================================================================
--- a/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/UrlInputOpenerPreference.java
+++ b/adblockplussbrowser/src/org/adblockplus/sbrowser/contentblocker/UrlInputOpenerPreference.java
@@ -20,26 +20,26 @@ package org.adblockplus.sbrowser.content
import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.AttributeSet;
-import android.util.Patterns;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import org.adblockplus.adblockplussbrowser.R;
import org.adblockplus.sbrowser.contentblocker.util.PreferenceUtils;
+import org.apache.commons.validator.routines.DomainValidator;
public class UrlInputOpenerPreference extends EditTextPreference implements TextWatcher,
TextView.OnEditorActionListener
{
private OnUrlReadyListener onUrlReadyListener;
private AlertDialog mAlertDialog;
@@ -129,17 +129,17 @@ public class UrlInputOpenerPreference ex
public void setOnUrlReadyListener(OnUrlReadyListener listener)
{
this.onUrlReadyListener = listener;
}
private boolean isValidUrl()
{
- return Patterns.WEB_URL.matcher(getUrl()).matches();
+ return DomainValidator.getInstance().isValid(getUrl());
anton 2017/07/06 06:51:10 it's misleading - we validate URL with Apache DOMA
jens 2017/07/06 08:49:06 The purpose of this change is, to have a reliable
}
private String getUrl()
{
return getEditText().getText().toString();
}
private void setPositiveButtonEnabled(boolean enabled)
« adblockplussbrowser/build.gradle ('K') | « adblockplussbrowser/proguard-rules.pro ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld