Example usage for java.util.logging Level FINER

List of usage examples for java.util.logging Level FINER

Introduction

In this page you can find the example usage for java.util.logging Level FINER.

Prototype

Level FINER

To view the source code for java.util.logging Level FINER.

Click Source Link

Document

FINER indicates a fairly detailed tracing message.

Usage

From source file:jenkins.security.apitoken.ApiTokenStore.java

/**
 * Given a token identifier and a name, the system will try to find a corresponding token and rename it
 * @return {@code true} iff the token was found and the rename was successful
 *//*ww  w.j a va 2  s  .  co m*/
public synchronized boolean renameToken(@Nonnull String tokenUuid, @Nonnull String newName) {
    for (HashedToken token : tokenList) {
        if (token.uuid.equals(tokenUuid)) {
            token.rename(newName);
            return true;
        }
    }

    LOGGER.log(Level.FINER,
            "The target token for rename does not exist, for uuid = {0}, with desired name = {1}",
            new Object[] { tokenUuid, newName });
    return false;
}

From source file:com.archivas.clienttools.arcutils.utils.net.GetCertsX509TrustManager.java

/**
 * @see javax.net.ssl.X509TrustManager#checkServerTrusted(java.security.cert.X509Certificate[],String
 *      authType)//w  w w.j  av  a2  s .  c  o m
 */
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:com.granule.json.utils.XML.java

/**
 * Method to take an input stream to an XML document and return a String of the JSON format.  Note that the xmlStream is not closed when read is complete.  This is left up to the caller, who may wish to do more with it.
 * @param xmlStream The InputStream to an XML document to transform to JSON.
 * @param verbose Boolean flag denoting whther or not to write the JSON in verbose (formatted), or compact form (no whitespace)
 * @return A string of the JSON representation of the XML file
 * //from  w w  w .j a  va2  s .  c  o m
 * @throws SAXException Thrown if an error occurs during parse.
 * @throws IOException Thrown if an IOError occurs.
 */
public static String toJson(InputStream xmlStream, boolean verbose) throws SAXException, IOException {
    if (logger.isLoggable(Level.FINER)) {
        logger.exiting(className, "toJson(InputStream, boolean)");
    }

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    String result = null;

    try {
        toJson(xmlStream, baos, verbose);
        result = baos.toString("UTF-8");
        baos.close();
    } catch (UnsupportedEncodingException uec) {
        IOException iox = new IOException(uec.toString());
        iox.initCause(uec);
        throw iox;
    }

    if (logger.isLoggable(Level.FINER)) {
        logger.exiting(className, "toJson(InputStream, boolean)");
    }

    return result;
}

From source file:org.apache.oodt.cas.filemgr.datatransfer.LocalDataTransferer.java

private void copyDirToDir(Product product, File directory) throws IOException, URISyntaxException {
    Reference dirRef = product.getProductReferences().get(0);
    LOG.log(Level.INFO, "LocalDataTransferer: Staging Directory: " + dirRef.getDataStoreReference()
            + " into directory " + directory.getAbsolutePath());

    for (Reference r : product.getProductReferences()) {
        File fileRef = new File(new URI(r.getDataStoreReference()));

        if (fileRef.isFile()) {
            copyFile(r, directory);//from   w w w .  ja v  a 2  s.co m
        } else if (fileRef.isDirectory() && (fileRef.list() != null && fileRef.list().length == 0)) {
            // if it's a directory and it doesn't exist yet, we should
            // create it
            // just in case there's no files in it
            File dest = new File(directory, fileRef.getName());
            if (!new File(new URI(dest.getAbsolutePath())).exists()) {
                LOG.log(Level.FINER, "Directory: [" + dest.getAbsolutePath() + "] doesn't exist: creating it");
                try {
                    FileUtils.forceMkdir(new File(new URI(dest.getAbsolutePath())));
                } catch (IOException e) {
                    LOG.log(Level.WARNING, "Unable to create directory: [" + dest.getAbsolutePath()
                            + "] in local data transferer");

                }
            }
        }
    }
}

From source file:org.aselect.server.request.handler.IDPFHandler.java

/**
 * Process incoming request.<br>//from   w w w. jav  a 2 s . c  o m
 * 
 * @param servletRequest
 *            HttpServletRequest.
 * @param servletResponse
 *            HttpServletResponse.
 * @return the request state
 * @throws ASelectException
 *             If processing of  data request fails.
 */
