Skip to content

Commit

Permalink
less messy exception handling in the oai servlet (#8372)
Browse files Browse the repository at this point in the history
  • Loading branch information
landreev committed Jul 13, 2022
1 parent e64a81d commit 088d9b8
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import io.gdcc.xoai.dataprovider.repository.ItemRepository;
import io.gdcc.xoai.dataprovider.repository.SetRepository;
import io.gdcc.xoai.model.oaipmh.DeletedRecord;
import io.gdcc.xoai.model.oaipmh.Granularity;
import io.gdcc.xoai.model.oaipmh.OAIPMH;

import io.gdcc.xoai.xml.XmlWriter;
Expand All @@ -32,6 +31,7 @@
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.MailUtil;
import edu.harvard.iq.dataverse.util.SystemConfig;
import io.gdcc.xoai.exceptions.OAIException;
import org.apache.commons.lang3.StringUtils;


Expand Down Expand Up @@ -220,7 +220,7 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}


private void processRequest(HttpServletRequest httpServletRequest, HttpServletResponse response)
throws ServletException, IOException {
Expand All @@ -242,15 +242,8 @@ private void processRequest(HttpServletRequest httpServletRequest, HttpServletRe
xmlWriter.write(handle);
}

} catch (IOException ex) {
logger.warning("IO exception in Get; "+ex.getMessage());
throw new ServletException ("IO Exception in Get", ex);
} catch (XMLStreamException xse) {
logger.warning("XML Stream exception in Get; "+xse.getMessage());
throw new ServletException ("XML Stream Exception in Get", xse);
} catch (Exception e) {
logger.warning("Unknown exception in Get; "+e.getMessage());
throw new ServletException ("Unknown servlet exception in Get.", e);
} catch (XMLStreamException | OAIException e) {
throw new ServletException (e);
}

}
Expand Down

0 comments on commit 088d9b8

Please sign in to comment.