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.moneydance.modules.features.importlist.io.DeleteOneOperation.java

@Override
public void execute(final List<File> files) {
    final File file = files.iterator().next();
    // ESCA-JAVA0166: IOException, SecurityException
    try {/*from   w  ww  . j  a  v  a2s .c  o m*/
        LOG.info(String.format("Deleting file %s", file.getAbsoluteFile()));
        FileUtils.forceDelete(file);
    } catch (Exception e) { // $codepro.audit.disable caughtExceptions
        LOG.log(Level.WARNING, e.getMessage(), e);
        final String errorMessage = this.localizable.getErrorMessageDeleteFile(file.getName());
        final Object errorLabel = new JLabel(errorMessage);
        JOptionPane.showMessageDialog(null, // no parent component
                errorLabel, null, // no title
                JOptionPane.ERROR_MESSAGE);
    }
}

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

/** Send a non-streaming-recognize request to server. */
public void recognize() {
    RecognitionAudio audio;//from  w ww . j  a v a 2 s  .co  m
    try {
        audio = createRecognitionAudio();
    } 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();
    SyncRecognizeRequest request = SyncRecognizeRequest.newBuilder().setConfig(config).setAudio(audio).build();

    SyncRecognizeResponse response;
    try {
        response = speechClient.syncRecognize(request);
    } catch (StatusRuntimeException e) {
        logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
        return;
    }
    logger.info("Received response: " + TextFormat.printToString(response));
}

From source file:com.groupon.jenkins.dotci.notifiers.WebhookNotifier.java

@Override
protected boolean notify(DynamicBuild build, BuildListener listener) {
    Map<String, ?> options = (Map<String, ?>) getOptions();
    HttpClient client = getHttpClient();
    String requestUrl = (String) options.get("url");
    PostMethod post = new PostMethod(requestUrl);

    Map<String, String> payload = (Map<String, String>) options.get("payload");
    ObjectMapper objectMapper = new ObjectMapper();

    try {//from   www  .  ja  va2 s  .  c  om
        String payloadJson = objectMapper.writeValueAsString(payload);
        StringRequestEntity requestEntity = new StringRequestEntity(payloadJson, "application/json", "UTF-8");
        post.setRequestEntity(requestEntity);
        int statusCode = client.executeMethod(post);
        listener.getLogger().println(
                "Posted Paylod " + payloadJson + " to " + requestUrl + " with response code " + statusCode);
    } catch (Exception e) {
        listener.getLogger().print("Failed to make a POST to webhook. Check Jenkins logs for exceptions.");
        LOGGER.log(Level.WARNING, "Error posting to webhook", e);
        return false;
    } finally {
        post.releaseConnection();
    }
    return false;
}

From source file:com.dawg6.web.dhcalc.server.FileLoadServlet.java

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    try {/* ww  w.j  a  va  2s  .  com*/

        MultipartParser parser = new MultipartParser(req, Integer.MAX_VALUE);

        Part part = parser.readNextPart();

        if (part == null) {
            log.severe("No First Part");
        } else {

            String client = null;
            FormData data = null;

            while (part != null) {
                //               log.info("Found part " + part.getName());

                if (part instanceof FilePart) {
                    FilePart file = ((FilePart) part);
                    InputStream stream = file.getInputStream();
                    ObjectMapper mapper = new ObjectMapper();

                    try {
                        data = mapper.reader(FormData.class).readValue(stream);
                    } catch (Exception e) {
                        log.log(Level.WARNING, "Exception parsing FormData", e);
                    }
                } else if (part instanceof ParamPart) {
                    client = ((ParamPart) part).getStringValue();
                } else {
                    log.info("Skipping part of type " + part.getClass().getName());
                }

                part = parser.readNextPart();
            }

            //            log.info("Done with parts");

            String key = client + ".FormData";

            if (client == null) {
                log.severe("No client Key");
            } else if (data == null) {
                log.severe("No FormData");
                ClientBuffer.getInstance().put(key, new FormData());
            } else {
                //               log.info("Created Client Buffer " + key + " = " + data);

                ClientBuffer.getInstance().put(key, data);
            }

        }

    } catch (Exception e) {
        log.log(Level.SEVERE, "Exception", e);
    }
}

From source file:com.groupon.jenkins.dotci.notifiers.HipchatNotifier.java

