Skip to content

Commit 9ff4142

Browse files
committed
Remove dead/commented out code and modifiers
(cherry picked from commit 0a74172)
1 parent 7d2be64 commit 9ff4142

21 files changed

+63
-223
lines changed

src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
import org.jruby.RubyInstanceConfig;
2323
import org.jruby.exceptions.RaiseException;
2424
import org.jruby.javasupport.JavaUtil;
25-
import org.jruby.rack.servlet.ServletRackContext;
2625
import org.jruby.rack.servlet.RewindableInputStream;
26+
import org.jruby.rack.servlet.ServletRackContext;
2727
import org.jruby.rack.util.IOHelpers;
2828
import org.jruby.runtime.ThreadContext;
2929
import org.jruby.runtime.builtin.IRubyObject;
30+
import org.jruby.util.cli.OutputStrings;
3031

31-
import static org.jruby.rack.RackLogger.Level.*;
3232
import static org.jruby.rack.DefaultRackConfig.isIgnoreRUBYOPT;
33+
import static org.jruby.rack.RackLogger.Level.*;
3334

3435
/**
3536
* Default application factory creates a new application instance on each
@@ -87,7 +88,7 @@ public void init(final RackContext rackContext) {
8788
this.rackContext = (ServletRackContext) rackContext;
8889
if ( getRackupScript() == null ) resolveRackupScript();
8990
this.runtimeConfig = createRuntimeConfig();
90-
rackContext.log(INFO, runtimeConfig.getVersionString());
91+
rackContext.log(INFO, OutputStrings.getVersionString());
9192
configureDefaults();
9293
}
9394

src/main/java/org/jruby/rack/DefaultRackConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
import java.util.Map;
2020
import java.util.regex.Matcher;
2121
import java.util.regex.Pattern;
22+
2223
import org.jruby.CompatVersion;
2324
import org.jruby.rack.logging.OutputStreamLogger;
2425
import org.jruby.rack.logging.StandardOutLogger;
2526
import org.jruby.util.SafePropertyAccessor;
26-
import static org.jruby.rack.RackLogger.Level.*;
27+
28+
import static org.jruby.rack.RackLogger.Level.WARN;
2729

2830
/**
2931
* A base implementation of that retrieves settings from system properties.
@@ -456,7 +458,6 @@ private static Map<String,String> getLoggerTypes() {
456458
loggerTypes.put("clogging", "org.jruby.rack.logging.CommonsLoggingLogger");
457459
loggerTypes.put("slf4j", "org.jruby.rack.logging.Slf4jLogger");
458460
loggerTypes.put("jul", "org.jruby.rack.logging.JulLogger");
459-
//loggerTypes.put("servlet_context", "org.jruby.rack.logging.ServletContextLogger");
460461
return loggerTypes;
461462
}
462463

src/main/java/org/jruby/rack/PoolingRackApplicationFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void setAcquireTimeout(Number acquireTimeout) {
111111

112112
@Override
113113
protected void doInit() throws Exception {
114-
super.doInit(); // delegate.init(rackContext);
114+
super.doInit();
115115
final RackConfig config = getConfig();
116116
// TODO until config.getRuntimeTimeoutSeconds returns an integer :
117117
Number timeout = config.getNumberProperty("jruby.runtime.acquire.timeout");
@@ -253,16 +253,15 @@ public void destroy() {
253253
synchronized (applicationPool) {
254254
for (RackApplication app : applicationPool) {
255255
getDelegate().finishedWithApplication(app);
256-
// DefaultRackAppFactory: app.destroy();
257256
}
258257
applicationPool.clear();
259258
}
260-
super.destroy(); // delegate.destroy();
259+
super.destroy();
261260
}
262261

263262
/**
264263
* Fills the initial pool with initialized application instances.
265-
*
264+
* <p>
266265
* Application objects are created in foreground threads to avoid
267266
* leakage when the web application is undeployed from the server.
268267
*/

