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.daboross.bukkitdev.skywars.api.location.SkyBlockLocation.java

public Location toLocation() {
    World bukkitWorld = null;/* w w  w . j a v a2s  . c  o m*/
    if (world != null) {
        bukkitWorld = Bukkit.getWorld(world);
    }
    if (bukkitWorld == null) {
        SkyStatic.log(Level.WARNING, "[SkyBlockLocation] World '%s' not found when using toLocation", world);
    }
    return new Location(bukkitWorld, x, y, z);
}

From source file:org.ohmage.jee.listener.ConfigurationFileImport.java

/**
 * Find the log file, if it exists, and add its properties to the system
 * properties./*  ww w .j ava2 s.co m*/
 */
@Override
public void contextInitialized(ServletContextEvent event) {
    // An empty Properties object that will be populated with the default
    // configuration.
    Properties defaultProperties = new Properties();
    File defaultConfiguration = new File(event.getServletContext().getRealPath("/") + CONFIG_FILE_DEFAULT);
    try {
        defaultProperties.load(new FileReader(defaultConfiguration));
    }
    // The default properties file didn't exist, which is alarming.
    catch (FileNotFoundException e) {
        LOGGER.log(Level.WARNING,
                "The default properties file is missing: " + defaultConfiguration.getAbsolutePath(), e);
    }
    // There was an error reading the default properties file.
    catch (IOException e) {
        LOGGER.log(Level.WARNING, "There was an error reading the default properties " + "file: "
                + defaultConfiguration.getAbsolutePath(), e);
    }

    // Get a handler for the properties file based on the operating system.
    File propertiesFile;
    if (System.getProperty("os.name").contains("Windows")) {
        propertiesFile = new File(CONFIG_FILE_DEFAULT_WINDOWS);
    } else {
        propertiesFile = new File(CONFIG_FILE_DEFAULT_POSIX);
    }

    // Attempts to retrieve the custom configuration file and store it.
    Properties customProperties = new Properties();
    try {
        customProperties.load(new FileReader(propertiesFile));
        LOGGER.log(Level.INFO, "The properties file was imported: " + propertiesFile.getAbsolutePath());
    }
    // The properties file didn't exist, which is fine.
    catch (FileNotFoundException e) {
        LOGGER.log(Level.INFO, "The properties file does not exist: " + propertiesFile.getAbsolutePath());
    }
    // There was a problem reading the properties.
    catch (IOException e) {
        LOGGER.log(Level.WARNING,
                "There was an error reading the properties file: " + propertiesFile.getAbsolutePath(), e);
    }

    // Set the properties files.
    PROPERTIES_ARRAY[0] = defaultProperties;
    PROPERTIES_ARRAY[1] = customProperties;

    // Create a merged properties and save it.
    for (Object key : defaultProperties.keySet()) {
        PROPERTIES.put(key, defaultProperties.get(key));
    }
    for (Object key : customProperties.keySet()) {
        PROPERTIES.put(key, customProperties.get(key));
    }
}

From source file:io.fabric8.jenkins.openshiftsync.PipelineJobListener.java

@Override
public void onDeleted(Item item) {
    super.onDeleted(item);
    if (item instanceof WorkflowJob) {
        WorkflowJob job = (WorkflowJob) item;
        if (job.getProperty(BuildConfigProjectProperty.class) != null
                && isNotBlank(job.getProperty(BuildConfigProjectProperty.class).getNamespace())
                && isNotBlank(job.getProperty(BuildConfigProjectProperty.class).getName())) {

            NamespaceName buildName = OpenShiftUtils.buildConfigNameFromJenkinsJobName(job.getName(),
                    job.getProperty(BuildConfigProjectProperty.class).getNamespace());
            logger.info("Deleting BuildConfig " + buildName);

            String namespace = buildName.getNamespace();
            String buildConfigName = buildName.getName();
            BuildConfig buildConfig = getOpenShiftClient().buildConfigs().inNamespace(namespace)
                    .withName(buildConfigName).get();
            if (buildConfig != null) {
                try {
                    getOpenShiftClient().buildConfigs().inNamespace(namespace).withName(buildConfigName)
                            .delete();/*from  w ww .  j  a  v a2  s  . c o m*/
                } catch (KubernetesClientException e) {
                    if (HTTP_NOT_FOUND != e.getCode()) {
                        logger.log(Level.WARNING, "Failed to delete BuildConfig in namespace: " + namespace
                                + " for name: " + buildConfigName, e);
                    }
                } catch (Exception e) {
                    logger.log(Level.WARNING, "Failed to delete BuildConfig in namespace: " + namespace
                            + " for name: " + buildConfigName, e);
                } finally {
                    removeJobWithBuildConfig(buildConfig);
                }
            }
        }
    }
}

