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.skcraft.launcher.bootstrap.Downloader.java

@Override
public void run() {
    this.thread = Thread.currentThread();

    try {//  w ww . j av  a 2  s.co m
        execute();
    } catch (InterruptedException e) {
        log.log(Level.WARNING, "Interrupted");
        System.exit(0);
    } catch (Throwable t) {
        log.log(Level.WARNING, "Failed to download launcher", t);
        SwingHelper.showErrorDialog(null, _("errors.failedDownloadError"), _("errorTitle"), t);
        System.exit(0);
    }
}

From source file:com.boundlessgeo.geoserver.api.exceptions.AppExceptionHandler.java

@ExceptionHandler(Exception.class)
public @ResponseBody JSONObj error(Exception e, HttpServletResponse response) {

    HttpStatus status = status(e);//from w  ww . j ava2s . c  o m
    response.setStatus(status.value());

    // log at warning if 500, else debug
    LOG.log(status == HttpStatus.INTERNAL_SERVER_ERROR ? Level.WARNING : Level.FINE, e.getMessage(), e);
    return IO.error(new JSONObj(), e);
}

From source file:com.ibm.watson.developer_cloud.natural_language_classifier.v1.util.TrainingDataUtils.java

/**
 * Converts a training like argument list to a CSV representation.
 * /*from   w w  w .j a  v a2 s. c  o  m*/
 * @param data
 *            the training data data
 * @return the string with the CSV representation for the training data
 */
public static String toCSV(final TrainingData... data) {
    Validate.notEmpty(data, "data cannot be null or empty");

    StringWriter stringWriter = new StringWriter();
    try {
        CSVPrinter printer = new CSVPrinter(stringWriter, CSVFormat.EXCEL);
        for (TrainingData trainingData : data) {
            if (trainingData.getText() == null || trainingData.getClasses() == null
                    || trainingData.getClasses().isEmpty())
                log.log(Level.WARNING, trainingData + " couldn't be converted to a csv record");
            else {
                List<String> record = new ArrayList<String>();
                record.add(trainingData.getText());
                record.addAll(trainingData.getClasses());
                printer.printRecord(record.toArray());
            }
        }
        printer.close();
    } catch (IOException e) {
        log.log(Level.SEVERE, "Error creating the csv", e);
    }

    return stringWriter.toString();
}

From source file:at.bitfire.davdroid.log.LogcatHandler.java

@Override
public void publish(LogRecord r) {
    String text = getFormatter().format(r);
    int level = r.getLevel().intValue();

    int end = text.length();
    for (int pos = 0; pos < end; pos += MAX_LINE_LENGTH) {
        String line = text.substring(pos, NumberUtils.min(pos + MAX_LINE_LENGTH, end));

        if (level >= Level.SEVERE.intValue())
            Log.e(r.getLoggerName(), line);
        else if (level >= Level.WARNING.intValue())
            Log.w(r.getLoggerName(), line);
        else if (level >= Level.CONFIG.intValue())
            Log.i(r.getLoggerName(), line);
        else if (level >= Level.FINER.intValue())
            Log.d(r.getLoggerName(), line);
        else/*from  w  w  w  . j  a  v  a 2  s .c  om*/
            Log.v(r.getLoggerName(), line);
    }
}

From source file:com.bc.appbase.ui.dialog.SendReportAction.java

private static Email getEmail(String host, int port, String emailAddress, String password, String subject) {

    final SimpleEmail email = new SimpleEmail();

    try {//from w w w.  ja  v  a2 s.  c  om
        email.addTo(emailAddress);
    } catch (EmailException e) {
        logger.log(Level.WARNING,
                "Error add `to address`: " + emailAddress + " to email with subject: " + subject, e);
        return null;
    }

    if (password != null) {
        email.setAuthentication(emailAddress, password);
    }
    email.setDebug(logger.isLoggable(Level.FINE));

    try {
        email.setFrom(emailAddress);
    } catch (EmailException e) {
        logger.log(Level.WARNING,
                "Error setting `from address` = " + emailAddress + " to email with subject: " + subject, e);
        return null;
    }

    email.setHostName(host);
    email.setSmtpPort(port);

    if (password != null) {
        email.setSSLOnConnect(true);
    }

    email.setSubject(subject);

    return email;
}

