Microsoft KB Archive/195173

= FIX: WinIOException Occurs when Calling dumpHTML or dumpDHTML =

Article ID: 195173

Article Last Modified on 6/14/2006

-

APPLIES TO


 * Microsoft Visual J++ 6.0 Standard Edition

-



This article was previously published under Q195173



SYMPTOMS
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. (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)



CAUSE
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.



RESOLUTION
Do one of the following to work around this issue:
 * Make sure your files are stored in a directory structure containing only numbers and letters.


 * Write your own method to show the HTML and make sure the file it creates is in a directory structure containing only numbers and letters.


 * Write your own method that loads a blank page and then dynamically adds data to the page.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are 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:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
 In Visual J++, select New Project from the File menu. In the New Project dialog box, click the New tab. In the Visual J++ Projects tree, click Web Pages. Click Code-Behind HTML. Click Open to create the project.</li>  Modify Class1.java as follows: 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; } }                       </li>  Modify Page1.html as follows: <HTML> <BODY> <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>

</BODY> </HTML> </li> Run the project.</li></ol>

RESULT: A WinIOException error occurs. To work around the problem, create an empty Blank.htm file and make sure a C:\Temp directory exists. Comment the call to dumpHTML. Uncomment the first workaround line if you want to create an output file in the C:\Temp directory and display the results. Uncomment the second workaround if you want to dynamically display the results without writing to the local drive.

<div class="references_section">