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:net.erdfelt.android.sdkfido.configer.Configer.java

public Configer(Object o) {
    this.obj = o;
    this.bub = BeanUtilsBean.getInstance();

    // Setup default persistent storage file
    this.persistFile = new File(RC_DIR, "config.properties");

    // Load descriptive definitions
    try {/*from  w  ww  .  ja v a  2s  .co  m*/
        defsBundle = ResourceBundle.getBundle(o.getClass().getName());
        Enumeration<String> keys = defsBundle.getKeys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            if (key.startsWith("scope.")) {
                String scope = key.substring("scope.".length());
                scopes.add(scope);
            }
        }
    } catch (MissingResourceException e) {
        LOG.log(Level.WARNING, e.getMessage(), e);
    }

    // Identify all of the configurable fields
    walkFields(null, o.getClass(), null);

    // Identify the method to use for accepting raw arguments
    findRawArgsMethod(o.getClass());
}

From source file:co.runrightfast.incubator.rx.impl.ObservableRingBufferImpl.java

@Override
protected void shutDown() {
    if (this.disruptor != null) {
        for (int i = 1; true; i++) {
            final int waitTimeSecs = 10;
            try {
                this.disruptor.shutdown(waitTimeSecs, TimeUnit.SECONDS);
                break;
            } catch (final TimeoutException ex) {
                log.logp(Level.WARNING, CLAZZ, "shutDown", "waiting for disruptor to shutdown : {0} secs",
                        i * waitTimeSecs);
            }//ww w.  j a v  a 2 s .  c  om
        }
    }

    if (this.subscribers != null) {
        this.subscribers.stream().filter(this::isSubscribed).forEach(subscriber -> subscriber.onCompleted());
    }

    this.disruptor = null;
    this.ringBuffer = null;
    this.subscribers.clear();
}

From source file:com.oic.event.SetProfile.java

@Override
public void ActionEvent(JSONObject json, WebSocketListener webSocket) {
    JSONObject responseJSON = new JSONObject();
    responseJSON.put("method", "setprofile");
    if (!validation(json, webSocket)) {
        return;/*  www  .  j a  v a2  s  . c om*/
    }
    Connection con = DatabaseConnection.getConnection();
    PreparedStatement ps;
    try {
        con = DatabaseConnection.getConnection();
        con.setAutoCommit(false);
        String sql = "UPDATE user SET studentnumber = ?, name = ?, avatarid = ?, grade = ?, sex = ?, birth = ?, comment = ? "
                + "WHERE userid = ?";
        ps = con.prepareStatement(sql);
        ps.setString(1, json.get("studentid").toString());
        ps.setString(2, json.get("username").toString());
        ps.setInt(3, Integer.parseInt(json.get("avatarid").toString()));
        ps.setInt(4, Integer.parseInt(json.get("grade").toString()));
        ps.setInt(5, Integer.parseInt(json.get("gender").toString()));
        ps.setDate(6, toDate(json.get("birthday").toString()));
        ps.setString(7, json.get("comment").toString());
        ps.setLong(8, webSocket.getCharacter().getUserId());
        ps.executeUpdate();
        ps.close();

        sql = "UPDATE setting SET privategrade = ?, privatesex = ?, privatebirth =? WHERE userid = ?";
        ps = con.prepareStatement(sql);
        ps.setInt(1, Integer.parseInt(json.get("vgrade").toString()));
        ps.setInt(2, Integer.parseInt(json.get("vgender").toString()));
        ps.setInt(3, Integer.parseInt(json.get("vbirthday").toString()));
        ps.setLong(4, webSocket.getCharacter().getUserId());

        ps.executeUpdate();
        ps.close();

        con.commit();

        //TODO 
        responseJSON.put("status", 0);
    } catch (Exception e) {
        try {
            con.rollback();
        } catch (SQLException sq) {
            LOG.warning("[setProfile]Error Rolling back.");
        }
        e.printStackTrace();
        responseJSON.put("status", 1);
    } finally {
        try {
            con.setAutoCommit(true);
        } catch (SQLException ex) {
            Logger.getLogger(SetProfile.class.getName()).log(Level.WARNING,
                    "Error going back to AutoCommit mode", ex);
        }
    }

    webSocket.sendJson(responseJSON);
}

From source file:esmska.gui.AboutFrame.java

