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.redhat.jenkins.nodesharing.RestEndpoint.java

private static int parseTimeout() {
    String strTimeout = Util.fixEmptyAndTrim(System.getProperty(PROPERTY_NAME));
    if (strTimeout != null) {
        try {//from   ww  w  .  ja  v a 2  s.  co m
            int timeout = Integer.parseInt(strTimeout);
            if (timeout > 0) {
                if (timeout < DEFAULT_TIMEOUT) {
                    LOGGER.warning("Using " + PROPERTY_NAME + " shorter than the default (" + DEFAULT_TIMEOUT
                            + ") may be problematic");
                }
                return timeout;
            } else {
                LOGGER.warning("Value of " + PROPERTY_NAME + " is invalid, using default " + DEFAULT_TIMEOUT);
            }
        } catch (NumberFormatException e) {
            LOGGER.log(Level.WARNING, "Unable to parse TIMEOUT, using default value " + DEFAULT_TIMEOUT, e);
        }
    }
    return DEFAULT_TIMEOUT;
}

From source file:com.neophob.sematrix.core.generator.Textwriter.java

/**
 * Instantiates a new textwriter./*from w  ww . j ava  2 s.  c  o m*/
 *
 * @param controller the controller
 * @param fontName the font name
 * @param fontSize the font size
 * @param text the text
 */
public Textwriter(MatrixData matrix, String fontName, int fontSize, FileUtils fu) {
    super(matrix, GeneratorName.TEXTWRITER, ResizeName.PIXEL_RESIZE);
    String filename = fu.getDataDir() + File.separator + fontName;
    InputStream is = null;
    try {
        is = new FileInputStream(filename);
        textAsImage = new int[internalBuffer.length];
        font = Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(Font.BOLD, (float) fontSize);
        LOG.log(Level.INFO, "Loaded font " + fontName + ", size: " + fontSize);
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to load font " + filename + ":", e);
        throw new IllegalArgumentException(
                "Failed to load font " + filename + ". Check your config.properties file.");
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (IOException e) {
                LOG.log(Level.WARNING, "Failed to close InputStream.", e);
            }
        }
    }
    createTextImage(INITIAL_STRING);
    scroller = new PingPongScroller();
}

From source file:com.tupilabs.pbs.parser.QstatQueuesParser.java

@Override
public List<Queue> parse(String text) throws ParseException {
    final List<Queue> queues;
    if (StringUtils.isNotBlank(text)) {
        queues = new LinkedList<Queue>();
        String separator = "\n";
        if (text.indexOf("\r\n") > 0) {
            separator = "\r\n";
        }/* w  ww.j ava  2  s . c  o m*/
        final String[] lines = text.split(separator);
        Queue queue = null;
        for (final String line : lines) {
            Matcher matcher = PATTERN_QUEUE.matcher(line);
            if (matcher.matches()) {
                if (queue != null) {
                    queues.add(queue);
                }
                queue = new Queue();
                final String name = matcher.group(1);
                queue.setName(name);
            } else if (StringUtils.isNotBlank(line)) {
                String[] temp = Utils.splitFirst(line, CHAR_EQUALS);
                if (temp.length == 2) {
                    final String key = temp[0].trim().toLowerCase();
                    final String value = temp[1].trim();
                    if ("queue_type".equals(key)) {
                        queue.setQueueType(value);
                    } else if ("priority".equals(key)) {
                        try {
                            queue.setPriority(Integer.parseInt(value));
                        } catch (NumberFormatException nfe) {
                            LOGGER.log(Level.WARNING, "Failed parsing queue priority: " + nfe.getMessage(),
                                    nfe);
                            queue.setPriority(-1);
                        }
                    } else if ("total_jobs".equals(key)) {
                        try {
                            queue.setTotalJobs(Integer.parseInt(value));
                        } catch (NumberFormatException nfe) {
                            LOGGER.log(Level.WARNING, "Failed parsing queue total jobs: " + nfe.getMessage(),
                                    nfe);
                            queue.setPriority(-1);
                        }
                    } else if ("state_count".equals(key)) {
                        queue.setStateCount(value);
                    } else if ("mtime".equals(key)) {
                        queue.setMtime(value);
                    } else if ("max_user_run".equals(key)) {
                        try {
                            queue.setMaxUserRun(Integer.parseInt(value));
                        } catch (NumberFormatException nfe) {
                            LOGGER.log(Level.WARNING, "Failed parsing queue max user run: " + nfe.getMessage(),
                                    nfe);
                            queue.setPriority(-1);
                        }
                    } else if ("enabled".equals(key)) {
                        queue.setEnabled(Boolean.parseBoolean(value));
                    } else if ("started".equals(key)) {
                        queue.setStarted(Boolean.parseBoolean(value));
                    } else if (key.startsWith("resources_max.")) {
                        queue.getResourcesMax().put(key, value);
                    } else if (key.startsWith("resources_min.")) {
                        queue.getResourcesMin().put(key, value);
                    } else if (key.startsWith("resources_assigned.")) {
                        queue.getResourcesAssigned().put(key, value);
                    } else if (key.startsWith("resources_default.")) {
                        queue.getResourcesDefault().put(key, value);
                    } else {
                        LOGGER.info("Unmmaped key, value: " + key + ", " + value);
                    }
                }
            }
        }
        if (queue != null) {
            queues.add(queue);
        }
        return queues;
    } else {
        return Collections.emptyList();
    }
}

