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.nebel_tv.content.wrapper.builders.VideoAssetsBuilder.java

/**
 *
 *//*from  w ww. ja va 2s. co m*/
private void fixVidoURL() {
    if (assets == null) {
        return;
    }

    for (int i = 0; i < assets.length(); i++) {
        try {
            JSONObject item = assets.getJSONObject(i);
            if (item != null) {
                int rate = item.getInt("rate");
                switch (rate) {
                case 80:
                case 212:
                case 185:
                    item.put("URL", "http://54.201.170.111/assets/001-180p-185kb.mp4");
                    break;
                case 450:
                case 600:
                case 686:
                case 750:
                    item.put("URL", "http://54.201.170.111/assets/001-270p-686kb.mp4");
                    break;
                case 1500:
                case 2500:
                case 8000:
                default:
                    item.put("URL", "http://54.201.170.111/assets/001-720p-2500kb.mp4");
                    break;
                }
            }
        } catch (JSONException ex) {
            Logger.getLogger(ConnectionUtils.class.getName()).log(Level.WARNING, null, ex);
        }
    }
}

From source file:com.almende.eve.protocol.jsonrpc.JSONRpcProtocol.java

/**
 * Convert incoming message object to JSONMessage if possible. Returns null
 * if the message can't be interpreted as a JSONMessage.
 * /*from www.j  a v  a 2s .c  o  m*/
 * @param msg
 *            the msg
 * @return the JSON message
 */
public static JSONMessage jsonConvert(final Object msg) {
    JSONMessage jsonMsg = null;
    if (msg == null) {
        LOG.warning("Message null!");
        return null;
    }
    try {
        if (msg instanceof JSONMessage) {
            jsonMsg = (JSONMessage) msg;
        } else {
            ObjectNode json = null;
            if (msg instanceof String) {
                final String message = (String) msg;
                if (message.startsWith("{") || message.trim().startsWith("{")) {

                    json = (ObjectNode) JOM.getInstance().readTree(message);
                }
            } else if (msg instanceof ObjectNode || (msg instanceof JsonNode && ((JsonNode) msg).isObject())) {
                json = (ObjectNode) msg;
            } else {
                LOG.info("Message unknown type:" + msg.getClass());
            }
            if (json != null) {
                if (JSONRpc.isResponse(json)) {
                    final JSONResponse response = new JSONResponse(json);
                    jsonMsg = response;
                } else if (JSONRpc.isRequest(json)) {
                    final JSONRequest request = new JSONRequest(json);
                    jsonMsg = request;
                } else {
                    LOG.info("Message contains valid JSON, but is not JSON-RPC:" + json);
                }
            }
        }
    } catch (final Exception e) {
        LOG.log(Level.WARNING, "Message triggered exception in trying to convert it to a JSONMessage.", e);
    }
    return jsonMsg;
}

From source file:com.symbian.driver.plugins.reboot.Activator.java

public synchronized boolean SwitcthOn() {
    String switchState = "1"; // 1- Immediate On
    try {//from  w ww.j a v a  2 s . c om
        switchOp(switchState);
    } catch (IOException e) {
        LOGGER.log(Level.WARNING, e.getMessage(), e);
        return false;
    }
    return true;
}

From source file:JarClassLoader.java

/** 
 * Adds a jar file from the filesystems into the jar loader list.
 * //  www .j  a va2s . co  m
 * @param jarfile The full path to the jar file.
 */
public void addJarFile(String jarfile) {
    try {
        URL url = new URL("file:" + jarfile);
        addURL(url);
    } catch (IOException ex) {
        Logger.getAnonymousLogger().log(Level.WARNING, "Error adding jar file", ex);
    }
}

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

