Merge branch 'workerErrorHandling' into develop

This commit is contained in:
Robin Eklund 2011-08-08 16:17:39 +02:00
commit 14fc1c6d30
4 changed files with 8 additions and 8 deletions

@ -1,8 +1,10 @@
package se.su.dsv.scipro.json;
import java.io.IOException;
/**
* Interface for delegated callback handling of response-strings.
*/
public interface IResponseHandler {
public void handleResponse(final String response,final RemoteLookupOptions options);
public void handleResponse(final String response,final RemoteLookupOptions options) throws IOException;
}

@ -17,7 +17,6 @@ import se.su.dsv.scipro.ApplicationSettings;
*
* @author Dan Kjellman <dan-kjel@dsv.su.se>
*/
//TODO Make sure this worker successfully fails when it should
@Component
public class ImportWorkerLookup {
public static final String USERS = "users";

@ -1,5 +1,6 @@
package se.su.dsv.scipro.json;
import java.io.IOException;
import java.lang.reflect.Type;
import org.apache.log4j.Level;
@ -34,7 +35,7 @@ public class ImportWorkerResponseHandler extends JsonResponseHandler {
*
* @param response the json string
*/
public void handleResponse(final String response, final RemoteLookupOptions options) {
public void handleResponse(final String response, final RemoteLookupOptions options) throws IOException {
JsonCompleteGetContainer completeContainer = null;
try{
Gson gson = new Gson();
@ -43,7 +44,7 @@ public class ImportWorkerResponseHandler extends JsonResponseHandler {
} catch (Exception e) {
logger.log(Level.FATAL, "Gson error when creating objects from json \n" + e.getMessage());
return;
throw new IOException(e);
}
int createdUsers = 0;
int changedUsers = 0;

@ -1,16 +1,14 @@
package se.su.dsv.scipro.json;
import java.io.IOException;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.transaction.annotation.Transactional;
import se.su.dsv.scipro.ApplicationSettings;
import se.su.dsv.scipro.data.dao.interfaces.ProjectClassDao;
@ -465,7 +463,7 @@ abstract class JsonResponseHandler implements IResponseHandler {
/*
* Force subclasses to handle the response
*/
public abstract void handleResponse(final String response, final RemoteLookupOptions options);
public abstract void handleResponse(final String response, final RemoteLookupOptions options) throws IOException;
/*
* Getters for logging