Skip to content

Apache Lucene open-source search software

LUCENE-10313: merge log4j-less Luke.

Dawid Weiss9917092bf847
diff --cc lucene/luke/build.gradle
index ac300811ac0,fe556ca9527..6def3e6d88b
--- a/lucene/luke/build.gradle
+++ b/lucene/luke/build.gradle
@@@ -25,27 -25,25 +25,25 @@@ ext
}
dependencies {
- api project(':lucene:core')
-
- implementation project(':lucene:codecs')
- implementation project(':lucene:backward-codecs')
- implementation project(':lucene:analysis:common')
- implementation project(':lucene:queries')
- implementation project(':lucene:queryparser')
- implementation project(':lucene:misc')
-
- implementation project(":lucene:highlighter")
- implementation project(':lucene:analysis:icu')
- implementation project(':lucene:analysis:kuromoji')
- implementation project(':lucene:analysis:morfologik')
- implementation project(':lucene:analysis:nori')
- implementation project(':lucene:analysis:opennlp')
- implementation project(':lucene:analysis:phonetic')
- implementation project(':lucene:analysis:smartcn')
- implementation project(':lucene:analysis:stempel')
- implementation project(':lucene:suggest')
+ moduleApi project(':lucene:core')
+
- moduleImplementation 'org.apache.logging.log4j:log4j-core'
-
+ moduleImplementation project(':lucene:codecs')
+ moduleImplementation project(':lucene:backward-codecs')
+ moduleImplementation project(':lucene:analysis:common')
+ moduleImplementation project(':lucene:queries')
+ moduleImplementation project(':lucene:queryparser')
+ moduleImplementation project(':lucene:misc')
+
+ moduleImplementation project(":lucene:highlighter")
+ moduleImplementation project(':lucene:analysis:icu')
+ moduleImplementation project(':lucene:analysis:kuromoji')
+ moduleImplementation project(':lucene:analysis:morfologik')
+ moduleImplementation project(':lucene:analysis:nori')
+ moduleImplementation project(':lucene:analysis:opennlp')
+ moduleImplementation project(':lucene:analysis:phonetic')
+ moduleImplementation project(':lucene:analysis:smartcn')
+ moduleImplementation project(':lucene:analysis:stempel')
+ moduleImplementation project(':lucene:suggest')
testImplementation project(':lucene:test-framework')
}
diff --cc lucene/luke/src/java-module/module-info.java
index 2c1b141ed5d,00000000000..101d4ae3f8b
mode 100644,000000..100644
--- a/lucene/luke/src/java-module/module-info.java
+++ b/lucene/luke/src/java-module/module-info.java
@@@ -1,30 -1,0 +1,27 @@@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** Luke : Lucene toolbox project. */
- @SuppressWarnings({"requires-automatic"})
+module org.apache.lucene.luke {
+ requires java.desktop;
+ requires java.logging;
+ requires org.apache.lucene.core;
+ requires org.apache.lucene.analysis.common;
+ requires org.apache.lucene.queries;
+ requires org.apache.lucene.queryparser;
+ requires org.apache.lucene.misc;
- requires org.apache.logging.log4j;
- requires org.apache.logging.log4j.core;
+}
diff --cc lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java
index ba47207f9da,f64ec18bd2c..cd78468e3d6
--- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java
+++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java
@@@ -20,12 -20,12 +20,12 @@@ package org.apache.lucene.luke.app.desk
import static org.apache.lucene.luke.app.desktop.util.ExceptionHandler.handle;
import java.awt.GraphicsEnvironment;
-import java.io.IOException;
import java.lang.invoke.MethodHandles;
- import java.nio.file.FileSystems;
+import java.util.concurrent.SynchronousQueue;
+ import java.util.logging.Level;
+ import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.UIManager;
- import org.apache.logging.log4j.Logger;
import org.apache.lucene.luke.app.desktop.components.LukeWindowProvider;
import org.apache.lucene.luke.app.desktop.components.dialog.menubar.OpenIndexDialogFactory;
import org.apache.lucene.luke.app.desktop.util.DialogOpener;
@@@ -75,12 -68,9 +68,12 @@@ public class LukeMain
600,
420,
(factory) -> {});
- } catch (IOException e) {
+
+ return true;
+ } catch (Throwable e) {
messageBroker.showUnknownErrorMessage();
- log.fatal("Cannot initialize components.", e);
+ log.log(Level.SEVERE, "Cannot initialize components.", e);
+ return false;
}
}
@@@ -96,21 -86,6 +89,19 @@@
GraphicsEnvironment genv = GraphicsEnvironment.getLocalGraphicsEnvironment();
genv.registerFont(FontUtils.createElegantIconFont());
- javax.swing.SwingUtilities.invokeLater(LukeMain::createAndShowGUI);
+ var guiThreadResult = new SynchronousQueue<Boolean>();
+ javax.swing.SwingUtilities.invokeLater(
+ () -> {
+ try {
+ guiThreadResult.put(createAndShowGUI());
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ });
+
+ if (Boolean.FALSE.equals(guiThreadResult.take())) {
- // Use java logging just in case log4j didn't start up properly.
- java.util.logging.Logger.getGlobal()
- .severe("Luke could not start because of errors, see the log file: " + LOG_FILE);
++ Logger.getGlobal().log(Level.SEVERE, "Luke could not start.");
+ Runtime.getRuntime().exit(1);
+ }
}
}
diff --cc versions.props
index 1d5eface864,c0103925617..0b1ba24c07b
--- a/versions.props
+++ b/versions.props
@@@ -1,23 -1,21 +1,21 @@@
- com.carrotsearch.randomizedtesting:*=2.7.6
- com.carrotsearch:hppc=0.9.0
- com.google.errorprone:*=2.4.0
- com.ibm.icu:icu4j=70.1
- commons-codec:commons-codec=1.13
- io.sgr:s2-geometry-library-java=1.0.0
- javax.servlet:javax.servlet-api=3.1.0
- junit:junit=4.13.1
- net.sourceforge.nekohtml:nekohtml=1.9.17
- org.antlr:antlr4*=4.5.1-1
- org.apache.commons:commons-compress=1.19
- org.apache.httpcomponents:httpclient=4.5.13
- org.apache.logging.log4j:*=2.13.2
- org.apache.opennlp:opennlp-tools=1.9.1
- org.assertj:*=3.21.0
- org.carrot2:morfologik-*=2.1.8
- org.eclipse.jetty:*=9.4.41.v20210516
- org.hamcrest:*=2.2
- org.locationtech.jts:jts-core=1.17.0
- org.locationtech.spatial4j:*=0.8
- org.ow2.asm:*=7.2
- ua.net.nlp:morfologik-ukrainian-search=4.9.1
+ com.carrotsearch.randomizedtesting:*=2.7.6
+ com.carrotsearch:hppc=0.9.0
+ com.google.errorprone:*=2.4.0
+ com.ibm.icu:icu4j=70.1
+ commons-codec:commons-codec=1.13
+ io.sgr:s2-geometry-library-java=1.0.0
+ javax.servlet:javax.servlet-api=3.1.0
+ junit:junit=4.13.1
+ net.sourceforge.nekohtml:nekohtml=1.9.17
+ org.antlr:antlr4*=4.5.1-1
+ org.apache.commons:commons-compress=1.19
+ org.apache.httpcomponents:httpclient=4.5.13
+ org.apache.opennlp:opennlp-tools=1.9.1
+ org.carrot2:morfologik-*=2.1.8
+ org.eclipse.jetty:*=9.4.41.v20210516
+ org.hamcrest:*=2.2
+ org.locationtech.jts:jts-core=1.17.0
+ org.locationtech.spatial4j:*=0.8
+ org.ow2.asm:*=7.2
+ ua.net.nlp:morfologik-ukrainian-search=4.9.1
-xerces:xercesImpl=2.12.0
+xerces:xercesImpl=2.12.0