← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13735: Made dataentryformupgrader more robust against no html content

 

------------------------------------------------------------
revno: 13735
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-01-15 12:11:54 +0100
message:
  Made dataentryformupgrader more robust against no html content
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.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 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java	2014-01-07 19:29:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataentryform/DataEntryForm.java	2014-01-15 11:11:54 +0000
@@ -200,6 +200,12 @@
 
         return name.equals( other.getName() );
     }
+    
+    @Override
+    public String toString()
+    {
+        return "[" + name + "]";
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java	2013-12-17 11:49:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DataEntryFormUpgrader.java	2014-01-15 11:11:54 +0000
@@ -75,9 +75,17 @@
         {
             try
             {
-                String customForm = upgradeDataEntryForm( form.getHtmlCode() );
+                String htmlCode = form.getHtmlCode();
+                
+                if ( htmlCode == null || htmlCode.isEmpty() )
+                {
+                    log.warn( "No html content for form: " + form );
+                    continue;
+                }
+                
+                String customForm = upgradeDataEntryForm( htmlCode );
     
-                if ( customForm != null && !customForm.equals( form.getHtmlCode() ) )
+                if ( customForm != null && !customForm.equals( htmlCode ) )
                 {
                     form.setHtmlCode( customForm );
                     dataEntryFormService.updateDataEntryForm( form );