From source file:eu.playproject.platform.service.bootstrap.DSBTopicManager.java

@Override
public Subscription subscribe(String producer, QName topic, String subscriber) throws BootstrapFault {
    Subscription subscription = null;/*  w ww  .  jav a  2 s.co m*/

    logger.info("Subscribe to topic '" + topic + "' on producer '" + producer + "' for subscriber '"
            + subscriber + "'");

    HTTPProducerClient client = new HTTPProducerClient(producer);
    try {
        String id = client.subscribe(topic, subscriber);
        logger.info("Subscribed to topic " + topic + " and ID is " + id);

        subscription = new Subscription();
        subscription.setDate(System.currentTimeMillis());
        subscription.setId(id);
        subscription.setProvider(producer);
        subscription.setSubscriber(subscriber);
        Topic t = new Topic();
        t.setName(topic.getLocalPart());
        t.setNs(topic.getNamespaceURI());
        t.setPrefix(topic.getPrefix());
        subscription.setTopic(t);

        this.subscriptionRegistry.addSubscription(subscription);

    } catch (NotificationException e) {
        logger.log(Level.SEVERE, "Problem while subscribing", e);
        throw new BootstrapFault(e);
    } catch (GovernanceExeption e) {
        logger.log(Level.WARNING, "Problem while saving subscription", e);
        //throw new BootstrapFault(e);
    }
    return subscription;
}

From source file:org.jboss.arquillian.android.drone.impl.SelendroidHelper.java

/**
 * Waits for Selendroid start. After installation and execution of instrumentation command, we repeatedly send http request
 * to status page to get response code of 200 - server is up and running and we can proceed safely.
 *///from w ww  . j  av a 2  s  .c o  m
public void waitForServerHTTPStart() {
    HttpClient httpClient = new DefaultHttpClient();

    httpClient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, SOCKET_TIME_OUT_SECONDS * 1000);
    httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
            CONNECTION_TIME_OUT_SECONDS * 1000);

    HttpGet httpGet = new HttpGet(getSelendroidStatusURI());

    boolean connectionSuccess = false;

    for (int i = NUM_CONNECTION_RETIRES; i > 0; i--) {
        try {
            HttpResponse response = httpClient.execute(httpGet);
            int statusCode = response.getStatusLine().getStatusCode();
            if (statusCode == 200) {
                connectionSuccess = true;
                break;
            }
            logger.log(Level.INFO,
                    "Response was not 200, response was: " + statusCode + ". Repeating " + i + " times.");
        } catch (ClientProtocolException e) {
            logger.log(Level.WARNING, e.getMessage());
        } catch (IOException e) {
            logger.log(Level.WARNING, e.getMessage());
        }
    }

    httpClient.getConnectionManager().shutdown();

    if (!connectionSuccess) {
        throw new AndroidExecutionException("Unable to get successful connection from Selendroid http server.");
    }
}

From source file:com.google.enterprise.connector.sharepoint.wsclient.soap.SPClientFactory.java

/**
 * Gets the instance of the bulk authorization web service.
 *
 * @return a new bulk authorization service instance.
 *//*w w  w. j  a  va2  s  . c om*/
