Skip to content

Commit a1cb61b

Browse files
authored
Fixes #336 - Invalid path for Snapshot location (#337)
1 parent 3f235e1 commit a1cb61b

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<groupId>com.github.switcherapi</groupId>
99
<artifactId>switcher-client</artifactId>
1010
<packaging>jar</packaging>
11-
<version>2.2.1</version>
11+
<version>2.2.2</version>
1212

1313
<name>Switcher Client</name>
1414
<description>Switcher Client SDK for working with Switcher API</description>

src/main/java/com/github/switcherapi/client/SwitcherExecutorImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
import com.github.switcherapi.client.service.remote.ClientRemote;
99
import com.github.switcherapi.client.utils.SnapshotLoader;
1010
import com.github.switcherapi.client.utils.SwitcherUtils;
11+
import org.apache.commons.lang3.StringUtils;
1112
import org.slf4j.Logger;
1213
import org.slf4j.LoggerFactory;
1314

14-
import java.util.Objects;
15-
1615
public abstract class SwitcherExecutorImpl implements SwitcherExecutor {
1716

1817
private static final Logger logger = LoggerFactory.getLogger(SwitcherExecutorImpl.class);
@@ -40,7 +39,7 @@ protected Domain initializeSnapshotFromAPI(ClientRemote clientRemote)
4039
final Snapshot snapshot = clientRemote.resolveSnapshot();
4140
final String snapshotLocation = switcherProperties.getValue(ContextKey.SNAPSHOT_LOCATION);
4241

43-
if (Objects.nonNull(snapshotLocation)) {
42+
if (StringUtils.isNotBlank(snapshotLocation)) {
4443
SnapshotLoader.saveSnapshot(snapshot, snapshotLocation, environment);
4544
}
4645

src/test/java/com/github/switcherapi/client/SwitcherSnapshotAutoUpdateTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ void shouldUpdateSnapshot_remote_inMemory() {
173173
.apiKey("[API_KEY]")
174174
.environment("generated_mock_default_5")
175175
.local(true)
176+
.snapshotLocation("")
176177
.snapshotAutoLoad(true)
177178
.snapshotAutoUpdateInterval("1m"));
178179

@@ -182,6 +183,7 @@ void shouldUpdateSnapshot_remote_inMemory() {
182183
//test
183184
CountDownHelper.wait(2);
184185
assertEquals(2, Switchers.getSnapshotVersion());
186+
assertTrue(Files.notExists(Paths.get("/generated_mock_default_5.json")));
185187
}
186188

187189
@Test

0 commit comments

Comments
 (0)