@Override
public boolean notify(DynamicBuild build, BuildListener listener) {
    List rooms = getRooms();//from  w w w .ja va  2  s. co m
    listener.getLogger().println("sending hipchat notifications");
    for (Object roomId : rooms) {
        HttpClient client = getHttpClient();
        String url = "https://api.hipchat.com/v1/rooms/message?auth_token=" + getHipchatConfig().getToken();
        PostMethod post = new PostMethod(url);
        String urlMsg = " (<a href='" + build.getFullUrl() + "'>Open</a>)";

        try {
            post.addParameter("from", "CI");
            post.addParameter("room_id", roomId.toString());
            post.addParameter("message", getNotificationMessage(build, listener) + " " + urlMsg);
            post.addParameter("color", getColor(build, listener));
            post.addParameter("notify", shouldNotify(getColor(build, listener)));
            post.getParams().setContentCharset("UTF-8");
            client.executeMethod(post);
        } catch (Exception e) {
            listener.getLogger()
                    .print("Failed to send hipchat notifications. Check Jenkins logs for exceptions.");
            LOGGER.log(Level.WARNING, "Error posting to HipChat", e);
        } finally {
            post.releaseConnection();
        }
    }
    return true;
}

From source file:cz.cas.lib.proarc.common.config.Catalogs.java

private static boolean isValidProperty(String prefix, String name, String value) {
    if (value == null || value.isEmpty()) {
        LOG.log(Level.WARNING, "Missing {0}.{1} property!", new Object[] { prefix, name });
        return false;
    }/*from  w ww . j  ava2  s.  c  o m*/
    return true;
}

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

/**
 * Perform action./*from   ww  w  .  j a  v a  2 s  .  c o  m*/
 * @param e Event.
 */
public void actionPerformed(ActionEvent e) {
    ParametricModel model = Application.getContext().getModel();
    if (model != null) {
        String name = model.getNextName(Scenario.DEFAULT_NAME);
        Scenario scenario = new Scenario(name);
        try {
            scenario.registerInContext(model);
        } catch (Exception ex) {
            String stack = ExceptionUtils.getFullStackTrace(ex);
            logger.log(Level.WARNING, "{0}", stack);
        }
    } else {
        logger.log(Level.WARNING, "Could not create new scenario because model does not exist");
    }
}

From source file:de.hofuniversity.iisys.neo4j.websock.query.encoding.safe.TSafeDeflateJsonQueryHandler.java

public TSafeDeflateJsonQueryHandler(final String compression) {
    fLogger = Logger.getLogger(this.getClass().getName());
    fDebug = (fLogger.getLevel() == Level.FINEST);

    int tmpComp = DEFAULT_COMPRESSION_LEVEL;

    if (WebsockConstants.FASTEST_COMPRESSION.equals(compression)) {
        tmpComp = Deflater.BEST_SPEED;
    } else if (WebsockConstants.BEST_COMPRESSION.equals(compression)) {
        tmpComp = Deflater.BEST_COMPRESSION;
    } else {/*  ww w.  ja  v  a2 s.c  o m*/
        fLogger.log(Level.WARNING, "unknown compression level '" + compression + "'; using default.");
    }

    fCompression = tmpComp;
}

From source file:fitnesse.FitNesseExpediter.java

@Override
public void close() {
    log(socket, request, response);/*from   w  ww  .j a  v  a 2 s .  com*/
    if (!socket.isClosed()) {
        try {
            socket.close();
        } catch (IOException e) {
            LOG.log(Level.WARNING, "Error while closing socket", e);
        }
    }
}

From source file:org.gvnix.dynamic.configuration.roo.addon.config.XpathElementsDynamicConfiguration.java

/**
 * {@inheritDoc}/*w  w w .j  a  v a  2 s .c o  m*/
 */
@Override
public DynPropertyList read() {

    DynPropertyList dynProps = new DynPropertyList();

    // Get the XML file path
    MutableFile file = getFile();

    // If managed file not exists, nothing to do
    if (file != null) {

        // Obtain the XML file on DOM document format
        Document doc = getXmlDocument(file);

        // Obtain all xpath elements
        List<Element> elems = XmlUtils.findElements(getXpath(), doc.getDocumentElement());
        for (Element elem : elems) {

            // Create dynamic property with key and value elements
            Element key = XmlUtils.findFirstElement(getKey(), elem);
            Element value = XmlUtils.findFirstElement(getValue(), elem);
            if (key == null || value == null) {

                logger.log(Level.WARNING, "Element " + elem + " to get not exists on file");
                continue;
            }
            dynProps.add(new DynProperty(setKeyValue(key.getTextContent()), value.getTextContent()));
        }
    }

    return dynProps;
}