From source file:it_minds.dk.eindberetningmobil_android.server.SafeJsonHelper.java

@Override
public JSONObject put(String name, int value) {
    try {/*from w ww.jav  a  2  s.c om*/
        return super.put(name, value);
    } catch (JSONException e) {
        Logger.getLogger("SafeJsonObject").log(Level.WARNING, "", e);
        return null;
    }
}

From source file:net.erdfelt.android.sdkfido.git.GitMirrors.java

/**
 * Load specific gitmirror xml file.//from w  ww  .  j  a  v a  2s  .co m
 * 
 * @param mirrorxml
 *            the mirrorxml to load
 * @return a GitMirrors object, with information from the mirrorxml, or empty (if mirrorxml not found)
 */
public static GitMirrors load(File mirrorxml) {
    if (!mirrorxml.exists()) {
        return new GitMirrors();
    }
    Digester digester = new Digester();
    digester.addObjectCreate("mirrors", GitMirrors.class);

    digester.addCallMethod("mirrors/mirror", "addMirror", 2);
    digester.addCallParam("mirrors/mirror", 0, "url");
    digester.addCallParam("mirrors/mirror", 1, "mirrorurl");

    try {
        return (GitMirrors) digester.parse(mirrorxml);
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Unable to load GitMirrors: " + mirrorxml, e);
    } catch (SAXException e) {
        LOG.log(Level.WARNING, "Unable to load GitMirrors: " + mirrorxml, e);
    }
    return new GitMirrors();
}

From source file:com.prowidesoftware.deprecation.DeprecationUtils.java

/**
 * According to the deprecation policy this method implements the phase 2 which 
 * involves logging a warning and making a small pause in the execution thread.
 * @param message the log message//from   ww  w. ja  v  a  2  s.co  m
 */
@SuppressWarnings("rawtypes")
public static void phase2(final Class clazz, final String method, final String message) {
    if (!isSet(EnvironmentVariableKey.NOLOG)) {
        log.warning(notice(clazz, method) + message);
    }
    if (!isSet(EnvironmentVariableKey.NODELAY)) {
        try {
            Thread.sleep(4000);
        } catch (InterruptedException e) {
            log.log(Level.WARNING, notice(clazz, method) + message, e);
            ;
        }
    }
}

From source file:edu.wpi.cs.wpisuitetng.authentication.BasicAuth.java

@Override
protected String[] parsePost(String post) throws AuthenticationException {
    // format: ["Authorization:", "Basic", Base64-encoded credentials]
    String[] parts = post.split(" ");

    if (!isValidBasicAuth(parts)) {
        logger.log(Level.WARNING, "Login attempted with invalid BasicAuth token");
        throw new AuthenticationException(
                "The <" + this.getAuthType() + "> authentication token is invalid format");
    }//ww w .j a v a2  s  .co  m

    byte[] decoded = Base64.decodeBase64(parts[1]);

    String[] credentials = (new String(decoded)).split(":"); // split decoded token username:password

    // check if the credential array has space for username and password elements.
    if (credentials.length != 2) {
        logger.log(Level.WARNING, "Login attempted with invalid BasicAuth token");
        throw new AuthenticationException(
                "The <" + this.getAuthType() + "> token's encoded portion is missing a piece");
    }

    return credentials;
}

From source file:net.consulion.jeotag.PhotoLoader.java

public static void load(final List<File> files) {
    final List<PhotoDataset> photos = new ArrayList<>(files.size());
    files.stream().forEach((file) -> {
        final PhotoDataset photoDataset = new PhotoDataset(file);
        final TiffImageMetadata exif = getExif(file);
        if (exif != null) {
            final Instant timeTaken = getTimeTaken(exif, file);
            if (timeTaken != null) {
                photoDataset.setInstantTaken(timeTaken);
                photoDataset.setHasGeotag(photoHasGeotag(exif, file));
                photos.add(photoDataset);
            } else {
                log(Level.ALL, String.format("Couldn't parse date/time for file %s", file));
            }//from  w  ww .  j  a v a  2s . c  om
        } else {
            log(Level.WARNING, String.format("No EXIF metadata found for file %s", file));
        }
    });
    DataHolder.getInstance().addPhotos(photos);
}