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:org.geonode.security.GeoNodeDataAccessManager.java
/** * @see org.geoserver.security.DataAccessManager#canAccess(org.springframework.security.Authentication, * org.geoserver.catalog.ResourceInfo, org.geoserver.security.AccessMode) *///from ww w . ja v a2s. c o m public boolean canAccess(Authentication user, ResourceInfo resource, AccessMode mode) { if (!authenticationEnabled) { return true; } /** * A null user should only come from an internal GeoServer process (such as a GWC seed * thread). * <p> * Care must be taken in setting up the security filter chain so that no request can get * here with a null user. At least an anonymous authentication token must be set. * </p> */ if (user == null) { //throw new NullPointerException("user is null"); return true; } if (LOG.isLoggable(Level.FINE)) { LOG.fine("GeoNodeDataAccessManager::canAccess: Checking permissions for " + user.getName() + " with authorities " + user.getAuthorities() + " accessing " + resource); } if (user.getAuthorities().contains(GeoServerRole.ADMIN_ROLE)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("GeoNodeDataAccessManager::canAccess: user " + user.getName() + " is admin"); } return true; } return securityClientProvider.getSecurityClient().authorize(user, resource, mode); }
From source file:net.chrissearle.flickrvote.web.vote.ShowVoteChartAction.java
private void initializeChallengeInfo() { Set<ChallengeSummary> challenges = challengeService.getChallengesByType(ChallengeType.VOTING); challengeInfo = new DisplayChallengeSummary(challenges.iterator().next()); if (logger.isLoggable(Level.FINE)) { logger.info("Saw " + challengeInfo.toString()); }//from w w w . ja va 2 s. c o m }
From source file:edu.wpi.cs.wpisuitetng.modules.core.entitymanagers.ProjectManager.java
@Override public Project makeEntity(Session s, String content) throws WPISuiteException { User theUser = s.getUser();/*from ww w . ja va2s .c o m*/ logger.log(Level.FINER, "Attempting new Project creation..."); Project p; try { p = Project.fromJSON(content); } catch (JsonSyntaxException e) { logger.log(Level.WARNING, "Invalid Project entity creation string."); throw new BadRequestException( "The entity creation string had invalid format. Entity String: " + content); } logger.log(Level.FINE, "New project: " + p.getName() + " submitted by: " + theUser.getName()); p.setOwner(theUser); if (getEntity(s, p.getIdNum())[0] == null) { if (getEntityByName(s, p.getName())[0] == null) { save(s, p); } else { logger.log(Level.WARNING, "Project Name Conflict Exception during Project creation."); throw new ConflictException( "A project with the given name already exists. Entity String: " + content); } } else { logger.log(Level.WARNING, "ID Conflict Exception during Project creation."); throw new ConflictException("A project with the given ID already exists. Entity String: " + content); } logger.log(Level.FINER, "Project creation success!"); return p; }
From source file:at.bitfire.davdroid.syncadapter.TasksSyncManager.java
@Override protected RequestBody prepareUpload(LocalResource resource) throws IOException, CalendarStorageException { LocalTask local = (LocalTask) resource; App.log.log(Level.FINE, "Preparing upload of task " + local.getFileName(), local.getTask()); ByteArrayOutputStream os = new ByteArrayOutputStream(); local.getTask().write(os);/*w ww.j a v a 2 s. c o m*/ return RequestBody.create(DavCalendar.MIME_ICALENDAR, os.toByteArray()); }
From source file:es.prodevelop.gvsig.mini.tasks.namefinder.NameFinderFunc.java
@Override public boolean execute() { NameFinder NFTask = new NameFinder(); String query = new String(NFTask.URL + NFTask.parms).replaceAll(" ", "%20"); try {/*from w ww . j a va2s . co m*/ log.log(Level.FINE, query); InputStream is = Utils.openConnection(query); BufferedInputStream bis = new BufferedInputStream(is); /* Read bytes to the Buffer until there is nothing more to read(-1). */ ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = bis.read()) != -1) { if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } baf.append((byte) current); } Vector result = NFTask.parse(baf.toByteArray()); if (result != null) { // handler.sendEmptyMessage(map.POI_SUCCEEDED); Named[] searchRes = new Named[result.size()]; desc = new String[result.size()]; for (int i = 0; i < result.size(); i++) { Named n = (Named) result.elementAt(i); desc[i] = n.description; searchRes[i] = n; if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } } if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } nm = new NamedMultiPoint(searchRes); res = TaskHandler.FINISHED; } else { res = TaskHandler.CANCELED; } } catch (IOException e) { if (e instanceof UnknownHostException) { res = TaskHandler.NO_RESPONSE; } } catch (Exception e) { log.log(Level.SEVERE, "Namefinder" + e.getMessage(), e); } finally { } return true; }
From source file:io.stallion.services.Log.java
public static void fine(String message, Object... args) { if (getLogLevel().intValue() > Level.FINE.intValue()) { return;/*w w w . j a va 2s.c om*/ } //System.out.println(message); if (alwaysIncludeLineNumber) { Throwable t = new Throwable(); t.getStackTrace()[2].toString(); String clz = t.getStackTrace()[2].getClassName().replace("io.stallion.", ""); String method = t.getStackTrace()[2].getMethodName(); logger.logp(Level.FINE, clz, method, message, args); } else { logger.logp(Level.FINE, "", "", message, args); } }
From source file:edu.cwru.sepia.model.SimpleModel.java
@Override public void addActions(Collection<Action> actions, int sendingPlayerNumber) { for (Action a : actions) { int unitId = a.getUnitId(); history.recordCommandRecieved(sendingPlayerNumber, state.getTurnNumber(), unitId, a); if (a.getUnitId() != unitId) { if (logger.isLoggable(Level.FINE)) logger.fine("Rejecting submitted action because key did not match action's unit ID: " + a); history.recordCommandFeedback(sendingPlayerNumber, state.getTurnNumber(), new ActionResult(a, ActionResultType.INVALIDUNIT)); continue; } else if (state.getUnit(unitId) == null) { if (logger.isLoggable(Level.FINE)) logger.fine("Rejecting submitted action because unit " + unitId + " does not exist"); history.recordCommandFeedback(sendingPlayerNumber, state.getTurnNumber(), new ActionResult(a, ActionResultType.INVALIDUNIT)); continue; } else if (state.getUnit(unitId).getPlayer() != sendingPlayerNumber) { if (logger.isLoggable(Level.FINE)) logger.fine("Rejecting submitted action because player does not control unit: " + a); history.recordCommandFeedback(sendingPlayerNumber, state.getTurnNumber(), new ActionResult(a, ActionResultType.INVALIDCONTROLLER)); continue; } else {//from ww w. j a v a2s .c o m if (logger.isLoggable(Level.FINE)) logger.fine("Action submitted successfully: " + a); Unit actor = state.getUnit(unitId); ActionQueue queue = new ActionQueue(a, calculatePrimitives(a)); queuedActions.put(actor, queue); } } }
From source file:models.cloud.notifications.gcm.Sender.java
/** * Sends a message to many devices, retrying in case of unavailability. * //from w w w .j a v a 2 s . c o m * <p> * <strong>Note: </strong> this method uses exponential back-off to retry in * case of service unavailability and hence could block the calling thread * for many seconds. * * @param message * message to be sent. * @param regIds registration id of the devices that will receive the message. * @param retries number of retries in case of service unavailability errors. * * @return combined result of all requests made. * * @throws IllegalArgumentException if registrationIds is {@literal null} or empty. * @throws models.cloud.notifications.gcm.exceptions.InvalidRequestException if GCM didn't returned a 200 or 503 status. * @throws java.io.IOException if message could not be sent. */ public MulticastResult send(Message message, List<String> regIds, int retries) throws IOException { int attempt = 0; MulticastResult multicastResult; int backoff = BACKOFF_INITIAL_DELAY; // Map of results by registration id, it will be updated after each // attempt // to send the messages Map<String, Result> results = new HashMap<>(); List<String> unsentRegIds = new ArrayList<>(regIds); boolean tryAgain; List<Long> multicastIds = new ArrayList<>(); do { attempt++; if (logger.isLoggable(Level.FINE)) { logger.fine("Attempt #" + attempt + " to send message " + message + " to regIds " + unsentRegIds); } multicastResult = sendNoRetry(message, unsentRegIds); long multicastId = multicastResult.getMulticastId(); logger.fine("multicast_id on attempt # " + attempt + ": " + multicastId); multicastIds.add(multicastId); unsentRegIds = updateStatus(unsentRegIds, results, multicastResult); tryAgain = !unsentRegIds.isEmpty() && attempt <= retries; if (tryAgain) { int sleepTime = backoff / 2 + random.nextInt(backoff); sleep(sleepTime); if (2 * backoff < MAX_BACKOFF_DELAY) { backoff *= 2; } } } while (tryAgain); // calculate summary int success = 0, failure = 0, canonicalIds = 0; for (Result result : results.values()) { if (result.getMessageId() != null) { success++; if (result.getCanonicalRegistrationId() != null) { canonicalIds++; } } else { failure++; } } // build a new object with the overall result long multicastId = multicastIds.remove(0); MulticastResult.Builder builder = new MulticastResult.Builder(success, failure, canonicalIds, multicastId) .retryMulticastIds(multicastIds); // add results, in the same order as the input for (String regId : regIds) { Result result = results.get(regId); builder.addResult(result); } return builder.build(); }
From source file:edu.emory.cci.aiw.i2b2etl.ksb.QueryExecutor.java
public <E extends Object> E execute(ParameterSetter paramSetter, ResultSetReader<E> resultSetReader) throws KnowledgeSourceReadException { try {/* w ww. j a v a2s . c om*/ prepare(); if (this.preparedStatement == null) { return resultSetReader.read(null); } else { int j = 1; for (int i = 0, n = this.ontTables.length; i < n; i++) { j = paramSetter.set(this.preparedStatement, j); } long start = System.currentTimeMillis(); try (ResultSet rs = this.preparedStatement.executeQuery()) { E result = resultSetReader.read(rs); double queryTime = (System.currentTimeMillis() - start) / 1000.0; if (LOGGER.isLoggable(Level.FINE) && queryTime >= 1) { LOGGER.log(Level.FINE, "Long running query ({0} seconds): {1}", new Object[] { queryTime, this.sql }); } return result; } } } catch (SQLException ex) { throw new KnowledgeSourceReadException(ex); } }
From source file:jenkins.security.plugins.ldap.FromUserRecordLDAPGroupMembershipStrategy.java
@Override public GrantedAuthority[] getGrantedAuthorities(LdapUserDetails ldapUser) { List<GrantedAuthority> result = new ArrayList<GrantedAuthority>(); Attributes attributes = ldapUser.getAttributes(); final String attributeName = getAttributeName(); Attribute attribute = attributes == null ? null : attributes.get(attributeName); if (attribute != null) { try {//from w ww . j a va2s . c o m for (Object value : Collections.list(attribute.getAll())) { String groupName = String.valueOf(value); try { LdapName dn = new LdapName(groupName); groupName = String.valueOf(dn.getRdn(dn.size() - 1).getValue()); } catch (InvalidNameException e) { LOGGER.log(Level.FINEST, "Expected a Group DN but found: {0}", groupName); } result.add(new GrantedAuthorityImpl(groupName)); } } catch (NamingException e) { LogRecord lr = new LogRecord(Level.FINE, "Failed to retrieve member of attribute ({0}) from LDAP user details"); lr.setThrown(e); lr.setParameters(new Object[] { attributeName }); LOGGER.log(lr); } } return result.toArray(new GrantedAuthority[result.size()]); }