Skip to content

Commit

Permalink
Merge branch 'master' into fixNpe
Browse files Browse the repository at this point in the history
  • Loading branch information
basilevs committed Apr 4, 2024
2 parents dcb0a63 + 55d9d6d commit 6b3e764
Show file tree
Hide file tree
Showing 120 changed files with 1,700 additions and 1,168 deletions.
126 changes: 19 additions & 107 deletions devenv/launches/RCPTT IDE AUT.launch

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion devenv/launches/RCPTT IDE Self AUT.launch

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions devenv/launches/RCPTT IDE.launch
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<setEntry value="org.eclipse.jdt.apt.core@default:default"/>
<setEntry value="org.eclipse.jdt.apt.pluggable.core@default:default"/>
<setEntry value="org.eclipse.jdt.apt.ui@default:default"/>
<setEntry value="org.eclipse.jdt.core.compiler.batch@default:default"/>
<setEntry value="org.eclipse.jdt.core.formatterapp@default:default"/>
<setEntry value="org.eclipse.jdt.core.manipulation@default:default"/>
<setEntry value="org.eclipse.jdt.core@default:default"/>
Expand Down Expand Up @@ -492,6 +493,7 @@
<setEntry value="org.eclipse.rcptt.launching.ext@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.injection@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.p2utils@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.rap.ui@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.remote.ui@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.remote@default:default"/>
<setEntry value="org.eclipse.rcptt.launching.tests@default:false"/>
Expand Down
4 changes: 2 additions & 2 deletions ecl/plugins/org.eclipse.rcptt.ecl.core/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
11 changes: 11 additions & 0 deletions ecl/plugins/org.eclipse.rcptt.ecl.core/.project
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,15 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1711017410074</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-true-false-target</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundle-Version: 2.5.5.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.eclipse.rcptt.ecl.core,
org.eclipse.rcptt.ecl.core.impl,
org.eclipse.rcptt.ecl.core.util,
Expand Down
3 changes: 2 additions & 1 deletion ecl/plugins/org.eclipse.rcptt.ecl.core/model/ecl.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="message" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="stackTrace" upperBound="-1"
eType="#//EclStackTraceEntry" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="throwable" eType="#//Throwable"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="throwable" eType="#//Throwable"
transient="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="cause" eType="#//EclException"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="status" eType="#//ProcessStatus"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public interface EclException extends EObject {
* @return the value of the '<em>Throwable</em>' attribute.
* @see #setThrowable(Throwable)
* @see org.eclipse.rcptt.ecl.core.CorePackage#getEclException_Throwable()
* @model dataType="org.eclipse.rcptt.ecl.core.Throwable"
* @model dataType="org.eclipse.rcptt.ecl.core.Throwable" transient="true"
* @generated
*/
Throwable getThrowable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,7 @@ public void initializePackageContents() {
initEAttribute(getEclException_ClassName(), theEcorePackage.getEString(), "className", null, 0, 1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getEclException_Message(), theEcorePackage.getEString(), "message", null, 0, 1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getEclException_StackTrace(), this.getEclStackTraceEntry(), null, "stackTrace", null, 0, -1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getEclException_Throwable(), this.getThrowable(), "throwable", null, 0, 1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getEclException_Throwable(), this.getThrowable(), "throwable", null, 0, 1, EclException.class, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getEclException_Cause(), this.getEclException(), null, "cause", null, 0, 1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getEclException_Status(), this.getProcessStatus(), null, "status", null, 0, 1, EclException.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
*******************************************************************************/
package org.eclipse.rcptt.ecl.internal.core;

import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
Expand Down Expand Up @@ -65,57 +69,135 @@ public IStatus fromEObject(ProcessStatus ps) {
ps.getMessage(), th);
}
}

private static Optional<Throwable> constructWithMessageAndCause(Class<?> clazz, EclException exception, Consumer<Throwable> suppress) {
try {
Constructor<?> constructor = clazz.getConstructor(
String.class, Throwable.class);
Throwable newInstance = (Throwable) constructor
.newInstance(exception.getMessage(), getThrowable(exception.getCause()));
return Optional.of(newInstance);
} catch (NoSuchMethodException e) {
} catch (InstantiationException| IllegalAccessException | IllegalArgumentException |InvocationTargetException e) {
suppress.accept(e);
}
return Optional.empty();
}

private static Optional<Throwable> constructWithStatus(Class<?> clazz, EclException exception, Consumer<Throwable> suppress) {
try {
if (exception.getStatus() != null) {
Constructor<?> constructor = clazz.getConstructor(IStatus.class);
Throwable newInstance = (Throwable) constructor
.newInstance(toIStatus(exception.getStatus()));
return Optional.of(newInstance);
}
} catch (NoSuchMethodException e) {
} catch (InstantiationException| IllegalAccessException | IllegalArgumentException |InvocationTargetException e) {
suppress.accept(e);
}
return Optional.empty();
}