From source file:com.vmware.admiral.adapter.docker.service.SystemImageRetrievalManager.java

private void retrieveAgentImage(String resourcesPath, String containerImageFilePath) {
    Consumer<byte[]> finalCallback = (fileBytes) -> {
        if (fileBytes == null) {
            host.log(Level.WARNING, "System image " + containerImageFilePath + " does not exists.");
        }/*from ww w .  j a v a 2s  . co m*/

        notifyCallbacks(containerImageFilePath, fileBytes);
    };

    if (resourcesPath != null) {
        getExternalAgentImage(resourcesPath, containerImageFilePath, (fileBytes) -> {
            if (fileBytes != null) {
                notifyCallbacks(containerImageFilePath, fileBytes);
            } else {
                // Fetch the data from resources when the image is not found in user resources
                getResourceAgentImage(containerImageFilePath, finalCallback);
            }
        });
    } else {
        getResourceAgentImage(containerImageFilePath, finalCallback);
    }
}

From source file:com.qualogy.qafe.bind.presentation.style.Style.java

public void performPostProcessing() {
    if (styleFileLocation == null || styleFileLocation.toURI() == null) {
        String message = "Style file location [" + styleFileLocation + "] points to a non-existing file";
        LOG.severe(message);/*from  www  .  ja v a  2  s.  c o  m*/
        messages.add(message);
        return;
    }

    InputStream inputStream = null;
    try {
        if (FileLocation.SCHEME_HTTP.equals(styleFileLocation.toURI().getScheme())) {
            URL url = new URL(styleFileLocation.toURI().toString());
            inputStream = url.openStream();
        } else {
            inputStream = new FileInputStream(new File(styleFileLocation.toURI()));

        }
        LessCompiler lessCompiler = new LessCompiler();

        String less = IOUtils.toString(inputStream);
        // Compile LESS input string to CSS output string
        String css = lessCompiler.compile(less);
        cssData = css != null ? css.getBytes() : null;
        LOG.info("Less CSS data read " + cssData);
    } catch (IOException e) {
        throw new BindException("Error occured on file [" + styleFileLocation + "]", e);
    } catch (LessException e) {
        throw new BindException("Error occured in less file [" + styleFileLocation + "]", e);
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException e) {
                LOG.log(Level.WARNING, "Problem closing input stream", e);
            }
        }
    }
}

From source file:com.almende.eve.agent.ExampleAgent.java

/**
 * Run complex type test.//from   ww w  . j ava  2 s.  com
 *
 * @param uri
 *            the uri
 */
