Skip to content

Commit

Permalink
GraalVM: fixed java.util.logging problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed May 4, 2020
1 parent 3906925 commit c5eca10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions builtins/src/main/java/org/jline/builtins/TTop.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2020, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -147,7 +147,7 @@ public void run() throws IOException, InterruptedException {
comparator = buildComparator(sort);
delay = delay > 0 ? Math.max(delay, 100) : 1000;
if (stats == null || stats.isEmpty()) {
stats = Arrays.asList(STAT_TID, STAT_NAME, STAT_STATE, STAT_CPU_TIME, STAT_LOCK_OWNER_ID);
stats = new ArrayList<>(Arrays.asList(STAT_TID, STAT_NAME, STAT_STATE, STAT_CPU_TIME, STAT_LOCK_OWNER_ID));
}

Boolean isThreadContentionMonitoringEnabled = null;
Expand Down
12 changes: 10 additions & 2 deletions demo/src/main/java/org/jline/demo/Graal.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
*
* https://opensource.org/licenses/BSD-3-Clause
*/
package org.jline.demo;

import java.io.BufferedReader;
Expand Down Expand Up @@ -238,7 +246,7 @@ public static void main(String[] args) {
// ScriptEngine and command registeries
//
File file = new File(Graal.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
String root = file.getCanonicalPath().replace("classes", "").replaceAll("\\\\", "/"); // forward slashes works better also in windows!
String root = file.getCanonicalPath().replace("graal", "").replaceAll("\\\\", "/"); // forward slashes works better also in windows!
ConfigurationPath configPath = new ConfigurationPath(Paths.get(root), Paths.get(root));
Builtins builtins = new Builtins(Graal::workDir, configPath, null);
MyCommands myCommands = new MyCommands(Graal::workDir);
Expand Down Expand Up @@ -281,7 +289,7 @@ public static void main(String[] args) {
while (true) {
try {
systemRegistry.cleanUp(); // delete temporary variables and reset output streams
String line = reader.readLine("groovy-repl> ");
String line = reader.readLine("graal> ");
line = parser.getCommand(line).startsWith("!") ? line.replaceFirst("!", "! ") : line;
Object result = systemRegistry.execute(line);
if (result != null) {
Expand Down
14 changes: 4 additions & 10 deletions terminal/src/main/java/org/jline/utils/Log.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2020, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -22,8 +22,9 @@
* @author <a href="mailto:gnodet@gmail.com">Guillaume Nodet</a>
* @since 2.0
*/
public final class Log
{
public final class Log {
private static final Logger logger = Logger.getLogger("org.jline");

public static void trace(final Object... messages) {
log(Level.FINEST, messages);
}
Expand Down Expand Up @@ -109,23 +110,16 @@ static void log(final Level level, final Object... messages) {
}

static void logr(final Level level, final Supplier<LogRecord> record) {
/* mrn 3/5/2020 GraalVM
Logger logger = Logger.getLogger("org.jline");
if (logger.isLoggable(level)) {
// inform record of the logger-name
LogRecord tmp = record.get();
tmp.setLoggerName(logger.getName());
logger.log(tmp);
}
*/
}

static boolean isEnabled(Level level) {
/* mrn 3/5/2020 GraalVM
Logger logger = Logger.getLogger("org.jline");
return logger.isLoggable(level);
*/
return false;
}

}

0 comments on commit c5eca10

Please sign in to comment.