Skip to content
Snippets Groups Projects
Commit debd27d0 authored by cramakri's avatar cramakri
Browse files

LMS-2389 Moved jython-specific code to the jython handler.

SVN: 22171
parent 6e6aa475
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,6 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import org.apache.log4j.Logger;
import org.python.core.PyException;
import ch.systemsx.cisd.base.exceptions.InterruptedExceptionUnchecked;
import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
......@@ -203,7 +202,7 @@ public abstract class AbstractOmniscientTopLevelDataSetRegistrator<T extends Dat
}
private final OmniscientTopLevelDataSetRegistratorState state;
private boolean stopped;
/**
......@@ -307,20 +306,19 @@ public abstract class AbstractOmniscientTopLevelDataSetRegistrator<T extends Dat
{
Throwable firstError = service.getEncounteredErrors().get(0);
throw new EnvironmentFailureException("Could not process file "
+ incomingDataSetFile.getName(), serializableException(firstError));
+ incomingDataSetFile.getName(), asSerializableException(firstError));
}
}
/**
* Not all instances of PyExceptions are serializable, because they keep references to
* non-serializable objects e.g. java.lang.reflect.Method.
* <p>
* Subclasses may need to override if they encounter other kinds of exceptions that cannot
* happen in this generic context.
*/
private Throwable serializableException(Throwable throwable)
protected Throwable asSerializableException(Throwable throwable)
{
if (throwable instanceof PyException)
{
return new RuntimeException(throwable.toString());
}
if (throwable instanceof UserFailureException)
{
return new RuntimeException(throwable.getMessage());
......
......@@ -19,6 +19,7 @@ package ch.systemsx.cisd.etlserver.registrator;
import java.io.File;
import org.python.core.Py;
import org.python.core.PyException;
import org.python.core.PyFunction;
import org.python.util.PythonInterpreter;
......@@ -332,4 +333,16 @@ public class JythonTopLevelDataSetHandler<T extends DataSetInformation> extends
PythonInterpreter interpreter = ((JythonDataSetRegistrationService<T>) service).interpreter;
return interpreter;
}
@Override
protected Throwable asSerializableException(Throwable throwable)
{
if (throwable instanceof PyException)
{
return new RuntimeException(throwable.toString());
}
return super.asSerializableException(throwable);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment