Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HazelcastHttpSession getAttributeNames returns entries that were only read but not written #7033

Closed
eysegal opened this issue Dec 9, 2015 · 2 comments

Comments

Projects
None yet
4 participants
@eysegal
Copy link

commented Dec 9, 2015

Reopening #6868.
HazelcastHttpSession::getAttributeNames returns entries (with null values) if HazelcastHttpSession::getAttribute was called with those entry names.
So, in the example below, we call hazelcastHttpSession.getAttribute("test") it's being returned when calling hazelcastHttpSession.getAttributeNames().

This is the test code that reproduces it ("test" is printed even though it was only read, not write):

            package test;

            import java.util.Enumeration;

            import javax.servlet.FilterConfig;
            import javax.servlet.ServletContext;
            import javax.servlet.ServletException;

            import org.eclipse.jetty.servlet.ServletContextHandler;
            import org.eclipse.jetty.servlet.ServletContextHandler.Context;

            import com.hazelcast.web.HazelcastHttpSession;
            import com.hazelcast.web.WebFilter;

            public class HazelcastSessionParamCheck {
                public static void main(String[] args) throws ServletException {

                    WebFilter filter = new WebFilter();
                    final Context servletContext = new ServletContextHandler().new Context(); 

                    FilterConfig filterConfig = new FilterConfig() {

                        public ServletContext getServletContext() {
                            // TODO Auto-generated method stub
                            return servletContext;
                        }

                        public Enumeration<String> getInitParameterNames() {
                            // TODO Auto-generated method stub
                            return null;
                        }

                        public String getInitParameter(String name) {
                            // TODO Auto-generated method stub
                            return null;
                        }

                        public String getFilterName() {
                            // TODO Auto-generated method stub
                            return null;
                        }
                    };
                    filter.init(filterConfig);
                    HazelcastHttpSession hazelcastHttpSession = new HazelcastHttpSession(filter, "sessionId", null, true, true); 
                    hazelcastHttpSession.getAttribute("test");
                    Enumeration<String> sessionAttributeNames = hazelcastHttpSession.getAttributeNames();
                    while (sessionAttributeNames.hasMoreElements()) {
                        System.out.println(sessionAttributeNames.nextElement());
                    }
                    System.exit(1);

                }
            }

With this maven configuration:

            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
              <modelVersion>4.0.0</modelVersion>
              <groupId>test</groupId>
              <artifactId>test</artifactId>
              <version>0.0.1-SNAPSHOT</version>
              <name>test</name>

              <dependencies>
                <dependency>
                    <groupId>com.hazelcast</groupId>
                    <artifactId>hazelcast-wm</artifactId>
                    <version>3.5.4</version>
                </dependency>

                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>3.0.1</version>
                </dependency>

                <dependency>
                    <groupId>org.eclipse.jetty</groupId>
                    <artifactId>jetty-webapp</artifactId>
                    <version>8.1.18.v20150929</version>
                </dependency>
              </dependencies>
            </project>

@kobalski kobalski added this to the 3.6 milestone Dec 9, 2015

@kobalski kobalski self-assigned this Dec 9, 2015

@mesutcelik mesutcelik modified the milestones: 3.6, 3.6.1 Dec 10, 2015

@enesakar enesakar modified the milestones: 3.6.1, 3.6.2 Feb 26, 2016

@eysegal

This comment has been minimized.

Copy link
Author

commented Feb 28, 2016

Can you please fix it for 3.6.2? We're waiting for a long time for this fix, which is actually a regression bug since it was ok in 3.4...
It's preventing us from upgrading from 3.4 to the latest...

Thanks!

@mesutcelik

This comment has been minimized.

Copy link
Contributor

commented Mar 18, 2016

fixed by #7766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.