diff --git a/.devcontainer/devcontainer-lock.json b/.devcontainer/devcontainer-lock.json new file mode 100644 index 000000000..cc2a3d6bd --- /dev/null +++ b/.devcontainer/devcontainer-lock.json @@ -0,0 +1,24 @@ +{ + "features": { + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "1.1.0", + "resolved": "ghcr.io/devcontainers/features/github-cli@sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671", + "integrity": "sha256:d22f50b70ed75339b4eed1ba9ecde3a1791f90e88d37936517e3bace0bbad671" + }, + "ghcr.io/devcontainers/features/java:1": { + "version": "1.8.0", + "resolved": "ghcr.io/devcontainers/features/java@sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a", + "integrity": "sha256:9663ce0219ff85786e87901ce5f0a59f488edd5f99b46015192cda48468b233a" + }, + "ghcr.io/devcontainers/features/node:2": { + "version": "2.0.0", + "resolved": "ghcr.io/devcontainers/features/node@sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f", + "integrity": "sha256:fedd4c11f7adfb64283b578dddc7da906728daa25fa293351c9d913231acf12f" + }, + "ghcr.io/devcontainers/features/powershell:2": { + "version": "2.0.2", + "resolved": "ghcr.io/devcontainers/features/powershell@sha256:82ea3880c5706ac3963f1b5e940a7f5871835393a5472f80008148b995d58d61", + "integrity": "sha256:82ea3880c5706ac3963f1b5e940a7f5871835393a5472f80008148b995d58d61" + } + } +} diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0581619f8..bfde8e3c7 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,17 +1,20 @@ { - "name": "Java", - "image": "mcr.microsoft.com/devcontainers/java:17", + "name": "Java 21 & Gradle", + "image": "mcr.microsoft.com/devcontainers/java:21-bookworm", "features": { "ghcr.io/devcontainers/features/java:1": { "version": "none", "installMaven": "true", "installGradle": "true" }, - "ghcr.io/devcontainers/features/node:1": { + "ghcr.io/devcontainers/features/node:2": { "version": "lts" }, "ghcr.io/devcontainers/features/github-cli:1": {}, - "ghcr.io/devcontainers/features/powershell:1": {} + "ghcr.io/devcontainers/features/powershell:2": {} + }, + "containerEnv": { + "WAYLAND_DISPLAY": "disabled" }, // Configure tool-specific properties. "customizations": { diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 71db154c4..03d94877c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -48,3 +48,8 @@ updates: open-telemetry: patterns: - "*opentelemetry*" +- package-ecosystem: devcontainers + directory: "/.devcontainer" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/components/abstractions/spotBugsExcludeFilter.xml b/components/abstractions/spotBugsExcludeFilter.xml index 68e65df88..8c33623ae 100644 --- a/components/abstractions/spotBugsExcludeFilter.xml +++ b/components/abstractions/spotBugsExcludeFilter.xml @@ -67,4 +67,17 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu + + + + + + + + + + + + + diff --git a/components/abstractions/src/main/java/com/microsoft/kiota/RequestInformation.java b/components/abstractions/src/main/java/com/microsoft/kiota/RequestInformation.java index be16d49e8..7cd98aa9f 100644 --- a/components/abstractions/src/main/java/com/microsoft/kiota/RequestInformation.java +++ b/components/abstractions/src/main/java/com/microsoft/kiota/RequestInformation.java @@ -91,7 +91,7 @@ public void configure( @Nullable public String urlTemplate; /** The path parameters for the current request */ - @Nullable public Map pathParameters = new HashMap<>(); + @Nonnull public Map pathParameters = new HashMap<>(); private URI uri; diff --git a/components/abstractions/src/main/java/com/microsoft/kiota/authentication/BaseBearerTokenAuthenticationProvider.java b/components/abstractions/src/main/java/com/microsoft/kiota/authentication/BaseBearerTokenAuthenticationProvider.java index 819c63bf9..43ceaa0dd 100644 --- a/components/abstractions/src/main/java/com/microsoft/kiota/authentication/BaseBearerTokenAuthenticationProvider.java +++ b/components/abstractions/src/main/java/com/microsoft/kiota/authentication/BaseBearerTokenAuthenticationProvider.java @@ -42,6 +42,9 @@ public void authenticateRequest( } catch (URISyntaxException e) { throw new RuntimeException("Malformed URI.", e); } + if (targetUri == null) { + throw new IllegalStateException("Request URI cannot be null."); + } String accessToken = this.accessTokenProvider.getAuthorizationToken( targetUri, additionalAuthenticationContext); diff --git a/components/abstractions/src/main/java/com/microsoft/kiota/serialization/KiotaSerialization.java b/components/abstractions/src/main/java/com/microsoft/kiota/serialization/KiotaSerialization.java index a9c0a9e0e..a4ef68a24 100644 --- a/components/abstractions/src/main/java/com/microsoft/kiota/serialization/KiotaSerialization.java +++ b/components/abstractions/src/main/java/com/microsoft/kiota/serialization/KiotaSerialization.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -259,6 +260,7 @@ private static InputStream getInputStreamFromString(@Nonnull final String value) @Nonnull final InputStream stream, @Nonnull final ParsableFactory parsableFactory) { final ParseNode parseNode = getRootParseNode(contentType, stream, parsableFactory); - return parseNode.getCollectionOfObjectValues(parsableFactory); + final List values = parseNode.getCollectionOfObjectValues(parsableFactory); + return values != null ? values : new ArrayList<>(); } } diff --git a/components/abstractions/src/test/java/com/microsoft/kiota/BaseRequestConfigurationTest.java b/components/abstractions/src/test/java/com/microsoft/kiota/BaseRequestConfigurationTest.java index 257060f70..f7c8122c6 100644 --- a/components/abstractions/src/test/java/com/microsoft/kiota/BaseRequestConfigurationTest.java +++ b/components/abstractions/src/test/java/com/microsoft/kiota/BaseRequestConfigurationTest.java @@ -20,9 +20,10 @@ void testOptions() { RequestOption requestOption = new RequestOption() { + @SuppressWarnings("unchecked") @Override public Class getType() { - return null; + return (Class) RequestOption.class; } }; // options should be mutable list diff --git a/components/abstractions/src/test/java/com/microsoft/kiota/RequestInformationTest.java b/components/abstractions/src/test/java/com/microsoft/kiota/RequestInformationTest.java index d1c07d1c1..526d5fa32 100644 --- a/components/abstractions/src/test/java/com/microsoft/kiota/RequestInformationTest.java +++ b/components/abstractions/src/test/java/com/microsoft/kiota/RequestInformationTest.java @@ -44,6 +44,7 @@ void BuildsUrlOnProvidedBaseUrl() { requestInfo.urlTemplate = "{+baseurl}/users{?%24count}"; // Act + assertNotNull(requestInfo.pathParameters); requestInfo.pathParameters.put("baseurl", "http://localhost"); // Assert diff --git a/components/abstractions/src/test/java/com/microsoft/kiota/store/InMemoryBackingStoreTest.java b/components/abstractions/src/test/java/com/microsoft/kiota/store/InMemoryBackingStoreTest.java index 39f97e711..96f4bbe8e 100644 --- a/components/abstractions/src/test/java/com/microsoft/kiota/store/InMemoryBackingStoreTest.java +++ b/components/abstractions/src/test/java/com/microsoft/kiota/store/InMemoryBackingStoreTest.java @@ -450,6 +450,7 @@ void TestsBackingStoreUpdateToItemInNestedCollectionWithAnotherBackedModel() { manager.setId("2fe22fe5-1132-42cf-90f9-1dc17e325a74"); manager.getBackingStore().setIsInitializationCompleted(true); var collectionValues = testUserCollectionResponse.getValue(); + assertNotNull(collectionValues); collectionValues.get(0).setManager(manager); // Assert by retrieving only changed values @@ -504,7 +505,9 @@ void testInitializationCompletedIsPropagatedToCollectionItems() { testUser.setValue(colleagues); testUser.getBackingStore().setIsInitializationCompleted(true); - for (TestEntity colleague : testUser.getValue()) { + final var values = testUser.getValue(); + assertNotNull(values); + for (TestEntity colleague : values) { assertTrue(colleague.getBackingStore().getIsInitializationCompleted()); } } diff --git a/components/authentication/azure/spotBugsExcludeFilter.xml b/components/authentication/azure/spotBugsExcludeFilter.xml index 4c1060939..1925dadff 100644 --- a/components/authentication/azure/spotBugsExcludeFilter.xml +++ b/components/authentication/azure/spotBugsExcludeFilter.xml @@ -7,4 +7,12 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu + + + + + + + + \ No newline at end of file diff --git a/components/authentication/azure/src/test/java/com/microsoft/kiota/authentication/AzureIdentityAccessTokenProviderTest.java b/components/authentication/azure/src/test/java/com/microsoft/kiota/authentication/AzureIdentityAccessTokenProviderTest.java index 3dd49bb1f..081fe165e 100644 --- a/components/authentication/azure/src/test/java/com/microsoft/kiota/authentication/AzureIdentityAccessTokenProviderTest.java +++ b/components/authentication/azure/src/test/java/com/microsoft/kiota/authentication/AzureIdentityAccessTokenProviderTest.java @@ -32,7 +32,8 @@ void testLocalhostHttpUrlIsValid(String urlString) throws URISyntaxException { var tokenCredential = mock(TokenCredential.class); when(tokenCredential.getTokenSync(any(TokenRequestContext.class))) .thenReturn(new AccessToken("token", null)); - var accessTokenProvider = new AzureIdentityAccessTokenProvider(tokenCredential, null, ""); + var accessTokenProvider = + new AzureIdentityAccessTokenProvider(tokenCredential, new String[] {}, ""); assertEquals( "token", accessTokenProvider.getAuthorizationToken(new URI(urlString), new HashMap<>())); @@ -42,7 +43,8 @@ void testLocalhostHttpUrlIsValid(String urlString) throws URISyntaxException { @ValueSource(strings = {"http://graph.microsoft.com/me"}) void testNonLocalhostHttpUrlIsInvalid(String urlString) { var tokenCredential = mock(TokenCredential.class); - var accessTokenProvider = new AzureIdentityAccessTokenProvider(tokenCredential, null, ""); + var accessTokenProvider = + new AzureIdentityAccessTokenProvider(tokenCredential, new String[] {}, ""); assertThrows( IllegalArgumentException.class, () -> diff --git a/components/http/okHttp/spotBugsExcludeFilter.xml b/components/http/okHttp/spotBugsExcludeFilter.xml index a242f453f..cd4710d92 100644 --- a/components/http/okHttp/spotBugsExcludeFilter.xml +++ b/components/http/okHttp/spotBugsExcludeFilter.xml @@ -39,4 +39,15 @@ + + + + + + + + + + + diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java index a944de067..a73f1db9e 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java @@ -879,8 +879,12 @@ private void setBaseUrlForRequestInformation(@Nonnull final RequestInformation r .setParent(Context.current().with(parentSpan)) .startSpan(); try (final Scope scope = span.makeCurrent()) { - spanForAttributes.setAttribute(HTTP_REQUEST_METHOD, requestInfo.httpMethod.toString()); - final URL requestURL = requestInfo.getUri().toURL(); + final HttpMethod requestMethod = + Objects.requireNonNull(requestInfo.httpMethod, "httpMethod cannot be null"); + spanForAttributes.setAttribute(HTTP_REQUEST_METHOD, requestMethod.toString()); + final java.net.URI requestUri = + Objects.requireNonNull(requestInfo.getUri(), "request URI cannot be null"); + final URL requestURL = requestUri.toURL(); if (obsOptions.getIncludeEUIIAttributes()) { spanForAttributes.setAttribute(URL_FULL, requestURL.toString()); } @@ -888,8 +892,9 @@ private void setBaseUrlForRequestInformation(@Nonnull final RequestInformation r spanForAttributes.setAttribute(SERVER_ADDRESS, requestURL.getHost()); spanForAttributes.setAttribute(URL_SCHEME, requestURL.getProtocol()); + final InputStream requestContent = requestInfo.content; RequestBody body = - requestInfo.content == null + requestContent == null ? null : new RequestBody() { @Override @@ -910,7 +915,8 @@ public MediaType contentType() { @Override public boolean isOneShot() { - return !requestInfo.content.markSupported(); + return requestContent == null + || !requestContent.markSupported(); } @Override @@ -924,9 +930,9 @@ public long contentLength() throws IOException { } // super.contentLength() is not relied on since it defaults to // -1L, causing wrong telemetry added to the attributes. - if (requestInfo.content instanceof ByteArrayInputStream) { + if (requestContent instanceof ByteArrayInputStream) { final ByteArrayInputStream contentStream = - (ByteArrayInputStream) requestInfo.content; + (ByteArrayInputStream) requestContent; // using available() on a byte-array backed input stream is // reliable because array size is defined. return contentStream.available(); @@ -936,14 +942,14 @@ public long contentLength() throws IOException { @Override public void writeTo(@Nonnull BufferedSink sink) throws IOException { - long contentLength = contentLength(); + final long contentLength = contentLength(); if (contentLength > 0) { - requestInfo.content.mark((int) contentLength); + requestContent.mark((int) contentLength); } - sink.writeAll(Okio.source(requestInfo.content)); + sink.writeAll(Okio.source(requestContent)); if (!isOneShot()) { try { - requestInfo.content.reset(); + requestContent.reset(); } catch (Exception ex) { spanForAttributes.recordException(ex); // we don't want to fail the request if reset() fails diff --git a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/RetryHandler.java b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/RetryHandler.java index 275acdb85..50d63e9ab 100644 --- a/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/RetryHandler.java +++ b/components/http/okHttp/src/main/java/com/microsoft/kiota/http/middleware/RetryHandler.java @@ -85,7 +85,7 @@ boolean retryRequest( int executionCount, @Nonnull final Request request, @Nonnull final RetryHandlerOption retryOption, - @Nonnull final Span span) { + @Nullable final Span span) { // Should retry option // Use should retry common for all requests @@ -110,7 +110,9 @@ && isBuffered(request) if (shouldRetry) { long retryInterval = getRetryAfter(response, retryOption.delay(), executionCount); - span.setAttribute(HTTP_REQUEST_RESEND_DELAY, Math.round(retryInterval / 1000f)); + if (span != null) { + span.setAttribute(HTTP_REQUEST_RESEND_DELAY, Math.round(retryInterval / 1000f)); + } try { Thread.sleep(retryInterval); } catch (InterruptedException e) { @@ -258,7 +260,8 @@ boolean isBuffered(final Request request) { } int executionCount = 1; - while (retryRequest(response, executionCount, request, retryOption, span)) { + while (retryRequest( + response, executionCount, request, Objects.requireNonNull(retryOption), span)) { final Request.Builder builder = request.newBuilder() .addHeader(RETRY_ATTEMPT_HEADER, String.valueOf(executionCount)); @@ -266,9 +269,6 @@ boolean isBuffered(final Request request) { builder.tag(Span.class, span); } request = builder.build(); - if (request == null) { - throw new IllegalArgumentException("request cannot be null"); - } executionCount++; final ResponseBody body = response.body(); if (body != null) body.close(); diff --git a/components/serialization/form/src/main/java/com/microsoft/kiota/serialization/FormParseNode.java b/components/serialization/form/src/main/java/com/microsoft/kiota/serialization/FormParseNode.java index b2df53eb0..f62827c56 100644 --- a/components/serialization/form/src/main/java/com/microsoft/kiota/serialization/FormParseNode.java +++ b/components/serialization/form/src/main/java/com/microsoft/kiota/serialization/FormParseNode.java @@ -140,7 +140,11 @@ private String sanitizeKey(@Nonnull final String key) { } @Nullable public List getCollectionOfPrimitiveValues(@Nonnull final Class targetClass) { - final String[] primitiveStringCollection = getStringValue().split(","); + final String rawValue = getStringValue(); + if (rawValue == null) { + return null; + } + final String[] primitiveStringCollection = rawValue.split(","); final List result = new ArrayList<>(primitiveStringCollection.length); for (final String item : primitiveStringCollection) { String decodedItem; diff --git a/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/ParseNodeTests.java b/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/ParseNodeTests.java index 6cb719e06..5448edf1d 100644 --- a/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/ParseNodeTests.java +++ b/components/serialization/form/src/test/java/com/microsoft/kiota/serialization/ParseNodeTests.java @@ -89,6 +89,7 @@ void returnsDefaultIfChildNodeDoesNotExist() { void getCollectionOfBooleanPrimitiveValuesFromForm() { final String TestFormData = "bools=true&" + "bools=false"; final ParseNode numberNode = new FormParseNode(TestFormData).getChildNode("bools"); + assertNotNull(numberNode); final List numberCollection = numberNode.getCollectionOfPrimitiveValues(Boolean.class); assertNotNull(numberCollection); @@ -102,6 +103,7 @@ void getCollectionOfGuidPrimitiveValuesFromForm() { "ids=48d31887-5fad-4d73-a9f5-3c356e68a038&" + "ids=48d31887-5fad-4d73-a9f5-3c356e68a038"; final ParseNode numberNode = new FormParseNode(TestFormData).getChildNode("ids"); + assertNotNull(numberNode); var numberCollection = numberNode.getCollectionOfPrimitiveValues(UUID.class); assertNotNull(numberCollection); assertEquals(2, numberCollection.size()); @@ -143,6 +145,7 @@ void testInvalidOffsetDateTimeStringThrowsException(final String dateTimeString) void getCollectionOfStringPrimitiveValuesFromForm() { final String testFormData = "names=Alice&names=Bob"; final ParseNode node = new FormParseNode(testFormData).getChildNode("names"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(String.class); assertNotNull(result); assertEquals(2, result.size()); @@ -154,6 +157,7 @@ void getCollectionOfStringPrimitiveValuesFromForm() { void getCollectionOfIntegerPrimitiveValuesFromForm() { final String testFormData = "nums=1&nums=2&nums=3"; final ParseNode node = new FormParseNode(testFormData).getChildNode("nums"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Integer.class); assertNotNull(result); assertEquals(3, result.size()); @@ -166,6 +170,7 @@ void getCollectionOfIntegerPrimitiveValuesFromForm() { void getCollectionOfLongPrimitiveValuesFromForm() { final String testFormData = "vals=100&vals=200"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Long.class); assertNotNull(result); assertEquals(2, result.size()); @@ -177,6 +182,7 @@ void getCollectionOfLongPrimitiveValuesFromForm() { void getCollectionOfDoublePrimitiveValuesFromForm() { final String testFormData = "vals=1.5&vals=2.5"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Double.class); assertNotNull(result); assertEquals(2, result.size()); @@ -188,6 +194,7 @@ void getCollectionOfDoublePrimitiveValuesFromForm() { void getCollectionOfFloatPrimitiveValuesFromForm() { final String testFormData = "vals=1.5&vals=2.5"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Float.class); assertNotNull(result); assertEquals(2, result.size()); @@ -199,6 +206,7 @@ void getCollectionOfFloatPrimitiveValuesFromForm() { void getCollectionOfShortPrimitiveValuesFromForm() { final String testFormData = "vals=10&vals=20"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Short.class); assertNotNull(result); assertEquals(2, result.size()); @@ -210,6 +218,7 @@ void getCollectionOfShortPrimitiveValuesFromForm() { void getCollectionOfBytePrimitiveValuesFromForm() { final String testFormData = "vals=1&vals=2"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(Byte.class); assertNotNull(result); assertEquals(2, result.size()); @@ -221,6 +230,7 @@ void getCollectionOfBytePrimitiveValuesFromForm() { void getCollectionOfBigDecimalPrimitiveValuesFromForm() { final String testFormData = "vals=123.45&vals=678.90"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(BigDecimal.class); assertNotNull(result); assertEquals(2, result.size()); @@ -238,6 +248,7 @@ void getCollectionOfOffsetDateTimePrimitiveValuesFromForm() { + "&vals=" + URLEncoder.encode(dt2, StandardCharsets.UTF_8); final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(OffsetDateTime.class); assertNotNull(result); @@ -250,6 +261,7 @@ void getCollectionOfOffsetDateTimePrimitiveValuesFromForm() { void getCollectionOfLocalDatePrimitiveValuesFromForm() { final String testFormData = "vals=2024-01-01&vals=2024-06-15"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(LocalDate.class); assertNotNull(result); assertEquals(2, result.size()); @@ -261,6 +273,7 @@ void getCollectionOfLocalDatePrimitiveValuesFromForm() { void getCollectionOfLocalTimePrimitiveValuesFromForm() { final String testFormData = "vals=08:00:00&vals=17:30:00"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(LocalTime.class); assertNotNull(result); assertEquals(2, result.size()); @@ -272,6 +285,7 @@ void getCollectionOfLocalTimePrimitiveValuesFromForm() { void getCollectionOfPeriodAndDurationPrimitiveValuesFromForm() { final String testFormData = "vals=P1M&vals=PT2H"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); final List result = node.getCollectionOfPrimitiveValues(PeriodAndDuration.class); assertNotNull(result); @@ -284,6 +298,7 @@ void getCollectionOfPeriodAndDurationPrimitiveValuesFromForm() { void getCollectionOfPrimitiveValuesThrowsForUnknownType() { final String testFormData = "vals=foo"; final ParseNode node = new FormParseNode(testFormData).getChildNode("vals"); + assertNotNull(node); assertThrows( RuntimeException.class, () -> node.getCollectionOfPrimitiveValues(Object.class)); } diff --git a/components/serialization/json/spotBugsExcludeFilter.xml b/components/serialization/json/spotBugsExcludeFilter.xml index 4a40a57fb..754432829 100644 --- a/components/serialization/json/spotBugsExcludeFilter.xml +++ b/components/serialization/json/spotBugsExcludeFilter.xml @@ -32,4 +32,13 @@ xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubu + + + + + + + + + diff --git a/components/serialization/text/spotBugsExcludeFilter.xml b/components/serialization/text/spotBugsExcludeFilter.xml index c20dac932..478f6b1de 100644 --- a/components/serialization/text/spotBugsExcludeFilter.xml +++ b/components/serialization/text/spotBugsExcludeFilter.xml @@ -7,4 +7,8 @@ + + + + \ No newline at end of file diff --git a/components/serialization/text/src/main/java/com/microsoft/kiota/serialization/TextParseNode.java b/components/serialization/text/src/main/java/com/microsoft/kiota/serialization/TextParseNode.java index 11ddafc20..387436864 100644 --- a/components/serialization/text/src/main/java/com/microsoft/kiota/serialization/TextParseNode.java +++ b/components/serialization/text/src/main/java/com/microsoft/kiota/serialization/TextParseNode.java @@ -78,7 +78,8 @@ public TextParseNode(@Nonnull final String rawText) { } @Nullable public UUID getUUIDValue() { - return UUID.fromString(this.getStringValue()); + final String value = this.getStringValue(); + return value != null ? UUID.fromString(value) : null; } @Nullable public OffsetDateTime getOffsetDateTimeValue() { @@ -104,7 +105,8 @@ public TextParseNode(@Nonnull final String rawText) { } @Nullable public PeriodAndDuration getPeriodAndDurationValue() { - return PeriodAndDuration.parse(this.getStringValue()); + final String value = this.getStringValue(); + return value != null ? PeriodAndDuration.parse(value) : null; } @Nullable public List getCollectionOfPrimitiveValues(@Nonnull final Class targetClass) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b8fe0a4f2..17a97c32a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -22,5 +22,5 @@ org-mockito-mockito-core = { group = "org.mockito", name = "mockito-core", versi [plugins] com-diffplug-spotless = { id = "com.diffplug.spotless", version = "8.6.0" } -com-github-spotbugs = { id = "com.github.spotbugs", version = "6.5.5" } +com-github-spotbugs = { id = "com.github.spotbugs", version = "6.5.6" } org-sonarqube = { id = "org.sonarqube", version = "7.3.1.8318" }