fix deprecations

This commit is contained in:
zzz
2018-08-25 13:26:28 +00:00
parent ff551b19fb
commit c3881a811b
5 changed files with 21 additions and 20 deletions

View File

@ -935,8 +935,8 @@ checkLongOption()
// +option or -option // +option or -option
else else
{ {
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character(argv[optind-1].charAt(0)).toString(), Character.toString(argv[optind-1].charAt(0)),
pfound.name }; pfound.name };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.arguments2"), _messages.getString("getopt.arguments2"),
@ -1138,8 +1138,8 @@ getopt()
} }
else else
{ {
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character(argv[optind].charAt(0)).toString(), Character.toString(argv[optind].charAt(0)),
nextchar }; nextchar };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.unrecognized2"), _messages.getString("getopt.unrecognized2"),
@ -1176,15 +1176,15 @@ getopt()
if (posixly_correct) if (posixly_correct)
{ {
// 1003.2 specifies the format of this message // 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character((char)c).toString() }; Character.toString((char)c) };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.illegal"), msgArgs)); _messages.getString("getopt.illegal"), msgArgs));
} }
else else
{ {
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character((char)c).toString() }; Character.toString((char)c) };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.invalid"), msgArgs)); _messages.getString("getopt.invalid"), msgArgs));
} }
@ -1208,8 +1208,8 @@ getopt()
if (opterr) if (opterr)
{ {
// 1003.2 specifies the format of this message. // 1003.2 specifies the format of this message.
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character((char)c).toString() }; Character.toString((char)c) };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs)); _messages.getString("getopt.requires2"), msgArgs));
} }
@ -1270,8 +1270,8 @@ getopt()
if (opterr) if (opterr)
{ {
// 1003.2 specifies the format of this message // 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character((char)c).toString() }; Character.toString((char)c) };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs)); _messages.getString("getopt.requires2"), msgArgs));
} }
@ -1300,8 +1300,8 @@ getopt()
if (opterr) if (opterr)
{ {
// 1003.2 specifies the format of this message // 1003.2 specifies the format of this message
Object[] msgArgs = { progname, new Object[] msgArgs = { progname,
Character((char)c).toString() }; Character.toString((char)c) };
System.err.println(MessageFormat.format( System.err.println(MessageFormat.format(
_messages.getString("getopt.requires2"), msgArgs)); _messages.getString("getopt.requires2"), msgArgs));
} }

View File

@ -127,7 +127,7 @@ LongOpt(String name, int has_arg,
if ((has_arg != NO_ARGUMENT) && (has_arg != REQUIRED_ARGUMENT) if ((has_arg != NO_ARGUMENT) && (has_arg != REQUIRED_ARGUMENT)
&& (has_arg != OPTIONAL_ARGUMENT)) && (has_arg != OPTIONAL_ARGUMENT))
{ {
Object[] msgArgs = { new Integer(has_arg).toString() }; Object[] msgArgs = { Integer.toString(has_arg) };
throw new IllegalArgumentException(MessageFormat.format( throw new IllegalArgumentException(MessageFormat.format(
_messages.getString("getopt.invalidValue"), msgArgs)); _messages.getString("getopt.invalidValue"), msgArgs));
} }

View File

@ -148,7 +148,7 @@ public abstract class GettextResource extends ResourceBundle {
String[] pluralforms = (String[])localValue; String[] pluralforms = (String[])localValue;
long i = 0; long i = 0;
try { try {
i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { new Long(n) })).longValue(); i = ((Long) pluralEvalMethod.invoke(catalog, new Object[] { Long.valueOf(n) })).longValue();
if (!(i >= 0 && i < pluralforms.length)) if (!(i >= 0 && i < pluralforms.length))
i = 0; i = 0;
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {

View File

@ -20,6 +20,8 @@ public final class I2PProvider extends Provider {
* <code>Security.addProvider()</code> mechanism. * <code>Security.addProvider()</code> mechanism.
*/ */
public I2PProvider() { public I2PProvider() {
// following constructor deprecated in Java 9,
// replaced by (String,String,String) added in Java 9
super(PROVIDER_NAME, 0.1, INFO); super(PROVIDER_NAME, 0.1, INFO);
AccessController.doPrivileged(new PrivilegedAction<Void>() { AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -125,11 +125,10 @@ public final class Noise {
static void throwBadTagException() throws BadPaddingException static void throwBadTagException() throws BadPaddingException
{ {
try { try {
// java since 1.7; android since API 19
Class<?> c = Class.forName("javax.crypto.AEADBadTagException"); Class<?> c = Class.forName("javax.crypto.AEADBadTagException");
throw (BadPaddingException)(c.newInstance()); throw (BadPaddingException)(c.getDeclaredConstructor().newInstance());
} catch (ClassNotFoundException e) { } catch (Exception e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
} }
throw new BadPaddingException(); throw new BadPaddingException();
} }