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:org.osiam.addons.selfadministration.exception.OsiamExceptionHandler.java

@ExceptionHandler(OsiamClientException.class)
protected ModelAndView handleConflict(OsiamClientException ex, HttpServletResponse response) {
    LOGGER.log(Level.WARNING, AN_EXCEPTION_OCCURED, ex);
    response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
    modelAndView.addObject(KEY, "registration.form.error");
    setLoggingInformation(ex);//from   w w w  . j a  v  a2  s . c o m
    return modelAndView;
}

From source file:eu.eexcess.opensearch.recommender.dataformat.JsonOpensearchResultListBuilder.java

/**
 * @return an OpensearchResponse object representing the given
 *         {@code jsonResponse} or null on error
 *///from  w  w  w .  ja v a  2s .com
@Override
public ResultList build() {

    int shortDescriptonsIdx = 1;
    int descriptonsIdx = 2;
    int urlsIdx = 3;

    int numShortDescriptions = jsonResponse.getJSONArray(shortDescriptonsIdx).length();
    int numDescriptions = jsonResponse.getJSONArray(descriptonsIdx).length();
    int numUrls = jsonResponse.getJSONArray(urlsIdx).length();

    if (numShortDescriptions != numDescriptions || numDescriptions != numUrls) {
        logger.log(Level.WARNING, "warning - unequal response dimensions [" + numShortDescriptions + "]["
                + numDescriptions + "][" + numUrls + "][#shortDescriptions][#descriptions][#links]");
        return null;
    }

    int maxLength = (numShortDescriptions > numDescriptions) ? numShortDescriptions : numDescriptions;
    maxLength = (numUrls > maxLength) ? numUrls : maxLength;

    JSONArray shortDescriptions = jsonResponse.getJSONArray(shortDescriptonsIdx);
    JSONArray descriptions = jsonResponse.getJSONArray(descriptonsIdx);
    JSONArray urls = jsonResponse.getJSONArray(urlsIdx);

    ResultList response = new ResultList();

    for (int idx = 0; idx < maxLength; idx++) {
        String shortDescription = null;
        try {
            shortDescription = shortDescriptions.getString(idx);
        } catch (JSONException e) {
            shortDescription = "";
        }

        String description = null;
        try {
            description = descriptions.getString(idx);
        } catch (JSONException e) {
            description = "";
        }

        String url = null;
        try {
            url = urls.getString(idx);
        } catch (JSONException e) {
            url = "";
        }

        Result resultEntry = new Result();
        resultEntry.title = shortDescription;
        resultEntry.description = description;
        resultEntry.uri = url;
        resultEntry.facets.provider = getProviderName();
        response.results.add(resultEntry);
    }
    response.totalResults = response.results.size();
    return response;
}

From source file:io.github.lucaseasedup.logit.profile.ProfileManager.java

public ProfileManager(File path, Map<String, Object> fields) {
    if (path == null || fields == null)
        throw new IllegalArgumentException();

    this.path = path;

    for (Map.Entry<String, Object> e : fields.entrySet()) {
        String fieldName = e.getKey();
        String fieldDefinition = e.getValue().toString();

        try {//from   w ww  .j a va  2  s  .  c o m
            definedFields.add(newField(fieldName, fieldDefinition));
        } catch (RuntimeException ex) {
            String exMsg = ex.getMessage();

            if (exMsg == null) {
                exMsg = ex.getClass().getSimpleName();

                log(Level.WARNING, ex);
            }

            log(Level.WARNING,
                    "Invalid field definition." + " Field name: " + fieldName + "." + " Cause: " + exMsg);
        }
    }
}

From source file:Jimbo.Cheerlights.BlinktLights.java

/**
 * Update the lights with a new colour./*  ww w  .jav  a  2 s.com*/
 * 
 * @param colour The colour to update with
 * @throws IOException In case of problems
 */
@Override
public synchronized void update(int colour) throws IOException {
    LOG.log(Level.INFO, "Update new colour {0}", Integer.toHexString(colour));

    int[] next = new int[data.length];

    for (int i = 1; i < data.length; ++i)
        next[i] = data[i - 1];

    next[0] = colour;

    for (int step = 1; step <= 100; ++step) {
        final int left = 100 - step;

        for (int i = 0; i < data.length; ++i) {
            final int r = (step * ((next[i] >> 16) & 0xff) + left * ((data[i] >> 16) & 0xff)) / 100;
            final int g = (step * ((next[i] >> 8) & 0xff) + left * ((data[i] >> 8) & 0xff)) / 100;
            final int b = (step * ((next[i]) & 0xff) + left * ((data[i]) & 0xff)) / 100;

            blinkt.set(i, r, g, b, 8);
        }

        blinkt.show();

        try {
            Thread.sleep(100);
        }

        catch (InterruptedException e) {
            LOG.log(Level.WARNING, "Interrupted sleep?");
        }
    }

    data = next;
}

From source file:com.appenginefan.toolkit.common.HttpClientEnvironment.java