/** Same as JXHyperlink.setURI(), but don't throw exception */
private void setURI(JXHyperlink jXHyperlink, URI uri) {
    try {//from w  w w.j  a v  a  2 s  . c  o m
        jXHyperlink.setURI(uri);
    } catch (UnsupportedOperationException ex) {
        logger.log(Level.WARNING, "System does not support Desktop API, this URI won't work: " + uri, ex);
    }
}

From source file:uk.trainwatch.util.config.impl.HttpConfiguration.java

private synchronized void loadConfiguration() {
    if (configuration == null) {
        // Don't write uri as is as we may expose security details
        LOG.log(Level.INFO,//from   w ww  .  j av a  2 s .  co m
                () -> "Retrieving config " + uri.getScheme() + "://" + uri.getHost() + uri.getPath());

        try (CloseableHttpClient client = HttpClients.createDefault()) {
            int retry = 0;
            do {
                try {
                    if (retry > 0) {
                        LOG.log(Level.INFO, "Sleeping {0}ms attempt {1}/{2}",
                                new Object[] { RETRY_DELAY, retry, MAX_RETRY });
                        Thread.sleep(RETRY_DELAY);
                    }
                    HttpGet get = new HttpGet(uri);
                    get.setHeader("User-Agent", "Area51 Configuration/1.0");

                    try (CloseableHttpResponse response = client.execute(get)) {
                        switch (response.getStatusLine().getStatusCode()) {
                        case 200:
                        case 304:
                            try (InputStream is = response.getEntity().getContent()) {
                                try (JsonReader r = Json.createReader(new InputStreamReader(is))) {
                                    configuration = new MapConfiguration(
                                            MapBuilder.fromJsonObject(r.readObject()).build());
                                    return;
                                }
                            }

                        default:
                            LOG.log(Level.WARNING, () -> "Error " + uri.getScheme() + "://" + uri.getHost()
                                    + uri.getPath() + " " + response.getStatusLine().getStatusCode());
                        }
                    }
                } catch (ConnectException ex) {
                    if (retry < MAX_RETRY) {
                        LOG.log(Level.WARNING, () -> "Failed " + ex.getMessage());
                    } else {
                        throw ex;
                    }
                } catch (InterruptedException ex) {
                    LOG.log(Level.SEVERE, null, ex);
                }

                retry++;
            } while (retry < MAX_RETRY);
        } catch (IOException ex) {
            throw new UncheckedIOException(ex);
        }

        configuration = EmptyConfiguration.INSTANCE;
    }
}

From source file:com.bbva.arq.devops.ae.mirrorgate.jenkins.plugin.listener.MirrorGateListenerHelper.java

public void sendBuildFromJob(Job job, TaskListener listener) {
    if (job != null && job.getLastBuild() != null) {
        BuildStatus status = job.isBuildable() ? (job.getLastBuild().getResult() != null
                ? BuildStatus.fromString(job.getLastBuild().getResult().toString())
                : BuildStatus.InProgress) : BuildStatus.Deleted;
        BuildBuilder builder = new BuildBuilder(job.getLastBuild(), status);
        MirrorGateResponse response = getMirrorGateService().publishBuildData(builder.getBuildData());

        String msg;//from  www .  ja va 2s  . c  o m
        Level level;
        if (response.getResponseCode() == HttpStatus.SC_CREATED) {
            msg = "MirrorGate: Published Build Complete Data. " + response.toString();
            level = Level.FINE;
        } else {
            msg = "MirrorGate: Build Status could not been sent to MirrorGate. Please contact with "
                    + "MirrorGate Team for further information (mirrorgate.group@bbva.com).";
            level = Level.WARNING;
        }

        if (listener != null && level == Level.FINE) {
            listener.getLogger().println("Follow this project's builds progress at: "
                    + createMirrorgateLink(builder.getBuildData().getProjectName()));

            listener.getLogger().println(msg);
        }
        LOG.log(level, msg);

        sendBuildExtraData(builder, listener);
    }
}

From source file:com.opera.core.systems.scope.AbstractService.java

/**
 * Query a collection with JXPath and return value of node
 *
 * @param collection/* w ww  .  j ava2  s  .  c om*/
 * @param query a valid XPath query
 * @return result
 */
public Object xpathQuery(Collection<?> collection, String query) {
    JXPathContext pathContext = JXPathContext.newContext(collection);
    Object result = null;
    try {
        result = pathContext.getValue(query);
    } catch (JXPathNotFoundException e) {
        logger.log(Level.WARNING, "JXPath exception: {0}", e.getMessage());
    }
    return result;
}

From source file:com.oic.net.WebSocketListener.java

