public void error(String msg, Object... args) { log.error(msg, args); } }
public void error(String s) { log.error(s); } }
@Override public void destroyDataSource(DataSource ds) { if(null != ds) { try { dataSourceManager.destroyDataSource(ds); } catch (Exception e) { log.error("Error destroying data source, {}", e.getMessage(), e); } } }
@Override public void serverError(Response response, String desc) { log.error("Auth Server Internal Error : {}", desc); response(response, HTTP.SC_INTERNAL_SERVER_ERROR, ERROR_SERVER_ERROR, desc); }
public void initVerifier(){ if(null == this.verifier){ synchronized (lock){ if(null == this.verifier){ try { this.verifier = getVerifier(); } catch (Throwable throwable) { log.error("create verifier error",throwable); } } } } }
@Override public AttributeList getAttributes(String[] attributes) { AttributeList list = new AttributeList(); if(null != attributes) { for(String name : attributes) { try { list.add(new Attribute(name, getAttribute(name))); } catch (Exception e) { log.error("Error get attribute '" + name + "' : " + e.getMessage(), e); } } } return list; }
@Override public void clearAll() { for(Entry<String, Cache<?,?>> entry : caches.entrySet()){ try{ entry.getValue().clear(); }catch(Throwable e){ log.error("Error clearing cache '{}' : {}",entry.getKey(),e.getMessage(),e); } } }
@Override public boolean tryDestroyDataSource(DataSource ds) { if(ds instanceof PooledDataSource) { try { ((PooledDataSource) ds).close(); } catch (Exception e) { log.error("Error close pooled datasource : {}",e.getMessage(), e); } return true; } return false; }
@Override public void serverError(Response response, String desc, Throwable e) { log.error("Auth Server Internal Error : {}", desc, e); response(response, HTTP.SC_INTERNAL_SERVER_ERROR, ERROR_SERVER_ERROR, desc); }
@Override public void serverError(Response response, String desc) { log.error("Auth Server Internal Error : {}", desc); response(response, HTTP.SC_INTERNAL_SERVER_ERROR, ERROR_SERVER_ERROR, desc); }
@Override public void serverError(Response response, String desc, Throwable e) { log.error("Auth Server Internal Error : {}", desc, e); response(response, HTTP.SC_INTERNAL_SERVER_ERROR, ERROR_SERVER_ERROR, desc); }
public void initVerifier(){ if(null == this.verifier){ synchronized (lock){ if(null == this.verifier){ try { this.verifier = getVerifier(); } catch (Throwable throwable) { log.error("create verifier error",throwable); } } } } }
protected void closeStatement(StatementProxy proxy) throws SQLException { try{ closeStatementOnly(proxy); }finally{ if(!statements.remove(proxy)){ log.error("Invalid state, No open statement found for the closed statement",new Exception("")); } } }
protected static Class<?> init(Class<?> cls) { DEV.setCurrentTestClass(cls); try { startServer(); }catch (RuntimeException e) { log.error("Error start test web server : " + e.getMessage(), e); throw e; } return cls; }
public void updateToIdleState(PooledConnection conn, int fromState) { if(conn.compareStateAndSet(fromState, STATE_IDLE)) { //increase the state,see PoolSynchronizer synchronizer.releaseShared(syncState.incrementAndGet()); }else{ log.error("Failed to update connection's to 'IDLE', expected {}, but {}",fromState,conn.getState().get()); } }
@Bean public static BeanFactoryPostProcessor beanFactoryPostProcessor() { return springBeanFactory -> { if(springBeanFactory instanceof DefaultListableBeanFactory) { DefaultListableBeanFactory dbf = ((DefaultListableBeanFactory) springBeanFactory); dbf.setAutowireCandidateResolver(new SpringAutowireResolver(dbf.getAutowireCandidateResolver())); }else{ log.error("Found unsupported spring bean factory '{}', can't autowire leap's beans", springBeanFactory); } }; }
@Init public void init() { if (null == beanFactory) { log.error("Spring context not found, can't use spring expression factory"); return; } SpelParserConfiguration c = new SpelParserConfiguration(SpelCompilerMode.IMMEDIATE, this.getClass().getClassLoader()); spelParser = new SpelExpressionParser(c); evalContext = new StandardEvaluationContext(); envProperty = new EnvPropertyAccessor(env); evalContext.getPropertyAccessors().add(0, envProperty); evalContext.getPropertyAccessors().add(0, new MapPropertyAccessor()); evalContext.setBeanResolver(new BeanFactoryResolver(beanFactory)); }
protected void handleAuthenticated(Request request, Response response, SimpleAuthzAuthentication authc, ResponseTypeHandler handler) throws Throwable { String redirectUri = authc.getRedirectUri(); try{ handler.handleResponseType(request, response, authc); }catch(OAuth2ResponseException e) { OAuth2Error error = OAuth2Errors.oauth2Error(request,e.getStatus(),e.getError(),null,e.getMessage()); OAuth2Errors.redirect(response, redirectUri, error); }catch(ResponseException e) { throw e; }catch(Throwable e) { log.error("Internal server error : {}", e.getMessage(), e); OAuth2Error error = OAuth2Errors.redirectServerErrorError(request, Oauth2MessageKey.createRandomKey(),e.getMessage()); OAuth2Errors.redirect(response, redirectUri, error); } }
protected void handleAuthenticated(Request request, Response response, SimpleAuthzAuthentication authc, ResponseTypeHandler handler) throws Throwable { String redirectUri = authc.getRedirectUri(); try{ handler.handleResponseType(request, response, authc); }catch(OAuth2ResponseException e) { OAuth2Error error = OAuth2Errors.oauth2Error(request,e.getStatus(),e.getError(),null,e.getMessage()); OAuth2Errors.redirect(response, redirectUri, error); }catch(ResponseException e) { throw e; }catch(Throwable e) { log.error("Internal server error : {}", e.getMessage(), e); OAuth2Error error = OAuth2Errors.redirectServerErrorError(request,Oauth2MessageKey.createRandomKey(),e.getMessage()); OAuth2Errors.redirect(response, redirectUri, error); } }
@Override public void createApiOperation(RestdContext context, RestdOperationDef od) { String opPath = od.getPath(); if(Strings.isEmpty(opPath)) { opPath = "/" + Strings.lowerUnderscore(od.getName()); } String path = fullPath(context.getApi().getConfigurator(), opPath); try { createOperation(context, null, od, path); }catch (RuntimeException e) { log.error("Error create operation '{}'", od.getScriptPath()); throw e; } }