public void runComplexTypeTest(URI uri) {
    final MessageContainer test = new MessageContainer();
    test.setMessage("Hi there!");

    final Params params = new Params();
    params.add("message", test);
    try {
        call(uri, "getMessage", params, new AsyncCallback<List<MessageContainer>>() {

            @Override
            public void onSuccess(List<MessageContainer> message) {
                LOG.info("received message:" + message.get(0).getMessage());
            }

            @Override
            public void onFailure(Exception exception) {
                LOG.log(Level.WARNING, "Oops:", exception);

            }
        });

    } catch (IOException e) {
        LOG.log(Level.WARNING, "failed to send message", e);
    }
    try {
        final SyncCallback<List<MessageContainer>> callback = new SyncCallback<List<MessageContainer>>() {
        };
        call(uri, "getMessage", params, callback);
        LOG.info("received message:" + callback.get().get(0).getMessage());

    } catch (Exception e) {
        LOG.log(Level.WARNING, "failed to send message", e);
    }
    try {
        final List<MessageContainer> message = callSync(uri, "getMessage", params,
                new TypeUtil<List<MessageContainer>>() {
                });
        LOG.info("received message:" + message.get(0).getMessage());

    } catch (IOException e) {
        LOG.log(Level.WARNING, "failed to send message", e);
    }
    try {
        params.put("message", "Hi There!");
        final String message = callSync(uri, "helloWorld", params, String.class);
        LOG.info("received message:" + message);

    } catch (IOException e) {
        LOG.log(Level.WARNING, "failed to send message", e);
    }

}

From source file:io.hops.hopsworks.common.dao.tensorflow.TensorflowFacade.java

public String getTensorboardURI(String appId, String projectName) {
    DistributedFileSystemOps dfso = null;
    try {/*from w w  w.ja  va 2  s.c  om*/
        dfso = dfs.getDfsOps();
        String tensorboardFile = File.separator + Settings.DIR_ROOT + File.separator + projectName
                + File.separator + Settings.PROJECT_STAGING_DIR + File.separator + ".tensorboard." + appId;
        try {
            FSDataInputStream file = dfso.open(tensorboardFile);
            String uri = IOUtils.toString(file);
            return uri;
        } catch (IOException ex) {
            LOGGER.log(Level.WARNING, "error while trying to read tensorboard file: " + tensorboardFile, ex);
            return null;
        }

    } finally {
        if (dfso != null) {
            dfso.close();
        }
    }
}

From source file:es.logongas.encuestas.presentacion.controller.EncuestaController.java

@RequestMapping(value = { "/encuesta.html" })
public ModelAndView encuesta(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Map<String, Object> model = new HashMap<String, Object>();
    String viewName;// www.  jav a 2 s. c o m

    if (request.getCharacterEncoding() == null) {
        try {
            request.setCharacterEncoding("utf-8");
        } catch (UnsupportedEncodingException ex) {
            Logger.getLogger(EncuestaController.class.getName()).log(Level.WARNING,
                    "no existe el juego de caracteres utf-8", ex);
        }
    }

    int idEncuesta;
    URI backURI;
    try {
        idEncuesta = Integer.parseInt(request.getParameter("idEncuesta"));
    } catch (NumberFormatException ex) {
        throw new BusinessException(new BusinessMessage(null, "El N de encuesta no es vlido"));
    }

    try {
        if ((request.getParameter("backURI") == null) || (request.getParameter("backURI").trim().equals(""))) {
            backURI = new URI(request.getContextPath() + "/");
        } else {
            backURI = new URI(request.getParameter("backURI"));
        }
    } catch (Exception ex) {
        throw new BusinessException(new BusinessMessage(null, "El backURI no es vlido"));
    }

    Encuesta encuesta = (Encuesta) daoFactory.getDAO(Encuesta.class).read(idEncuesta);
    if (encuesta == null) {
        throw new BusinessException(new BusinessMessage(null, "La encuesta solicitada no existe"));
    }

    if (encuesta.isEncuestaHabilitada() == false) {
        throw new BusinessException(
                new BusinessMessage(null, "La encuesta solicitada no es posible realizarla actualmente"));
    }

    RespuestaEncuesta respuestaEncuesta = new RespuestaEncuesta(encuesta);
    EncuestaState encuestaState = new EncuestaState(respuestaEncuesta, backURI);
    setEncuestaState(request, encuestaState);

    Pregunta pregunta = respuestaEncuesta.getPrimeraPregunta();
    if (pregunta == null) {
        throw new BusinessException(new BusinessMessage(null, "La encuesta no tiene preguntas"));
    }
    viewName = "redirect:/pregunta.html?idPregunta=" + pregunta.getIdPregunta();

    return new ModelAndView(viewName, model);
}

