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:ch.jamiete.hilda.plugins.PluginManager.java

public void disablePlugins() {
    ExecutorService executor = Executors.newSingleThreadExecutor();

    synchronized (this.plugins) {
        final Iterator<HildaPlugin> iterator = this.plugins.iterator();

        while (iterator.hasNext()) {
            final HildaPlugin entry = iterator.next();

            Future<?> future = executor.submit(() -> {
                try {
                    entry.onDisable();//  w ww.  j a  v a  2 s  .c  om
                } catch (final Exception e) {
                    Hilda.getLogger().log(Level.WARNING, "Encountered an exception while disabling plugin "
                            + entry.getPluginData().getName(), e);
                }
            });

            try {
                future.get(30, TimeUnit.SECONDS);
            } catch (InterruptedException | ExecutionException | TimeoutException e) {
                Hilda.getLogger().log(Level.WARNING, "Plugin " + entry.getPluginData().getName()
                        + " took too long disabling; ceased executing its code", e);
            }
        }
    }

    executor.shutdown();

    try {
        executor.awaitTermination(5, TimeUnit.SECONDS);
    } catch (InterruptedException e) {
        Hilda.getLogger().log(Level.WARNING, "Encountered an exception during the plugin disable grace period",
                e);
    }
}

From source file:to.sparks.mtgox.service.SocketListener.java

@Override
public void on(String string, IOAcknowledge ioa, Object... os) {
    logger.log(Level.WARNING, "on: {0}", string);
}

From source file:cz.cas.lib.proarc.common.process.AsyncProcess.java

public void kill() {
    Level level = isDone() ? Level.FINE : Level.WARNING;
    LOG.log(level, "Kill isDone: " + isDone() + ", " + cmdLine);
    Process process = refProcess.getAndSet(null);
    if (process != null) {
        process.destroy();/*from  w  ww  .ja  va 2s.  c o m*/
        IOUtils.closeQuietly(process.getInputStream());
        IOUtils.closeQuietly(process.getErrorStream());
        IOUtils.closeQuietly(process.getOutputStream());
        done.set(true);
        try {
            outputConsumer.join();
        } catch (InterruptedException ex) {
            LOG.log(Level.SEVERE, null, ex);
        }
    }
}

From source file:org.openspaces.bigdata.processor.TweetArchiveFilter.java

@Override
public void onException(ListenerExecutionFailedException exception, SpaceDocument[] tweets, GigaSpace gigaSpace,
        TransactionStatus txStatus, Object source) throws RuntimeException {

    List<SpaceDocument> retryTweets = new ArrayList<SpaceDocument>();

    for (SpaceDocument tweet : tweets) {
        Integer tries = tweet.getProperty("Archived");
        if (tries == null) {
            tries = 0;/* ww  w  .ja  va2s  .  c om*/
        }
        if (tries < maxRetries) {
            tweet.setProperty("Archived", tries + 1);
            retryTweets.add(tweet);
        } else {
            log.log(Level.WARNING, "Error archiving tweet " + tweet.getProperty("Id"), exception.getCause());
        }
    }

    if (!retryTweets.isEmpty()) {
        //retry
        SpaceDocument[] spaceDocuments = retryTweets.toArray(new SpaceDocument[retryTweets.size()]);
        gigaSpace.writeMultiple(spaceDocuments);
    }
}

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

/**
 * Fetch the PCT waypoint 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
 *///from w ww .  j a  v a  2s .c  o  m
@Override
public String process() throws Exception {
    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 waypoints from {0}", new Object[] { url });

        byte[] response = Request.Get(context.getProperties().getProperty(url)).execute().returnContent()
                .asBytes();
        File outputFile = new File(outputDir.getAbsolutePath() + File.separator + url + "_state_gps.zip");
        FileUtils.writeByteArrayToFile(outputFile, response);

        if (outputFile.exists()) {
            unZipIt(outputFile, outputDir);
        }
    }

    return BatchStatus.COMPLETED.toString();
}

From source file:eu.optimis.ip.gui.client.resources.DbServerThread.java

public void stopServer() {
    server.shutdown();/*from   w w w .  ja  v a2s .c  o  m*/
    while (!isShutdown()) {
        try {
            Thread.sleep(500);
        } catch (InterruptedException ex) {
            Logger.getLogger(Accounting.class.getName()).log(Level.WARNING,
                    "Error when Thread.sleep(): " + ex.getMessage());
        }
    }
}

