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:alma.acs.nc.sm.generic.AcsScxmlActionDispatcher.java

/**
 * Generic action handler, dispatches to the right handler based on action type.
 * <p>/*from www .j a va 2 s  .c  o  m*/
 * TODO: org.apache.commons.scxml.env.SimpleErrorReporter#onError prints the class name of the "Object errCtx".
 *       Currently we'd get NPE or useless info.
 */
public void execute(A action, final EventDispatcher evtDispatcher, final ErrorReporter errRep,
        final SCInstance scInstance, final Collection<TriggerEvent> derivedEvents)
        throws ModelException, SCXMLExpressionException {
    AcsScxmlActionExecutor<A> handler = getActionHandler(action);
    if (handler != null) {
        boolean handledAction = false;
        try {
            handledAction = handler.execute(action, evtDispatcher, errRep, scInstance, derivedEvents);
        } catch (AcsJStateMachineActionEx ex) {
            handledAction = true;

            if (actionExceptionHandler != null) { // handler is optional
                // ex will be thrown at the user
                actionExceptionHandler.setActionException(ex);
            } else {
                logger.log(Level.WARNING,
                        "Handler " + handler.getClass() + " failed to execute action " + action.name(), ex);
            }

            // TODO: define and fire a standardized internal error event so that the state machine
            // can reflect the problem and can be maneuvered out of the error again by the user 
        }
        if (!handledAction) {
            errRep.onError(ErrorConstants.UNKNOWN_ACTION,
                    "Handler " + handler.getClass() + " handler unexpectedly did not handle action ", action);
        }
    } else {
        errRep.onError(ErrorConstants.UNKNOWN_ACTION, "No handler registered for action " + action.name(),
                null);
    }
}

From source file:jeplus.util.RelativeDirUtil.java

/**
 * Check the path is absolute or not. If it is not, use the specified BaseDir and calculate absolute path
 *
 * @param thispath The Path to check//from  ww w  . j  a  v a  2s  .c  o  m
 * @param BaseDir The Base Directory to which a relative path is associated
 * @return The absolute (canonical where possible) path
 */
public static String checkAbsolutePath(String thispath, String BaseDir) {
    String abspath;
    File path = new File(thispath);
    if (!path.isAbsolute()) {
        path = new File(BaseDir + thispath);
    }
    try {
        abspath = path.getCanonicalPath();
    } catch (IOException ex) {
        Logger.getLogger(RelativeDirUtil.class.getName()).log(Level.WARNING, null, ex);
        abspath = path.getAbsolutePath();
    }
    return abspath;
}

From source file:com.neophob.sematrix.jmx.PixelControllerStatus.java

/**
 * Register the JMX Bean./*from  w  w w.  j av  a 2  s .c om*/
 *
 * @param configuredFps the configured fps
 */
public PixelControllerStatus(int configuredFps) {
    LOG.log(Level.INFO, "Initialize the PixelControllerStatus JMX Bean");

    this.configuredFps = configuredFps;

    // initialize all buffers 
    this.timeMeasureMapGlobal = new ConcurrentHashMap<TimeMeasureItemGlobal, CircularFifoBuffer>();
    for (TimeMeasureItemGlobal timeMeasureItem : TimeMeasureItemGlobal.values()) {
        this.timeMeasureMapGlobal.put(timeMeasureItem, new CircularFifoBuffer(this.configuredFps * SECONDS));
    }
    this.timeMeasureMapOutput = new ConcurrentHashMap<Output, Map<TimeMeasureItemOutput, CircularFifoBuffer>>();
    this.outputList = new ArrayList<Output>();

    startTime = System.currentTimeMillis();

    // register MBean
    try {
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName name = new ObjectName(JMX_BEAN_NAME);
        // check if the MBean is already registered
        if (!server.isRegistered(name)) {
            server.registerMBean(this, name);
        }
    } catch (JMException ex) {
        LOG.log(Level.WARNING, "Error while registering class as JMX Bean.", ex);
    }
}

From source file:de.tudarmstadt.lt.ltbot.postprocessor.DecesiveValuePrioritizer.java

@Override
protected void innerProcess(CrawlURI uri) throws InterruptedException {
    // CrawlURI is a candidate Uri which has to be scheduled according our priority
    synchronized (_lck) {
        double value = 0d;
        try {//from   w  w w  .  j a va  2 s .com
            value = getValueFromViaURI(uri);
            double oldvalue = getValueFromCurrentURI(uri);
            if (oldvalue <= value) // URI was already processed and value was equal to or lower than the current via url
                return;
        } catch (Throwable t) {
            for (int i = 1; t != null && i < 10; i++) {
                LOG.log(Level.WARNING,
                        String.format("Failed to get decisive value from extra info: (%d-%s:%s).", i,
                                t.getClass().getName(), t.getMessage()),
                        t);
                t = t.getCause();
            }
            return;
        }

        int schedulingConstants_priority = getPriorityAsSchedulingDirective(value);
        if (uri.getFullVia().isSeed() && uri.getLastHop().equals(Hop.REFER.getHopString()))
            schedulingConstants_priority = SchedulingConstants.HIGHEST;

        if (schedulingConstants_priority < 0) {
            _count_reject++;
            uri.setFetchStatus(S_OUT_OF_SCOPE); // this will not consider the url for further processing // TODO: there must be a better solution, maybe extend org.archive.crawler.prefetch.FrontierPreparer or org.archive.crawler.prefetch.CandidateScoper
        }

        uri.setSchedulingDirective(schedulingConstants_priority);
        if (schedulingConstants_priority >= 0)
            _assignment_counts[schedulingConstants_priority]++;
        LOG.finest(String.format("Assigned scheduling directive %d to %s.", schedulingConstants_priority,
                uri.toString()));
        // lower values have higher precedence, i.e. higher priority
        int cost = 255;
        if (schedulingConstants_priority == 0)
            cost = 1;
        else if (schedulingConstants_priority > 0)
            cost = getPrecedenceCost(value);
        uri.setHolderCost(cost);
        uri.setPrecedence(cost);
        LOG.finest(String.format("Assigned precedence cost %d to %s.", cost, uri.toString()));
        try {
            uri.getExtraInfo().put(SharedConstants.EXTRA_INFO_ASSIGNED_SCHEDULING_DIRECTIVE,
                    schedulingConstants_priority);
            uri.getExtraInfo().put(SharedConstants.EXTRA_INFO_ASSIGNED_COST_PRECEDENCE, cost);
            uri.getExtraInfo().put(SharedConstants.EXTRA_INFO_PERPLEXITY_VIA, String.format("%012g", value));
        } catch (Throwable t) {
            for (int i = 1; t != null && i < 10; i++) {
                LOG.log(Level.WARNING, String.format("Failed to add extra information to uri %s: (%d-%s:%s).",
                        uri.toString(), i, t.getClass().getName(), t.getMessage()), t);
                t = t.getCause();
            }
        }
    }
}

