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:cz.vity.freerapid.plugins.services.rapidshare_premium.RapidShareRunner.java

@Override
public void run() throws Exception {
    super.run();//from   w w  w . j a va  2s  .  c  o m

    int i = 0;
    do {
        try {
            i++;
            tryDownloadAndSaveFile(downloadTask);
            break;
        } catch (BadLoginException ex) {
            setBadConfig();
            logger.log(Level.WARNING, "Login failed: " + ex.getMessage());
            if (i > 4) {
                throw new BadLoginException("No RS Premium account login information!");
            }
        }
    } while (true);
}

From source file:com.google.gwt.benchmark.dashboard.server.servlets.AddBenchmarkResultServlet.java

@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    String auth = req.getHeader("auth");
    if (!authController.validateAuth(auth)) {
        resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
        return;/*from ww  w. ja v a  2s  .c o m*/
    }

    BenchmarkRunJson benchmarkRunJSON = null;
    String json = null;
    try {
        json = IOUtils.toString(req.getInputStream(), "UTF-8");
        AutoBean<BenchmarkRunJson> bean = AutoBeanCodex.decode(JsonFactory.get(), BenchmarkRunJson.class, json);
        benchmarkRunJSON = bean.as();
    } catch (Exception e) {
        logger.log(Level.WARNING, "Can not deserialize JSON", e);
        if (json != null) {
            logger.warning(json);
        }
        resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
        resp.getWriter().write("Can't parse JSON, see App Engine log for details.");
        return;
    }

    try {

        benchmarkController.addBenchmarkResult(benchmarkRunJSON);
        resp.setStatus(HttpServletResponse.SC_OK);
    } catch (Exception e) {
        logger.log(Level.WARNING, "Can not add benchmark results", e);
        resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
}

From source file:com.sun.faban.driver.transport.hc3.TimedSSLFactories.java

SecureProtocolSocketFactory getInstance() {
    SecureProtocolSocketFactory instance = null;
    try {/*from ww w.  ja  v a  2s . c  o m*/
        instance = (SecureProtocolSocketFactory) factory.newInstance();
    } catch (InstantiationException e) {
        Logger.getLogger(TimedSSLFactories.class.getName()).log(Level.WARNING,
                "Cannot instantiate " + factory.getName() + '.', e);
    } catch (IllegalAccessException e) {
        Logger.getLogger(TimedSSLFactories.class.getName()).log(Level.WARNING,
                "Access denied instantiating " + factory.getName() + '.', e);
    }
    return instance;
}

From source file:hudson.plugins.ansicolor.AnsiColorNote.java

public static String encodeTo(String html, final AnsiColorMap colorMap) {
    try {//from   w  w w .j a v a2  s. c  o m
        return ConsoleNote.removeNotes(new AnsiColorNote(html, colorMap).encode());
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Failed to serialize " + AnsiColorNote.class, e);
        return "";
    }
}

From source file:gzipper.algorithms.Zip.java

@Override
public void stop() {
    _runFlag = false;// w ww.  j  av a  2  s .  c o m
    try {
        if (_zos != null) {
            _zos.flush();
            _zos.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 + ".zip");
        if (file.exists()) {
            file.delete();
        }
    }
}

From source file:edu.usu.sdl.openstorefront.service.job.PluginScanJob.java

@Override
protected void executeInternaljob(JobExecutionContext context) {
    File pluginDir = FileSystemManager.getDir(FileSystemManager.PLUGIN_DIR);

    ObjectMapper objectMapper = StringProcessor.defaultObjectMapper();

    String fileMapJson = service.getSystemService().getPropertyValue(ApplicationProperty.PLUGIN_LAST_LOAD_MAP);
    Map<String, Long> fileMap = null;
    if (StringUtils.isNotBlank(fileMapJson)) {
        try {/*from  w  w w .j ava  2  s  . c o  m*/
            fileMap = objectMapper.readValue(fileMapJson, new TypeReference<Map<String, Long>>() {
            });
        } catch (IOException e) {
            log.log(Level.WARNING,
                    "Unable to restore plugin file map.  Starting over; should be able to continue.");
        }
    } else {
        fileMapJson = "";
    }

    if (fileMap == null) {
        fileMap = new ConcurrentHashMap<>();
    }

    Set<String> newFiles = new HashSet<>();
    for (File plugin : pluginDir.listFiles()) {
        if (plugin.isFile()) {
            newFiles.add(plugin.getPath());

            Long lastModTime = fileMap.get(plugin.getPath());
            boolean loadPlugin = false;
            if (lastModTime != null) {
                //check for update
                if (plugin.lastModified() > lastModTime) {
                    log.log(Level.INFO, MessageFormat.format("Plugin: {0} was updated...", plugin.getName()));
                    loadPlugin = true;
                }
            } else {
                //new Plugin
                loadPlugin = true;
            }

            if (loadPlugin) {
                log.log(Level.INFO,
                        MessageFormat.format("Found plugin: {0} attempting to load.", plugin.getName()));
                try (InputStream in = new FileInputStream(plugin)) {
                    service.getPluginServicePrivate().installPlugin(plugin.getName(), in, true);
                    log.log(Level.INFO,
                            MessageFormat.format("Loaded plugin: {0} successfully.", plugin.getName()));
                } catch (Exception ioe) {
                    log.log(Level.SEVERE, MessageFormat.format("Plugin: {0} failed to load.", plugin.getName()),
                            ioe);
                } finally {
                    fileMap.put(plugin.getPath(), plugin.lastModified());
                }
            }
        }
    }

    //look for removed files
    List<String> keysToRemove = new ArrayList<>();
    for (String path : fileMap.keySet()) {
        if (newFiles.contains(path) == false) {
            //file was remove
            log.log(Level.INFO, MessageFormat.format("Plugin: {0} was removed...", path));

            String filename = Paths.get(path).getFileName().toString();
            Plugin pluginExample = new Plugin();
            pluginExample.setActualFilename(filename);
            pluginExample = pluginExample.find();
            if (pluginExample != null) {
                log.log(Level.INFO, MessageFormat.format("Uninstalling plugin: {0} ", path));
                try {
                    service.getPluginService().uninstallPlugin(pluginExample.getPluginId());
                    log.log(Level.INFO, MessageFormat.format("Plugin: {0} uninstalled. ", path));
                } catch (Exception e) {
                    log.log(Level.INFO, MessageFormat.format(
                            "Failed to uninstalled:  {0} See log.  Try to use admin tools to uninstall.", path),
                            e);
                }
            } else {
                log.log(Level.INFO, MessageFormat.format("Plugin: {0} wasn't installed", path));
            }
            keysToRemove.add(path);
        }
    }

    for (String key : keysToRemove) {
        fileMap.remove(key);
    }

    try {
        String updatedMap = objectMapper.writeValueAsString(fileMap);
        if (fileMapJson.equals(updatedMap) == false) {
            service.getSystemService().saveProperty(ApplicationProperty.PLUGIN_LAST_LOAD_MAP, updatedMap);
        }
    } catch (JsonProcessingException ex) {
        log.log(Level.SEVERE, "Unable to save FileMap.  This can cause spinning.  Pausing job.", ex);
        JobManager.pauseSystemJob(PluginScanJob.class.getSimpleName());
    }

}

