diff options
author | sliebig | 2008-02-14 14:21:16 +0000 |
---|---|---|
committer | sliebig | 2008-02-14 14:21:16 +0000 |
commit | 5402ecc039e7c6401b13d8f7a810e600ec5f3e80 (patch) | |
tree | 77a1b29dcdfcaac815102179d8da180de7a8e54f /bundles/org.eclipse.equinox.p2.artifact.processors | |
parent | 72b78e9cbcdcf6bd9b918422f6b2bb0bfeed9611 (diff) | |
download | rt.equinox.p2-5402ecc039e7c6401b13d8f7a810e600ec5f3e80.tar.gz rt.equinox.p2-5402ecc039e7c6401b13d8f7a810e600ec5f3e80.tar.xz rt.equinox.p2-5402ecc039e7c6401b13d8f7a810e600ec5f3e80.zip |
uses protected setter/getters instead of accessing fields in super class
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.processors')
6 files changed, 24 insertions, 31 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/AbstractDeltaProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/AbstractDeltaProcessorStep.java index 6a04f73bf..fb6630c2a 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/AbstractDeltaProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/AbstractDeltaProcessorStep.java @@ -30,7 +30,7 @@ public abstract class AbstractDeltaProcessorStep extends AbstractDeltaStep { public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(descriptor, context); - if (!status.isOK()) + if (!getStatus().isOK()) return; fetchLocalArtifactRepository(); } @@ -43,7 +43,7 @@ public abstract class AbstractDeltaProcessorStep extends AbstractDeltaStep { return; IArtifactRepositoryManager repoMgr = (IArtifactRepositoryManager) ServiceHelper.getService(Activator.getContext(), IArtifactRepositoryManager.class.getName()); if (repoMgr == null) { - status = new Status(IStatus.ERROR, Activator.ID, "Could not get artifact repository manager."); + setStatus(new Status(IStatus.ERROR, Activator.ID, "Could not get artifact repository manager.")); return; } @@ -59,7 +59,7 @@ public abstract class AbstractDeltaProcessorStep extends AbstractDeltaStep { //just skip unreadable repositories } } - status = new Status(IStatus.ERROR, Activator.ID, "No repository available containing key " + key); + setStatus(new Status(IStatus.ERROR, Activator.ID, "No repository available containing key " + key)); } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jardelta/JarDeltaProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jardelta/JarDeltaProcessorStep.java index 6c3651aae..42dda53ab 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jardelta/JarDeltaProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jardelta/JarDeltaProcessorStep.java @@ -47,9 +47,9 @@ public class JarDeltaProcessorStep extends AbstractDeltaProcessorStep { // now write the optimized content to the destination if (resultFile.length() > 0) { InputStream resultStream = new BufferedInputStream(new FileInputStream(resultFile)); - FileUtils.copyStream(resultStream, true, destination, false); + FileUtils.copyStream(resultStream, true, getDestination(), false); } else { - status = new Status(IStatus.ERROR, Activator.ID, "Empty optimized file: " + resultFile); //$NON-NLS-1$ + setStatus(new Status(IStatus.ERROR, Activator.ID, "Empty optimized file: " + resultFile)); //$NON-NLS-1$ } } finally { if (resultFile != null) diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchStep.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchStep.java index f8589afc0..64bbe1301 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchStep.java @@ -41,14 +41,14 @@ public class JBPatchStep extends AbstractDeltaProcessorStep { incomingStream = null; // copy the result of the optimization to the destination. - FileUtils.copyStream(new ByteArrayInputStream(result), true, destination, false); + FileUtils.copyStream(new ByteArrayInputStream(result), true, getDestination(), false); } private DirectByteArrayOutputStream fetchPredecessorBytes(ArtifactDescriptor artifactDescriptor) throws IOException { DirectByteArrayOutputStream result = new DirectByteArrayOutputStream(); - status = repository.getArtifact(artifactDescriptor, result, monitor); - if (!status.isOK()) - throw (IOException) new IOException(status.getMessage()).initCause(status.getException()); + setStatus(repository.getArtifact(artifactDescriptor, result, getProgressMonitor())); + if (!getStatus().isOK()) + throw (IOException) new IOException(getStatus().getMessage()).initCause(getStatus().getException()); return result; } }
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchZipStep.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchZipStep.java index 798a67b4b..de1f22ccc 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchZipStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/jbdiff/JBPatchZipStep.java @@ -37,14 +37,14 @@ public class JBPatchZipStep extends JBPatchStep { incomingStream = null; // copy the result of the optimization to the destination. - SarUtil.sarToZip(new ByteArrayInputStream(result), true, destination, false); + SarUtil.sarToZip(new ByteArrayInputStream(result), true, getDestination(), false); } private DirectByteArrayOutputStream fetchPredecessorBytes(ArtifactDescriptor artifactDescriptor) throws IOException { DirectByteArrayOutputStream zippedPredecessor = new DirectByteArrayOutputStream(); - status = repository.getArtifact(artifactDescriptor, zippedPredecessor, monitor); - if (!status.isOK()) - throw (IOException) new IOException(status.getMessage()).initCause(status.getException()); + setStatus(repository.getArtifact(artifactDescriptor, zippedPredecessor, getProgressMonitor())); + if (!getStatus().isOK()) + throw (IOException) new IOException(getStatus().getMessage()).initCause(getStatus().getException()); DirectByteArrayOutputStream result = new DirectByteArrayOutputStream(); SarUtil.zipToSar(zippedPredecessor.getInputStream(), result); diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java index a218fe511..34cb05637 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java @@ -10,7 +10,8 @@ * IBM Corporation - ongoing development *******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.processors.pack200; -
import java.io.*; + +import java.io.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.equinox.internal.p2.artifact.optimizers.AbstractBufferingStep; @@ -22,7 +23,6 @@ import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processin import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor; import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor.Options; - /** * The Pack200Unpacker expects an input containing ".jar.pack.gz" data. */ @@ -39,7 +39,7 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { public void initialize(ProcessingStepDescriptor descriptor, IArtifactDescriptor context) { super.initialize(descriptor, context); if (!UnpackStep.canUnpack()) - status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured"); //$NON-NLS-1$ + setStatus(new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured")); //$NON-NLS-1$ } protected void cleanupTempFiles() { @@ -55,9 +55,9 @@ public class Pack200ProcessorStep extends AbstractBufferingStep { // now write the processed content to the destination if (resultFile.length() > 0) { InputStream resultStream = new BufferedInputStream(new FileInputStream(resultFile)); - FileUtils.copyStream(resultStream, true, destination, false); + FileUtils.copyStream(resultStream, true, getDestination(), false); } else { - status = new Status(IStatus.ERROR, Activator.ID, "Empty intermediate file: " + resultFile); //$NON-NLS-1$ + setStatus(new Status(IStatus.ERROR, Activator.ID, "Empty intermediate file: " + resultFile)); //$NON-NLS-1$ } } finally { if (resultFile != null) diff --git a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java index ac42ba9c6..11161de66 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java +++ b/bundles/org.eclipse.equinox.p2.artifact.processors/src/org/eclipse/equinox/internal/p2/artifact/processors/verifier/MD5Verifier.java @@ -49,24 +49,20 @@ public class MD5Verifier extends ProcessingStep { } private void basicInitialize(ProcessingStepDescriptor descriptor) { - int code; - if (descriptor == null) - code = IStatus.ERROR; - else - code = descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; + int code = (descriptor == null) ? IStatus.ERROR : descriptor.isRequired() ? IStatus.ERROR : IStatus.INFO; if (md5Test == null || md5Test.length() != 32) - status = new Status(code, Activator.ID, "MD5 value not available or incorrect size"); + setStatus(new Status(code, Activator.ID, "MD5 value not available or incorrect size")); try { md5 = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException e) { - status = new Status(code, Activator.ID, "Could not create MD5 algorithm", e); + setStatus(new Status(code, Activator.ID, "Could not create MD5 algorithm", e)); } } public void write(int b) throws IOException { if (b != -1) md5.update((byte) b); - destination.write(b); + getDestination().write(b); } public void close() throws IOException { @@ -81,10 +77,7 @@ public class MD5Verifier extends ProcessingStep { } // if the hashes don't line up set the status to error. - if (!buf.toString().equals(md5Test)) { - String message = "Error processing stream. MD5 hash is not as expected."; - status = new Status(IStatus.ERROR, "plugin id", message); - } else - status = Status.OK_STATUS; + if (!buf.toString().equals(md5Test)) + setStatus(new Status(IStatus.ERROR, Activator.ID, "Error processing stream. MD5 hash is not as expected.")); } } |