Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<configuration>
<source>1.6</source>
<target>1.6</target>
<executable>F:/devtools/jdk1.6.0_31/bin/javac</executable>
<executable>${env.JAVA_HOME}/bin/javac</executable>
</configuration>
<version>2.3.2</version>
</plugin>
Expand Down
33 changes: 27 additions & 6 deletions src/main/java/com/uttesh/pdfngreport/util/PdfngUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import com.uttesh.pdfngreport.common.ImageUtils;
import com.uttesh.pdfngreport.model.SystemMeta;
import com.uttesh.pdfngreport.util.xml.ReportData;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -65,12 +67,20 @@ public String getProp(String name) {
}

public static String getReportLocation() {
String location = System.getProperty(Constants.SystemProps.REPORT_OUPUT_DIR);
if (location == null || location.trim().length() == 0) {
location = (String) PDFCache.getConfig(Constants.SystemProps.REPORT_OUPUT_DIR);
}
return location;
String outputDir = System.getProperty(Constants.SystemProps.REPORT_OUPUT_DIR);
if (outputDir == null || outputDir.trim().length() == 0) {
String configOption = (String) PDFCache.getConfig(Constants.SystemProps.REPORT_OUPUT_DIR);
return absolutify(configOption);
} else {
return absolutify(outputDir);
}
}

private static String absolutify(String relative) {
String backSlashes = new File(relative).getAbsolutePath();
String forwardSlashes = backSlashes.replace('\\', '/');
return forwardSlashes;
}

public void populateReportDataProperties(ReportData reportData) throws Exception {
String reportTitle = (String) PDFCache.getConfig(Constants.SystemProps.REPORT_TITLE_PROP);
Expand Down Expand Up @@ -100,6 +110,18 @@ public void populateReportDataProperties(ReportData reportData) throws Exception
} else {
exceptionPage = Constants.SHOW;
}

File logoFilepath = new File(logoFile);
if (logoFilepath.exists()) {
// This isn't really necessary; absolutify won't do anything to paths that are already absolute
if (logoFilepath.isAbsolute())
reportData.setLogoFile(logoFile);
else
reportData.setLogoFile(absolutify(logoFile));
} else {
System.err.println("[ERROR] Logo file located at '" + absolutify(logoFile) + "' cannot be found! Disabling logo...");
logo = "hide";
}

InputStream exceptionIcon = getClass().getClassLoader().getResourceAsStream(Constants.Icons.EXCEPTION_ICON);

Expand All @@ -120,7 +142,6 @@ public void populateReportDataProperties(ReportData reportData) throws Exception
reportData.setTitleAlign(titleAlign);
reportData.setReportLocation(reportLocation);
reportData.setChart(chart);
reportData.setLogoFile(logoFile);
reportData.setLogo(logo);
reportData.setLogoAlign(logoAlign);
reportData.setExceptionPage(exceptionPage);
Expand Down