From source file:de.devsurf.injection.guice.integrations.commons.configuration.CommonsConfigurationFeature.java

@SuppressWarnings("unchecked")
@Override//from  w  w w .j a v  a 2s.c  om
public void process(Class<Object> annotatedClass, Map<String, Annotation> annotations) {
    Configuration config = (Configuration) annotations.get(Configuration.class.getName());
    Named name = config.name();

    // TODO Implement Location overriding
    URL url;
    switch (config.location().type()) {
    case FILE:
        File file = new File(config.location().value());
        if (!file.exists()) {
            _logger.log(Level.WARNING, "Ignoring Configuration " + name + " in " + config.location()
                    + ". In the Path " + file.getAbsolutePath() + " no Configuration was found.");
            return;
        }
        try {
            url = file.toURI().toURL();
        } catch (MalformedURLException e) {
            _logger.log(Level.WARNING, "Ignoring Configuration " + name + " in " + config.location()
                    + ". It has an illegal URL-Format.", e);
            return;
        }
        break;
    case URL:
        try {
            url = new URL(config.location().value());
        } catch (MalformedURLException e) {
            _logger.log(Level.WARNING, "Ignoring Configuration " + name + " in " + config.location()
                    + ". It has an illegal URL-Format.", e);
            return;
        }
        break;
    case CLASSPATH:
    default:
        url = this.getClass().getResource(config.location().value());
        break;
    }

    if (url == null) {
        _logger.log(Level.WARNING, "Ignoring Configuration " + name + " in " + config.location()
                + ", because is couldn't be found in the Classpath.");
        // TODO Throw an exception if config doesn't exist?
        return;
    }

    Named named = null;
    if (name.value().length() > 0) {
        named = name;
    }

    FileConfiguration configuration;
    try {
        // Class<? extends FileConfiguration> interf =
        // config.to().asSubclass(FileConfiguration.class);
        Class<FileConfiguration> interf = (Class<FileConfiguration>) config.to();
        configuration = (FileConfiguration) injector.getInstance(interf);
        configuration.load(url);

        bindInstance(configuration, interf, named, null);
        bindInstance(configuration, FileConfiguration.class, named, null);
        bindInstance(configuration, org.apache.commons.configuration.Configuration.class, named, null);
    } catch (ConfigurationException e) {
        _logger.log(Level.WARNING, "Configuration " + name + " couldn't be loaded/bound: " + e.getMessage(), e);
    }
}

From source file:com.willwinder.universalgcodesender.utils.GUIHelpers.java

public static void openGcodeFile(File f, BackendAPI backend) {
    ThreadHelper.invokeLater(() -> {/* w  w  w.ja v  a 2s  . c o  m*/
        try {
            backend.setGcodeFile(f);
            Settings settings = backend.getSettings();
            settings.setLastOpenedFilename(f.getAbsolutePath());
            SettingsFactory.saveSettings(settings);
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "Couldn't set gcode-file" + e.getMessage(), e);
        }
    });
}

From source file:net.jetrix.filter.DownstackPuzzleGenerator.java

public Puzzle getNextPuzzle() {
    try {//  w  w w. j av  a  2 s . com
        // load the field
        File[] levels = getLevels();
        File file = levels[level % levels.length];
        level = level + 1;

        Puzzle puzzle = loadPuzzle(new File(path),
                file.getName().substring(0, file.getName().lastIndexOf(".")));
        puzzle.setKey(String.valueOf(level));

        return puzzle;
    } catch (IOException e) {
        log.log(Level.WARNING, e.getMessage(), e);
    }

    return null;
}

From source file:com.almende.eve.state.couchdb.CouchDBState.java

@Override
public synchronized JsonNode locPut(final String key, final JsonNode value) {
    final String ckey = couchify(key);
    JsonNode result = null;/*from www .  j a v a 2s. c o m*/
    try {
        result = properties.put(ckey, value);
        update();
    } catch (final UpdateConflictException uce) {
        read();
        return locPut(ckey, value);
    } catch (final Exception e) {
        LOG.log(Level.WARNING, "Failed to store property", e);
    }

    return result;
}