Skip to content

Exception when deleting project #169

@Death111

Description

@Death111

Following exception happened when deleting an project:

java.lang.IllegalArgumentException: Illegal Capacity: -1
	at java.base/java.util.ArrayList.<init>(ArrayList.java:158)
	at de.doubleslash.keeptime.controller.Controller.adaptProjectIndexesAfterRemoving(Controller.java:304)
	at de.doubleslash.keeptime.controller.Controller.deleteProject(Controller.java:194)
	at de.doubleslash.keeptime.REST_API.controller.ProjectController.deleteProject(ProjectController.java:111)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)

image

final List<Project> changedProjects = new ArrayList<>(size - removedIndex);

Logic seems wrong: List is initialized with a capacity based on the sorting Index - which does not make sense?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions