FIX: WinIOException Occurs when Calling dumpHTML or dumpDHTMLID: Q195173
|
When calling DhDocument.dumpHTML() or DhDocument.dumpDHTML() the following exception might occur:
com.ms.wfc.io.WinIOException: The system cannot find the path specified
(D:/Visual%20Studio%20Projects/Dump%20Test/__dump.txt)
at com/ms/wfc/io/File.<init> (File.java)
at com/ms/wfc/io/File.create (File.java)
at com/ms/wfc/html/DhDocument.writeHTML (DhDocument.java)
at com/ms/wfc/html/DhDocument.dumpHTML (DhDocument.java)
at com/ms/wfc/html/DhDocument.dumpDHTML (DhDocument.java)
The dumpHTML method does not translate URLs with "%20" into a space when
determining the file name to create.
NOTE: Other characters besides "%20" in the URL might also not be translated properly.
void dumpDHTML(Object, Event) has been deprecated by the author
of 'com.ms.wfc.html.DhDocument' and should not be used.
Do one of the following to work around this issue:
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
import com.ms.wfc.html.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
public class Class1 extends DhDocument
{
public Class1()
{
initForm();
}
private void initForm()
{
}
protected void onDocumentLoad(Object sender, Event e)
{
DhButton button=new DhButton("button");
add(button);
this.dumpDHTML(null,null);
// Workaround1: Uncomment the next line and comment the above line.
// You must have a "c:\temp" directory or change the directory below.
// showHTML("c:\\temp\\");
// Workaround2: Uncomment the next line and comment the above line.
// You must have a blank.htm in the current directory.
// showHTML();
}
public void showHTML(String directory) {
String filename=directory+"__dump.txt";
addText(filename);
com.ms.wfc.io.File outputFile =
com.ms.wfc.io.File.create(filename);
writeHTML(outputFile);
outputFile.close();
getWindow().open(filename,"dump",null,false);
}
public void showHTML() {
// You must have a "blank.htm" in the current directory
DhWindow window=getWindow().open("blank.htm","dump",null,false);
DhDocument document=window.getDocument();
String x=getHTML();
document.add(new DhRawHTML(toHTMLViewable(getHTML())));
}
static String toHTMLViewable(String text) {
// indexOf() returns -1 if not found:
if (text.indexOf('<')+text.indexOf('>')+text.indexOf('&')==-3)
return text;
StringBuffer buffer=new StringBuffer(text);
int index=0;
String amp="amp;";
String less="lt;";
String greater="gt;";
while (buffer.length()>index) {
if (buffer.charAt(index)=='&') {
buffer.insert(index+1,amp);
} else if (buffer.charAt(index)=='<') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,less);
} else if (buffer.charAt(index)=='>') {
buffer.setCharAt(index,'&');
buffer.insert(index+1,greater);
}
index++;
}
return buffer.toString();
}
}
<HTML>
<BODY>
<hr>
<OBJECT classid="java:com.ms.wfc.html.DhModule"
height=0 width=0 ... VIEWASTEXT>
<PARAM NAME=__CODECLASS VALUE=Class1>
<PARAM NAME=CABBASE VALUE=Project1.CAB>
</OBJECT>
<!-- Insert HTML here -->
</BODY>
</HTML>
For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java,
please see the following pages on the Microsoft Technical Support site:
http://support.microsoft.com/support/visualj/
http://support.microsoft.com/support/java/
© Microsoft Corporation 1998, All Rights Reserved.
Contributions by Derek Jamison, Microsoft Corporation
Additional query words:
Keywords : kbservicepack kbhtml kbDHTML kbJava kbVJ600bug kbWFC kbVS600sp2 kbVS600SP1 kbVS600sp3fix
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: May 19, 1999