Skip to content

Commit d0b03d2

Browse files
authored
Migrate azure-storage-blob to azure-xml (#40622)
* wip :( * blobflatsegment fix * blobhierarchylistsegment wip * pre regeneration * fix for BlobServiceStatistics and (i think) BlobHierarchyListSegment * revapi ignore * adding javadoc for BlobSignedIdentifierWrapper, removing instances of RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE from spotbugs, and ignoring other spotbugs errors. * removing the revapi things i accidentally added back in * jsonSerializable wip * removing jackson from ImmutableStorageWithVersioningTests * manual spotbugs exclude additions * revapi ignore done with JacksonDatabindRemovalTransform * corrected (?) revapi ignore in JacksonDatabindRemovalTransform * oops * OOPS * removing duplicated implementation in ImmutableStorageWithVersioningAsyncTests * adding ByteBufferBackedOutputStreamUtil * style and spotbugs excludes
1 parent d2cf4fe commit d0b03d2

File tree

199 files changed

+17142
-25383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+17142
-25383
lines changed

eng/code-quality-reports/src/main/java/com/azure/tools/revapi/transforms/JacksonDatabindRemovalTransform.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ private static boolean shouldDiscard(String packageName) {
134134
} else if (packageName.regionMatches(18, "queue.models", 0, 12)) {
135135
// Queue
136136
return true;
137+
} else if (packageName.regionMatches(18, "blob.", 0, 5)) {
138+
// Blob
139+
return packageName.regionMatches(23, "models", 0, 6)
140+
|| packageName.regionMatches(23, "options", 0, 7);
137141
}
138142
} else if (packageName.regionMatches(10, "communication.", 0, 14)) {
139143
if (packageName.regionMatches(24, "jobrouter.models", 0, 16)) {

sdk/storage/azure-storage-blob/checkstyle-suppressions.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
<suppress files="com.azure.storage.blob.implementation.util.ModelHelper.java" checks="MissingJavadocMethodCheck" />
2020
<suppress files="com.azure.storage.blob.implementation.models.PageListHelper.java" checks="MissingJavadocTypeCheck" />
2121
<suppress files="com.azure.storage.blob.implementation.util.BlobRequestConditionProperty.java" checks="MissingJavadocTypeCheck" />
22-
<suppress files="com.azure.storage.blob.implementation.util.CustomHierarchicalListingDeserializer.java" checks="MissingJavadocTypeCheck" />
2322
<suppress files="com.azure.storage.blob.implementation.BlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />
2423
<suppress files="com.azure.storage.blob.implementation.BlockBlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />
2524
<suppress files="com.azure.storage.blob.implementation.PageBlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />

sdk/storage/azure-storage-blob/pom.xml

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
</dependency>
9090

9191
<dependency>
92-
<groupId>com.fasterxml.jackson.dataformat</groupId>
93-
<artifactId>jackson-dataformat-xml</artifactId>
94-
<version>2.13.5</version> <!-- {x-version-update;com.fasterxml.jackson.dataformat:jackson-dataformat-xml;external_dependency} -->
92+
<groupId>com.azure</groupId>
93+
<artifactId>azure-xml</artifactId>
94+
<version>1.0.0</version> <!-- {x-version-update;com.azure:azure-xml;dependency} -->
9595
</dependency>
9696

9797
<!-- Added this dependency to include necessary annotations used by reactor core.
@@ -187,25 +187,6 @@
187187
</dependency>
188188
</dependencies>
189189

190-
<build>
191-
<plugins>
192-
<plugin>
193-
<groupId>org.apache.maven.plugins</groupId>
194-
<artifactId>maven-enforcer-plugin</artifactId>
195-
<version>3.4.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
196-
<configuration>
197-
<rules>
198-
<bannedDependencies>
199-
<includes>
200-
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-xml:[2.13.5]</include> <!-- {x-include-update;com.fasterxml.jackson.dataformat:jackson-dataformat-xml;external_dependency} -->
201-
</includes>
202-
</bannedDependencies>
203-
</rules>
204-
</configuration>
205-
</plugin>
206-
</plugins>
207-
</build>
208-
209190
<profiles>
210191
<profile>
211192
<id>inject-sas-service-version</id>

sdk/storage/azure-storage-blob/spotbugs-exclude.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,28 @@
2121
<Class name="com.azure.storage.blob.BlobClient" />
2222
<Class name="com.azure.storage.blob.BlobUrlParts" />
2323
<Class name="com.azure.storage.blob.implementation.AzureBlobStorageImpl" />
24-
<Class name="com.azure.storage.blob.implementation.SignedIdentifiersWrapper" />
24+
<Class name="com.azure.storage.blob.implementation.models.ArrowConfiguration" />
25+
<Class name="com.azure.storage.blob.implementation.models.BlobContainersSegment" />
2526
<Class name="com.azure.storage.blob.implementation.models.BlobFlatListSegment" />
2627
<Class name="com.azure.storage.blob.implementation.models.BlobHierarchyListSegment" />
2728
<Class name="com.azure.storage.blob.implementation.models.BlobItemInternal" />
2829
<Class name="com.azure.storage.blob.implementation.models.BlobPropertiesInternalConstructorProperties" />
30+
<Class name="com.azure.storage.blob.implementation.models.BlobSignedIdentifierWrapper" />
31+
<Class name="com.azure.storage.blob.implementation.models.BlobTags" />
2932
<Class name="com.azure.storage.blob.implementation.models.BlobsDownloadHeaders" />
3033
<Class name="com.azure.storage.blob.implementation.models.BlobsGetPropertiesHeaders" />
3134
<Class name="com.azure.storage.blob.implementation.models.BlobsQueryHeaders" />
3235
<Class name="com.azure.storage.blob.implementation.models.ContainersGetPropertiesHeaders" />
36+
<Class name="com.azure.storage.blob.implementation.models.FilterBlobSegment" />
3337
<Class name="com.azure.storage.blob.implementation.models.PageListCollection" />
3438
<Class name="com.azure.storage.blob.implementation.models.PageListSegment" />
3539
<Class name="com.azure.storage.blob.models.BlobContainerAccessPolicies" />
3640
<Class name="com.azure.storage.blob.models.BlobContainerItem" />
3741
<Class name="com.azure.storage.blob.models.BlobContainerProperties" />
3842
<Class name="com.azure.storage.blob.models.BlobItem" />
3943
<Class name="com.azure.storage.blob.models.BlobSeekableByteChannelReadResult" />
44+
<Class name="com.azure.storage.blob.models.BlobServiceProperties" />
45+
<Class name="com.azure.storage.blob.models.BlockList" />
4046
<Class name="com.azure.storage.blob.models.BlockLookupList" />
4147
<Class name="com.azure.storage.blob.models.PageList" />
4248
<Class name="com.azure.storage.blob.models.TaggedBlobItem" />
@@ -81,22 +87,29 @@
8187
<Class name="com.azure.storage.blob.BlobServiceClientBuilder" />
8288
<Class name="com.azure.storage.blob.BlobUrlParts" />
8389
<Class name="com.azure.storage.blob.implementation.AzureBlobStorageImplBuilder" />
84-
<Class name="com.azure.storage.blob.implementation.SignedIdentifiersWrapper" />
90+
<Class name="com.azure.storage.blob.implementation.models.ArrowConfiguration" />
91+
<Class name="com.azure.storage.blob.implementation.models.BlobContainersSegment" />
8592
<Class name="com.azure.storage.blob.implementation.models.BlobFlatListSegment" />
8693
<Class name="com.azure.storage.blob.implementation.models.BlobHierarchyListSegment" />
8794
<Class name="com.azure.storage.blob.implementation.models.BlobItemInternal" />
8895
<Class name="com.azure.storage.blob.implementation.models.BlobPropertiesInternalConstructorProperties" />
96+
<Class name="com.azure.storage.blob.implementation.models.BlobSignedIdentifierWrapper" />
97+
<Class name="com.azure.storage.blob.implementation.models.BlobTags" />
8998
<Class name="com.azure.storage.blob.implementation.models.BlobsDownloadHeaders" />
9099
<Class name="com.azure.storage.blob.implementation.models.BlobsGetPropertiesHeaders" />
91100
<Class name="com.azure.storage.blob.implementation.models.BlobsQueryHeaders" />
92101
<Class name="com.azure.storage.blob.implementation.models.ContainersGetPropertiesHeaders" />
102+
<Class name="com.azure.storage.blob.implementation.models.FilterBlobSegment" />
93103
<Class name="com.azure.storage.blob.implementation.models.PageListCollection" />
94104
<Class name="com.azure.storage.blob.implementation.models.PageListSegment" />
105+
<Class name="com.azure.storage.blob.implementation.util.ByteBufferBackedOutputStreamUtil" />
95106
<Class name="com.azure.storage.blob.models.BlobContainerAccessPolicies" />
96107
<Class name="com.azure.storage.blob.models.BlobContainerItem" />
97108
<Class name="com.azure.storage.blob.models.BlobContainerProperties" />
98109
<Class name="com.azure.storage.blob.models.BlobItem" />
99110
<Class name="com.azure.storage.blob.models.BlobSeekableByteChannelReadResult" />
111+
<Class name="com.azure.storage.blob.models.BlobServiceProperties" />
112+
<Class name="com.azure.storage.blob.models.BlockList" />
100113
<Class name="com.azure.storage.blob.models.BlockLookupList" />
101114
<Class name="com.azure.storage.blob.models.PageList" />
102115
<Class name="com.azure.storage.blob.models.TaggedBlobItem" />

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobContainerAsyncClient.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ Mono<Response<BlobContainerAccessPolicies>> getAccessPolicyWithResponse(String l
868868
containerName, null, leaseId, null, context)
869869
.map(response -> new SimpleResponse<>(response,
870870
new BlobContainerAccessPolicies(response.getDeserializedHeaders().getXMsBlobPublicAccess(),
871-
response.getValue())));
871+
response.getValue().items())));
872872
}
873873

