You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2005/12/01 07:02:58 UTC
svn commit: r350182 - in /incubator/roller/trunk: src/org/roller/business/
src/org/roller/business/hibernate/ src/org/roller/presentation/velocity/
web/WEB-INF/classes/
Author: snoopdave
Date: Wed Nov 30 22:02:52 2005
New Revision: 350182
URL: http://svn.apache.org/viewcvs?rev=350182&view=rev
Log:
Minor tweaks and error handling improvements
Modified:
incubator/roller/trunk/src/org/roller/business/ThemeManagerImpl.java
incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
incubator/roller/trunk/src/org/roller/presentation/velocity/BasePageServlet.java
incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
Modified: incubator/roller/trunk/src/org/roller/business/ThemeManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/ThemeManagerImpl.java?rev=350182&r1=350181&r2=350182&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/ThemeManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/ThemeManagerImpl.java Wed Nov 30 22:02:52 2005
@@ -7,8 +7,10 @@
package org.roller.business;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FilenameFilter;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -195,23 +197,26 @@
// now go through each theme and read all it's templates
Theme theme = null;
for(int i=0; i < themenames.length; i++) {
- theme = this.loadThemeFromDisk(themenames[i],
- themespath + File.separator + themenames[i]);
-
- themes.put(theme.getName(), theme);
+ try {
+ theme = this.loadThemeFromDisk(themenames[i],
+ themespath + File.separator + themenames[i]);
+ themes.put(theme.getName(), theme);
+ } catch (Throwable unexpected) {
+ // shouldn't happen, so let's learn why it did
+ mLogger.error("Problem reading theme " + themenames[i], unexpected);
+ }
}
return themes;
}
-
-
+
/**
* Another convenience method which knows how to load a single theme
* off the filesystem and return a Theme object
*/
private Theme loadThemeFromDisk(String theme_name, String themepath) {
- mLogger.debug("Loading theme "+theme_name+" from "+themepath);
+ mLogger.info("Loading theme "+theme_name+" from "+themepath);
Theme theme = new Theme();
theme.setName(theme_name);
@@ -235,35 +240,37 @@
ThemeTemplate theme_template = null;
for (int i=0; i < templates.length; i++) {
// strip off the .vm part
- template_name = templates[i].substring(0, templates[i].length() - 3);
+ template_name = templates[i].substring(0, templates[i].length() - 3);
+ File template_file = new File(themepath + File.separator + templates[i]);
+ // Continue reading theme even if problem encountered with one file
+ String msg = "read theme template file ["+template_file+"]";
+ if(!template_file.exists() && !template_file.canRead()) {
+ mLogger.error("Couldn't " + msg);
+ continue;
+ }
+ char[] chars = null;
try {
- File template_file = new File(themepath + File.separator + templates[i]);
-
- if(!template_file.exists() && !template_file.canRead()) {
- mLogger.warn("Couldn't read theme template file ["+template_file.getPath()+"]");
- continue;
- }
-
FileReader reader = new FileReader(template_file);
- char[] chars = new char[(int) template_file.length()];
- reader.read(chars);
-
- // construct ThemeTemplate representing this file
- theme_template = new ThemeTemplate(
- theme_name+":"+template_name,
- template_name,
- template_name,
- new String(chars),
- template_name,
- new Date(template_file.lastModified()));
-
- // add it to the theme
- theme.setTemplate(template_name, theme_template);
-
- } catch (Exception e) {
- // warn?
+ chars = new char[(int) template_file.length()];
+ reader.read(chars);
+ } catch (Exception noprob) {
+ mLogger.error("Exception while attempting to " + msg);
+ if (mLogger.isDebugEnabled()) mLogger.debug(noprob);
+ continue;
}
+
+ // construct ThemeTemplate representing this file
+ theme_template = new ThemeTemplate(
+ theme_name+":"+template_name,
+ template_name,
+ template_name,
+ new String(chars),
+ template_name,
+ new Date(template_file.lastModified()));
+
+ // add it to the theme
+ theme.setTemplate(template_name, theme_template);
}
// use the last mod date of the last template file
Modified: incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java?rev=350182&r1=350181&r2=350182&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/roller/business/hibernate/HibernatePlanetManagerImpl.java Wed Nov 30 22:02:52 2005
@@ -324,7 +324,7 @@
Set newEntries = new TreeSet();
try {
// for local feeds, sub.author = website.handle
- if (sub.getFeedUrl().endsWith(sub.getAuthor())) {
+ if (sub.getAuthor()!=null && sub.getFeedUrl().endsWith(sub.getAuthor())) {
logger.debug("Getting LOCAL feed "+sub.getFeedUrl());
@@ -335,12 +335,16 @@
// figure website last update time
WeblogManager blogmgr = roller.getWeblogManager();
- // ISSUE: is this too expensive; can we use cached dates instead?
Date siteUpdated = blogmgr.getWeblogLastPublishTime(website);
+ if (siteUpdated == null) { // Site never updated, skip it
+ logger.warn("Last-publish time null, skipping local feed ["
+ + website.getHandle() + "]");
+ return newEntries;
+ }
// if website last update time > subsciption last update time
List entries = new ArrayList();
- if (sub.getLastUpdated() == null || siteUpdated.after(sub.getLastUpdated())) {
+ if (sub.getLastUpdated()==null || siteUpdated.after(sub.getLastUpdated())) {
int entryCount = RollerRuntimeConfig.getIntProperty(
"site.newsfeeds.defaultEntries");
entries = blogmgr.getWeblogEntries(
Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/BasePageServlet.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/BasePageServlet.java?rev=350182&r1=350181&r2=350182&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/BasePageServlet.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/BasePageServlet.java Wed Nov 30 22:02:52 2005
@@ -128,11 +128,13 @@
} catch( Exception e ) {
pageException = e;
- response.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
if (pageException != null) {
- mLogger.error("EXCEPTION: in RollerServlet", pageException);
+ mLogger.error(pageException.getClass()
+ + " processing URL: " + request.getRequestURL());
+ mLogger.debug(pageException);
request.setAttribute("DisplayException", pageException);
}
Modified: incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties?rev=350182&r1=350181&r2=350182&view=diff
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/ApplicationResources.properties Wed Nov 30 22:02:52 2005
@@ -274,6 +274,9 @@
configForm.commentSettings=Comment and Trackback Settings
configForm.enableComments=Allow weblog comments?
configForm.enableTrackbacks=Allow weblog trackbacks?
+configForm.newsfeedSettings=Newsfeed settings
+configForm.defaultEntries=Default number of entries
+configForm.newsfeedMaxEntries=Max number of entries
configForm.fileUploadSettings=File Upload Settings
configForm.enableFileUploads=Enable File Uploads?