Example usage for java.lang Class isAnnotationPresent

List of usage examples for java.lang Class isAnnotationPresent

Introduction

In this page you can find the example usage for java.lang Class isAnnotationPresent.

Prototype

@Override
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) 

Source Link

Usage

From source file:com.reactivetechnologies.platform.rest.depre.RequestDispatchers.java

private void addAnnotatedClass(Class<?> restletClass) throws InstantiationException, IllegalAccessException {
    final JAXRSInstanceMetadata proxy = new JAXRSInstanceMetadata(restletClass.newInstance());
    if (restletClass.isAnnotationPresent(Path.class)) {
        String rootUri = restletClass.getAnnotation(Path.class).value();
        proxy.setRootUri(rootUri);//from ww w. j  a  v  a  2 s .  c  o  m
    }
    ReflectionUtils.doWithMethods(restletClass, new MethodCallback() {

        @Override
        public void doWith(Method method) throws IllegalArgumentException, IllegalAccessException {
            String subUri = "";
            if (method.isAnnotationPresent(Path.class)) {
                subUri = method.getAnnotation(Path.class).value();
            }
            if (method.isAnnotationPresent(GET.class)) {
                MethodDetail m = new MethodDetail(method);
                Annotation[][] mAnnots = method.getParameterAnnotations();
                int i = 0;
                for (Annotation[] annots : mAnnots) {
                    for (Annotation annot : annots) {
                        if (annot.annotationType() == QueryParam.class) {
                            m.setQueryParam(i, ((QueryParam) annot).value());
                        }
                    }
                    i++;
                }
                proxy.addGetMethod(proxy.getRootUri() + subUri, m);
            }
            if (method.isAnnotationPresent(POST.class)) {
                MethodDetail m = new MethodDetail(method);
                Annotation[][] mAnnots = method.getParameterAnnotations();
                int i = 0;
                for (Annotation[] annots : mAnnots) {
                    for (Annotation annot : annots) {
                        if (annot.annotationType() == QueryParam.class) {
                            m.setQueryParam(i, ((QueryParam) annot).value());
                        }
                    }
                    i++;
                }
                proxy.addPostMethod(proxy.getRootUri() + subUri, m);
            }

        }
    }, new MethodFilter() {

        @Override
        public boolean matches(Method method) {
            return (method.isAnnotationPresent(GET.class) || method.isAnnotationPresent(POST.class));
        }
    });

    allClasses.add(proxy);
}

From source file:com.jdon.aop.interceptor.PoolInterceptor.java

public boolean isPoolabe(TargetMetaDef targetMetaDef) {
    boolean found = false;
    if (isPoolableCache.contains(targetMetaDef.getName())) {
        found = true;/*from  w w  w .  j a  v  a 2  s  . co  m*/
    } else if (!unPoolableCache.contains(targetMetaDef.getName())) {
        Debug.logVerbose("[JdonFramework] check if it is a Poolable", module);
        ContainerWrapper containerWrapper = containerCallback.getContainerWrapper();
        Class thisCLass = containerWrapper.getComponentClass(targetMetaDef.getName());
        if (Poolable.class.isAssignableFrom(thisCLass)
                || thisCLass.isAnnotationPresent(com.jdon.annotation.intercept.Poolable.class)) {
            found = true;
            isPoolableCache.add(targetMetaDef.getName());
        } else {
            unPoolableCache.add(targetMetaDef.getName());
        }
    }
    return found;
}

From source file:cz.zcu.kiv.eegdatabase.logic.indexing.PojoIndexer.java

/**
 * Creates a document from the input POJO object.
 * @param instance The input object./*from  w w w .j a  va  2s  .  co  m*/
 * @return The created Lucene/Solr document.
 * @throws IOException
 * @throws SolrServerException
 * @throws IllegalAccessException
 */
