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.auraframework.integration.test.configuration.JettyTestServletConfig.java

public JettyTestServletConfig() throws Exception {
    String host;/*ww  w . j  a  va 2 s  .  com*/
    int port;
    boolean spawnJetty = Boolean.parseBoolean(System.getProperty("jetty.spawn", "false"));
    if (spawnJetty) {
        Server server = AuraJettyServer.getInstance();
        Connector connector = server.getConnectors()[0];
        port = connector.getPort();
        host = connector.getHost();
        if (host == null) {
            try {
                host = getHost();
            } catch (UnknownHostException e) {
                LOG.log(Level.WARNING, e.toString(), e);
                host = "localhost";
            }
        }
        LOG.info(String.format("Starting Jetty on %s:%s", host, port));
        server.start();
    } else {
        port = Integer.parseInt(System.getProperty("jetty.port", "9090"));
        host = System.getProperty("jetty.host");
        if (host == null) {
            try {
                host = getHost();
            } catch (UnknownHostException e) {
                LOG.log(Level.WARNING, e.toString(), e);
                host = "localhost";
            }
        }
    }
    baseUrl = new URL("http", host, port, "/");
    LOG.info("BaseUrl: " + baseUrl);
}

From source file:ca.craigthomas.visualclassifier.commandline.TrainCommand.java

/**
 * Load data from a directory. Assumes that all samples are images.
 * The truth value indicates whether it is a positive or negative sample.
 * //  w  ww .jav a 2s.c o m
 * @param directory the directory to load images from
 * @param truth whether the samples are positive or negative
 */
public void loadFromDirectory(File directory, double truth) {
    File[] files = directory.listFiles();
    for (File file : files) {
        String filename = file.getAbsolutePath();
        Image image = new Image(filename);

        if (image.getWidth() != arguments.requiredWidth || image.getHeight() != arguments.requiredHeight) {
            LOGGER.log(Level.WARNING,
                    "file " + filename + " not correct size, skipping (want " + arguments.requiredWidth + "x"
                            + arguments.requiredHeight + ", got " + image.getWidth() + "x" + image.getHeight()
                            + ")");
        } else {
            if (arguments.color) {
                mDataSet.addSample(image.convertColorToMatrix(truth));
            } else {
                mDataSet.addSample(image.convertGrayscaleToMatrix(truth));
            }
        }
    }
}

From source file:com.groupon.jenkins.github.CommitStatusUpdateRunListener.java

@Override
public void onStarted(final DynamicBuild build, final TaskListener listener) {
    final GHRepository repository = getGithubRepository(build);

    try {/*from w  ww  .j av a 2  s  . c o m*/
        String url = "";
        try {
            url = build.getFullUrl();
        } catch (final Exception e) {
            // do nothing
        }
        repository.createCommitStatus(build.getSha(), GHCommitState.PENDING, url, "Build in progress",
                getContext(build));
    } catch (final Exception e) {
        // Ignore if cannot create a pending status
        LOGGER.log(Level.WARNING, "Failed to Update commit status", e);
        printErrorToBuildConsole(listener, e);
    }
}

From source file:org.osiam.auth.exception.OsiamExceptionHandler.java

@ExceptionHandler(value = { ResourceNotFoundException.class })
@ResponseStatus(HttpStatus.NOT_FOUND)/*from   w w w . ja va2 s.  c o m*/
protected @ResponseBody JsonErrorResult handleResourceNotFound(HttpServletRequest request,
        HttpServletResponse response, ResourceNotFoundException e) {
    LOGGER.log(Level.WARNING, "A ResourceNotFoundException occurred", e);
    JsonErrorResult error = new JsonErrorResult(HttpStatus.NOT_FOUND.name(), e.getMessage());
    return error;
}

From source file:com.elusive_code.newsboy.EventNotifierTask.java

