Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register
Show
Ignore:
Timestamp:
08/06/08 17:17:55 (5 months ago)
Author:
mseaton
Message:

synchronization_bidirectional_branch: merge from [4734] to [5181].

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs/branches/data_synchronization_bidirectional/src/api/org/openmrs/module/Module.java

    r4295 r5183  
    471471        } 
    472472         
     473        /** 
     474         * Add the given exceptionMessage and throwable as the startup error for this module. 
     475         * This method loops over the stacktrace and adds the detailed message  
     476         *  
     477         * @param exceptionMessage optional. the default message to show on the first line of the error message 
     478         * @param t throwable stacktrace to include in the error message 
     479         */ 
     480        public void setStartupErrorMessage(String exceptionMessage, Throwable t) { 
     481                if (t == null) 
     482                        throw new ModuleException("Startup error value cannot be null", this.getModuleId()); 
     483                 
     484                StringBuffer sb = new StringBuffer(); 
     485                 
     486                // if exceptionMessage is not null, append it 
     487                if (exceptionMessage != null) { 
     488                        sb.append(exceptionMessage); 
     489                        sb.append("\n"); 
     490                } 
     491                 
     492                sb.append(t.getMessage()); 
     493                sb.append("\n"); 
     494                 
     495                // loop over and append all stacktrace elements marking the "openmrs" ones  
     496                for (StackTraceElement traceElement : t.getStackTrace()) { 
     497                        if (traceElement.getClassName().contains("openmrs")) 
     498                                sb.append(" ** "); 
     499                        sb.append(traceElement); 
     500                        sb.append("\n"); 
     501                } 
     502                 
     503                this.startupErrorMessage = sb.toString(); 
     504        } 
     505         
    473506        public String getStartupErrorMessage() { 
    474507                return startupErrorMessage;