package com.example.bot.spring;

import java.util.Arrays;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DatabaseEngine {
	String search(String text) throws Exception {
		String result = null;
		BufferedReader br = null;
		FileReader fr = null;
		try {
			fr = new FileReader(KitchenSinkController.createUri(FILENAME));
   		    br = new BufferedReader(fr);
			String sCurrentLine;
			while (result != null && (sCurrentLine = br.readLine()) != null) {
				String[] parts = sCurrentLine.split(":");
				if (text.toLowerCase().equals(parts[0].toLowerCase())) {
					result = parts[1];
				}
			}
		} catch (IOException e) {
			log.info("IOException while reading file: {}", e.toString());
		} finally {
			try {
				if (br != null)
					br.close();
				if (fr != null)
					fr.close();
			} catch (IOException ex) {
				log.info("IOException while closing file: {}", ex.toString());
			}
		}
		if (result != null)
			return result;
		throw new Exception("NOT FOUND");
    }
	private final String FILENAME = "/static/database.txt";
}
@@ -106,32 +106,67 @@
 io.FileReader;%0D%0A
+import java.io.InputStreamReader;%0D%0A
 import java.io.I
@@ -381,16 +381,49 @@
  null;%0D%0A
+%09%09InputStreamReader isr = null;%0D%0A
 %09%09try %7B%0D
@@ -426,16 +426,18 @@
 y %7B%0D%0A%09%09%09
+//
 fr = new
@@ -480,16 +480,52 @@
 eateUri(
+dbFile));%0D%0A//%09%09%09fr = new FileReader(
 FILENAME
@@ -525,20 +525,21 @@
 ILENAME)
-)
 ;%0D%0A
+//
    %09%09   
@@ -569,16 +569,152 @@
 r(fr);%0D%0A
+%09%09%09isr = new InputStreamReader(%0D%0A                    this.getClass().getResourceAsStream(FILENAME));%0D%0A%09%09%09br = new BufferedReader(isr);%0D%0A
 %09%09%09Strin
@@ -730,16 +730,21 @@
 tLine;%0D%0A
+%09%09%09%0D%0A
 %09%09%09while
@@ -1120,17 +1120,18 @@
 %09%09%09%09if (
-f
+is
 r != nul
@@ -1139,17 +1139,18 @@
 )%0D%0A%09%09%09%09%09
-f
+is
 r.close(
@@ -1349,16 +1349,130 @@
 %0A    %7D%0D%0A
+%09%0D%0A%09DatabaseEngine() %7B%0D%0A%09%09 //Resource resource = resourceLoader.getResource(%22classpath:%22 + FILENAME);%0D%0A%09%09 %0D%0A%09%7D%0D%0A%0D%0A
 %09private
@@ -1521,9 +1521,11 @@
 .txt%22;%0D%0A
+%0D%0A
 %7D

test again