Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cds-feature-attachments/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.10.1</version>
<version>4.10.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.34</version>
<version>1.5.37</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.feature.attachments.handler.applicationservice.helper.ExtendedErrorStatuses;
import com.sap.cds.feature.attachments.handler.applicationservice.helper.ModifyApplicationHandlerHelper;
Expand Down Expand Up @@ -51,10 +49,10 @@ public CreateAttachmentsHandler(
ThreadDataStorageReader storageReader,
String defaultMaxSize,
CdsRuntime cdsRuntime) {
this.eventFactory = requireNonNull(eventFactory, "eventFactory must not be null");
this.storageReader = requireNonNull(storageReader, "storageReader must not be null");
this.defaultMaxSize = requireNonNull(defaultMaxSize, "defaultMaxSize must not be null");
this.cdsRuntime = requireNonNull(cdsRuntime, "cdsRuntime must not be null");
this.eventFactory = eventFactory;
this.storageReader = storageReader;
this.defaultMaxSize = defaultMaxSize;
this.cdsRuntime = cdsRuntime;
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsDataProcessor;
import com.sap.cds.CdsDataProcessor.Converter;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
Expand Down Expand Up @@ -36,9 +34,8 @@ public class DeleteAttachmentsHandler implements EventHandler {

public DeleteAttachmentsHandler(
AttachmentsReader attachmentsReader, MarkAsDeletedAttachmentEvent deleteEvent) {
this.attachmentsReader =
requireNonNull(attachmentsReader, "attachmentsReader must not be null");
this.deleteEvent = requireNonNull(deleteEvent, "deleteEvent must not be null");
this.attachmentsReader = attachmentsReader;
this.deleteEvent = deleteEvent;
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.sap.cds.feature.attachments.handler.applicationservice;

import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.CdsDataProcessor;
Expand Down Expand Up @@ -82,13 +81,11 @@ public ReadAttachmentsHandler(
PersistenceService persistenceService,
AssociationCascader cascader,
boolean scannerAvailable) {
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.statusValidator = requireNonNull(statusValidator, "statusValidator must not be null");
this.scanExecutor = requireNonNull(scanExecutor, "scanExecutor must not be null");
this.persistenceService =
requireNonNull(persistenceService, "persistenceService must not be null");
this.cascader = requireNonNull(cascader, "cascader must not be null");
this.attachmentService = attachmentService;
this.statusValidator = statusValidator;
this.scanExecutor = scanExecutor;
this.persistenceService = persistenceService;
this.cascader = cascader;
this.scannerAvailable = scannerAvailable;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.feature.attachments.handler.applicationservice.helper.ModifyApplicationHandlerHelper;
Expand Down Expand Up @@ -53,13 +51,11 @@ public UpdateAttachmentsHandler(
AttachmentService attachmentService,
ThreadDataStorageReader storageReader,
String defaultMaxSize) {
this.eventFactory = requireNonNull(eventFactory, "eventFactory must not be null");
this.attachmentsReader =
requireNonNull(attachmentsReader, "attachmentsReader must not be null");
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.storageReader = requireNonNull(storageReader, "storageReader must not be null");
this.defaultMaxSize = requireNonNull(defaultMaxSize, "defaultMaxSize must not be null");
this.eventFactory = eventFactory;
this.attachmentsReader = attachmentsReader;
this.attachmentService = attachmentService;
this.storageReader = storageReader;
this.defaultMaxSize = defaultMaxSize;
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.sap.cds.feature.attachments.handler.applicationservice.modifyevents;

import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull;

import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.MediaData;
Expand Down Expand Up @@ -44,9 +43,8 @@ public class CreateAttachmentEvent implements ModifyAttachmentEvent {

public CreateAttachmentEvent(
AttachmentService attachmentService, ListenerProvider listenerProvider) {
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.listenerProvider = requireNonNull(listenerProvider, "listenerProvider must not be null");
this.attachmentService = attachmentService;
this.listenerProvider = listenerProvider;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package com.sap.cds.feature.attachments.handler.applicationservice.modifyevents;

import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull;

import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.feature.attachments.service.AttachmentService;
Expand All @@ -27,8 +26,7 @@ public class MarkAsDeletedAttachmentEvent implements ModifyAttachmentEvent {
private final AttachmentService attachmentService;

public MarkAsDeletedAttachmentEvent(AttachmentService attachmentService) {
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.attachmentService = attachmentService;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice.modifyevents;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.feature.attachments.service.AttachmentService;
Expand Down Expand Up @@ -37,10 +35,10 @@ public ModifyAttachmentEventFactory(
UpdateAttachmentEvent updateEvent,
MarkAsDeletedAttachmentEvent deleteEvent,
DoNothingAttachmentEvent doNothingEvent) {
this.createEvent = requireNonNull(createEvent, "createEvent must not be null");
this.updateEvent = requireNonNull(updateEvent, "updateEvent must not be null");
this.deleteEvent = requireNonNull(deleteEvent, "deleteEvent must not be null");
this.doNothingEvent = requireNonNull(doNothingEvent, "doNothingEvent must not be null");
this.createEvent = createEvent;
this.updateEvent = updateEvent;
this.deleteEvent = deleteEvent;
this.doNothingEvent = doNothingEvent;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice.modifyevents;

import static java.util.Objects.requireNonNull;

import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.feature.attachments.service.AttachmentService;
import com.sap.cds.ql.cqn.Path;
Expand All @@ -28,8 +26,8 @@ public class UpdateAttachmentEvent implements ModifyAttachmentEvent {

public UpdateAttachmentEvent(
CreateAttachmentEvent createEvent, MarkAsDeletedAttachmentEvent deleteEvent) {
this.createEvent = requireNonNull(createEvent, "createEvent must not be null");
this.deleteEvent = requireNonNull(deleteEvent, "deleteEvent must not be null");
this.createEvent = createEvent;
this.deleteEvent = deleteEvent;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.applicationservice.transaction;

import static java.util.Objects.requireNonNull;

import com.sap.cds.feature.attachments.service.AttachmentService;
import com.sap.cds.feature.attachments.service.model.service.MarkAsDeletedInput;
import com.sap.cds.services.changeset.ChangeSetContext;
Expand Down Expand Up @@ -33,10 +31,9 @@ public class CreationChangeSetListener implements ChangeSetListener {
*/
public CreationChangeSetListener(
String contentId, CdsRuntime cdsRuntime, AttachmentService attachmentService) {
this.contentId = requireNonNull(contentId, "contentId must not be null");
this.cdsRuntime = requireNonNull(cdsRuntime, "cdsRuntime must not be null");
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.contentId = contentId;
this.cdsRuntime = cdsRuntime;
this.attachmentService = attachmentService;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.common;

import static java.util.Objects.requireNonNull;

import com.sap.cds.Result;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
import com.sap.cds.ql.CQL;
Expand Down Expand Up @@ -35,8 +33,8 @@ public class AttachmentsReader {
private final PersistenceService persistence;

public AttachmentsReader(AssociationCascader cascader, PersistenceService persistence) {
this.cascader = requireNonNull(cascader, "cascader must not be null");
this.persistence = requireNonNull(persistence, "persistence must not be null");
this.cascader = cascader;
this.persistence = persistence;
}

public List<Attachments> readAttachments(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.draftservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.feature.attachments.handler.applicationservice.helper.ThreadDataStorageSetter;
import com.sap.cds.services.draft.DraftSaveEventContext;
import com.sap.cds.services.draft.DraftService;
Expand All @@ -18,8 +16,7 @@ public class DraftActiveAttachmentsHandler implements EventHandler {
private final ThreadDataStorageSetter threadLocalSetter;

public DraftActiveAttachmentsHandler(ThreadDataStorageSetter threadLocalSetter) {
this.threadLocalSetter =
requireNonNull(threadLocalSetter, "threadLocalSetter must not be null");
this.threadLocalSetter = threadLocalSetter;
}

@On
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.draftservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.CdsDataProcessor;
import com.sap.cds.CdsDataProcessor.Filter;
Expand Down Expand Up @@ -50,9 +48,8 @@ public class DraftCancelAttachmentsHandler implements EventHandler {

public DraftCancelAttachmentsHandler(
AttachmentsReader attachmentsReader, MarkAsDeletedAttachmentEvent deleteEvent) {
this.attachmentsReader =
requireNonNull(attachmentsReader, "attachmentsReader must not be null");
this.deleteEvent = requireNonNull(deleteEvent, "deleteEvent must not be null");
this.attachmentsReader = attachmentsReader;
this.deleteEvent = deleteEvent;
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.handler.draftservice;

import static java.util.Objects.requireNonNull;

import com.sap.cds.CdsData;
import com.sap.cds.CdsDataProcessor;
import com.sap.cds.CdsDataProcessor.Converter;
Expand Down Expand Up @@ -46,9 +44,9 @@ public DraftPatchAttachmentsHandler(
PersistenceService persistence,
ModifyAttachmentEventFactory eventFactory,
String defaultMaxSize) {
this.persistence = requireNonNull(persistence, "persistence must not be null");
this.eventFactory = requireNonNull(eventFactory, "eventFactory must not be null");
this.defaultMaxSize = requireNonNull(defaultMaxSize, "defaultMaxSize must not be null");
this.persistence = persistence;
this.eventFactory = eventFactory;
this.defaultMaxSize = defaultMaxSize;
}

@Before
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.sap.cds.services.handler.annotations.HandlerOrder;
import com.sap.cds.services.handler.annotations.On;
import com.sap.cds.services.handler.annotations.ServiceName;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -41,8 +40,7 @@ public class DefaultAttachmentsServiceHandler implements EventHandler {
private final EndTransactionMalwareScanProvider malwareScanProvider;

public DefaultAttachmentsServiceHandler(EndTransactionMalwareScanProvider malwareScanProvider) {
this.malwareScanProvider =
Objects.requireNonNull(malwareScanProvider, "malwareScanProvider must not be null");
this.malwareScanProvider = malwareScanProvider;
}

@On
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.service.malware;

import static java.util.Objects.requireNonNull;

import com.google.common.annotations.VisibleForTesting;
import com.sap.cds.Result;
import com.sap.cds.feature.attachments.generated.cds4j.sap.attachments.Attachments;
Expand Down Expand Up @@ -59,10 +57,8 @@ public DefaultAttachmentMalwareScanner(
PersistenceService persistenceService,
AttachmentService attachmentService,
MalwareScanClient malwareScanClient) {
this.persistenceService =
requireNonNull(persistenceService, "persistenceService must not be null");
this.attachmentService =
requireNonNull(attachmentService, "attachmentService must not be null");
this.persistenceService = persistenceService;
this.attachmentService = attachmentService;
this.malwareScanClient = malwareScanClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
*/
package com.sap.cds.feature.attachments.service.malware.client;

import static java.util.Objects.requireNonNull;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.sap.cds.services.ServiceException;
Expand Down Expand Up @@ -43,7 +41,7 @@ public class DefaultMalwareScanClient implements MalwareScanClient {
* @throws NullPointerException if the {@code clientProviderFactory} is {@code null}.
*/
public DefaultMalwareScanClient(HttpClientProvider clientProvider) {
this.clientProvider = requireNonNull(clientProvider, "clientProvider must not be null");
this.clientProvider = clientProvider;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ void serviceExceptionDueToLimitExceeded() {
if (wrappedContent != null) {
// Read all bytes - this will trigger CountingInputStream to throw
byte[] buffer = new byte[1024];
while (wrappedContent.read(buffer) != -1) {
// Keep reading until exception or EOF
int bytesRead;
while ((bytesRead = wrappedContent.read(buffer)) != -1) {
assertThat(bytesRead).isPositive(); // use value to satisfy SpotBugs
}
}
return null;
Expand Down
Loading
Loading