1 23 package com.sun.enterprise.tools.verifier; 24 25 import com.sun.enterprise.deployment.annotation.AnnotationInfo; 26 import com.sun.enterprise.deployment.annotation.impl.DefaultErrorHandler; 27 import com.sun.enterprise.deployment.annotation.AnnotationProcessorException; 28 import com.sun.enterprise.logging.LogDomains; 29 import com.sun.enterprise.util.LocalStringManagerImpl; 30 31 import java.util.logging.Logger ; 32 import java.util.logging.LogRecord ; 33 import java.util.logging.Level ; 34 35 42 public class VerifierErrorHandler extends DefaultErrorHandler { 43 44 private Logger logger = LogDomains.getLogger(LogDomains.AVK_VERIFIER_LOGGER); 45 private ResultManager resultManager = null; 46 47 public VerifierErrorHandler(ResultManager resultManager) { 48 this.resultManager = resultManager; 49 } 50 51 public void error(AnnotationProcessorException ape) 52 throws AnnotationProcessorException { 53 logger.fine("Error : " + ape); AnnotationInfo info = ape.getLocator(); 55 String msg = (info==null) ? 56 ape.getMessage() : 57 StringManagerHelper.getLocalStringsManager().getLocalString( 58 "com.sun.enterprise.tools.verifier.annotation.error", "{3}\n annotation: {0}\n symbol: {1}\n location: {2}\n", new Object [] {info.getAnnotation(), info.getElementType(), 61 info.getAnnotatedElement(), ape.getMessage()}); 62 LogRecord logRecord = new LogRecord (Level.SEVERE, msg); 63 resultManager.log(logRecord); 64 } 65 } 66 | Popular Tags |