当前位置: 首页>>代码示例>>Java>>正文


Java Log.error方法代码示例

本文整理汇总了Java中jline.internal.Log.error方法的典型用法代码示例。如果您正苦于以下问题:Java Log.error方法的具体用法?Java Log.error怎么用?Java Log.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jline.internal.Log的用法示例。


在下文中一共展示了Log.error方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: eval

import jline.internal.Log; //导入方法依赖的package包/类
public Object eval(ScriptObject o, Object scope, String source, boolean returnStuff) {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'eval' in local mode");
        return "";
    }
    try {
        //new jdk.nashorn.internal.runtime.DebugLogger().
        Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
        //note: getConstructor() can return only public constructors,
        //you need to use

        Method method = c.getDeclaredMethod("eval", ScriptObject.class, Object.class, String.class, boolean.class);

        //Constructor<?> constructor = c.getDeclaredConstructor();
        method.setAccessible(true);
        return method.invoke(null, o, scope, source, returnStuff);
    } catch (Exception e) {
        Log.error(e);
        return null;
    }
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:22,代码来源:JavaToJsHelpers.java

示例2: getDebugSupport

import jline.internal.Log; //导入方法依赖的package包/类
private Object getDebugSupport() {


        //return new NashornDebugHelper();
        try {
            Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
            //note: getConstructor() can return only public constructors,
            //you need to use
            Method method = c.getDeclaredMethod("eval", ScriptObject.class, Object.class, String.class, boolean.class);

            //Constructor<?> constructor = c.getDeclaredConstructor();
            method.setAccessible(true);
            return method;
            //constructor.setAccessible(true);
            //Object o = constructor.newInstance(null);
            //return o;
        } catch (Exception e) {
            Log.error(e);
            return null;
        }
    }
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:22,代码来源:JavaToJsHelpers.java

示例3: setEchoEnabled

