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:Jimbo.Cheerlights.MQTTListener.java

/**
 * Receive an MQTT message.//w w w .  ja v a2 s. c  o m
 * 
 * @param topic The topic it's on
 * @param message The message itself
 */
@Override
public void receive(String topic, String message) {
    try {
        JSONObject j = new JSONObject(message);

        final Instant instant = Instant.ofEpochMilli(j.getLong("sent")).truncatedTo(ChronoUnit.SECONDS);
        final LocalDateTime stamp = LocalDateTime.ofInstant(instant, ZONE);
        final String when = stamp.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);

        LOG.log(Level.INFO, "{0} (@{1}) sent {2}: {3}",
                new Object[] { j.getString("name"), j.getString("screen"), when, j.getString("text") });
        target.update(j.getInt("colour"));
    }

    catch (JSONException | IOException e) {
        LOG.log(Level.WARNING, "Unable to parse: \"{0}\": {1}",
                new Object[] { message, e.getLocalizedMessage() });
    }
}

From source file:com.github.veithen.ulog.MetaFactory.java

private static LoggerFactoryBinder getLoggerFactoryBinder() {
    Class binderClass;/* w w  w.j a  va  2  s  .  c o m*/
    try {
        binderClass = MetaFactory.class.getClassLoader().loadClass("org.slf4j.impl.StaticLoggerBinder");
    } catch (ClassNotFoundException ex) {
        return null;
    }
    try {
        return (LoggerFactoryBinder) binderClass.getMethod("getSingleton", new Class[0]).invoke(null,
                new Object[0]);
    } catch (InvocationTargetException ex) {
        logger.log(Level.WARNING, "Unable to get the SLF4J LoggerFactoryBinder", ex.getCause());
        return null;
    } catch (Throwable ex) {
        logger.log(Level.WARNING, "Unable to get the SLF4J LoggerFactoryBinder", ex);
        return null;
    }
}

From source file:com.symbian.driver.core.controller.PCVisitor.java

/**
 * Constructor for HostVisitor./* w  ww .j a  v  a2s .  com*/
 * 
 * Creates the stack of UID's.
 */
public PCVisitor() {
    // Prepare a UID set to be used when creating sis files.
    String lUidFirstLiteral = null;
    String lUidLastLiteral = null;
    TDConfig CONFIG = TDConfig.getInstance();
    try {
        lUidFirstLiteral = CONFIG.getPreference(TDConfig.UIDFIRST);
        lUidLastLiteral = CONFIG.getPreference(TDConfig.UIDLAST);
    } catch (ParseException lParseException) {
        LOGGER.log(Level.WARNING, "Could not get the preference for the first and last UID.", lParseException);
    }

    int lUidFirstInt = 0x10210D02;
    int lUidLastInt = 0x10210D32;

    try {
        if (lUidFirstLiteral != null && !lUidFirstLiteral.equalsIgnoreCase("0")
                && !lUidFirstLiteral.equalsIgnoreCase("")) {
            lUidFirstInt = Integer.decode(lUidFirstLiteral).intValue();
        }
        if (lUidLastLiteral != null && !lUidLastLiteral.equalsIgnoreCase("0")
                && !lUidLastLiteral.equalsIgnoreCase("")) {
            lUidLastInt = Integer.decode(lUidLastLiteral).intValue();
        }
    } catch (NumberFormatException lNumberFormatException) {
        LOGGER.log(Level.WARNING, "Please specifiy correct UID number ranges.", lNumberFormatException);
    }

    // Configures the UID set
    if (UID_LIST.size() == 0) {
        for (int lUidIndex = lUidFirstInt; lUidIndex <= lUidLastInt; lUidIndex++) {
            UID_LIST.add("0x" + Integer.toHexString(lUidIndex));
        }

        if (UID_LIST.size() != 49) {
            LOGGER.log(Level.SEVERE, "Could not intilaise UID stack, stack is of size: " + UID_LIST.size());
        }
    }
}

From source file:com.symbian.driver.core.processors.EmulatorPreProcessor.java

/**
 * Constructor for the Emulator Device.//w w w  .j a v a 2 s.  c o  m
 * 
 * Sets up the location of the stat.ini file.
 * 
 * @throws ParseException
 */