From source file:com.qualogy.qafe.business.resource.rdb.RDBDatasource.java

public void destroy(ApplicationContext context) {
    if (dataSource != null) {
        try {/*from   w  w w  .ja  v  a2  s . c  o m*/
            DataSourceUtils.releaseConnection(dataSource.getConnection(), dataSource);
        } catch (SQLException e) {
            LOG.log(Level.WARNING, "Problem releasing db connection", e);
        }
        // if (!dataSource.getConnection().isClosed()){
        // // You call close() on the Connection object when you're done. Note that this doesn't really
        // close the connection - it just returns it to the pool.
        // dataSource.getConnection().close();
        // }
    }
}

From source file:com.qwazr.library.cassandra.CassandraSession.java

private ResultSet executeStatement(Session session, SimpleStatement statement) {
    try {/* www . jav a2 s  .  c  om*/
        return session.execute(statement);
    } catch (NoHostAvailableException e1) {
        if (cluster == null || !cluster.isClosed())
            throw e1;
        try {
            return session.execute(statement);
        } catch (DriverException e2) {
            logger.log(Level.WARNING, e2, e2::getMessage);
            throw e1;
        }
    }

}

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

/**
 * {@inheritDoc}//  w w w  .java  2 s .com
 */
public void write(DynPropertyList dynProps) {

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

        // Obtain the root element of the XML file
        Document doc = getXmlDocument(file);
        Element root = doc.getDocumentElement();

        // Update the root element property values with dynamic properties
        setProperties(root, dynProps);

        // Update the XML file
        XmlUtils.writeXml(file.getOutputStream(), doc);

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

        logger.log(Level.WARNING,
                "File " + getFilePath() + " not exists and there are dynamic properties to set it");
    }
}

From source file:di.uniba.it.tri.aan.AAN2file.java

public void build(String anndirname, String outputdirname) throws Exception {
    for (int i = 0; i < yearsdir.length; i++) {
        File metadatafile = new File(anndirname + "/release/" + yearsdir[i] + "/acl-metadata.txt");
        List<Paper> list = loadPaperList(metadatafile, anndirname + "/papers_text/");
        for (Paper paper : list) {
            if (paper.getFile().exists()) {
                File destFile = new File(outputdirname + "/" + paper.getId() + "_" + paper.getYear());
                if (!destFile.exists()) {
                    FileUtils.copyFile(paper.getFile(), destFile);
                }//  ww w  .  j  a v  a2s .c  o m
            } else {
                Logger.getLogger(AAN2file.class.getName()).log(Level.WARNING, "Paper not found: {0}",
                        paper.getFile());
            }
        }
    }
}

From source file:ch.jamiete.hilda.configuration.Configuration.java

public void load() {
    if (!this.file.exists()) {
        this.json = new JsonObject();
        return;/*from   w  w  w  . java2 s  . c o  m*/
    }

    Charset charset = null;

    try {
        charset = Charset.forName("UTF-8");
    } catch (final Exception e) {
        charset = Charset.defaultCharset();
    }

    try {
        this.json = new JsonParser().parse(FileUtils.readFileToString(this.file, charset)).getAsJsonObject();
    } catch (final IOException e) {
        Hilda.getLogger().log(Level.WARNING,
                "Encountered an exception while loading configuration " + this.file.getName(), e);
        this.json = new JsonObject();
    }

    if (new Gson().toJson(this.json).equals("{}")) {
        try {
            this.file.delete();
        } catch (final Exception e) {
            // Ignore
        }
    }
}

From source file:com.google.cloud.speech.grpc.demos.NonStreamingRecognizeClient.java

/** Send a non-streaming-recognize request to server. */
public void recognize() {
    AudioRequest audio;//w  w  w .j  a  v a2s.  c o  m
    try {
        audio = createAudioRequest();
    } catch (IOException e) {
        logger.log(Level.WARNING, "Failed to read audio uri input: " + input);
        return;
    }
    logger.info("Sending " + audio.getContent().size() + " bytes from audio uri input: " + input);
    InitialRecognizeRequest initial = InitialRecognizeRequest.newBuilder().setEncoding(AudioEncoding.LINEAR16)
            .setSampleRate(samplingRate).build();
    RecognizeRequest request = RecognizeRequest.newBuilder().setInitialRequest(initial).setAudioRequest(audio)
            .build();
    NonStreamingRecognizeResponse response;
    try {
        response = blockingStub.nonStreamingRecognize(request);
    } catch (StatusRuntimeException e) {
        logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus());
        return;
    }
    logger.info("Received response: " + TextFormat.printToString(response));
}