Skip to content

Commit

Permalink
fixed nullpoint exception with R_HOME
Browse files Browse the repository at this point in the history
  • Loading branch information
cande committed May 20, 2011
1 parent d9ada9f commit c4f7394
Showing 1 changed file with 18 additions and 5 deletions.
Expand Up @@ -14,14 +14,14 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
import java.net.MalformedURLException;
import java.net.URL;
//import java.net.MalformedURLException;
//import java.net.URL;
import java.util.NoSuchElementException;
import javax.security.auth.login.LoginException;
import javax.swing.filechooser.FileFilter;
//import javax.swing.filechooser.FileFilter;

import net.bioclipse.business.BioclipsePlatformManager;
import net.bioclipse.core.business.BioclipseException;
//import net.bioclipse.business.BioclipsePlatformManager;
//import net.bioclipse.core.business.BioclipseException;
import net.bioclipse.managers.business.IBioclipseManager;
import org.apache.log4j.Logger;

Expand Down Expand Up @@ -55,11 +55,18 @@ public RBusinessManager() throws LoginException, NoSuchElementException {
logger.debug("Bioclipse workingdirectory: " + workspacePath.toString());

R_HOME = System.getenv("R_HOME");

logger.debug("R_HOME=" + R_HOME);
try {
// TODO integrate checkR_HOME() and checkRPath in one go! or?
checkR_HOME();
R_HOME = rsmanager.checkRPath(R_HOME);
rsmanager.setEmbedded(R_HOME);
}
catch (NullPointerException e) {
working = false;
status = e.getMessage();
}
catch (FileNotFoundException e) {
working = false;
status = e.getMessage();
Expand Down Expand Up @@ -97,6 +104,11 @@ public Boolean isWorking() {
return working;
}

private void checkR_HOME() throws NullPointerException {
if (R_HOME == null)
throw new NullPointerException("R_HOME is not set, set path in your system.");
}

private void initSession() {
File file = new File(workspacePath.toString()+"/r");
if (!file.exists())
Expand Down Expand Up @@ -148,6 +160,7 @@ private String help(String command) {
eval("help("+ command +", help_type=\"html\")");
return "";

// TODO remove this if not used.
// BioclipsePlatformManager bioclipse = new BioclipsePlatformManager();
// try {
// bioclipse.openURL(new URL(url));
Expand Down

0 comments on commit c4f7394

Please sign in to comment.