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:magma.agent.worldmodel.impl.GlobalMap.java
private void processHear(IPerception perception, Ball ball) { IHearPerceptor hear = perception.getHearPerceptor(); String name = hear.getName(); if ("self".equalsIgnoreCase(name)) { // message from ourselves return;/*from w ww .j a v a2 s. c o m*/ } try { String message = hear.getMessage(); int index = message.indexOf('-'); if (index < 0) { // no message from us return; } int x = new Integer(message.substring(0, index)); int y = new Integer(message.substring(index + 1)); float xlong = (x / 100.0f) - 10; float ylong = (y / 100.0f) - 5; ball.setPosition(new Vector3D(xlong, ylong, ball.getPosition().getZ())); logger.log(Level.FINER, "hear ball: ({0}, {1})", new Object[] { xlong, ylong }); } catch (Exception e) { // might happen with opponent messages } }
From source file:org.b3log.solo.plugin.cache.AdminCacheService.java
/** * Gets page cache list by the specified request json object. * //from ww w. j ava2s .c om * <p> * The request URI contains the pagination arguments. For example, the * request URI is /console/admin-cache/pages/1/10/20, means the * current page is 1, the page size is 10, and the window size is 20. * </p> * * <p> * Renders the response with a json object, for example, * <pre> * { * "sc": boolean, * "pagination": { * "paginationPageCount": 100, * "paginationPageNums": [1, 2, 3, 4, 5] * }, * "pages": [{ * "link": "", * "cachedType": "", * "cachedTitle": "", * }, ....] * } * </pre> * </p> * * @param request the specified http servlet request * @param response the specified http servlet response * @param context the specified http request context * @throws Exception exception */ @RequestProcessing(value = "/console/plugins/admin-cache/pages/" + Requests.PAGINATION_PATH_PATTERN, method = HTTPRequestMethod.GET) public void getPages(final HttpServletRequest request, final HttpServletResponse response, final HTTPRequestContext context) throws Exception { if (!userUtils.isLoggedIn(request, response)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } final JSONRenderer renderer = new JSONRenderer(); context.setRenderer(renderer); final JSONObject ret = new JSONObject(); renderer.setJSONObject(ret); try { final String requestURI = request.getRequestURI(); final String path = requestURI.substring("/console/plugins/admin-cache/pages/".length()); final JSONObject requestJSONObject = Requests.buildPaginationRequest(path); final int currentPageNum = requestJSONObject.getInt(Pagination.PAGINATION_CURRENT_PAGE_NUM); final int pageSize = requestJSONObject.getInt(Pagination.PAGINATION_PAGE_SIZE); final int windowSize = requestJSONObject.getInt(Pagination.PAGINATION_WINDOW_SIZE); List<String> keys = new ArrayList<String>(PageCaches.getKeys()); // Paginates final int pageCount = (int) Math.ceil((double) keys.size() / (double) pageSize); final JSONObject pagination = new JSONObject(); ret.put(Pagination.PAGINATION, pagination); final List<Integer> pageNums = Paginator.paginate(currentPageNum, pageSize, pageCount, windowSize); pagination.put(Pagination.PAGINATION_PAGE_COUNT, pageCount); pagination.put(Pagination.PAGINATION_PAGE_NUMS, pageNums); final int start = pageSize * (currentPageNum - 1); int end = start + pageSize; end = end > keys.size() ? keys.size() : end; keys = keys.subList(start, end); // Retrives cached pages final List<JSONObject> pages = new ArrayList<JSONObject>(); for (final String key : keys) { LOGGER.log(Level.FINER, "Cached page[key={0}]", key); JSONObject cachedPage = PageCaches.get(key); if (null != cachedPage) { // Do a copy for properties removing and retrieving cachedPage = new JSONObject(cachedPage, JSONObject.getNames(cachedPage)); cachedPage.remove(PageCaches.CACHED_CONTENT); pages.add(cachedPage); } } ret.put(Page.PAGES, pages); ret.put(Keys.STATUS_CODE, true); } catch (final Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); final JSONObject jsonObject = QueryResults.defaultResult(); renderer.setJSONObject(jsonObject); jsonObject.put(Keys.MSG, "Admin Cache plugin exception: " + e.getMessage()); } }
From source file:org.crank.javax.faces.component.MenuRenderer.java
public void decode(FacesContext context, UIComponent component) { if (context == null) { throw new NullPointerException(MessageUtils .getExceptionMessageString(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context")); }/*from ww w.j a v a2 s. c o m*/ if (component == null) { throw new NullPointerException(MessageUtils .getExceptionMessageString(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "component")); } if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, "Begin decoding component " + component.getId()); } // If the component is disabled, do not change the value of the // component, since its state cannot be changed. if (Util.componentIsDisabledOrReadonly(component)) { if (logger.isLoggable(Level.FINE)) { logger.fine("No decoding necessary since the component " + component.getId() + " is disabled"); } return; } String clientId = component.getClientId(context); assert (clientId != null); // currently we assume the model type to be of type string or // convertible to string and localized by the application. if (component instanceof UISelectMany) { Map<String, String[]> requestParameterValuesMap = context.getExternalContext() .getRequestParameterValuesMap(); if (requestParameterValuesMap.containsKey(clientId)) { String newValues[] = requestParameterValuesMap.get(clientId); setSubmittedValue(component, newValues); if (logger.isLoggable(Level.FINE)) { logger.fine("submitted values for UISelectMany component " + component.getId() + " after decoding " + newValues); } } else { // Use the empty array, not null, to distinguish // between an deselected UISelectMany and a disabled one setSubmittedValue(component, new String[0]); if (logger.isLoggable(Level.FINE)) { logger.fine( "Set empty array for UISelectMany component " + component.getId() + " after decoding "); } } } else { // this is a UISelectOne Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap(); if (requestParameterMap.containsKey(clientId)) { String newValue = requestParameterMap.get(clientId); setSubmittedValue(component, newValue); if (logger.isLoggable(Level.FINE)) { logger.fine("submitted value for UISelectOne component " + component.getId() + " after decoding " + newValue); } } else { // there is no value, but this is different from a null // value. setSubmittedValue(component, RIConstants.NO_VALUE); } } return; }
From source file:com.sampas.socbs.core.data.arcsde.impl.ArcSDEPooledConnection.java
/** * Doesn't close the connection, but returns itself to the connection pool. * //from w ww. j av a 2 s. co m * @throws IllegalStateException * if close() is called while a transaction is in progress * @see #destroy() */ // @Override public void close() throws IllegalStateException { checkActive(); if (transactionInProgress) { throw new IllegalStateException("Transaction is in progress, should commit or rollback before closing"); } try { if (LOGGER.isLoggable(Level.FINER)) { // StackTraceElement[] stackTrace = // Thread.currentThread().getStackTrace(); // String caller = stackTrace[3].getClassName() + "." + // stackTrace[3].getMethodName(); // System.err.println("<- " + caller + " returning " + // toString() + " to pool"); LOGGER.finer("<- returning " + toString() + " to pool"); } this.pool.returnObject(this); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } }
From source file:org.jboss.arquillian.container.was.wlp_remote_8_5.WLPRestClient.java
/** * Checks the application State using the WLP rest api. * /* w w w . ja v a 2s . c om*/ * @param applicationName * @return true if the application is in STARTED state * @throws DeploymentException */ public boolean isApplicationStarted(String applicationName) { if (log.isLoggable(Level.FINER)) { log.entering(className, "isApplicationStarted"); } String restEndpoint = String.format( "https://%s:%d%sWebSphere:service=com.ibm.websphere.application.ApplicationMBean,name=%s/attributes/State", configuration.getHostName(), configuration.getHttpsPort(), MBEANS_ENDPOINT, applicationName); String status = ""; try { String jsonResponse = executor.execute(Request.Get(restEndpoint)).returnContent().asString(); status = parseJsonResponse(jsonResponse); } catch (ClientProtocolException e) { // This exception is expected if the application hasn't been // deployed yet as its MBean won't exist. // We expect this and can continue, set status to error. log.finest("Expected error occurred while checking if application " + applicationName + " is already started, app may not have been deployed yet. Ok to continue. " + e); status = "error"; } catch (IOException e) { log.severe("IOException occurred while checking if application " + applicationName + " is already started " + e); status = "error"; } boolean applicationState; if (STARTED.equals(status)) { applicationState = true; } else { applicationState = false; } if (log.isLoggable(Level.FINER)) { log.exiting(className, "isApplicationStarted", applicationState); } return applicationState; }
From source file:com.granule.json.utils.XML.java
/** * Method to do the transform from an XML input stream to a JSON stream. * Neither input nor output streams are closed. Closure is left up to the caller. * * @param XMLStream The XML stream to convert to JSON * @param JSONStream The stream to write out JSON to. The contents written to this stream are always in UTF-8 format. * @param verbose Flag to denote whether or not to render the JSON text in verbose (indented easy to read), or compact (not so easy to read, but smaller), format. * * @throws SAXException Thrown if a parse error occurs. * @throws IOException Thrown if an IO error occurs. *//*from ww w . ja v a 2 s .com*/ public static void toJson(InputStream XMLStream, OutputStream JSONStream, boolean verbose) throws SAXException, IOException { if (logger.isLoggable(Level.FINER)) { logger.entering(className, "toJson(InputStream, OutputStream)"); } if (XMLStream == null) { throw new NullPointerException("XMLStream cannot be null"); } else if (JSONStream == null) { throw new NullPointerException("JSONStream cannot be null"); } else { if (logger.isLoggable(Level.FINEST)) { logger.logp(Level.FINEST, className, "transform", "Fetching a SAX parser for use with JSONSAXHandler"); } try { /** * Get a parser. */ SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); SAXParser sParser = factory.newSAXParser(); XMLReader parser = sParser.getXMLReader(); JSONSAXHandler jsonHandler = new JSONSAXHandler(JSONStream, verbose); parser.setContentHandler(jsonHandler); parser.setErrorHandler(jsonHandler); InputSource source = new InputSource(new BufferedInputStream(XMLStream)); if (logger.isLoggable(Level.FINEST)) { logger.logp(Level.FINEST, className, "transform", "Parsing the XML content to JSON"); } /** * Parse it. */ source.setEncoding("UTF-8"); parser.parse(source); jsonHandler.flushBuffer(); } catch (javax.xml.parsers.ParserConfigurationException pce) { throw new SAXException("Could not get a parser: " + pce.toString()); } } if (logger.isLoggable(Level.FINER)) { logger.exiting(className, "toJson(InputStream, OutputStream)"); } }
From source file:com.ibm.amc.data.wamt.WamtAppliance.java
/** * Create a new appliance in the WAMT repository, using the connection details to access the * appliance hardware.//from w ww . j a va2 s. co m * * @param manager * WAMT * @param applianceConnection * The ReST object containing the properties needed to connect to the device. * @throws ApplianceConnectionException * if the appliance can't be contacted with the given hostname and port * @throws InvalidCredentialsException * if the username and password are not accepted * @throws AmcIllegalArgumentException * if the appliance already exists in the WAMT repository */ public WamtAppliance(Manager manager, Appliance applianceConnection) throws ApplianceConnectionException, InvalidCredentialsException, AmcIllegalArgumentException { if (logger.isEntryEnabled()) logger.entry("<init>", manager, applianceConnection); this.manager = manager; applianceSymbolicName = applianceConnection.name; final ActionStatus status = ActionFactory.getActionLog().actionStarted( SecurityContext.getContext().getUser(), null, "add", "CWZBA1015I_ADD_APPLIANCE_ACTION_DESCRIPTION", applianceSymbolicName); try { ProgressContainer progressContainer; try { progressContainer = createDevice(applianceConnection); } catch (final FullException e) { throw new AmcRuntimeException(e); } try { progressContainer.blockAndTrace(Level.FINER); } catch (final Exception e) { // Remove the generic progress container wrapper exception if possible final Throwable cause = e.getCause(); if (cause != null) { if (cause instanceof com.ibm.datapower.amt.amp.InvalidCredentialsException) { throw new InvalidCredentialsException(); } if (cause instanceof AlreadyExistsInRepositoryException) { throw new AmcIllegalArgumentException(cause, "CWZBA0508E_APPLIANCE_ALREADY_EXISTS", applianceConnection.name, applianceConnection.hostName); } if (cause instanceof AMPIOException) { throw new ApplianceConnectionException(cause.getCause(), applianceConnection.hostName, applianceConnection.ampPort); } if (Util.getWamtExceptionCode(cause).equals("WAMT0805")) { throw new ApplianceConnectionException(cause.getCause(), applianceConnection.hostName, applianceConnection.ampPort); } throw new AmcRuntimeException(cause); } throw new AmcRuntimeException(e); } if (progressContainer.hasError()) { Exception exception = progressContainer.getError(); logger.error("CWZBA0002I_WAMT_ERROR_ADD_APPLIANCE", exception, exception.getMessage()); throw new AmcRuntimeException(exception); } wamtDevice = (Device) progressContainer.getResult(); try { ensureDeviceManaged(); } catch (RuntimeException exc) { // Attempt to remove appliance again try { manager.remove(wamtDevice); } catch (Throwable t) { if (logger.isDebugEnabled()) logger.debug("<init>", "Failed to remove appliance: " + t); } throw exc; } // Retrieve domains now so that they are all managed before the appliance is made // available to competing threads getDomains(); } catch (final ApplianceConnectionException exc) { status.failed(exc); throw exc; } catch (final RuntimeException exc) { status.failed(exc); throw exc; } status.succeeded(); if (logger.isEntryEnabled()) logger.exit("<init>"); }
From source file:mendeley2kindle.KindleDAO.java
public void addFileToCollection(String collection, MFile f) { log.log(Level.FINER, "Adding a document:" + f.getLocalUrl() + " to the collection: " + collection); if (hasFile(collection, f)) { log.log(Level.FINE, "Already exists in the collection " + collection + ":" + f.getLocalUrl()); return;// w ww . ja va 2s .co m } String path = toKindlePath(f); String khash = toKindleHash(path); String key = collection + KINDLE_LOCALE; try { JSONArray items = collections.getJSONObject(key).getJSONArray("items"); items.put(khash); log.log(Level.FINE, "Added a document:" + f.getLocalUrl() + " to the collection: " + collection); } catch (JSONException e) { e.printStackTrace(); } }
From source file:org.geotools.data.ngi.NGISchemaReader.java
private String seekNextLayer(BufferedReader reader) { try {/* www . ja v a 2s .co m*/ String line = reader.readLine(); while (line != null) { if (line.equalsIgnoreCase("$LAYER_NAME")) { String layerName = reader.readLine(); return layerName.substring(1, layerName.length() - 1); } line = reader.readLine(); } } catch (IOException e) { LOGGER.log(Level.FINER, e.getMessage(), e); } return null; }
From source file:com.ibm.jaggr.core.impl.AbstractAggregatorImpl.java
@Override public void init(ServletConfig servletConfig) throws ServletException { final String sourceMethod = "init"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[] { servletConfig }); }//from w w w .j a v a 2 s. c o m super.init(servletConfig); final ServletContext context = servletConfig.getServletContext(); // Set servlet context attributes for access though the request context.setAttribute(IAggregator.AGGREGATOR_REQATTRNAME, this); if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } }