History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: UP-1197
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Brad Johnson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
uPortal

cpd files don't reference the DTD channelPublishingDocument.dtd and don't validate against it

Created: 08/Aug/05 06:45 PM   Updated: 03/Jul/07 04:12 PM
Component/s: None
Affects Version/s: 2.5.0 GA, 2.4.3
Fix Version/s: 2.5.3 RC3

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Issue Links:
Block
This issue blocks:
UP-1295 sanity check CPDs at startup Minor Reopened
UP-1521 Need dtd to validate PersonDirs.xml Minor Closed
 
Duplicate
 
This issue is duplicated by:
UP-1295 sanity check CPDs at startup Minor Reopened
Generic Relation
 
This issue relates to:
UP-1443 Incomplete channelPublishingDocument.dtd Trivial Closed


 Description  « Hide
*.cpd files don't reference the DTD channelPublishingDocument.dtd and don't validate against it.

For example the file CWebProxy.cpd. Also, see related bug UP-245.

 All   Comments   Work Log   Change History      Sort Order:
Brad Johnson [17/May/06 01:08 PM]
On HEAD I got this exception when trying to publish a CWebProxy channel

org.jasig.portal.ResourceMissingException: java.io.FileNotFoundException: /home/jjohnson/jakarta-tomcat-5.0.28_1/channelPublishing.dtd (No such file or directory)
at org.jasig.portal.ChannelRegistryManager.getCPD(ChannelRegistryManager.java:657)
at org.jasig.portal.channels.CChannelManager$CPDWorkflowSection.<init>(CChannelManager.java:861)
at org.jasig.portal.channels.CChannelManager$Workflow.addChannelParamsSection(CChannelManager.java:807)
at org.jasig.portal.channels.CChannelManager$Workflow.toXML(CChannelManager.java:777)
at org.jasig.portal.channels.CChannelManager.doAction(CChannelManager.java:401)
at org.jasig.portal.channels.CChannelManager.setRuntimeData(CChannelManager.java:117)
at org.jasig.portal.ChannelRenderer$Worker.execute(ChannelRenderer.java:459)
at org.jasig.portal.utils.threading.BaseTask.run(BaseTask.java:27)
at edu.emory.mathcs.backport.java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:431)
at edu.emory.mathcs.backport.java.util.concurrent.FutureTask.run(FutureTask.java:166)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:643)
at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:668)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException: /home/jjohnson/jakarta-tomcat-5.0.28_1/channelPublishing.dtd (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at org.jasig.portal.utils.ResourceLoader.getResourceAsDocument(ResourceLoader.java:182)
at org.jasig.portal.ChannelRegistryManager.getCPD(ChannelRegistryManager.java:655)
... 12 more


George Lindholm [19/May/06 03:40 PM]
SIgh. Even when not validating, the SAXParser insists on opening the dtd file, and there
appears to be no way of letting the parser know where the dtd file lives.

So for the moment, no dtd reference is possible


Brad Johnson [19/May/06 03:45 PM]
The bookmarks channel may have some code that will help you with the dtd:

// Turn validation on for the DOM parser to make sure it reads the DTD
domParser.setFeature("http://xml.org/sax/features/validation", true);
DTDResolver dtdResolver = new DTDResolver("xbel-1.0.dtd");
domParser.setEntityResolver(dtdResolver);

// Parse the XML document containing the user's bookmarks
domParser.parse(new InputSource(new StringReader(inputXML)));


Brad Johnson [23/May/06 05:03 PM]
Hey George,

Here's an example patch that fixes uPortal so it will use the services.dtd when parsing the services.xml file. I've tested this and it works.

thanks,
Brad

Index: ExternalServices.java
===================================================================
RCS file: /home/cvs/jasig/portal/source/org/jasig/portal/services/ExternalServices.java,v
retrieving revision 1.15
diff -u -r1.15 ExternalServices.java
— ExternalServices.java 31 Mar 2005 20:37:40 -0000 1.15
+++ ExternalServices.java 23 May 2006 21:00:29 -0000
@@ -21,9 +21,13 @@
import org.apache.commons.logging.LogFactory;
import org.jasig.portal.PortalException;
import org.jasig.portal.car.CarResources;
+import org.jasig.portal.utils.DTDResolver;
import org.jasig.portal.utils.ResourceLoader;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;

/**

  • ExternalServices starts up all the runtime services for the uPortal.
    @@ -86,8 +90,10 @@
    if ( svcDescriptor != null )
    {
    try { - SAXParser parser = svcMgr.createParser(); - parser.parse(svcDescriptor, svcMgr.svcHandler); + XMLReader parser = XMLReaderFactory.createXMLReader(); + parser.setEntityResolver(new DTDResolver("services.dtd")); + parser.setContentHandler(svcMgr.svcHandler); + parser.parse(new InputSource(svcDescriptor)); } catch (Exception ex) {
    throw new PortalException ("Failed to start external portal " +
    "services defined in services.xml.",

George Lindholm [25/May/06 02:01 PM]
OK. The DOCTYPE is back in and ResourceLoader now uses DTDResolver to find the dtd.

Not yet validating.


George Lindholm [25/May/06 03:31 PM]
Not sure what to do about validating.

When I enable validation I got a complaint about PersonDirs.xml not having a DOCTYPE, so I
added/created one. Now I get a NPE because personAttributeDao is invoked
before uPortal has been initialized so there is no way to load the PersonsDir.dtd
with PortalSessionManager.getResourceAsStream()

Any ideas?


George Lindholm [25/Jul/06 08:02 PM]
I figured out how to find the dtd file if the tomcat context s not available