public EmulatorPreProcessor() {
    LOGGER.entering(EmulatorPreProcessor.class.getName(), "Constructor");

    // Intialise the JSTAT transport
    File lEpocRoot = new File(".");
    String lVariant = "udeb";

    try {
        lEpocRoot = TDConfig.getInstance().getPreferenceFile(TDConfig.EPOC_ROOT);
        lVariant = TDConfig.getInstance().getPreference(TDConfig.VARIANT);

    } catch (ParseException lParseException) {
        LOGGER.log(Level.WARNING, "Could not get preferences.", lParseException);
    }

    iWinscwReleaseDir = new File(lEpocRoot, "/epoc32/RELEASE/WINSCW/" + lVariant);
    iWinscwCDir = new File(lEpocRoot, "/epoc32/WINSCW/c/");

    iEthertapPddFile = new File(iWinscwReleaseDir, "/ethertap.pdd");

    LOGGER.exiting(EmulatorPreProcessor.class.getName(), "Constructor");
}

From source file:com.sk89q.craftbook.mech.drops.legacy.LegacyCustomDropManager.java

public LegacyCustomDropManager(File source) {

    //CraftBookPlugin.inst().createDefaultConfiguration(new File(CraftBookPlugin.inst().getDataFolder(), "custom-block-drops.txt"), "custom-block-drops.txt");
    //CraftBookPlugin.inst().createDefaultConfiguration(new File(CraftBookPlugin.inst().getDataFolder(), "custom-mob-drops.txt"), "custom-mob-drops.txt");

    File blockDefinitions = new File(source, "custom-block-drops.txt");
    File mobDefinitions = new File(source, "custom-mob-drops.txt");

    if (blockDefinitions.exists()) {
        try {//from   w  w w . ja  va 2s  . c  o  m
            loadDropDefinitions(blockDefinitions, false);
        } catch (CustomDropParseException e) {
            CraftBookPlugin.logger().log(Level.WARNING, "Custom block drop definitions failed to parse", e);
        } catch (IOException e) {
            CraftBookPlugin.logger().log(Level.SEVERE,
                    "Unknown IO error while loading custom block drop definitions", e);
        } catch (Exception e) {
            CraftBookPlugin.logger().log(Level.SEVERE,
                    "Unknown exception while loading custom block drop definitions", e);
        }
    }

    if (mobDefinitions.exists()) {
        try {
            loadDropDefinitions(mobDefinitions, true);
        } catch (CustomDropParseException e) {
            CraftBookPlugin.logger().log(Level.WARNING, "Custom mob drop definitions failed to parse", e);
        } catch (IOException e) {
            CraftBookPlugin.logger().log(Level.SEVERE,
                    "Unknown IO error while loading custom mob drop definitions", e);
        } catch (Exception e) {
            CraftBookPlugin.logger().log(Level.SEVERE,
                    "Unknown exception while loading custom mob drop definitions", e);
        }
    }
}

From source file:com.almende.eve.state.couch.CouchState.java

@Override
public JsonNode locPut(final String key, final JsonNode value) {
    final String ckey = couchify(key);
    JsonNode result = null;//w ww.  j av  a  2s  .com
    try {
        synchronized (properties) {
            result = properties.put(ckey, value);
        }
        db.update(this);
    } catch (final UpdateConflictException uce) {
        read();
        return locPut(ckey, value);
    } catch (final Exception e) {
        LOG.log(Level.WARNING, "Failed to store property", e);
    }

    return result;
}

From source file:edu.wpi.cs.wpisuitetng.modules.core.entitymanagers.ProjectManager.java

@Override
public Project makeEntity(Session s, String content) throws WPISuiteException {
    User theUser = s.getUser();/*  w w  w  .j  ava 2 s . c o m*/

    logger.log(Level.FINER, "Attempting new Project creation...");

    Project p;
    try {
        p = Project.fromJSON(content);
    } catch (JsonSyntaxException e) {
        logger.log(Level.WARNING, "Invalid Project entity creation string.");
        throw new BadRequestException(
                "The entity creation string had invalid format. Entity String: " + content);
    }

    logger.log(Level.FINE, "New project: " + p.getName() + " submitted by: " + theUser.getName());
    p.setOwner(theUser);

    if (getEntity(s, p.getIdNum())[0] == null) {
        if (getEntityByName(s, p.getName())[0] == null) {
            save(s, p);
        } else {
            logger.log(Level.WARNING, "Project Name Conflict Exception during Project creation.");
            throw new ConflictException(
                    "A project with the given name already exists. Entity String: " + content);
        }
    } else {
        logger.log(Level.WARNING, "ID Conflict Exception during Project creation.");
        throw new ConflictException("A project with the given ID already exists. Entity String: " + content);
    }

    logger.log(Level.FINER, "Project creation success!");
    return p;
}

