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:hudson.plugins.sonar.client.SQProjectResolver.java

/**
 * Resolve information concerning the quality gate.
 * Might return null if it's not possible to fetch it, which should be interpreted as 'nothing to display'.
 * Errors that should be displayed are included in {@link ProjectInformation#getErrors()}.
 */// w w  w . j a  v  a2  s  .c o m
@CheckForNull
public ProjectInformation resolve(String projectUrl, String ceTaskId, String installationName) {
    SonarInstallation inst = SonarInstallation.get(installationName);
    if (inst == null) {
        Logger.LOG.info("Invalid installation name: " + installationName);
        return null;
    }

    try {
        String projectKey = extractProjectKey(projectUrl);
        String serverUrl = extractServerUrl(projectUrl);

        WsClient wsClient;
        if (StringUtils.isNotEmpty(inst.getServerAuthenticationToken())) {
            wsClient = new WsClient(client, serverUrl, inst.getServerAuthenticationToken(), null);
        } else {
            wsClient = new WsClient(client, serverUrl, inst.getSonarLogin(), inst.getSonarPassword());
        }

        if (!checkServerUrl(serverUrl, projectKey, inst)) {
            return null;
        }

        Version version = new Version(wsClient.getServerVersion());

        ProjectInformation projectInfo = new ProjectInformation(projectKey);
        projectInfo.setUrl(projectUrl);

        getQualityGate(wsClient, projectInfo, projectKey, version);
        if (projectInfo.getStatus() == null) {
            // if QG is not available for the project, without errors, projectInfo will be empty
            return projectInfo;
        }

        getCETask(wsClient, projectInfo, ceTaskId);

        if (projectInfo.getProjectName() == null) {
            projectInfo.setName(wsClient.getProjectName(projectKey));
        }
        return projectInfo;

    } catch (Exception e) {
        Logger.LOG.log(Level.WARNING, "Error fetching project information", e);
        return null;
    }
}

From source file:com.neophob.sematrix.generator.Textwriter.java

/**
 * Instantiates a new textwriter./*  ww w .  ja v  a 2  s .  co  m*/
 *
 * @param controller the controller
 * @param fontName the font name
 * @param fontSize the font size
 * @param text the text
 */
public Textwriter(PixelControllerGenerator controller, String fontName, int fontSize, String text) {
    super(controller, GeneratorName.TEXTWRITER, ResizeName.PIXEL_RESIZE);
    color = new Color(128);
    xpos = 0;
    ypos = internalBufferYSize;
    try {
        InputStream is = Collector.getInstance().getPapplet().createInput(fontName);
        tmp = new int[internalBuffer.length];
        font = Font.createFont(Font.TRUETYPE_FONT, is).deriveFont(Font.BOLD, (float) fontSize);
        LOG.log(Level.INFO, "Loaded font " + fontName + ", size: " + fontSize);
    } catch (Exception e) {
        LOG.log(Level.WARNING, "Failed to load font " + fontName + ":", e);
    }
    createTextImage(text);
}

From source file:org.osiam.resources.provisioning.SCIMUserProvisioning.java

@Override
public User getById(String id) {
    try {//www  .  jav  a  2  s  . c o  m
        UserEntity userEntity = userDao.getById(id);
        User user = userConverter.toScim(userEntity);
        return getUserWithoutPassword(user);
    } catch (NoResultException nre) {
        LOGGER.log(Level.INFO, nre.getMessage(), nre);

        throw new ResourceNotFoundException(String.format("User with id '%s' not found", id), nre);
    } catch (PersistenceException pe) {
        LOGGER.log(Level.WARNING, pe.getMessage(), pe);

        throw new ResourceNotFoundException(String.format("User with id '%s' not found", id), pe);
    }
}

From source file:com.almende.eve.transport.http.ApacheHttpClient.java

/**
 * Instantiates a new apache http client.
 *
 *///from   w ww  . j ava 2  s .c o m
