diff --git a/pom.xml b/pom.xml
index 05083f34..9e0d8022 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
com.lyncode
xoai
- 4.1.0
+ 4.1.0-header-patch
XOAI : OAI-PMH Java Toolkit
http://www.lyncode.com
diff --git a/xoai-common/pom.xml b/xoai-common/pom.xml
index 9e4afbd5..f5187ae1 100644
--- a/xoai-common/pom.xml
+++ b/xoai-common/pom.xml
@@ -3,7 +3,7 @@
xoai
com.lyncode
- 4.1.0
+ 4.1.0-header-patch
4.0.0
@@ -73,4 +73,4 @@
-
\ No newline at end of file
+
diff --git a/xoai-common/src/main/java/com/lyncode/xoai/model/oaipmh/GetRecord.java b/xoai-common/src/main/java/com/lyncode/xoai/model/oaipmh/GetRecord.java
index 273b9104..8c863260 100644
--- a/xoai-common/src/main/java/com/lyncode/xoai/model/oaipmh/GetRecord.java
+++ b/xoai-common/src/main/java/com/lyncode/xoai/model/oaipmh/GetRecord.java
@@ -23,6 +23,13 @@ public void write(XmlWriter writer) throws XmlWriteException {
}
}
+ /* Not to be confused with the similarly-named constructor, this
+ method exposes the "private final Record record" to other parts
+ of the OAI framework: */
+ public Record getRecord() {
+ return record;
+ }
+
@Override
public Type getType() {
return Type.GetRecord;
diff --git a/xoai-data-provider/pom.xml b/xoai-data-provider/pom.xml
index 6ff02f9e..0f99a6ea 100644
--- a/xoai-data-provider/pom.xml
+++ b/xoai-data-provider/pom.xml
@@ -3,7 +3,7 @@
xoai
com.lyncode
- 4.1.0
+ 4.1.0-header-patch
4.0.0
@@ -50,4 +50,4 @@
test
-
\ No newline at end of file
+
diff --git a/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/GetRecordHandler.java b/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/GetRecordHandler.java
index 39ae5111..9472dc66 100644
--- a/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/GetRecordHandler.java
+++ b/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/GetRecordHandler.java
@@ -58,6 +58,9 @@ public GetRecord handle(OAICompiledRequest parameters) throws OAIException, Hand
if (item.isDeleted())
header.withStatus(Header.Status.DELETED);
+ /* Include the raw metadata: */
+ record.withMetadata(item.getMetadata());
+ /* Bypass/disable the XOAI metadata transform functionality:
if (!item.isDeleted()) {
Metadata metadata = null;
try {
@@ -87,7 +90,7 @@ public GetRecord handle(OAICompiledRequest parameters) throws OAIException, Hand
for (About about : item.getAbout())
record.withAbout(about);
}
- }
+ }*/
return result;
}
diff --git a/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/ListIdentifiersHandler.java b/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/ListIdentifiersHandler.java
index a443bea0..a11578e3 100644
--- a/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/ListIdentifiersHandler.java
+++ b/xoai-data-provider/src/main/java/com/lyncode/xoai/dataprovider/handlers/ListIdentifiersHandler.java
@@ -51,8 +51,8 @@ else if (parameters.hasFrom() && parameters.hasUntil())
listItemIdentifiersResult = itemRepositoryHelper.getItemIdentifiers(getContext(), offset, length,
parameters.getMetadataPrefix());
} else {
- if (!getRepository().getSetRepository().exists(parameters.getSet()) && !getContext().hasSet(parameters.getSet()))
- throw new NoMatchesException();
+ /*if (!getRepository().getSetRepository().exists(parameters.getSet()) && !getContext().hasSet(parameters.getSet()))
+ throw new NoMatchesException();*/
if (parameters.hasFrom() && !parameters.hasUntil())
listItemIdentifiersResult = itemRepositoryHelper.getItemIdentifiers(getContext(), offset, length,
diff --git a/xoai-service-provider/pom.xml b/xoai-service-provider/pom.xml
index c724d631..8f448457 100644
--- a/xoai-service-provider/pom.xml
+++ b/xoai-service-provider/pom.xml
@@ -3,7 +3,7 @@
xoai
com.lyncode
- 4.1.0
+ 4.1.0-header-patch
4.0.0
@@ -63,4 +63,4 @@
-
\ No newline at end of file
+
diff --git a/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/handler/ListSetsHandler.java b/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/handler/ListSetsHandler.java
index d69b5155..51f67904 100644
--- a/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/handler/ListSetsHandler.java
+++ b/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/handler/ListSetsHandler.java
@@ -43,6 +43,7 @@
import com.lyncode.xoai.serviceprovider.lazy.Source;
import com.lyncode.xoai.serviceprovider.model.Context;
import com.lyncode.xoai.serviceprovider.parsers.ListSetsParser;
+import java.io.IOException;
public class ListSetsHandler implements Source {
private Context context;
@@ -82,6 +83,24 @@ public List nextIteration() {
resumptionToken = text;
} else ended = true;
} else ended = true;
+ /* This appears to be a bug in 4.1.0: the handler should be
+ * closing the stream here, similarly to the ListIdentifierHandle,
+ * etc. Without closing it, if there is a resumption token and
+ * we need to make another call - you will get an exception
+ * "Invalid use of BasicClientConnManager: connection still allocated.
+ * Make sure to release the connection before allocating another one."
+ * Also note, that I ignore the IOException if one is thrown on an
+ * attempt to close the stream (unlike ListIdentifierHandler - which
+ * then proceeds to throw an InvalidOAIResponse). If there is
+ * something seriously bad with the connection, to the point that it
+ * prevents us from making the next call, it will surely result in
+ * an exception then. -- L.A. May 2016.
+ */
+ try {
+ stream.close();
+ } catch (IOException ioex) {
+ // ignore!
+ }
return sets;
} catch (XmlReaderException e) {
throw new InvalidOAIResponse(e);
diff --git a/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/parsers/HeaderParser.java b/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/parsers/HeaderParser.java
index 0ebacb8b..d5b70d49 100644
--- a/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/parsers/HeaderParser.java
+++ b/xoai-service-provider/src/main/java/com/lyncode/xoai/serviceprovider/parsers/HeaderParser.java
@@ -40,8 +40,12 @@ public Header parse (XmlReader reader) throws XmlReaderException {
header.withIdentifier(reader.getText());
reader.next(elementName(localPart(equalTo("datestamp")))).next(text());
header.withDatestamp(reader.get(dateParser()));
+ /* The 4.0-4.1 implementation was buggy, in that it made the
+ * setspec tag mandatory. Commenting out the next 2 lines fixes it:
reader.next(setSpecElement()).next(text());
header.withSetSpec(reader.getText());
+ */
+
while (reader.next(endOfHeader(), setSpecElement()).current(setSpecElement()))
header.withSetSpec(reader.next(text()).getText());
return header;