File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
main/java/com/microsoft/graph/http
test/java/com/microsoft/graph/http Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
1212### Changed
1313
14+ - Fixes NullPointerException in GraphErrorResponse#copy
15+
1416## [ 2.0.16] - 2023-01-30
1517
1618### Changed
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ public final AdditionalDataManager additionalDataManager() {
8080 public GraphErrorResponse copy () {
8181 GraphErrorResponse responseCopy = new GraphErrorResponse ();
8282 responseCopy .additionalDataManager = this .additionalDataManager ;
83- responseCopy .rawObject = this .rawObject .deepCopy ();
84- responseCopy .error = this .error .copy ();
83+ responseCopy .rawObject = this .rawObject == null ? null : this . rawObject .deepCopy ();
84+ responseCopy .error = this .error == null ? null : this . error .copy ();
8585 return responseCopy ;
8686 }
8787}
Original file line number Diff line number Diff line change 22
33import static org .junit .jupiter .api .Assertions .assertEquals ;
44import static org .junit .jupiter .api .Assertions .assertTrue ;
5+ import static org .junit .jupiter .api .Assertions .assertNull ;
56import static org .mockito .Mockito .mock ;
67
78import org .junit .jupiter .api .Test ;
@@ -59,4 +60,18 @@ public void testGraphErrorResponseCopy() {
5960
6061 assertEquals (errorResponse .rawObject , errorResponseCopy .rawObject );
6162 }
63+
64+ @ Test
65+ void testGraphErrorResponseCopy2 () {
66+ GraphErrorResponse errorResponse = new GraphErrorResponse ();;
67+
68+ //Copy the errorResponse and its subsequent innerErrors
69+ GraphErrorResponse errorResponseCopy = errorResponse .copy ();
70+
71+ //Ensure default null values are copied without issue.
72+ assertNull (errorResponseCopy .error );
73+ assertNull (errorResponseCopy .rawObject );
74+
75+ assertEquals (errorResponse .rawObject , errorResponseCopy .rawObject );
76+ }
6277}
You can’t perform that action at this time.
0 commit comments