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:it.unibo.alchemist.utils.L.java

/**
 * @param s/*from   w w w .  j  a  v a2 s  .  c om*/
 *            the String to log
 */
@Deprecated
public static void warn(final String s) {
    log(Level.WARNING, s);
}

From source file:com.github.shynixn.blockball.bukkit.logic.persistence.context.SqlDbContextImpl.java

@Inject
public SqlDbContextImpl(Plugin plugin) {
    super();/*w  w  w  . j ava 2  s  . c o m*/
    if (plugin == null)
        throw new IllegalArgumentException("Plugin cannot be null!");
    this.retriever = fileName -> {
        try (final InputStream stream = plugin.getResource("sql/" + fileName + ".sql")) {
            return IOUtils.toString(stream, "UTF-8");
        } catch (final IOException e) {
            Bukkit.getLogger().log(Level.WARNING, "Cannot read file.", fileName);
            throw new RuntimeException(e);
        }
    };
    this.connectInternal(plugin);
}

From source file:com.berkgokden.mongodb.MongoMapStore.java

public Object load(Object key) {
    DBObject dbo = new BasicDBObject();
    dbo.put("_id", key);
    DBObject obj = coll.findOne(dbo);/*from w w w .ja  va2  s  .c om*/
    if (obj == null)
        return null;

    try {
        Class clazz = Class.forName(obj.get("_class").toString());
        return converter.toObject(clazz, obj);
    } catch (ClassNotFoundException e) {
        logger.log(Level.WARNING, e.getMessage(), e);
    }
    return null;
}

From source file:dataform.sql.query.DefaultTable.java

public void addWhereClause(WhereClause whereClause) {
    if (whereClause != null) {
        try {//from w w w  .j  a  v a  2s .c  o m
            this.whereClause.addWhereClause(whereClause);
        } catch (Exception e) {
            if (logger.getLevel() == Level.FINEST)
                e.printStackTrace();
            logger.log(Level.WARNING, e.getMessage());
        }
    } else {
        logger.log(Level.WARNING, "WhereClause is null.");
    }
}

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