@Override
public SolrInputDocument prepareForIndexing(Object instance)
        throws IOException, SolrServerException, IllegalAccessException {

    Class clazz = instance.getClass();
    // first find out whether the class shall be indexed
    if (!clazz.isAnnotationPresent(Indexed.class)) {
        return null;
    }

    String className = instance.getClass().getName();
    Field[] fields = clazz.getDeclaredFields();

    // then find out if any of its field has the @SolrId annotation
    int id = getId(fields, instance);
    // based on the id, add uuid, class name and id of the document
    SolrInputDocument document = new SolrInputDocument();
    document.addField(IndexField.UUID.getValue(), className + id);
    document.addField(IndexField.ID.getValue(), id);
    document.addField(IndexField.CLASS.getValue(), FullTextSearchUtils.getDocumentType(clazz));
    document.addField(IndexField.SOURCE.getValue(), IndexingUtils.SOURCE_DATABASE);

    // extract values of those fields that have the @SolrField annotation
    Map<String, Object> documentFields = null;
    try {
        documentFields = getDocumentFromAnnotatedFields(instance, LEVEL_PARENT);
    } catch (NoSuchMethodException e) {
        log.error(e);
    } catch (InvocationTargetException e) {
        log.error(e);
    }

    for (String key : documentFields.keySet()) {
        document.addField(key, documentFields.get(key));
    }

    // pote projit vsechny kolekce, pro kazdy objekt kolekce najit @SolrField anotace u jeho fieldu
    // a jeho @SolrId pro sparovani polozek v multivalued listu rodicovskeho dokumentu

    return document;
}

From source file:com.sdm.core.filter.AuthorizationRequestFilter.java

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
    Method method = resourceInfo.getResourceMethod();
    Class<?> resourceClass = resourceInfo.getResourceClass();

    //Skip Data Permission if Resource Permission is public or there is no AccessManager
    if (resourceClass.isAnnotationPresent(PermitAll.class) || accessManager == null) {
        //Auth Success
        requestContext.setProperty(Constants.REQUEST_TOKEN, new AuthInfo(0, "public-token", "unknown"));
        return;//from w  w w .  j  av a  2 s.c  om
    }

    if (!method.isAnnotationPresent(PermitAll.class)) {
        if (method.isAnnotationPresent(DenyAll.class)) {
            //Deny all Auth
            requestContext.abortWith(errorResponse(403));
            return;
        }

        final MultivaluedMap<String, String> headers = requestContext.getHeaders();
        final List<String> authorization = headers.get(HttpHeaders.AUTHORIZATION);
        final List<String> userAgents = headers.get(HttpHeaders.USER_AGENT);

        if (authorization == null || authorization.isEmpty() || userAgents == null || userAgents.isEmpty()) {
            //There is not Auth
            requestContext.abortWith(errorResponse(401));
            return;
        }

        try {
            // Clean Token
            String settingKey = Setting.getInstance().get(Setting.JWT_KEY);
            String tokenString = authorization.get(0).substring(Constants.AUTH_TYPE.length()).trim();
            byte[] jwtKey = Base64.getDecoder().decode(settingKey);

            try {
                Claims authorizeToken = Jwts.parser().setSigningKey(jwtKey).requireIssuer(userAgents.get(0))
                        .parseClaimsJws(tokenString).getBody();

                if (!accessManager.validateToken(authorizeToken)) {
                    //Auth Failed 
                    requestContext.abortWith(errorResponse(403));
                    return;
                }

                String token = authorizeToken.getId();
                String device = authorizeToken.get("device_id").toString() + ":"
                        + authorizeToken.get("device_os").toString();
                long userId = Long.parseLong(
                        authorizeToken.getSubject().substring(Constants.USER_PREFIX.length()).trim());

                AuthInfo authInfo = new AuthInfo(userId, token, device);

                //Check @UserAllowed in Class
                UserAllowed userAllowed = resourceClass.getAnnotation(UserAllowed.class);
                if (userAllowed != null && userAllowed.value()) {
                    //Skip Permission for User Allowed Class
                    requestContext.setProperty(Constants.REQUEST_TOKEN, authInfo);
                    return;
                }

                //Check @UserAllowed in Method
                userAllowed = resourceClass.getAnnotation(UserAllowed.class);
                if (userAllowed != null && userAllowed.value()) {
                    //Skip Permission for User Allowed Method
                    requestContext.setProperty(Constants.REQUEST_TOKEN, authInfo);
                    return;
                }

                //Check permission from DB
                if (!accessManager.checkPermission(authorizeToken, method, requestContext.getMethod(),
                        resourceClass)) {
                    //Validate dynamic Permission failed
                    requestContext.abortWith(errorResponse(403));
                    return;
                }

                requestContext.setProperty(Constants.REQUEST_TOKEN, authInfo);

            } catch (ClaimJwtException ex) {
                requestContext.abortWith(buildResponse(403, ex.getLocalizedMessage()));
            }

        } catch (UnsupportedJwtException | MalformedJwtException | SignatureException
                | IllegalArgumentException e) {
            LOG.error(e);
            requestContext.abortWith(buildResponse(500, e.getLocalizedMessage()));
        }
    }
}