From source file:edu.usu.sdl.openstorefront.security.SecurityUtil.java

/**
 * Find the current user context in the session
 *
 * @return context or null if not found//from   w w  w  . j  a v a  2 s  .com
 */
public static UserContext getUserContext() {
    UserContext userContext = null;
    try {
        Subject currentUser = SecurityUtils.getSubject();
        userContext = (UserContext) currentUser.getSession().getAttribute(USER_CONTEXT_KEY);
    } catch (Exception e) {
        log.log(Level.WARNING, "No user is logged in or security Manager hasn't started yet.");
    }
    return userContext;
}

From source file:com.neophob.sematrix.listener.MessageProcessor.java

/**
 * process message from gui./*from  w  w  w .ja v a  2 s .  co m*/
 *
 * @param msg the msg
 * @param startFader the start fader
 * @return STATUS if we need to send updates back to the gui (loaded preferences)
 */
public static synchronized ValidCommands processMsg(String[] msg, boolean startFader, byte[] blob) {
    if (msg == null || msg.length < 1) {
        return null;
    }

    int msgLength = msg.length - 1;
    int tmp;
    try {
        ValidCommands cmd = ValidCommands.valueOf(msg[0]);
        Collector col = Collector.getInstance();
        switch (cmd) {
        case STATUS:
            return ValidCommands.STATUS;

        case CHANGE_GENERATOR_A:
            try {
                int nr = col.getCurrentVisual();
                tmp = Integer.parseInt(msg[1]);
                Generator g = col.getPixelControllerGenerator().getGenerator(tmp);
                //silly check of generator exists
                g.getId();
                col.getVisual(nr).setGenerator1(g);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_GENERATOR_B:
            try {
                //the new method - used by the gui
                int nr = col.getCurrentVisual();
                tmp = Integer.parseInt(msg[1]);
                Generator g = col.getPixelControllerGenerator().getGenerator(tmp);
                g.getId();
                col.getVisual(nr).setGenerator2(g);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_EFFECT_A:
            try {
                int nr = col.getCurrentVisual();
                tmp = Integer.parseInt(msg[1]);
                Effect e = col.getPixelControllerEffect().getEffect(tmp);
                e.getId();
                col.getVisual(nr).setEffect1(e);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_EFFECT_B:
            try {
                int nr = col.getCurrentVisual();
                tmp = Integer.parseInt(msg[1]);
                Effect e = col.getPixelControllerEffect().getEffect(tmp);
                e.getId();
                col.getVisual(nr).setEffect2(e);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_MIXER:
            try {
                //the new method - used by the gui
                int nr = col.getCurrentVisual();
                tmp = Integer.parseInt(msg[1]);
                Mixer m = col.getPixelControllerMixer().getMixer(tmp);
                m.getId();
                col.getVisual(nr).setMixer(m);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_OUTPUT_VISUAL:
            try {
                int nr = col.getCurrentOutput();
                int newFx = Integer.parseInt(msg[1]);
                int oldFx = col.getFxInputForScreen(nr);
                int nrOfVisual = col.getAllVisuals().size();
                LOG.log(Level.INFO, "old fx: {0}, new fx {1}", new Object[] { oldFx, newFx });
                if (oldFx != newFx && newFx >= 0 && newFx < nrOfVisual) {
                    LOG.log(Level.INFO, "Change Output 0, old fx: {0}, new fx {1}",
                            new Object[] { oldFx, newFx });
                    if (startFader) {
                        //start fader to change screen
                        col.getOutputMappings(nr).getFader().startFade(newFx, nr);
                    } else {
                        //do not fade if we load setting from present
                        col.mapInputToScreen(nr, newFx);
                    }
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_ALL_OUTPUT_VISUAL:
            try {
                int newFx = Integer.parseInt(msg[1]);
                int size = col.getAllOutputMappings().size();
                int nrOfVisual = col.getAllVisuals().size();

                if (newFx >= 0 && newFx < nrOfVisual) {
                    for (int i = 0; i < size; i++) {
                        int oldFx = col.getFxInputForScreen(i);
                        if (oldFx != newFx) {
                            LOG.log(Level.INFO, "Change Output 0, old fx: {0}, new fx {1}",
                                    new Object[] { oldFx, newFx });
                            if (startFader) {
                                //start fader to change screen
                                col.getOutputMappings(i).getFader().startFade(newFx, i);
                            } else {
                                //do not fade if we load setting from present
                                col.mapInputToScreen(i, newFx);
                            }
                        }
                    }
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_OUTPUT_FADER:
            try {
                int nr = col.getCurrentOutput();
                tmp = Integer.parseInt(msg[1]);
                //do not start a new fader while the old one is still running
                if (!col.getOutputMappings(nr).getFader().isStarted()) {
                    Fader f = PixelControllerFader.getFader(tmp);
                    if (f != null) {
                        col.getOutputMappings(nr).setFader(f);
                    }
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_ALL_OUTPUT_FADER:
            try {
                tmp = Integer.parseInt(msg[1]);
                for (OutputMapping om : col.getAllOutputMappings()) {
                    //do not start a new fader while the old one is still running
                    if (!om.getFader().isStarted()) {
                        Fader f = PixelControllerFader.getFader(tmp);
                        if (f != null) {
                            om.setFader(f);
                        }
                    }
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_SHUFFLER_SELECT:
            try {
                int size = col.getPixelControllerShufflerSelect().getShufflerSelect().size();
                if (size > msgLength) {
                    size = msgLength;
                }
                boolean b;
                for (int i = 0; i < size; i++) {
                    b = false;
                    if (msg[i + 1].equals("1")) {
                        b = true;
                    }
                    col.getPixelControllerShufflerSelect().setShufflerSelect(i, b);
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_ROTOZOOM:
            try {
                int val = Integer.parseInt(msg[1]);
                RotoZoom r = (RotoZoom) col.getPixelControllerEffect().getEffect(EffectName.ROTOZOOM);
                r.setAngle(val);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case SAVE_PRESENT:
            try {
                int idxs = col.getSelectedPreset();
                List<String> present = col.getCurrentStatus();
                col.getPresets().get(idxs).setPresent(present);
                col.getPh().savePresents();
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case LOAD_PRESENT:
            try {
                int idxl = col.getSelectedPreset();
                List<String> present = col.getPresets().get(idxl).getPresent();
                if (present != null) {
                    col.setCurrentStatus(present);
                }
                return ValidCommands.STATUS;
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_PRESENT:
            try {
                int a = Integer.parseInt(msg[1]);
                if (a < Collector.NR_OF_PRESET_SLOTS) {
                    col.setSelectedPreset(a);
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_THRESHOLD_VALUE:
            try {
                int a = Integer.parseInt(msg[1]);
                if (a > 255) {
                    a = 255;
                }
                if (a < 0) {
                    a = 0;
                }
                col.getPixelControllerEffect().setThresholdValue(a);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case BLINKEN:
            try {
                String fileToLoad = msg[1];
                col.getPixelControllerGenerator().setFileBlinken(fileToLoad);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case IMAGE:
            try {
                String fileToLoad = msg[1];
                if (StringUtils.isNotBlank(fileToLoad)) {
                    col.getPixelControllerGenerator().setFileImageSimple(fileToLoad);
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case COLOR_SCROLL_OPT:
            try {
                int dir = Integer.parseInt(msg[1]);
                col.getPixelControllerGenerator().setColorScrollingDirection(dir);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case COLOR_FADE_LENGTH:
            try {
                int length = Integer.parseInt(msg[1]);
                col.getPixelControllerGenerator().setColorFadeTime(length);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case COLOR_SCROLL_LENGTH:
            try {
                int length = Integer.parseInt(msg[1]);
                col.getPixelControllerGenerator().setColorScrollingFadeLength(length);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case TEXTDEF:
            try {
                int lut = Integer.parseInt(msg[1]);
                col.getPixelControllerEffect().setTextureDeformationLut(lut);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case TEXTWR:
            try {
                String message = msg[1];
                col.getPixelControllerGenerator().setText(message);
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case RANDOM: //enable or disable random mode
            try {
                String onOrOff = msg[1];
                if (onOrOff.equalsIgnoreCase("ON")) {
                    col.setRandomMode(true);
                    LOG.log(Level.INFO, "Random Mode enabled");
                }
                if (onOrOff.equalsIgnoreCase("OFF")) {
                    col.setRandomMode(false);
                    LOG.log(Level.INFO, "Random Mode disabled");
                    return ValidCommands.STATUS;
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case RANDOMIZE: //one shot randomizer
            try {
                Shuffler.manualShuffleStuff();
                return ValidCommands.STATUS;
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case PRESET_RANDOM: //one shot randomizer, use a pre-stored present
            try {
                Shuffler.presentShuffler();
                return ValidCommands.STATUS;
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CURRENT_VISUAL:
            //change the selected visual, need to update
            //some of the gui elements 
            try {
                int a = Integer.parseInt(msg[1]);
                col.setCurrentVisual(a);
                return ValidCommands.STATUS_MINI;
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CURRENT_OUTPUT:
            //change the selected output, need to update
            //some of the gui elements 
            try {
                int a = Integer.parseInt(msg[1]);
                col.setCurrentOutput(a);
                return ValidCommands.STATUS_MINI;
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        case CHANGE_BRIGHTNESS:
            try {
                int a = Integer.parseInt(msg[1]);
                if (a < 0 || a > 100) {
                    LOG.log(Level.WARNING, IGNORE_COMMAND, "Invalid brightness value: " + a);
                    break;
                } else {
                    float f = a / 100f;
                    col.getPixelControllerGenerator().setBrightness(f);
                }
            } catch (Exception e) {
                LOG.log(Level.WARNING, IGNORE_COMMAND, e);
            }
            break;

        //create a screenshot of all current buffers
        case SCREENSHOT:
            col.saveScreenshot();
            LOG.log(Level.INFO, "Saved some screenshots");
            break;

        //change current colorset
        case CURRENT_COLORSET:
            int newColorSetIndex = Integer.parseInt(msg[1]);
            int nr = col.getCurrentVisual();
            col.getVisual(nr).setColorSet(newColorSetIndex);
            return ValidCommands.STATUS_MINI;

        //pause output, needed to create screenshots or take an image of the output
        case FREEZE:
            Collector.getInstance().togglePauseMode();
            break;

        case OSC_GENERATOR1:
            col.getPixelControllerGenerator().getOscListener1().updateBuffer(blob);
            break;

        case OSC_GENERATOR2:
            col.getPixelControllerGenerator().getOscListener2().updateBuffer(blob);
            break;

        //unkown message
        default:
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < msg.length; i++) {
                sb.append(msg[i]);
                sb.append("; ");
            }
            LOG.log(Level.INFO, "Ignored command <{0}>", sb);
            break;
        }
    } catch (IllegalArgumentException e) {
        LOG.log(Level.INFO, "Illegal argument <{0}>: {1}", new Object[] { msg[0], e });
    }

    return null;
}

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

/**
 * Annotate output that contains ANSI codes and hide raw text.
 */// w w w  . ja v a 2 s .c o  m
@Override
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
    try {
        String colorizedData = colorize(StringEscapeUtils.escapeHtml(this.data), this.getColorMap());
        if (!colorizedData.contentEquals(this.data)) {
            text.addMarkup(charPos, colorizedData);
            text.addMarkup(charPos, charPos + text.getText().length(), "<span style=\"display: none;\">",
                    "</span>");
        }
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to add markup to \"" + text + "\"", e);
    }
    return null;
}

From source file:com.subgraph.vega.impl.scanner.modules.scripting.ResponseProcessorScript.java

@Override
public void processResponse(IScanInstance scanInstance, HttpRequest request, IHttpResponse response,
        IWorkspace workspace) {//from w  w w .  j av  a2 s  .c  o  m
    final ResponseModuleContext ctx = new ResponseModuleContext(workspace, scanInstance);
    try {
        Context cx = Context.enter();
        Scriptable instance = module.createInstanceScope(cx);
        final Object[] arguments = new Object[] { request, createResponse(response, cx, instance), ctx };
        final long startTS = System.currentTimeMillis();
        module.runModule(cx, instance, arguments);
        final long endTS = System.currentTimeMillis();
        runningTime.addTimestamp((int) (endTS - startTS), request.getRequestLine().getUri());
    } catch (WrappedException e) {
        logger.log(Level.WARNING, new RhinoExceptionFormatter(
                "Wrapped exception running module script: " + module.getModuleName(), e).toString());
    } catch (RhinoException e) {
        e.printStackTrace();
        logger.warning(
                new RhinoExceptionFormatter("Exception running module script: " + module.getModuleName(), e)
                        .toString());
    } finally {
        Context.exit();
    }
}