Example usage for java.util.logging Level FINE

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

Introduction

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

Prototype

Level FINE

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

Click Source Link

Document

FINE is a message level providing tracing information.

Usage

From source file:com.validation.manager.core.tool.Tool.java

public static TCEExtraction extractTCE(Object key) {
    TestCaseExecutionServer tce = null;//  www. j  a  v a  2  s . c  o m
    TestCaseServer tcs = null;
    if (key instanceof String) {
        String item = (String) key;
        StringTokenizer st = new StringTokenizer(item, "-");
        st.nextToken();//Ignore the tce part
        String tceIdS = st.nextToken();
        try {
            int tceId = Integer.parseInt(tceIdS);
            LOG.log(Level.FINE, "{0}", tceId);
            tce = new TestCaseExecutionServer(tceId);
        } catch (NumberFormatException nfe) {
            LOG.log(Level.WARNING, "Unable to find TCE: " + tceIdS, nfe);
        }
        try {
            int tcId = Integer.parseInt(st.nextToken());
            int tcTypeId = Integer.parseInt(st.nextToken());
            LOG.log(Level.FINE, "{0}", tcId);
            tcs = new TestCaseServer(new TestCasePK(tcId, tcTypeId));
        } catch (NumberFormatException nfe) {
            LOG.log(Level.WARNING, "Unable to find TCE: " + tceIdS, nfe);
        }
    } else if (key instanceof TestCaseExecution) {
        //It is a TestCaseExecution
        tce = new TestCaseExecutionServer((TestCaseExecution) key);
    } else {
        LOG.log(Level.SEVERE, "Unexpected key: {0}", key);
        tce = null;
    }
    return new TCEExtraction(tce, tcs);
}

From source file:magma.agent.behavior.complex.ShootToGoal.java

/**
 * @return the appropriate behavior for kicking
 *///from   w ww  .  j  a  v a  2  s . c  om
