Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractScriptGenerator.newAntScript: revert close stream #967 #984

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.publisher.eclipse.FeatureEntry;

Check warning on line 50 in build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.util.NLS;
Expand Down Expand Up @@ -252,9 +252,21 @@
}

protected static AntScript newAntScript(String scriptLocation, String scriptName) throws CoreException {
try (OutputStream scriptStream = new BufferedOutputStream(new FileOutputStream(scriptLocation + '/' + scriptName))) {
return new AntScript(scriptStream);
} catch (IOException e) {
try {
@SuppressWarnings("resource") // intentional return AntScript without closed stream
OutputStream scriptStream = new BufferedOutputStream(new FileOutputStream(scriptLocation + '/' + scriptName));
try {
return new AntScript(scriptStream);
} catch (IOException e) {
try {
scriptStream.close();
} catch (IOException e1) {
e.addSuppressed(e1);
}
String message = NLS.bind(Messages.exception_writingFile, scriptLocation + '/' + scriptName);
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_WRITING_FILE, message, e));
}
} catch (FileNotFoundException e) {
String message = NLS.bind(Messages.exception_writingFile, scriptLocation + '/' + scriptName);
throw new CoreException(new Status(IStatus.ERROR, PI_PDEBUILD, EXCEPTION_WRITING_FILE, message, e));
}
Expand Down Expand Up @@ -785,8 +797,8 @@
version = oldVersion.getMajor() + "." + oldVersion.getMinor() + "." + oldVersion.getMicro() + "." + Utils.getPropertyFormat(PROPERTY_P2_PRODUCT_QUALIFIER); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}

List<FeatureEntry> productEntries = product.getProductEntries();

Check warning on line 800 in build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:
String mappings = Utils.getEntryVersionMappings(productEntries.toArray(new FeatureEntry[productEntries.size()]), site, assemblyInfo);

Check warning on line 801 in build/org.eclipse.pde.build/src/org/eclipse/pde/internal/build/AbstractScriptGenerator.java

View check run for this annotation

Jenkins - eclipse-pde / Java Compiler

tycho-compiler:compile

NORMAL:

script.println("<eclipse.idReplacer productFilePath=\"" + AntScript.getEscaped(productFilePath) + "\""); //$NON-NLS-1$ //$NON-NLS-2$
script.println(" selfVersion=\"" + version + "\" "); //$NON-NLS-1$ //$NON-NLS-2$
Expand Down
Loading