private static Optional<Throwable> constructWithMessage(Class<?> clazz, EclException exception, Consumer<Throwable> suppress) {
try {
Constructor<?> constructor = clazz.getConstructor(String.class);
Throwable newInstance = (Throwable) constructor
.newInstance(exception.getMessage());
return Optional.of(newInstance);
} catch (NullPointerException | NoSuchMethodException e) {
} catch (InstantiationException| IllegalAccessException | IllegalArgumentException |InvocationTargetException e) {
suppress.accept(e);
}
return Optional.empty();
}

private static Optional<Throwable> constructWithCause(Class<?> clazz, EclException exception, Consumer<Throwable> suppress) {
try {
Constructor<?> constructor = clazz.getConstructor(Throwable.class);
Throwable newInstance = (Throwable) constructor
.newInstance(getThrowable(exception.getCause()));
return Optional.of(newInstance);
} catch (NullPointerException | NoSuchMethodException e) {
} catch (InstantiationException| IllegalAccessException | IllegalArgumentException |InvocationTargetException e) {
suppress.accept(e);
}
return Optional.empty();
}


private static Optional<Throwable> constructWithoutArguments(Class<?> clazz, EclException exception, Consumer<Throwable> suppress) {
try {
Constructor<?> constructor = clazz.getConstructor();
Throwable newInstance = (Throwable) constructor.newInstance();
return Optional.of(newInstance);
} catch (NoSuchMethodException e) {
} catch (InstantiationException| IllegalAccessException | IllegalArgumentException |InvocationTargetException e) {
suppress.accept(e);
}
return Optional.empty();
}




