public static ExceptionMessage translateExceptionMessage(String code,Dictionary<?,?> params) throws MessageTranslatorException {
  MessageFormat mf=lookupMessageFormat(code);
  String[] indexNames=lookupArrayIndexNames(code);
  String fieldRef=lookupFieldReference(code);
  String newCode=lookupCodeName(code);
  Object[] formatParams=new Object[indexNames.length];
  for (int i=0; i < indexNames.length; i++) {
    Object param=null;
    if (null != params) {
      param=params.get(indexNames[i]);
    }
    if (null == param) {
      formatParams[i]="";
    }
 else {
      formatParams[i]=param;
    }
  }
  String message=mf.format(formatParams);
  if (fieldRef == null) {
    return new ExceptionMessage(new ExceptionCode(newCode),message);
  }
 else {
    return new ExceptionMessage(new ExceptionCode(newCode,fieldRef),message);
  }
}

public static ExceptionMessage translateExceptionMessage ( String code , Dictionary < ? , ? > params ) throws MessageTranslatorException { MessageFormat mf = lookupMessageFormat ( code ) ; String [ ] indexNames = lookupArrayIndexNames ( code ) ; String fieldRef = lookupFieldReference ( code ) ; String newCode = lookupCodeName ( code ) ; Object [ ] formatParams = new Object [ indexNames . length ] ; for ( int i = 0 ; i < indexNames . length ; i ++ ) { Object param = null ; if ( null != params ) { param = params . get ( indexNames [ i ] ) ; } if ( null == param ) { formatParams [ i ] = "" ; } else { formatParams [ i ] = param ; } } String message = mf . format ( formatParams ) ; if ( fieldRef == null ) { return new ExceptionMessage ( new ExceptionCode ( newCode ) , message ) ; } else { return new ExceptionMessage ( new ExceptionCode ( newCode , fieldRef ) , message ) ; } }
this is the same as the translateexceptionmessage method that takes an exception code , except it takes a string representing the code to use to look up the message from the file
