From ad3e2db5eefd3093a066e7b61df0653abc9b6f2e Mon Sep 17 00:00:00 2001
From: ulrich
Date: Fri, 07 May 2021 14:05:08 +0000
Subject: [PATCH] Nicht erforderliche globale Variablen entfernt

---
 src/de/uhilger/tango/api/ListHandler.java |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/de/uhilger/tango/api/ListHandler.java b/src/de/uhilger/tango/api/ListHandler.java
index 719f911..8154211 100644
--- a/src/de/uhilger/tango/api/ListHandler.java
+++ b/src/de/uhilger/tango/api/ListHandler.java
@@ -45,14 +45,19 @@
   private static final Logger logger = Logger.getLogger(ListHandler.class.getName());
   
   public static final String ALLE_TITEL = "alle";
-
+  
+  private String conf;
+  
+  public ListHandler(String conf) {
+    this.conf = conf;
+  }
 
   @Override
   protected String get(HttpExchange e) {
     String path = e.getRequestURI().toString();
     String[] elems = path.split(Server.SLASH);
     String plname = elems[elems.length - 1];
-    FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF)));
+    FileStorage fs = new FileStorage(conf);
     String json = fs.readJson(FileStorage.ST_ABSPIELLISTE, plname);
     return embedInCustomType(json, FileStorage.ST_ABSPIELLISTE);
   }
@@ -75,7 +80,7 @@
   }
   
   private String addTitel(HttpExchange e, String plname) throws IOException {
-    FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF)));
+    FileStorage fs = new FileStorage(conf);
     Entity entity = fs.read(FileStorage.ST_ABSPIELLISTE, plname);
     String response = "Titel konnte nicht hinzugefuegt werden.";
     if(entity instanceof Abspielliste) {
@@ -104,7 +109,7 @@
     String path = e.getRequestURI().toString();
     String[] elems = path.split(Server.SLASH);
     String listName = elems[elems.length - 2];
-    FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF)));
+    FileStorage fs = new FileStorage(conf);
     Entity entity = fs.read(Abspielliste.class.getSimpleName(), listName);
     if(entity instanceof Abspielliste) {
       Abspielliste liste = (Abspielliste) entity;

--
Gitblit v1.9.3