Browse Source

Improved comment readability in IDE editor

master
Anthony Restaino 10 years ago
parent
commit
fbd74df422
  1. 26
      src/acr/browser/lightning/WebAddress.java

26
src/acr/browser/lightning/WebAddress.java

@ -14,11 +14,11 @@ import static android.util.Patterns.GOOD_IRI_CHAR;
* *
* Web Address Parser * Web Address Parser
* *
* This is called WebAddress, rather than URL or URI, because it attempts to parse the stuff that a user will actually * This is called WebAddress, rather than URL or URI, because it attempts to
* type into a browser address widget. * parse the stuff that a user will actually type into a browser address widget.
* *
* Unlike java.net.uri, this parser will not choke on URIs missing schemes. It will only throw a ParseException if the * Unlike java.net.uri, this parser will not choke on URIs missing schemes. It
* input is really hosed. * will only throw a ParseException if the input is really hosed.
* *
* If given an https scheme but no port, fills in port * If given an https scheme but no port, fills in port
*/ */
@ -44,7 +44,8 @@ public class WebAddress {
static final int MATCH_GROUP_PATH = 5; static final int MATCH_GROUP_PATH = 5;
static Pattern sAddressPattern = Pattern.compile( static Pattern sAddressPattern = Pattern
.compile(
/* scheme */"(?:(http|https|file)\\:\\/\\/)?" + /* scheme */"(?:(http|https|file)\\:\\/\\/)?" +
/* authority */"(?:([-A-Za-z0-9$_.+!*'(),;?&=]+(?:\\:[-A-Za-z0-9$_.+!*'(),;?&=]+)?)@)?" + /* authority */"(?:([-A-Za-z0-9$_.+!*'(),;?&=]+(?:\\:[-A-Za-z0-9$_.+!*'(),;?&=]+)?)@)?" +
/* host */"([" + GOOD_IRI_CHAR + "%_-][" + GOOD_IRI_CHAR + "%_\\.-]*|\\[[0-9a-fA-F:\\.]+\\])?" + /* host */"([" + GOOD_IRI_CHAR + "%_-][" + GOOD_IRI_CHAR + "%_\\.-]*|\\[[0-9a-fA-F:\\.]+\\])?" +
@ -94,8 +95,10 @@ public class WebAddress {
} }
t = m.group(MATCH_GROUP_PATH); t = m.group(MATCH_GROUP_PATH);
if (t != null && t.length() > 0) { if (t != null && t.length() > 0) {
/* handle busted myspace frontpage redirect with /*
missing initial "/" */ * handle busted myspace frontpage redirect with missing initial
* "/"
*/
if (t.charAt(0) == '/') { if (t.charAt(0) == '/') {
mPath = t; mPath = t;
} else { } else {
@ -108,8 +111,9 @@ public class WebAddress {
throw new Exception(); throw new Exception();
} }
/* Get port from scheme or scheme from port, if necessary and /*
possible */ * Get port from scheme or scheme from port, if necessary and possible
*/
if (mPort == 443 && mScheme.equals("")) { if (mPort == 443 && mScheme.equals("")) {
mScheme = "https"; mScheme = "https";
} else if (mPort == -1) { } else if (mPort == -1) {
@ -127,8 +131,8 @@ public class WebAddress {
@Override @Override
public String toString() { public String toString() {
String port = ""; String port = "";
if ((mPort != 443 && mScheme.equals("https")) || if ((mPort != 443 && mScheme.equals("https"))
(mPort != 80 && mScheme.equals("http"))) { || (mPort != 80 && mScheme.equals("http"))) {
port = ":" + Integer.toString(mPort); port = ":" + Integer.toString(mPort);
} }
String authInfo = ""; String authInfo = "";

Loading…
Cancel
Save