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.infullmobile.jenkins.plugin.restrictedregister.util.Utils.java

@SuppressWarnings("WeakerAccess")
public static void logWarning(String message) {
    LOGGER.log(Level.WARNING, message);
}

From source file:me.footlights.core.crypto.Fingerprint.java

public static Option<Fingerprint> unapply(String s) {
    try {//from ww w  .  j  a v  a2 s  .c o  m
        return Option.apply(decode(new URI(s)));
    } catch (FormatException e) {
        log.log(Level.INFO, e.getLocalizedMessage() + ": " + s);
    } catch (NoSuchAlgorithmException e) {
        log.log(Level.WARNING, "No such algorithm", e);
    } catch (URISyntaxException e) {
        log.log(Level.INFO, "Bad fingerprint syntax: " + s);
    }

    return Option.apply(null);
}

From source file:net.erdfelt.android.sdkfido.project.FilteredFileUtil.java

public static void copyWithExpansion(String resourceId, File destFile, Map<String, String> props) {
    URL url = FilteredFileUtil.class.getResource(resourceId);
    if (url == null) {
        LOG.log(Level.WARNING, "Unable to find resourceID: " + resourceId);
        return;/*from  w  w  w  .  j  ava2 s .c  o m*/
    }

    InputStream in = null;
    InputStreamReader reader = null;
    BufferedReader buf = null;
    FileWriter writer = null;
    PrintWriter out = null;
    try {
        in = url.openStream();
        reader = new InputStreamReader(in);
        buf = new BufferedReader(reader);
        writer = new FileWriter(destFile);
        out = new PrintWriter(writer);

        PropertyExpander expander = new PropertyExpander(props);
        String line;

        while ((line = buf.readLine()) != null) {
            out.println(expander.expand(line));
        }
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Unable to open input stream for url: " + url, e);
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(writer);
        IOUtils.closeQuietly(buf);
        IOUtils.closeQuietly(reader);
        IOUtils.closeQuietly(in);
    }
}

From source file:net.erdfelt.android.sdkfido.Build.java

public static String getVersion() {
    if (version == null) {
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        String resource = String.format("META-INF/maven/%s/%s/pom.properties", GROUP_ID, ARTIFACT_ID);
        URL url = cl.getResource(resource);
        if (url == null) {
            version = "[DEV]";
        } else {// w  w w.ja va  2 s.c  o m
            InputStream in = null;
            try {
                in = url.openStream();
                Properties props = new Properties();
                props.load(in);
                version = props.getProperty("version");
            } catch (IOException e) {
                LOG.log(Level.WARNING, "Unable to read: " + url, e);
                version = "[UNKNOWN]";
            } finally {
                IOUtils.closeQuietly(in);
            }
        }
    }
    return version;
}

From source file:jp.zippyzip.City.java

/**
 * JSON ???//w ww. j a  v a2  s.co m
 * 
 * @param json JSON
 * @return 
 */
public static City fromJson(String json) {

    City ret = null;

    try {

        JSONObject jo = new JSONObject(json);

        ret = new City(jo.optString("code", ""), jo.optString("name", ""), jo.optString("yomi", ""),
                Timestamp.valueOf(jo.optString("expiration", "")));

    } catch (JSONException e) {
        log.log(Level.WARNING, "", e);
    }

    return ret;
}

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

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

From source file:jshm.logging.Log.java

