summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java2
-rw-r--r--server/src/com/vaadin/server/WebBrowser.java10
-rw-r--r--server/src/com/vaadin/ui/Table.java102
3 files changed, 101 insertions, 13 deletions
diff --git a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
index f7f3e73a7f..2ad48aff8c 100644
--- a/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
+++ b/server/src/com/vaadin/data/util/sqlcontainer/SQLContainer.java
@@ -1116,7 +1116,7 @@ public class SQLContainer implements Container, Container.Filterable,
delegate.setOrderBy(sorters);
} catch (UnsupportedOperationException e) {
getLogger().log(Level.FINE,
- "The query delegate doesn't support filtering", e);
+ "The query delegate doesn't support sorting", e);
}
int newSize = delegate.getCount();
sizeUpdated = new Date();
diff --git a/server/src/com/vaadin/server/WebBrowser.java b/server/src/com/vaadin/server/WebBrowser.java
index ca0e4cd6ce..4122f053ae 100644
--- a/server/src/com/vaadin/server/WebBrowser.java
+++ b/server/src/com/vaadin/server/WebBrowser.java
@@ -293,19 +293,19 @@ public class WebBrowser implements Serializable {
}
/**
- * Gets the difference in minutes between the browser's GMT TimeZone and
+ * Returns the offset in milliseconds between the browser's GMT TimeZone and
* DST.
*
- * @return the amount of minutes that the TimeZone shifts when DST is in
- * effect
+ * @return the number of milliseconds that the TimeZone shifts when DST is
+ * in effect
*/
public int getDSTSavings() {
return dstSavings;
}
/**
- * Determines whether daylight savings time (DST) is currently in effect in
- * the region of the browser or not.
+ * Returns whether daylight saving time (DST) is currently in effect in the
+ * region of the browser or not.
*
* @return true if the browser resides at a location that currently is in
* DST
diff --git a/server/src/com/vaadin/ui/Table.java b/server/src/com/vaadin/ui/Table.java
index e73c6d7188..10752140db 100644
--- a/server/src/com/vaadin/ui/Table.java
+++ b/server/src/com/vaadin/ui/Table.java
@@ -557,6 +557,8 @@ public class Table extends AbstractSelect implements Action.Container,
*/
private boolean keyMapperReset;
+ private List<Throwable> exceptionsDuringCachePopulation = new ArrayList<Throwable>();
+
/* Table constructors */
/**
@@ -1646,6 +1648,55 @@ public class Table extends AbstractSelect implements Action.Container,
setRowCacheInvalidated(true);
markAsDirty();
+ maybeThrowCacheUpdateExceptions();
+
+ }
+
+ private void maybeThrowCacheUpdateExceptions() {
+ if (!exceptionsDuringCachePopulation.isEmpty()) {
+ Throwable[] causes = new Throwable[exceptionsDuringCachePopulation
+ .size()];
+ exceptionsDuringCachePopulation.toArray(causes);
+
+ exceptionsDuringCachePopulation.clear();
+ throw new CacheUpdateException(this,
+ "Error during Table cache update", causes);
+ }
+
+ }
+
+ /**
+ * Exception thrown when one or more exceptions occurred during updating of
+ * the Table cache.
+ * <p>
+ * Contains all exceptions which occurred during the cache update.
+ * </p>
+ *
+ */
+ public static class CacheUpdateException extends RuntimeException {
+ private Throwable[] causes;
+ private Table table;
+
+ public CacheUpdateException(Table table, String message,
+ Throwable[] causes) {
+ super(message);
+ this.table = table;
+ this.causes = causes;
+ }
+
+ /**
+ * Returns the cause(s) for this exception
+ *
+ * @return the exception(s) which caused this exception
+ */
+ public Throwable[] getCauses() {
+ return causes;
+ }
+
+ public Table getTable() {
+ return table;
+ }
+
}
/**
@@ -2036,9 +2087,19 @@ public class Table extends AbstractSelect implements Action.Container,
cells[CELL_HEADER][i] = String.valueOf(i + firstIndex + 1);
break;
default:
- cells[CELL_HEADER][i] = getItemCaption(id);
+ try {
+ cells[CELL_HEADER][i] = getItemCaption(id);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ cells[CELL_HEADER][i] = "";
+ }
+ }
+ try {
+ cells[CELL_ICON][i] = getItemIcon(id);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ cells[CELL_ICON][i] = null;
}
- cells[CELL_ICON][i] = getItemIcon(id);
}
GeneratedRow generatedRow = rowGenerator != null ? rowGenerator
@@ -2056,7 +2117,12 @@ public class Table extends AbstractSelect implements Action.Container,
boolean isGenerated = isGeneratedRow || isGeneratedColumn;
if (!isGenerated) {
- p = getContainerProperty(id, colids[j]);
+ try {
+ p = getContainerProperty(id, colids[j]);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ value = null;
+ }
}
if (isGeneratedRow) {
@@ -2089,7 +2155,12 @@ public class Table extends AbstractSelect implements Action.Container,
if (isGeneratedColumn) {
ColumnGenerator cg = columnGenerators
.get(colids[j]);
- value = cg.generateCell(this, id, colids[j]);
+ try {
+ value = cg.generateCell(this, id, colids[j]);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ value = null;
+ }
if (value != null && !(value instanceof Component)
&& !(value instanceof String)) {
// Avoid errors if a generator returns
@@ -2098,10 +2169,20 @@ public class Table extends AbstractSelect implements Action.Container,
value = value.toString();
}
} else if (iscomponent[j]) {
- value = p.getValue();
+ try {
+ value = p.getValue();
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ value = null;
+ }
listenProperty(p, oldListenedProperties);
} else if (p != null) {
- value = getPropertyValue(id, colids[j], p);
+ try {
+ value = getPropertyValue(id, colids[j], p);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ value = null;
+ }
/*
* If returned value is Component (via fieldfactory
* or overridden getPropertyValue) we expect it to
@@ -2114,7 +2195,12 @@ public class Table extends AbstractSelect implements Action.Container,
listenProperty(p, oldListenedProperties);
}
} else {
- value = getPropertyValue(id, colids[j], null);
+ try {
+ value = getPropertyValue(id, colids[j], null);
+ } catch (Exception e) {
+ exceptionsDuringCachePopulation.add(e);
+ value = null;
+ }
}
}
}
@@ -3049,6 +3135,7 @@ public class Table extends AbstractSelect implements Action.Container,
indexInRowbuffer, itemId);
}
target.endTag("urows");
+ maybeThrowCacheUpdateExceptions();
}
private void paintPartialRowAdditions(PaintTarget target,
@@ -3096,6 +3183,7 @@ public class Table extends AbstractSelect implements Action.Container,
target.addAttribute("firstprowix", firstIx);
target.addAttribute("numprows", count);
target.endTag("prows");
+ maybeThrowCacheUpdateExceptions();
}
/**