private static Instant getTimeTaken(final TiffImageMetadata exif, final File file) {
    Instant instant = null;/*w w w.j  av a 2  s. c  o m*/
    if (exif != null) {
        try {
            final String[] dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
            if (dateTimeOriginal.length == 1
                    && dateTimeOriginal[0].matches("\\d{4}\\:\\d{2}:\\d{2}\\s\\d{2}:\\d{2}:\\d{2}")) {
                final String[] split = dateTimeOriginal[0].split("\\s");
                final String dateString = split[0];
                final String timeString = split[1];
                final String[] dateSplit = dateString.split("\\:");
                final int year = Integer.parseInt(dateSplit[0]);
                final int month = Integer.parseInt(dateSplit[1]);
                final int day = Integer.parseInt(dateSplit[2]);
                final String[] timeSplit = timeString.split("\\:");
                final int hour = Integer.parseInt(timeSplit[0]);
                final int minute = Integer.parseInt(timeSplit[1]);
                final int second = Integer.parseInt(timeSplit[2]);
                final LocalDateTime ldt = LocalDateTime.of(year, month, day, hour, minute, second);
                instant = ldt.toInstant(ZoneOffset.ofHoursMinutes(0, 0));
            } else {
                log(Level.WARNING, String.format("unknown date format in file %s", file.getPath()));
            }
        } catch (ImageReadException ex) {
            Logger.getLogger(PhotoLoader.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    return instant;
}

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

/**
 * Gets the value./* ww  w . j  av  a  2s .  c om*/
 *
 * @param state the {@link State} from which to retrieve this
 * @return the value retrieved from specified {@code state} or {@code null}
 * if none exists
 * {@code StateEntry}'s value
 * @see java.util.Map#get(Object)
 */
public T getValue(final State state) {
    try {
        return state.get(getKey(), valueType);
    } catch (final ClassCastException e) {
        LOG.log(Level.WARNING, "Problem casting agent's state value, key: " + key, e);
        return null;
    }
}

From source file:biz.ganttproject.impex.csv.RecordGroup.java

boolean process(CSVRecord record) {
    assert record.size() > 0;
    boolean allEmpty = true;
    for (Iterator<String> it = record.iterator(); it.hasNext();) {
        if (!Strings.isNullOrEmpty(it.next())) {
            allEmpty = false;/*from ww w. j a v  a 2s.co m*/
            break;
        }
    }
    if (allEmpty) {
        return false;
    }
    try {
        return doProcess(record);
    } catch (Throwable e) {
        GPLogger.getLogger(GanttCSVOpen.class).log(Level.WARNING,
                String.format("Failed to process record:\n%s", record), e);
        return false;
    }
}

From source file:com.qualogy.qafe.bind.orm.jibx.ORMBinder.java

/**
 * closing the bytearrayinputstream has now effect
 * @param doc/*from   w w w .  j ava 2s.  c  o m*/
 * @param root
 * @return
 */
public static Object bind(Document doc, String root, Class expectedResultType, boolean readInDebugMode) {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();

    // Refactor the commented code below, to make Google App Engine (GAE) compatible
    // The com.sun.org.apache.xml.internal.serialize.OutputFormat class is restricted
    /*OutputFormat format = new OutputFormat(doc);
    format.setIndenting(true);
    try {
       new XMLSerializer(bout, format).serialize(doc);
    } catch (IOException e) {
       throw new BindException(e);
    }*/
    /*try {
       Source source = new DOMSource(doc);
       Result result = new StreamResult(bout);
       TransformerFactory factory = TransformerFactory.newInstance();
       Transformer transformer = factory.newTransformer();
       transformer.transform(source, result);
    } catch (Exception e) {
       throw new BindException(e);
    }*/

    String docAsString = docToString(doc);
    byte[] docAsBytes = null;

    try {
        docAsBytes = docAsString.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e2) {
        // TODO Auto-generated catch block
        e2.printStackTrace();
    }
    ByteArrayInputStream in = new ByteArrayInputStream(docAsBytes);
    //ByteArrayInputStream in = new ByteArrayInputStream(bout.toByteArray());

    if (readInDebugMode && logger.isLoggable(Level.FINE)) {
        try {
            logger.fine(docToString(in));
        } catch (IOException e1) {
            logger.log(Level.WARNING, "unable to print the merged document contents due to error", e1);
        }
    }

    Object obj = null;
    try {
        IBindingFactory bfact = BindingDirectory.getFactory(expectedResultType);
        IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
        obj = uctx.unmarshalDocument(in, root, ENCODING_TYPE);
    } catch (JiBXException e) {
        String line = JIBXExceptionTranslator.getLine(e, in);
        BindException be = (line != null) ? new BindException(e.getMessage() + "\nLine: " + line, e)
                : new BindException(e);
        throw be;
    } catch (ClassCastException e) {
        throw new BindException(e);
    }
    return obj;
}

From source file:jsat.distributions.SingleValueDistribution.java

@Override
public void setUsingData(Vec data) {
    final Pair<Boolean, Double> sameValues = MyDistributionSearch.checkForDifferentValues(data);
    if (sameValues.getFirstItem()) {
        value = sameValues.getSecondItem();
    } else {//from   w w w.j a v a2 s .c o m
        Logger.getLogger(SingleValueDistribution.class.getName()).log(Level.WARNING,
                "Trying to use a SingleValueDistribution with data that contains more than one value.");
    }
}

From source file:org.globus.security.stores.AbstractResourceSecurityWrapper.java

public URL getResourceURL() {
    try {// www.  j  a v  a2 s  .c o m
        return resource.getURL();
    } catch (IOException e) {
        logger.log(Level.WARNING, "Unable to extract url", e);
        return null;
    }
}