874874
/**
@@ -1454,9 +1454,7 @@ private Mono<PagedResponse<TaggedBlobItem>> findBlobsByTags(
14541454
this.azureBlobStorage.getContainers().filterBlobsWithResponseAsync(containerName, null, null,
14551455
options.getQuery(), marker, options.getMaxResultsPerPage(), null, context), timeout)
14561456
.map(response -> {
1457-
List<TaggedBlobItem> value = response.getValue().getBlobs() == null
1458-
? Collections.emptyList()
1459-
: response.getValue().getBlobs().stream()
1457+
List<TaggedBlobItem> value = response.getValue().getBlobs().stream()
14601458
.map(ModelHelper::populateTaggedBlobItem)
14611459
.collect(Collectors.toList());
14621460

@@ -1520,8 +1518,7 @@ public Mono<Response<StorageAccountInfo>> getAccountInfoWithResponse() {
15201518

15211519
Mono<Response<StorageAccountInfo>> getAccountInfoWithResponse(Context context) {
15221520
context = context == null ? Context.NONE : context;
1523-
return this.azureBlobStorage.getContainers().getAccountInfoWithResponseAsync(containerName, null,
1524-
null, context)
1521+
return this.azureBlobStorage.getContainers().getAccountInfoWithResponseAsync(containerName, context)
15251522
.map(rb -> {
15261523
ContainersGetAccountInfoHeaders hd = rb.getDeserializedHeaders();
15271524
return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind()));

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
import java.time.Duration;
5555
import java.time.OffsetDateTime;
5656
import java.util.ArrayList;
57-
import java.util.Collections;
5857
import java.util.List;
5958
import java.util.Map;
6059
import java.util.function.BiFunction;
@@ -614,9 +613,7 @@ private Mono<PagedResponse<TaggedBlobItem>> findBlobsByTags(
614613
this.azureBlobStorage.getServices().filterBlobsWithResponseAsync(null, null,
615614
options.getQuery(), marker, options.getMaxResultsPerPage(), null, context), timeout)
616615
.map(response -> {
617-
List<TaggedBlobItem> value = response.getValue().getBlobs() == null
618-
? Collections.emptyList()
619-
: response.getValue().getBlobs().stream()
616+
List<TaggedBlobItem> value = response.getValue().getBlobs().stream()
620617
.map(ModelHelper::populateTaggedBlobItem)
621618
.collect(Collectors.toList());
622619

@@ -838,13 +835,11 @@ Mono<Response<Void>> setPropertiesWithResponse(BlobServiceProperties properties,
838835
}
839836

840837
// CORS
841-
if (properties.getCors() != null) {
842-
List<BlobCorsRule> corsRules = new ArrayList<>();
843-
for (BlobCorsRule rule : properties.getCors()) {
844-
corsRules.add(validatedCorsRule(rule));
845-
}
846-
finalProperties.setCors(corsRules);
838+
List<BlobCorsRule> corsRules = new ArrayList<>();
839+
for (BlobCorsRule rule : properties.getCors()) {
840+
corsRules.add(validatedCorsRule(rule));
847841
}
842+
finalProperties.setCors(corsRules);
848843

849844
// Default Service Version
850845
finalProperties.setDefaultServiceVersion(properties.getDefaultServiceVersion());
@@ -1071,7 +1066,7 @@ public Mono<Response<StorageAccountInfo>> getAccountInfoWithResponse() {
10711066

10721067
Mono<Response<StorageAccountInfo>> getAccountInfoWithResponse(Context context) {
10731068
throwOnAnonymousAccess();
1074-
return this.azureBlobStorage.getServices().getAccountInfoWithResponseAsync(null, null, context)
1069+
return this.azureBlobStorage.getServices().getAccountInfoWithResponseAsync(context)
10751070
.map(rb -> {
10761071
ServicesGetAccountInfoHeaders hd = rb.getDeserializedHeaders();
10771072
return new SimpleResponse<>(rb, new StorageAccountInfo(hd.getXMsSkuName(), hd.getXMsAccountKind(),

0 commit comments

Comments
 (0)