Example usage for java.util.logging Level WARNING

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

Introduction

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

Prototype

Level WARNING

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

Click Source Link

Document

WARNING is a message level indicating a potential problem.

Usage

From source file:com.google.youtube.captions.AuthSubLogout.java

@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String username = Util.getCookie(req, Util.CURRENT_USERNAME);

    if (!Util.isEmptyOrNull(username)) {
        try {//from   w w w.  j  a v  a 2s  .co  m
            String authSubCookie = Util.getCookie(req, Util.AUTH_SUB_COOKIE);
            JSONObject cookieAsJSON = new JSONObject(authSubCookie);

            if (cookieAsJSON.has(username)) {
                String authSubToken = cookieAsJSON.getString(username);

                AuthSubUtil.revokeToken(authSubToken, null);

                cookieAsJSON.remove(username);

                Cookie cookie = new Cookie(Util.AUTH_SUB_COOKIE, cookieAsJSON.toString());
                cookie.setMaxAge(Util.COOKIE_LIFETIME);
                resp.addCookie(cookie);

                cookie = new Cookie(Util.CURRENT_AUTHSUB_TOKEN, "");
                cookie.setMaxAge(Util.COOKIE_LIFETIME);
                resp.addCookie(cookie);

                cookie = new Cookie(Util.CURRENT_USERNAME, "");
                cookie.setMaxAge(Util.COOKIE_LIFETIME);
                resp.addCookie(cookie);
            }
        } catch (AuthenticationException e) {
            LOG.log(Level.WARNING, "", e);
        } catch (GeneralSecurityException e) {
            LOG.log(Level.WARNING, "", e);
        } catch (JSONException e) {
            LOG.log(Level.WARNING, "", e);
        }
    }

    resp.sendRedirect("/");
}

From source file:com.exquance.jenkins.plugins.HarbormasterHookReceiver.java

/**
 * Harbormaster sends payload as urlencoded query string <pre>payload=JSON</pre>
 * @throws IOException/*from w w  w  . ja v  a2 s . c o  m*/
 */
public void doIndex(StaplerRequest req) throws IOException {
    if (req.getRequestURI().contains("/" + HARBORMASTER_HOOK_URL + "/")) {
        String body = URLDecoder.decode(req.getQueryString());
        if (body.startsWith("payload="))
            body = body.substring(8);

        LOGGER.log(Level.FINE, "Received commit hook notification : {0}", body);
        JSONObject payload = JSONObject.fromObject(body);

        payloadProcessor.processPayload(payload, req);
    } else {
        LOGGER.log(Level.WARNING,
                "The Jenkins job cannot be triggered. You might not have configured correctly the WebHook on Harbormaster with the last slash `http://<JENKINS-URL>/harbormaster-hook/`");
    }
}

From source file:net.osten.watermap.batch.FetchSanGJob.java

/**
 * Fetch the San Gorgonio files and save in output directory.
 *
 * @see javax.batch.api.Batchlet#process()
 * @return FAILED if the files cannot be downloaded or can't be written to disk; COMPLETED otherwise
 *//*  w w w . j  ava 2s .c  om*/
@Override
public String process() throws Exception {
    System.out.println("config=" + config);
    System.out.println("context=" + context);
    outputDir = new File(config.getString(WatermapConfig.OUTPUT_DIR));

    // curl -o $od/datafile.txt http://www.howlingduck.com/triterra/gorgonio/datafile.txt
    if (!outputDir.isDirectory()) {
        log.log(Level.WARNING, "Output directory [{0}] is not a directory.", outputDir);
        return BatchStatus.FAILED.toString();
    } else if (!outputDir.canWrite()) {
        log.log(Level.WARNING, "Output directory [{0}] is not writable.", outputDir);
        return BatchStatus.FAILED.toString();
    }

    for (String url : URLS) {
        log.log(Level.FINE, "Fetching PCT to {0}", new Object[] { url });
        String response = Request.Get(context.getProperties().getProperty(url)).execute().returnContent()
                .asString();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + "datafile.txt");
        FileUtils.writeStringToFile(outputFile, response, Charsets.UTF_8);
    }

    return BatchStatus.COMPLETED.toString();
}

From source file:tanks10.SendAndReceive.java

/**
 * Umieszczenie bufora w kolejce do wysania
 *//*from www . j a v a2  s.c  om*/
public void addToSendBuffers(ByteBuffer in) {
    if (closed) {
        return;
    }
    if (kill) {
        closeSession();
    } else {

        // blokada tylko dotyczy operowania na wskanikach bufora
        synchronized (sendBuffers) {
            final TextMessage message;
            try {
                byte[] arrayContent = new byte[in.limit()];
                in.get(arrayContent);
                String content = new String(arrayContent, "UTF-8");
                message = new TextMessage(content);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }

            try {
                session.sendMessage(message);
            } catch (Exception e) {
                LOG.log(Level.WARNING, "send message failed to " + session.getRemoteAddress().toString(), e);
                closeSession();
            }
        }
    }

}

From source file:net.sf.maltcms.chromaui.chromatogram2Dviewer.datastructures.annotations.Peak2DXMLAnnotationProvider.java

/**
 *
 * @param f//from  ww  w .j  ava2  s  .  com
 * @return
 */