private IBehavior getBehavior() {
    IBehavior result;
    IThisPlayer thisPlayer = worldModel.getThisPlayer();
    IMoveableObject ball = worldModel.getBall();
    Vector3D ballPos = ball.getPosition();
    Vector3D ownPos = thisPlayer.getPosition();

    double ownDistanceToBall = thisPlayer.getDistanceToXY(ballPos);
    double goalDistance = thisPlayer.getDistanceTo(worldModel.getOtherGoalPosition());
    double ownGoalDistance = thisPlayer.getDistanceTo(worldModel.getOwnGoalPosition());
    Angle ballAngle1 = thisPlayer.getBodyDirectionTo(ballPos);
    Angle goalAngle1 = thisPlayer.getBodyDirectionTo(worldModel.getOtherGoalPosition());
    Angle delta = goalAngle1.subtract(ballAngle1);

    double ballAngle = ballAngle1.degrees();
    double goalAngle = goalAngle1.degrees();

    // Calculate the position where the straight line through the player and
    // the ball will cross the end of the field

    double m = 0;
    double b = 0;

    // Decide on which goal are we playing and calculate the straight line
    double x = worldModel.getOtherGoalPosition().getX();
    if (x < 0) {
        // Playing to the left goal
        m = (ballPos.getY() - ownPos.getY()) / (ballPos.getX() - ownPos.getX());

        b = ballPos.getY() - m * ownPos.getX();

    } else {
        // Playing to the right goal
        m = (ownPos.getY() - ballPos.getY()) / (ownPos.getX() - ballPos.getX());

        b = ownPos.getY() - m * ballPos.getX();

    }

    // Calculate the Y point of the goal line where the ball will cross the
    // line if we perform a straight kick
    double y = m * x + b;

    // LOG
    logger.log(Level.FINE,
            "Kick: Distance: {0} BallAngle: {1} goalAngle: {2} " + "ball observed distance: {3} last seen: {4}",
            new Object[] { ownDistanceToBall, ballAngle, goalAngle, ball.getDistance(),
                    ball.getLastSeenTime() });

    logger.log(Level.FINE, "Kick: ballPos: {0};{1} playerPos: {2};{3} ", new Object[] { ballPos.getX(),
            ballPos.getY(), thisPlayer.getPosition().getX(), thisPlayer.getPosition().getY() });

    // if (Math.abs(goalAngle) < 30) {
    // if your direction is pointed to the ball
    // and you are able to shoot between the two goalPost
    // then kick

    if ((goalDistance < 2 && y < 0.7 && y > -0.7 && Math.abs(ballAngle) < 45)
            || (goalDistance > 2 && ownGoalDistance > 3 && Math.abs(ballAngle) < 30 && Math.abs(goalAngle) < 30)
            || (ownGoalDistance < 3 && Math.abs(ballAngle) < 30 && Math.abs(goalAngle) < 80)) {

        // we are aligned to goal
        if (thisPlayer.isInsidePolygonXY(ballPos, getBothLegKickRectangle())) {
            // ball is kickable by both feet
            if (goalAngle < 0) {
                // the goal is to the right, kicking with left leg in this
                // area usually lets the ball drift right of the straight line
                // from robot through ball is of the left side of the goal center
                return behaviors.get(IBehavior.SHOOT_LEFT);

            } else {
                return behaviors.get(IBehavior.SHOOT_RIGHT);
            }

            // ball kickable by single leg?
        } else if (thisPlayer.isInsidePolygonXY(ballPos, getLeftLegKickRectangle())) {
            return behaviors.get(IBehavior.SHOOT_LEFT);

        } else if (thisPlayer.isInsidePolygonXY(ballPos, getRightLegKickRectangle())) {
            return behaviors.get(IBehavior.SHOOT_RIGHT);

        } else if (Math.abs(ballAngle) < 20) {
            // ball is ahead
            return behaviors.get(IBehavior.FORWARD);

        } else if (ballAngle > 50 && ballAngle < 90) {
            // ball is left and in front
            return behaviors.get(IBehavior.STEP_LEFT);

        } else if (ballAngle < -50 && ballAngle > -90) {
            // ball is right and in front

            return behaviors.get(IBehavior.STEP_RIGHT);

        }
    }

    // not facing to goal direction
    if (Math.abs(delta.degrees()) < 35) {
        // ball and goal direction are aligned
        /*
         * if (ballAngle > 70) { return
         * behaviors.get(IBehavior.SIDE_KICK_LEFT); } else if (ballAngle < -70)
         * { return behaviors.get(IBehavior.SIDE_KICK_RIGHT); } else
         */
        // side kick possible ?
        if (thisPlayer.isInsidePolygonXY(ballPos, getLeftLegSideKickRectangle())) {
            return behaviors.get(IBehavior.SIDE_KICK_LEFT);

        } else if (thisPlayer.isInsidePolygonXY(ballPos, getRightLegSideKickRectangle())) {
            return behaviors.get(IBehavior.SIDE_KICK_RIGHT);

            // turn necessary?
        } else if ((result = getTurnBehavior(ballAngle)) != null) {
            return result;

        } else {
            return behaviors.get(IBehavior.FORWARD);
        }

    } else {
        // ball and goal are not aligned
        if (Math.abs(ballAngle) < 50) {
            // ball is in front: move round ball
            if (goalAngle < 0) {
                return behaviors.get(IBehavior.INWARD_TURN_LEFT45);
            } else {
                return behaviors.get(IBehavior.INWARD_TURN_RIGHT45);
            }

        } else if (goalAngle > 0 && delta.degrees() > 0) {
            // goal is further left than ball
            return behaviors.get(IBehavior.FORWARD);

        } else if (goalAngle < 0 && delta.degrees() < 0) {
            // goal is further right than ball
            return behaviors.get(IBehavior.FORWARD);

        } else {
            // ball angle is bigger than goal angle, so we turn
            return getTurnBehavior(ballAngle);
        }
    }
}

From source file:com.esri.gpt.control.rest.search.DistributedSearchServlet.java

/**
 * Processes the HTTP request./*from  ww  w  .j  a  va  2  s .co m*/
 * 
 * @param request
 *          the HTTP request.
 * @param response
 *          HTTP response.
 * @param context
 *          request context
 * @throws Exception
 *           if an exception occurs
 */
@Override
public void execute(HttpServletRequest request, HttpServletResponse response, RequestContext context)
        throws Exception {

    LOG.finer("Handling rest query string=" + request.getQueryString());

    MessageBroker msgBroker = new FacesContextBroker(request, response).extractMessageBroker();

    // parse the query
    RestQuery query = null;
    PrintWriter printWriter = null;

    try {

        query = parseRequest(request, context);
        if (query == null)
            query = new RestQuery();
        this.executeQuery(request, response, context, msgBroker, query);

    } catch (Exception e) {
        LOG.log(Level.SEVERE, "Error executing query.", e);
        String msg = Val.chkStr(e.getMessage());
        if (msg.length() == 0)
            msg = e.toString();
        response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg);
    } finally {
        printWriter = response.getWriter();
        if (printWriter != null) {
            try {
                try {
                    printWriter.flush();
                } catch (Throwable e) {
                    LOG.log(Level.FINE, "Error while flushing printwriter", e);
                }
            } catch (Throwable t) {
                LOG.log(Level.FINE, "Error while closing printwriter", t);
            }
        }

    }

}

