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:io.grpc.alts.CheckGcpEnvironment.java

private static boolean isRunningOnGcp() {
    try {/*from   w w w  .j av a 2s  .  com*/
        if (SystemUtils.IS_OS_LINUX) {
            // Checks GCE residency on Linux platform.
            return checkProductNameOnLinux(Files.newBufferedReader(Paths.get(DMI_PRODUCT_NAME), UTF_8));
        } else if (SystemUtils.IS_OS_WINDOWS) {
            // Checks GCE residency on Windows platform.
            Process p = new ProcessBuilder().command(WINDOWS_COMMAND, "Get-WmiObject", "-Class", "Win32_BIOS")
                    .start();
            return checkBiosDataOnWindows(new BufferedReader(new InputStreamReader(p.getInputStream(), UTF_8)));
        }
    } catch (IOException e) {
        logger.log(Level.WARNING, "Fail to read platform information: ", e);
        return false;
    }
    // Platforms other than Linux and Windows are not supported.
    return false;
}

From source file:com.levalo.contacts.view.ContactView.java

public void doGetContact(Contact contact) {
    try {//from  www.jav a2  s.  c om
        this.contact = contactService.getContactById(contact);
    } catch (ServiceException ex) {
        logger.log(Level.WARNING, ex.getMessage());
    }
}

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

/**
 * Handle action performed event.//  w ww . j  a  va  2s  .  c  om
 * @param ae Event
 */
public void actionPerformed(ActionEvent ae) {
    try {
        URI uri = new URI(ApplicationContext.PROJECT_WEBSITE_URL);
        // open the default web browser for the HTML page
        logger.log(Level.INFO, "Opening desktop browser to {0}", uri.toString());
        Desktop.getDesktop().browse(uri);
    } catch (Exception ex) {
        String stack = ExceptionUtils.getFullStackTrace(ex);
        logger.log(Level.WARNING, "Could not open browser for URL {0}\n\n{1}",
                new Object[] { ApplicationContext.PROJECT_WEBSITE_URL, stack });
    }
}

From source file:com.moneydance.modules.features.importlist.io.DefaultDirectoryChooser.java

@Override
void chooseBaseDirectory() {
    final JFileChooser fileChooser = new JFileChooser();
    fileChooser.setDialogTitle(this.getLocalizable().getDirectoryChooserTitle());
    fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    // disable the "All files" option.
    fileChooser.setAcceptAllFileFilterUsed(false);

    try {/*from w w  w . ja v  a2s . c o m*/
        fileChooser.setCurrentDirectory(FileUtils.getUserDirectory());
    } catch (SecurityException e) {
        LOG.log(Level.WARNING, e.getMessage(), e);
    }

    if (this.getBaseDirectory() != null) {
        final File parentDirectory = this.getBaseDirectory().getParentFile();
        fileChooser.setCurrentDirectory(parentDirectory);
    }

    if (fileChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
        return;
    }

    this.getPrefs().setBaseDirectory(fileChooser.getSelectedFile().getAbsolutePath());

    LOG.info(String.format("Base directory is %s", this.getPrefs().getBaseDirectory()));
}

From source file:com.thecoderscorner.groovychart.chart.BaseChart.java

/**
 * Creates a new instance of BaseChart//ww  w.j a va 2  s. c om
 */
protected BaseChart() {
    try {
        setBeanClass(this.getClass());
        bb.setBeanClass(JFreeChart.class);
    } catch (IntrospectionException ex) {
        logger.log(Level.WARNING, ex.getMessage(), ex);
    }
}

From source file:org.gameontext.regsvc.db.RegistrationRepository.java

@PostConstruct
protected void postConstruct() {
    // Create an ObjectMapper for marshalling responses back to REST clients
    mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    try {//w w w  .  j a  v a  2 s . c  o m
        // Ensure required views exist
        registrations = new RegistrationDocuments(db);

    } catch (Exception e) {
        // Log the warning, and then re-throw to prevent this class from going into service,
        // which will prevent injection to the Health check, which will make the app stay down.
        Log.log(Level.WARNING, this, "Unable to connect to database", e);
        throw e;
    }
}

From source file:com.almende.eve.state.redis.RedisState.java

@Override
public Object remove(String key) {
    final Jedis redis = provider.getInstance();
    final String nkey = makeKey(key);

    JsonNode res = JOM.createNullNode();
    try {/*from  ww w . ja  va  2 s  .  co m*/
        res = JOM.getInstance().readTree(redis.get(nkey));
    } catch (JsonProcessingException e) {
        LOG.log(Level.WARNING, "Couldn't read:" + nkey, e);
    } catch (IOException e) {
        LOG.log(Level.WARNING, "Couldn't read:" + nkey, e);
    }
    redis.del(nkey);

    provider.returnInstance(redis);
    return res;
}

From source file:net.openhft.chronicle.logger.jul.JulTestBase.java

protected static void log(Logger logger, ChronicleLogLevel level, String fmt, Object... args) {
    switch (level) {
    case TRACE:/*from  w  w  w  . j  a va2 s .c om*/
        logger.log(Level.ALL, fmt, args);
        break;
    case DEBUG:
        logger.log(Level.FINE, fmt, args);
        break;
    case INFO:
        logger.log(Level.INFO, fmt, args);
        break;
    case WARN:
        logger.log(Level.WARNING, fmt, args);
        break;
    case ERROR:
        logger.log(Level.SEVERE, fmt, args);
        break;
    default:
        throw new UnsupportedOperationException();
    }
}

From source file:cz.muni.fi.pa165.creatures.rest.client.services.utils.CRUDServiceHelper.java

/**
 * Helper methods which executes an HTTP {@code method} and writes the
 * output to the standard output (e.g. console). Return codes of the HTTP
 * responses are present so we can verify what happened at the server side.
 *
 * @param method method to send to the server side
 *//*from w  w w  . j av a 2s.c o m*/
public static void send(HttpMethodBase method) {
    HttpClient httpClient = new HttpClient();
    try {

        int result = httpClient.executeMethod(method);
        System.out.println(RESPONSE_STATUS_CODE + result);
        ResponseCode response = ResponseCode.fromInt(result);
        if (response != ResponseCode.NOT_FOUND && response != ResponseCode.SERVER_ERROR
                && response != ResponseCode.FORBIDDEN) {
            System.out.println(RESPONSE_HEADER);

            Header[] headers = method.getResponseHeaders();
            for (Header h : headers) {
                System.out.println(h.toString());
            }

            InputStreamReader isr = new InputStreamReader(method.getResponseBodyAsStream());
            BufferedReader br = new BufferedReader(isr);

            String line;

            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
        }
    } catch (ConnectException ex) {
        logger.log(Level.WARNING, CONNECTION_EXCEPTION_MSG);
    } catch (IOException ex) {
        logger.log(Level.INFO, ex.getMessage());
    } finally {
        method.releaseConnection();
    }
}

From source file:com.oic.connection.Connections.java

/**
 * ????JSON??/*from  ww w  .  ja  va2s  .  c o  m*/
 *
 * @param json
 */
public static void broadCastMessage(JSONObject json) {
    synchronized (userConnections) {
        Session session;
        try {
            for (int i = 0; i < userConnections.size(); i++) {
                WebSocketListener websocket = userConnections.get(i);
                session = websocket.getSession();
                if (session.isOpen()) {
                    session.getRemote().sendString(json.toJSONString());
                } else {
                    session.close();
                    userConnections.remove(i);
                }
            }
        } catch (IOException e) {
            LOG.log(Level.WARNING, "error {0}", e.toString());
        }
    }
}