Commit fde8de6267e8cd5d70dd8aa0285e58e990e760dc

Authored by gibransodre
1 parent 3f57bf21
Exists in master

Melhoramento na verificação dos links.

src/main/java/br/com/checker/emag/core/BehaviorEvaluation.java
@@ -220,7 +220,8 @@ public class BehaviorEvaluation extends Evaluation { @@ -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 if (getDocument().getAllElements("body").get(0).getAllElements("noscript") == null 225 if (getDocument().getAllElements("body").get(0).getAllElements("noscript") == null
225 || getDocument().getAllElements("body").get(0).getAllElements("noscript").size() <= 0) { 226 || getDocument().getAllElements("body").get(0).getAllElements("noscript").size() <= 0) {
226 // occurrences.add(this.buildOccurrence("2.2", true, elementScript.toString(), 227 // occurrences.add(this.buildOccurrence("2.2", true, elementScript.toString(),
@@ -231,7 +232,9 @@ public class BehaviorEvaluation extends Evaluation { @@ -231,7 +232,9 @@ public class BehaviorEvaluation extends Evaluation {
231 getDocument().getFirstElement(), "1"));// "1")); 232 getDocument().getFirstElement(), "1"));// "1"));
232 } 233 }
233 } 234 }
234 - 235 +
  236 + if (getDocument().getAllElements("body").size() > 0)
  237 + {
235 if (getDocument().getAllElements("script").size() != getDocument().getAllElements("body") 238 if (getDocument().getAllElements("script").size() != getDocument().getAllElements("body")
236 .get(0).getAllElements("noscript").size()) { 239 .get(0).getAllElements("noscript").size()) {
237 for (Element elementScript : getDocument().getAllElements("script")) { 240 for (Element elementScript : getDocument().getAllElements("script")) {
@@ -242,7 +245,7 @@ public class BehaviorEvaluation extends Evaluation { @@ -242,7 +245,7 @@ public class BehaviorEvaluation extends Evaluation {
242 245
243 } 246 }
244 247
245 - 248 + }
246 249
247 if (!getDocument().getAllElements("embed").isEmpty()) { 250 if (!getDocument().getAllElements("embed").isEmpty()) {
248 for (Element embed : getDocument().getAllElements("embed")) 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,6 +22,7 @@ import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
22 import org.apache.commons.httpclient.HttpClient; 22 import org.apache.commons.httpclient.HttpClient;
23 import org.apache.commons.httpclient.HttpMethod; 23 import org.apache.commons.httpclient.HttpMethod;
24 import org.apache.commons.httpclient.methods.GetMethod; 24 import org.apache.commons.httpclient.methods.GetMethod;
  25 +import org.apache.commons.httpclient.methods.HeadMethod;
25 import org.apache.commons.httpclient.params.HttpConnectionParams; 26 import org.apache.commons.httpclient.params.HttpConnectionParams;
26 import org.apache.commons.httpclient.params.HttpMethodParams; 27 import org.apache.commons.httpclient.params.HttpMethodParams;
27 import org.apache.commons.lang3.StringUtils; 28 import org.apache.commons.lang3.StringUtils;
@@ -520,7 +521,7 @@ public class ContentEvaluation extends Evaluation { @@ -520,7 +521,7 @@ public class ContentEvaluation extends Evaluation {
520 clienteHTTPJakartaCommons.getParams().setParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 521 clienteHTTPJakartaCommons.getParams().setParameter(HttpConnectionParams.CONNECTION_TIMEOUT,
521 new Integer(2000)); 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 // "UTF-8")); 525 // "UTF-8"));
525 526
526 metodoRequisicaoGET.setRequestHeader(usuario, agente); 527 metodoRequisicaoGET.setRequestHeader(usuario, agente);