Fix error for downloading soft deleted artifact binary (#1102)

* download soft deleted artifact throws binary gone exception

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* add test and update documentation

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* fix javadoc

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>

* test soft deleted artifact has no download link

Signed-off-by: Stefan Klotz <stefan.klotz@bosch.io>
This commit is contained in:
Stefan Klotz
2021-03-24 15:17:34 +01:00
committed by GitHub
parent 41922b6dca
commit 78d784f3c4
7 changed files with 109 additions and 6 deletions

View File

@@ -0,0 +1,55 @@
/**
* Copyright (c) 2021 Bosch.IO GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.repository.exception;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
/**
* Exception indicating that an artifact's binary does not exist anymore. This
* might be caused due to the soft deletion of a {@link SoftwareModule}.
*
*/
public class ArtifactBinaryNoLongerExistsException extends AbstractServerRtException {
private static final SpServerError THIS_ERROR = SpServerError.SP_ARTIFACT_BINARY_DELETED;
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Creates a new ArtifactBinaryGoneException error.
*/
public ArtifactBinaryNoLongerExistsException() {
super(THIS_ERROR);
}
/**
* Creates a new ArtifactBinaryGoneException error with cause.
*
* @param cause
* for the exception
*/
public ArtifactBinaryNoLongerExistsException(final Throwable cause) {
super(THIS_ERROR, cause);
}
/**
* Creates a new ArtifactBinaryGoneException error with message.
*
* @param message
* of the error
*/
public ArtifactBinaryNoLongerExistsException(final String message) {
super(message, THIS_ERROR);
}
}