List of usage examples for java.util.logging Level FINE
Level FINE
To view the source code for java.util.logging Level FINE.
Click Source Link
From source file:de.theit.jenkins.crowd.CrowdRememberMeServices.java
/** * {@inheritDoc}//w w w .ja va 2s. c om * * @see org.springframework.security.ui.rememberme.RememberMeServices#loginFail(javax.servlet.http.HttpServletRequest, * javax.servlet.http.HttpServletResponse) */ @Override public void loginFail(HttpServletRequest request, HttpServletResponse response) { try { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Login failed"); } this.configuration.crowdHttpAuthenticator.logout(request, response); } catch (ApplicationPermissionException ex) { LOG.warning(applicationPermission()); } catch (InvalidAuthenticationException ex) { LOG.warning(invalidAuthentication()); } catch (OperationFailedException ex) { LOG.log(Level.SEVERE, operationFailed(), ex); } }
From source file:jenkins.security.ClassFilterImpl.java
@SuppressWarnings("rawtypes") @Override// w w w . ja v a 2 s . c o m public boolean isBlacklisted(Class _c) { for (CustomClassFilter f : ExtensionList.lookup(CustomClassFilter.class)) { Boolean r = f.permits(_c); if (r != null) { if (r) { LOGGER.log(Level.FINER, "{0} specifies a policy for {1}: {2}", new Object[] { f, _c.getName(), true }); } else { notifyRejected(_c, _c.getName(), String.format("%s specifies a policy for %s: %s ", f, _c.getName(), r)); } return !r; } } return cache.computeIfAbsent(_c, c -> { String name = c.getName(); if (Main.isUnitTest && (name.contains("$$EnhancerByMockitoWithCGLIB$$") || name.contains("$$FastClassByMockitoWithCGLIB$$") || name.startsWith("org.mockito."))) { mockOff(); return false; } if (ClassFilter.STANDARD.isBlacklisted(c)) { // currently never true, but may issue diagnostics notifyRejected(_c, _c.getName(), String.format("%s is not permitted ", _c.getName())); return true; } if (c.isArray()) { LOGGER.log(Level.FINE, "permitting {0} since it is an array", name); return false; } if (Throwable.class.isAssignableFrom(c)) { LOGGER.log(Level.FINE, "permitting {0} since it is a throwable", name); return false; } if (Enum.class.isAssignableFrom(c)) { // Class.isEnum seems to be false for, e.g., java.util.concurrent.TimeUnit$6 LOGGER.log(Level.FINE, "permitting {0} since it is an enum", name); return false; } String location = codeSource(c); if (location != null) { if (isLocationWhitelisted(location)) { LOGGER.log(Level.FINE, "permitting {0} due to its location in {1}", new Object[] { name, location }); return false; } } else { ClassLoader loader = c.getClassLoader(); if (loader != null && loader.getClass().getName().equals("hudson.remoting.RemoteClassLoader")) { LOGGER.log(Level.FINE, "permitting {0} since it was loaded by a remote class loader", name); return false; } } if (WHITELISTED_CLASSES.contains(name)) { LOGGER.log(Level.FINE, "tolerating {0} by whitelist", name); return false; } if (SUPPRESS_WHITELIST || SUPPRESS_ALL) { notifyRejected(_c, null, String.format( "%s in %s might be dangerous, so would normally be rejected; see https://jenkins.io/redirect/class-filter/", name, location != null ? location : "JRE")); return false; } notifyRejected(_c, null, String.format( "%s in %s might be dangerous, so rejecting; see https://jenkins.io/redirect/class-filter/", name, location != null ? location : "JRE")); return true; }); }
From source file:eu.edisonproject.training.wsd.BabelNet.java
private String getBabelnetSynset(String id, String lan) throws IOException, FileNotFoundException, InterruptedException { if (id == null || id.length() < 1) { return null; }/*w ww. j a va 2 s . com*/ String json = getFromSynsetDB(id); if (json != null && json.equals("NON-EXISTING")) { return null; } if (json == null) { URL url = new URL("http://babelnet.io/v2/getSynset?id=" + id + "&filterLangs=" + lan + "&langs=" + lan + "&key=" + this.key); LOGGER.log(Level.FINE, url.toString()); json = IOUtils.toString(url); handleKeyLimitException(json); if (json != null) { addToSynsetDB(id, json); } else { addToSynsetDB(id, "NON-EXISTING"); } } return json; }
From source file:daylightchart.gui.DaylightChartGui.java
/** * Add a new location tab./* w w w. java2 s . co m*/ * * @param location * Location */ public void addLocationTab(final Location location) { if (location == null) { return; } final DaylightChartReport daylightChartReport = new DaylightChartReport(location, UserPreferences.optionsFile().getData()); if (slimUi) { final Path reportFile = Paths.get(UserPreferences.getScratchDirectory().toString(), daylightChartReport.getReportFileName(ChartFileType.png)); daylightChartReport.write(reportFile, ChartFileType.png); try { final String url = reportFile.toUri().toURL().toString(); LOGGER.log(Level.FINE, "Opening URL " + url); BareBonesBrowserLaunch.openURL(url); } catch (final MalformedURLException e) { LOGGER.log(Level.FINE, "Cannot open file " + reportFile, e); } } else { locationsTabbedPane.addLocationTab(daylightChartReport); } // Add to recent locations UserPreferences.recentLocationsFile().add(location); final Collection<Location> recentLocations = UserPreferences.recentLocationsFile().getData(); recentLocationsMenu.removeAll(); for (final Location recentLocation : recentLocations) { recentLocationsMenu .add(new OpenLocationTabAction(this, recentLocation, recentLocationsMenu.getItemCount())); } }
From source file:com.stratuscom.harvester.codebase.ClassServer.java
/** * Close the server socket, causing the thread to terminate. *//*from w w w . ja v a 2 s . c o m*/ @Shutdown public synchronized void terminate() { try { server.close(); } catch (IOException e) { logger.log(Level.FINE, MessageNames.CLASS_SERVER_EXCEPTION_DURING_SHUTDOWN, e); } logger.log(Level.INFO, MessageNames.CLASS_SERVER_TERMINATED, new Object[] { server.getLocalSocketAddress(), server.getLocalPort() }); }
From source file:com.ibm.liberty.starter.api.v1.LibertyFileUploader.java
private static String getSubmittedFileName(Part part) { for (String cd : part.getHeader("content-disposition").split(";")) { if (cd.trim().startsWith("filename")) { String fileName = cd.substring(cd.indexOf('=') + 1).trim().replace("\"", ""); log.log(Level.FINEST, "fileName=" + fileName + " : part=" + part); return fileName.substring(fileName.lastIndexOf('/') + 1).substring(fileName.lastIndexOf('\\') + 1); }/*from w w w. j ava 2 s. c om*/ } log.log(Level.FINE, "File name was not retrieved : part=" + part); return null; }
From source file:com.cloudant.http.internal.interceptors.CookieInterceptor.java
@Override public HttpConnectionInterceptorContext interceptResponse(HttpConnectionInterceptorContext context) { // Check if this interceptor is valid before attempting any kind of renewal if (shouldAttemptCookieRequest.get()) { HttpURLConnection connection = context.connection.getConnection(); // If we got a 401 or 403 we might need to renew the cookie try {//from w w w.j av a 2s . c o m boolean renewCookie = false; int statusCode = connection.getResponseCode(); if (statusCode == HttpURLConnection.HTTP_FORBIDDEN || statusCode == HttpURLConnection.HTTP_UNAUTHORIZED) { InputStream errorStream = connection.getErrorStream(); String errorString = null; if (errorStream != null) { try { // Get the string value of the error stream errorString = IOUtils.toString(errorStream, "UTF-8"); } finally { IOUtils.closeQuietly(errorStream); } } logger.log(Level.FINE, String.format(Locale.ENGLISH, "Intercepted " + "response %d %s", statusCode, errorString)); switch (statusCode) { case HttpURLConnection.HTTP_FORBIDDEN: //403 // Check if it was an expiry case // Check using a regex to avoid dependency on a JSON library. // Note (?siu) flags used for . to also match line breaks and for // unicode // case insensitivity. if (errorString != null && errorString .matches("(?siu)" + ".*\\\"error\\\"\\s*:\\s*\\\"credentials_expired\\\".*")) { // Was expired - set boolean to renew cookie renewCookie = true; } else { // Wasn't a credentials expired, throw exception HttpConnectionInterceptorException toThrow = new HttpConnectionInterceptorException( errorString); // Set the flag for deserialization toThrow.deserialize = errorString != null; throw toThrow; } break; case HttpURLConnection.HTTP_UNAUTHORIZED: //401 // We need to get a new cookie renewCookie = true; break; default: break; } if (renewCookie) { logger.finest("Cookie was invalid attempt to get new cookie."); boolean success = requestCookie(context); if (success) { // New cookie obtained, replay the request context.replayRequest = true; } else { // Didn't successfully renew, maybe creds are invalid context.replayRequest = false; // Don't replay shouldAttemptCookieRequest.set(false); // Set the flag to stop trying } } } else { // Store any cookies provided on the response storeCookiesFromResponse(connection); } } catch (IOException e) { logger.log(Level.SEVERE, "Error reading response code or body from request", e); } } return context; }
From source file:org.cloudifysource.dsl.internal.tools.download.ResourceDownloader.java
/** * * @throws ResourceDownloadException// ww w . ja va2 s .c om * if download fails. * @throws TimeoutException * if timeout exceeded. */ public void download() throws ResourceDownloadException, TimeoutException { if (this.resourceDest.exists() && this.skipExisting) { logger.log(Level.INFO, "File already exists. " + this.resourceDest.getAbsolutePath() + " Skipping download."); return; } createDestinationDirectories(); for (int attempt = 1; attempt <= this.numberOfRetries; attempt++) { try { getResource(this.resourceUrl, this.resourceDest); if (this.hashUrl != null) { // create checksum file destination. // The checksum file extension determines the hashing algorithm used. String resourceName = getResourceName(this.hashUrl); File checksumFile = new File(this.resourceDest.getParent(), resourceName); getResource(this.hashUrl, checksumFile); logger.log(Level.FINE, "Verifying resource checksum using checksum file " + checksumFile.getAbsolutePath()); verifyResourceChecksum(checksumFile); } return; } catch (ResourceDownloadException e) { logger.log(Level.WARNING, "Failed downloading resource on attempt " + attempt + ". Reason was " + e.getMessage()); if (attempt == numberOfRetries) { throw e; } } } }
From source file:org.cogsurv.cogsurver.http.AbstractHttpApi.java
public HttpPost createHttpPost(String url, NameValuePair... nameValuePairs) { if (DEBUG)//from w w w .java 2 s . c o m LOG.log(Level.FINE, "creating HttpPost for: " + url); HttpPost httpPost = new HttpPost(url); httpPost.addHeader(CLIENT_VERSION_HEADER, mClientVersion); try { httpPost.setEntity(new UrlEncodedFormEntity(stripNulls(nameValuePairs), HTTP.UTF_8)); } catch (UnsupportedEncodingException e1) { throw new IllegalArgumentException("Unable to encode http parameters."); } if (DEBUG) LOG.log(Level.FINE, "Created: " + httpPost); return httpPost; }