From source file:fr.ortolang.diffusion.referential.indexing.ReferentialEntityIndexableContent.java

public ReferentialEntityIndexableContent(ReferentialEntity entity) throws IndexableContentParsingException {
    super(ReferentialService.SERVICE_NAME, entity.getType().name().toLowerCase(), entity.getObjectKey());
    //        entityType = entity.getType();
    content = new HashMap<>();

    // Copies referential to content
    JSONObject jsonObject = new JSONObject(entity.getContent());
    Iterator iterator = jsonObject.keys();
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        Object value = jsonObject.get(key);
        if (value instanceof String && value.toString().isEmpty()) {
            LOGGER.log(Level.WARNING,
                    "Found empty property [" + key + "] in referential entity [" + entity.getKey() + "]");
            iterator.remove();/*  w  ww . j ava2 s.c  o m*/
        } else {
            content.put(key, value);
        }
    }

    // Encodes referential to content
    String referentialEntityContent = entity.getContent();
    try {
        content.put("content", URLEncoder.encode(referentialEntityContent, "UTF-8"));
    } catch (JSONException | UnsupportedEncodingException e) {
        LOGGER.log(Level.WARNING, "Unable to encode content", e);
    }

    content.put("key", entity.getKey());
    content.put("boost", entity.getBoost());
    setContent(content);
}

From source file:mx.itesm.mexadl.MexAdlAnalyzer.java

/**
 * Analyze an xADL architecture in order to generate the following MexADL
 * artifacts:/*from  www .  j  a  v  a  2 s  . c o m*/
 * <ul>
 * <li>AspectJ architecture description aspect (XPI)</li>
 * <li>AspectJ metrics data aspect</li>
 * </ul>
 * 
 * @param xArch
 *            xADL architecture definition.
 * @param xArchFilePath
 *            Path to the file containing the xADL architecture definition.
 * @throws Exception
 */
public static void analyzeXArch(final String xArch, final String xArchFilePath) throws Exception {
    Document document;

    try {
        // Clean output
        FileUtils.deleteQuietly(Util.getOutputDir(xArchFilePath));

        // If there are any processors configured, execute them with the
        // current xADL architecture
        if ((MexAdlAnalyzer.processors != null) && (!MexAdlAnalyzer.processors.isEmpty())) {
            document = MexAdlAnalyzer.saxBuilder.build(new ByteArrayInputStream(xArch.getBytes()));
            for (MexAdlProcessor processor : processors) {
                try {
                    processor.processDocument(document, xArchFilePath);
                } catch (Exception e) {
                    MexAdlAnalyzer.logger.log(Level.WARNING, "An error ocurred while executing " + processor,
                            e);
                    throw e;
                }
            }
        } else {
            MexAdlAnalyzer.logger.log(Level.WARNING,
                    "No MexAdlProcessors found to analyze the xADL architecture");
        }
    } catch (Exception e) {
        MexAdlAnalyzer.logger.log(Level.WARNING, "Error analyzing xArch: ", e);
        throw e;
    }
}

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

/**
 * {@inheritDoc}//ww w .j  av  a2s  .  co m
 */
@Override
public DynPropertyList read() {

    DynPropertyList dynProps = new DynPropertyList();

    // Get the XML file path
    MutableFile file = getFile();

    // If managed file not exists, nothing to do
    if (file != null) {

        // Obtain the XML file on DOM document format
        Document doc = getXmlDocument(file);

        // Obtain all xpath elements that contains the key attribute
        List<Element> elems = XmlUtils.findElements(
                getXpath() + XPATH_ARRAY_PREFIX + XPATH_ATTRIBUTE_PREFIX + getKey() + XPATH_ARRAY_SUFIX,
                doc.getDocumentElement());
        for (Element elem : elems) {

            // If key attribute exists, create current dynamic property
            String key = elem.getAttribute(getKey());
            String value = elem.getAttribute(getValue());
            if (key.isEmpty()) {

                logger.log(Level.WARNING, "Element attribute " + elem + " to get not exists on file");
                continue;
            }
            dynProps.add(new DynProperty(setKeyValue(key), value));
        }
    }

    return dynProps;
}