src/main/java/org/jruby/rack/RackApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public interface RackApplication {
2424
* @param env the RackEnvironment
2525
* @return the RackResponse
2626
*/
27-
public RackResponse call(RackEnvironment env);
27+
RackResponse call(RackEnvironment env);
2828

2929
/**
3030
* Get a reference to the underlying runtime that holds the application

src/main/java/org/jruby/rack/RackApplicationFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public interface RackApplicationFactory {
6868
*
6969
* @author kares
7070
*/
71-
public static interface Decorator {
71+
interface Decorator {
7272

7373
/**
7474
* @return the delegate factory this decorator wraps

src/main/java/org/jruby/rack/RackConfig.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
package org.jruby.rack;
99

10-
import org.jruby.CompatVersion;
11-
1210
import java.io.PrintStream;
1311
import java.util.Map;
1412

13+
import org.jruby.CompatVersion;
14+
1515
/**
1616
* Centralized interface for configuration options used by JRuby-Rack.
1717
*
@@ -143,12 +143,7 @@ public interface RackConfig {
143143
* @return the maximum size of the in-memory buffer
144144
*/
145145
Integer getMaximumMemoryBufferSize();
146-
147-
/**
148-
* @return whether we allow the initialization exception to bubble up
149-
*/
150-
//boolean isThrowInitException();
151-
146+
152147
/**
153148
* Create a logger to be used (based on this configuration).
154149
* @return a logger instance

src/main/java/org/jruby/rack/RackEnvironment.java

Lines changed: 22 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package org.jruby.rack;
99

10-
import org.jruby.rack.ext.Input;
1110
import java.io.IOException;
1211
import java.io.InputStream;
1312
import java.util.Enumeration;
@@ -27,13 +26,13 @@ public interface RackEnvironment {
2726
* Environment key that retrieves the exception the {@link RackApplication}
2827
* failed with. Useful when dispatching call to an {@link ErrorApplication}.
2928
*/
30-
final String EXCEPTION = "jruby.rack.exception";
31-
final String DYNAMIC_REQS_ONLY = "jruby.rack.dynamic.requests.only";
29+
String EXCEPTION = "jruby.rack.exception";
30+
String DYNAMIC_REQS_ONLY = "jruby.rack.dynamic.requests.only";
3231

3332
/**
3433
* @return the associated {@link RackContext} for this environment
3534
*/
36-
public RackContext getContext();
35+
RackContext getContext();
3736

3837
// The following methods are specific to the rack environment
3938

@@ -42,160 +41,120 @@ public interface RackEnvironment {
4241
* @return the input as a stream
4342
* @throws IOException if there's an IO exception
4443
*/
45-
public InputStream getInput() throws IOException;
44+
InputStream getInput() throws IOException;
4645

4746
/**
4847
* For servlet-based environment implementations the script name might be
4948
* constructed as the the (servlet) context path + the servlet path.
5049
* @return the script name ("CGI" style)
5150
*/
52-
public String getScriptName();
51+
String getScriptName();
5352

5453
// The following methods are usually inherited from the servlet request
5554

5655
/**
5756
* @see javax.servlet.http.HttpServletRequest#getPathInfo()
5857
* @return the request path info
5958
*/
60-
public String getPathInfo();
59+
String getPathInfo();
6160

6261
/**
6362
* Request URI should include the query string if available.
6463
* @see javax.servlet.http.HttpServletRequest#getRequestURI()
6564
* @return the request URI
6665
*/
67-
public String getRequestURI();
66+
String getRequestURI();
6867

6968
/**
7069
* @see javax.servlet.http.HttpServletRequest#getAttributeNames()
7170
* @return an enumeration of all attribute names
7271
*/
73-
public Enumeration<String> getAttributeNames();
72+
Enumeration<String> getAttributeNames();
7473

7574
/**
7675
* @see javax.servlet.http.HttpServletRequest#getAttribute(String)
7776
* @param key the attribute key
7877
* @return the attribute value
7978
*/
80-
public Object getAttribute(String key);
79+
Object getAttribute(String key);
8180

8281
/**
8382
* @see javax.servlet.http.HttpServletRequest#setAttribute(String, Object)
8483
* @param key the key
8584
* @param value the value
8685
*/
87-
public void setAttribute(String key, Object value);
86+
void setAttribute(String key, Object value);
8887

8988
/**
9089
* @see javax.servlet.http.HttpServletRequest#getHeaderNames()
9190
* @return an enumeration of all header names
9291
*/
93-
public Enumeration<String> getHeaderNames();
92+
Enumeration<String> getHeaderNames();
9493

9594
/**
9695
* @see javax.servlet.http.HttpServletRequest#getHeader(String)
9796
* @param name the header name
9897
* @return the header value
9998
*/
100-
public String getHeader(String name);
99+
String getHeader(String name);
101100

102101
/**
103102
* @see javax.servlet.http.HttpServletRequest#getScheme()
104103
* @return the request scheme
105104
*/
106-
public String getScheme();
105+
String getScheme();
107106

108107
/**
109108
* @see javax.servlet.http.HttpServletRequest#getContentType()
110109
* @return the content type
111110
*/
112-
public String getContentType();
111+
String getContentType();
113112

114113
/**
115114
* @see javax.servlet.http.HttpServletRequest#getContentLength()
116115
* @return the content length
117116
*/
118-
public int getContentLength();
117+
int getContentLength();
119118

120119
/**
121120
* @see javax.servlet.http.HttpServletRequest#getMethod()
122121
* @return the request method
123122
*/
124-
public String getMethod();
123+
String getMethod();
125124

126125
/**
127126
* @see javax.servlet.http.HttpServletRequest#getQueryString()
128127
* @return the query string
129128
*/
130-
public String getQueryString();
129+
String getQueryString();
131130

132131
/**
133132
* @see javax.servlet.http.HttpServletRequest#getServerName()
134133
* @return the server name
135134
*/
136-
public String getServerName();
135+
String getServerName();
137136

138137
/**
139138
* @see javax.servlet.http.HttpServletRequest#getServerPort()
140139
* @return the server port
141140
*/
142-
public int getServerPort();
141+
int getServerPort();
143142

144143
/**
145144
* @see javax.servlet.ServletRequest#getRemoteHost()
146145
* @return the remote host
147146
*/
148-
public String getRemoteHost();
147+
String getRemoteHost();
149148

150149
/**
151150
* @see javax.servlet.ServletRequest#getRemoteAddr()
152151
* @return the remote address
153152
*/
154-
public String getRemoteAddr();
153+
String getRemoteAddr();
155154

156155
/**
157156
* @see javax.servlet.http.HttpServletRequest#getRemoteUser()
158157
* @return the remote user
159158
*/
160-
public String getRemoteUser();
161-
162-
/**
163-
* {@link RackEnvironment} extension to obtain a rack.input IO.
164-
*
165-
* NOTE: This interface will most likely get moved onto the (parent)
166-
* environment interface directly once the deprecated way of maintaining
167-
* backwards compatibility (using jruby/rack/environment.rb) is removed.
168-
*
169-
* @deprecated Was an internal interface and is no longer used.
170-
* @author kares
171-
*/
172-
@Deprecated
173-
interface ToIO {
174-
175-
// TODO move to RackEnvironment once jruby/rack/environment.rb removed
176-
177-
/**
178-
* Convert this environment into a "rack.input" IO.
179-
* Replaces the <code>to_io</code> monkey-patch ...
180-
* @return rack.input
181-
*/
182-
public Input toIO();
183-
184-
/**
185-
* Set the rack.input, this is an optional operation and implementers
186-
* might ignore this call silently if they're capable of constructing
187-
* the rack.input themselves.
188-
* @param io the rack.input instance
189-
*/
190-
void setIO(Input io) ;
191-
192-
}
193-
194-
/**
195-
* Convert this environment into a "rack.input" IO.
196-
* Replaces the <code>to_io</code> monkey-patch ...
197-
* @return rack.input
198-
*/
199-
//public Input toIO() ;
200-
159+
String getRemoteUser();
201160
}

src/main/java/org/jruby/rack/RackInput.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ public static RubyClass getClass(Ruby runtime, String name, RubyClass parent,
4343
return runtime.getOrCreateModule("JRuby").getClass(name); // RackInput
4444
}
4545

46-
//private static RubyClass getClass(final Ruby runtime) {
47-
// return (RubyClass) runtime.getModule("JRuby").getConstantAt("RackInput");
48-
//}
49-
5046
public RackInput(Ruby runtime, RubyClass klass) {
5147
super(runtime, klass);
5248
}

src/main/java/org/jruby/rack/RackLogger.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,6 @@ public interface RackLogger {
1616
void log(String message) ;
1717
void log(String message, Throwable ex) ;
1818

19-
//void debug(String message) ;
20-
//void debug(String message, Throwable e) ;
21-
22-
//void info(String message) ;
23-
//void info(String message, Throwable e) ;
24-
25-
//void warn(String message) ;
26-
//void warn(String message, Throwable e) ;
27-
28-
//void error(String message) ;
29-
//void error(String message, Throwable e) ;
30-
3119
enum Level {
3220
DEBUG, INFO, WARN, ERROR, FATAL
3321
}

src/main/java/org/jruby/rack/SharedRackApplicationFactory.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.util.Collection;
1111
import java.util.Collections;
1212

13-
import static org.jruby.rack.RackLogger.Level.*;
13+
import static org.jruby.rack.RackLogger.Level.INFO;
1414

1515
/**
1616
* Shared application factory that only creates a single application instance.
@@ -31,7 +31,7 @@ public SharedRackApplicationFactory(RackApplicationFactory delegate) {
3131

3232
@Override
3333
protected void doInit() throws Exception {
34-
super.doInit(); // delegate.init(rackContext);
34+
super.doInit();
3535
log(INFO, "using a shared (thread-safe) runtime");
3636
application = getDelegate().getApplication();
3737
}
@@ -62,11 +62,10 @@ public void destroy() {
6262
synchronized(this) {
6363
if (application != null) {
6464
getDelegate().finishedWithApplication(application);
65-
// DefaultRackAppFactory: application.destroy();
6665
}
6766
}
6867
}
69-
super.destroy(); // delegate.destroy();
68+
super.destroy();
7069
}
7170

7271
@Override

0 commit comments

Comments
 (0)