Author: michiel
Date: 2009-07-07 19:30:38 +0200 (Tue, 07 Jul 2009)
New Revision: 36634
Modified:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/util/PageContextBacking.java
Log:
It seems that something is changed that this requestless pageContext occur more
often then before. I can't make a simplified test-case yet. For the moment
handling the situation with a warning rather than a complete failure.
Modified:
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/util/PageContextBacking.java
===================================================================
---
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/util/PageContextBacking.java
2009-07-07 16:08:45 UTC (rev 36633)
+++
mmbase/trunk/applications/taglib/src/main/java/org/mmbase/bridge/jsp/taglib/util/PageContextBacking.java
2009-07-07 17:30:38 UTC (rev 36634)
@@ -161,15 +161,26 @@
}
}
public Object getOriginal(String key) {
- if (key == null) return null; // pageContext cannot accept null keys
+ if (key == null) {
+ return null; // pageContext cannot accept null keys
+ }
Object value = unwrapped.get(key);
- if (value != null) return value;
- if (pageContext.getRequest() == null) throw new
IllegalArgumentException("PageContext " + pageContext + " has no request");
- try {
- return pageContext.findAttribute((String) key);
- } catch (Exception e) {
- throw new RuntimeException(" for " + (key == null ? "NULL" :
(key.getClass() + ":" + key)) + " " + e.getMessage() , e);
+ if (value != null) {
+ return value;
}
+ if (pageContext.getRequest() == null) {
+ log.warn("PageContext " + pageContext + " has no request.");
+
+ // findAttribute would throw NPE. This is no good, you shouldn't
have had the
+ // pageContext in the first place. Probably it was stored in a the
session or so?
+ return null;
+ } else {
+ try {
+ return pageContext.findAttribute((String) key);
+ } catch (Exception e) {
+ throw new RuntimeException(" for " + (key == null ? "NULL" :
(key.getClass() + ":" + key)) + " " + e.getMessage() , e);
+ }
+ }
}
@Override public boolean containsKey(Object key) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs