Commit e7a03960d4a7292e07ca706b4bee74c020804552

Authored by higo.gomes
1 parent 6af6311f

Correção com zero erros.

git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/ASES%20-%20Web/ASES%20-%20Web/Fontes/avaliador-api@10690 c2178572-b5ca-4887-91d2-9e3a90c7d55b
src/main/java/br/com/checker/emag/core/ContentEvaluation.java
... ... @@ -410,10 +410,12 @@ public class ContentEvaluation extends Evaluation {
410 410 && !link.getAttributeValue("href").substring(0, 1).equals("/")
411 411 && !link.getAttributeValue("href").contains("javascript")) {
412 412  
413   - int[] codErro = { 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
  413 + /*int[] codErro = { 400, 401, 402, 403, 404, 405, 406, 407, 408, 409,
414 414 410, 411, 412, 414, 415, 416, 417, 418, 422, 423, 424, 425,
415   - 426, 450, 499, 500, 501, 502, 503, 504, 505 };
  415 + 426, 450, 499, 500, 501, 502, 503, 504, 505 };*/
416 416 int codResponse = 0;
  417 +
  418 + int[] codErro = {404};
417 419  
418 420 String regex = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]+$";
419 421  
... ... @@ -445,11 +447,13 @@ public class ContentEvaluation extends Evaluation {
445 447 * if(huc.getResponseCode() != HttpURLConnection.HTTP_OK)
446 448 * System.out.println(link.toString());
447 449 */
448   - for (int cod : codErro)
  450 + for (int cod : codErro)
  451 + {
449 452 if (codResponse == cod) {
450 453 return true;
451 454 }
452   -
  455 +
  456 + }
453 457 }
454 458  
455 459 return false;
... ... @@ -835,16 +839,16 @@ public class ContentEvaluation extends Evaluation {
835 839 * table, "1")); }
836 840 */
837 841  
838   - for (Element table : getDocument().getAllElements("table")) {
  842 + /*for (Element table : getDocument().getAllElements("table")) {
839 843 for (Element caption : table.getAllElements("caption")) {
840 844 if (caption == null || caption.isEmpty())
841 845 occurrences.add(buildOccurrence("3.10", true, table
842 846 .getStartTag().toString(), table, "1"));
843 847 }
844   - }
  848 + }*/
845 849  
846 850 for (Element table : getDocument().getAllElements("table")) {
847   - Attribute summary = table.getAttributes().get("summary");
  851 + //Attribute summary = table.getAttributes().get("summary");
848 852  
849 853 boolean THusaScope = false;
850 854 boolean THusaId = false;
... ... @@ -856,9 +860,9 @@ public class ContentEvaluation extends Evaluation {
856 860 boolean usaTfoot = false;
857 861 boolean usaTbody = false;
858 862  
859   - if (summary == null || summary.getValue().equals(""))
  863 + /*if (summary == null || summary.getValue().equals(""))
860 864 occurrences.add(buildOccurrence("3.10", true, table
861   - .getStartTag().toString(), table, "1"));
  865 + .getStartTag().toString(), table, "1"));*/
862 866  
863 867 for (Element thead : table.getAllElements("thead")) {
864 868 if (thead != null)
... ...
src/main/java/br/com/checker/emag/core/MarkEvaluation.java
... ... @@ -217,13 +217,22 @@ public class MarkEvaluation extends Evaluation {
217 217 }
218 218 }
219 219  
220   - for (Element element : getDocument().getAllElements("script")) {
221   - // if(element.getAttributeValue("src") ==null)
222   - if (element != null)
223   - occurrences.add(this.buildOccurrence("1.1", false,
224   - element.toString(), element, "6"));
  220 + for (Element element : getDocument().getAllElements("script")) {
  221 +
  222 +
  223 + if (element != null )
  224 + {
  225 +
  226 + if (!element.getContent().getTextExtractor().toString().trim().equalsIgnoreCase("")) {
  227 + occurrences.add(this.buildOccurrence("1.1", false,
  228 + element.toString(), element, "6"));
  229 +
  230 + }
  231 +
  232 +
  233 + }
225 234 }
226   -
  235 +
227 236 this.oder(occurrences);
228 237  
229 238 return occurrences;
... ...