From fdae0cda5fe009d577238ae8adb1c8cc8a6923dc Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Fri, 13 Sep 2019 08:50:36 -0500 Subject: Bug 550605 - StackOverflowError in CDSBundleFileEntry The method CDSBundleEntry.getEntry() ended up calling CDSBundleFile.getEntry(path) which ends up returning another CDSBundleEntry object. The intention was to get the wrapped entry from the next BundleFile in the chain. The result of getting another CDSBundleEntry is that we endless recurse when calling methods like CDSBundleEntry.getInputStream() Change-Id: I0c684eb63987797cd9e092a405274ccb1d4eae71 Signed-off-by: Thomas Watson --- .../src/org/eclipse/osgi/internal/cds/CDSBundleEntry.java | 14 +++++++------- .../src/org/eclipse/osgi/internal/cds/CDSBundleFile.java | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleEntry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleEntry.java index 6293fb0e6..746af6cb1 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleEntry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleEntry.java @@ -48,8 +48,8 @@ public class CDSBundleEntry extends BundleEntry { this.bundleFile = bundleFile; } - private BundleEntry getEntry() { - BundleEntry entry = bundleFile.getEntry(path); + private BundleEntry getWrappedEntry() { + BundleEntry entry = bundleFile.getWrappedEntry(path); if (entry == null) { throw new IllegalStateException("Could not find original entry for the class: " + path); //$NON-NLS-1$ } @@ -66,7 +66,7 @@ public class CDSBundleEntry extends BundleEntry { */ @Override public URL getFileURL() { - return getEntry().getFileURL(); + return getWrappedEntry().getFileURL(); } /* @@ -79,7 +79,7 @@ public class CDSBundleEntry extends BundleEntry { public InputStream getInputStream() throws IOException { // someone is trying to get the real bytes of the class file!! // just return the entry from the wrapped file instead of the magic cookie - return getEntry().getInputStream(); + return getWrappedEntry().getInputStream(); } /* @@ -104,7 +104,7 @@ public class CDSBundleEntry extends BundleEntry { */ @Override public URL getLocalURL() { - return getEntry().getLocalURL(); + return getWrappedEntry().getLocalURL(); } @Override @@ -114,11 +114,11 @@ public class CDSBundleEntry extends BundleEntry { @Override public long getSize() { - return getEntry().getSize(); + return getWrappedEntry().getSize(); } @Override public long getTime() { - return getEntry().getTime(); + return getWrappedEntry().getTime(); } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleFile.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleFile.java index ff7256a88..29a8dd796 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleFile.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/cds/CDSBundleFile.java @@ -83,6 +83,10 @@ public class CDSBundleFile extends BundleFileWrapper { return be; } + BundleEntry getWrappedEntry(String path) { + return super.getEntry(path); + } + /** * Returns the file url to the content of the actual bundle file * @return the file url to the content of the actual bundle file -- cgit v1.2.3