Zwei kleinere Änderungen:
- Besseres Logging bei Exceptions, die in einer JSP auftreten - Fehlerkorrektur im SelectFilter für CustomizableObjectList. Der SelectFilter war nicht null sicher, das heißt wenn der Wert für den der Select-Filter definiert ist bei einem Item nicht vorhanden ist, kam es zu einer NPE. git-svn-id: https://svn.libreccm.org/ccm/trunk@1194 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
722275e115
commit
86d98cb4c7
|
|
@ -75,23 +75,18 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
private boolean m_cache = true;
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(DefinePage.class.getName());
|
||||
|
||||
private static CacheTable s_pageCache = new CacheTable("PageCache");
|
||||
// maps URL(/packages/foo/www/asdf.jsp) -> {Page, creation date}
|
||||
// should this be a CacheTable or not?
|
||||
private static Map s_pageLocks = new HashMap();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Bebop Page instance. A page tag is a special case
|
||||
* because we don't expect it to have a parent tag.
|
||||
*/
|
||||
public int doStartTag() throws JspException {
|
||||
if (m_cache) {
|
||||
String cacheKey = DispatcherHelper.getCurrentResourcePath
|
||||
((HttpServletRequest)pageContext.getRequest());
|
||||
String cacheKey = DispatcherHelper.getCurrentResourcePath((HttpServletRequest) pageContext.getRequest());
|
||||
Object pageLock;
|
||||
// First off all we have the global synchronization
|
||||
// block to get the page's unique sync object.
|
||||
|
|
@ -110,8 +105,7 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
Object[] pair = cached.getPageTimeStampPair();
|
||||
|
||||
long pageDate = ((Long) pair[1]).longValue();
|
||||
File jspFile = new File(pageContext.getServletContext()
|
||||
.getRealPath(cacheKey));
|
||||
File jspFile = new File(pageContext.getServletContext().getRealPath(cacheKey));
|
||||
if (jspFile.lastModified() <= pageDate) {
|
||||
// jsp file is not newer than cached page,
|
||||
// and page hasn't been marked as dirty by anyone so we can use the cached page.
|
||||
|
|
@ -167,7 +161,6 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
s_pageCache.remove(resourceURL);
|
||||
}
|
||||
|
||||
|
||||
private Page buildPage() throws JspException {
|
||||
Page page;
|
||||
|
||||
|
|
@ -219,8 +212,7 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
public int doEndTag() throws JspException {
|
||||
try {
|
||||
if (m_cache) {
|
||||
String cacheKey = DispatcherHelper.getCurrentResourcePath
|
||||
((HttpServletRequest)pageContext.getRequest());
|
||||
String cacheKey = DispatcherHelper.getCurrentResourcePath((HttpServletRequest) pageContext.getRequest());
|
||||
Object pageLock;
|
||||
// Global lock to get hold of page sync object
|
||||
synchronized (s_pageLocks) {
|
||||
|
|
@ -265,8 +257,7 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
} else if (m_master != null) {
|
||||
// if we have a master page, then we pass control to it,
|
||||
// with the current (m_page) as a request attribute.
|
||||
pageContext.getRequest()
|
||||
.setAttribute("com.arsdigita.bebop.SlavePage", m_page);
|
||||
pageContext.getRequest().setAttribute("com.arsdigita.bebop.SlavePage", m_page);
|
||||
DispatcherHelper.forwardRequestByPath(m_master, pageContext);
|
||||
} else {
|
||||
// pass on the document to the ShowAll code. Note ugly
|
||||
|
|
@ -282,11 +273,9 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
try {
|
||||
doc = new Document();
|
||||
state = m_page.process(req, resp);
|
||||
}
|
||||
catch (ParserConfigurationException ex) {
|
||||
} catch (ParserConfigurationException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
catch (ServletException ex) {
|
||||
} catch (ServletException ex) {
|
||||
throw new UncheckedWrapperException(ex);
|
||||
}
|
||||
m_page.generateXML(state, doc);
|
||||
|
|
@ -302,6 +291,8 @@ public class DefinePage extends DefineContainer implements JSPConstants {
|
|||
} catch (Throwable nested) {
|
||||
// serving error page failed, so
|
||||
// percolate error up to top-level
|
||||
s_log.error("PageContext failed to handle exceptionb exception: ",
|
||||
nested);
|
||||
throw new UncheckedWrapperException(e);
|
||||
}
|
||||
return SKIP_PAGE;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import java.util.Set;
|
|||
* paginator) and using each distinct value of the property as option.
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SelectFilter implements Filter {
|
||||
|
||||
|
|
@ -129,9 +130,14 @@ public class SelectFilter implements Filter {
|
|||
while (objects.next()) {
|
||||
dobj = objects.getDataObject();
|
||||
|
||||
option = (dobj.get(property)).toString();
|
||||
final Object propValue = dobj.get(property);
|
||||
if (propValue == null) {
|
||||
continue;
|
||||
} else {
|
||||
option = propValue.toString();
|
||||
optionsSet.add(option);
|
||||
}
|
||||
}
|
||||
|
||||
options = new ArrayList<String>(optionsSet);
|
||||
Collections.sort(options);
|
||||
|
|
|
|||
Loading…
Reference in New Issue