mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 04:45:37 +00:00
Fix line-length violations in gce/util/Access
This commit addresses all 100-column line-length violations in gce/util/Access.java and removes this file from the suppressions list.
This commit is contained in:
parent
2df39689fc
commit
2517cb3062
@ -3842,7 +3842,6 @@
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]gce[/\\]GceInstancesServiceImpl.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]gce[/\\]GceMetadataService.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]gce[/\\]network[/\\]GceNameResolver.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]cloud[/\\]gce[/\\]util[/\\]Access.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]GceUnicastHostsProvider.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]discovery[/\\]gce[/\\]RetryHttpInitializerWrapper.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]discovery-gce[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugin[/\\]discovery[/\\]gce[/\\]GceDiscoveryPlugin.java" checks="LineLength" />
|
||||
|
@ -22,27 +22,29 @@ package org.elasticsearch.cloud.gce.util;
|
||||
import org.elasticsearch.SpecialPermission;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.SocketPermission;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
|
||||
/**
|
||||
* GCE's http client changes access levels. Specifically it needs {@link RuntimePermission} accessDeclaredMembers and
|
||||
* setFactory and {@link java.lang.reflect.ReflectPermission} suppressAccessChecks. For remote calls the plugin needs
|
||||
* SocketPermissions for 'connect'. This class wraps the operations requiring access in
|
||||
* GCE's HTTP client changes access levels. Specifically it needs {@link RuntimePermission} {@code
|
||||
* accessDeclaredMembers} and {@code setFactory}, and {@link java.lang.reflect.ReflectPermission}
|
||||
* {@code suppressAccessChecks}. For remote calls, the plugin needs {@link SocketPermission} for
|
||||
* {@code connect}. This class wraps the operations requiring access in
|
||||
* {@link AccessController#doPrivileged(PrivilegedAction)} blocks.
|
||||
*/
|
||||
public final class Access {
|
||||
|
||||
private Access() {}
|
||||
|
||||
public static <T> T doPrivileged(PrivilegedAction<T> operation) {
|
||||
public static <T> T doPrivileged(final PrivilegedAction<T> operation) {
|
||||
SpecialPermission.check();
|
||||
return AccessController.doPrivileged(operation);
|
||||
}
|
||||
|
||||
public static void doPrivilegedVoid(Runnable action) {
|
||||
public static void doPrivilegedVoid(final Runnable action) {
|
||||
SpecialPermission.check();
|
||||
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
|
||||
action.run();
|
||||
@ -50,12 +52,14 @@ public final class Access {
|
||||
});
|
||||
}
|
||||
|
||||
public static <T> T doPrivilegedIOException(PrivilegedExceptionAction<T> operation) throws IOException {
|
||||
public static <T> T doPrivilegedIOException(final PrivilegedExceptionAction<T> operation)
|
||||
throws IOException {
|
||||
SpecialPermission.check();
|
||||
try {
|
||||
return AccessController.doPrivileged(operation);
|
||||
} catch (PrivilegedActionException e) {
|
||||
} catch (final PrivilegedActionException e) {
|
||||
throw (IOException) e.getCause();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user