From source file:org.apache.cxf.security.spring.ServerPasswordCallbackHandler.java

private SecurityException translateException(AuthenticationException ex) {
    if (logExceptions) {
        LogUtils.log(LOG, Level.WARNING, "Authentication failed", ex);
    }// ww w.  j a va2s  .c o  m
    return nestExceptions ? new SecurityException(ex) : new SecurityException("Authentication failed");
}

From source file:io.trivium.Central.java

/**
 * parses command line arguments and sets up the server.
 *
 * @param args command line arguments/* w ww  .  j a v a  2 s  . c om*/
 * @return true, if normal startup can proceed
 * @throws Exception
 */
public static boolean setup(String[] args) throws Exception {
    CommandLineParser parser = new PosixParser();
    Options opts = new Options();
    opts.addOption("ll", "loglevel", true,
            "turn logging to one of the following levels: fine,info,warning,severe");
    opts.addOption("h", "help", false, "show help");
    opts.addOption("?", "help", false, "show help");
    opts.addOption("p", "path", true, "base path for the local storage");
    opts.addOption("hp", "http", true, "port for the http interface, defaults to port 12345");
    opts.addOption("cs", "cleanStore", false, "re-initializes the local store (all information will be lost)");
    opts.addOption("cq", "cleanQueue", false, "re-initializes the local ingestion queue");
    opts.addOption("t", "test", true, "starts test mode with target scope (default core)");
    opts.addOption("c", "compress", true, "enable/disable snappy compression (default=true)");
    opts.addOption("b", "build", false, "generate executable shell script");

    CommandLine cmd = parser.parse(opts, args);
    if (cmd.hasOption("help")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("trivium", opts);
        return false;
    }
    if (cmd.hasOption("build")) {
        uuencode();
        return false;
    }

    if (cmd.hasOption("loglevel")) {
        String val = cmd.getOptionValue("loglevel");
        try {
            Level l = Level.parse(val.toUpperCase());
            Central.setLogLevel(val);
        } catch (Exception ex) {
            logger.log(Level.WARNING, "log level was not recognized, falling back to default value");
        }
    }
    if (cmd.hasOption("compress")) {
        String val = cmd.getOptionValue("compress");
        if (val.equalsIgnoreCase("false")) {
            Central.setProperty("compression", "false");
        } else {
            Central.setProperty("compression", "true");
        }
    } else {
        Central.setProperty("compression", "true");
    }
    if (cmd.hasOption("test")) {
        String target = cmd.getOptionValue("test");
        Central.setProperty("test", target);
    }
    if (cmd.hasOption("path")) {
        String val = cmd.getOptionValue("path");
        if (val != null && val.length() > 1) {
            if (!val.endsWith(File.separator))
                val += File.separator;
            Central.setProperty("basePath", val);
        } else {
            Central.setProperty("basePath", System.getProperty("user.dir"));
        }
    } else {
        Central.setProperty("basePath", System.getProperty("user.dir"));
    }
    if (cmd.hasOption("cleanStore")) {
        StoreUtils.cleanStore();
    }
    if (cmd.hasOption("cleanQueue")) {
        StoreUtils.cleanQueue();
    }

    if (cmd.hasOption("http")) {
        String val = cmd.getOptionValue("http");
        if (val != null && val.length() > 1) {
            try {
                int port = Integer.parseInt(val);
                if (port > 0 && port < 65535)
                    Central.setProperty("httpPort", val);
                else
                    throw new Exception("out of range");
            } catch (Exception ex) {
                Central.setProperty("httpPort", "12345");
            }
        } else {
            Central.setProperty("httpPort", "12345");
        }
    } else {
        Central.setProperty("httpPort", "12345");
    }

    Hardware.discover();

    return true;
}