public static void reloadConfig() throws Exception {
    // all logging
    Handler consoleHandler = new ConsoleHandler();
    consoleHandler.setLevel(DEBUG ? Level.ALL : Level.WARNING);
    consoleHandler.setFormatter(new OneLineFormatter());

    Logger cur = Logger.getLogger("");
    removeHandlers(cur);//from  w  w w .jav a2 s.  com

    cur.addHandler(consoleHandler);

    // jshm logging
    Formatter fileFormatter = new FileFormatter();
    Handler jshmHandler = new FileHandler("data/logs/JSHManager.txt");
    jshmHandler.setLevel(Level.ALL);
    jshmHandler.setFormatter(fileFormatter);

    cur = Logger.getLogger("jshm");
    cur.addHandler(jshmHandler);
    cur.setLevel(DEBUG ? Level.ALL : Level.INFO);

    // hibernate logging
    Handler hibernateHandler = new FileHandler("data/logs/Hibernate.txt");
    hibernateHandler.setLevel(Level.ALL);
    hibernateHandler.setFormatter(fileFormatter);

    cur = Logger.getLogger("org.hibernate");
    removeHandlers(cur);

    cur.addHandler(hibernateHandler);
    cur.setLevel(DEBUG ? Level.INFO : Level.WARNING);

    // HttpClient logging
    Handler httpClientHandler = new FileHandler("data/logs/HttpClient.txt");
    httpClientHandler.setLevel(Level.ALL);
    httpClientHandler.setFormatter(fileFormatter);

    //      cur = Logger.getLogger("httpclient.wire");
    cur = Logger.getLogger("httpclient.wire.header");
    removeHandlers(cur);

    cur.addHandler(httpClientHandler);
    cur.setLevel(DEBUG ? Level.ALL : Level.INFO);

    cur = Logger.getLogger("org.apache.commons.httpclient");
    removeHandlers(cur);

    cur.addHandler(httpClientHandler);
    cur.setLevel(DEBUG ? Level.FINER : Level.INFO);

    // HtmlParser logging
    Handler htmlParserHandler = new FileHandler("data/logs/HtmlParser.txt");
    htmlParserHandler.setLevel(Level.ALL);
    htmlParserHandler.setFormatter(fileFormatter);

    cur = Logger.getLogger("org.htmlparser");
    removeHandlers(cur);

    cur.addHandler(htmlParserHandler);
    cur.setLevel(DEBUG ? Level.ALL : Level.INFO);

    // SwingX logging
    Handler swingxHandler = new FileHandler("data/logs/SwingX.txt");
    swingxHandler.setLevel(Level.ALL);
    swingxHandler.setFormatter(fileFormatter);

    cur = Logger.getLogger("org.jdesktop.swingx");
    removeHandlers(cur);

    cur.addHandler(swingxHandler);
    cur.setLevel(DEBUG ? Level.ALL : Level.INFO);
}

From source file:com.nebel_tv.content.utils.ConnectionUtils.java

/**
 *
 * @param url/*from www .j  av  a  2 s .  com*/
 * @return
 * @throws Exception
 */
public static InputStream getResponseAsStream(String url) throws Exception {
    if (ids.empty()) {
        init();
    }
    String developerId = ids.pop();
    url = url + "&Developerid=" + developerId;
    try {
        String result = IOUtils.toString(new URL(url));

        ids.push(developerId);
        return new ByteArrayInputStream(result.getBytes());
    } catch (MalformedURLException ex) {
        Logger.getLogger(ConnectionUtils.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ConnectionUtils.class.getName()).log(Level.WARNING, null, ex);
    }
    return null;
}

From source file:Util.java

public static boolean retreiveTextFileFromJar(String resourceName, String targetDirectory) throws Exception {
    boolean found = false;
    if (resourceName != null) {
        InputStream is = Util.class.getResourceAsStream(resourceName);
        if (is == null)
            logger.log(Level.WARNING, "The resource '" + resourceName + "' was not found.");
        BufferedReader br = new BufferedReader(new InputStreamReader(is));
        String line;/*from w ww  .  j ava2  s. c o  m*/
        String lineSep = System.getProperty("line.separator");
        StringBuffer sb = new StringBuffer();
        while ((line = br.readLine()) != null) {
            sb.append(line);
            sb.append(lineSep);
        }
        is.close();
        if (sb != null) {
            if (sb.length() > 0) {
                FileWriter temp = new FileWriter(targetDirectory + File.separator + resourceName);
                temp.write(sb.toString());
                temp.close();
                found = true;
            }
        }
    }
    return (found);
}

From source file:br.msf.maven.utils.IOUtils.java

public static Charset getCharset(final String charsetName) {
    if (StringUtils.isBlank(charsetName)) {
        LOGGER.log(Level.WARNING, "Charset name is blank. Assuming default charset!");
        return Charset.defaultCharset();
    }//from w  w  w .j  av  a  2s  .c  om
    return Charset.forName(charsetName);
}