Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Thoms2017-04-06 06:37:22 +0000
committerKarsten Thoms2017-04-06 06:37:22 +0000
commit9a2188080b901060f79f5aa4408a7f508ce3e369 (patch)
tree886d4a7061d96edab12dde74d4df3f5e7df6ec0f /bundles/org.eclipse.equinox.p2.artifact.repository/src
parent88b5ff073f8a6d4a62a6054a60e4a5248791e79d (diff)
downloadrt.equinox.p2-9a2188080b901060f79f5aa4408a7f508ce3e369.tar.gz
rt.equinox.p2-9a2188080b901060f79f5aa4408a7f508ce3e369.tar.xz
rt.equinox.p2-9a2188080b901060f79f5aa4408a7f508ce3e369.zip
Bug 514807 - Avoid instantiation of empty array for processing stepsY20170413-1000I20170413-2000
Change-Id: Ie1a3b45efc2ce33b871db4476c4b86e7ab74f3a4 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
index ff7e45fa1..334119a02 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
@@ -46,6 +46,7 @@ public class SimpleArtifactRepositoryIO {
private final IProvisioningAgent agent;
private Location lockLocation = null;
+ static final IProcessingStepDescriptor[] EMPTY_STEPS = new ProcessingStepDescriptor[0];
public SimpleArtifactRepositoryIO(IProvisioningAgent agent) {
this.agent = agent;
@@ -535,7 +536,7 @@ public class SimpleArtifactRepositoryIO {
properties = (repositoryPropertiesHandler == null ? new OrderedProperties(0) : repositoryPropertiesHandler.getProperties());
currentArtifact.addRepositoryProperties(properties);
- IProcessingStepDescriptor[] processingSteps = (processingStepsHandler == null ? new ProcessingStepDescriptor[0] //
+ IProcessingStepDescriptor[] processingSteps = (processingStepsHandler == null ? EMPTY_STEPS //
: processingStepsHandler.getProcessingSteps());
currentArtifact.setProcessingSteps(processingSteps);
artifacts.add(currentArtifact);
@@ -554,7 +555,7 @@ public class SimpleArtifactRepositoryIO {
}
public IProcessingStepDescriptor[] getProcessingSteps() {
- return processingSteps.toArray(new ProcessingStepDescriptor[processingSteps.size()]);
+ return processingSteps.isEmpty() ? EMPTY_STEPS : processingSteps.toArray(new ProcessingStepDescriptor[processingSteps.size()]);
}
public void startElement(String name, Attributes attributes) {

Back to the top