Browse Source

fixes #3920, workaround for glassfish 3 bug

svn changeset:10584/svn branch:6.2
tags/6.7.0.beta1
Matti Tahvonen 14 years ago
parent
commit
7a2b2b4b34
1 changed files with 20 additions and 3 deletions
  1. 20
    3
      src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java

+ 20
- 3
src/com/vaadin/terminal/gwt/server/JsonPaintTarget.java View File

@@ -1009,13 +1009,11 @@ public class JsonPaintTarget implements PaintTarget {
* integer strings to optimized transferred data.
*/
Class<? extends Paintable> class1 = paintable.getClass();
ClientWidget annotation = class1.getAnnotation(ClientWidget.class);
while (annotation == null) {
while (!hasClientWidgetMapping(class1)) {
Class<?> superclass = class1.getSuperclass();
if (superclass != null
&& Paintable.class.isAssignableFrom(superclass)) {
class1 = (Class<? extends Paintable>) superclass;
annotation = class1.getAnnotation(ClientWidget.class);
} else {
System.out
.append("Warning: no superclass of givent has ClientWidget"
@@ -1023,11 +1021,30 @@ public class JsonPaintTarget implements PaintTarget {
break;
}
}

usedPaintableTypes.add(class1);
return AbstractCommunicationManager.getTagForType(class1);

}

private boolean hasClientWidgetMapping(Class<? extends Paintable> class1) {
try {
ClientWidget annotation = class1.getAnnotation(ClientWidget.class);
return annotation != null;
} catch (RuntimeException e) {
if (e.getStackTrace()[0].getClassName().equals(
"org.glassfish.web.loader.WebappClassLoader")) {
// Glassfish 3 is darn eager to load the value class, even
// though we just want to check if the annotation exists.
// See #3920, remove this hack when fixed in glassfish
return true;
} else {
// throw exception forward
throw e;
}
}
}

Collection<Class<? extends Paintable>> getUsedPaintableTypes() {
return usedPaintableTypes;
}

Loading…
Cancel
Save