throw exception instead of logging an error
@@ -58,9 +58,7 @@ public class DocumentManager {
if (built.contains(dataType)) continue;
built.add(dataType);
if (dataType instanceof TemporaryStructuredDataType) {
- // this should never happen?
- System.err.println("still temporary [1]: "+dataType);
- continue;
+ throw new IllegalArgumentException("Can not create config for temporary data type: " + dataType.getName());
}
if ((dataType.getId() < 0) || (dataType.getId()> DataType.lastPredefinedDataTypeId())) {
Datatype.Builder dataTypeBuilder = new Datatype.Builder();
@@ -110,16 +108,7 @@ public class DocumentManager {
keytype(mtype.getKeyType().getId()).
valtype(mtype.getValueType().getId()));
} else if (type instanceof DocumentType) {
- System.err.println("still a DocumentType: "+type);
- DocumentType dt = (DocumentType) type;
- Datatype.Documenttype.Builder doc = new Datatype.Documenttype.Builder();
- builder.documenttype(doc);
- doc.
- name(dt.getName()).
- headerstruct(dt.contentStruct().getId());
- for (DocumentType inherited : dt.getInheritedTypes()) {
- doc.inherits(new Datatype.Documenttype.Inherits.Builder().name(inherited.getName()));
- }
+ throw new IllegalArgumentException("Can not create config for unadorned document type: " + type.getName());
} else if (type instanceof NewDocumentType) {
NewDocumentType dt = (NewDocumentType) type;
Datatype.Documenttype.Builder doc = new Datatype.Documenttype.Builder();
@@ -133,8 +122,7 @@ public class DocumentManager {
buildConfig(dt.getFieldSets(), doc);
buildImportedFieldsConfig(dt.getImportedFieldNames(), doc);
} else if (type instanceof TemporaryStructuredDataType) {
- // this should never happen?
- System.err.println("still temporary [2]: "+type);
+ throw new IllegalArgumentException("Can not create config for temporary data type: " + type.getName());
} else if (type instanceof StructDataType) {
StructDataType structType = (StructDataType) type;
Datatype.Structtype.Builder structBuilder = new Datatype.Structtype.Builder();
