Made the code "more robust" (adding some try/catch and checking null
value)
This commit is contained in:
parent
3c12d6a841
commit
0d4428e341
|
@ -22,6 +22,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -67,6 +68,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -112,6 +114,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -157,6 +160,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -202,6 +206,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -247,6 +252,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -295,6 +301,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -340,6 +347,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -385,6 +393,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -430,6 +439,7 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ public class GeoportalDataViewerConstants {
|
|||
var tabCell = tr.insertCell(-1);
|
||||
var theValue = jsonObj[j][col[i]];
|
||||
//console.log("the value: "+theValue);
|
||||
if (Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||
if (theValue !== null && Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||
var formattedValueArray = "";
|
||||
for (var k = 0; k < theValue.length; k++) {
|
||||
var theValueArray = theValue[k];
|
||||
|
|
|
@ -17,6 +17,8 @@ import com.github.gwtbootstrap.client.ui.PageHeader;
|
|||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -48,6 +50,9 @@ public class SectionViewer extends Composite {
|
|||
sectionTitle.setTitle(sectionView.getSectionTitle());
|
||||
sectionTitle.setText(sectionView.getSectionTitle());
|
||||
|
||||
if (subDocuments == null)
|
||||
return;
|
||||
|
||||
Button goToTop = new Button("");
|
||||
goToTop.setType(ButtonType.LINK);
|
||||
goToTop.setIcon(IconType.DOUBLE_ANGLE_UP);
|
||||
|
@ -58,6 +63,8 @@ public class SectionViewer extends Composite {
|
|||
sectionTitle.add(goToTop);
|
||||
|
||||
boolean displayAsGallery = false;
|
||||
|
||||
try {
|
||||
for (SubDocumentView subDocumentView : subDocuments) {
|
||||
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
|
||||
GWT.log("Section with images: " + subDocumentView.getListImages());
|
||||
|
@ -80,8 +87,16 @@ public class SectionViewer extends Composite {
|
|||
GWT.log("displayAsGallery the: " + sectionView);
|
||||
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
|
||||
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
sectionGallery.fillGallery();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Displaying the whole section as a Map of Layers
|
||||
} else if (displayAsMapOfLayers) {
|
||||
GWT.log("displayAsMapOfLayers the: " + sectionView);
|
||||
|
@ -92,7 +107,8 @@ public class SectionViewer extends Composite {
|
|||
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
|
||||
if (layers != null) {
|
||||
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
|
||||
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer, subDocumentView);
|
||||
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer,
|
||||
subDocumentView);
|
||||
sectionPanelContainer.add(layerSectionViewer);
|
||||
// showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
|
||||
}
|
||||
|
@ -113,6 +129,9 @@ public class SectionViewer extends Composite {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on rendering the section: "+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -919,7 +919,7 @@ public class Geoportal_JSON_Mapper {
|
|||
if (theObjectFieldValue instanceof String) {
|
||||
String toString = (String) theObjectFieldValue;
|
||||
if (toString != null && !toString.isEmpty()) {
|
||||
toDoc.append(fieldLabel, theObjectFieldValue);
|
||||
toDoc.append(fieldLabel, toString.trim());
|
||||
} else {
|
||||
LOG.debug("Skipping String field " + fieldLabel + " its value is null or empty");
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
return [ year, month, day ].join('-');
|
||||
}
|
||||
return "";
|
||||
return date + "";
|
||||
} catch (err) {
|
||||
return date + "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue