[HepData-svn] r1896 - trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Mon Sep 28 22:07:36 BST 2015


Author: watt
Date: Mon Sep 28 22:07:36 2015
New Revision: 1896

Log:
Further checks for null in DatasetAsHtml

Modified:
   trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java

Modified: trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java
==============================================================================
--- trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Mon Sep 28 21:28:30 2015	(r1895)
+++ trunk/hepdata-webapp/src/main/java/cedar/hepdata/webapp/components/DatasetAsHtml.java	Mon Sep 28 22:07:36 2015	(r1896)
@@ -449,7 +449,7 @@
                     else {  writer.attributes("class", "xval"); }
                     if (b != null) {
                         if (b.getDescription() == null){
-                            if (b.getRelation() == Relation.EQUALS) {
+                            if (b.getRelation() != null && b.getRelation() == Relation.EQUALS) {
                                 if (b.getLowValue() != null) { low = b.getLowValue(); }
                                 if (b.getHighValue() != null) { high = b.getHighValue(); }
                                 if (b.getFocus() != null) { f = b.getFocus(); }
@@ -474,9 +474,11 @@
                                         lsd = -b.getFocusLength();
                                     }  
                                 }
-                                String f_val = Formats.forms(f,fwidth, msd,-lsd);
-                                if(lsd == -1 && f_val.endsWith(".0") &&  b.getFocusLength() == null){ f_val = f_val.substring(0,f_val.length()-2); }
-
+				String f_val = null;
+				if (f != null) {
+				    f_val = Formats.forms(f,fwidth, msd,-lsd);
+				    if(lsd == -1 && f_val.endsWith(".0") &&  b.getFocusLength() == null){ f_val = f_val.substring(0,f_val.length()-2); }
+				}
                                 if (low != null && high != null) {
                                     SignificantFigures vall = new SignificantFigures(low);
                                     lsd = vall.getLSD();
@@ -533,12 +535,16 @@
 				    else { writer.writeRaw("–"); }
                                 }
                             } else {
-                                writer.write(b.getRelation().toString());
-                                if (b.getLowValue() != null) {
-                                    writer.write(b.getLowValue().toString());
-                                } else if (b.getHighValue() != null) {
-                                    writer.write(b.getHighValue().toString());
-                                }
+				if (b.getRelation() != null) {
+				    writer.write(b.getRelation().toString());
+				    if (b.getLowValue() != null) {
+					writer.write(b.getLowValue().toString());
+				    } else if (b.getHighValue() != null) {
+					writer.write(b.getHighValue().toString());
+				    }
+				} else {
+				    writer.writeRaw("–");
+				}
                             }
                         } else {
                             writer.write(b.getDescription());


More information about the HepData-svn mailing list