Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 73443 Details for
Bug 189192
[Help] Named HTML entities cause errors in help viewer if doctype is xhtml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
patch189192.txt (text/plain), 10.26 KB, created by
Adam Archer
on 2007-07-10 12:34:22 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Adam Archer
Created:
2007-07-10 12:34:22 EDT
Size:
10.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ua.tests >Index: data/help/dynamic/xhtml_expected.txt >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ua.tests/data/help/dynamic/xhtml_expected.txt,v >retrieving revision 1.2 >diff -u -r1.2 xhtml_expected.txt >--- data/help/dynamic/xhtml_expected.txt 13 Oct 2006 19:14:44 -0000 1.2 >+++ data/help/dynamic/xhtml_expected.txt 10 Jul 2007 16:32:37 -0000 >@@ -9,7 +9,7 @@ > > <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css" /> > <title>Exporting files</title> >-<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> >+<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" xml:space="preserve"> </script> > </head> > > <body bgcolor="#ffffff"> >@@ -21,7 +21,7 @@ > <li> <img align="texttop" border="0" src="../images/win_only.png" alt="Windows only" /> > Copying and pasting to the file system, or</li> > <li> Using the >- <a class="command-link" href="javascript:executeCommand("org.eclipse.ui.file.export")"> >+ <a class="command-link" href="javascript:executeCommand("org.eclipse.ui.file.export")" shape="rect"> > <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"/> > <b>Export wizard</b></a>.</li> > </ul> >Index: data/help/dynamic/xhtml.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ua.tests/data/help/dynamic/xhtml.xml,v >retrieving revision 1.1 >diff -u -r1.1 xhtml.xml >--- data/help/dynamic/xhtml.xml 12 Oct 2006 23:31:55 -0000 1.1 >+++ data/help/dynamic/xhtml.xml 10 Jul 2007 16:32:37 -0000 >@@ -9,7 +9,7 @@ > > <link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css" /> > <title>Exporting files</title> >-<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> >+<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" xml:space="preserve"> </script> > </head> > > <body bgcolor="#ffffff"> >@@ -21,7 +21,7 @@ > <li> <img align="texttop" border="0" src="../images/win_only.png" alt="Windows only" /> > Copying and pasting to the file system, or</li> > <li> Using the >- <a class="command-link" href="javascript:executeCommand("org.eclipse.ui.file.export")"> >+ <a class="command-link" href="javascript:executeCommand("org.eclipse.ui.file.export")" shape="rect"> > <img src="PLUGINS_ROOT/org.eclipse.help/command_link.png"/> > <b>Export wizard</b></a>.</li> > </ul> >#P org.eclipse.help >Index: src/org/eclipse/help/internal/UAElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.help/src/org/eclipse/help/internal/UAElement.java,v >retrieving revision 1.6 >diff -u -r1.6 UAElement.java >--- src/org/eclipse/help/internal/UAElement.java 9 Jul 2007 20:58:34 -0000 1.6 >+++ src/org/eclipse/help/internal/UAElement.java 10 Jul 2007 16:32:38 -0000 >@@ -10,7 +10,6 @@ > *******************************************************************************/ > package org.eclipse.help.internal; > >-import java.io.StringReader; > import java.lang.reflect.Array; > import java.util.ArrayList; > import java.util.List; >@@ -31,10 +30,6 @@ > import org.w3c.dom.Document; > import org.w3c.dom.Element; > import org.w3c.dom.Node; >-import org.xml.sax.EntityResolver; >-import org.xml.sax.InputSource; >-import org.xml.sax.SAXException; >- > /* > * Base class for UA model elements. > */ >@@ -137,11 +132,7 @@ > if (builder == null) { > try { > builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); >- builder.setEntityResolver(new EntityResolver() { >- public InputSource resolveEntity(String publicId, String systemId) throws SAXException { >- return new InputSource(new StringReader("")); //$NON-NLS-1$ >- } >- }); >+ builder.setEntityResolver(new CachedEntityResolver()); > } > catch (ParserConfigurationException e) { > String msg = "Error creating document builder"; //$NON-NLS-1$ >Index: src/org/eclipse/help/internal/HelpPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.help/src/org/eclipse/help/internal/HelpPlugin.java,v >retrieving revision 1.44 >diff -u -r1.44 HelpPlugin.java >--- src/org/eclipse/help/internal/HelpPlugin.java 9 Jul 2007 20:58:34 -0000 1.44 >+++ src/org/eclipse/help/internal/HelpPlugin.java 10 Jul 2007 16:32:38 -0000 >@@ -10,15 +10,19 @@ > *******************************************************************************/ > package org.eclipse.help.internal; > >+import java.io.File; > import java.io.InputStream; >+import java.net.URL; > > import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Plugin; > import org.eclipse.core.runtime.Status; > import org.eclipse.help.internal.context.ContextManager; > import org.eclipse.help.internal.extension.ContentExtensionManager; > import org.eclipse.help.internal.index.IndexManager; > import org.eclipse.help.internal.toc.TocManager; >+import org.eclipse.osgi.service.datalocation.Location; > import org.osgi.framework.BundleContext; > > /** >@@ -40,6 +44,7 @@ > private ContentExtensionManager contentExtensionManager; > private IndexManager indexManager; > private IHelpProvider helpProvider; >+ private File configurationDirectory; > > public static void logWarning(String message) { > Status errorStatus = new Status(IStatus.WARNING, PLUGIN_ID, IStatus.OK, message, null); >@@ -131,6 +136,22 @@ > public void start(BundleContext context) throws Exception { > super.start(context); > plugin = this; >+ >+ // determine configuration location for this plug-in >+ Location location = Platform.getConfigurationLocation(); >+ if (location != null) { >+ URL configURL = location.getURL(); >+ if (configURL != null && configURL.getProtocol().startsWith("file")) { //$NON-NLS-1$ >+ configurationDirectory = new File(configURL.getFile(), PLUGIN_ID); >+ } >+ } >+ if (configurationDirectory == null) { >+ configurationDirectory = getStateLocation().toFile(); >+ } >+ } >+ >+ public static File getConfigurationDirectory() { >+ return getDefault().configurationDirectory; > } > > /* (non-Javadoc) >Index: src/org/eclipse/help/internal/dynamic/DocumentReader.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.help/src/org/eclipse/help/internal/dynamic/DocumentReader.java,v >retrieving revision 1.5 >diff -u -r1.5 DocumentReader.java >--- src/org/eclipse/help/internal/dynamic/DocumentReader.java 9 Jul 2007 20:58:34 -0000 1.5 >+++ src/org/eclipse/help/internal/dynamic/DocumentReader.java 10 Jul 2007 16:32:38 -0000 >@@ -13,18 +13,19 @@ > import java.io.IOException; > import java.io.InputStream; > import java.io.InputStreamReader; >-import java.io.StringReader; > > import javax.xml.parsers.DocumentBuilder; > import javax.xml.parsers.DocumentBuilderFactory; > import javax.xml.parsers.ParserConfigurationException; > >+import org.eclipse.help.internal.CachedEntityResolver; > import org.eclipse.help.internal.UAElement; > import org.eclipse.help.internal.UAElementFactory; > import org.w3c.dom.Document; >-import org.xml.sax.EntityResolver; >+import org.xml.sax.ErrorHandler; > import org.xml.sax.InputSource; > import org.xml.sax.SAXException; >+import org.xml.sax.SAXParseException; > > public class DocumentReader { > >@@ -40,11 +41,7 @@ > factory.setNamespaceAware(false); > factory.setExpandEntityReferences(false); > builder = factory.newDocumentBuilder(); >- builder.setEntityResolver(new EntityResolver() { >- public InputSource resolveEntity(String publicId, String systemId) throws SAXException { >- return new InputSource(new StringReader("")); //$NON-NLS-1$ >- } >- }); >+ builder.setEntityResolver(new CachedEntityResolver()); > } > InputSource input = null; > if (charset != null) { >Index: src/org/eclipse/help/internal/CachedEntityResolver.java >=================================================================== >RCS file: src/org/eclipse/help/internal/CachedEntityResolver.java >diff -N src/org/eclipse/help/internal/CachedEntityResolver.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/help/internal/CachedEntityResolver.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+package org.eclipse.help.internal; >+ >+import java.io.BufferedReader; >+import java.io.BufferedWriter; >+import java.io.File; >+import java.io.FileNotFoundException; >+import java.io.FileReader; >+import java.io.FileWriter; >+import java.io.IOException; >+import java.io.InputStreamReader; >+import java.io.StringReader; >+import java.net.URL; >+import java.net.URLConnection; >+ >+import org.xml.sax.EntityResolver; >+import org.xml.sax.InputSource; >+ >+ >+public class CachedEntityResolver implements EntityResolver { >+ >+ public InputSource resolveEntity(String publicId, String systemId) { >+ int index = systemId.lastIndexOf("/"); //$NON-NLS-1$ >+ File cachedCopy = null; >+ if (index != -1) { >+ cachedCopy = new File(HelpPlugin.getConfigurationDirectory(), "/DTDs"); //$NON-NLS-1$ >+ cachedCopy.mkdirs(); >+ cachedCopy = new File(cachedCopy, systemId.substring(index)); >+ } >+ if (cachedCopy != null) { >+ if (!cachedCopy.exists()) { >+ try { >+ URL system = new URL(systemId); >+ URLConnection sc = system.openConnection(); >+ BufferedReader in = new BufferedReader( >+ new InputStreamReader( >+ sc.getInputStream())); >+ String inputLine; >+ BufferedWriter out = new BufferedWriter(new FileWriter(cachedCopy)); >+ while ((inputLine = in.readLine()) != null) { >+ out.write(inputLine); >+ out.newLine(); >+ } >+ in.close(); >+ out.flush(); >+ out.close(); >+ } catch (IOException e) {} >+ } >+ try { >+ InputSource is = new InputSource(new FileReader(cachedCopy)); >+ is.setSystemId(systemId); >+ is.setPublicId(publicId); >+ return is; >+ } catch (FileNotFoundException e) {} >+ } >+ return new InputSource(new StringReader("")); //$NON-NLS-1$ >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 189192
:
68836
|
72626
|
73432
| 73443