public static Throwable getThrowable(EclException exception) {
if (exception == null)
return null;
Throwable th = null;
List<Throwable> suppressed = new ArrayList<>();
// Try to restore stored exception.
try {
// Try to restore stored exception.
th = exception.getThrowable();
if (!Objects.equals(th.getClass().getName(), exception.getClassName())) {
throw new IllegalStateException(String.format("Bad class, expected: %s, actual: %s ", exception.getClassName(), th.getClass().getName()));
}
} catch (Throwable ee) {
// Failed to restore exception, try to construct new one
try {
String className = exception.getClassName();
Class<?> forName = Class.forName(className);
try {
Constructor<?> constructor = forName.getConstructor(
String.class, Throwable.class);
Throwable newInstance = (Throwable) constructor
.newInstance(exception.getMessage(), getThrowable(exception.getCause()));
th = newInstance;
} catch (NoSuchMethodException e) {
if (exception.getStatus() == null)
throw e;
Constructor<?> constructor = forName.getConstructor(IStatus.class);
Throwable newInstance = (Throwable) constructor
.newInstance(toIStatus(exception.getStatus()));
th = newInstance;
th.addSuppressed(e);
}
th.addSuppressed(ee);
} catch (Exception eee) {
if (exception.getStatus() != null) {
th = new CoreException(toIStatus(exception.getStatus()));
} else {
th = new Exception(exception.getMessage(), getThrowable(exception.getCause()));
}
th.addSuppressed(eee);
Throwable th = exception.getThrowable();
if (th != null && Objects.equals(th.getClass().getName(), exception.getClassName())) {
return th;
}
} catch (RuntimeException e) {
suppressed.add(e);
}
if (th != null) {
copyAttributesFromEObject(exception, th);

// Failed to restore exception, try to construct new one

Class<?> clazz;
try {
String className = exception.getClassName();
clazz = Class.forName(className);
} catch (ClassNotFoundException e) {
suppressed.add(e);
clazz = IOException.class;
}

Optional<Throwable> result;

result = constructWithMessageAndCause(clazz, exception, suppressed::add);

if (!result.isPresent()) {
result = constructWithStatus(clazz, exception, suppressed::add);
}

if (!result.isPresent()) {
result = constructWithMessage(clazz, exception, suppressed::add);
}
return th;

if (!result.isPresent()) {
result = constructWithCause(clazz, exception, suppressed::add);
}

if (!result.isPresent()) {
result = constructWithoutArguments(clazz, exception, suppressed::add);
}

Throwable finalResult = result.orElse(new IOException(exception.getClassName() + ": " + exception.getMessage()));
copyAttributesFromEObject(exception, finalResult);
suppressed.forEach(finalResult::addSuppressed);
exception.setThrowable(finalResult);
return finalResult;
}

private static void copyAttributesFromEObject(EclException exception, Throwable newInstance) {
EList<EclStackTraceEntry> list = exception.getStackTrace();
if (list.size() > 0) {
newInstance.setStackTrace(constructStack(list));
newInstance.setStackTrace(constructStack(list));
if (newInstance.getCause() == null && exception.getCause() != null) {
newInstance.initCause(getThrowable(exception.getCause()));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target includeMode="feature" name="2022-03" sequenceNumber="95">
<target includeMode="feature" name="2023-06" sequenceNumber="95">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.7.0.v20170129-0911"/>
<unit id="com.google.guava" version="27.1.0.v20190517-1946"/>
<unit id="org.hamcrest" version="0.0.0"/>
<unit id="org.mockito" version="0.0.0"/>
<unit id="org.apache.commons.lang3" version="0.0.0"/>
<unit id="org.apache.poi" version="0.0.0"/>
<unit id="org.apache.poi.ooxml" version="0.0.0"/>
<unit id="org.apache.poi" version="3.9.0.v201405241750"/>
<unit id="org.apache.poi.ooxml" version="3.9.0.v201405241905"/>
<unit id="com.sun.xml.bind" version="0.0.0"/>
<unit id="javax.activation" version="0.0.0"/>
<unit id="javax.xml" version="0.0.0"/>
<unit id="org.apache.httpcomponents.httpcore" version="0.0.0"/>
<unit id="org.apache.httpcomponents.httpclient" version="0.0.0"/>
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20210223232630/repository"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.nebula.widgets.grid.feature.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/nebula/releases/latest"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="http://download.eclipse.org/releases/2022-03"/>
<repository location="http://download.eclipse.org/releases/2023-06"/>
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/>
<unit id="org.eclipse.platform.sdk" version="0.0.0"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.emf.common.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.edit.ui.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.emf.transaction.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.gef.sdk.feature.group" version="0.0.0"/>
<unit id="org.eclipse.gmf.feature.group" version="0.0.0"/>
<unit id="org.antlr.runtime" version="3.2.0.v201101311130"/>
<unit id="org.eclipse.emf.common.feature.group" version="2.25.0.v20220123-0838"/>
<unit id="org.eclipse.emf.edit.ui.feature.group" version="2.23.0.v20220226-1304"/>
<unit id="org.eclipse.emf.sdk.feature.group" version="2.29.0.v20220226-1304"/>
<unit id="org.eclipse.emf.transaction.sdk.feature.group" version="1.12.0.201805140824"/>
<unit id="org.eclipse.gmf.feature.group" version="1.14.1.202202190902"/>
<unit id="org.jsoup" version="0.0.0"/>
<repository location="http://download.eclipse.org/releases/2022-03"/>
<unit id="org.eclipse.gef.sdk.feature.group" version="3.11.0.201606061308"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.aspectj.runtime" version="0.0.0"/>
Expand All @@ -43,8 +42,8 @@
<repository location="http://download.eclipse.org/tools/ajdt/410/dev/update"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<repository location="https://download.eclipse.org/swtchart/releases/0.12.0/repository"/>
<unit id="org.eclipse.swtchart.feature.source.feature.group" version="0.12.0.202003130409"/>
<repository location="https://download.eclipse.org/swtchart/releases/0.14.0/repository"/>
<unit id="org.eclipse.swtchart.feature.source.feature.group" version="0.0.0"/>
</location>
</locations>
</target>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rcptt.launching.injection;bundle-version="[2.5.5,3.0.0)",
org.eclipse.pde.core,
org.eclipse.equinox.p2.repository.tools,
org.eclipse.equinox.p2.director,
org.eclipse.equinox.p2.director;bundle-version="2.6.200",
org.eclipse.rcptt.util;bundle-version="[2.5.5,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public static void expandFeatures(IProgressMonitor monitor, IMetadataRepository
false); // slicingOptions.followOnlyFilteredRequirements());

IQueryable<IInstallableUnit> slice = slicer
.slice(availableUnits.toArray(new IInstallableUnit[availableUnits.size()]), monitor);
.slice(availableUnits, monitor);
availableUnits.addAll(slice.query(QueryUtil.ALL_UNITS, monitor).toSet());
}
}
2 changes: 1 addition & 1 deletion launching/org.eclipse.rcptt.launching/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-16"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=16
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=16
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=16
2 changes: 1 addition & 1 deletion launching/org.eclipse.rcptt.launching/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.rcptt.core.launching;bundle-version="[2.5.5,3.0.0)",
org.eclipse.rcptt.verifications;bundle-version="[2.5.5,3.0.0)",
org.eclipse.rcptt.reporting.util;bundle-version="[2.5.5,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-16
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.rcptt.internal.launching,
org.eclipse.rcptt.internal.launching.aut,
Expand Down
Loading

0 comments on commit 6b3e764

Please sign in to comment.