You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by bu...@apache.org on 2006/12/15 16:56:47 UTC

DO NOT REPLY [Bug 41183] New: - [PATCH] Live documents with unpublished links fail

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41183

           Summary: [PATCH] Live documents with unpublished links fail
           Product: Lenya
           Version: 1.4
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: Miscellaneous
        AssignedTo: dev@lenya.apache.org
        ReportedBy: richard.frovarp@sendit.nodak.edu


If a live document has internal links to unpublished documents, when viewed an
error is thrown. I have been able to create a patch that gets around the issue,
and will still display notifications upon publication. A better method may
exist. LinkTarget throws an exception if the target doesn't exist.
LinkRewritingTransformer looks for null as an indicator of the link existing or
not, not exception. Patch catches the exception and keeps the variable at null
if an exception is thrown. To reproduce, publish only the Home page from the
default publication and view under live.

org.apache.lenya.cms.linking.LinkException: The target doesn't exist!
	at org.apache.lenya.cms.linking.LinkTarget.getDocument(LinkTarget.java:62)
	at
org.apache.lenya.cms.cocoon.transformation.LinkRewritingTransformer.startElement(LinkRewritingTransformer.java:212)
	at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java:95)
	at
org.apache.cocoon.transformation.I18nTransformer.startElement(I18nTransformer.java:1156)
	at org.apache.cocoon.xml.AbstractXMLPipe.startElement(AbstractXMLPipe.java:95)
	at
org.apache.cocoon.transformation.AbstractSAXTransformer.startElement(AbstractSAXTransformer.java:466)
	at
org.apache.lenya.cms.cocoon.transformation.MetaDataTransformer.startElement(MetaDataTransformer.java:155)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


DO NOT REPLY [Bug 41183] - [PATCH] Live documents with unpublished links fail

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41183





------- Additional Comments From andreas@apache.org  2006-12-15 08:33 -------
I introduced LinkTarget.exists() for this purpose, maybe this works:
(I didn't try it yet)

Index:
/Users/nobby/apache/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/LinkRewritingTransformer.java
===================================================================
---
/Users/nobby/apache/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/LinkRewritingTransformer.java
(revision 482993)
+++
/Users/nobby/apache/lenya/trunk/src/modules-core/linking/java/src/org/apache/lenya/cms/cocoon/transformation/LinkRewritingTransformer.java
(working copy)
@@ -36,6 +36,7 @@
 import org.apache.lenya.ac.Policy;
 import org.apache.lenya.ac.PolicyManager;
 import org.apache.lenya.cms.linking.LinkResolver;
+import org.apache.lenya.cms.linking.LinkTarget;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentFactory;
 import org.apache.lenya.cms.publication.DocumentUtil;
@@ -56,7 +57,7 @@
  * <p>
  * This transformer is applied to an XHMTL document. It processes all links
  * following the {@link LinkResolver} syntax which are denoted by
- * {@link ResourceType#getLinkAttributeXPaths()}.
+ * {@link org.apache.lenya.cms.publication.ResourceType#getLinkAttributeXPaths()}.
  * </p>
  * <p>
  * These links are resolved using the following rules:
@@ -209,8 +210,9 @@
                         if (linkUriAndQuery.length > 1) {
                             queryString = linkUriAndQuery[1];
                         }
-                        Document targetDocument =
this.linkResolver.resolve(doc, linkUri).getDocument();
-                        if (targetDocument != null) {
+                        LinkTarget target = this.linkResolver.resolve(doc,
linkUri);
+                        if (target.exists()) {
+                            Document targetDocument = target.getDocument();
                             String extension = targetDocument.getExtension();
                             if (extension.length() > 0) {
                                 extension = "." + extension;


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


DO NOT REPLY [Bug 41183] - [PATCH] Live documents with unpublished links fail

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41183





------- Additional Comments From richard.frovarp@sendit.nodak.edu  2006-12-15 07:57 -------
Created an attachment (id=19264)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=19264&action=view)
Proof of concept patch


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


DO NOT REPLY [Bug 41183] - [PATCH] Live documents with unpublished links fail

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41183


richard.frovarp@sendit.nodak.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From richard.frovarp@sendit.nodak.edu  2006-12-15 12:14 -------
That did it. Thanks.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org


DO NOT REPLY [Bug 41183] - [PATCH] Live documents with unpublished links fail

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41183>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41183


thorsten@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|1.4                         |2.0
            Version|1.4                         |2.0




------- Additional Comments From thorsten@apache.org  2007-07-16 01:58 -------
Renaming Lenya 1.4 to 2.0

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org