Skip to content

Commit

Permalink
Removes extra slashes in log file path
Browse files Browse the repository at this point in the history
Solves bug 3479
  • Loading branch information
goglepox committed Mar 8, 2013
1 parent b6e9d9c commit 9ec657f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
@@ -0,0 +1,18 @@
package net.bioclipse.business;

import static org.junit.Assert.*;

import net.bioclipse.business.BioclipsePlatformManager;

import org.junit.Test;


public class LogfilelocationTest {

@Test
public void test() {
String input = "/Users/xxx/Library/Logs/Bioclipse//bioclipse.log";
assertEquals( "/Users/xxx/Library/Logs/Bioclipse/bioclipse.log", BioclipsePlatformManager.stripExtraSlashes( input ));
}

}
Expand Up @@ -10,14 +10,17 @@
******************************************************************************/
package net.bioclipse.business.test;

import net.bioclipse.business.LogfilelocationTest;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({
APITest.class,
CoverageTest.class
CoverageTest.class,
LogfilelocationTest.class
})
public class AllBioclipsePlatformManagerTests {

Expand Down
Expand Up @@ -73,13 +73,21 @@ public String logfileLocation() {
for (Iterator<Appender<ILoggingEvent>> index = logger.iteratorForAppenders(); index.hasNext();) {
Appender<ILoggingEvent> appender = index.next();
if(appender instanceof FileAppender) {
return ((FileAppender)appender).getFile();
return stripExtraSlashes( ((FileAppender<?>)appender).getFile());
}
}
}
return "";
}

/* Due to the way the logfile location is assembled an extra slash may is
* should not have any effect on the code. This method strips the extra slashes
* for a better visual presentation see bug 3479.
*/
static String stripExtraSlashes(String input) {
return input.replaceAll( "/(/)+", "/" );
}

public void bugTracker() throws BioclipseException {
try {
openURL(new URL("http://bugs.bioclipse.net"));
Expand Down

0 comments on commit 9ec657f

Please sign in to comment.