From source file:com.esri.gpt.control.webharvest.client.waf.FtpClientRequest.java

public FTPFile[] listFiles(String pathName) throws IOException {
    try {//www . ja  va2 s . c o m
        LOG.log(Level.FINE, "Listing files on: {0} from the path: {1}", new Object[] { host, pathName });
        return listFiles(1, pathName);
    } catch (IOException ex) {
        aborted = true;
        throw ex;
    }
}

From source file:com.prowidesoftware.swift.io.parser.XMLParser.java

/**
 * Helper method for XML representation parsing.<br>
 *
 * @param doc/*from  ww  w.  j  av a 2 s.c o m*/
 *            Document object containing a message in XML format
 * @return SwiftMessage object populated with the given XML message data
 */
private SwiftMessage createMessage(final Document doc) {
    final NodeList messageNL = doc.getElementsByTagName("message");

    if (messageNL.getLength() == 1) {
        final Node message = messageNL.item(0);
        final SwiftMessage m = new SwiftMessage(false);

        final NodeList blocksNL = message.getChildNodes();
        if (log.isLoggable(Level.FINE)) {
            log.fine("blocks in message: " + blocksNL.getLength());
        }

        for (int i = 0; i < blocksNL.getLength(); i++) {
            final Node blockNode = blocksNL.item(i);
            if (log.isLoggable(Level.FINE)) {
                log.fine("evaluating node " + blockNode.getNodeName());
            }
            if (blockNode.getNodeType() == Node.ELEMENT_NODE) {
                final String blockName = blockNode.getNodeName();

                if (blockName.equalsIgnoreCase("block1")) {
                    m.setBlock1(getBlock1FromNode(blockNode));
                } else if (blockName.equalsIgnoreCase("block2")) {
                    m.setBlock2(getBlock2FromNode(blockNode));
                } else if (blockName.equalsIgnoreCase("unparsedtexts")) {
                    // unparsed texts at <message> level
                    m.setUnparsedTexts(getUnparsedTextsFromNode(blockNode));
                } else {
                    // blocks 3, 4, 5 or user blocks
                    m.addBlock(getTagListBlockFromNode(blockNode));
                }
            }
        } // end block list iteration
        return m;
    } else {
        throw new IllegalArgumentException("<message> tag not found");
    }
}

From source file:io.fabric8.cxf.endpoint.IgnorePropertiesBackedByTransientFields.java

/**
 * Returns false if the getter method has a field of the same name which is transient
 * @return/*from w w w .j  a va2  s.  co m*/
 */
protected boolean isGetterMethodWithFieldVisible(Object method, String fieldName, Class<?> declaringClass) {
    Field field = findField(fieldName, declaringClass);
    if (field != null) {
        int fieldModifiers = field.getModifiers();
        if (Modifier.isTransient(fieldModifiers)) {
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Ignoring getter " + method + " due to transient field called " + fieldName);
            }
            return false;
        }
    }
    return true;
}

From source file:org.tiefaces.components.websheet.chart.ChartHelper.java

/**
 * return cell Value for paredCell. ParsedCell contain sheetName/row/col
 * which normally is parsed from String like: Sheet1!B2 .
 * //from  ww  w  . j a  va2 s.co m
 * @param pCell
 *            parsed cell.
 * @return cell string value without format.
 */
public final String getParsedCellValue(final ParsedCell pCell) {

    String result = "";
    try {
        Cell poiCell = parent.getWb().getSheet(pCell.getSheetName()).getRow(pCell.getRow())
                .getCell(pCell.getCol());
        result = CellUtility.getCellValueWithoutFormat(poiCell);

    } catch (Exception ex) {
        LOG.log(Level.FINE, "error getParsedCellValue :" + ex.getLocalizedMessage(), ex);
    }
    return result;

}

From source file:com.core.ServerConnector.java

