Skip to content

Commit

Permalink
Update M2E to 2.0.0 (Vulnerability in Apache Lucene 8.9)
Browse files Browse the repository at this point in the history
Signed-off-by: Snjezana Peco <snjezana.peco@redhat.com>
  • Loading branch information
snjeza authored and rgrunber committed Jun 1, 2022
1 parent 73b64b9 commit 6c32243
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 58 deletions.
7 changes: 2 additions & 5 deletions launch/jdt.ls.remote.server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<setAttribute key="selected_features"/>
<setAttribute key="selected_target_bundles">
<setEntry value="ch.qos.logback.classic@default:default"/>
<setEntry value="ch.qos.logback.core@default:default"/>
<setEntry value="ch.qos.logback.slf4j@default:default"/>
<setEntry value="com.google.gson@default:default"/>
<setEntry value="com.google.guava@default:default"/>
<setEntry value="javax.inject@default:default"/>
Expand Down Expand Up @@ -93,7 +90,7 @@
<setEntry value="org.eclipse.m2e.core@default:default"/>
<setEntry value="org.eclipse.m2e.jdt@default:default"/>
<setEntry value="org.eclipse.m2e.lifecyclemapping.defaults@default:default"/>
<setEntry value="org.eclipse.m2e.logback.configuration@default:default"/>
<setEntry value="org.apache.commons.codec@default:default"/>
<setEntry value="org.eclipse.m2e.maven.indexer@default:default"/>
<setEntry value="org.eclipse.m2e.maven.runtime.slf4j.simple@default:default"/>
<setEntry value="org.eclipse.m2e.maven.runtime@default:default"/>
Expand All @@ -110,7 +107,7 @@
<setEntry value="org.eclipse.xtext.xbase.lib@default:default"/>
<setEntry value="org.gradle.toolingapi@default:default"/>
<setEntry value="org.hamcrest.core@default:default"/>
<setEntry value="org.jboss.tools.maven.apt.core@default:default"/>
<setEntry value="org.eclipse.m2e.apt.core@default:default"/>
<setEntry value="org.junit@default:default"/>
<setEntry value="org.slf4j.api@default:default"/>
</setAttribute>
Expand Down
7 changes: 2 additions & 5 deletions launch/jdt.ls.socket-stream.launch
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<setAttribute key="selected_features"/>
<setAttribute key="selected_target_bundles">
<setEntry value="ch.qos.logback.classic@default:default"/>
<setEntry value="ch.qos.logback.core@default:default"/>
<setEntry value="ch.qos.logback.slf4j@default:default"/>
<setEntry value="com.google.gson@default:default"/>
<setEntry value="com.google.guava@default:default"/>
<setEntry value="javax.inject@default:default"/>
Expand Down Expand Up @@ -94,7 +91,7 @@
<setEntry value="org.eclipse.m2e.core@default:default"/>
<setEntry value="org.eclipse.m2e.jdt@default:default"/>
<setEntry value="org.eclipse.m2e.lifecyclemapping.defaults@default:default"/>
<setEntry value="org.eclipse.m2e.logback.configuration@default:default"/>
<setEntry value="org.apache.commons.codec@default:default"/>
<setEntry value="org.eclipse.m2e.maven.indexer@default:default"/>
<setEntry value="org.eclipse.m2e.maven.runtime.slf4j.simple@default:default"/>
<setEntry value="org.eclipse.m2e.maven.runtime@default:default"/>
Expand All @@ -111,7 +108,7 @@
<setEntry value="org.eclipse.xtext.xbase.lib@default:default"/>
<setEntry value="org.gradle.toolingapi@default:default"/>
<setEntry value="org.hamcrest.core@default:default"/>
<setEntry value="org.jboss.tools.maven.apt.core@default:default"/>
<setEntry value="org.eclipse.m2e.apt.core@default:default"/>
<setEntry value="org.junit@default:default"/>
<setEntry value="org.slf4j.api@default:default"/>
</setAttribute>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.12.0",
org.eclipse.xtext.xbase.lib,
org.eclipse.core.filesystem;bundle-version="1.7.0",
org.eclipse.jdt.apt.pluggable.core;bundle-version="1.2.0";resolution:=optional,
org.jboss.tools.maven.apt.core;bundle-version="1.3.0";resolution:=optional
org.eclipse.m2e.apt.core;bundle-version="1.3.0";resolution:=optional
Export-Package: org.eclipse.jdt.ls.core.internal;x-friends:="org.eclipse.jdt.ls.tests,org.eclipse.jdt.ls.tests.syntaxserver",
org.eclipse.jdt.ls.core.internal.codemanipulation;x-friends:="org.eclipse.jdt.ls.tests",
org.eclipse.jdt.ls.core.internal.commands;x-friends:="org.eclipse.jdt.ls.tests",
Expand Down
1 change: 0 additions & 1 deletion org.eclipse.jdt.ls.core/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ bin.includes = META-INF/,\
lib/jsoup-1.14.2.jar,\
lib/remark-1.2.0.jar,\
lifecycle-mapping-metadata.xml,\
logback.xml,\
plugin.properties,\
gradle/checksums/checksums.json,\
gradle/checksums/versions.json
Expand Down
10 changes: 0 additions & 10 deletions org.eclipse.jdt.ls.core/logback.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,6 @@ public class JavaLanguageServerPlugin extends Plugin {
public static final String HTTPS_PROXY_USER = "https.proxyUser";
public static final String HTTP_PROXY_USER = "http.proxyUser";

private static final String LOGBACK_CONFIG_FILE_PROPERTY = "logback.configurationFile";
private static final String LOGBACK_DEFAULT_FILENAME = "logback.xml";

/**
* Source string send to clients for messages such as diagnostics.
**/
Expand Down Expand Up @@ -176,25 +173,6 @@ public void start(BundleContext bundleContext) throws Exception {
JavaLanguageServerPlugin.pluginInstance = this;
setPreferenceNodeId();

// Override logback preferences *before* M2E plugin is activated below
if (isDebug && System.getProperty(LOGBACK_CONFIG_FILE_PROPERTY) == null) {
File stateDir = getStateLocation().toFile();
File configFile = new File(stateDir, LOGBACK_DEFAULT_FILENAME);
if (!configFile.isFile()) {
try (InputStream is = bundleContext.getBundle().getEntry(LOGBACK_DEFAULT_FILENAME).openStream(); FileOutputStream fos = new FileOutputStream(configFile)) {
for (byte[] buffer = new byte[1024 * 4];;) {
int n = is.read(buffer);
if (n < 0) {
break;
}
fos.write(buffer, 0, n);
}
}
}
// ContextInitializer.CONFIG_FILE_PROPERTY
System.setProperty(LOGBACK_CONFIG_FILE_PROPERTY, configFile.getAbsolutePath());
}

if (JDTEnvironmentUtils.isSyntaxServer()) {
disableServices();
preferenceManager = new PreferenceManager();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.MavenModelManager;
import org.eclipse.m2e.core.internal.IMavenConstants;
import org.eclipse.m2e.core.internal.MavenPluginActivator;
import org.eclipse.m2e.core.internal.preferences.MavenConfigurationImpl;
import org.eclipse.m2e.core.project.IMavenProjectImportResult;
import org.eclipse.m2e.core.project.IProjectConfigurationManager;
import org.eclipse.m2e.core.project.LocalProjectScanner;
import org.eclipse.m2e.core.project.MavenProjectInfo;
import org.eclipse.m2e.core.project.ProjectImportConfiguration;
import org.osgi.framework.Bundle;

@SuppressWarnings("restriction")
public class MavenProjectImporter extends AbstractProjectImporter {
Expand All @@ -68,6 +68,8 @@ public class MavenProjectImporter extends AbstractProjectImporter {

public static final String POM_FILE = "pom.xml";

private static final String STATE_FILENAME = "workspaceState.ser";

private Set<MavenProjectInfo> projectInfos = null;

private IProjectConfigurationManager configurationManager;
Expand Down Expand Up @@ -232,8 +234,14 @@ public void importToWorkspace(IProgressMonitor monitor) throws CoreException, Op
}

private long getLastWorkspaceStateModified() {
File workspaceStateFile = MavenPluginActivator.getDefault().getMavenProjectManager().getWorkspaceStateFile();
return workspaceStateFile.lastModified();
Bundle bundle = Platform.getBundle(IMavenConstants.PLUGIN_ID);
if (bundle != null) {
IPath result = Platform.getStateLocation(bundle);
File bundleStateLocation = result.toFile();
File workspaceStateFile = new File(bundleStateLocation, STATE_FILENAME);
return workspaceStateFile.lastModified();
}
return 0l;
}

private File getProjectDirectory() {
Expand Down Expand Up @@ -288,7 +296,7 @@ private Set<MavenProjectInfo> getMavenProjects(File directory, MavenModelManager
}
try {
List<String> folders = directories.stream().map(java.nio.file.Path::toAbsolutePath).map(Object::toString).collect(Collectors.toList());
LocalProjectScanner scanner = new LocalProjectScanner(directory.getParentFile(), folders, false, modelManager);
LocalProjectScanner scanner = new LocalProjectScanner(folders, false, modelManager);
scanner.run(monitor);
return collectProjects(scanner.getProjects());
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin;
import org.eclipse.m2e.apt.MavenJdtAptPlugin;
import org.eclipse.m2e.apt.preferences.PreferencesConstants;
import org.eclipse.m2e.core.MavenPlugin;
import org.eclipse.m2e.core.embedder.IMavenConfiguration;
import org.eclipse.m2e.core.internal.IMavenConstants;
Expand All @@ -38,7 +40,7 @@
*
*/
public class StandardPreferenceManager extends PreferenceManager {
private static final String M2E_APT_ID = "org.jboss.tools.maven.apt";
private static final String M2E_APT_ID = MavenJdtAptPlugin.PLUGIN_ID;
private IMavenConfiguration mavenConfig;

public StandardPreferenceManager() {
Expand All @@ -55,7 +57,7 @@ public static void initializeMavenPreferences() {

IEclipsePreferences m2eAptPrefs = DefaultScope.INSTANCE.getNode(M2E_APT_ID);
if (m2eAptPrefs != null) {
m2eAptPrefs.put(M2E_APT_ID + ".mode", "jdt_apt");
m2eAptPrefs.put(PreferencesConstants.MODE, "jdt_apt");
}

IEclipsePreferences store = InstanceScope.INSTANCE.getNode(IMavenConstants.PLUGIN_ID);
Expand Down
4 changes: 2 additions & 2 deletions org.eclipse.jdt.ls.product/languageServer.product
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
</vm>

<plugins>
<plugin id="org.apache.commons.codec"/>
<plugin id="org.apache.felix.scr"/>
<plugin id="org.eclipse.ant.core"/>
<plugin id="org.eclipse.buildship.core"/>
Expand Down Expand Up @@ -52,18 +53,17 @@
<plugin id="org.eclipse.jdt.launching"/>
<plugin id="org.eclipse.jdt.launching.macosx"/>
<plugin id="org.eclipse.jdt.ls.core"/>
<plugin id="org.eclipse.m2e.apt.core"/>
<plugin id="org.eclipse.m2e.core"/>
<plugin id="org.eclipse.m2e.jdt"/>
<plugin id="org.eclipse.m2e.lifecyclemapping.defaults"/>
<plugin id="org.eclipse.m2e.logback.configuration"/>
<plugin id="org.eclipse.m2e.maven.runtime"/>
<plugin id="org.eclipse.m2e.workspace.cli"/>
<plugin id="org.eclipse.osgi"/>
<plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/>
<plugin id="org.eclipse.osgi.services"/>
<plugin id="org.eclipse.text"/>
<plugin id="org.eclipse.xtext.xbase.lib"/>
<plugin id="org.jboss.tools.maven.apt.core"/>
</plugins>

<configurations>
Expand Down
6 changes: 1 addition & 5 deletions org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.m2e.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.m2e.logback.feature.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/technology/m2e/releases/1.18.2/"/>
<repository location="https://download.eclipse.org/technology/m2e/snapshots/latest/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.equinox.core.feature.feature.group" version="0.0.0"/>
Expand All @@ -37,10 +37,6 @@
<unit id="org.eclipse.xtext.sdk.feature.group" version="0.0.0"/>
<repository location="https://download.eclipse.org/releases/2021-09/202109151000/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.jboss.tools.maven.apt.core" version="0.0.0"/>
<repository location="https://jbosstools.github.io/m2e-apt/updates/1.5.4/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/lsp4j/updates/releases/0.11.0/"/>
<unit id="org.eclipse.lsp4j.sdk.feature.group" version="0.0.0"/>
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Require-Bundle: org.eclipse.jdt.ls.core,
org.eclipse.jdt.launching,
org.eclipse.ltk.core.refactoring,
org.eclipse.jdt.apt.pluggable.core,
org.jboss.tools.maven.apt.core,
org.eclipse.m2e.apt.core,
org.eclipse.buildship.core
Bundle-Vendor: %Bundle-Vendor
Bundle-Activator: org.eclipse.jdt.ls.core.internal.JavaLanguageServerTestPlugin

0 comments on commit 6c32243

Please sign in to comment.