BUG: setBorderWidth(..,DhUnits.PERCENT) Causes ComFailException (196576)



The information in this article applies to:

  • Microsoft Visual J++ 6.0

This article was previously published under Q196576

SYMPTOMS

When you call setBorderWidth() with DhUnits.PERCENT, the following exception occurs:
com.ms.com.ComFailException: (0x80020009) Exception occurred.

CAUSE

DhUnits.PERCENT is not a valid unit in border-width specifications. The setBorderWidth() method should not accept a value of DhUnits.PERCENT.

RESOLUTION

Do not call setBorderWidth() by passing DhUnits.PERCENT because DhUnits.PERCENT is not a valid parameter.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

setBorderWidth passes the DhUnits parameter to the peer class without first verifying whether it is valid. This causes the peer to generate a ComFailException. A better implementation of setBorderWidth() is to ignore invalid parameters or throw a setBorderWidth() exception.

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)
       {
          DhTable table=new DhTable();
          add(table);
          table.setBorderWidth(DhBorders.ALL,4,DhUnits.PERCENT);
       }
    }
    						
  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 dialog box appears:
com.ms.com.ComFailException: (0x80020009) Exception occurred.

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:


Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbInetDev kbpending kbWFC KB196576