public static QTResponse getQtResponse(String txRef) {
    QTResponse qtResponse = new QTResponse();
    String resCode = null, amount = null, resDesc = null, pmtRef = null, tdate = null, message = null;
    JSONObject jo = null;/*  www  .  ja v  a  2s  .  c om*/
    boolean gotres = false;

    try {
        String secretKey = Log.SECRETKEY;
        String endpoint = "https://paywith.quickteller.com/api/v2/transaction.json";
        HashMap params = new HashMap<String, String>();
        HashMap headers = new HashMap<String, String>();
        params.put("transRef", URLEncoder.encode(txRef));
        headers.put("clientid", Log.clientId);
        headers.put("Hash", Util.hash(txRef + secretKey));

        String response = GET(endpoint, params, headers);
        System.out.println("Raw Respone:" + response);

        jo = new JSONObject(response);
        resCode = jo.getString("ResponseCode");
        amount = jo.getString("Amount");
        resDesc = jo.getString("ResponseDescription");
        pmtRef = jo.getString("PaymentReference");
        tdate = jo.getString("TransactionDate");
        gotres = true;

    } catch (JSONException ex) {
        Logger.getLogger(TestService.class.getName()).log(Level.FINE, null, ex);
        try {
            message = jo.getString("Message");
        } catch (JSONException ex1) {
            Logger.getLogger(TestService.class.getName()).log(Level.SEVERE, null, ex1);
        }
    } catch (Exception ex) {
        Logger.getLogger(TestService.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (gotres) {
        System.out.println("*********Successful Response**********");
        System.out.println("ResponseCode:" + resCode);
        System.out.println("Amount:" + amount);
        System.out.println("ResDesc:" + resDesc);
        System.out.println("pmtRef:" + pmtRef);
        System.out.println("tdate:" + tdate);

        qtResponse.setAmount(amount);
        qtResponse.setResponseCode(resCode);
        qtResponse.setDescription(resDesc);
        qtResponse.setHonour(true);
        if (resCode.equals("00")) {
            qtResponse.setSuccess(true);
        }
    } else {
        System.out.println("*********Failed**********");
        System.out.println("Message:" + message);
        qtResponse.setSuccess(false);
        qtResponse.setDescription(message);
    }

    return qtResponse;
}

From source file:com.stratuscom.harvester.deployer.CommandLineAppRunner.java

/**
 * If clientAppName has been set, then we're running a predetermined app as
 * a result of the entry in Config.xml. In that case, we're not going to
 * bother with any '-with' options./* ww w. ja v a2s  . com*/
 *
 * @throws IOException
 * @throws ParseException
 * @throws org.apache.commons.cli.ParseException
 */
private void tryInitialize() throws IOException, ParseException, org.apache.commons.cli.ParseException {
    log.log(Level.FINE, MessageNames.STARTER_SERVICE_DEPLOYER_STARTING, myName);

    /*
     Establish the deployment directory.
     */
    deploymentDirectoryFile = fileUtility.getProfileDirectory().resolveFile(deployDirectory);
    if (deploymentDirectoryFile == null || deploymentDirectoryFile.getType() != FileType.FOLDER) {
        log.log(Level.WARNING, MessageNames.NO_DEPLOYMENT_DIRECTORY,
                new Object[] { deployDirectory, fileUtility.getProfileDirectory() });
    }
    /*
     * Find the name of the client we need to deploy.  
     */
    /* First argument was the profile name.  Second argument is the name of 
     * the client app to run.  All the rest are parameters to the client
     * app.
     */
    if (clientAppName == null && commandLineArguments.length < 2) {
        System.out.println(messages.getString(MessageNames.CLIENT_APP_USAGE));
        System.exit(1);
    }
    String[] clientAppArgs = new String[0];
    String additionalApps = Strings.EMPTY;
    if (clientAppName == null) {
        String[] argsWithoutProfile = new String[commandLineArguments.length - 1];
        System.arraycopy(commandLineArguments, 1, argsWithoutProfile, 0, argsWithoutProfile.length);
        CommandLine cl = CommandLineParsers.parseCommandLineAppRunnerLine(argsWithoutProfile);
        // At this point, any remaining args after -with are in getArgs()
        // The first of those is the app name.
        clientAppName = cl.getArgs()[0];
        clientAppArgs = new String[cl.getArgs().length - 1];
        System.arraycopy(cl.getArgs(), 1, clientAppArgs, 0, clientAppArgs.length);
        if (cl.hasOption(CommandLineParsers.WITH)) {
            additionalApps = cl.getOptionValue(CommandLineParsers.WITH);
        }
    } else {
        clientAppArgs = new String[commandLineArguments.length - 1];
        System.arraycopy(commandLineArguments, 1, clientAppArgs, 0, clientAppArgs.length);
    }
    if (!Strings.EMPTY.equals(additionalApps)) {
        startAdditionalApps(additionalApps);
    }

    /*
     See if the clientAppName happens to be a 'jar' name and refers to a 
     jar file.  If so, that's the service archive.
     */
    FileObject serviceArchive = null;
    if (isAppArchive(clientAppName)) {
        serviceArchive = fileUtility.resolveFile(clientAppName);
    } else {
        serviceArchive = findServiceArchiveForName(clientAppName);
    }

    if (serviceArchive == null) {
        System.err.println(
                MessageFormat.format(messages.getString(MessageNames.NO_SUCH_CLIENT_APP), clientAppName));
        System.exit(1);
    }
    // Deploy the service
    deployServiceArchive(serviceArchive, clientAppArgs);
    // Run the main method with the remaining command line parameters.
}

From source file:eu.europa.ejusticeportal.dss.applet.model.action.SigningAction.java

/**
 * Execute the SigningAction with elevated privilege.
 *
 *///from   www  .  j  a va2 s  .c o  m
protected void doExec() throws CodeException {
    LOG.log(Level.FINE, "Signing with #{0}", certHash);
    final SignatureEvent sigLog = SignatureInformationHome.getInstance().getSignatureEvent();
    CodeException exceptionToThrow = null;
    try {
        CertificateDisplayDetails cd = TokenManager.getInstance().getCertificateDisplayName(certHash);
        if (cd != null) {
            sigLog.setExtensions(cd.getExtensions());
            sigLog.setRecommended(Boolean.toString(cd.isRecommended()));
        }
        final AbstractDSSAction ada = getDSSActionInstance();
        final DSSPrivateKeyEntry keyEntry = getKeyEntry(ada);
        collectInformation(ada);
        sigLog.setApi(ada.getSignatureTokenType().name());
        sigLog.setKeyUsage(KeyUsage.decodeToString(keyEntry.getCertificate().getKeyUsage()));
        sigLog.setSigningMethod(SigningMethodHome.getInstance().getSigningMethod().name());

        LOG.log(Level.FINE, "Position of the certs list for token is : {0}", ada.getPosCertificates());
        LOG.log(Level.INFO, "Sign the document, connection is instance of {0}", ada.getClass().getSimpleName());
        LOG.log(Level.FINE, "Signing internal with #{0}", ada.getIndexCertificate());
        final DSSDocument toBeSigned = new InMemoryDocument(PDFHome.getInstance().getSealedPdf());
        DSSDocument signedDocument;
        AppletSigningMethod m = SigningMethodHome.getInstance().getSigningMethod();
        if ((AppletSigningMethod.sc.equals(m) || AppletSigningMethod.installed_cert.equals(m))
                && (ada.getChosenDigestAlgo() == null)) {
            signedDocument = UnknownTokenSignature.getInstance().signWithSeveralDigestAlgo(ada, keyEntry,
                    toBeSigned);
        } else {
            signedDocument = ada.sign(toBeSigned, keyEntry);
        }
        sigLog.setSigned(true);
        Event.getInstance().fire(new StatusRefreshed(MessagesEnum.dss_applet_message_signed, MessageLevel.INFO,
                TokenManager.getInstance().getCertificateDisplayName(certHash).getName()));

        //Turn off the card watcher service because the user might pull out his card at this point
        Event.getInstance().fire(new ActivateCardTerminalWatcher(false));
        //Output
        PDFHome.getInstance().setSignedPdf(IOUtils.toByteArray(signedDocument.openStream()));
        AsynchronousCallerHome.getInstance().getCaller().fire(new ServerCall(AsynchronousServerCall.callServer,
                ServerCallId.uploadSignedPdf, SignedPDFFactory.get(PDFHome.getInstance().getSignedPdf())));
    } catch (CodeException e) {
        exceptionToThrow = handleSignatureErrorEvent(sigLog, e);
    } catch (Exception e) {
        LOG.log(Level.SEVERE, "error in signing\n {0}", ExceptionUtils.getStackTrace(e));
        exceptionToThrow = handleSignatureErrorEvent(sigLog, e);
    }

    if (exceptionToThrow != null) {
        ExceptionUtils.exception(exceptionToThrow, LOG);
    }
}