Skip to content

Commit 046b4c3

Browse files
authored
remove v1 datafile support (#110)
1 parent 9cb5f71 commit 046b4c3

File tree

5 files changed

+4
-21
lines changed

5 files changed

+4
-21
lines changed

core-api/src/main/java/com/optimizely/ab/config/ProjectConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
public class ProjectConfig {
3737

3838
public enum Version {
39-
V1 ("1"),
4039
V2 ("2"),
4140
V3 ("3");
4241

core-api/src/main/java/com/optimizely/ab/config/parser/JsonConfigParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ public ProjectConfig parseProjectConfig(@Nonnull String json) throws ConfigParse
6464
List<Experiment> experiments = parseExperiments(rootObject.getJSONArray("experiments"));
6565

6666
List<Attribute> attributes;
67-
if (version.equals(ProjectConfig.Version.V1.toString())) {
68-
attributes = parseAttributes(rootObject.getJSONArray("dimensions"));
69-
} else {
70-
attributes = parseAttributes(rootObject.getJSONArray("attributes"));
71-
}
67+
attributes = parseAttributes(rootObject.getJSONArray("attributes"));
7268

7369
List<EventType> events = parseEvents(rootObject.getJSONArray("events"));
7470
List<Audience> audiences = parseAudiences(rootObject.getJSONArray("audiences"));

core-api/src/main/java/com/optimizely/ab/config/parser/JsonSimpleConfigParser.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ public ProjectConfig parseProjectConfig(@Nonnull String json) throws ConfigParse
6464
List<Experiment> experiments = parseExperiments((JSONArray)rootObject.get("experiments"));
6565

6666
List<Attribute> attributes;
67-
if (version.equals(ProjectConfig.Version.V1.toString())) {
68-
throw new ConfigParseException("The Java SDK no longer supports datafile version 1. If you wish to use a Classic Custom Project, please use Java SDK version 1.6 or below.");
69-
} else {
70-
attributes = parseAttributes((JSONArray)rootObject.get("attributes"));
71-
}
67+
attributes = parseAttributes((JSONArray)rootObject.get("attributes"));
7268

7369
List<EventType> events = parseEvents((JSONArray)rootObject.get("events"));
7470
List<Audience> audiences = parseAudiences((JSONArray)parser.parse(rootObject.get("audiences").toString()));

core-api/src/main/java/com/optimizely/ab/config/parser/ProjectConfigGsonDeserializer.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,7 @@ public ProjectConfig deserialize(JsonElement json, Type typeOfT, JsonDeserializa
6060
context.deserialize(jsonObject.get("experiments").getAsJsonArray(), experimentsType);
6161

6262
List<Attribute> attributes;
63-
if (version.equals(ProjectConfig.Version.V1.toString())) {
64-
attributes = context.deserialize(jsonObject.get("dimensions"), attributesType);
65-
} else {
66-
attributes = context.deserialize(jsonObject.get("attributes"), attributesType);
67-
}
63+
attributes = context.deserialize(jsonObject.get("attributes"), attributesType);
6864

6965
List<EventType> events =
7066
context.deserialize(jsonObject.get("events").getAsJsonArray(), eventsType);

core-api/src/main/java/com/optimizely/ab/config/parser/ProjectConfigJacksonDeserializer.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,7 @@ public ProjectConfig deserialize(JsonParser parser, DeserializationContext conte
5757
new TypeReference<List<Experiment>>() {});
5858

5959
List<Attribute> attributes;
60-
if (version.equals(ProjectConfig.Version.V1.toString())) {
61-
attributes = mapper.readValue(node.get("dimensions").toString(), new TypeReference<List<Attribute>>() {});
62-
} else {
63-
attributes = mapper.readValue(node.get("attributes").toString(), new TypeReference<List<Attribute>>() {});
64-
}
60+
attributes = mapper.readValue(node.get("attributes").toString(), new TypeReference<List<Attribute>>() {});
6561

6662
List<EventType> events = mapper.readValue(node.get("events").toString(),
6763
new TypeReference<List<EventType>>() {});

0 commit comments

Comments
 (0)