@Override
public void writeTo(Object value, Class<?> type, Type genericType, Annotation[] annotations,
        MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
        throws IOException {
    try {// w  w w .j a v  a  2s  . c o m
        super.writeTo(value, type, genericType, annotations, mediaType, httpHeaders, entityStream);
    } catch (IOException e) {
        LOGGER.log(Level.WARNING, "Writing entity failed!", e);
        throw e;
    } catch (Exception e) {
        LOGGER.log(Level.WARNING, "Writing entity failed!", e);
        throw new IOException(e);
    }
}

From source file:com.examples.cloud.speech.AsyncRecognizeClient.java

/**
 * Sends a request to the speech API and returns an Operation handle.
 *///w  w w. ja va  2s. c  o  m
public void recognize() {
    RecognitionAudio audio;
    try {
        audio = RecognitionAudioFactory.createRecognitionAudio(this.input);
    } catch (IOException e) {
        logger.log(Level.WARNING, "Failed to read audio uri input: " + input);
        return;
    }
    logger.info("Sending " + audio.getContent().size() + " bytes from audio uri input: " + input);
    RecognitionConfig config = RecognitionConfig.newBuilder().setEncoding(AudioEncoding.LINEAR16)
            .setSampleRate(samplingRate).build();
    AsyncRecognizeRequest request = AsyncRecognizeRequest.newBuilder().setConfig(config).setAudio(audio)
            .build();

    Operation operation;
    Operation status;
    try {
        operation = speechClient.asyncRecognize(request);

        // Print the long running operation handle
        logger.log(Level.INFO,
                String.format("Operation handle: %s, URI: %s", operation.getName(), input.toString()));
    } catch (StatusRuntimeException e) {
        logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
        return;
    }

    while (true) {
        try {
            logger.log(Level.INFO, "Waiting 2s for operation, {0} processing...", operation.getName());
            Thread.sleep(2000);
            GetOperationRequest operationReq = GetOperationRequest.newBuilder().setName(operation.getName())
                    .build();
            status = statusClient
                    .getOperation(GetOperationRequest.newBuilder().setName(operation.getName()).build());

            if (status.getDone()) {
                break;
            }
        } catch (Exception ex) {
            logger.log(Level.WARNING, ex.getMessage());
        }
    }

    try {
        AsyncRecognizeResponse asyncRes = status.getResponse().unpack(AsyncRecognizeResponse.class);

        logger.info("Received response: " + asyncRes);
    } catch (com.google.protobuf.InvalidProtocolBufferException ex) {
        logger.log(Level.WARNING, "Unpack error, {0}", ex.getMessage());
    }
}

From source file:com.titankingdoms.dev.titanchat.format.tag.TagManager.java

/**
 * Registers the {@link Tag}s//from  w  ww  .  j a va2 s .c o m
 * 
 * @param tags The {@link Tag}s to register
 */
public void registerTags(Tag... tags) {
    if (tags == null)
        return;

    for (Tag tag : tags) {
        if (tag == null || tag.getTag().isEmpty())
            continue;

        if (hasTag(tag)) {
            plugin.log(Level.WARNING, "Duplicate tag: " + tag.getTag());
            continue;
        }

        this.tags.put(tag.getTag().toLowerCase(), tag);
        db.debug(Level.INFO, "Registered tag: " + tag.getTag());
    }
}

From source file:com.flagleader.builder.FlagLeader.java

public void checkUpdate() {
    if (BuilderConfig.getInstance().getUpdateUrl().length() > 0)
        try {/*from   w w  w .  ja v  a 2s.c  o  m*/
            StringBuffer localStringBuffer = new StringBuffer();
            JspUtil.readUrl(BuilderConfig.getInstance().getUpdateUrl(), localStringBuffer);
        } catch (Exception localException) {
            Logger.getLogger("flagleader").log(Level.WARNING, localException.getLocalizedMessage());
        }
}

From source file:ca.sfu.federation.action.CreateAssemblyAction.java

/**
 * Perform action./*from   ww w .j a va2s .c  o  m*/
 * @param e Action event.
 */
public void actionPerformed(ActionEvent e) {
    if (context != null) {
        try {
            String name = context.getNextName(Assembly.DEFAULT_NAME);
            Assembly assembly = new Assembly(name);
            assembly.registerInContext(context);
        } catch (Exception ex) {
            String stack = ExceptionUtils.getFullStackTrace(ex);
            logger.log(Level.WARNING, "{0}", stack);
        }
    }
}

From source file:com.almende.eve.protocol.jsonrpc.formats.JSONRequest.java

/**
 * Create a JSONRequest from a java method and arguments.
 *
 * @param method/*from   w ww  .j a  va 2s .  c  o m*/
 *            the method
 * @param args
 *            the args
 * @param callback
 *            the callback
 */
public <T> JSONRequest(final Method method, final Object[] args, final AsyncCallback<T> callback) {
    AnnotatedMethod annotatedMethod = null;
    try {
        annotatedMethod = new AnnotationUtil.AnnotatedMethod(method);
    } catch (final Exception e) {
        LOG.log(Level.WARNING, "Method can't be used as annotated method", e);
        throw new IllegalArgumentException(
                "Method '" + method.getName() + "' can't be used as annotated method.", e);
    }
    final List<AnnotatedParam> annotatedParams = annotatedMethod.getParams();

    final ObjectNode params = JOM.createObjectNode();

    for (int i = 0; i < annotatedParams.size(); i++) {
        final AnnotatedParam annotatedParam = annotatedParams.get(i);
        if (i < args.length && args[i] != null) {
            final Name nameAnnotation = annotatedParam.getAnnotation(Name.class);
            if (nameAnnotation != null && nameAnnotation.value() != null) {
                final String name = nameAnnotation.value();
                final JsonNode paramValue = JOM.getInstance().valueToTree(args[i]);
                params.set(name, paramValue);
            } else {
                throw new IllegalArgumentException("Parameter " + i + " in method '" + method.getName()
                        + "' is missing the @Name annotation.");
            }
        } else if (isRequired(annotatedParam)) {
            throw new IllegalArgumentException(
                    "Required parameter " + i + " in method '" + method.getName() + "' is null.");
        }
    }
    JsonNode id = null;
    try {
        id = JOM.getInstance().valueToTree(new UUID().toString());
    } catch (final Exception e) {
        LOG.log(Level.SEVERE, "Failed to generate UUID for request", e);
    }
    init(id, method.getName(), params, callback);
}