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:fitnesse.FitNesseExpediter.java

@Override
public void run() {
    try {/*from  www .  j ava 2  s . co  m*/
        // Storing them in instance fields, since we need info for logging when the connection is closed.
        request = makeRequest();
        response = makeResponse(request);
        sendResponse(response);
    } catch (SocketException se) {
        // can be thrown by makeResponse or sendResponse.
    } catch (Throwable e) { // NOSONAR
        // This catch is intentional, since it's the last point where we can catch exceptions that occur in this thread.
        LOG.log(Level.WARNING, "Unexpected exception", e);
    }
}

From source file:edu.usu.sdl.openstorefront.service.manager.ReportManager.java

public static void cleanup() {
    ServiceProxy serviceProxy = ServiceProxy.getProxy();
    List<Report> allReports = getInprogessReports();
    if (!allReports.isEmpty()) {
        log.log(Level.WARNING, MessageFormat.format(
                "Reports are currently in progress.  Attempting to cancel and put back on queue.   Reports in progress:  {0}",
                allReports.size()));// w w  w  .j a  v a 2s.c  om

        List<TaskFuture> taskFutures = AsyncTaskManager.getTasksByName(TaskRequest.TASKNAME_REPORT);
        for (TaskFuture taskFuture : taskFutures) {
            String reportId = (String) taskFuture.getTaskData().get(TaskRequest.DATAKEY_REPORT_ID);
            if (StringUtils.isNotBlank(reportId)) {
                if (taskFuture.cancel(true)) {
                    Report report = serviceProxy.getPersistenceService().findById(Report.class, reportId);
                    report.setRunStatus(RunStatus.PENDING);
                    report.setUpdateUser(OpenStorefrontConstant.SYSTEM_USER);
                    report.populateBaseUpdateFields();
                    serviceProxy.getPersistenceService().persist(report);
                } else {
                    log.log(Level.WARNING, MessageFormat.format(
                            "Unable to cancel report id: {0} it likely be in a fail state upon restart.  It can be safely deleted.",
                            reportId));
                }
            } else {
                log.log(Level.WARNING,
                        "Unable to find report id for a report task.  Unable to cleanly cancel.  Report can be clean up upon restart.");
            }
        }
    }
}

From source file:com.frostwire.gui.UniversalScanner.java

public void scan(String filePath) {
    try {/*ww  w  .  j a v a  2  s  . c  o m*/
        MediaType mt = MediaType.getMediaTypeForExtension(FilenameUtils.getExtension(filePath));

        if (mt == null) {
            scanDocument(filePath, true);
        } else if (mt.equals(MediaType.getAudioMediaType())) {
            scanAudio(filePath, true);
        } else if (mt.equals(MediaType.getImageMediaType())) {
            scanPictures(filePath, true);
        } else if (mt.equals(MediaType.getVideoMediaType())) {
            scanVideo(filePath, true); // until we integrate mplayer for video and research metadata extraction
        } else {
            scanDocument(filePath, true);
        }

    } catch (Throwable e) {
        scanDocument(filePath, true);
        LOG.log(Level.WARNING, "Error scanning file, scanned as document: " + filePath, e);
    }
}

From source file:com.jwebmp.core.FileTemplates.java

/**
 * Replaces all instances of the following
 *
 * @param templateName/*  w w w .  ja v a  2  s .co m*/
 *       The name of the template being processed
 * @param template
 *       The physical string to process
 *
 * @return
 */
public static StringBuilder processTemplate(String templateName, String template) {
    String templateOutput = template;
    for (String templateVariable : getTemplateVariables().keySet()) {
        String templateScript = null;
        try {
            templateScript = Matcher.quoteReplacement(getTemplateVariables().get(templateVariable).toString());
            templateOutput = templateOutput.replaceAll(
                    StaticStrings.STRING_EMPTY + templateVariable + StaticStrings.STRING_EMPTY, templateScript);
        } catch (NullPointerException iae) {
            LOG.log(Level.WARNING,
                    "[Error]-[Unable to find specified template];[Script]-[" + templateVariable + "]", iae);
        } catch (IllegalArgumentException iae) {
            LOG.log(Level.WARNING, format(
                    "[Error]-[Invalid Variable Name for Regular Expression Search];[Variable]-[{0}];[Script]-[{1}]",
                    templateVariable, templateScript), iae);
        }
    }
    TemplateScripts.put(templateName, new StringBuilder(templateOutput.trim()));
    return TemplateScripts.get(templateName);
}

From source file:photosharing.api.oauth.CallbackDefinition.java

/**
 * processes the callback and converts the code into permanent OAuth 2.0
 * credentials//from  w  ww.j  a va 2s.  c o m
 * 
 * @param request
 *            the http request object
 * @param request
 *            the http response object
 */
