Commit ecfdac8e98c0c6964c72290401ccb95c393d2e3a

Authored by gibran
1 parent c6caa736

Correção no método que retorna quantidade de erros css

src/main/java/br/com/ases/business/impl/AvaliacaoBusinessImpl.java
@@ -566,24 +566,33 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness { @@ -566,24 +566,33 @@ public class AvaliacaoBusinessImpl implements AvaliacaoBusiness {
566 566
567 try { 567 try {
568 if (isCss) { 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 if (m.find()) 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 if (m.find()) 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 } else { 597 } else {
589 598