import jline.internal.Log; //导入方法依赖的package包/类
@Override
public synchronized void setEchoEnabled(final boolean enabled) {
    try {
        if (enabled) {
            settings.set("echo");
        }
        else {
            settings.set("-echo");
        }
        super.setEchoEnabled(enabled);
    }
    catch (Exception e) {
        if (e instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        Log.error("Failed to ", (enabled ? "enable" : "disable"), " echo", e);
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:19,代码来源:UnixTerminal.java

示例4: getInput

import jline.internal.Log; //导入方法依赖的package包/类
public String getInput(String prompt) throws Exception {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'getInput' in local mode");
        return "";
    }

    ConsoleReader reader = new ConsoleReader();
    return reader.readLine(prompt);
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:10,代码来源:JavaToJsHelpers.java

示例5: inspect

import jline.internal.Log; //导入方法依赖的package包/类
public Object inspect(Object object) throws Exception {
    if (!Settings.instance().getLocalMode()) {
        Log.error("You can only call 'inspect' in local mode");
        return "";
    }
    Class<?> c = Class.forName("jdk.nashorn.internal.runtime.DebuggerSupport");//full package name
    //note: getConstructor() can return only public constructors,
    //you need to use

    Method method = c.getDeclaredMethod("valueInfos", Object.class, boolean.class);
    //valueInfos(Object object, boolean all)
    //Constructor<?> constructor = c.getDeclaredConstructor();
    method.setAccessible(true);
    Object[] objects = (Object[])method.invoke(null, object, true);
    //List<Map> returnObjects = new ArrayList<>();
    Map desc = new HashMap<>();
    for(Object o: objects) {
        Map map = new HashMap<>();

        Field field = o.getClass().getDeclaredField("key");
        field.setAccessible(true);
        Object key = field.get(o);

        Field field2 = o.getClass().getDeclaredField("valueAsString");
        field2.setAccessible(true);
        Object val = field2.get(o);
        desc.put(key.toString(), val.toString());

    }
    return desc;
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:32,代码来源:JavaToJsHelpers.java

示例6: createUrlPath

import jline.internal.Log; //导入方法依赖的package包/类
protected String createUrlPath(int timeoutMs, int limit) {
	final StringBuilder url = new StringBuilder(CambriaPublisherUtility.makeConsumerUrl(fTopic, fGroup, fId));
	final StringBuilder adds = new StringBuilder();
	if (timeoutMs > -1) {
		adds.append("timeout=").append(timeoutMs);
	}

	if (limit > -1) {
		if (adds.length() > 0) {
			adds.append("&");
		}
		adds.append("limit=").append(limit);
	}
	if (fFilter != null && fFilter.length() > 0) {
		try {
			if (adds.length() > 0) {
				adds.append("&");
			}
			adds.append("filter=").append(URLEncoder.encode(fFilter, "UTF-8"));
		} catch (UnsupportedEncodingException e) {
			Log.error("Failed due to UnsupportedEncodingException" + e);
		}
	}
	if (adds.length() > 0) {
		url.append("?").append(adds.toString());
	}
	return url.toString();
}
 
开发者ID:att,项目名称:dmaap-framework,代码行数:29,代码来源:DMaaPCambriaConsumerImpl.java

示例7: syncConfig

import jline.internal.Log; //导入方法依赖的package包/类
public static void syncConfig() {
    try {
        processConfig();
    } catch (Exception e) {
        Log.error(MODID + " has a problem loading its configuration!");
        e.printStackTrace();
    } finally {
        if(config.hasChanged()) {
            config.save();
        }
    }
}
 
开发者ID:Tbsc,项目名称:TbscFPS,代码行数:13,代码来源:TbscFPS.java

示例8: finishBuffer

import jline.internal.Log; //导入方法依赖的package包/类
/**
 * Clear the buffer and add its contents to the history.
 *
 * @return the former contents of the buffer.
 */
final String finishBuffer() throws IOException { // FIXME: Package protected because used by tests
    String str = buf.buffer.toString();
    String historyLine = str;

    if (expandEvents) {
        try {
            str = expandEvents(str);
            // all post-expansion occurrences of '!' must have been escaped, so re-add escape to each
            historyLine = str.replace("!", "\\!");
            // only leading '^' results in expansion, so only re-add escape for that case
            historyLine = historyLine.replaceAll("^\\^", "\\\\^");
        } catch(IllegalArgumentException e) {
            Log.error("Could not expand event", e);
            beep();
            buf.clear();
            str = "";
        }
    }

    // we only add it to the history if the buffer is not empty
    // and if mask is null, since having a mask typically means
    // the string was a password. We clear the mask after this call
    if (str.length() > 0) {
        if (mask == null && isHistoryEnabled()) {
            history.add(historyLine);
        }
        else {
            mask = null;
        }
    }

    history.moveToEnd();

    buf.buffer.setLength(0);
    buf.cursor = 0;

    return str;
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:44,代码来源:ConsoleReader.java

示例9: disableInterruptCharacter

import jline.internal.Log; //导入方法依赖的package包/类
public void disableInterruptCharacter()
{
    try {
        settings.set("intr undef");
    }
    catch (Exception e) {
        if (e instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        Log.error("Failed to disable interrupt character", e);
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:13,代码来源:UnixTerminal.java

示例10: enableInterruptCharacter

import jline.internal.Log; //导入方法依赖的package包/类
public void enableInterruptCharacter()
{
    try {
        settings.set("intr ^C");
    }
    catch (Exception e) {
        if (e instanceof InterruptedException) {
            Thread.currentThread().interrupt();
        }
        Log.error("Failed to enable interrupt character", e);
    }
}
 
开发者ID:AcademicTorrents,项目名称:AcademicTorrents-Downloader,代码行数:13,代码来源:UnixTerminal.java

示例11: isRunning

import jline.internal.Log; //导入方法依赖的package包/类
@Override
public boolean isRunning() {
    if (runner == null)
        return false;
    
    try {
        return CassandraRunner.waitForPortOpen(InetAddress.getByName("localhost"), Integer.parseInt(default_native_transport_port), 2000);
    } catch (UnknownHostException e) {
        Log.error("Cassandra failed to start: ", e);
        return false;
    }
}
 
开发者ID:ANierbeck,项目名称:Karaf-Cassandra,代码行数:13,代码来源:OsgiEmbeddedCassandra.java

示例12: shutdown

import jline.internal.Log; //导入方法依赖的package包/类
@Override
public void shutdown() {
    if (null != provider) {
        try {
            runtime.unregisterProvider(localDomain, provider);
        } catch (JoynrRuntimeException exception) {
            Log.error("Failed to unregister provider", exception);
        }
    }

    runtime.shutdown(true);
    System.exit(0);
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:14,代码来源:EchoProviderApplication.java

示例13: run

import jline.internal.Log; //导入方法依赖的package包/类
@Override
public void run() {
    EchoProxy echoProxy = createEchoProxy();

    if (invocationParameters.getCommunicationMode() == COMMUNICATIONMODE.SYNC) {
        switch (invocationParameters.getTestCase()) {
        case SEND_STRING:
            performSyncSendStringTest(echoProxy);
            break;
        case SEND_STRUCT:
            performSyncSendStructTest(echoProxy);
            break;
        case SEND_BYTEARRAY:
            performSyncSendByteArrayTest(echoProxy);
            break;
        default:
            Log.error("Unknown test type used");
            break;
        }
    } else if (invocationParameters.getCommunicationMode() == COMMUNICATIONMODE.ASYNC) {
        switch (invocationParameters.getTestCase()) {
        case SEND_STRING:
            performAsyncSendStringTest(echoProxy);
            break;
        case SEND_STRUCT:
            performAsyncSendStructTest(echoProxy);
            break;
        case SEND_BYTEARRAY:
            performAsyncSendByteArrayTest(echoProxy);
            break;
        default:
            Log.error("Unknown test type used");
            break;
        }
    } else {
        Log.error("Unknown communication mode used");
    }
}
 
开发者ID:bmwcarit,项目名称:joynr,代码行数:39,代码来源:ConsumerApplication.java

示例14: start

import jline.internal.Log; //导入方法依赖的package包/类
/**
 * Start the ssh daemon.
 */
public void start() {
    final String portString = System.getProperty(COMMANDER_SSH_PORT);
    if (portString == null) {
        Log.warn("No 'commander.ssh.port' specified, ssh support will not be enabled!");
        return;
    }

    int port;
    try {
        port = Integer.parseInt(portString);
    } catch (NumberFormatException ex) {
        Log.error("Bad port '" + portString + "' specified, ssh support will not be enabled!");
        return;
    }

    final String username = System.getProperty(COMMANDER_SSH_USERNAME);
    if (username == null) {
        Log.warn("No 'commander.ssh.username' specified, ssh support will not be enabled!");
        return;
    }

    final String password = System.getProperty(COMMANDER_SSH_PASSWORD);
    if (password == null) {
        Log.warn("No 'commander.ssh.password' specified, ssh support will not be enabled!");
        return;
    }

    this.sshd = SshServer.setUpDefaultServer();
    sshd.setPasswordAuthenticator(new PasswordAuthenticator() {
        @Override
        public boolean authenticate(@Nullable String u, @Nullable String p, ServerSession serverSession) {
            if (p == null || u == null) {
                return false;
            }
            return MessageDigest.isEqual(username.getBytes(StandardCharsets.UTF_8), u.getBytes(StandardCharsets.UTF_8))
                    && MessageDigest.isEqual(password.getBytes(StandardCharsets.UTF_8), p.getBytes(StandardCharsets.UTF_8));
        }
    });
    sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));


    sshd.setPort(port);

    sshd.setShellFactory(new CommanderSshCommandFactory());

    try {
        sshd.start();
        Log.info("Ssh support started on port " + port);
    } catch (IOException e) {
        Log.error("Couldn't start the ssh daemon", e);
    }
}
 
开发者ID:nikolavp,项目名称:commander-shell,代码行数:56,代码来源:SSHD.java


注:本文中的jline.internal.Log.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。