private ApacheHttpClient() {

    // Allow self-signed SSL certificates:
    final TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
    final X509HostnameVerifier hostnameVerifier = new AllowAllHostnameVerifier();
    final SchemeRegistry schemeRegistry = SchemeRegistryFactory.createDefault();

    SSLSocketFactory sslSf;
    try {
        sslSf = new SSLSocketFactory(trustStrategy, hostnameVerifier);
        final Scheme https = new Scheme("https", 443, sslSf);
        schemeRegistry.register(https);
    } catch (Exception e) {
        LOG.warning("Couldn't init SSL socket, https not supported!");
    }

    // Work with PoolingClientConnectionManager
    final ClientConnectionManager connection = new PoolingClientConnectionManager(schemeRegistry);

    // Provide eviction thread to clear out stale threads.
    new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                while (true) {
                    synchronized (this) {
                        wait(5000);
                        connection.closeExpiredConnections();
                        connection.closeIdleConnections(30, TimeUnit.SECONDS);
                    }
                }
            } catch (final InterruptedException ex) {
            }
        }
    }).start();

    // generate httpclient
    httpClient = new DefaultHttpClient(connection);

    // Set cookie policy and persistent cookieStore
    try {
        httpClient.setCookieStore(new MyCookieStore());
    } catch (final Exception e) {
        LOG.log(Level.WARNING, "Failed to initialize persistent cookieStore!", e);
    }
    final HttpParams params = httpClient.getParams();

    params.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY);
    params.setParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
    params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 20000);
    params.setParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false);
    params.setParameter(CoreConnectionPNames.TCP_NODELAY, true);
    httpClient.setParams(params);
}

From source file:ratpack.codahale.metrics.internal.WebSocketReporter.java

@Override
@SuppressWarnings("rawtypes")
public void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters,
        SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters,
        SortedMap<String, Timer> timers) {
    try {//w  w  w  . j a v  a  2  s  .co  m
        OutputStream out = new ByteArrayOutputStream();
        JsonGenerator json = factory.createGenerator(out);

        json.writeStartObject();
        json.writeNumberField("timestamp", clock.getTime());
        writeTimers(json, timers);
        writeGauges(json, gauges);
        writeMeters(json, meters);
        writeCounters(json, counters);
        writeHistograms(json, histograms);
        json.writeEndObject();

        json.flush();
        json.close();

        metricsBroadcaster.broadcast(out.toString());
    } catch (IOException e) {
        LOGGER.log(Level.WARNING, "Exception encountered while reporting metrics: " + e.getLocalizedMessage());
    }
}

From source file:com.almende.eve.state.StateEntry.java

/**
 * Put value./*from w ww . j a v  a  2 s.  co m*/
 *
 * @param state the {@link State} to update with specified {@code value}
 * @param value the new value for this {@link StateEntry} in specified
 * @return the previous value or {@code null} if none existed
 * {@code state}
 * @see java.util.Map#put(Object, Object)
 */
public T putValue(final State state, final T value) {
    try {
        return TypeUtil.inject(state.put(getKey(), value), valueType);
    } catch (final ClassCastException e) {
        LOG.log(Level.WARNING, "Problem casting agent's previous state value, key: " + key, e);
        return null;
    }
}

From source file:edu.usu.sdl.openstorefront.web.action.BaseAction.java

protected void deleteTempFile(FileBean fileBean) {
    try {/* w w  w . j  av  a  2 s . c o m*/
        fileBean.delete();
    } catch (IOException ex) {
        log.log(Level.WARNING, "Unable to remove temp upload file.", ex);
    }
}

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

/**
 * {@inheritDoc}/*from  ww w  . j  av  a  2 s  . com*/
 */
