List of usage examples for java.util.logging Level FINEST
Level FINEST
To view the source code for java.util.logging Level FINEST.
Click Source Link
From source file:edu.harvard.iq.safe.lockss.impl.DaemonStatusDataUtil.java
public static String escapeHtml(String rawUrl) { String sanitizedUrl = null;//from w w w .ja v a 2 s . c om logger.log(Level.FINEST, "received={0}", rawUrl); sanitizedUrl = rawUrl.replace("%", "%25"); sanitizedUrl = sanitizedUrl.replace("~", "%7E"); sanitizedUrl = sanitizedUrl.replace("|", "%7C"); sanitizedUrl = sanitizedUrl.replace("&", "%26"); logger.log(Level.FINEST, "final={0}", sanitizedUrl); return sanitizedUrl; }
From source file:com.sun.grizzly.http.jk.common.ChannelNioSocket.java
public void setMinSpareThreads(int i) { if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) { LoggerUtils.getLogger().log(Level.FINEST, "Setting minSpareThreads " + i); }/*from w w w .j av a2s . co m*/ tp.setMinSpareThreads(i); }
From source file:com.clothcat.hpoolauto.model.HtmlGenerator.java
private static void generatePools(Model model) { for (Pool pool : model.pools) { String template = POOL_HTML_TEMPLATE; // date generated template = template.replace(PlaceholderStrings.DATE_GENERATED, toDateString(new Date().getTime())); template = template.replace(PlaceholderStrings.POOL_NAME, pool.getPoolName()); template = template.replace(PlaceholderStrings.POOL_STATUS, pool.getStatus().toString()); template = template.replace(PlaceholderStrings.POOL_FILL_DATE, toDateString(pool.getStartTimestamp())); long age = pool.getPoolAge(); // this is in ms long ageinseconds = age / 1000; String ageString = convertTimeToString(ageinseconds); template = template.replace(PlaceholderStrings.POOL_AGE, ageString); long potStake = pool.calculatePotentialStake(); double potStaked = potStake; potStaked /= Constants.uH_IN_HYP; String potStakeStr = String.format("%.4f", potStaked); template = template.replace(PlaceholderStrings.POTENTIAL_STAKE, potStakeStr); template = template.replace(PlaceholderStrings.XFER_FEES, "TODO"); String poolTable = "<table id=\"pool_table\" border=\"1\">\n" + "<tr id=\"pool_table_header\">\n" + "<th>Participants</th>\n" + "<th>Investment</th>\n" + "<th>Percentage</th>\n" + "<th>Current return</th>\n" + "</tr>\n" + ""; int rownum = 0; for (Investment inv : pool.getInvestments()) { if (rownum % 2 == 0) { poolTable += "<tr id=\"pool_table_oddrow\">\n"; } else { poolTable += "<tr id=\"pool_table_evenrow\">\n"; }//from w w w. jav a 2 s. c o m rownum++; double invAmount = inv.getAmount(); invAmount /= Constants.uH_IN_HYP; String invStr = String.format("%.3f", invAmount); poolTable += "<td>" + inv.getFromAddress() + "</td>\n" + "<td>" + invStr + "</td>\n" + "<td>" + calcPercentage(pool.calculateFillAmount(), inv.getAmount()) + "</td>\n" + "<td>" + calcReturn(pool.calculateFillAmount(), inv.getAmount(), potStake) + "</td>\n" + "</tr>\n"; } // TODO: Total row poolTable += "</table>\n"; template = template.replace(PlaceholderStrings.POOL_TABLE, poolTable); template = template.replace(PlaceholderStrings.OTHER_STUFF, "TODO"); // tidy html template = tidyHtml(template); // write file // make sure target directory exists File d = new File(Constants.HTML_FILEPATH); d.mkdirs(); try { FileUtils.write(new File(Constants.HTML_FILEPATH + pool.getPoolName() + ".html"), template); } catch (IOException ex) { HLogger.log(Level.FINEST, "Caught Exception in generatePools()", ex); Logger.getLogger(HtmlGenerator.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.getblimp.api.client.Blimp.java
private void errorHandler(Exception e) { logger.fine("Entering Blimp.errorHandler."); logger.severe(e.getMessage());/*from w w w .j a v a2s .c o m*/ if (logger.getLevel().equals(Level.FINEST)) { e.printStackTrace(); } }
From source file:com.ibm.sbt.security.authentication.oauth.consumer.OAuth2Handler.java
public void getAccessTokenForAuthorizedUsingPOST() throws Exception { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "getAccessTokenForAuthorizedUsingPOST", new Object[] {}); }//from ww w. j av a2 s.com HttpPost method = null; int responseCode = HttpStatus.SC_OK; String responseBody = null; InputStream content = null; try { HttpClient client = new DefaultHttpClient(); if (forceTrustSSLCertificate) client = (DefaultHttpClient) SSLUtil.wrapHttpClient((DefaultHttpClient) client); StringBuffer url = new StringBuffer(2048); // This works for Smartcloud /* url.append(getAccessTokenURL()).append("?"); url.append(Configuration.OAUTH2_CALLBACK_URI).append('=').append(URLEncoder.encode(client_uri, "UTF-8")); url.append('&'); url.append(Configuration.OAUTH2_CLIENT_ID).append('=').append(URLEncoder.encode(consumerKey, "UTF-8")); url.append('&'); url.append(Configuration.OAUTH2_CLIENT_SECRET).append('=').append(URLEncoder.encode(consumerSecret, "UTF-8")); url.append('&'); url.append(Configuration.OAUTH2_GRANT_TYPE).append('=').append(Configuration.OAUTH2_AUTHORIZATION_CODE); url.append('&'); url.append(Configuration.OAUTH2_CODE).append('=').append(URLEncoder.encode(authorization_code, "UTF-8")); System.err.println("url used here "+url); method = new HttpPost(url.toString());*/ // This works for connections // add parameters to the post method method = new HttpPost(getAccessTokenURL()); List<NameValuePair> parameters = new ArrayList<NameValuePair>(); parameters.add(new BasicNameValuePair(Configuration.OAUTH2_CALLBACK_URI, URLEncoder.encode(client_uri, "UTF-8"))); parameters.add(new BasicNameValuePair(Configuration.OAUTH2_CLIENT_ID, URLEncoder.encode(consumerKey, "UTF-8"))); parameters.add(new BasicNameValuePair(Configuration.OAUTH2_CLIENT_SECRET, URLEncoder.encode(consumerSecret, "UTF-8"))); parameters.add(new BasicNameValuePair(Configuration.OAUTH2_GRANT_TYPE, Configuration.OAUTH2_AUTHORIZATION_CODE)); parameters.add(new BasicNameValuePair(Configuration.OAUTH2_CODE, URLEncoder.encode(authorization_code, "UTF-8"))); UrlEncodedFormEntity sendentity = new UrlEncodedFormEntity(parameters, HTTP.UTF_8); method.setEntity(sendentity); HttpResponse httpResponse = client.execute(method); responseCode = httpResponse.getStatusLine().getStatusCode(); if (logger.isLoggable(Level.FINEST)) { logger.log(Level.FINEST, "OAuth2.0 network call to fetch token :" + getAccessTokenURL(), responseCode); } content = httpResponse.getEntity().getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(content)); try { responseBody = StreamUtil.readString(reader); } finally { StreamUtil.close(reader); } } catch (Exception e) { throw new OAuthException(e, "getAccessToken failed with Exception: <br>"); } finally { if (content != null) { content.close(); } } if (responseCode != HttpStatus.SC_OK) { String exceptionDetail = buildErrorMessage(responseCode, responseBody); if (exceptionDetail != null) { String msg = "Unable to retrieve access token because \"{0}\". Please check the access token URL is valid, current value: {1}."; msg = MessageFormat.format(msg, exceptionDetail, getAccessTokenURL()); throw new OAuthException(null, msg); } } else { setOAuthData(responseBody); //save the returned data } }
From source file:de.theit.jenkins.crowd.CrowdConfigurationService.java
/** * Retrieves the list of all (nested) groups from the Crowd server that the * user is a member of.//ww w. j a v a 2 s . c o m * * @param username * The name of the user. May not be <code>null</code>. * @return The list of all groups that the user is a member of. Always * non-null. */ public Collection<GrantedAuthority> getAuthoritiesForUser(String username) { Collection<GrantedAuthority> authorities = new TreeSet<GrantedAuthority>( new Comparator<GrantedAuthority>() { @Override public int compare(GrantedAuthority ga1, GrantedAuthority ga2) { return ga1.getAuthority().compareTo(ga2.getAuthority()); } }); HashSet<String> groupNames = new HashSet<String>(); // retrieve the names of all groups the user is a direct member of try { int index = 0; if (LOG.isLoggable(Level.FINE)) { LOG.fine("Retrieve list of groups with direct membership for user '" + username + "'..."); } while (true) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Fetching groups [" + index + "..." + (index + MAX_GROUPS - 1) + "]..."); } List<Group> groups = this.crowdClient.getGroupsForUser(username, index, MAX_GROUPS); if (null == groups || groups.isEmpty()) { break; } for (Group group : groups) { if (group.isActive()) { groupNames.add(group.getName()); } } index += MAX_GROUPS; } } catch (UserNotFoundException ex) { if (LOG.isLoggable(Level.INFO)) { LOG.info(userNotFound(username)); } } catch (InvalidAuthenticationException ex) { LOG.warning(invalidAuthentication()); } catch (ApplicationPermissionException ex) { LOG.warning(applicationPermission()); } catch (OperationFailedException ex) { LOG.log(Level.SEVERE, operationFailed(), ex); } // now the same but for nested group membership if this configuration // setting is active/enabled if (this.nestedGroups) { try { int index = 0; if (LOG.isLoggable(Level.FINE)) { LOG.fine("Retrieve list of groups with direct membership for user '" + username + "'..."); } while (true) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Fetching groups [" + index + "..." + (index + MAX_GROUPS - 1) + "]..."); } List<Group> groups = this.crowdClient.getGroupsForNestedUser(username, index, MAX_GROUPS); if (null == groups || groups.isEmpty()) { break; } for (Group group : groups) { if (group.isActive()) { groupNames.add(group.getName()); } } index += MAX_GROUPS; } } catch (UserNotFoundException ex) { if (LOG.isLoggable(Level.INFO)) { LOG.info(userNotFound(username)); } } catch (InvalidAuthenticationException ex) { LOG.warning(invalidAuthentication()); } catch (ApplicationPermissionException ex) { LOG.warning(applicationPermission()); } catch (OperationFailedException ex) { LOG.log(Level.SEVERE, operationFailed(), ex); } } // now create the list of authorities for (String str : groupNames) { authorities.add(new GrantedAuthorityImpl(str)); } return authorities; }
From source file:com.sun.grizzly.http.jk.common.ChannelNioSocket.java
public void setMaxSpareThreads(int i) { if (LoggerUtils.getLogger().isLoggable(Level.FINEST)) { LoggerUtils.getLogger().log(Level.FINEST, "Setting maxSpareThreads " + i); }//from ww w . j a v a 2 s . c om tp.setMaxSpareThreads(i); }
From source file:com.ibm.jaggr.service.impl.AggregatorImpl.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException { if (log.isLoggable(Level.FINEST)) log.finest("doGet: URL=" + req.getRequestURI()); //$NON-NLS-1$ req.setAttribute(AGGREGATOR_REQATTRNAME, this); ConcurrentMap<String, Object> concurrentMap = new ConcurrentHashMap<String, Object>(); req.setAttribute(CONCURRENTMAP_REQATTRNAME, concurrentMap); try {/*from w w w.j av a2 s . c o m*/ // Validate config last-modified if development mode is enabled if (getOptions().isDevelopmentMode()) { long lastModified = -1; URI configUri = getConfig().getConfigUri(); if (configUri != null) { lastModified = configUri.toURL().openConnection().getLastModified(); } if (lastModified > getConfig().lastModified()) { if (reloadConfig()) { // If the config has been modified, then dependencies will be revalidated // asynchronously. Rather than forcing the current request to wait, return // a response that will display an alert informing the user of what is // happening and asking them to reload the page. String content = "alert('" + //$NON-NLS-1$ StringUtil.escapeForJavaScript(Messages.ConfigModified) + "');"; //$NON-NLS-1$ resp.addHeader("Cache-control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ CopyUtil.copy(new StringReader(content), resp.getOutputStream()); return; } } } getTransport().decorateRequest(req); notifyRequestListeners(RequestNotifierAction.start, req, resp); ILayer layer = getLayer(req); long modifiedSince = req.getDateHeader("If-Modified-Since"); //$NON-NLS-1$ long lastModified = (Math.max(getCacheManager().getCache().getCreated(), layer.getLastModified(req)) / 1000) * 1000; if (modifiedSince >= lastModified) { if (log.isLoggable(Level.FINER)) { log.finer("Returning Not Modified response for layer in servlet" + //$NON-NLS-1$ getName() + ":" //$NON-NLS-1$ + req.getAttribute(IHttpTransport.REQUESTEDMODULES_REQATTRNAME).toString()); } resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); } else { // Get the InputStream for the response. This call sets the Content-Type, // Content-Length and Content-Encoding headers in the response. InputStream in = layer.getInputStream(req, resp); // if any of the readers included an error response, then don't cache the layer. if (req.getAttribute(ILayer.NOCACHE_RESPONSE_REQATTRNAME) != null) { resp.addHeader("Cache-Control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ } else { resp.setDateHeader("Last-Modified", lastModified); //$NON-NLS-1$ int expires = getConfig().getExpires(); if (expires > 0) { resp.addHeader("Cache-Control", "max-age=" + expires); //$NON-NLS-1$ //$NON-NLS-2$ } } CopyUtil.copy(in, resp.getOutputStream()); } notifyRequestListeners(RequestNotifierAction.end, req, resp); } catch (DependencyVerificationException e) { // clear the cache now even though it will be cleared when validateDeps has // finished (asynchronously) so that any new requests will be forced to wait // until dependencies have been validated. getCacheManager().clearCache(); getDependencies().validateDeps(false); resp.addHeader("Cache-control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ if (getOptions().isDevelopmentMode()) { String msg = StringUtil.escapeForJavaScript(MessageFormat.format(Messages.DepVerificationFailed, new Object[] { e.getMessage(), AggregatorCommandProvider.EYECATCHER + " " + //$NON-NLS-1$ AggregatorCommandProvider.CMD_VALIDATEDEPS + " " + //$NON-NLS-1$ getName() + " " + //$NON-NLS-1$ AggregatorCommandProvider.PARAM_CLEAN, getWorkingDirectory().toString().replace("\\", "\\\\") //$NON-NLS-1$ //$NON-NLS-2$ })); String content = "alert('" + msg + "');"; //$NON-NLS-1$ //$NON-NLS-2$ try { CopyUtil.copy(new StringReader(content), resp.getOutputStream()); } catch (IOException e1) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e1.getMessage(), e1); } resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { resp.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE); } } catch (ProcessingDependenciesException e) { resp.addHeader("Cache-control", "no-store"); //$NON-NLS-1$ //$NON-NLS-2$ if (getOptions().isDevelopmentMode()) { String content = "alert('" + StringUtil.escapeForJavaScript(Messages.Busy) + "');"; //$NON-NLS-1$ //$NON-NLS-2$ try { CopyUtil.copy(new StringReader(content), resp.getOutputStream()); } catch (IOException e1) { if (log.isLoggable(Level.SEVERE)) { log.log(Level.SEVERE, e1.getMessage(), e1); } resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } else { resp.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE); } } catch (BadRequestException e) { exceptionResponse(req, resp, e, HttpServletResponse.SC_BAD_REQUEST); } catch (NotFoundException e) { exceptionResponse(req, resp, e, HttpServletResponse.SC_NOT_FOUND); } catch (Exception e) { exceptionResponse(req, resp, e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { concurrentMap.clear(); } }
From source file:com.archivas.clienttools.arcutils.utils.net.GetCertsX509TrustManager.java
/** * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[],String * authType)//from w w w. jav a 2 s . c om */ public void checkServerTrusted(X509Certificate[] certificates, String authType) throws CertificateException { synchronized (LOCK) { try { if ((certificates != null) && LOG.isLoggable(Level.FINER)) { LOG.log(Level.FINER, "Server certificate chain:"); for (int i = 0; i < certificates.length; i++) { LOG.log(Level.FINER, "X509Certificate[" + i + "]=" + certificates[i]); } } checkServerTrusted1(certificates, authType); } catch (CertificateException e) { LOG.log(Level.FINEST, "Exception checking trust for certificate.", e); throw e; } catch (RuntimeException e) { LOG.log(Level.WARNING, "Unexpected exception checking trust for certificate.", e); throw e; } } }
From source file:org.archive.modules.fetcher.FetchDNS.java
protected ARecord getFirstARecord(Record[] rrecordSet) { ARecord arecord = null;//from ww w .ja va2 s .com if (rrecordSet == null || rrecordSet.length == 0) { if (logger.isLoggable(Level.FINEST)) { logger.finest("rrecordSet is null or zero length: " + rrecordSet); } return arecord; } for (int i = 0; i < rrecordSet.length; i++) { if (rrecordSet[i].getType() != Type.A) { if (logger.isLoggable(Level.FINEST)) { logger.finest( "Record " + Integer.toString(i) + " is not A type but " + rrecordSet[i].getType()); } continue; } arecord = (ARecord) rrecordSet[i]; break; } return arecord; }