xlawrence 2005/04/26 18:12:22 CEST
Modified files: (Branch: JAHIA-4-1-BRANCH)
src/java/org/jahia/blogs/actions AbstractAction.java
Log:
Corrected empty field value bug
Revision Changes Path
1.1.2.11 +21 -11
jahia/src/java/org/jahia/blogs/actions/AbstractAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/src/java/org/jahia/blogs/actions/AbstractAction.java.diff?r1=1.1.2.10&r2=1.1.2.11&f=h
Index: AbstractAction.java
===================================================================
RCS file:
/home/cvs/repository/jahia/src/java/org/jahia/blogs/actions/Attic/AbstractAction.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- AbstractAction.java 26 Apr 2005 11:48:04 -0000 1.1.2.10
+++ AbstractAction.java 26 Apr 2005 16:12:22 -0000 1.1.2.11
@@ -412,8 +412,8 @@
buffer.append("<");
buffer.append(containerNames.getValue(containerNames.POST_TITLE));
buffer.append(">");
- buffer.append(postContainer.getField(containerNames.getValue(
- containerNames.POST_TITLE)).getValue());
+ buffer.append(postContainer.getFieldValue(containerNames.getValue(
+ containerNames.POST_TITLE), "n/a"));
buffer.append("</");
buffer.append(containerNames.getValue(containerNames.POST_TITLE));
buffer.append(">");
@@ -461,21 +461,29 @@
Hashtable postInfo = new Hashtable(8);
String fieldName =
containerNames.getValue(containerNames.POST_TITLE);
- JahiaField f = postContainer.getField(fieldName);
- if (f != null) postInfo.put(MetaPostInfo.TITLE, f.getValue());
+ postInfo.put(MetaPostInfo.TITLE,
+ postContainer.getFieldValue(fieldName, "n/a"));
+
fieldName = containerNames.getValue(containerNames.POST_EXCERPT);
- f = postContainer.getField(fieldName);
- if (f != null) postInfo.put(MetaPostInfo.MT_EXCERPT, f.getValue());
+ JahiaField f = postContainer.getField(fieldName);
+ if (f != null) {
+ postInfo.put(MetaPostInfo.MT_EXCERPT,
+ postContainer.getFieldValue(fieldName, "n/a"));
+ }
+
fieldName = containerNames.getValue(containerNames.POST_KEYWORDS);
f = postContainer.getField(fieldName);
- if (f != null) postInfo.put(MetaPostInfo.MT_EXCERPT, f.getValue());
+ if (f != null) {
+ postInfo.put(MetaPostInfo.MT_EXCERPT,
+ postContainer.getFieldValue(fieldName, "n/a"));
+ }
fieldName = containerNames.getValue(containerNames.POST_BODY);
- f = postContainer.getField(fieldName);
- if (f != null) postInfo.put(MetaPostInfo.DESCRIPTION,
this.getValue(f));
-
+ postInfo.put(MetaPostInfo.DESCRIPTION,
+ this.getValue(postContainer.getField(fieldName)));
+
fieldName = containerNames.getValue(containerNames.POST_AUTHOR);
JahiaUser author = servicesRegistry.getJahiaSiteUserManagerService().
getMember(jParams.getSiteID(),
postContainer.getField(fieldName).
@@ -513,7 +521,7 @@
postInfo.put(MetaPostInfo.PERMANENT_LINK, url);
- if (categories != null) {
+ if (categories != null && categories.size() > 0) {
postInfo.put(MetaPostInfo.CATEGORIES, fromSet(categories));
}
@@ -732,7 +740,9 @@
*/
protected String getValue(JahiaField field)
throws JahiaException {
+ if (field == null) return "n/a";
String value = field.getValue();
+ if (value == null || value.length() == 0) return "n/a";
if (value.indexOf("<html>") != -1) {
String tag = "<html>";
String endTag = "</html>";