From source file:com.google.code.struts.annotations.plugin.StrutsAnnotationConfigLoaderPlugIn.java

/**
 * Process all the classes within the specified packages that are annotated
 * with the {@link Action @Action} annotation 
 * @param moduleConfig The Struts configuration object
 * @throws Exception On any error//from  www. ja va 2  s.c o m
 */
private void processAnnotatedActions(ModuleConfig moduleConfig) throws Exception {
    StringTokenizer tokenizer = new StringTokenizer(annotatedActionsPackages, ",");
    while (tokenizer.hasMoreTokens()) {
        String pkg = tokenizer.nextToken();
        logger.debug("Processing annotated actions from package: " + pkg);
        List<Class<?>> classes = PackageIntrospector.getClasses(pkg);
        for (Class<?> c : classes) {
            if (c.isAnnotationPresent(Action.class)) {
                Action actionAnnotation = c.getAnnotation(Action.class);
                ActionConfig actionConfig = (ActionConfig) RequestUtils
                        .applicationInstance(moduleConfig.getActionMappingClass());
                // Process and "type" and "path"
                actionConfig.setType(c.getName());
                if (Strings.isEmpty(actionAnnotation.path())) {
                    actionConfig.setPath("/" + Strings.lowerCamelCase(c));
                } else if (actionAnnotation.path().startsWith("/")) {
                    actionConfig.setPath(actionAnnotation.path());
                } else {
                    actionConfig.setPath("/" + actionAnnotation.path());
                }
                if (!Strings.isEmpty(actionAnnotation.parameter())) {
                    actionConfig.setParameter(actionAnnotation.parameter());
                }

                // Process "name" (the form)
                if (!actionAnnotation.form().equals(ActionForm.class)) {
                    String form = findFormName(actionAnnotation.form(), moduleConfig);
                    actionConfig.setName(form);
                }
                // Process "forward" with annotation "@Forward" or "@Forwards". "@Forward has higher priority
                if (c.isAnnotationPresent(Forward.class)) {
                    Forward forwardAnnotation = c.getAnnotation(Forward.class);
                    ForwardConfig forwardConfig = (ForwardConfig) RequestUtils
                            .applicationInstance(moduleConfig.getActionForwardClass());
                    //forwardConfig.setContextRelative(forwardAnnotation.contextRelative());
                    forwardConfig.setName(forwardAnnotation.name());
                    forwardConfig.setPath(forwardAnnotation.path());
                    forwardConfig.setRedirect(forwardAnnotation.redirect());
                    actionConfig.addForwardConfig(forwardConfig);
                } else if (c.isAnnotationPresent(Forwards.class)) {
                    Forwards forwardsAnnotation = c.getAnnotation(Forwards.class);
                    for (Forward forwardAnnotation : forwardsAnnotation.value()) {
                        ForwardConfig forwardConfig = (ForwardConfig) RequestUtils
                                .applicationInstance(moduleConfig.getActionForwardClass());
                        //forwardConfig.setContextRelative(forwardAnnotation.contextRelative());
                        forwardConfig.setName(forwardAnnotation.name());
                        forwardConfig.setPath(forwardAnnotation.path());
                        forwardConfig.setRedirect(forwardAnnotation.redirect());
                        actionConfig.addForwardConfig(forwardConfig);
                    }
                }
                // Process "input"
                if (c.isAnnotationPresent(Input.class)) {
                    actionConfig.setInput(c.getAnnotation(Input.class).value());
                }
                // Process "scope"
                if (c.isAnnotationPresent(Scope.class)) {
                    actionConfig.setScope(c.getAnnotation(Scope.class).value().name().toLowerCase());
                }
                // Process "parameter"
                if (c.isAnnotationPresent(Parameter.class)) {
                    actionConfig.setParameter(c.getAnnotation(Parameter.class).value());
                }
                // Process "parameter" with "@Dispath" annotation
                if (c.isAnnotationPresent(Dispatch.class)) {
                    actionConfig.setParameter(c.getAnnotation(Dispatch.class).value());
                }
                // Process "set-property
                if (c.isAnnotationPresent(SetProperties.class)) {
                    SetProperties setPropertiesAnnotation = c.getAnnotation(SetProperties.class);
                    for (Property property : setPropertiesAnnotation.value()) {
                        BeanUtilsBean.getInstance().setProperty(actionConfig, property.property(),
                                property.value());
                    }
                }
                // Set "validate"
                actionConfig.setValidate(c.isAnnotationPresent(Validate.class));

                moduleConfig.addActionConfig(actionConfig);
                logger.debug("Added annotated configuration for action: " + c.getName());
            }
        }
    }
}

