From 65b2c5428d42b0dbede7b546abc288c693070c09 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Fri, 22 Nov 2024 13:10:21 +0100 Subject: [PATCH] Corrected checkstyle --- .../main/java/org/dspace/testing/Testing.java | 17 ++++++++++++----- dspace-api/src/main/resources/python-script.py | 8 -------- .../src/main/resources/testing/python-script.py | 8 ++++++++ 3 files changed, 20 insertions(+), 13 deletions(-) delete mode 100644 dspace-api/src/main/resources/python-script.py create mode 100644 dspace-api/src/main/resources/testing/python-script.py diff --git a/dspace-api/src/main/java/org/dspace/testing/Testing.java b/dspace-api/src/main/java/org/dspace/testing/Testing.java index 4952aff04ac..125a89dc604 100644 --- a/dspace-api/src/main/java/org/dspace/testing/Testing.java +++ b/dspace-api/src/main/java/org/dspace/testing/Testing.java @@ -7,13 +7,18 @@ */ package org.dspace.testing; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + import org.apache.commons.cli.ParseException; import org.dspace.scripts.DSpaceRunnable; import org.dspace.utils.DSpace; -import java.io.*; -import java.nio.charset.StandardCharsets; - public class Testing extends DSpaceRunnable { @Override @@ -32,7 +37,8 @@ public void internalRun() throws Exception { System.out.println("Hello world from java"); try { // loading python scripts stored in resources - InputStream scriptInputStream = getClass().getClassLoader().getResourceAsStream("python-script.py"); + InputStream scriptInputStream = + getClass().getClassLoader().getResourceAsStream("testing/python-script.py"); if (scriptInputStream == null) { throw new FileNotFoundException("Python script not found in resources"); } @@ -49,7 +55,8 @@ public void internalRun() throws Exception { processBuilder.directory(tempFile.getParentFile()); Process process = processBuilder.start(); - InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8); + InputStreamReader inputStreamReader = + new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8); BufferedReader reader = new BufferedReader(inputStreamReader); // reading the scripts output and then outputs it to the console diff --git a/dspace-api/src/main/resources/python-script.py b/dspace-api/src/main/resources/python-script.py deleted file mode 100644 index df14040835c..00000000000 --- a/dspace-api/src/main/resources/python-script.py +++ /dev/null @@ -1,8 +0,0 @@ -""" -The contents of this file are subject to the license and copyright -detailed in the LICENSE and NOTICE files at the root of the source -tree and available online at - -http://www.dspace.org/license/ -""" -print("Hello world from python") diff --git a/dspace-api/src/main/resources/testing/python-script.py b/dspace-api/src/main/resources/testing/python-script.py new file mode 100644 index 00000000000..7f3d5454486 --- /dev/null +++ b/dspace-api/src/main/resources/testing/python-script.py @@ -0,0 +1,8 @@ +# +# The contents of this file are subject to the license and copyright +# detailed in the LICENSE and NOTICE files at the root of the source +# tree and available online at +# +# http://www.dspace.org/license/ +# +print("Hello world from python")