Skip to content
Permalink
Browse files
8276632: Use blessed modifier order in security-libs code
Reviewed-by: mullan
  • Loading branch information
magicus committed Nov 5, 2021
1 parent 7023b3f commit c393ee8f598850379266bdba1f55af94744dbad1
Showing 15 changed files with 153 additions and 153 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -160,7 +160,7 @@ private Oid getOidFromMechFactoryProperty(String prop)
}

// So the existing code do not have to be changed
synchronized public MechanismFactory getMechFactory(Oid mechOid)
public synchronized MechanismFactory getMechFactory(Oid mechOid)
throws GSSException {
if (mechOid == null) mechOid = ProviderList.DEFAULT_MECH_OID;
return getMechFactory(mechOid, null);
@@ -177,7 +177,7 @@ synchronized public MechanismFactory getMechFactory(Oid mechOid)
* support the desired mechanism, or when no provider supports
* the desired mechanism.
*/
synchronized public MechanismFactory getMechFactory(Oid mechOid,
public synchronized MechanismFactory getMechFactory(Oid mechOid,
Provider p)
throws GSSException {

@@ -335,7 +335,7 @@ public Oid[] getMechs() {
return mechs.toArray(new Oid[] {});
}

synchronized public void addProviderAtFront(Provider p, Oid mechOid)
public synchronized void addProviderAtFront(Provider p, Oid mechOid)
throws GSSException {

PreferencesEntry newEntry = new PreferencesEntry(p, mechOid);
@@ -367,7 +367,7 @@ synchronized public void addProviderAtFront(Provider p, Oid mechOid)
}
}

synchronized public void addProviderAtEnd(Provider p, Oid mechOid)
public synchronized void addProviderAtEnd(Provider p, Oid mechOid)
throws GSSException {

PreferencesEntry newEntry = new PreferencesEntry(p, mechOid);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -147,7 +147,7 @@ private int getIntervalIndex(int number) {
* (This analysis leaves out the possibility that expectedNumber passes
* initNumber after wrapping around. That may be added later.)
*/
synchronized public final void getProps(int number, MessageProp prop) {
public final synchronized void getProps(int number, MessageProp prop) {

boolean gap = false;
boolean old = false;
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -123,7 +123,7 @@ private KeyTab(String filename) {
* @param s file name of keytab, must not be null
* @return the keytab object, can be invalid, but never null.
*/
private synchronized static KeyTab getInstance0(String s) {
private static synchronized KeyTab getInstance0(String s) {
long lm = new File(s).lastModified();
KeyTab old = map.get(s);
if (old != null && old.isValid() && old.lastModified == lm) {
@@ -429,7 +429,7 @@ public KeyTabEntry[] getEntries() {
/**
* Creates a new default key table.
*/
public synchronized static KeyTab create()
public static synchronized KeyTab create()
throws IOException, RealmException {
String dname = getDefaultTabName();
return create(dname);
@@ -438,7 +438,7 @@ public synchronized static KeyTab create()
/**
* Creates a new default key table.
*/
public synchronized static KeyTab create(String name)
public static synchronized KeyTab create(String name)
throws IOException, RealmException {

try (KeyTabOutputStream kos =
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,7 +35,7 @@
*/
public class CardNotPresentException extends CardException {

private final static long serialVersionUID = 1346879911706545215L;
private static final long serialVersionUID = 1346879911706545215L;

/**
* Constructs a new CardNotPresentException with the specified detail message.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -74,17 +74,17 @@ public class CardPermission extends Permission {

private static final long serialVersionUID = 7146787880530705613L;

private final static int A_CONNECT = 0x01;
private final static int A_EXCLUSIVE = 0x02;
private final static int A_GET_BASIC_CHANNEL = 0x04;
private final static int A_OPEN_LOGICAL_CHANNEL = 0x08;
private final static int A_RESET = 0x10;
private final static int A_TRANSMIT_CONTROL = 0x20;
private static final int A_CONNECT = 0x01;
private static final int A_EXCLUSIVE = 0x02;
private static final int A_GET_BASIC_CHANNEL = 0x04;
private static final int A_OPEN_LOGICAL_CHANNEL = 0x08;
private static final int A_RESET = 0x10;
private static final int A_TRANSMIT_CONTROL = 0x20;

// sum of all the actions above
private final static int A_ALL = 0x3f;
private static final int A_ALL = 0x3f;

private final static int[] ARRAY_MASKS = {
private static final int[] ARRAY_MASKS = {
A_ALL,
A_CONNECT,
A_EXCLUSIVE,
@@ -94,16 +94,16 @@ public class CardPermission extends Permission {
A_TRANSMIT_CONTROL,
};

private final static String S_CONNECT = "connect";
private final static String S_EXCLUSIVE = "exclusive";
private final static String S_GET_BASIC_CHANNEL = "getBasicChannel";
private final static String S_OPEN_LOGICAL_CHANNEL = "openLogicalChannel";
private final static String S_RESET = "reset";
private final static String S_TRANSMIT_CONTROL = "transmitControl";
private static final String S_CONNECT = "connect";
private static final String S_EXCLUSIVE = "exclusive";
private static final String S_GET_BASIC_CHANNEL = "getBasicChannel";
private static final String S_OPEN_LOGICAL_CHANNEL = "openLogicalChannel";
private static final String S_RESET = "reset";
private static final String S_TRANSMIT_CONTROL = "transmitControl";

private final static String S_ALL = "*";
private static final String S_ALL = "*";

private final static String[] ARRAY_STRINGS = {
private static final String[] ARRAY_STRINGS = {
S_ALL,
S_CONNECT,
S_EXCLUSIVE,
@@ -88,12 +88,12 @@
*/
public final class TerminalFactory {

private final static String PROP_NAME =
private static final String PROP_NAME =
"javax.smartcardio.TerminalFactory.DefaultType";

private final static String defaultType;
private static final String defaultType;

private final static TerminalFactory defaultFactory;
private static final TerminalFactory defaultFactory;

static {
// lookup up the user specified type, default to PC/SC
@@ -133,14 +133,14 @@ public final class TerminalFactory {
private static final class NoneProvider extends Provider {

private static final long serialVersionUID = 2745808869881593918L;
final static Provider INSTANCE = new NoneProvider();
static final Provider INSTANCE = new NoneProvider();
private NoneProvider() {
super("None", "1.0", "none");
}
}

private static final class NoneFactorySpi extends TerminalFactorySpi {
final static TerminalFactorySpi INSTANCE = new NoneFactorySpi();
static final TerminalFactorySpi INSTANCE = new NoneFactorySpi();
private NoneFactorySpi() {
// empty
}
@@ -150,7 +150,7 @@ protected CardTerminals engineTerminals() {
}

private static final class NoneCardTerminals extends CardTerminals {
final static CardTerminals INSTANCE = new NoneCardTerminals();
static final CardTerminals INSTANCE = new NoneCardTerminals();
private NoneCardTerminals() {
// empty
}
@@ -114,13 +114,13 @@ public int transmit(ByteBuffer command, ByteBuffer response) throws CardExceptio
return responseBytes.length;
}

private final static boolean t0GetResponse =
private static final boolean t0GetResponse =
getBooleanProperty("sun.security.smartcardio.t0GetResponse", true);

private final static boolean t1GetResponse =
private static final boolean t1GetResponse =
getBooleanProperty("sun.security.smartcardio.t1GetResponse", true);

private final static boolean t1StripLe =
private static final boolean t1StripLe =
getBooleanProperty("sun.security.smartcardio.t1StripLe", false);

private static boolean getBooleanProperty(String name, boolean def) {
@@ -151,8 +151,8 @@ private byte[] concat(byte[] b1, byte[] b2, int n2) {
return res;
}

private final static int RESPONSE_ITERATIONS = 256;
private final static byte[] B0 = new byte[0];
private static final int RESPONSE_ITERATIONS = 256;
private static final byte[] B0 = new byte[0];

private byte[] doTransmit(byte[] command) throws CardException {
// note that we modify the 'command' array in some cases, so it must
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -93,83 +93,83 @@ static void checkAvailable() throws RuntimeException {
throws PCSCException;

// PCSC success/error/failure/warning codes
final static int SCARD_S_SUCCESS = 0x00000000;
final static int SCARD_E_CANCELLED = 0x80100002;
final static int SCARD_E_CANT_DISPOSE = 0x8010000E;
final static int SCARD_E_INSUFFICIENT_BUFFER = 0x80100008;
final static int SCARD_E_INVALID_ATR = 0x80100015;
final static int SCARD_E_INVALID_HANDLE = 0x80100003;
final static int SCARD_E_INVALID_PARAMETER = 0x80100004;
final static int SCARD_E_INVALID_TARGET = 0x80100005;
final static int SCARD_E_INVALID_VALUE = 0x80100011;
final static int SCARD_E_NO_MEMORY = 0x80100006;
final static int SCARD_F_COMM_ERROR = 0x80100013;
final static int SCARD_F_INTERNAL_ERROR = 0x80100001;
final static int SCARD_F_UNKNOWN_ERROR = 0x80100014;
final static int SCARD_F_WAITED_TOO_LONG = 0x80100007;
final static int SCARD_E_UNKNOWN_READER = 0x80100009;
final static int SCARD_E_TIMEOUT = 0x8010000A;
final static int SCARD_E_SHARING_VIOLATION = 0x8010000B;
final static int SCARD_E_NO_SMARTCARD = 0x8010000C;
final static int SCARD_E_UNKNOWN_CARD = 0x8010000D;
final static int SCARD_E_PROTO_MISMATCH = 0x8010000F;
final static int SCARD_E_NOT_READY = 0x80100010;
final static int SCARD_E_SYSTEM_CANCELLED = 0x80100012;
final static int SCARD_E_NOT_TRANSACTED = 0x80100016;
final static int SCARD_E_READER_UNAVAILABLE = 0x80100017;

final static int SCARD_W_UNSUPPORTED_CARD = 0x80100065;
final static int SCARD_W_UNRESPONSIVE_CARD = 0x80100066;
final static int SCARD_W_UNPOWERED_CARD = 0x80100067;
final static int SCARD_W_RESET_CARD = 0x80100068;
final static int SCARD_W_REMOVED_CARD = 0x80100069;
final static int SCARD_W_INSERTED_CARD = 0x8010006A;

final static int SCARD_E_UNSUPPORTED_FEATURE = 0x8010001F;
final static int SCARD_E_PCI_TOO_SMALL = 0x80100019;
final static int SCARD_E_READER_UNSUPPORTED = 0x8010001A;
final static int SCARD_E_DUPLICATE_READER = 0x8010001B;
final static int SCARD_E_CARD_UNSUPPORTED = 0x8010001C;
final static int SCARD_E_NO_SERVICE = 0x8010001D;
final static int SCARD_E_SERVICE_STOPPED = 0x8010001E;
static final int SCARD_S_SUCCESS = 0x00000000;
static final int SCARD_E_CANCELLED = 0x80100002;
static final int SCARD_E_CANT_DISPOSE = 0x8010000E;
static final int SCARD_E_INSUFFICIENT_BUFFER = 0x80100008;
static final int SCARD_E_INVALID_ATR = 0x80100015;
static final int SCARD_E_INVALID_HANDLE = 0x80100003;
static final int SCARD_E_INVALID_PARAMETER = 0x80100004;
static final int SCARD_E_INVALID_TARGET = 0x80100005;
static final int SCARD_E_INVALID_VALUE = 0x80100011;
static final int SCARD_E_NO_MEMORY = 0x80100006;
static final int SCARD_F_COMM_ERROR = 0x80100013;
static final int SCARD_F_INTERNAL_ERROR = 0x80100001;
static final int SCARD_F_UNKNOWN_ERROR = 0x80100014;
static final int SCARD_F_WAITED_TOO_LONG = 0x80100007;
static final int SCARD_E_UNKNOWN_READER = 0x80100009;
static final int SCARD_E_TIMEOUT = 0x8010000A;
static final int SCARD_E_SHARING_VIOLATION = 0x8010000B;
static final int SCARD_E_NO_SMARTCARD = 0x8010000C;
static final int SCARD_E_UNKNOWN_CARD = 0x8010000D;
static final int SCARD_E_PROTO_MISMATCH = 0x8010000F;
static final int SCARD_E_NOT_READY = 0x80100010;
static final int SCARD_E_SYSTEM_CANCELLED = 0x80100012;
static final int SCARD_E_NOT_TRANSACTED = 0x80100016;
static final int SCARD_E_READER_UNAVAILABLE = 0x80100017;

static final int SCARD_W_UNSUPPORTED_CARD = 0x80100065;
static final int SCARD_W_UNRESPONSIVE_CARD = 0x80100066;
static final int SCARD_W_UNPOWERED_CARD = 0x80100067;
static final int SCARD_W_RESET_CARD = 0x80100068;
static final int SCARD_W_REMOVED_CARD = 0x80100069;
static final int SCARD_W_INSERTED_CARD = 0x8010006A;

static final int SCARD_E_UNSUPPORTED_FEATURE = 0x8010001F;
static final int SCARD_E_PCI_TOO_SMALL = 0x80100019;
static final int SCARD_E_READER_UNSUPPORTED = 0x8010001A;
static final int SCARD_E_DUPLICATE_READER = 0x8010001B;
static final int SCARD_E_CARD_UNSUPPORTED = 0x8010001C;
static final int SCARD_E_NO_SERVICE = 0x8010001D;
static final int SCARD_E_SERVICE_STOPPED = 0x8010001E;

// MS undocumented
final static int SCARD_E_NO_READERS_AVAILABLE = 0x8010002E;
static final int SCARD_E_NO_READERS_AVAILABLE = 0x8010002E;
// std. Windows invalid handle return code, used instead of SCARD code
final static int WINDOWS_ERROR_INVALID_HANDLE = 6;
final static int WINDOWS_ERROR_INVALID_PARAMETER = 87;
static final int WINDOWS_ERROR_INVALID_HANDLE = 6;
static final int WINDOWS_ERROR_INVALID_PARAMETER = 87;

//
final static int SCARD_SCOPE_USER = 0x0000;
final static int SCARD_SCOPE_TERMINAL = 0x0001;
final static int SCARD_SCOPE_SYSTEM = 0x0002;
final static int SCARD_SCOPE_GLOBAL = 0x0003;

final static int SCARD_SHARE_EXCLUSIVE = 0x0001;
final static int SCARD_SHARE_SHARED = 0x0002;
final static int SCARD_SHARE_DIRECT = 0x0003;

final static int SCARD_LEAVE_CARD = 0x0000;
final static int SCARD_RESET_CARD = 0x0001;
final static int SCARD_UNPOWER_CARD = 0x0002;
final static int SCARD_EJECT_CARD = 0x0003;

final static int SCARD_STATE_UNAWARE = 0x0000;
final static int SCARD_STATE_IGNORE = 0x0001;
final static int SCARD_STATE_CHANGED = 0x0002;
final static int SCARD_STATE_UNKNOWN = 0x0004;
final static int SCARD_STATE_UNAVAILABLE = 0x0008;
final static int SCARD_STATE_EMPTY = 0x0010;
final static int SCARD_STATE_PRESENT = 0x0020;
final static int SCARD_STATE_ATRMATCH = 0x0040;
final static int SCARD_STATE_EXCLUSIVE = 0x0080;
final static int SCARD_STATE_INUSE = 0x0100;
final static int SCARD_STATE_MUTE = 0x0200;
final static int SCARD_STATE_UNPOWERED = 0x0400;

final static int TIMEOUT_INFINITE = 0xffffffff;

private final static char[] hexDigits = "0123456789abcdef".toCharArray();
static final int SCARD_SCOPE_USER = 0x0000;
static final int SCARD_SCOPE_TERMINAL = 0x0001;
static final int SCARD_SCOPE_SYSTEM = 0x0002;
static final int SCARD_SCOPE_GLOBAL = 0x0003;

static final int SCARD_SHARE_EXCLUSIVE = 0x0001;
static final int SCARD_SHARE_SHARED = 0x0002;
static final int SCARD_SHARE_DIRECT = 0x0003;

static final int SCARD_LEAVE_CARD = 0x0000;
static final int SCARD_RESET_CARD = 0x0001;
static final int SCARD_UNPOWER_CARD = 0x0002;
static final int SCARD_EJECT_CARD = 0x0003;

static final int SCARD_STATE_UNAWARE = 0x0000;
static final int SCARD_STATE_IGNORE = 0x0001;
static final int SCARD_STATE_CHANGED = 0x0002;
static final int SCARD_STATE_UNKNOWN = 0x0004;
static final int SCARD_STATE_UNAVAILABLE = 0x0008;
static final int SCARD_STATE_EMPTY = 0x0010;
static final int SCARD_STATE_PRESENT = 0x0020;
static final int SCARD_STATE_ATRMATCH = 0x0040;
static final int SCARD_STATE_EXCLUSIVE = 0x0080;
static final int SCARD_STATE_INUSE = 0x0100;
static final int SCARD_STATE_MUTE = 0x0200;
static final int SCARD_STATE_UNPOWERED = 0x0400;

static final int TIMEOUT_INFINITE = 0xffffffff;

private static final char[] hexDigits = "0123456789abcdef".toCharArray();

public static String toString(byte[] b) {
StringBuilder sb = new StringBuilder(b.length * 3);

1 comment on commit c393ee8

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on c393ee8 Nov 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.