package com4j;

import java.io.Serializable;
import java.io.File;

/**
 * Represents error information.
 *
 * <p>
 * This is a Java bean version of <tt>IErrorInfo</tt> COM interface.
 *
 * @author Kohsuke Kawaguchi
 */
public class ErrorInfo implements Serializable {
    private GUID guid;

    private String source;

    private String description;

    private File helpFile;

    private Integer helpContext;

    /*package*/ ErrorInfo(IErrorInfo ei) {
        try {
            this.guid = ei.guid();
        } catch (ComException e) {
            ;   // ignore
        }
        try {
            this.source = ei.source();
        } catch (ComException e) {
            ;   // ignore
        }
        try {
            this.description = ei.description();
        } catch (ComException e) {
            ;   // ignore
        }
        try {
            this.helpFile = new File(ei.helpFile());
        } catch (ComException e) {
            ;   // ignore
        }
        try {
            this.helpContext = ei.helpContext();
        } catch (ComException e) {
            ;   // ignore
        }
    }

    /**
     * Returns GUID for the interface that defined the error.
     *
     * @return
     *      null if no such information is available.
     */
    public GUID getGuid() {
        return guid;
    }

    /**
     * Returns the ProgID for the class or application that returned the error.
     *
     * @return
     *      null if no such information is available.
     */
    public String getSource() {
        return source;
    }

    /**
     * Returns a textual description of the error.
     *
     * @return
     *      null if no such information is available.
     */
    public String getDescription() {
        return description;
    }

    /**
     * Returns the path of the Help file that describes the error.
     *
     * @return
     *      null if no such information is available.
     */
    public File getHelpFile() {
        return helpFile;
    }

    /**
     * Returns the Help context identifier (ID) for the error.
     *
     * @return
     *      null if no such information is available.
     */
    public Integer getHelpContext() {
        return helpContext;
    }

    public String toString() {
        return description!=null ? description : "(no description)";
    }
}

@@ -536,36 +536,32 @@
 n e) %7B%0A         
-   ;
    // ignore%0A   
@@ -656,36 +656,32 @@
 n e) %7B%0A         
-   ;
    // ignore%0A   
@@ -786,36 +786,32 @@
 n e) %7B%0A         
-   ;
    // ignore%0A   
@@ -847,35 +847,161 @@
     
-this.helpFile = new File(ei
+String pathname = ei.helpFile();%0A            if(pathname!=null)%0A                this.helpFile = new File(pathname);%0A            else%0A                this
 .hel
@@ -1009,11 +1009,15 @@
 File
-())
+ = null
 ;%0A  
@@ -1050,36 +1050,32 @@
 n e) %7B%0A         
-   ;
    // ignore%0A   
@@ -1192,12 +1192,8 @@
     
-   ;
    /

there might be no file name available.