@@ -22,8 +22,9 @@ public FilterLayerHandler(int layers) {
2222
2323 // Create & initialize layers
2424 this .layers = new FilterLayer [layers ];
25- for (int i = 0 ; i < this .layers .length ; i ++)
25+ for (int i = 0 ; i < this .layers .length ; i ++) {
2626 this .layers [i ] = new FilterLayer <>();
27+ }
2728 }
2829
2930 public void handle (HttpExchange httpExchange , Express express ) {
@@ -34,8 +35,9 @@ public void handle(HttpExchange httpExchange, Express express) {
3435 for (FilterLayer chain : layers ) {
3536 chain .filter (request , response );
3637
37- if (response .isClosed ())
38+ if (response .isClosed ()) {
3839 return ;
40+ }
3941 }
4042 }
4143
@@ -48,10 +50,13 @@ public void handle(HttpExchange httpExchange, Express express) {
4850 @ SuppressWarnings ("unchecked" )
4951 public void add (int level , HttpRequestHandler handler ) {
5052
51- if (level >= layers .length )
53+ if (level >= layers .length ) {
5254 throw new IndexOutOfBoundsException ("Out of bounds: " + level + " > " + layers .length );
53- if (level < 0 )
55+ }
56+
57+ if (level < 0 ) {
5458 throw new IndexOutOfBoundsException ("Cannot be under zero: " + level + " < 0" );
59+ }
5560
5661 layers [level ].add (handler );
5762 }
@@ -66,11 +71,13 @@ public void combine(FilterLayerHandler filterLayerHandler) {
6671 if (filterLayerHandler != null ) {
6772 FilterLayer [] chains = filterLayerHandler .getLayers ();
6873
69- if (chains .length != layers .length )
74+ if (chains .length != layers .length ) {
7075 throw new ExpressException ("Cannot add an filterLayerHandler with different layers sizes: " + chains .length + " != " + layers .length );
76+ }
7177
72- for (int i = 0 ; i < chains .length ; i ++)
78+ for (int i = 0 ; i < chains .length ; i ++) {
7379 layers [i ].addAll (chains [i ].getFilter ());
80+ }
7481 }
7582 }
7683
@@ -80,11 +87,13 @@ public void combine(FilterLayerHandler filterLayerHandler) {
8087 * @param layerConsumer An consumer for the layers
8188 */
8289 public void forEach (Consumer <FilterLayer > layerConsumer ) {
83- if (layerConsumer == null )
90+ if (layerConsumer == null ) {
8491 return ;
92+ }
8593
86- for (FilterLayer layer : layers )
94+ for (FilterLayer layer : layers ) {
8795 layerConsumer .accept (layer );
96+ }
8897 }
8998
9099 private FilterLayer [] getLayers () {
0 commit comments