[MGNLCAT-10] Category RSS missing in public instance if only one category was defined Created: 08/Jun/09 Updated: 04/Oct/13 Resolved: 09/Jun/09 |
|
| Status: | Closed |
| Project: | Magnolia Categorization Module |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Teresa Miyar | Assignee: | Teresa Miyar |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Description |
|
If only one category is defined in the category rss paragraph, is activated as a single value field and not as a multivalue field, when public instance tries to render this paragraph fails because getvalues returns a NPE, as getvalues cant be used in a single value field. To reproduce: in the author instance, create a category rss paragraph, activate the page, go to the public instance to check if it's been rendered. |
| Comments |
| Comment by Teresa Miyar [ 09/Jun/09 ] |
|
It also fails on regular import/export when only one item is used. |
| Comment by Teresa Miyar [ 09/Jun/09 ] |
| Comment by Boris Kraft [ 09/Jun/09 ] |
|
Maybe we can simply add a dummy entry? |
| Comment by Teresa Miyar [ 09/Jun/09 ] |
|
Potential fix: Index: src/main/java/info/magnolia/cms/core/DefaultNodeData.java
===================================================================
--- src/main/java/info/magnolia/cms/core/DefaultNodeData.java (revision 25937)
+++ src/main/java/info/magnolia/cms/core/DefaultNodeData.java (working copy)
@@ -297,13 +297,25 @@
public Value[] getValues() {
try {
return this.property.getValues();
- }
- catch (Exception e) {
+ } catch (ValueFormatException ex) {
+ try {
+ //JCR-1464 needed for export of multivalue property with only one item
+ return new Value[] { this.property.getValue() };
+ } catch (ValueFormatException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(e.getMessage(), e);
+ }
+ } catch (RepositoryException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(e.getMessage(), e);
+ }
+ }
+ } catch (RepositoryException e) {
if (log.isDebugEnabled()) {
log.debug(e.getMessage(), e);
}
- return (Value[])null;
}
+ return (Value[]) null;
}
public String getString(String lineBreak) {
@@ -633,7 +645,7 @@
public void setParent(Content parent) {
this.parent = parent;
}
-
+
public String toString() {
if (this.property == null || this.node == null) {
return super.toString();
|
| Comment by Teresa Miyar [ 09/Jun/09 ] |
|
Patch: Index: src/main/java/info/magnolia/cms/core/DefaultNodeData.java
===================================================================
--- src/main/java/info/magnolia/cms/core/DefaultNodeData.java (revision 26027)
+++ src/main/java/info/magnolia/cms/core/DefaultNodeData.java (working copy)
@@ -296,14 +296,16 @@
public Value[] getValues() {
try {
- return this.property.getValues();
- }
- catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug(e.getMessage(), e);
+ if(this.isMultiValue() == MULTIVALUE_TRUE) {
+ return this.property.getValues();
+ } else {
+ //JCR-1464 needed for export of multivalue property with only one item
+ return new Value[] { this.property.getValue() };
}
- return (Value[])null;
+ } catch (Exception e) {
+ log.error("Error retrieving value of " + this.getName());
}
+ return (Value[]) null;
}
public String getString(String lineBreak) {
@@ -633,7 +635,7 @@
public void setParent(Content parent) {
this.parent = parent;
}
-
+
public String toString() {
if (this.property == null || this.node == null) {
return super.toString();
|
| Comment by Teresa Miyar [ 09/Jun/09 ] |
|
this is fixed by |