dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11227
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3177: (local vn) - Fixed NPE.
------------------------------------------------------------
revno: 3177
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-03-28 14:23:41 +0700
message:
(local vn) - Fixed NPE.
modified:
local/vn/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportLocationManager.java
local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/vn/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportLocationManager.java'
--- local/vn/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportLocationManager.java 2011-03-25 09:11:30 +0000
+++ local/vn/dhis-service-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/DefaultReportLocationManager.java 2011-03-28 07:23:41 +0000
@@ -116,14 +116,21 @@
public File getReportExcelTemplateDirectory()
{
- File templateDirectory = new File( REPORT, (String) systemSettingManager
- .getSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY ) );
+ String pathConfig = (String) systemSettingManager
+ .getSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY );
+
+ if ( pathConfig == null )
+ {
+ return null;
+ }
+
+ File templateDirectory = new File( REPORT, pathConfig );
if ( !templateDirectory.exists() )
{
templateDirectory.mkdirs();
}
-
+
return templateDirectory;
}
=== modified file 'local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java'
--- local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java 2011-03-25 09:11:30 +0000
+++ local/vn/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/configuration/action/SetReportConfigurationAction.java 2011-03-28 07:23:41 +0000
@@ -29,6 +29,8 @@
import static org.apache.commons.io.FileUtils.deleteDirectory;
+import java.io.File;
+
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.reportexcel.ReportLocationManager;
@@ -77,8 +79,13 @@
public String execute()
throws Exception
- {
- deleteDirectory ( reportLocationManager.getReportExcelTemplateDirectory() );
+ {
+ File templateDir = reportLocationManager.getReportExcelTemplateDirectory();
+
+ if ( templateDir != null && templateDir.exists() )
+ {
+ deleteDirectory ( reportLocationManager.getReportExcelTemplateDirectory() );
+ }
systemSettingManager.saveSystemSetting( SystemSettingManager.KEY_REPORT_TEMPLATE_DIRECTORY, templateDirectory );