apache/dolphinscheduler · error · RuntimeException
java.lang.CloneNotSupportedException
Error message
java.lang.CloneNotSupportedException
What it means
getFavTaskList clones FavTaskDto instances via e.clone(), and if the clone operation raises CloneNotSupportedException the code wraps it in a RuntimeException, surfacing as 'java.lang.CloneNotSupportedException'. This happens when FavTaskDto does not properly implement Cloneable, so Object.clone() refuses to copy it.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/FavTaskServiceImpl.java:58
@Resource
private FavTaskMapper favMapper;
@Override
public List<FavTaskDto> getFavTaskList(User loginUser) {
Set<String> userFavTaskTypes = favMapper.getUserFavTaskTypes(loginUser.getId());
List<FavTaskDto> defaultTaskTypes = taskTypeConfiguration.getDefaultTaskTypes();
List<FavTaskDto> result = new ArrayList<>();
// clone default list and modify fav task type flag
defaultTaskTypes.forEach(e -> {
try {
FavTaskDto clone = (FavTaskDto) e.clone();
if (userFavTaskTypes.contains(clone.getTaskType())) {
clone.setCollection(true);
}
result.add(clone);
} catch (CloneNotSupportedException ex) {
throw new RuntimeException(ex);
}
});
return result;
}
@Override
public boolean deleteFavTask(User loginUser, String taskType) {
return favMapper.deleteUserFavTask(loginUser.getId(), taskType);
}
@Override
public int addFavTask(User loginUser, String taskType) {
favMapper.deleteUserFavTask(loginUser.getId(), taskType);
return favMapper.insert(new FavTask(null, taskType, loginUser.getId()));
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Make FavTaskDto implement Cloneable (and keep super.clone()), or better, replace the clone() call with a copy constructor / explicit field copy.
- Fix the DTO class in the source tree; this is a code defect, not a runtime configuration issue.
- Upgrade to a version where the clone usage is removed.
Example fix
// before FavTaskDto clone = (FavTaskDto) e.clone(); // after (copy constructor) FavTaskDto clone = new FavTaskDto(e); clone.setCollection(userFavTaskTypes.contains(clone.getTaskType()));
Defensive patterns
Strategy: try-catch
Try / catch
try { return getFavTaskList(loginUser); } catch (RuntimeException e) { if (e.getCause() instanceof CloneNotSupportedException) { /* rebuild fav list without clone, or report DTO defect */ } else throw e; } Prevention
- Ensure DTOs used with clone() implement Cloneable.
- Prefer copy constructors or deep-copy helpers over Object.clone().
- Add unit tests covering getFavTaskList after DTO changes.
When it happens
Trigger: Calling getFavTaskList when FavTaskDto (or the element being cloned) fails to implement java.lang.Cloneable — Object.clone() throws and the catch block rethrows it as RuntimeException.
Common situations: Refactoring FavTaskDto (e.g. removing Cloneable or changing hierarchy) breaks clone-based copying; running a build where the DTO was modified without re-checking the clone contract.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- no master server available
- Backfill workflow failed: %s
- The workflow instance: %s status is %s, can not pause
- WorkflowInstance: %s pause failed: %s
- WorkflowInstance: %s pause failed
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/2379763c4a374a7a.
Report an issue: GitHub.