Replaces with more efficient way of file retrieval.

This commit is contained in:
JSQui 2022-10-06 14:45:34 -07:00
parent be812630ea
commit 7d62ce06df
2 changed files with 12 additions and 20 deletions

10
pom.xml
View File

@ -157,5 +157,15 @@
</plugin> </plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -1414,16 +1414,7 @@ public class delegationServices {
try try
{ {
File homedir = new File(System.getProperty("user.home")); File homedir = new File(System.getProperty("user.home"));
String fileName = homedir + "/ocs/policy/launcher/legal/eula.txt"; policyDocument = Files.readString(Path.of(homedir + "/ocs/policy/launcher/legal/eula.txt"));
Path path = Paths.get(fileName);
byte[] bytes = Files.readAllBytes(path);
List<String> allLines = Files.readAllLines(path, StandardCharsets.UTF_8);
String formattedString = allLines.toString()
.replace("[", "") //remove the right bracket
.replace("]", "") //remove the left bracket
.replace(",", "")
.trim(); //remove trailing spaces from partially initialized arrays
policyDocument = formattedString;
} }
catch (Exception EXR) catch (Exception EXR)
{ {
@ -1454,16 +1445,7 @@ public class delegationServices {
try try
{ {
File homedir = new File(System.getProperty("user.home")); File homedir = new File(System.getProperty("user.home"));
String fileName = homedir + "/ocs/policy/launcher/legal/accountagreement.txt"; policyDocument = Files.readString(Path.of(homedir + "/ocs/policy/launcher/legal/eula.txt"));
Path path = Paths.get(fileName);
byte[] bytes = Files.readAllBytes(path);
List<String> allLines = Files.readAllLines(path, StandardCharsets.UTF_8);
String formattedString = allLines.toString()
.replace("[", "") //remove the right bracket
.replace("]", "") //remove the left bracket
.replace(",", "")
.trim(); //remove trailing spaces from partially initialized arrays
policyDocument = formattedString;
} }
catch (Exception EXR) catch (Exception EXR)
{ {