public RequestState process(HttpServletRequest servletRequest, HttpServletResponse servletResponse)
        throws ASelectException {
    String sMethod = "process";
    String uid = defaultUID;
    String extractedAselect_credentials = null;

    extractedAselect_credentials = servletRequest.getParameter("aselect_credentials");

    if (extractedAselect_credentials == null) { // For now we don't care about previous authentication, let aselect handle that

        // authenticate to the aselect server
        String ridReqURL = aselectServerURL;
        String ridSharedSecret = sharedSecret;
        String ridAselectServer = _sMyServerID;
        String ridrequest = "authenticate";
        String ridAppURL = getIdpfEndpointUrl();

        //               String ridCheckSignature = verifySignature; 

        String ridResponse = "";
        // Send data 
        BufferedReader in = null;
        try {
            //Construct request data 
            String ridURL = ridReqURL + "?" + "shared_secret=" + URLEncoder.encode(ridSharedSecret, "UTF-8")
                    + "&a-select-server=" + URLEncoder.encode(ridAselectServer, "UTF-8") + "&request="
                    + URLEncoder.encode(ridrequest, "UTF-8") + "&uid=" + URLEncoder.encode(uid, "UTF-8") +
                    // RM_30_01
                    "&app_url=" + URLEncoder.encode(ridAppURL, "UTF-8") +
                    //                         "&check-signature=" + URLEncoder.encode(ridCheckSignature, "UTF-8") +
                    "&app_id=" + URLEncoder.encode(appID, "UTF-8");
            _systemLogger.log(Level.FINER, MODULE, sMethod, "Requesting rid through: " + ridURL);

            URL url = new URL(ridURL);

            in = new BufferedReader(new InputStreamReader(url.openStream()));

            String inputLine = null;
            while ((inputLine = in.readLine()) != null) {
                ridResponse += inputLine;
            }
            _systemLogger.log(Level.FINER, MODULE, sMethod, "Requesting rid response: " + ridResponse);
        } catch (Exception e) {
            _systemLogger.log(Level.SEVERE, MODULE, sMethod,
                    "Could not retrieve rid from aselectserver: " + ridAselectServer);
            throw new ASelectCommunicationException(Errors.ERROR_ASELECT_IO, e);
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch (IOException e) {
                    _systemLogger.log(Level.WARNING, MODULE, sMethod,
                            "Could not close stream to aselectserver : " + ridAselectServer);
                }
        }

        String extractedRid = ridResponse.replaceFirst(".*rid=([^&]*).*$", "$1");
        _systemLogger.log(Level.FINER, MODULE, sMethod, "rid retrieved: " + extractedRid);

        _htSessionContext = _oSessionManager.getSessionContext(extractedRid);
        if (_htSessionContext == null) {
            _systemLogger.log(Level.WARNING, MODULE, sMethod, "No session found for RID: " + extractedRid);
            throw new ASelectException(Errors.ERROR_ASELECT_SERVER_INVALID_REQUEST);
        }
        _htSessionContext = setupSessionContext(_htSessionContext);

        String javaxSessionid = servletRequest.getSession().getId();
        _systemLogger.log(Level.FINER, MODULE, sMethod, "idpfsessionid: " + javaxSessionid);

        _htSessionContext.put("idpfsessionid", javaxSessionid);

        _oSessionManager.updateSession(extractedRid, _htSessionContext);

        String loginrequest = "login1";

        //Construct request data 
        String redirectURL = null;
        try {
            redirectURL = ridReqURL + "?" + "request=" + URLEncoder.encode(loginrequest, "UTF-8")
                    + "&a-select-server=" + URLEncoder.encode(ridAselectServer, "UTF-8") + "&rid="
                    + extractedRid;
            _systemLogger.log(Level.FINER, MODULE, sMethod,
                    "Requesting login through redirect with redirectURL: " + redirectURL);

            servletResponse.sendRedirect(redirectURL);
        } catch (UnsupportedEncodingException e1) {
            _systemLogger.log(Level.SEVERE, MODULE, sMethod,
                    "Could not URLEncode to UTF-8, this should not happen!");
            throw new ASelectCommunicationException(Errors.ERROR_ASELECT_INTERNAL_ERROR, e1);
        } catch (IOException e) {
            _systemLogger.log(Level.SEVERE, MODULE, sMethod, "Could not redirect to: " + redirectURL);
            throw new ASelectCommunicationException(Errors.ERROR_ASELECT_IO, e);
        }
    } else { // This should be a return from the aselect server
        // This should be the aselectserver response

        // check the session for validity
        String javaxSessionid = servletRequest.getSession().getId();
        _systemLogger.log(Level.FINEST, MODULE, sMethod, "javaxSessionid: " + javaxSessionid);

        String org_javaxSessionid = (String) _htSessionContext.get("idpfsessionid");
        if (!javaxSessionid.equals(org_javaxSessionid)) {
            _systemLogger.log(Level.WARNING, MODULE, sMethod, "Invalid sessionid found");
            throw new ASelectException(Errors.ERROR_ASELECT_SERVER_INVALID_REQUEST);
        }

        _systemLogger.log(Level.INFO, MODULE, sMethod, "Handle the aselectserver response");

        String finalResult = verify_credentials(servletRequest, extractedAselect_credentials);
        _systemLogger.log(Level.INFO, MODULE, sMethod, "finalResult after verify_credentials: " + finalResult);

        String extractedAttributes = finalResult.replaceFirst(".*attributes=([^&]*).*$", "$1");
        String extractedResultCode = finalResult.replaceFirst(".*result_code=([^&]*).*$", "$1");

        String urlDecodedAttributes = null;
        ;
        String decodedAttributes = null;
        try {
            urlDecodedAttributes = URLDecoder.decode(extractedAttributes, "UTF-8");
            decodedAttributes = URLDecoder.decode(new String(
                    org.apache.commons.codec.binary.Base64.decodeBase64(urlDecodedAttributes.getBytes())),
                    "UTF-8");
            String attribs[] = decodedAttributes.split("&");
            for (int i = 0; i < attribs.length; i++) {
                _systemLogger.log(Level.FINER, MODULE, sMethod,
                        "Retrieved attribute from aselectserver: " + attribs[i]);
            }
        } catch (UnsupportedEncodingException e2) {
            _systemLogger.log(Level.SEVERE, MODULE, sMethod,
                    "Could not URLDecode from UTF-8, this should not happen!");
            throw new ASelectCommunicationException(Errors.ERROR_ASELECT_INTERNAL_ERROR, e2);
        }

        String userSelectedClaimedId = null;
        //           userSelectedId =  finalResult.replaceFirst(".*uid=([^&]*).*$", "$1");
        //         _systemLogger.log(Level.INFO, MODULE, sMethod, "Retrieved uid from aselect query string (userSelectedId): " + userSelectedId);

        //           userSelectedClaimedId =  decodedAttributes.replaceFirst(".*uid=([^&]*).*$", "$1");
        userSelectedClaimedId = decodedAttributes
                .replaceFirst(".*" + Pattern.quote(elected_uid_attributename) + "=([^&]*).*$", "$1"); // configurable passed_uid
        _systemLogger.log(Level.FINER, MODULE, sMethod, "Retrieved: " + elected_uid_attributename
                + " (elected_uid_attributename) from aselect attributes: " + userSelectedClaimedId);

        Boolean authenticatedAndApproved = false;
        try {
            authenticatedAndApproved = Boolean.valueOf(Integer.parseInt(extractedResultCode) == 0);
        } catch (NumberFormatException nfe) {
            _systemLogger.log(Level.WARNING, MODULE, sMethod,
                    "Resultcode from aselectserver was non-numeric: " + extractedResultCode);
        }

        if (authenticatedAndApproved) {
            // If authenticatedAndApproved then send off the user with either POST or GET
            // (Only POST for now)
            if (getPostTemplate() != null) {
                String sSelectForm = Utils.loadTemplateFromFile(_systemLogger, _configManager.getWorkingdir(),
                        null, getPostTemplate(), _sUserLanguage, _configManager.getOrgFriendlyName(),
                        Version.getVersion());

                String sInputs = generatePostForm(userSelectedClaimedId);

                // Keep logging short:
                _systemLogger.log(Level.FINER, MODULE, sMethod,
                        "Template=" + getPostTemplate() + " sInputs=" + sInputs + " ...");

                handlePostForm(sSelectForm, getEndpointurl(), sInputs, servletRequest, servletResponse);
            } else { // for now we only allow POST
                _systemLogger.log(Level.SEVERE, MODULE, sMethod, "No POST template found");
                throw new ASelectException(Errors.ERROR_ASELECT_AGENT_INTERNAL_ERROR);
            }

        } else {
            _systemLogger.log(Level.WARNING, MODULE, sMethod,
                    "Could not aythenticate user, authentication failed with resultcode: "
                            + extractedResultCode);
            throw new ASelectException(Errors.ERROR_ASELECT_SERVER_USER_NOT_ALLOWED);
        }

    }
    return null;
}

