Commit ecfdac8e98c0c6964c72290401ccb95c393d2e3a
1 parent
c6caa736
Exists in
master
and in
1 other branch
Correção no método que retorna quantidade de erros css
Showing
1 changed file
with
23 additions
and
14 deletions
Show diff stats
src/main/java/br/com/ases/business/impl/AvaliacaoBusinessImpl.java
... | ... | @@ -566,24 +566,33 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { |
566 | 566 | |
567 | 567 | try { |
568 | 568 | if (isCss) { |
569 | - String content = WebChecker | |
570 | - .from(CSS_VALIDATOR_URL.replace("#{url}", url)) | |
571 | - .withGetRequest().execute().getContent(); | |
572 | - Matcher m = Pattern.compile( | |
573 | - "<m:errorcount>(\\d)*</m:errorcount>", | |
574 | - Pattern.MULTILINE).matcher(content); | |
569 | + String content = WebChecker.from(CSS_VALIDATOR_URL.replace("#{url}", url)).withGetRequest().execute().getContent(); | |
570 | + | |
571 | + Matcher m = Pattern.compile("<m:errorcount>(\\d)*</m:errorcount>",Pattern.MULTILINE).matcher(content); | |
572 | + | |
575 | 573 | if (m.find()) |
576 | - errors = Integer.valueOf(m.group(0) | |
577 | - .replace("<m:errorcount>", "") | |
578 | - .replace("</m:errorcount>", "")); | |
574 | + { | |
575 | + errors = Integer.valueOf(m.group(0).replace("<m:errorcount>", "").replace("</m:errorcount>", "")); | |
576 | + } | |
579 | 577 | |
580 | - m = Pattern.compile("<m:warningcount>(\\d)*</m:warningcount>", | |
581 | - Pattern.MULTILINE).matcher(content); | |
578 | + m = Pattern.compile("<m:warningcount>(\\d)*</m:warningcount>",Pattern.MULTILINE).matcher(content); | |
582 | 579 | |
583 | 580 | if (m.find()) |
584 | - warnings = Integer.valueOf(m.group(0) | |
585 | - .replace("<m:warningcount>", "") | |
586 | - .replace("</m:warningcount>", "")); | |
581 | + { | |
582 | + warnings = Integer.valueOf(m.group(0).replace("<m:warningcount>", "").replace("</m:warningcount>", "")); | |
583 | + } | |
584 | + | |
585 | + | |
586 | + if(errors == 0 && warnings == 0) | |
587 | + { | |
588 | + m = Pattern.compile("</m:errordetail>",Pattern.MULTILINE).matcher(content); | |
589 | + if (m.find()) | |
590 | + { | |
591 | + errors = -10; | |
592 | + warnings = -10; | |
593 | + } | |
594 | + } | |
595 | + | |
587 | 596 | |
588 | 597 | } else { |
589 | 598 | ... | ... |