Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

String.isEmpty() and LinkedList.peekFirst() is not part of the Java 5…

….0 API.
commit d8ea84f46e009a7f144ee414a9fa73ea187019a3 1 parent ecc54c2
@uggedal uggedal authored jhy committed
View
8 src/main/java/org/jsoup/parser/Parser.java
@@ -107,7 +107,7 @@ private void parseEndTag() {
String tagName = tq.consumeWord();
tq.chompTo(">");
- if (!tagName.isEmpty()) {
+ if (tagName.length() != 0) {
Tag tag = Tag.valueOf(tagName);
popStackToClose(tag);
}
@@ -117,7 +117,7 @@ private void parseStartTag() {
tq.consume("<");
String tagName = tq.consumeWord();
- if (tagName.isEmpty()) { // doesn't look like a start tag after all; put < back on stack and handle as text
+ if (tagName.length() == 0) { // doesn't look like a start tag after all; put < back on stack and handle as text
tq.addFirst("&lt;");
parseTextNode();
return;
@@ -156,7 +156,7 @@ private void parseStartTag() {
// <base href>: update the base uri
if (child.tagName().equals("base")) {
String href = child.absUrl("href");
- if (!href.isEmpty()) { // ignore <base target> etc
+ if (href.length() != 0) { // ignore <base target> etc
baseUri = href;
doc.setBaseUri(href); // set on the doc so doc.createElement(Tag) will get updated base
}
@@ -187,7 +187,7 @@ private Attribute parseAttribute() {
}
tq.consumeWhitespace();
}
- if (!key.isEmpty())
+ if (key.length() != 0)
return Attribute.createFromEncoded(key, value);
else {
tq.consume(); // unknown char, keep popping so not get stuck
View
4 src/main/java/org/jsoup/parser/TokenQueue.java
@@ -193,7 +193,7 @@ public String chompTo(String seq) {
*/
public boolean consumeWhitespace() {
boolean seen = false;
- while (!queue.isEmpty() && Character.isWhitespace(queue.peekFirst())) {
+ while (!queue.isEmpty() && Character.isWhitespace(queue.peek())) {
consume();
seen = true;
}
@@ -206,7 +206,7 @@ public boolean consumeWhitespace() {
*/
public String consumeWord() {
StringBuilder wordAccum = new StringBuilder();
- while (!queue.isEmpty() && Character.isLetterOrDigit(queue.peekFirst())) {
+ while (!queue.isEmpty() && Character.isLetterOrDigit(queue.peek())) {
wordAccum.append(queue.removeFirst());
}
return wordAccum.toString();
View
2  src/test/java/org/jsoup/select/SelectorTest.java
@@ -103,7 +103,7 @@
assertEquals("div", els.get(2).tagName());
assertEquals("bar", els.get(2).attr("title"));
assertEquals("div", els.get(3).tagName());
- assertTrue(els.get(3).attr("title").isEmpty()); // missing attributes come back as empty string
+ assertTrue(els.get(3).attr("title").length() == 0); // missing attributes come back as empty string
assertFalse(els.get(3).hasAttr("title"));
assertEquals("span", els.get(4).tagName());
}
Please sign in to comment.
Something went wrong with that request. Please try again.