Commit fde8de6267e8cd5d70dd8aa0285e58e990e760dc
1 parent
3f57bf21
Exists in
master
Melhoramento na verificação dos links.
Showing
2 changed files
with
8 additions
and
4 deletions
Show diff stats
src/main/java/br/com/checker/emag/core/BehaviorEvaluation.java
... | ... | @@ -220,7 +220,8 @@ public class BehaviorEvaluation extends Evaluation { |
220 | 220 | |
221 | 221 | |
222 | 222 | |
223 | - if (getDocument().getAllElements("script").size() > 0) { | |
223 | + if (getDocument().getAllElements("body").size() > 0 && getDocument().getAllElements("script").size() > 0) { | |
224 | + | |
224 | 225 | if (getDocument().getAllElements("body").get(0).getAllElements("noscript") == null |
225 | 226 | || getDocument().getAllElements("body").get(0).getAllElements("noscript").size() <= 0) { |
226 | 227 | // occurrences.add(this.buildOccurrence("2.2", true, elementScript.toString(), |
... | ... | @@ -231,7 +232,9 @@ public class BehaviorEvaluation extends Evaluation { |
231 | 232 | getDocument().getFirstElement(), "1"));// "1")); |
232 | 233 | } |
233 | 234 | } |
234 | - | |
235 | + | |
236 | + if (getDocument().getAllElements("body").size() > 0) | |
237 | + { | |
235 | 238 | if (getDocument().getAllElements("script").size() != getDocument().getAllElements("body") |
236 | 239 | .get(0).getAllElements("noscript").size()) { |
237 | 240 | for (Element elementScript : getDocument().getAllElements("script")) { |
... | ... | @@ -242,7 +245,7 @@ public class BehaviorEvaluation extends Evaluation { |
242 | 245 | |
243 | 246 | } |
244 | 247 | |
245 | - | |
248 | + } | |
246 | 249 | |
247 | 250 | if (!getDocument().getAllElements("embed").isEmpty()) { |
248 | 251 | for (Element embed : getDocument().getAllElements("embed")) | ... | ... |
src/main/java/br/com/checker/emag/core/ContentEvaluation.java
... | ... | @@ -22,6 +22,7 @@ import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; |
22 | 22 | import org.apache.commons.httpclient.HttpClient; |
23 | 23 | import org.apache.commons.httpclient.HttpMethod; |
24 | 24 | import org.apache.commons.httpclient.methods.GetMethod; |
25 | +import org.apache.commons.httpclient.methods.HeadMethod; | |
25 | 26 | import org.apache.commons.httpclient.params.HttpConnectionParams; |
26 | 27 | import org.apache.commons.httpclient.params.HttpMethodParams; |
27 | 28 | import org.apache.commons.lang3.StringUtils; |
... | ... | @@ -520,7 +521,7 @@ public class ContentEvaluation extends Evaluation { |
520 | 521 | clienteHTTPJakartaCommons.getParams().setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, |
521 | 522 | new Integer(2000)); |
522 | 523 | |
523 | - metodoRequisicaoGET = new GetMethod(UrlConvertida.toExternalForm());// URLEncoder.encode(UrlConvertida.toExternalForm(), | |
524 | + metodoRequisicaoGET = new HeadMethod(UrlConvertida.toExternalForm());// GetMethod(UrlConvertida.toExternalForm());// URLEncoder.encode(UrlConvertida.toExternalForm(), | |
524 | 525 | // "UTF-8")); |
525 | 526 | |
526 | 527 | metodoRequisicaoGET.setRequestHeader(usuario, agente); | ... | ... |