List of usage examples for java.util.logging Level FINER
Level FINER
To view the source code for java.util.logging Level FINER.
Click Source Link
From source file:de.theit.jenkins.crowd.CrowdAuthenticationManager.java
/** * {@inheritDoc}//from ww w . j a v a 2s. c o m * * @see org.springframework.security.AuthenticationManager#authenticate(org.springframework.security.Authentication) */ @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { String username = authentication.getPrincipal().toString(); // checking whether there's already a SSO token if (null == authentication.getCredentials() && authentication instanceof CrowdAuthenticationToken && null != ((CrowdAuthenticationToken) authentication).getSSOToken()) { // SSO token available => user already authenticated if (LOG.isLoggable(Level.FINER)) { LOG.finer("User '" + username + "' already authenticated"); } return authentication; } String password = authentication.getCredentials().toString(); // ensure that the group is available, active and that the user // is a member of it if (!this.configuration.isGroupMember(username)) { throw new InsufficientAuthenticationException( userNotValid(username, this.configuration.allowedGroupNames)); } String displayName = null; try { // authenticate user if (LOG.isLoggable(Level.FINE)) { LOG.fine("Authenticating user: " + username); } User user = this.configuration.crowdClient.authenticateUser(username, password); displayName = user.getDisplayName(); } catch (UserNotFoundException ex) { if (LOG.isLoggable(Level.INFO)) { LOG.info(userNotFound(username)); } throw new BadCredentialsException(userNotFound(username), ex); } catch (ExpiredCredentialException ex) { LOG.warning(expiredCredentials(username)); throw new CredentialsExpiredException(expiredCredentials(username), ex); } catch (InactiveAccountException ex) { LOG.warning(accountExpired(username)); throw new AccountExpiredException(accountExpired(username), ex); } catch (ApplicationPermissionException ex) { LOG.warning(applicationPermission()); throw new AuthenticationServiceException(applicationPermission(), ex); } catch (InvalidAuthenticationException ex) { LOG.warning(invalidAuthentication()); throw new AuthenticationServiceException(invalidAuthentication(), ex); } catch (OperationFailedException ex) { LOG.log(Level.SEVERE, operationFailed(), ex); throw new AuthenticationServiceException(operationFailed(), ex); } // user successfully authenticated // => retrieve the list of groups the user is a member of List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); // add the "authenticated" authority to the list of granted // authorities... authorities.add(SecurityRealm.AUTHENTICATED_AUTHORITY); // ..and finally all authorities retrieved from the Crowd server authorities.addAll(this.configuration.getAuthoritiesForUser(username)); // user successfully authenticated => create authentication token if (LOG.isLoggable(Level.FINE)) { LOG.fine("User successfully authenticated; creating authentication token"); } return new CrowdAuthenticationToken(username, password, authorities, null, displayName); }
From source file:org.b3log.solo.service.PreferenceMgmtService.java
/** * Updates the preference with the specified preference. * * @param preference the specified preference * @throws ServiceException service exception *//* w ww . j a v a 2 s .c o m*/ public void updatePreference(final JSONObject preference) throws ServiceException { @SuppressWarnings("unchecked") final Iterator<String> keys = preference.keys(); while (keys.hasNext()) { final String key = keys.next(); if (preference.isNull(key)) { throw new ServiceException("A value is null of preference[key=" + key + "]"); } } // TODO: checks preference final Transaction transaction = preferenceRepository.beginTransaction(); try { String blogHost = preference.getString(BLOG_HOST).toLowerCase().trim(); if (StringUtils.startsWithIgnoreCase(blogHost, "http://")) { blogHost = blogHost.substring("http://".length()); } if (blogHost.endsWith("/")) { blogHost = blogHost.substring(0, blogHost.length() - 1); } LOGGER.log(Level.FINER, "Blog Host[{0}]", blogHost); preference.put(BLOG_HOST, blogHost); final String skinDirName = preference.getString(Skin.SKIN_DIR_NAME); final String skinName = Skins.getSkinName(skinDirName); preference.put(Skin.SKIN_NAME, skinName); final Set<String> skinDirNames = Skins.getSkinDirNames(); final JSONArray skinArray = new JSONArray(); for (final String dirName : skinDirNames) { final JSONObject skin = new JSONObject(); skinArray.put(skin); final String name = Skins.getSkinName(dirName); skin.put(Skin.SKIN_NAME, name); skin.put(Skin.SKIN_DIR_NAME, dirName); } final String webRootPath = SoloServletListener.getWebRoot(); final String skinPath = webRootPath + Skin.SKINS + "/" + skinDirName; LOGGER.log(Level.FINER, "Skin path[{0}]", skinPath); Templates.CACHE.clear(); preference.put(Skin.SKINS, skinArray.toString()); final String timeZoneId = preference.getString(TIME_ZONE_ID); TimeZones.setTimeZone(timeZoneId); preference.put(Preference.SIGNS, preference.get(Preference.SIGNS).toString()); final JSONObject oldPreference = preferenceQueryService.getPreference(); final String adminEmail = oldPreference.getString(ADMIN_EMAIL); preference.put(ADMIN_EMAIL, adminEmail); if (!preference.has(PAGE_CACHE_ENABLED)) { preference.put(PAGE_CACHE_ENABLED, oldPreference.getBoolean(PAGE_CACHE_ENABLED)); } else { if (RuntimeEnv.BAE == Latkes.getRuntimeEnv()) { // XXX: Ignores user's setting, uses default // https://github.com/b3log/b3log-solo/issues/73 preference.put(PAGE_CACHE_ENABLED, Default.DEFAULT_PAGE_CACHE_ENABLED); } } final boolean pageCacheEnabled = preference.getBoolean(Preference.PAGE_CACHE_ENABLED); Templates.enableCache(pageCacheEnabled); final String version = oldPreference.optString(VERSION); if (!Strings.isEmptyOrNull(version)) { preference.put(VERSION, version); } final String localeString = preference.getString(Preference.LOCALE_STRING); LOGGER.log(Level.FINER, "Current locale[string={0}]", localeString); Latkes.setLocale(new Locale(Locales.getLanguage(localeString), Locales.getCountry(localeString))); preferenceRepository.update(Preference.PREFERENCE, preference); transaction.commit(); Templates.MAIN_CFG.setDirectoryForTemplateLoading(new File(skinPath)); if (preference.getBoolean(PAGE_CACHE_ENABLED)) { Latkes.enablePageCache(); } else { Latkes.disablePageCache(); } } catch (final JSONException e) { if (transaction.isActive()) { transaction.rollback(); } LOGGER.log(Level.SEVERE, "Updates preference failed", e); throw new ServiceException(langPropsService.get("updateFailLabel")); } catch (final RepositoryException e) { if (transaction.isActive()) { transaction.rollback(); } LOGGER.log(Level.SEVERE, "Updates preference failed", e); throw new ServiceException(langPropsService.get("updateFailLabel")); } catch (final IOException e) { if (transaction.isActive()) { transaction.rollback(); } LOGGER.log(Level.SEVERE, "Updates preference failed", e); throw new ServiceException(langPropsService.get("updateFailLabel")); } LOGGER.log(Level.FINER, "Updates preference successfully"); }
From source file:com.ibm.jaggr.service.impl.config.BundleVersionsHash.java
@Override public void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionRegistrar registrar) { final String sourceMethod = "initialize"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(BundleVersionsHash.class.getName(), sourceMethod, new Object[] { aggregator, extension, registrar }); }/*from w w w .j a v a 2 s. c o m*/ // get the name of the function from the extension attributes propName = extension.getInitParams().getValue("propName"); //$NON-NLS-1$ if (propName == null) { propName = DEFAULT_PROPNAME; } if (isTraceLogging) { log.finer("propName = " + propName); //$NON-NLS-1$ } if (aggregator instanceof AggregatorImpl) { // can be an IAggregator mock when unit testing contributingBundle = ((AggregatorImpl) aggregator).getContributingBundle(); } bundleResolver = BundleResolverFactory.getResolver(contributingBundle); if (isTraceLogging) { log.exiting(BundleVersionsHash.class.getName(), sourceMethod); } }
From source file:org.jenkinsci.plugins.dockerhub.notification.Coordinator.java
private void sendResponse(@Nonnull final WebHookPayload payload, @Nonnull final CallbackPayload callback) throws IOException, ExecutionException, InterruptedException { final String callbackUrl = payload.getCallbackUrl(); if (!StringUtils.isBlank(callbackUrl)) { logger.log(Level.FINE, "Sending callback to Docker Hub"); logger.log(Level.FINER, "Callback: {0}", callback); int response = Http.post(callbackUrl, callback.toJSON()); logger.log(Level.FINE, "Docker Hub returned {0}", response); } else {/*from ww w. j a va 2 s . c om*/ logger.log(Level.WARNING, "No callback URL specified in {0}", payload); } }
From source file:org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRestClient.java
/** * Deletes the specified application from the servers dropins directory. WLP * will detect this and then undeploy it. * //from w ww. j a v a2 s.c o m * @param String * - applicationName * @throws ClientProtocolException * @throws IOException */ public void undeploy(String applicationName) throws ClientProtocolException, IOException { if (log.isLoggable(Level.FINER)) { log.entering(className, "undeploy"); } String deployPath = String.format("${wlp.user.dir}/servers/%s/dropins/%s", configuration.getServerName(), applicationName); String serverRestEndpoint = String.format("https://%s:%d%s%s", configuration.getHostName(), configuration.getHttpsPort(), FILE_ENDPOINT, URLEncoder.encode(deployPath, UTF_8)); HttpResponse result = executor .execute(Request.Delete(serverRestEndpoint).useExpectContinue().version(HttpVersion.HTTP_1_1)) .returnResponse(); if (isSuccessful(result)) { log.fine("File " + applicationName + " was deleted"); } else { throw new ClientProtocolException("Unable to undeploy application " + applicationName + ", server returned response: " + result.getStatusLine()); } if (log.isLoggable(Level.FINER)) { log.exiting(className, "undeploy", result); } }
From source file:org.jenkinsci.plugins.pipeline.maven.publishers.DependenciesFingerprintPublisher.java
@Override public void process(@Nonnull StepContext context, @Nonnull Element mavenSpyLogsElt) throws IOException, InterruptedException { Run run = context.get(Run.class); TaskListener listener = context.get(TaskListener.class); FilePath workspace = context.get(FilePath.class); List<MavenSpyLogProcessor.MavenDependency> dependencies = listDependencies(mavenSpyLogsElt, LOGGER); if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger()//from w w w . j a v a 2 s .com .println("[withMaven] dependenciesFingerprintPublisher - filter: " + "versions[snapshot: " + isIncludeSnapshotVersions() + ", release: " + isIncludeReleaseVersions() + "], " + "scopes:" + getIncludedScopes()); } Map<String, String> artifactsToFingerPrint = new HashMap<>(); // artifactPathInFingerprintZone -> artifactMd5 for (MavenSpyLogProcessor.MavenDependency dependency : dependencies) { if (dependency.snapshot) { if (!includeSnapshotVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger() .println("[withMaven] Skip fingerprinting snapshot dependency: " + dependency); } continue; } } else { if (!includeReleaseVersions) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger() .println("[withMaven] Skip fingerprinting release dependency: " + dependency); } continue; } } if (!getIncludedScopes().contains(dependency.getScope())) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger().println( "[withMaven] Skip fingerprinting dependency with ignored scope: " + dependency); } continue; } try { if (StringUtils.isEmpty(dependency.file)) { if (LOGGER.isLoggable(Level.FINER)) { listener.getLogger() .println("[withMaven] Can't fingerprint maven dependency with no file attached: " + dependency); } continue; } FilePath dependencyFilePath = new FilePath(workspace, dependency.file); if (!(dependency.file.endsWith("." + dependency.extension))) { if (dependencyFilePath.isDirectory()) { if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger().println( "[withMaven] Skip fingerprinting of maven dependency of type directory " + dependency); } continue; } } String dependencyMavenRepoStyleFilePath = dependency.groupId.replace('.', '/') + "/" + dependency.artifactId + "/" + dependency.baseVersion + "/" + dependency.getFileNameWithBaseVersion(); if (dependencyFilePath.exists()) { // the subsequent call to digest could test the existence but we don't want to prematurely optimize performances if (LOGGER.isLoggable(Level.FINE)) { listener.getLogger() .println("[withMaven] Fingerprint dependency " + dependencyMavenRepoStyleFilePath); } String artifactDigest = dependencyFilePath.digest(); artifactsToFingerPrint.put(dependencyMavenRepoStyleFilePath, artifactDigest); } else { listener.getLogger().println("[withMaven] FAILURE to fingerprint " + dependencyMavenRepoStyleFilePath + ", file not found"); } } catch (IOException | RuntimeException e) { listener.error("[withMaven] WARNING: Exception fingerprinting " + dependency + ", skip"); e.printStackTrace(listener.getLogger()); listener.getLogger().flush(); } } LOGGER.log(Level.FINER, "Fingerprint {0}", artifactsToFingerPrint); // FINGERPRINT GENERATED MAVEN ARTIFACT FingerprintMap fingerprintMap = Jenkins.getInstance().getFingerprintMap(); for (Map.Entry<String, String> artifactToFingerprint : artifactsToFingerPrint.entrySet()) { String artifactPathInFingerprintZone = artifactToFingerprint.getKey(); String artifactMd5 = artifactToFingerprint.getValue(); fingerprintMap.getOrCreate(null, artifactPathInFingerprintZone, artifactMd5).addFor(run); } // add action Fingerprinter.FingerprintAction fingerprintAction = run.getAction(Fingerprinter.FingerprintAction.class); if (fingerprintAction == null) { run.addAction(new Fingerprinter.FingerprintAction(run, artifactsToFingerPrint)); } else { fingerprintAction.add(artifactsToFingerPrint); } }
From source file:com.granule.json.utils.internal.JSONSAXHandler.java
/** * Function ends a tag in this iFix parser. */// w ww .j av a 2 s. c o m public void endElement(String uri, String localName, String qName) throws SAXException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "endElement(String,String,String)"); if (!previousObjects.isEmpty()) { this.current = (JSONObject) this.previousObjects.pop(); } else { this.current = null; } if (logger.isLoggable(Level.FINER)) logger.exiting(className, "endElement(String,String,String)"); }
From source file:de.egore911.opengate.services.PilotService.java
@POST @Path("/login/{login}") @Produces("application/json") @Documentation("Allows a pilot to log in. This method is called by the client through the server. " + "It returns the ID of the user and it's ship data on success. " + "Otherwise HTTP 404 (Not Found) will be return, or an HTTP 500 (Internal " + "Server Error) in case of an internal error.") public Response performLogin(@PathParam("login") String login, @FormParam("password") String password) { EntityManager em = EntityManagerFilter.getEntityManager(); try {/* ww w . j av a2 s.co m*/ String passwordHash = hashPassword(password); try { Pilot pilot = (Pilot) em .createQuery("select pilot from Pilot pilot " + "where pilot.login = :login " + "and pilot.passwordHash = :passwordHash") .setParameter("login", login).setParameter("passwordHash", passwordHash).getSingleResult(); if (pilot.getVerificationCode() != null && !pilot.getVerificationCode().isEmpty()) { return Response.status(Status.UNAUTHORIZED).build(); } try { JSONObject jsonObject = new JSONObject(); StatusHelper.ok(jsonObject); jsonObject.put("id", pilot.getKey().getId()); // TODO properly wrap the vessel and its equipment/cargo jsonObject.put("vessel_id", pilot.getVessel().getKey().getId()); return Response.ok(jsonObject.toString()).build(); } catch (JSONException e) { LOG.log(Level.SEVERE, e.getMessage(), e); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } } catch (NoResultException e) { LOG.log(Level.FINER, e.getMessage(), e); return Response.status(Status.NOT_FOUND).build(); } } catch (NoSuchAlgorithmException e) { LOG.log(Level.SEVERE, e.getMessage(), e); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } }
From source file:com.granule.json.utils.internal.JSONObject.java
/** * Method to write out the JSON formatted object. Same as calling writeObject(writer,indentDepth,contentOnly,false); * @param writer The writer to use when serializing the JSON structure. * @param indentDepth How far to indent the text for object's JSON format. * @param contentOnly Flag to debnnote whether to assign this as an attribute name, or as a nameless object. Commonly used for serializing an array. The Array itself has the name, The contents are all nameless objects * @throws IOException Trhown if an error occurs on write. *//* ww w . ja v a 2 s . c o m*/ public void writeObject(Writer writer, int indentDepth, boolean contentOnly) throws IOException { if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); writeObject(writer, indentDepth, contentOnly, false); if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeObject(Writer, int, boolean)"); }
From source file:org.b3log.solo.processor.TagProcessor.java
/** * Shows articles related with a tag with the specified context. * /*from w ww.j ava 2s.com*/ * @param context the specified context * @throws IOException io exception */ @RequestProcessing(value = "/tags/**", method = HTTPRequestMethod.GET) public void showTagArticles(final HTTPRequestContext context) throws IOException { final AbstractFreeMarkerRenderer renderer = new FrontRenderer(); context.setRenderer(renderer); renderer.setTemplateName("tag-articles.ftl"); final Map<String, Object> dataModel = renderer.getDataModel(); final HttpServletRequest request = context.getRequest(); final HttpServletResponse response = context.getResponse(); try { String requestURI = request.getRequestURI(); if (!requestURI.endsWith("/")) { requestURI += "/"; } String tagTitle = getTagTitle(requestURI); final int currentPageNum = getCurrentPageNum(requestURI, tagTitle); if (-1 == currentPageNum) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } LOGGER.log(Level.FINER, "Tag[title={0}, currentPageNum={1}]", new Object[] { tagTitle, currentPageNum }); tagTitle = URLDecoder.decode(tagTitle, "UTF-8"); final JSONObject result = tagQueryService.getTagByTitle(tagTitle); if (null == result) { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } final JSONObject tag = result.getJSONObject(Tag.TAG); final String tagId = tag.getString(Keys.OBJECT_ID); final JSONObject preference = preferenceQueryService.getPreference(); Skins.fillSkinLangs(preference.optString(Preference.LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel); final int pageSize = preference.getInt(Preference.ARTICLE_LIST_DISPLAY_COUNT); final int windowSize = preference.getInt(Preference.ARTICLE_LIST_PAGINATION_WINDOW_SIZE); request.setAttribute(PageCaches.CACHED_OID, tagId); final Map<String, String> langs = langPropsService.getAll(Latkes.getLocale()); request.setAttribute(PageCaches.CACHED_TITLE, langs.get(PageTypes.TAG_ARTICLES.getLangeLabel()) + " [" + langs.get("pageNumLabel") + "=" + currentPageNum + ", " + langs.get("tagLabel") + "=" + tagTitle + "]"); request.setAttribute(PageCaches.CACHED_TYPE, langs.get(PageTypes.TAG_ARTICLES.getLangeLabel())); request.setAttribute(PageCaches.CACHED_LINK, requestURI); final List<JSONObject> articles = articleQueryService.getArticlesByTag(tagId, currentPageNum, pageSize); if (articles.isEmpty()) { try { response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } catch (final IOException ex) { LOGGER.severe(ex.getMessage()); } } final boolean hasMultipleUsers = Users.getInstance().hasMultipleUsers(); if (hasMultipleUsers) { filler.setArticlesExProperties(articles, preference); } else { // All articles composed by the same author final JSONObject author = articleUtils.getAuthor(articles.get(0)); filler.setArticlesExProperties(articles, author, preference); } final int tagArticleCount = tag.getInt(Tag.TAG_PUBLISHED_REFERENCE_COUNT); final int pageCount = (int) Math.ceil((double) tagArticleCount / (double) pageSize); LOGGER.log(Level.FINEST, "Paginate tag-articles[currentPageNum={0}, pageSize={1}, pageCount={2}, windowSize={3}]", new Object[] { currentPageNum, pageSize, pageCount, windowSize }); final List<Integer> pageNums = Paginator.paginate(currentPageNum, pageSize, pageCount, windowSize); LOGGER.log(Level.FINEST, "tag-articles[pageNums={0}]", pageNums); if (preference.getBoolean(Preference.ENABLE_ARTICLE_UPDATE_HINT)) { Collections.sort(articles, Comparators.ARTICLE_UPDATE_DATE_COMPARATOR); } else { Collections.sort(articles, Comparators.ARTICLE_CREATE_DATE_COMPARATOR); } fillPagination(dataModel, pageCount, currentPageNum, articles, pageNums); dataModel.put(Common.PATH, "/tags/" + URLEncoder.encode(tagTitle, "UTF-8")); dataModel.put(Keys.OBJECT_ID, tagId); dataModel.put(Tag.TAG, tag); dataModel.put(Keys.PAGE_TYPE, PageTypes.TAG_ARTICLES); filler.fillSide(request, dataModel, preference); filler.fillBlogHeader(request, dataModel, preference); filler.fillBlogFooter(dataModel, preference); } catch (final ServiceException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); try { response.sendError(HttpServletResponse.SC_NOT_FOUND); } catch (final IOException ex) { LOGGER.severe(ex.getMessage()); } } catch (final JSONException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); try { response.sendError(HttpServletResponse.SC_NOT_FOUND); } catch (final IOException ex) { LOGGER.severe(ex.getMessage()); } } }