1 package org.tigris.scarab.util; 2 3 48 49 import org.apache.torque.TorqueException; 50 import org.tigris.scarab.tools.ScarabLocalizationTool; 51 import org.tigris.scarab.tools.localization.Localizable; 52 53 59 public class ScarabLocalizedTorqueException extends TorqueException implements Localizable 60 { 61 private final Throwable throwable; 62 63 private ScarabLocalizationTool localizer; 65 66 72 public ScarabLocalizedTorqueException(final Throwable t) 73 { 74 throwable = t; 75 localizer = null; 76 } 77 78 82 public void setLocalizer(final ScarabLocalizationTool theLocalizer) 83 { 84 localizer = theLocalizer; 85 } 86 87 91 public String getMessage() 92 { 93 return throwable.getMessage(); 94 } 95 96 97 104 public String getMessage(final ScarabLocalizationTool l10n) 105 { 106 return l10n.getMessage(throwable); 107 } 108 109 114 public String getLocalizedMessage() 115 { 116 if (localizer != null) 117 { 118 return getMessage(localizer); 119 } 120 else 121 { 122 return super.getLocalizedMessage(); 123 } 124 } 125 } 126 | Popular Tags |