30
30
import org .jruby .*;
31
31
import org .jruby .anno .JRubyMethod ;
32
32
import org .jruby .anno .JRubyModule ;
33
+ import org .jruby .common .IRubyWarnings ;
33
34
import org .jruby .runtime .ThreadContext ;
34
35
import org .jruby .runtime .Visibility ;
35
36
import org .jruby .runtime .builtin .IRubyObject ;
@@ -194,18 +195,14 @@ public static IRubyObject set_fips_mode(ThreadContext context, IRubyObject self,
194
195
// internal (package-level) helpers :
195
196
196
197
/**
197
- * PRIMARILY MEANT FOR TESTING ONLY, USAGE IS DISCOURAGED!
198
- * @see org.jruby.ext.openssl.util.CryptoSecurity
198
+ * @deprecated
199
199
*/
200
200
@ JRubyMethod (name = "_disable_security_restrictions!" , visibility = Visibility .PRIVATE , meta = true )
201
201
public static IRubyObject _disable_security_restrictions (ThreadContext context , IRubyObject self ) {
202
- Boolean unrestrict = org .jruby .ext .openssl .util .CryptoSecurity .unrestrictSecurity ();
203
- Boolean allPerm = org .jruby .ext .openssl .util .CryptoSecurity .setAllPermissionPolicy ();
204
- if ( unrestrict == null || allPerm == null ) return context .nil ;
205
- return context .runtime .newBoolean ( unrestrict && allPerm );
202
+ warnDeprecated (context , "OpenSSL._disable_security_restrictions! is deprecated for removal" );
203
+ return context .nil ;
206
204
}
207
205
208
-
209
206
private static boolean debug ;
210
207
211
208
// on by default, warnings can be disabled using -Djruby.openssl.warn=false
@@ -251,7 +248,6 @@ public static void debugStackTrace(final Ruby runtime, final CharSequence msg, f
251
248
}
252
249
}
253
250
}
254
-
255
251
static void warn (final ThreadContext context , final CharSequence msg ) {
256
252
if ( warn ) warn (context , RubyString .newString (context .runtime , msg ));
257
253
}
@@ -264,6 +260,12 @@ static void warn(final ThreadContext context, final IRubyObject msg) {
264
260
if ( warn ) context .runtime .getModule ("OpenSSL" ).callMethod (context , "warn" , msg );
265
261
}
266
262
263
+ public static void warnDeprecated (final ThreadContext context , final CharSequence msg ) {
264
+ if ( warn ) {
265
+ context .runtime .getWarnings ().warn (IRubyWarnings .ID .DEPRECATED_METHOD , msg .toString ());
266
+ }
267
+ }
268
+
267
269
private static String javaVersion (final String def , final int len ) {
268
270
String javaVersion = SafePropertyAccessor .getProperty ("java.version" , def );
269
271
if ( "0" .equals (javaVersion ) ) javaVersion = "1.7.0" ; // Android
0 commit comments