public void write(DynPropertyList dynProps) {
    OutputStream outputStream = null;

    try {

        // Get the properties file path
        MutableFile file = getFile();
        if (file != null) {

            Properties props = new Properties();
            props.load(file.getInputStream());
            for (DynProperty dynProp : dynProps) {

                if (props.containsKey(dynProp.getKey())) {

                    props.put(dynProp.getKey(), dynProp.getValue());
                } else {

                    logger.log(Level.WARNING, "Property key ".concat(dynProp.getKey())
                            .concat(" to put value not exists on file"));
                }
            }
            outputStream = file.getOutputStream();
            props.store(outputStream, null);

        } else if (!dynProps.isEmpty()) {

            logger.log(Level.WARNING, "File ".concat(getFilePath())
                    .concat(" not exists and there are dynamic properties to set it"));
        }
    } catch (IOException ioe) {
        throw new IllegalStateException(ioe);
    } finally {
        if (outputStream != null) {
            IOUtils.closeQuietly(outputStream);
        }
    }
}

From source file:jp.go.nict.langrid.bpel.ProcessAnalyzer.java

/**
 * //from w  w  w. j  av  a  2s .c o  m
 * 
 */
public static ProcessInfo analyze(BPELServiceInstanceReader reader)
        throws IOException, MalformedURLException, SAXException, ProcessAnalysisException, URISyntaxException {
    ProcessInfo pi = new ProcessInfo();

    byte[] bpelBody = null;
    InputStream is = reader.getBpel();
    try {
        bpelBody = StreamUtil.readAsBytes(reader.getBpel());
    } finally {
        is.close();
    }

    int n = reader.getWsdlCount();
    byte[][] wsdlBodies = new byte[n][];
    for (int i = 0; i < n; i++) {
        InputStream w = reader.getWsdl(i);
        try {
            wsdlBodies[i] = StreamUtil.readAsBytes(w);
        } finally {
            w.close();
        }
    }

    BPEL bpel;
    try {
        bpel = analyzeBPEL(bpelBody);
    } catch (XPathExpressionException e) {
        throw new ProcessAnalysisException(e);
    }

    HashMap<URI, WSDL> wsdls = new HashMap<URI, WSDL>();
    for (byte[] wsdlBody : wsdlBodies) {
        WSDL wsdl = analyzeWsdl(wsdlBody);
        wsdls.put(wsdl.getTargetNamespace(), wsdl);
    }

    try {
        resolve(bpel, wsdls);
    } catch (ProcessAnalysisException e) {
        logger.log(Level.WARNING, "BPEL Resolve error: ", e);
        StringBuilder b = new StringBuilder();
        b.append("service contains...\n");
        b.append("bpel: ");
        b.append(bpel.getFilename());
        b.append("  ");
        b.append(bpel.getTargetNamespace());
        b.append("\n");
        for (WSDL w : wsdls.values()) {
            b.append("wsdl: ");
            b.append(w.getFilename());
            b.append("  ");
            b.append(w.getTargetNamespace());
        }
        logger.warning(b.toString());
        throw e;
    }

    pi.setBpel(bpel);
    pi.setWsdls(wsdls);
    for (PartnerLink pl : bpel.getPartnerLinks()) {
        String role = pl.getPartnerRole();
        if (role == null)
            continue;
        WSDL w = wsdls.get(new URI(pl.getPartnerLinkType().getNamespaceURI()));
        if (w == null)
            continue;
        PartnerLinkType plt = w.getPlinks().get(pl.getPartnerLinkType().getLocalPart());
        if (plt == null)
            continue;
        Role r = plt.getRoles().get(role);
        if (r == null)
            continue;
        pi.getPartnerLinks().put(r.getPortTypeName().getNamespaceURI(), pl);
    }

    return pi;
}

From source file:net.consulion.jeotag.PhotoLoader.java

private static TiffImageMetadata getExif(final File file) {
    TiffImageMetadata exif = null;/*  ww w .  ja va2  s  .co m*/
    try {
        final IImageMetadata metadata = Imaging.getMetadata(file);
        if (metadata != null) {
            final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
            exif = jpegMetadata.getExif();
        } else {
            log(Level.WARNING, String.format("No metadata found for file %s", file));
        }

    } catch (final ImageReadException | IOException ex) {
        Logger.getLogger(PhotoLoader.class.getName()).log(Level.SEVERE, null, ex);
    }
    return exif;
}