diff options
author | Carsten Hammer | 2020-11-01 10:56:40 +0000 |
---|---|---|
committer | Thomas Watson | 2020-11-09 16:00:39 +0000 |
commit | a16b81529f917451953043dcef060d5b2541566d (patch) | |
tree | 149602ec96bcda22763ee07aecf8f76c7f77612b | |
parent | f6d40224153ea9561afbf7f5fc2e2e330029d0e8 (diff) | |
download | rt.equinox.bundles-a16b81529f917451953043dcef060d5b2541566d.tar.gz rt.equinox.bundles-a16b81529f917451953043dcef060d5b2541566d.tar.xz rt.equinox.bundles-a16b81529f917451953043dcef060d5b2541566d.zip |
Bug: org.eclipse.equinox.http.servlet.internal.context.ProxyContext$ContextAttributesY20201127-1200Y20201124-1200Y20201120-1200Y20201117-1200Y20201113-1200Y20201111-0210Y20201110-1200Y20201109-1200S4_18_0_RC1S4_18_0_M3I20201127-1010I20201127-0630I20201125-1800I20201125-0600I20201124-1800I20201124-0600I20201123-1800I20201123-0600I20201122-1800I20201122-0600I20201121-1800I20201121-0600I20201120-1800I20201120-0320I20201119-0730I20201118-1800I20201118-0600I20201117-1800I20201117-0600I20201116-1800I20201116-0600I20201115-1800I20201115-0600I20201114-1800I20201114-0740I20201114-0600I20201113-1800I20201112-1800I20201111-1800I20201110-1800I20201109-1800
is serializable but also an inner class of a non-serializable class
This Serializable class is an inner class of a non-serializable class.
Thus, attempts to serialize it will also attempt to associate instance
of the outer class with which it is associated, leading to a runtime
error.
If possible, making the inner class a static inner class should solve
the problem. Making the outer class serializable might also work, but
that would mean serializing an instance of the inner class would always
also serialize the instance of the outer class, which it often not what
you really want.
Rank: Troubling (14), confidence: High
Pattern: SE_BAD_FIELD_INNER_CLASS
Type: Se, Category: BAD_PRACTICE (Bad practice)
Change-Id: I06c93020982fd2a593189bb5650e2734410c0134
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r-- | bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ProxyContext.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ProxyContext.java b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ProxyContext.java index c668225a6..4c66f40ae 100644 --- a/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ProxyContext.java +++ b/bundles/org.eclipse.equinox.http.servlet/src/org/eclipse/equinox/http/servlet/internal/context/ProxyContext.java @@ -67,7 +67,7 @@ public class ProxyContext { ContextAttributes contextAttributes = attributesMap.get(controller); if (contextAttributes == null) { - contextAttributes = new ContextAttributes(controller); + contextAttributes = new ContextAttributes(controller, proxyContextTempDir); attributesMap.put(controller, contextAttributes); } @@ -122,13 +122,13 @@ public class ProxyContext { return directory.delete(); } - public class ContextAttributes + public static class ContextAttributes extends Dictionary<String, Object> implements Serializable { private static final long serialVersionUID = 1916670423277243587L; private final AtomicInteger referenceCount = new AtomicInteger(); - public ContextAttributes(ContextController controller) { + public ContextAttributes(ContextController controller, File proxyContextTempDir) { if (proxyContextTempDir != null) { File contextTempDir = new File( proxyContextTempDir, |