public BulkAuthorizationWS getBulkAuthorizationWS(final SharepointClientContext ctx) {
    try {
        return new GSBulkAuthorizationWS(ctx);
    } catch (final Exception e) {
        LOGGER.log(Level.WARNING, "Failed to initialize GSBulkAuthorizationWS.", e);
        return null;
    }
}

From source file:de.ingrid.interfaces.csw.search.impl.LuceneSearcher.java

@Override
public void start() throws Exception {
    if (this.isStarted) {
        this.stop();
    }/* w w w  . java2  s .  c  om*/

    // overwrite indexer path with configuration
    if (configurationProvider != null) {
        this.indexPath = configurationProvider.getIndexPath();
    }

    log.info("Start search index: " + this.indexPath);

    // CREATE new analyzer to guarantee that analyzer not closed !
    Analyzer myAnalyzer = luceneTools.createAnalyzer();
    lis = new LuceneIndexSearcher(this.indexPath, "", myAnalyzer);
    lis.setCacheEnabled(ApplicationProperties.getBoolean(ConfigurationKeys.CACHE_ENABLE, false));
    lis.setLogLevel(log.isDebugEnabled() ? Level.FINEST
            : (log.isInfoEnabled() ? Level.INFO : (log.isWarnEnabled() ? Level.WARNING : Level.SEVERE)));

    this.isStarted = true;
}

From source file:net.daboross.bukkitdev.skywars.score.JSONScoreStorage.java

private JSONObject loadFile(Path file) throws IOException {
    if (!Files.isRegularFile(file)) {
        throw new IOException("File '" + file.toAbsolutePath() + "' is not a file (perhaps a directory?).");
    }/*from   www . j ava 2 s .co  m*/

    try (FileInputStream fis = new FileInputStream(file.toFile())) {
        return new JSONObject(new JSONTokener(fis));
    } catch (JSONException ex) {
        try (FileInputStream fis = new FileInputStream(file.toFile())) {
            byte[] buffer = new byte[10];
            int read = fis.read(buffer);
            String str = new String(buffer, 0, read, Charset.forName("UTF-8"));
            if (StringUtils.isBlank(str)) {
                skywars.getLogger().log(Level.WARNING,
                        "File {} is empty, perhaps it was corrupted? Ignoring it and starting new score database. If you haven't recorded any baseJson, this won't matter.",
                        file.toAbsolutePath());
                return new JSONObject();
            }
        }
        throw new IOException("JSONException loading " + file.toAbsolutePath(), ex);
    }
}

From source file:br.com.semanticwot.cd.controllers.GatewayController.java

@ExceptionHandler({ GatewayWotNotCreated.class })
public ModelAndView handleError(HttpServletRequest req, Exception exception) {
    LOGGER.log(Level.WARNING, "Request: {0} raised {1}", new Object[] { req.getRequestURL(), exception });

    ModelAndView mav = new ModelAndView();
    mav.addObject("info", exception.getMessage());
    mav.addObject("gateway", new GatewayForm());
    mav.addObject("url", req.getRequestURL());
    mav.setViewName("gateway/form");
    return mav;/*from   w  ww  . ja v  a2  s .  c o  m*/
}

From source file:edu.harvard.iq.safe.lockss.impl.DaemonStatusDataUtil.java

/**
 *
 * @param rawDaemonVersion// ww w . j a  v a  2s.  co  m
 * @return
 */
public static String getDaemonVersion(String rawDaemonVersion) {
    String daemonVersion = null;
    String dmnVerRegex = "Daemon\\s+(\\d+\\.\\d+\\.\\d+)\\s+built";
    Pattern pdv = Pattern.compile(dmnVerRegex);
    Matcher m = pdv.matcher(rawDaemonVersion);
    if (m.find()) {
        logger.log(Level.FINE, "LOCKSS-daemon version found={0}", m.group(1));
        daemonVersion = "" + m.group(1);
    } else {
        logger.log(Level.WARNING, "LOCKSS-daemon version is not found");
    }
    return daemonVersion;
}