public void run(HttpServletRequest request, HttpServletResponse response) {

    @SuppressWarnings("unused")
    Configuration config = Configuration.getInstance(request);

    HttpSession session = request.getSession(false);
    if (session != null) {
        String code = request.getParameter("code");

        // Checks to see if there is an oauth_error
        String error = request.getParameter("oauth_error");
        if (error != null) {
            // When there is an oauth_error, set SC_BAD_REQUEST
            logger.log(Level.WARNING, "Error on OAuth " + error);
            response.setStatus(HttpStatus.SC_BAD_REQUEST);

        } else {
            // Code should not be null
            if (code != null) {

                // Accesses the OAuth 20 Data
                OAuth20Handler handler = OAuth20Handler.getInstance();
                OAuth20Data oauthData = null;
                try {
                    logger.info("call to access token");
                    oauthData = handler.getAccessToken(code);
                } catch (IOException e1) {
                    logger.log(Level.WARNING, "IOException on getAccessToken  " + e1.toString());
                }

                // Checks the OAuth 2.0 data
                if (oauthData != null) {
                    // When there is credential data persist in the session
                    // and return SC_OK 
                    session.setAttribute(OAuth20Handler.CREDENTIALS, oauthData);

                    // Closes the Popup window
                    try {
                        response.setStatus(HttpStatus.SC_OK);
                        response.setContentType("text/html");
                        PrintWriter out = response.getWriter();
                        out.println("<html><body onload=\"javascript:window.close()\"></body></html>");
                    } catch (IOException e) {
                        logger.log(Level.WARNING, "IOException on Redirect " + e.toString());
                    }

                } else {
                    // OAuth Data
                    logger.log(Level.WARNING, "Error handling the oauth data");
                    response.setStatus(HttpStatus.SC_BAD_REQUEST);
                }
            } else {
                // When there is no code, set SC_BAD_REQUEST
                logger.log(Level.WARNING, "No Code passed into the URL " + request.getPathInfo());
                response.setStatus(HttpStatus.SC_BAD_REQUEST);
            }
        }

    } else {
        // When there is no session, set SC_BAD_REQUEST
        logger.log(Level.WARNING, "Invalid Session");
        response.setStatus(HttpStatus.SC_BAD_REQUEST);
    }

}

From source file:com.formkiq.core.service.notification.MailSenderService.java

/**
 * After Properties Set./*from  w w  w. j  a v a 2 s. com*/
 * @param is {@link InputStream}
 * @throws IOException IOException
 */
public void afterPropertiesSet(final InputStream is) throws IOException {

    boolean loaded = false;

    if (is != null) {
        Properties prop = new Properties();
        prop.load(is);

        this.mailSender = createJavaMailSender(prop);
        loaded = true;
    }

    if (!loaded) {
        LOG.log(Level.WARNING, "Cannot find mail.properties defaulting to " + "java.util.logging.Logger");
    }
}

From source file:com.pamarin.servlet.uploadfile.UploadFileServet.java

@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    LOG.log(Level.INFO, "uploaded");

    try {/*from www  .  java2s .com*/
        if (!ServletFileUpload.isMultipartContent(request)) {
            return;
        }

        LOG.log(Level.INFO, "is multipart");
        DiskFileItemFactory factory = new DiskFileItemFactory();
        factory.setSizeThreshold(maxMemSize);
        factory.setRepository(new File("c:\\temp"));
        //
        ServletFileUpload upload = new ServletFileUpload(factory);
        upload.setSizeMax(maxFileSize);

        List<FileItem> fileItems = upload.parseRequest(request);
        Iterator<FileItem> iterator = fileItems.iterator();

        LOG.log(Level.INFO, "file size --> {0}", fileItems.size());
        while (iterator.hasNext()) {
            FileItem item = iterator.next();
            //if (!item.isFormField()) {
            LOG.log(Level.INFO, "content type --> {0}", item.getContentType());
            LOG.log(Level.INFO, "name --> {0}", item.getName());
            LOG.log(Level.INFO, "field name --> {0}", item.getFieldName());
            LOG.log(Level.INFO, "string --> {0}", item.getString());

            item.write(new File("c:\\temp", UUID.randomUUID().toString() + ".png"));
            //}
        }
    } catch (FileUploadException ex) {
        LOG.log(Level.WARNING, ex.getMessage());
    } catch (Exception ex) {
        LOG.log(Level.WARNING, ex.getMessage());
    }
}

From source file:gzipper.algorithms.Gzip.java

@Override
public void stop() {
    _runFlag = false;/* w w w . j ava 2 s. c  o m*/
    try {
        if (_tos != null) {
            _tos.flush();
            _tos.close();
        }
    } catch (IOException ex) {
        Logger.getLogger(GUI.class.getName()).log(Level.WARNING, "Output stream could not be closed", ex);
        File file; //to delete previously created archive on error
        file = new File(_path + _archiveName + ".tar.gz");
        if (file.exists()) {
            file.delete();
        }
    }
}

From source file:io.selendroid.standalone.server.BaseSelendroidStandaloneHandler.java

private void logHandlerCalled(JSONObject payload) {
    String message = "Selendroid standalone handler: " + this.getClass().getSimpleName();
    if (payload != null) {
        try {//ww  w  .  j  av a  2 s  .  c o  m
            message += ", payload:\n" + payload.toString(2);
        } catch (JSONException e) {
            log.log(Level.WARNING, "Cannot debug-print request payload", e);
        }
    }
    log.log(Level.FINE, message);
}

From source file:com.formkiq.core.service.crypto.SecureTokenServiceImpl.java

@Override
public LicenseToken decodeLicenseToken(final PublicKey publicKey, final String encryptedToken)
        throws InvalidLicenseException {

    try {//from   w w  w  .  j  a va 2s.  c  o  m
        String decrypted = decryptToken(publicKey, encryptedToken);
        LicenseToken license = this.jsonService.readValue(decrypted, LicenseToken.class);

        return license;

    } catch (Exception e) {
        LOG.log(Level.WARNING, "Invalid License", e);
        throw new InvalidLicenseException("Invalid License");
    }
}