Skip to content

Commit

Permalink
Fix path errors in spotbugs-aggregate-report and pom.client.xml (#4884)
Browse files Browse the repository at this point in the history
* Fixing documented links in spotbugs excludes.

* Removing unecessary <Or>.

* Fixing path to core source files in spotbugs-aggregate-report.

* Fix codesnippet path for azure-core.

* Updating paths for storage docs to correct ones.

* Replace usage of \n with %n.

* Adding issue link for storage spotbugs

* Removing unused private method.
  • Loading branch information
conniey authored Aug 7, 2019
1 parent 08eb258 commit f7dd9e7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,25 @@
</Match>

<!-- Public field already exists in the public API surface area even though no writes were seen to this public field.
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L50
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L57 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L50
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L57 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.BatchOptions"/>
<Field name="~(maxMessageSize|partitionKey)"/>
<Bug pattern="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"/>
</Match>

<!-- Public method already exists in the public API surface area even though it has confusing name.
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L247
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L251
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java#L146 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L247
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L251
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java#L146 -->
<Match>
<Class name="~com\.microsoft\.azure\.eventhubs\.impl\.(MessageReceiver|MessagingFactory)"/>
<Bug pattern="NM_CONFUSING"/>
</Match>

<!-- Returning a new copy of the object is not necessary
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L62 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L62 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.EventHubRuntimeInformation"/>
<Method name="~(getPartitionIds|onConnectionInit)"/>
Expand All @@ -143,57 +143,57 @@

<!-- EventHubRuntimeInformation is populated by the service. There is no user input. Copying partitionId contents is
not necessary.
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L27 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L27 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.EventHubRuntimeInformation"/>
<Field name="partitionIds"/>
<Bug pattern="EI_EXPOSE_REP2"/>
</Match>

<!-- Public field already exists in the public API surface area even though it should be final.
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L41 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L41 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.impl.EventHubClientImpl"/>
<Field name="USER_AGENT"/>
<Bug pattern="MS_SHOULD_BE_FINAL,UWF_NULL_FIELD"/>
</Match>

<!-- Values are initialized at runtime
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L47 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L47 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.impl.EventHubClientImpl"/>
<Field name="~(sender|timer|underlyingFactory)"/>
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>

<!-- Returning a new copy of the object is not necessary
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ReplayableWorkItem.java#L35 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ReplayableWorkItem.java#L35 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.impl.ReplayableWorkItem"/>
<Field name="amqpMessage"/>
<Bug pattern="EI_EXPOSE_REP"/>
</Match>

<!-- Return value is fine to not check, if add, it will be a redundant step
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L80
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L123 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L80
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L123 -->
<Match>
<Class name="~com\.microsoft\.azure\.eventhubs\.impl\.FaultTolerantObject(\$(1|2))?"/>
<Method name="~(onEvent|runOnOpenedObject|close)"/>
<Bug pattern="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE"/>
</Match>

<!-- Bytes array are designed to return null if it is null
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventDataImpl.java#L150
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/PartitionReceiverImpl.java#L278 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventDataImpl.java#L150
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/PartitionReceiverImpl.java#L278 -->
<Match>
<Class name="~com\.microsoft\.azure\.eventhubs\.impl\.(EventDataImpl|PartitionReceiverImpl)"/>
<Method name="~(getBytes|getDesiredCapabilities)"/>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>

<!-- EventHubClientImpl.USER_AGENT is public and can be set by consumers of the SDK to not be null.
https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java#L88 -->
https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java#L88 -->
<Match>
<Class name="com.microsoft.azure.eventhubs.impl.ConnectionHandler"/>
<Method name="onConnectionInit"/>
Expand Down Expand Up @@ -511,9 +511,7 @@

<!-- It is fine to have un-used variables, unread fields, anonymous static inner classes in javadoc code samples. -->
<Match>
<Or>
<Class name="~.*JavaDoc(CodeSnippets|CodeSamples)"/>
</Or>
<Class name="~.*JavaDoc(CodeSnippets|CodeSamples)"/>
<Bug pattern="DLS_DEAD_LOCAL_STORE,URF_UNREAD_FIELD,SIC_INNER_SHOULD_BE_STATIC_ANON"/>
</Match>

Expand Down
15 changes: 8 additions & 7 deletions eng/spotbugs-aggregate-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
<sources>
<source>..\..\sdk\appconfiguration\azure-data-appconfiguration\src\main\java</source>
<source>..\..\sdk\appconfiguration\azure-data-appconfiguration\src\samples\java</source>
<source>..\..\core\azure-core\src\main\java</source>
<source>..\..\core\azure-core\src\samples\java</source>
<source>..\..\core\azure-core-amqp\src\main\java</source>
<source>..\..\core\azure-core-management\src\main\java</source>
<source>..\..\core\azure-core-test\src\main\java</source>
<source>..\..\sdk\core\azure-core\src\main\java</source>
<source>..\..\sdk\core\azure-core\src\samples\java</source>
<source>..\..\sdk\core\azure-core-amqp\src\main\java</source>
<source>..\..\sdk\core\azure-core-management\src\main\java</source>
<source>..\..\sdk\core\azure-core-test\src\main\java</source>
<source>..\..\sdk\eventhubs\azure-messaging-eventhubs\src\main\java</source>
<source>..\..\sdk\eventhubs\azure-messaging-eventhubs\src\samples\java</source>
<source>..\..\sdk\identity\azure-identity\src\main\java</source>
Expand Down Expand Up @@ -99,8 +99,9 @@
<source>..\..\sdk\eventhubs\microsoft-azure-eventhubs-eph\src\main\java</source>
<source>..\..\sdk\eventhubs\microsoft-azure-eventhubs-extensions\src\main\java</source>
<!-- Storage is excluded from Spotbugs report as it collides with the storage library
dependency in eventhubs code. This issue is under investigation. -->
<!--source>..\..\storage\data-plane\src\main\java</source-->
dependency in eventhubs code. This issue is under investigation.
Issue Link: https://github.com/Azure/azure-sdk-for-java/issues/3096 -->
<!-- <source>..\..\storage\data-plane\src\main\java</source> -->
<source>..\..\sdk\keyvault\microsoft-azure-keyvault\src\main\java</source>
<source>..\..\sdk\keyvault\microsoft-azure-keyvault-cryptography\src\main\java</source>
<source>..\..\sdk\keyvault\microsoft-azure-keyvault-core\src\main\java</source>
Expand Down
8 changes: 4 additions & 4 deletions pom.client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -541,13 +541,13 @@
So, path for aggregate reports have to be defined relative to parent pom -->
<additionalOptions>-maxLineLength 120
-snippetpath ${project.basedir}/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java
-snippetpath ${project.basedir}/core/azure-core/src/samples/java
-snippetpath ${project.basedir}/sdk/core/azure-core/src/samples/java
-snippetpath ${project.basedir}/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java
-snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-keys/src/samples/java
-snippetpath ${project.basedir}/sdk/keyvault/azure-keyvault-secrets/src/samples/java
-snippetpath ${project.basedir}/storage/client/blob/src/samples/java
-snippetpath ${project.basedir}/storage/client/file/src/samples/java
-snippetpath ${project.basedir}/storage/client/queue/src/samples/java
-snippetpath ${project.basedir}/sdk/storage/azure-storage-blob/src/samples/java
-snippetpath ${project.basedir}/sdk/storage/azure-storage-file/src/samples/java
-snippetpath ${project.basedir}/sdk/storage/azure-storage-queue/src/samples/java
</additionalOptions>
</configuration>
</reportSet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public void streamSnippet() throws MalformedURLException {
// process the stream
myIterableResponse.stream().forEach(resp -> {
if (resp.statusCode() == HttpURLConnection.HTTP_OK) {
System.out.printf("Response headers are %s. Url %s \n", resp.deserializedHeaders(), resp.request().url());
System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url());
resp.items().forEach(value -> {
System.out.printf("Response value is %d \n", value);
System.out.printf("Response value is %d%n", value);
});
}
});
Expand All @@ -69,9 +69,9 @@ public void iteratorwhileSnippet() throws MalformedURLException {
while (ite.hasNext()) {
PagedResponseBase<String, Integer> resp = ite.next();
if (resp.statusCode() == HttpURLConnection.HTTP_OK) {
System.out.printf("Response headers are %s. Url %s \n", resp.deserializedHeaders(), resp.request().url());
System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url());
resp.items().forEach(value -> {
System.out.printf("Response value is %d \n", value);
System.out.printf("Response value is %d%n", value);
});
}
}
Expand All @@ -97,9 +97,9 @@ public void iteratorStreamFilterSnippet() throws MalformedURLException {
myIterableResponse.stream().filter(resp -> resp.statusCode() == HttpURLConnection.HTTP_OK)
.limit(10)
.forEach(resp -> {
System.out.printf("Response headers are %s. Url %s \n", resp.deserializedHeaders(), resp.request().url());
System.out.printf("Response headers are %s. Url %s%n", resp.deserializedHeaders(), resp.request().url());
resp.items().forEach(value -> {
System.out.printf("Response value is %d \n", value);
System.out.printf("Response value is %d%n", value);
});
});
// END: com.azure.core.http.rest.iterableResponse.stream.filter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,34 +56,4 @@ private Flux<String> serviceCallReturnsCollection(String prefix, Context context
private Mono<String> serviceCallReturnsSingle(String prefix, Context context) {
return Mono.empty();
}

/**
* Implementation not provided
* @param value The value
* @return A {@link Mono} containing a {@link Response} containing a {@link Response#value() value}.
*/
private <T> Mono<Response<T>> getMonoRestResponse(T value) {
Response<T> response = new Response<T>() {
@Override
public int statusCode() {
return 200;
}

@Override
public HttpHeaders headers() {
return null;
}

@Override
public HttpRequest request() {
return null;
}

@Override
public T value() {
return value;
}
};
return Mono.just(response);
}
}

0 comments on commit f7dd9e7

Please sign in to comment.