/**
 * ????//from w w w  .ja  va2 s  .  co m
 *
 * @param method
 * @param json
 * @param webSocketListener
 */
public void selectMessage(String method, JSONObject json, WebSocketListener webSocketListener) {
    if (method == null) { //??????
        LOG.log(Level.WARNING, "Message Method is NULL : {0}", json.toString());
        return;
    } else if (method.equals("cmd")) {
        //   new CmdEvent().ActionEvent(json, webSocketListener);
    } else if ((login == LoginStatus.NOLOGIN || login == LoginStatus.REGISTER)
            && method.equals("duplication")) {
        /* ????Status?REGISTER?? */
        new CheckDuplication().ActionEvent(json, webSocketListener);
    } else if (login == LoginStatus.NOLOGIN && method.equals("login")) {
        /*  */
        new LoginHandler().ActionEvent(json, webSocketListener);
        //new LoginHandler().ActionEvent(json, this);//?
    } else if (login == LoginStatus.REGISTER && method.equals("setprofile")) {
        /* ????? */
        new RegisterProfile().ActionEvent(json, webSocketListener);
    } else if (login == LoginStatus.LOGIN) {
        LoginEvent.execEvent(method, json, webSocketListener);
    }
}

From source file:puma.sp.authentication.controllers.authentication.AccessController.java

@RequestMapping(value = "/ServiceAccessServlet", method = RequestMethod.GET)
public String accessService(@RequestParam(value = "RelayState", defaultValue = "") String relayState,
        @RequestParam(value = "Tenant", defaultValue = "") String tenantIdentifier,
        @RequestParam(value = "Post", defaultValue = "false") Boolean post, ModelMap model,
        HttpSession session) {/*from   w w w . j a  v a  2 s . c o m*/
    session.setAttribute("Post", post);
    if (session.getAttribute("Authenticated") == null
            || !((Boolean) session.getAttribute("Authenticated")).booleanValue()) {
        session.removeAttribute("Tenant");
        // Ensure relay state is in place
        session.setAttribute("RelayState", relayState);
        this.ensureRelayState(session);
        // Tenant Identifier
        Tenant tenantObject = null;
        if (tenantIdentifier == null || tenantIdentifier.isEmpty()) {
            session.setAttribute("FlowRedirectionElement", new FlowDirecter("/SubmitWAYF"));
            return "redirect:/";
        } else {
            tenantObject = this.tenantService.findOne(Long.parseLong(tenantIdentifier));
            if (tenantObject == null) {
                logger.log(Level.WARNING, "Could not find tenant with identifier " + tenantIdentifier);
                MessageManager.getInstance().addMessage(session, "info",
                        "Could not find any tenant with identifier " + tenantIdentifier);
                session.setAttribute("FlowRedirectionElement", new FlowDirecter("/SubmitWAYF"));
                return "redirect:/";
            }
        }
        session.setAttribute("Tenant", tenantObject);
        // Redirect to next flow element
        return "redirect:/AuthenticationRequestServlet";
    } else {
        // Subject is already authenticated
        if (relayState != null && !relayState.isEmpty())
            session.setAttribute("RelayState", relayState);
        return "redirect:/AuthenticationResponseServlet";
    }
}

From source file:hudson.plugins.copyartifact.ParameterizedBuildSelector.java

/**
 * Expand the parameter and resolve it to a xstream expression.
 * <ol>/* w w  w . jav a 2s .c om*/
 *   <li>Considers an immediate value if contains '&lt;'.
 *       This is expected to be used in especially in workflow jobs.</li>
 *   <li>Otherwise, considers a variable expression if contains '$'.
 *       This is to keep the compatibility of usage between workflow jobs and non-workflow jobs.</li>
 *   <li>Otherwise, considers a variable name.</li>
 * </ol>
 * 
 * @param env
 * @return xstream expression.
 */
private String resolveParameter(EnvVars env) {
    if (StringUtils.isBlank(getParameterName())) {
        LOG.log(Level.WARNING, "Parameter name is not specified");
        return null;
    }
    if (getParameterName().contains("<")) {
        LOG.log(Level.FINEST, "{0} is considered a xstream expression", getParameterName());
        return getParameterName();
    }
    if (getParameterName().contains("$")) {
        LOG.log(Level.FINEST, "{0} is considered a variable expression", getParameterName());
        return env.expand(getParameterName());
    }
    String xml = env.get(getParameterName());
    if (xml == null) {
        LOG.log(Level.WARNING, "{0} is not defined", getParameterName());
    }
    return xml;
}