From source file:org.crank.javax.faces.component.MenuRenderer.java

public void encodeEnd(FacesContext context, UIComponent component) throws IOException {

    if (context == null) {
        throw new NullPointerException(MessageUtils
                .getExceptionMessageString(MessageUtils.NULL_PARAMETERS_ERROR_MESSAGE_ID, "context"));
    }/*from   www  .j  a  va2s  . 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 encoding component " + component.getId());
    }
    // suppress rendering if "rendered" property on the component is
    // false.
    if (!component.isRendered()) {
        if (logger.isLoggable(Level.FINE)) {
            logger.fine("End encoding component " + component.getId() + " since "
                    + "rendered attribute is set to false ");
        }
        return;
    }

    renderSelect(context, component);
    if (logger.isLoggable(Level.FINER)) {
        logger.log(Level.FINER, "End encoding component " + component.getId());
    }

}

From source file:com.esri.vehiclecommander.controller.AdvancedSymbolController.java

@Override
protected boolean processMessage(Geomessage geomessage) {
    //Filter out messages that we just sent
    if (null != geomessage.getId() && geomessage.getId().equals(appConfigController.getUniqueId())) {
        return false;
    }//w  w  w . j  a va2  s.c om

    String action = (String) geomessage.getProperty(Geomessage.ACTION_FIELD_NAME);
    Message message;
    if ("select".equalsIgnoreCase(action)) {
        message = MessageHelper.createSelectMessage(DictionaryType.Mil2525C, geomessage.getId(),
                (String) geomessage.getProperty(Geomessage.TYPE_FIELD_NAME), true);
    } else if ("un-select".equalsIgnoreCase(action)) {
        message = MessageHelper.createSelectMessage(DictionaryType.Mil2525C, geomessage.getId(),
                (String) geomessage.getProperty(Geomessage.TYPE_FIELD_NAME), false);
    } else if ("remove".equalsIgnoreCase(action)) {
        message = MessageHelper.createRemoveMessage(DictionaryType.Mil2525C, geomessage.getId(),
                (String) geomessage.getProperty(Geomessage.TYPE_FIELD_NAME));
    } else {
        ArrayList<Point> points = new ArrayList<Point>();
        String pointsString = (String) geomessage.getProperty(Geomessage.CONTROL_POINTS_FIELD_NAME);
        if (null != pointsString) {
            StringTokenizer tok = new StringTokenizer(pointsString, ";");
            while (tok.hasMoreTokens()) {
                StringTokenizer tok2 = new StringTokenizer(tok.nextToken(), ",");
                try {
                    points.add(new Point(Double.parseDouble(tok2.nextToken()),
                            Double.parseDouble(tok2.nextToken())));
                } catch (Throwable t) {
                    Logger.getLogger(getClass().getName())
                            .warning("Couldn't parse point from '" + pointsString + "'");
                }
            }
        }
        message = MessageHelper.createUpdateMessage(DictionaryType.Mil2525C, geomessage.getId(),
                (String) geomessage.getProperty(Geomessage.TYPE_FIELD_NAME), points);
        message.setProperties(geomessage.getProperties());
        message.setID(geomessage.getId());
    }

    try {
        return _processMessage(message);
    } catch (RuntimeException re) {
        //This is probably a message type that the MessageProcessor type doesn't support
        Logger.getLogger(getClass().getName()).log(Level.FINER,
                "Couldn't process message: " + re.getMessage() + "\n"
                        + "\tIt is possible that this MessageProcessor doesn't handle messages of type "
                        + message.getProperty(MessageHelper.MESSAGE_2525C_TYPE_PROPERTY_NAME) + ".");
        return false;
    }
}

From source file:org.cloudifysource.restclient.RestClientExecutor.java

private <T> T executeRequest(final HttpRequestBase request,
        final TypeReference<Response<T>> responseTypeReference) throws RestClientException {
    HttpResponse httpResponse = null;/*w  ww  .j a v a 2  s.  c o  m*/
    try {
        IOException lastException = null;
        int numOfTrials = DEFAULT_TRIALS_NUM;
        if (HttpGet.METHOD_NAME.equals(request.getMethod())) {
            numOfTrials = GET_TRIALS_NUM;
        }
        for (int i = 0; i < numOfTrials; i++) {
            try {
                httpResponse = httpClient.execute(request);
                lastException = null;
                break;
            } catch (IOException e) {
                if (logger.isLoggable(Level.FINER)) {
                    logger.finer("Execute get request to " + request.getURI() + ". try number " + (i + 1)
                            + " out of " + GET_TRIALS_NUM + ", error is " + e.getMessage());
                }
                lastException = e;
            }
        }
        if (lastException != null) {
            if (logger.isLoggable(Level.WARNING)) {
                logger.warning("Failed executing " + request.getMethod() + " request to " + request.getURI()
                        + " : " + lastException.getMessage());
            }
            throw MessagesUtils.createRestClientIOException(RestClientMessageKeys.EXECUTION_FAILURE.getName(),
                    lastException, request.getURI());
        }
        String url = request.getURI().toString();
        checkForError(httpResponse, url);
        return getResponseObject(responseTypeReference, httpResponse, url);
    } finally {
        request.abort();
    }
}

