Skip to content

Commit

Permalink
Fixing broken windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Muñiz committed Nov 19, 2014
1 parent 20c6c2b commit 5ec0fca
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 26 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/sonar/report/pdf/DefaultPDFReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.util.Iterator;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.report.pdf.entity.Measures;
import org.sonar.report.pdf.entity.Project;
import org.sonar.report.pdf.entity.exception.ReportException;
Expand Down Expand Up @@ -56,6 +58,8 @@
*/
public class DefaultPDFReporter extends PDFReporter {

private static final Logger LOG = LoggerFactory.getLogger(DefaultPDFReporter.class);

private static final String REPORT_TYPE_WORKBOOK = "workbook";

private URL logo;
Expand Down Expand Up @@ -342,11 +346,11 @@ protected void printFrontPage(final Document frontPageDocument,
frontPageWriter.getDirectContent());

} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
} catch (DocumentException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/main/java/org/sonar/report/pdf/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
Expand All @@ -34,6 +37,8 @@
*/
public class Events extends PdfPageEventHelper {

private static final Logger LOG = LoggerFactory.getLogger(Events.class);

private Toc toc;
private Header header;

Expand Down Expand Up @@ -79,9 +84,9 @@ private void printPageNumber(final PdfWriter writer, final Document document) {
cb.setFontAndSize(
BaseFont.createFont("Helvetica", BaseFont.WINANSI, false), 12);
} catch (DocumentException e) {
e.printStackTrace();
LOG.error("Can not print page number", e);
} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not print page number", e);
}
cb.beginText();
cb.setTextMatrix(document.right() - 10, textBase);
Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/sonar/report/pdf/ExecutivePDFReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.util.List;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.report.pdf.entity.FileInfo;
import org.sonar.report.pdf.entity.Project;
import org.sonar.report.pdf.entity.Rule;
Expand All @@ -52,6 +54,8 @@

public class ExecutivePDFReporter extends PDFReporter {

private static final Logger LOG = LoggerFactory.getLogger(ExecutivePDFReporter.class);

private static final String REPORT_TYPE_EXECUTIVE = "executive";

private URL logo;
Expand Down Expand Up @@ -130,11 +134,11 @@ protected void printFrontPage(final Document frontPageDocument,
frontPageWriter.getDirectContent());

} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
} catch (DocumentException e) {
e.printStackTrace();
LOG.error("Can not generate front page", e);
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/org/sonar/report/pdf/Header.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.net.MalformedURLException;
import java.net.URL;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.report.pdf.entity.Project;

import com.lowagie.text.BadElementException;
Expand All @@ -39,6 +41,8 @@

public class Header extends PdfPageEventHelper {

private static final Logger LOG = LoggerFactory.getLogger(Header.class);

private URL logo;
private Project project;

Expand Down Expand Up @@ -70,11 +74,11 @@ public void onEndPage(final PdfWriter writer, final Document document) {
page.getHeight() - 20, writer.getDirectContent());
head.setSpacingAfter(10);
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate PDF header", e);
} catch (MalformedURLException e) {
e.printStackTrace();
LOG.error("Can not generate PDF header", e);
} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate PDF header", e);
}
}

Expand Down
9 changes: 4 additions & 5 deletions src/main/java/org/sonar/report/pdf/PDFReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.api.utils.HttpDownloader.HttpException;
import org.sonar.report.pdf.batch.PDFGenerator;
import org.sonar.report.pdf.builder.ComplexityDistributionBuilder;
import org.sonar.report.pdf.builder.ProjectBuilder;
import org.sonar.report.pdf.entity.ComplexityDistribution;
Expand Down Expand Up @@ -56,7 +55,7 @@
*/
public abstract class PDFReporter {

private static final Logger LOG = LoggerFactory.getLogger(PDFGenerator.class);
private static final Logger LOG = LoggerFactory.getLogger(PDFReporter.class);

private Credentials credentials;

Expand Down Expand Up @@ -201,11 +200,11 @@ public Image getTendencyImage(final int tendencyQualitative,
tendencyImage = Image.getInstance(this.getClass().getResource(
"/tendency/" + iconName));
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate tendency image", e);
} catch (MalformedURLException e) {
e.printStackTrace();
LOG.error("Can not generate tendency image", e);
} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate tendency image", e);
}
return tendencyImage;
}
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/org/sonar/report/pdf/Toc.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
import java.awt.Color;
import java.io.ByteArrayOutputStream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
Expand All @@ -36,6 +39,8 @@

public class Toc extends PdfPageEventHelper {

private static final Logger LOG = LoggerFactory.getLogger(Events.class);

private Document toc;
private ByteArrayOutputStream tocOutputStream;
private PdfPTable content;
Expand Down Expand Up @@ -102,7 +107,7 @@ public void onCloseDocument(final PdfWriter writer, final Document document) {
try {
toc.add(content);
} catch (DocumentException e) {
e.printStackTrace();
LOG.error("Can not add TOC", e);
}
}

Expand All @@ -121,7 +126,7 @@ public void setHeader(final Header header) {
writer = PdfWriter.getInstance(toc, tocOutputStream);
writer.setPageEvent(header);
} catch (DocumentException e) {
e.printStackTrace();
LOG.error("Can not add TOC", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
import java.io.IOException;
import java.net.MalformedURLException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonar.report.pdf.entity.ComplexityDistribution;

import com.lowagie.text.BadElementException;
import com.lowagie.text.Image;

public class ComplexityDistributionBuilder {

private static final Logger LOG = LoggerFactory.getLogger(ComplexityDistributionBuilder.class);

private static ComplexityDistributionBuilder builder;

private String sonarBaseUrl;
Expand Down Expand Up @@ -59,11 +63,11 @@ public Image getGraphic(final ComplexityDistribution complexityDistribution) {
image.setAlignment(Image.ALIGN_MIDDLE);
}
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate complexity distribution image", e);
} catch (MalformedURLException e) {
e.printStackTrace();
LOG.error("Can not generate complexity distribution image", e);
} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate complexity distribution image", e);
}
return image;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private void addAllMeasuresFromDocument(final Measures measures, final Resource
measures.setVersion(versionNode);
}
} catch (ParseException e) {
e.printStackTrace();
LOG.error("Can not parse date", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

public class ProjectBuilder {

private static final Logger LOG = LoggerFactory.getLogger(ProjectBuilder.class);
private static final Logger LOG = LoggerFactory.getLogger("org.sonar.PDF");

private static ProjectBuilder builder;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public Image getGraphic(final RadarGraphic radarGraphic) {
image = Image.getInstance(requestUrl);
image.setAlignment(Image.ALIGN_MIDDLE);
} catch (BadElementException e) {
e.printStackTrace();
LOG.error("Can not generate radar graphic", e);
} catch (MalformedURLException e) {
e.printStackTrace();
LOG.error("Can not generate radar graphic", e);
} catch (IOException e) {
e.printStackTrace();
LOG.error("Can not generate radar graphic", e);
}
return image;
}
Expand Down

0 comments on commit 5ec0fca

Please sign in to comment.