Fix/exception mapper (#3083)

* Added mapping for OptimisticLockingFailureException in ExceptionMapper for proper propagation

Signed-off-by: vasilchev <vasil.ilchev@bosch.com>

* Added ExceptionMapperTest

Signed-off-by: vasilchev <vasil.ilchev@bosch.com>

---------

Signed-off-by: vasilchev <vasil.ilchev@bosch.com>
This commit is contained in:
Vasil Ilchev
2026-05-18 09:22:49 +03:00
committed by GitHub
parent 60f006cfa1
commit 2a4c12fd29
3 changed files with 119 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
/**
* Copyright (c) 2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.hawkbit.repository.exception;
import java.io.Serial;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.eclipse.hawkbit.exception.AbstractServerRtException;
import org.eclipse.hawkbit.exception.SpServerError;
/**
* Thrown when an entity cannot be stored because it was modified concurrently in another session (optimistic locking conflict).
*/
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ConcurrentModificationException extends AbstractServerRtException {
@Serial
private static final long serialVersionUID = 1L;
public ConcurrentModificationException(final Throwable cause) {
super(SpServerError.SP_REPO_CONCURRENT_MODIFICATION, cause);
}
}