Skip to content

Commit 932203a

Browse files
jeffaldermillems
authored andcommitted
Allow period, solidus, at-sign, and percent-sign in profile names #389
1 parent d00080e commit 932203a

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## __AWS SDK for Java v2__
2+
- ### Bugfixes
3+
- The period, solidus, at-sign, and percent sign are now allowed in profile names and property names.
4+
15
# __2.10.29__ __2019-12-03__
26
## __AWS Lambda__
37
- ### Features

core/profiles/src/main/java/software/amazon/awssdk/profiles/internal/ProfileFileReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public final class ProfileFileReader {
4242

4343
private static final Pattern EMPTY_LINE = Pattern.compile("^[\t ]*$");
4444

45-
private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-]*$");
45+
private static final Pattern VALID_IDENTIFIER = Pattern.compile("^[A-Za-z0-9_\\-/.%@]*$");
4646

4747
private ProfileFileReader() {}
4848

@@ -213,7 +213,7 @@ private static Optional<String> parseProfileDefinition(ParserState state, String
213213
// If the profile name includes invalid characters, it should be ignored.
214214
if (!isValidIdentifier(profileName)) {
215215
log.warn(() -> "Ignoring profile '" + standardizedProfileName + "' on line " + state.currentLineNumber + " because " +
216-
"it was not alphanumeric with dashes or underscores.");
216+
"it was not alphanumeric with only these special characters: - / . % @ _");
217217
return Optional.empty();
218218
}
219219

@@ -256,7 +256,7 @@ private static Optional<Pair<String, String>> parsePropertyDefinition(ParserStat
256256
// If the profile name includes invalid characters, it should be ignored.
257257
if (!isValidIdentifier(propertyKey)) {
258258
log.warn(() -> "Ignoring property '" + propertyKey + "' on line " + state.currentLineNumber + " because " +
259-
"its name was not alphanumeric with dashes or underscores.");
259+
"its name was not alphanumeric with only these special characters: - / . % @ _");
260260
return Optional.empty();
261261
}
262262

core/profiles/src/test/java/software/amazon/awssdk/profiles/ProfileFileTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@ public void invalidPropertyNamesAreIgnored() {
326326

327327
@Test
328328
public void allValidProfileNameCharactersAreSupported() {
329-
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_]"))
330-
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_")));
329+
assertThat(configFileProfiles("[profile ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@]"))
330+
.isEqualTo(profiles(profile("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@")));
331331
}
332332

333333
@Test
334334
public void allValidPropertyNameCharactersAreSupported() {
335-
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ = value"))
336-
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
335+
assertThat(configFileProfiles("[profile foo]\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@ = value"))
336+
.isEqualTo(profiles(profile("foo", property("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_./%@",
337337
"value"))));
338338
}
339339

0 commit comments

Comments
 (0)