This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/master by this push:
new 8208244 Minor cleanup
8208244 is described below
commit 82082445b81ac87f11abb1d27efa3f09970685cb
Author: Karl Pauls <[email protected]>
AuthorDate: Thu Jun 10 23:18:22 2021 +0200
Minor cleanup
---
.../java/org/apache/felix/framework/BundleImpl.java | 3 +--
.../org/apache/felix/framework/BundleRevisionImpl.java | 17 +++++++----------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
index 7dd59d0..e0a5039 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleImpl.java
@@ -66,7 +66,7 @@ class BundleImpl implements Bundle, BundleRevisions
private final Felix __m_felix;
private final BundleArchive m_archive;
- private final List<BundleRevisionImpl> m_revisions = new
ArrayList<BundleRevisionImpl>(0);
+ private final List<BundleRevisionImpl> m_revisions = new ArrayList<>(0);
private volatile BundleRevisionImpl m_currentRevision = null;
private volatile int m_state;
private boolean m_useDeclaredActivationPolicy;
@@ -205,7 +205,6 @@ class BundleImpl implements Bundle, BundleRevisions
}
m_revisions.clear();
- m_currentRevision = null;
// Re-add the revision to the bundle.
addRevision(current);
diff --git
a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
index 388e426..d2352d9 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
@@ -347,18 +347,19 @@ public class BundleRevisionImpl implements
BundleRevision, Resource
return m_content;
}
- void resetContent(Content content)
+ synchronized void resetContent(Content content)
{
m_content = content;
}
List<Content> getContentPath()
{
- if (m_contentPath == null)
+ List<Content> contentPath = m_contentPath;
+ if (contentPath == null)
{
try
{
- m_contentPath = initializeContentPath();
+ contentPath = initializeContentPath();
}
catch (Exception ex)
{
@@ -366,7 +367,7 @@ public class BundleRevisionImpl implements BundleRevision,
Resource
m_bundle, Logger.LOG_ERROR, "Unable to get module class
path.", ex);
}
}
- return m_contentPath;
+ return contentPath;
}
private synchronized List<Content> initializeContentPath() throws Exception
@@ -397,7 +398,7 @@ public class BundleRevisionImpl implements BundleRevision,
Resource
fragments.get(i), fragmentContents.get(i), contentList,
false);
}
}
- return contentList;
+ return m_contentPath = contentList;
}
private List calculateContentPath(
@@ -710,11 +711,7 @@ public class BundleRevisionImpl implements BundleRevision,
Resource
}
m_content.close();
m_content = null;
- for (int i = 0; (m_contentPath != null) && (i < m_contentPath.size());
i++)
- {
- m_contentPath.get(i).close();
- }
- m_contentPath = null;
+ disposeContentPath();
}
@Override