@Override
public String fetch(String data) {
    LOG.fine("sending " + data);
    PostMethod method = new PostMethod(url);
    method.setRequestBody(data);/*from   www  . ja  v  a2 s .c  o  m*/
    try {
        int returnCode = client.executeMethod(method);
        if (returnCode == HttpStatus.SC_OK) {
            String response = method.getResponseBodyAsString();
            LOG.fine("receiving " + response);
            return response;
        } else {
            LOG.log(Level.WARNING, "Communication failed, status code " + returnCode);
        }
    } catch (HttpException e) {
        LOG.log(Level.WARNING, "Communication failed ", e);
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Communication failed ", e);
    } finally {
        method.releaseConnection();
    }
    return null;
}

From source file:com.josue.ws.web.server.MessageDispatcher.java

public void proccessMessage(String map, Session session, String message) {
    if (message == null || message.isEmpty()) {
        logger.warning("Empty message payload");
    }//  www.  j  a  v a 2  s .  c  o  m

    try {
        NetworkPackage networkPackage = mapper.readValue(message, NetworkPackage.class);

        MessageRequestWrapper wrapper = new MessageRequestWrapper(message, networkPackage, session, map);

        if (null != networkPackage.getType()) {
            switch (networkPackage.getType()) {
            case CONNECTION:
                proccessConnectionMessage(wrapper);
                break;
            case MESSAGE:
                proccessOnlineMessage(wrapper);
                break;
            case WORLD:
                proccessWorldMessage(wrapper);
                break;
            case PLAYER:
                proccessPlayerMessage(wrapper);
                break;
            default:
                logger.log(Level.WARNING, "Invalid message payload: {0}", message);
                break;
            }
        }
    } catch (IOException ex) {
        logger.log(Level.SEVERE, "Error while deserializang message", ex);
    }
}

From source file:com.almende.pi5.lch.SimManager.java

@Override
protected void onReady() {
    final ObjectNode config = getConfig();
    if (config.has("timeCsv")) {
        try {/*from  www  .j a  v a 2 s . c om*/
            final InputStream is = new FileInputStream(new File(config.get("timeCsv").asText()));
            if (is != null) {
                readTimeSpread(convertStreamToString(is));
            }
        } catch (FileNotFoundException e) {
            LOG.log(Level.WARNING, "Failed to read TimeSpread data.", e);
        }
    }
    if (config.has("flexCsv")) {
        try {
            final InputStream is = new FileInputStream(new File(config.get("flexCsv").asText()));
            if (is != null) {
                readFlexSpread(convertStreamToString(is));
            }
        } catch (FileNotFoundException e) {
            LOG.log(Level.WARNING, "Failed to read FlexSpread data.", e);
        }
    }
    if (config.has("dersCsv")) {
        try {
            final InputStream is = new FileInputStream(new File(config.get("dersCsv").asText()));
            if (is != null) {
                readDers(convertStreamToString(is));
            }
        } catch (FileNotFoundException e) {
            LOG.log(Level.WARNING, "Failed to read Ders data.", e);
        }
    }
}

From source file:com.oic.net.WebSocketListener.java

@OnWebSocketMessage
public void onText(String message) {
    String method = "";
    JSONObject json = new JSONObject();
    try {//  ww w. j av a2  s  . c o  m
        json = (JSONObject) (new JSONParser().parse(message));
        LOG.log(Level.INFO, "method : {0}", json.get("method"));
        //LOG.log(Level.INFO, "status : {0}", login);
        method = json.get("method").toString();
    } catch (ParseException e) {
        LOG.log(Level.WARNING, "{0}", e);
    }

    /* ?  */
    selectMessage(method, json, this);
}

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

/**
 * Fetch the PCT 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
 *//*ww  w  . jav a2s.com*/
@Override
public String process() throws Exception {
    googleKey = config.getString("GOOGLE_API_KEY");
    outputDir = new File(config.getString("output_dir"));

    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) + "?key=" + googleKey).execute()
                .returnContent().asString();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + url + ".json");
        FileUtils.writeStringToFile(outputFile, response, Charsets.UTF_8);
    }

    /*
     * curl -o $od/pct-CA-A.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Campo%20-%
     * 20Idyllwild!A11:G1000?key=$apik
     * curl -o $od/pct-CA-C.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Idyllwild%20-
     * %20Agua%20Dulce!A11:G1000?key=$apik
     * curl -o $od/pct-CA-E.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Agua%20Dulce%
     * 20-%20Cottonwood%20Pass!A11:G100?key=$apik
     * curl -o $od/pct-CA-M.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Northern%20CA
     * !A9:G1000?key=$apik
     * curl -o $od/pct-OR-B.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Oregon!A9:
     * G1000?key=$apik
     * curl -o $od/pct-WA-H.json
     * https://sheets.googleapis.com/v4/spreadsheets/1gEyz3bw__aPvNXpqqHcs7KRwmwYrTH2L0DEMW3RbHes/values/Washington!A9
     * :G1000?key=$apik
     */
    return BatchStatus.COMPLETED.toString();
}

From source file:com.nebel_tv.content.wrapper.builders.MediasBuilder.java

private void executeQuery() {
    try {//from   w w  w.ja  v  a 2 s .c om
        String source = ConnectionUtils.getResponseAsString(ConnectionHelper.fixURL(queryUrl));
        JSONObject root = new JSONObject(source);
        items = (JSONArray) root.get("d");
    } catch (Exception ex) {
        Logger.getLogger(MediasBuilder.class.getName()).log(Level.WARNING, null, ex);
    }
}