FIX: DhRow.removeAll() Causes a com.ms.com.ComFailException

ID: Q194898


The information in this article applies to:


SYMPTOMS

When you call DhRow.removeAll() the following exception occurs:

com.ms.com.ComFailException: Unknown error(0x800a0258)
at com/ms/wfc/html/om/IHTMLElement.setOuterHTML (IHTMLElement.java)
at com/ms/wfc/html/DhElementArray.removeInternal (DhForm.java)
at com/ms/wfc/html/DhElementArray.remove (DhForm.java)
at com/ms/wfc/html/DhBaseContainer.removeChildren (DhBaseContainer.java)
at com/ms/wfc/html/DhBaseContainer.removeAll (DhBaseContainer.java)


RESOLUTION

To work around this problem, remove each cell in the row individually using the DhRow.remove() method. For example, do the following to remove all of the cells from a DhRow element called row1:


DhCell[] cells = row1.getCells();
if (cells != null) {

   for (int i = 0; i < cells.length; ++i)
   row1.remove(cells[i]);

} 


STATUS

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


MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual J++, select New Project from the File menu.


  2. In the New Project dialog box, click the New tab.


  3. In the Visual J++ Projects tree, click Web Pages.


  4. Click Code-Behind HTML.


  5. Click Open to create the project.


  6. 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)
       {
          this.add(new DhHorizontalRule());
          DhTable table=new DhTable();
          add(table);
          DhRow row1,row2;
          DhCell cell;
          row1=new DhRow();
          table.add(row1);
          cell=new DhCell("Cell1");
          row1.add(cell);
          cell=new DhCell("Cell2");
          row1.add(cell);
          cell=new DhCell("Cell3");
          row1.add(cell);
          row2=new DhRow();
          table.add(row2);
          cell=new DhCell("Cell3");
          row2.add(cell);
          cell=new DhCell("Cell4");
          row2.add(cell);
          cell=new DhCell("Cell5");
          row2.add(cell);
          row1.removeAll();
    
    // to workaround the problem, comment out the above call to removeAll
    // and uncomment the following lines:
    //    DhCell[] cells = row1.getCells();
    //    if (cells != null) {
    //       for (int i = 0; i < cells.length; ++i)
    //          row1.remove(cells[i]);
    //    }
       }
    } 


  7. Modify Page1.html as follows:
    
    <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> 


  8. Run the project.


RESULT: The following exception error occurs:
com.ms.com.ComFailException: Unknown error(0x800a0258)


REFERENCES

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 1999, All Rights Reserved.
Contributions by Derek Jamison, Microsoft Corporation

Additional query words:


Keywords          : kbJava kbVJ600bug kbVS600sp3fix kbwfchtml 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 19, 1999