@Override
protected Object compute() {
    try {/*w  w w. j  a  va 2  s .c o  m*/
        return eventHandler.handleEvent(event, source);
    } catch (WeakReferenceCollectedException ex) {
        LOG.log(Level.WARNING, ex.getMessage());
        completeExceptionally(ex);
        return null;
    } catch (Throwable ex) {
        LOG.log(Level.WARNING, "Failed to invoke " + eventHandler + " with " + event + "\n", ex);
        updateStackTrace(ex);
        completeExceptionally(ex);
        return null;
    }
}

From source file:CraftAPI.java

/**
 * Construct the object./*from  w w  w .  j  a va  2  s  . co m*/
 */
public CraftAPI() {
    eventDispatcher = new EventDispatcher();
    listener = new CraftAPIListener(eventDispatcher);

    try {
        System.setOut(new PrintStream(new CopyingEventOuputStream(System.out, eventDispatcher)));
        System.setErr(new PrintStream(new CopyingEventOuputStream(System.err, eventDispatcher)));
        // Logger.GLOBAL_LOGGER_NAME doesn't seem to work
        Logger.getLogger("Minecraft").addHandler(new LoggingEventHandler(eventDispatcher, new LogFormat()));
    } catch (Throwable t) {
        logger.log(Level.WARNING, "CraftAPI: Could not redirect stdout/stderr");
        t.printStackTrace();
    }
}

From source file:com.google.walkaround.wave.server.rpc.ClientExceptionHandler.java

private void handleData(String raw) throws JSONException {
    log.info("raw data: " + raw);
    JSONObject data = new JSONObject(raw);
    Level level = "SEVERE".equals(data.getString("level")) ? Level.SEVERE : Level.WARNING;
    StringBuilder b = new StringBuilder();
    b.append("[" + data.getString("stream") + ":" + data.getLong("timestamp") + "] ");
    JSONArray objects = data.getJSONArray("objects");
    for (int i = 0; i < objects.length(); i++) {
        b.append(objects.getString(i));/*from ww w  . j a v  a2 s . c  o  m*/
    }
    ClientException ex = null;
    if (data.has("exception")) {
        ex = buildException(data.getJSONObject("exception"), data.getString("strongName"));
    }
    log.log(level, b.toString(), ex);
}

From source file:net.daboross.bukkitdev.skywars.util.CrossVersion.java

/**
 * Supports Bukkit earlier than 1.6. TODO: removable?
 *//*from w  w w .  ja v a2s.co m*/
public static void setHealth(Damageable d, double health) {
    Validate.notNull(d, "Damageable cannot be null");
    try {
        d.setHealth(health);
    } catch (NoSuchMethodError ignored) {
        Class<? extends Damageable> dClass = d.getClass();
        try {
            Method healthMethod = dClass.getMethod("setHealth", Integer.TYPE);
            healthMethod.invoke(d, (int) health);
        } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException
                | InvocationTargetException ex) {
            SkyStatic.getLogger().log(Level.WARNING, "Couldn't find / use .setHealth method of LivingEntity!",
                    ex);
        }
    }
}

From source file:org.tomitribe.tribestream.registryng.service.serialization.CustomJacksonJaxbJsonProvider.java

@Override
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType,
        MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException {
    try {/*  w  w  w  .  j av a 2  s .  c o  m*/
        return super.readFrom(type, genericType, annotations, mediaType, httpHeaders, entityStream);
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Reading entity failed!", e);
        throw new WebApplicationException(Response.Status.BAD_REQUEST);
    }
}

From source file:com.subgraph.vega.impl.scanner.forms.FormProcessingState.java

private URI createTargetURI() {
    if (baseURI == null)
        return null;
    if (action == null)
        return baseURI;
    try {/*from  ww w  .j ava  2s  . c  o m*/
        final URI target = baseURI.resolve(action);
        final String scheme = target.getScheme();
        if (scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("https"))
            return target;
        else
            return null;
    } catch (IllegalArgumentException e) {
        logger.log(Level.WARNING, "Failed to create new URI from base: " + baseURI + " and action=" + action,
                e);
        return null;
    }
}