From source file:com.zyeeda.jofm.services.JofmService.java

private void extractMappingAnnotations(String className) throws Exception {
    LoggerHelper.debug(logger, "class name = {}", className);
    Class<?> clazz = this.getClass().getClassLoader().loadClass(className);

    String scopeName = null;//from  ww w  . j  a  v a2s  .c  o m
    if (clazz.isAnnotationPresent(Scope.class)) {
        Scope scopeAnnotation = clazz.getAnnotation(Scope.class);
        scopeName = scopeAnnotation.value();
        this.putClass(scopeAnnotation.value(), clazz);
    } else {
        LoggerHelper.warn(logger, "annotation not present", clazz);
        scopeName = clazz.getSimpleName();
        this.putClass(clazz.getSimpleName(), clazz);
    }

    Map<String, Method> methods = new HashMap<String, Method>();
    this.operationMethods.put(scopeName, methods);

    Class<?> defaultViewOperationClass = this.getClass().getClassLoader()
            .loadClass(DEFAULT_VIEW_OPERATION_CLASS_NAME);
    methods.put(DEFAULT_SHOW_CREATE_VIEW_OPERATION_NAME,
            defaultViewOperationClass.getMethod(DEFAULT_SHOW_CREATE_VIEW_METHOD_NAME, Command.class));
    methods.put(DEFAULT_SHOW_UPDATE_VIEW_OPERATION_NAME,
            defaultViewOperationClass.getMethod(DEFAULT_SHOW_UPDATE_VIEW_METHOD_NAME, Command.class));
    methods.put(DEFAULT_SHOW_DELETE_VIEW_OPERATION_NAME,
            defaultViewOperationClass.getMethod(DEFAULT_SHOW_DELETE_VIEW_METHOD_NAME, Command.class));
    methods.put(DEFAULT_SHOW_DETAIL_VIEW_OPERATION_NAME,
            defaultViewOperationClass.getMethod(DEFAULT_SHOW_DETAIL_VIEW_METHOD_NAME, Command.class));
    methods.put(DEFAULT_SHOW_LIST_VIEW_OPERATION_NAME,
            defaultViewOperationClass.getMethod(DEFAULT_SHOW_LIST_VIEW_METHOD_NAME, Command.class));

    Class<?> defaultModelOperationClass = this.getClass().getClassLoader()
            .loadClass(DEFAULT_MODEL_OPERATION_CLASS_NAME);
    methods.put(DEFAULT_GET_CREATE_MODEL_OPERATION_NAME,
            defaultModelOperationClass.getMethod(DEFAULT_GET_CREATE_MODEL_METHOD_NAME, Command.class));
    methods.put(DEFAULT_GET_UPDATE_MODEL_OPERATION_NAME,
            defaultModelOperationClass.getMethod(DEFAULT_GET_UPDATE_MODEL_METHOD_NAME, Command.class));
    methods.put(DEFAULT_GET_DELETE_MODEL_OPERATION_NAME,
            defaultModelOperationClass.getMethod(DEFAULT_GET_DELETE_MODEL_METHOD_NAME, Command.class));
    methods.put(DEFAULT_GET_DETAIL_MODEL_OPERATION_NAME,
            defaultModelOperationClass.getMethod(DEFAULT_GET_DETAIL_MODEL_METHOD_NAME, Command.class));
    methods.put(DEFAULT_GET_LIST_MODEL_OPERATION_NAME,
            defaultModelOperationClass.getMethod(DEFAULT_GET_LIST_MODEL_METHOD_NAME, Command.class));

    Class<?> defaultEntityOperationClass = this.getClass().getClassLoader()
            .loadClass(DEFAULT_ENTITY_OPERATION_CLASS_NAME);
    methods.put(DEFAULT_CREATE_OPERATION_NAME,
            defaultEntityOperationClass.getMethod(DEFAULT_CREATE_METHOD_NAME, clazz, Map.class));
    methods.put(DEFAULT_UPDATE_OPERATION_NAME,
            defaultEntityOperationClass.getMethod(DEFAULT_UPDATE_METHOD_NAME, clazz, Map.class));
    methods.put(DEFAULT_DELETE_OPERATION_NAME,
            defaultEntityOperationClass.getMethod(DEFAULT_DELETE_METHOD_NAME, clazz, Map.class));

    Map<String, String> nextOps = new HashMap<String, String>();
    this.nextOperations.put(scopeName, nextOps);

    if (clazz.isAnnotationPresent(OperationGroup.class)) {
        OperationGroup group = clazz.getAnnotation(OperationGroup.class);
        this.extractOperationAnnotations(clazz, group, methods, nextOps);
    }

    if (clazz.isAnnotationPresent(OperationGroups.class)) {
        OperationGroups groups = clazz.getAnnotation(OperationGroups.class);
        for (OperationGroup group : groups.value()) {
            this.extractOperationAnnotations(clazz, group, methods, nextOps);
        }
    }
}

