Skip to content

Commit 0883321

Browse files
leepamillems
authored andcommitted
Add support for : in profile names
1 parent 022970e commit 0883321

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

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

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

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)