From source file:alien4cloud.paas.cloudify2.rest.external.RestClientExecutor.java

private <T> T executeRequest(final HttpRequestBase request,
        final TypeReference<Response<T>> responseTypeReference) throws RestClientException {
    HttpResponse httpResponse = null;/*from   w  w w.  ja  v  a 2 s .co m*/
    IOException lastException = null;
    int numOfTrials = DEFAULT_TRIALS_NUM;
    if (HttpGet.METHOD_NAME.equals(request.getMethod())) {
        numOfTrials = GET_TRIALS_NUM;
    }
    for (int i = 0; i < numOfTrials; i++) {
        try {
            httpResponse = httpClient.execute(request);
            lastException = null;
            break;
        } catch (IOException e) {
            if (logger.isLoggable(Level.FINER)) {
                logger.finer("Execute get request to " + request.getURI() + ". try number " + (i + 1)
                        + " out of " + GET_TRIALS_NUM + ", error is " + e.getMessage());
            }
            lastException = e;
        }
    }
    if (lastException != null) {
        if (logger.isLoggable(Level.WARNING)) {
            logger.warning("Failed executing " + request.getMethod() + " request to " + request.getURI() + " : "
                    + lastException.getMessage());
        }
        throw MessagesUtils.createRestClientIOException(RestClientMessageKeys.EXECUTION_FAILURE.getName(),
                lastException, request.getURI());
    }
    String url = request.getURI().toString();
    checkForError(httpResponse, url);
    return getResponseObject(responseTypeReference, httpResponse, url);
}

From source file:Peer.java

/**
 * Construct a peers finger table using getSuccessor.
 *///from w  w  w  .  j  a v a2s .  c  o  m
public void constructFingerTable(int mbits) {
    lg.log(Level.FINEST, "constructFingerTable entry");
    // clear the current finger table

    ft.clear();
    try {
        // For each mbit ...
        for (int i = 1; i <= mbits; i++) {
            // make a new finger entry 
            FingerEntry fe = new FingerEntry();

            // Calculate (nodeid+2^(i-1))%max_key
            Key fingerid = new Key().add(nodeid).add(new Key(BigInteger.valueOf((int) Math.pow(2, i - 1))))
                    .mod(new Key(BigInteger.valueOf((int) Math.pow(2, mbits))));
            // Adding a new finger entry
            fe.setId(fingerid);
            lg.log(Level.FINER, "Peer " + nodeid + " Initiating getSuccessor on key " + fingerid);
            fe.setNodeId(getSuccessor(fingerid));
            ft.addFingerEntry(fe);
        }

    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    lg.log(Level.FINEST, "constructFingerTable exit");

}