Skip to content
Snippets Groups Projects
Commit bfe08ca6 authored by Hallvard Trætteberg's avatar Hallvard Trætteberg
Browse files

checkstyle fixes

parent 70220272
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,8 @@ public class TodoList implements Iterable<TodoItem> {
@Override
public String toString() {
return String.format("[TodoList name=%s deadline=%s #item=%s]", getName(), getDeadline(), items.size());
return String.format("[TodoList name=%s deadline=%s #item=%s]",
getName(), getDeadline(), items.size());
}
public String getName() {
......
......@@ -48,7 +48,6 @@ public class TodoDocumentAppController implements DocumentListener<TodoModel, Fi
/**
* Map of config data. Current contents:
*
* fileMenu.recentFiles = [ ... ]
*/
......@@ -104,7 +103,8 @@ public class TodoDocumentAppController implements DocumentListener<TodoModel, Fi
try {
configMapper.writeValue(configPath.toFile(), config);
} catch (IOException ioe) {
System.out.println("Fikk ikke skrevet konfigurasjon til " + userAppConfigPath + " på hjemmeområdet");
System.out.println("Fikk ikke skrevet konfigurasjon til " + userAppConfigPath
+ " på hjemmeområdet");
}
}
......
......@@ -70,7 +70,8 @@ public class FileMenuController {
updateRecentMenu();
}
private Map<String, String> prefixReplacements = new HashMap<>(Map.of(System.getProperty("user.home"), "~"));
private Map<String, String> prefixReplacements =
new HashMap<>(Map.of(System.getProperty("user.home"), "~"));
public void setPrefixReplacement(String prefix, String replacement) {
prefixReplacements.put(prefix, replacement);
......
......@@ -18,6 +18,13 @@ public class TodoListResource {
private final String name;
private final TodoList todoList;
/**
* Initializes this TodoListResource with appropriate context information.
*
* @param todoModel the TodoModel
* @param name the todo list name
* @param todoList the TodoList, or null
*/
public TodoListResource(TodoModel todoModel, String name, TodoList todoList) {
this.todoModel = todoModel;
this.name = name;
......
package todolist.restserver;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
......@@ -50,11 +51,11 @@ public class TodoConfig extends ResourceConfig {
private static TodoModel createDefaultTodoModel() {
TodoPersistence todoPersistence = new TodoPersistence();
try {
return todoPersistence
.readTodoModel(new InputStreamReader(TodoConfig.class.getResourceAsStream("default-todomodel.json"), StandardCharsets.UTF_8));
try (InputStream input = TodoConfig.class.getResourceAsStream("default-todomodel.json")) {
return todoPersistence.readTodoModel(new InputStreamReader(input, StandardCharsets.UTF_8));
} catch (IOException e) {
System.out.println("Couldn't read default-todomodel.json, so rigging TodoModel manually (" + e + ")");
System.out.println("Couldn't read default-todomodel.json, so rigging TodoModel manually ("
+ e + ")");
}
TodoModel todoModel = new TodoModel();
TodoList todoList1 = new TodoList();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment