Skip to content

Commit

Permalink
dbeaver/pro#2800 Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rider committed May 10, 2024
1 parent bdea460 commit 7045575
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ public List<WebServerMessage> readSessionLog(
public boolean closeSession(HttpServletRequest request) throws DBWebException {
try {
var baseWebSession = CBPlatform.getInstance().getSessionManager().closeSession(request);
if (baseWebSession instanceof WebSession) {
var webSession = (WebSession) baseWebSession;
if (baseWebSession instanceof WebSession webSession) {
for (WebSessionHandlerDescriptor hd : WebHandlerRegistry.getInstance().getSessionHandlers()) {
try {
hd.getInstance().handleSessionClose(webSession);
Expand Down Expand Up @@ -711,15 +710,12 @@ public WebConnectionInfo testConnection(
);
if (connectionConfig.getSelectedSecretId() != null) {
try {
DBSSecretValue secretValue = dataSource.listSharedCredentials()
dataSource.listSharedCredentials()
.stream()
.filter(secret -> connectionConfig.getSelectedSecretId().equals(secret.getSubjectId()))
.findFirst()
.orElse(null);
.ifPresent(testDataSource::setSelectedSharedCredentials);

if (secretValue != null) {
testDataSource.setSelectedSharedCredentials(secretValue);
}
} catch (DBException e) {
throw new DBWebException("Failed to load secret value: " + connectionConfig.getSelectedSecretId());
}
Expand All @@ -741,7 +737,7 @@ public WebConnectionInfo testConnection(
testDataSource.getConnectionConfiguration());
testDataSource.setSavePassword(true); // We need for test to avoid password callback
if (DataSourceDescriptor.class.isAssignableFrom(testDataSource.getClass())) {
((DataSourceDescriptor) testDataSource).setAccessCheckRequired(!webSession.hasPermission(DBWConstants.PERMISSION_ADMIN));
testDataSource.setAccessCheckRequired(!webSession.hasPermission(DBWConstants.PERMISSION_ADMIN));
}
try {
ConnectionTestJob ct = new ConnectionTestJob(testDataSource, param -> {
Expand Down Expand Up @@ -776,8 +772,7 @@ public WebNetworkEndpointInfo testNetworkHandler(
}
try {
DBWNetworkHandler handler = handlerDescriptor.createHandler(DBWNetworkHandler.class);
if (handler instanceof DBWTunnel) {
DBWTunnel tunnel = (DBWTunnel) handler;
if (handler instanceof DBWTunnel tunnel) {
DBPConnectionConfiguration connectionConfig = new DBPConnectionConfiguration();
connectionConfig.setHostName(DBConstants.HOST_LOCALHOST);
connectionConfig.setHostPort(CommonUtils.toString(nhConfig.getProperties()
Expand Down Expand Up @@ -875,7 +870,6 @@ public WebConnectionFolderInfo createConnectionFolder(
@Nullable String parentPath,
@NotNull String folderName
) throws DBWebException {
DBRProgressMonitor monitor = session.getProgressMonitor();
WebConnectionFolderUtils.validateConnectionFolder(folderName);
session.addInfoMessage("Create new folder");
WebConnectionFolderInfo parentNode = null;
Expand Down

0 comments on commit 7045575

Please sign in to comment.