Skip to content

Commit

Permalink
Framework: Move standard exceptions into framework
Browse files Browse the repository at this point in the history
Metafacture should provide a basic exception hierarchy for modules that
covers common errors. For a start the existing exceptions are added to
the framework. These are `MetafactureException`, `FormatException` and
`MissingIdException`.
  • Loading branch information
cboehme committed Nov 20, 2016
1 parent 5adfc8a commit 6aeeec6
Show file tree
Hide file tree
Showing 61 changed files with 72 additions and 64 deletions.
Expand Up @@ -15,6 +15,8 @@
*/
package org.culturegraph.mf.exceptions;

import org.culturegraph.mf.framework.MetafactureException;

/**
* @author Markus Michael Geipel
*
Expand Down
Expand Up @@ -15,6 +15,7 @@
*/
package org.culturegraph.mf.exceptions;

import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.morph.MorphBuilder;


Expand Down
Expand Up @@ -15,6 +15,7 @@
*/
package org.culturegraph.mf.exceptions;

import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.morph.Metamorph;


Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.formeta.parser;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.util.StringUtil;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.formeta.parser;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.StreamReceiver;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.formeta.parser;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.formeta.Formeta;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.formeta.parser;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.formeta.Formeta;

/**
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.formeta.parser;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.formeta.Formeta;

/**
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013, 2014 Deutsche Nationalbibliothek
* Copyright 2016 Christoph Böhme
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.culturegraph.mf.exceptions;
package org.culturegraph.mf.framework;

/**
* Thrown if data processing fails due to a format error in the data.
Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013, 2014 Deutsche Nationalbibliothek
* Copyright 2016 Christoph Böhme
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.culturegraph.mf.exceptions;
package org.culturegraph.mf.framework;

/**
* Base class for exceptions thrown by Metastream.
* Base class for exceptions thrown by Metafacture.
*
* @author Christoph Böhme <c.boehme@dnb.de>
* @author Christoph Böhme
*/
public class MetafactureException extends RuntimeException {

Expand Down
@@ -1,5 +1,5 @@
/*
* Copyright 2013, 2014 Deutsche Nationalbibliothek
* Copyright 2016 Christoph Böhme
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
Expand All @@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.culturegraph.mf.stream.converter.bib;

import org.culturegraph.mf.exceptions.MetafactureException;
package org.culturegraph.mf.framework;

/**
* Thrown by {@link Reader}s if a record has no ID
* Thrown if a record has no id.
*
* @author Markus Michael Geipel
*
Expand Down
Expand Up @@ -19,7 +19,7 @@
import static org.culturegraph.mf.iso2709.Iso2709Constants.MAX_PAYLOAD_LENGTH;
import static org.culturegraph.mf.iso2709.Iso2709Constants.TAG_LENGTH;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;

/**
* Builds a directory in ISO2709:2008 format. For fields whose length is greater
Expand Down
Expand Up @@ -22,7 +22,7 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;

/**
* Builds a list of fields in ISO 2709:2008 format.
Expand Down
Expand Up @@ -17,7 +17,7 @@

import java.nio.charset.Charset;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;

/**
* Provides methods for reading and writing strings and integers in a byte
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/culturegraph/mf/iso2709/Record.java
Expand Up @@ -23,7 +23,7 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.util.Require;

/**
Expand Down
Expand Up @@ -25,7 +25,7 @@
import java.util.Arrays;
import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.util.Require;

/**
Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.util.HashMap;
import java.util.Map;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.util.StringUtil;

/**
Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.io.Reader;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.formeta.Formeta;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
Expand Down
Expand Up @@ -15,7 +15,7 @@
*/
package org.culturegraph.mf.stream.converter;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;

/**
* Thrown by {@link Reader}s if a record indicates unsupported encoding.
Expand Down
Expand Up @@ -19,7 +19,7 @@
import java.io.StringWriter;

import org.apache.commons.lang.StringEscapeUtils;
import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultStreamPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.StreamReceiver;
Expand Down
Expand Up @@ -19,7 +19,7 @@
import java.io.IOException;
import java.io.Reader;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -27,7 +27,7 @@
import java.util.Map;
import java.util.Map.Entry;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -16,7 +16,7 @@
import java.util.List;
import java.util.Map;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultStreamPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.StreamReceiver;
Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.io.Reader;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -17,7 +17,8 @@

import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.MissingIdException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -34,7 +34,8 @@
import static org.culturegraph.mf.stream.converter.bib.Marc21Constants.TYPE_OF_CONTROL_INDEX;
import static org.culturegraph.mf.stream.converter.bib.Marc21EventNames.TYPE_OF_CONTROL_LITERAL;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.MissingIdException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -46,7 +46,7 @@

import java.util.Arrays;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.helpers.DefaultStreamPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.StreamReceiver;
Expand Down
Expand Up @@ -23,6 +23,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.culturegraph.mf.framework.MissingIdException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -20,7 +20,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.MissingIdException;
import org.culturegraph.mf.framework.helpers.DefaultStreamPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.StreamReceiver;
Expand Down
Expand Up @@ -16,7 +16,7 @@
*/
package org.culturegraph.mf.stream.converter.xml;

import org.culturegraph.mf.exceptions.FormatException;
import org.culturegraph.mf.framework.FormatException;
import org.culturegraph.mf.framework.helpers.DefaultXmlPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.XmlReceiver;
Expand Down
Expand Up @@ -17,7 +17,7 @@

import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultXmlPipe;
import org.culturegraph.mf.framework.StreamReceiver;
import org.culturegraph.mf.framework.XmlReceiver;
Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.io.Reader;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.XmlReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -21,7 +21,7 @@
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -22,7 +22,7 @@
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.IOUtils;
import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.annotations.Description;
Expand Down
Expand Up @@ -25,7 +25,7 @@
import java.util.List;
import java.util.PriorityQueue;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.helpers.DefaultObjectPipe;
import org.culturegraph.mf.framework.ObjectReceiver;
import org.culturegraph.mf.framework.objects.Triple;
Expand Down
Expand Up @@ -22,7 +22,7 @@
import java.io.IOException;
import java.io.ObjectInputStream;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.objects.Triple;


Expand Down
Expand Up @@ -23,7 +23,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.FluxCommand;
import org.culturegraph.mf.framework.annotations.In;
import org.culturegraph.mf.util.FileCompression;
Expand Down
Expand Up @@ -18,7 +18,7 @@
import java.io.IOException;
import java.io.Writer;

import org.culturegraph.mf.exceptions.MetafactureException;
import org.culturegraph.mf.framework.MetafactureException;
import org.culturegraph.mf.framework.ObjectReceiver;

/**
Expand Down

0 comments on commit 6aeeec6

Please sign in to comment.