@Override
public List<XYAnnotation> load(File f) {
    MaltcmsAnnotationFactory maf = new MaltcmsAnnotationFactory();
    MaltcmsAnnotation ma = maf.load(f);
    List<AnnotationsType> l = ma.getAnnotations();
    List<XYAnnotation> list = new ArrayList<>(l.size());
    for (AnnotationsType at : l) {
        String type = at.getType();
        if (type.equals(Peak2D.class.getName())) {
            for (AnnotationType atype : at.getAnnotation()) {
                list.add(create(maf.getPeakAnnotation(atype)));
            }

        } else {
            Logger.getLogger(this.getClass().getName()).log(Level.WARNING,
                    "Do not know how to handle annotations of type {0}", type);
        }
    }
    return list;
}

From source file:com.symbian.driver.core.processors.EmulatorPostProcessor.java

public void run() {
    LOGGER.info(/*from   www  .  j  av a 2  s . co  m*/
            "Stopping the emulator. Please wait while the emulator restores the emulator to its orginal state.");
    try {
        Runtime.getRuntime().removeShutdownHook(this);
    } catch (Exception lException) {
        LOGGER.fine("Didn't succefully deregister the shutdownhook.");
    }

    // Move RDebug to the results folder
    if (iListener != null) {
        LOGGER.fine("Killing RDebug.");
        iListener.setMlife(false);
    }

    try {
        if (iEpoc != null && !iEpoc.doCleanUp(false)) {
            LOGGER.warning("Could not stop the epoc emulator.");
        }
    } catch (TimeLimitExceededException lTimeLimitExceededException) {
        LOGGER.log(Level.WARNING, "Could not stop the epoc emulator.", lTimeLimitExceededException);
    }

    try {
        DeviceCommsProxy.getInstance().stop(true);
    } catch (Exception lException) {
        LOGGER.log(Level.SEVERE, " Error ", lException);
    }

    DeviceUtils.killAllEpocs();

    String lCommDBInput;
    try {
        lCommDBInput = TDConfig.getInstance().getPreference(TDConfig.COMMDB).toLowerCase();
    } catch (ParseException lParseException) {
        LOGGER.log(Level.WARNING, "Could not get configuration for CommDat.", lParseException);
        lCommDBInput = "off";
    }

    if (lCommDBInput.equalsIgnoreCase("on") || lCommDBInput.equalsIgnoreCase("true")
            || lCommDBInput.startsWith("overwrite")) {

        // Restore Files
        restoreFile(iEthertapPddFile);

        // Restore Old WinTap CED
        LOGGER.info("Restoring old CommDB via Commandline.");
        try {
            Thread.sleep(2000);

            new ExecuteOnHost(iWinscwDir, "ced.exe -i c:\\cedout.cfg").doTask(true, 0, false);
        } catch (TimeLimitExceededException lTimeLimitExceededException) {
            LOGGER.log(Level.WARNING, "Could not restore the CommDB settings due to timeout.",
                    lTimeLimitExceededException);
        } catch (IOException lIOException) {
            LOGGER.log(Level.WARNING, "Could not restore the CommDB settings due to I/O exception.",
                    lIOException);
        } catch (InterruptedException lInterruptedException) {
            LOGGER.log(Level.WARNING, "Could not restore the CommDB settings due to Thread Interrupt.",
                    lInterruptedException);
        }
    }

    LOGGER.info("Emulator stopped and stopping TestDriver.");
}

From source file:com.p000ison.dev.copybooks.util.Helper.java

public static long getIdFromSign(char[] chars) {
    StringBuilder idString = new StringBuilder();

    for (char character : chars) {
        if (character == '[' || character == ':') {
            break;
        }/*from  w w w  . j ava  2s  . c om*/

        idString.append(character);

    }
    long id = -1;

    try {
        id = Long.parseLong(idString.toString());
    } catch (NumberFormatException e) {
        CopyBooks.debug(Level.WARNING, ChatColor.DARK_RED + "Failed at parsing sign!");
    }
    return id;
}

From source file:com.nms.mediastore.servlet.VideoServlet.java

/**
 * Handles the HTTP <code>GET</code> method.
 *
 * @param request servlet request//  w ww.  java 2 s  .  c  o  m
 * @param response servlet response
 * @throws ServletException if a servlet-specific error occurs
 * @throws IOException if an I/O error occurs
 */
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    String uuid = request.getParameter("id");
    if (Validator.isNotNull(uuid)) {
        VideoLink link;
        FileEntry videoFile = null;
        try {
            if (uuid.equals(DEFAULT_ID)) {
                Video video = videoService.getDefault();
                videoFile = video.getVideoFile();
            } else {
                link = linkService.findByUUID(uuid);
                videoFile = link.getVideo().getVideoFile();
            }
        } catch (Exception e) {
            LOG.log(Level.WARNING, "Video link not found or expirated uuid = {0} and ERROR: {1}",
                    new Object[] { uuid, e.toString() });
        }

        if (videoFile != null && Validator.isNotNull(videoFile.getUri())) {
            File in = new File(AppConfig.getFileStorePath() + videoFile.getUri());
            if (in.exists()) {
                response.setContentType(videoFile.getContentType());
                response.setContentLengthLong(videoFile.getSize());
                response.setHeader("Content-Disposition",
                        "attachment;filename=\"" + videoFile.getName() + "\"");
                try (OutputStream out = response.getOutputStream()) {
                    FileUtils.copyFile(in, out);
                }
            } else {
                LOG.log(Level.WARNING, "Video file not found = {0}",
                        new Object[] { AppConfig.getFileStorePath() + videoFile.getUri() });
            }
        } else {
            LOG.log(Level.WARNING, "Video file not found = {0}", new Object[] { uuid });
        }
    }
}

From source file:hm.binkley.util.ServiceBinderTest.java

@Before
public void setUp() {
    Logger.getLogger("org.springframework").setLevel(Level.WARNING);
}