Changeset 260 for trunk


Ignore:
Timestamp:
01/19/06 17:46:12 (19 years ago)
Author:
boris
Message:
  • implemented bug location logger
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/org.modelica.mdt/src/org/modelica/mdt/ErrorManager.java

    r248 r260  
    6969    private static final int INTERNAL_ERROR = 0;
    7070    private static final int INTERNAL_WARNING = 1;
     71    /* used to logg suspected bugs */
     72    private static final int ILLEGAL_INTERNAL_STATE = 2;
    7173
    7274    /**
     
    128130    public static void showCompilerError(CompilerException exception)
    129131    {
    130         boolean showErrorDialog = true;
     132        boolean showErrorDialog = false;
    131133       
    132134        /* construct the error message */
     
    145147             */
    146148        }
    147        
    148149       
    149150        String upgrade_your_software =  /* the standard remedy */
     
    261262        else
    262263        {
    263             //TODO bug location
     264            /* unexpected exception type */
     265            ErrorManager.logBug(MdtPlugin.getSymbolicName(),
     266                    "exception of unexpected type " +
     267                    exception.getClass().getName() +
     268                    " encountered");
    264269        }
    265270
     
    308313    }
    309314
     315    /**
     316     * Log illegal internal state that is a suspected bug.
     317     *
     318     * @param pluginSymbolicName the symbolic name of the plugin where the state
     319     * is occuring
     320     * @param message a descriptive message of the nature of illegalness of the
     321     * state, this description should be usable to fix the bug.
     322     *
     323     */
     324    public static void logBug(String pluginSymbolicName, String message)
     325    {
     326        /*
     327         * get the stack trace of the caller,
     328         * used to log the location of the bug
     329         */
     330        StackTraceElement ste = Thread.currentThread().getStackTrace()[3];
     331       
     332        IStatus status =
     333            new Status(IStatus.WARNING, pluginSymbolicName,
     334                ILLEGAL_INTERNAL_STATE,
     335                "illegal internal status (suspected bug) encountered at " +
     336                ste.getClassName() + "." + ste.getMethodName() +
     337                "(" + ste.getFileName() + ":" + ste.getLineNumber() + "). " +
     338                "'" + message + "'", null);
     339       
     340        MdtPlugin.getDefault().getLog().log(status);
     341
     342    }
    310343   
    311344    /**
Note: See TracChangeset for help on using the changeset viewer.