Skip to content

Commit

Permalink
fixes of Boolean.valueOf to parseBoolean or just autoboxing
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Jan 22, 2020
1 parent a08e27e commit 2acbbfc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
Expand Up @@ -94,10 +94,7 @@ public boolean getMandatory() {
return false;
}
String isMandatory = propertiesMap.getProperty(MANDATORY_KEY);
if (isMandatory != null && Boolean.valueOf(isMandatory)) {
return true;
}
return false;
return Boolean.parseBoolean(isMandatory);
}

public void setMandatory(boolean isMandatory) {
Expand Down
Expand Up @@ -4,7 +4,6 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.repo.sql.testing;

import com.evolveum.midpoint.repo.api.RepositoryServiceFactoryException;
Expand All @@ -18,6 +17,7 @@
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

import static com.evolveum.midpoint.repo.sql.SqlRepositoryConfiguration.*;
Expand Down Expand Up @@ -48,11 +48,6 @@ public synchronized void init(Configuration configuration) throws RepositoryServ
super.init(configuration);
}

// @Override
// public RepositoryService getRepositoryService() throws RepositoryServiceFactoryException {
// return new TestSqlRepositoryServiceImpl(this);
// }

private void updateConfigurationFromFile(Configuration configuration, String filePath) throws RepositoryServiceFactoryException {
Properties properties = new Properties();
try {
Expand Down Expand Up @@ -149,7 +144,7 @@ private void updateConfigurationBooleanProperty(Configuration configuration, Pro
if (value == null) {
return;
}
boolean val = Boolean.valueOf(value);
boolean val = Boolean.parseBoolean(value);
LOGGER.info("Overriding loaded configuration with value read from system properties: {}={}", propertyName, val);
configuration.setProperty(propertyName, val);
}
Expand Down
Expand Up @@ -819,19 +819,19 @@ protected void assumeConflictResolutionAction(ConflictResolutionActionType actio
protected void assumeResourceAssigmentPolicy(String resourceOid, AssignmentPolicyEnforcementType policy, boolean legalize) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException{
ProjectionPolicyType syncSettings = new ProjectionPolicyType();
syncSettings.setAssignmentPolicyEnforcement(policy);
syncSettings.setLegalize(Boolean.valueOf(legalize));
syncSettings.setLegalize(legalize);
applySyncSettings(ResourceType.class, resourceOid, ResourceType.F_PROJECTION, syncSettings);
}

protected void deleteResourceAssigmentPolicy(String oid, AssignmentPolicyEnforcementType policy, boolean legalize) throws ObjectNotFoundException, SchemaException, ObjectAlreadyExistsException{
ProjectionPolicyType syncSettings = new ProjectionPolicyType();
syncSettings.setAssignmentPolicyEnforcement(policy);
syncSettings.setLegalize(Boolean.valueOf(legalize));
syncSettings.setLegalize(legalize);
ContainerDelta<ProjectionPolicyType> deleteAssigmentEnforcement = prismContext.deltaFactory().container()
.createModificationDelete(ResourceType.F_PROJECTION, ResourceType.class,
syncSettings.clone());

Collection<ItemDelta> modifications = new ArrayList<>();
Collection<ItemDelta<?, ?>> modifications = new ArrayList<>();
modifications.add(deleteAssigmentEnforcement);

OperationResult result = new OperationResult("Aplying sync settings");
Expand Down
@@ -1,4 +1,4 @@
/**
/*
* Copyright (c) 2010-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
Expand Down Expand Up @@ -37,12 +37,12 @@ public class MidPoint {
private String baseUrl;
private String webDriver;
private String webdriverLocation;
private Boolean headless;
private boolean headless;

public MidPoint(EnvironmentConfiguration environment) throws IOException {
Validate.notNull(environment, "Environment configuration must not be null");

this.environment = environment;
MidPoint.environment = environment;

init();
}
Expand All @@ -52,7 +52,6 @@ private void init() throws IOException {
environment.baseUrl(baseUrl);
environment.validate();


System.setProperty(webDriver, webdriverLocation);
System.setProperty("selenide.browser", environment.getDriver().name().toLowerCase());
System.setProperty("selenide.baseUrl", environment.getBaseUrl());
Expand Down Expand Up @@ -90,7 +89,7 @@ private void fetchProperties() throws IOException {
password = schrodingerProperties.getProperty("password");
baseUrl = schrodingerProperties.getProperty("base_url");

headless = Boolean.valueOf(schrodingerProperties.getProperty("headlessStart"));
headless = Boolean.parseBoolean(schrodingerProperties.getProperty("headlessStart"));
} catch (IOException e) {
throw new IOException("An exception was thrown during Schrodinger initialization " + e.getLocalizedMessage());
}
Expand Down

0 comments on commit 2acbbfc

Please sign in to comment.