From source file:org.apache.syncope.client.console.init.ClassPathScanImplementationLookup.java

public Class<? extends AbstractBinaryPreviewer> getPreviewerClass(final String mimeType) {
    LOG.debug("Searching for previewer class for MIME type: {}", mimeType);
    Class<? extends AbstractBinaryPreviewer> previewer = null;
    for (Class<? extends AbstractBinaryPreviewer> candidate : previewers) {
        LOG.debug("Evaluating previewer class {} for MIME type {}", candidate.getName(), mimeType);
        if (candidate.isAnnotationPresent(BinaryPreview.class)
                && ArrayUtils.contains(candidate.getAnnotation(BinaryPreview.class).mimeTypes(), mimeType)) {
            LOG.debug("Found existing previewer for MIME type {}: {}", mimeType, candidate.getName());
            previewer = candidate;//from   w ww  .j a v  a2 s  .  co m
        }
    }
    return previewer;
}

From source file:com.sqewd.open.dal.core.persistence.csv.CSVPersister.java

protected void load(final Class<?> type) throws Exception {
    if (!type.isAnnotationPresent(Entity.class))
        throw new Exception("Class [" + type.getCanonicalName() + "] has not been annotated as an Entity.");
    synchronized (cache) {
        if (cache.containsKey(type.getCanonicalName()))
            return;

        Entity eann = type.getAnnotation(Entity.class);
        String fname = eann.recordset() + "." + format.name();
        String path = datadir + "/" + fname;

        File fi = new File(path);
        if (!fi.exists())
            throw new Exception("Cannot find file [" + path + "] for entity [" + type.getCanonicalName() + "]");
        List<AbstractEntity> entities = new ArrayList<AbstractEntity>();

        char sep = ',';
        if (format == EnumImportFormat.TSV) {
            sep = '\t';
        }/* ww  w . j a v a 2s  .c  o  m*/
        CSVReader reader = new CSVReader(new FileReader(path), sep, '"');
        String[] header = null;
        while (true) {
            String[] data = reader.readNext();
            if (data == null) {
                break;
            }
            if (header == null) {
                header = data;
                continue;
            }
            if (data.length < header.length) {
                continue;
            }
            AbstractEntity record = parseRecord(type, header, data);
            if (record == null) {
                log.warn("Parse returned NULL");
                continue;
            }
            entities.add(record);
        }
        cache.put(type.getCanonicalName(), entities);
        reader.close();
    }
}

