Prepare codebase to adhere to Checkstyle rules

Issue gh-393
This commit is contained in:
Vedran Pavic
2016-03-05 20:27:06 +01:00
committed by Rob Winch
parent 9e3bcafa75
commit 7f3302253b
222 changed files with 4071 additions and 3556 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,19 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample;
import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.config.SerializerConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.SessionRepositoryFilter;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.EnumSet;
import java.util.Map;
import javax.servlet.DispatcherType;
import javax.servlet.FilterRegistration.Dynamic;
@@ -33,10 +27,19 @@ import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.EnumSet;
import java.util.Map;
import com.hazelcast.config.Config;
import com.hazelcast.config.MapConfig;
import com.hazelcast.config.NetworkConfig;
import com.hazelcast.config.SerializerConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import org.springframework.session.ExpiringSession;
import org.springframework.session.MapSession;
import org.springframework.session.MapSessionRepository;
import org.springframework.session.SessionRepository;
import org.springframework.session.web.http.SessionRepositoryFilter;
@WebListener
public class Initializer implements ServletContextListener {
@@ -59,8 +62,8 @@ public class Initializer implements ServletContextListener {
mc.setTimeToLiveSeconds(MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS);
cfg.addMapConfig(mc);
instance = Hazelcast.newHazelcastInstance(cfg);
Map<String,ExpiringSession> sessions = instance.getMap(sessionMapName);
this.instance = Hazelcast.newHazelcastInstance(cfg);
Map<String, ExpiringSession> sessions = this.instance.getMap(sessionMapName);
SessionRepository<ExpiringSession> sessionRepository =
new MapSessionRepository(sessions);
@@ -71,7 +74,7 @@ public class Initializer implements ServletContextListener {
}
public void contextDestroyed(ServletContextEvent sce) {
instance.shutdown();
this.instance.shutdown();
}
private static int getAvailablePort() {
@@ -79,12 +82,16 @@ public class Initializer implements ServletContextListener {
try {
socket = new ServerSocket(0);
return socket.getLocalPort();
} catch(IOException e) {
}
catch (IOException e) {
throw new RuntimeException(e);
} finally {
}
finally {
try {
socket.close();
}catch(IOException e) {}
}
catch (IOException e) {
}
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,9 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample;
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
@@ -37,18 +42,19 @@ public class ObjectStreamSerializer implements StreamSerializer<Object> {
}
public void write(ObjectDataOutput objectDataOutput, Object object)
throws IOException {
throws IOException {
ObjectOutputStream out = new ObjectOutputStream((OutputStream) objectDataOutput);
out.writeObject(object);
out.flush();
}
public Object read(ObjectDataInput objectDataInput)
throws IOException {
throws IOException {
ObjectInputStream in = new ObjectInputStream((InputStream) objectDataInput);
try {
return in.readObject();
} catch (ClassNotFoundException e) {
}
catch (ClassNotFoundException e) {
throw new IOException(e);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2014-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Rob Winch