summaryrefslogtreecommitdiffstats
path: root/misc/log4j/src
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:39 -0500
committerInstrumental <jonathan.gathman@att.com>2019-08-07 13:40:42 -0500
commit3d1706fcbe7f95830ff6fd23cf679ee55c6d0595 (patch)
treeff97f10380a44d9f81d536c066782af10f728687 /misc/log4j/src
parent321dce367d74092a0ba09930c3aa526abdbd5da8 (diff)
Remove Tabs, per Jococo
Issue-ID: AAF-932 Change-Id: I3ab0ebcc082048d2d1424a58a90ea479fb005ee6 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'misc/log4j/src')
-rw-r--r--misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java30
-rw-r--r--misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java80
2 files changed, 55 insertions, 55 deletions
diff --git a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
index 85aae6f0..35d5038c 100644
--- a/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
+++ b/misc/log4j/src/main/java/org/onap/aaf/misc/env/log4j/LogFileNamer.java
@@ -56,24 +56,24 @@ public class LogFileNamer {
* @throws IOException
*/
public String setAppender(String appender) throws IOException {
- File f = new File(String.format(FIRST_FILE_FORMAT_STR, dir, root, appender));
- File lock = new File(f.getAbsoluteFile()+".lock");
- if(f.exists()) {
- if(lock.exists()) {
- int i = 0;
- while ((f = new File(String.format(FILE_FORMAT_STR, dir, root, appender, i))).exists() &&
- (lock = new File(f.getAbsoluteFile()+".lock")).exists()) {
- ++i;
- }
- }
- }
+ File f = new File(String.format(FIRST_FILE_FORMAT_STR, dir, root, appender));
+ File lock = new File(f.getAbsoluteFile()+".lock");
+ if(f.exists()) {
+ if(lock.exists()) {
+ int i = 0;
+ while ((f = new File(String.format(FILE_FORMAT_STR, dir, root, appender, i))).exists() &&
+ (lock = new File(f.getAbsoluteFile()+".lock")).exists()) {
+ ++i;
+ }
+ }
+ }
try {
- lock.createNewFile();
- lock.deleteOnExit();
- f.createNewFile();
+ lock.createNewFile();
+ lock.deleteOnExit();
+ f.createNewFile();
} catch (IOException e) {
- throw new IOException("Cannot create file '" + f.getCanonicalPath() + '\'', e);
+ throw new IOException("Cannot create file '" + f.getCanonicalPath() + '\'', e);
}
System.setProperty("LOG4J_FILENAME_" + appender, f.getCanonicalPath());
return appender;
diff --git a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
index 8657e1d6..1aaeb7fb 100644
--- a/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
+++ b/misc/log4j/src/test/java/org/onap/aaf/misc/env/log4j/JU_LogFileNamerTest.java
@@ -38,55 +38,55 @@ public class JU_LogFileNamerTest {
}
private void cleanup(String name) {
-// System.out.println("XXXX" + dir.getAbsolutePath());
- for(File f : dir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(File dir, String name) {
- return name.contains(name) && name.endsWith(".log");
- }
- })) {
-// System.out.println("Deleting " + f.getAbsolutePath());
- f.delete();
- };
+// System.out.println("XXXX" + dir.getAbsolutePath());
+ for(File f : dir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ return name.contains(name) && name.endsWith(".log");
+ }
+ })) {
+// System.out.println("Deleting " + f.getAbsolutePath());
+ f.delete();
+ };
}
@Test
public void test() throws IOException {
- String name = "Append";
- try {
- LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "log");
- assertEquals(logFileNamer, logFileNamer.noPID());
-
- logFileNamer.setAppender(name);
- assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
- dir.getCanonicalFile() + File.separator + "log-" + name + ".log");
-
- logFileNamer.setAppender(name);
- assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
- dir.getCanonicalFile() + File.separator + "log-" + name + ".0.log");
- } finally {
- cleanup("log-" + name);
- }
+ String name = "Append";
+ try {
+ LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "log");
+ assertEquals(logFileNamer, logFileNamer.noPID());
+
+ logFileNamer.setAppender(name);
+ assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
+ dir.getCanonicalFile() + File.separator + "log-" + name + ".log");
+
+ logFileNamer.setAppender(name);
+ assertEquals(System.getProperty("LOG4J_FILENAME_Append"),
+ dir.getCanonicalFile() + File.separator + "log-" + name + ".0.log");
+ } finally {
+ cleanup("log-" + name);
+ }
}
@Test
public void testBlankRoot() throws IOException {
- String name = "Different";
- try {
- LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "");
- assertEquals(logFileNamer, logFileNamer.noPID());
-
- logFileNamer.setAppender(name);
- assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
- dir.getCanonicalPath() + File.separator + name + ".log");
-
- logFileNamer.setAppender(name);
- assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
- dir.getCanonicalPath() + File.separator + name + ".0.log");
- } finally {
- cleanup(name);
- }
+ String name = "Different";
+ try {
+ LogFileNamer logFileNamer = new LogFileNamer(dir.getCanonicalPath(), "");
+ assertEquals(logFileNamer, logFileNamer.noPID());
+
+ logFileNamer.setAppender(name);
+ assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
+ dir.getCanonicalPath() + File.separator + name + ".log");
+
+ logFileNamer.setAppender(name);
+ assertEquals(System.getProperty("LOG4J_FILENAME_Different"),
+ dir.getCanonicalPath() + File.separator + name + ".0.log");
+ } finally {
+ cleanup(name);
+ }
}
}