From source file:Database.Handler.java

@SuppressWarnings("unchecked")
private List<T> mapRersultSetToObject(ResultSet rs, Class outputClass) {
    List<T> outputList = null;
    try {/*ww  w  .j av  a  2  s  .c o  m*/
        if (rs != null) {
            if (outputClass.isAnnotationPresent(Entity.class)) {
                ResultSetMetaData rsmd = rs.getMetaData();
                Field[] fields = outputClass.getDeclaredFields();
                while (rs.next()) {
                    T bean = (T) outputClass.newInstance();
                    //System.out.println("rsmd = "+rsmd.getColumnCount());
                    for (int i = 1; i <= rsmd.getColumnCount(); i++) {
                        String columnName = rsmd.getColumnName(i);
                        Object columnValue = rs.getObject(i);
                        for (Field field : fields) {
                            if (field.isAnnotationPresent(Column.class)) {
                                Column column = field.getAnnotation(Column.class);
                                if (column.name().equalsIgnoreCase(columnName) && columnValue != null) {
                                    //System.out.println(field.getName() + "=====>" + columnValue);
                                    BeanUtils.setProperty(bean, field.getName(), columnValue);
                                    break;
                                }
                            }
                        }
                    }
                    if (outputList == null) {
                        outputList = new ArrayList<T>();
                    }
                    outputList.add(bean);
                }
            } else {
                // throw some error
                System.out.println("output class is not annotationPresented");
            }
        } else {
            return null;
        }
    } catch (SQLException ex) {
        Logger.getLogger(Handler.class.getName()).log(Level.SEVERE, null, ex);
    } catch (SecurityException ex) {
        Logger.getLogger(Handler.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
        Logger.getLogger(Handler.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
        Logger.getLogger(Handler.class.getName()).log(Level.SEVERE, null, ex);
    } catch (InvocationTargetException ex) {
        Logger.getLogger(Handler.class.getName()).log(Level.SEVERE, null, ex);
    }
    return outputList;
}

From source file:com.cottsoft.thrift.framework.server.ThriftMultiBinaryServerFactory.java

/**
 * ?Processor/*from   w  w  w.j a  v  a  2 s.com*/
 * @return
 * @throws ThriftException
 */
public TProcessor getProcessor() throws ThriftException {
    try {
        TMultiplexedProcessor processor = new TMultiplexedProcessor();

        Set<Class<?>> thriftServiceImplClassList = ScanPackageHander
                .getPackageAllClasses(baseServiceImplPackage, true);

        for (Class<?> thriftServiceImplClass : thriftServiceImplClassList) {
            if (thriftServiceImplClass.isAnnotationPresent(ThriftService.class)) {
                ThriftService thriftServiceAnnotation = (ThriftService) thriftServiceImplClass
                        .getAnnotation(ThriftService.class);
                String thriftServiceName = thriftServiceAnnotation.service();

                Constructor<?> constructor = Class.forName(thriftServiceName + "$Processor")
                        .getConstructor(Class.forName(thriftServiceName + "$Iface"));

                Object service = SpringApplicationContext
                        .getBean(getServiceImplBeanName(thriftServiceImplClass));

                processor.registerProcessor(thriftServiceName, (TProcessor) constructor.newInstance(service));

                if (logger.isDebugEnabled()) {
                    logger.debug(">>> Thrift Service implements class: " + thriftServiceImplClass.getName());
                }
            }
        }
        return processor;
    } catch (NoSuchMethodException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (SecurityException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (ClassNotFoundException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (InstantiationException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (IllegalAccessException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (IllegalArgumentException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (InvocationTargetException e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    } catch (Exception e) {
        if (logger.isInfoEnabled()) {
            e.printStackTrace();
        }
        throw new ThriftException(e);
    }
}