1 16 package javax.faces.validator; 17 18 import javax.faces.FacesException; 19 import javax.faces.application.FacesMessage; 20 21 26 public class ValidatorException 27 extends FacesException 28 { 29 private FacesMessage _facesMessage; 30 31 public ValidatorException(FacesMessage message) 32 { 33 super(facesMessageToString(message)); 34 _facesMessage = message; 35 } 36 37 public ValidatorException(FacesMessage message, 38 Throwable cause) 39 { 40 super(facesMessageToString(message), cause); 41 _facesMessage = message; 42 } 43 44 public FacesMessage getFacesMessage() 45 { 46 return _facesMessage; 47 48 } 49 50 private static String facesMessageToString(FacesMessage message) 51 { 52 if (message.getSummary() != null) 53 { 54 if (message.getDetail() != null) 55 { 56 return message.getSummary() + ": " + message.getDetail(); 57 } 58 else 59 { 60 return message.getSummary(); 61 } 62 } 63 else 64 { 65 if (message.getDetail() != null) 66 { 67 return message.getDetail(); 68 } 69 else 70 { 71 return ""; 72 } 73 } 74 } 75 76 } 77 | Popular Tags |