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 committed May 28, 2022
1 parent ba6e3a0 commit 1488ac5
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion launch/jdt.ls.remote.server.launch
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,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 launch/jdt.ls.socket-stream.launch
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,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
9 changes: 1 addition & 8 deletions org.eclipse.jdt.ls.core/logback.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>

</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public void start(BundleContext bundleContext) throws Exception {
setPreferenceNodeId();

// Override logback preferences *before* M2E plugin is activated below
if (isDebug && System.getProperty(LOGBACK_CONFIG_FILE_PROPERTY) == null) {
if (System.getProperty(LOGBACK_CONFIG_FILE_PROPERTY) == null) {
File stateDir = getStateLocation().toFile();
File configFile = new File(stateDir, LOGBACK_DEFAULT_FILENAME);
if (!configFile.isFile()) {
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
2 changes: 1 addition & 1 deletion org.eclipse.jdt.ls.product/languageServer.product
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<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"/>
Expand All @@ -63,7 +64,6 @@
<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 1488ac5

Please sign in to comment.