File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
main/java/software/amazon/awssdk/profiles
test/java/software/amazon/awssdk/profiles Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ # __2.20.52__ __2023-04-24__
2
+ ## __Profile Files, Core__
3
+ - ### Bugfixes
4
+ - The fix avoids a NullPointerException when calling the profiles() method
5
+ on a ProfileFile object, whose config/credentials files were not found in ~/.aws.
6
+ An empty map is returned instead, as in previous versions.
7
+
1
8
# __2.20.51__ __2023-04-21__
2
9
## __AWS SDK for Java v2__
3
10
- ### Features
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ public Optional<Profile> profile(String profileName) {
117
117
*/
118
118
public Map <String , Profile > profiles () {
119
119
Map <String , Profile > profileMap = profilesAndSectionsMap .get (PROFILES_SECTION_TITLE );
120
- return profileMap != null ? Collections .unmodifiableMap (profileMap ) : profileMap ;
120
+ return profileMap != null ? Collections .unmodifiableMap (profileMap ) : Collections . emptyMap () ;
121
121
}
122
122
123
123
@ Override
Original file line number Diff line number Diff line change @@ -554,6 +554,15 @@ public void loadingDefaultProfileFileWorks() {
554
554
ProfileFile .defaultProfileFile ();
555
555
}
556
556
557
+ @ Test
558
+ public void returnsEmptyMap_when_AwsFilesDoNotExist () {
559
+ ProfileFile missingProfile = ProfileFile .aggregator ()
560
+ .build ();
561
+
562
+ assertThat (missingProfile .profiles ()).isEmpty ();
563
+ assertThat (missingProfile .profiles ()).isInstanceOf (Map .class );
564
+ }
565
+
557
566
private ProfileFile configFile (String configFile ) {
558
567
return ProfileFile .builder ()
559
568
.content (new StringInputStream (configFile ))
You can’t perform that action at this time.
0 commit comments