Skip to content
Snippets Groups Projects
Commit f4b2797a authored by srosse's avatar srosse
Browse files

OO-2808: make the read item method robust against empty file

parent 65c57593
No related branches found
No related tags found
No related merge requests found
...@@ -45,6 +45,7 @@ import org.olat.core.gui.media.MediaResource; ...@@ -45,6 +45,7 @@ import org.olat.core.gui.media.MediaResource;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.OLATResourceable; import org.olat.core.id.OLATResourceable;
import org.olat.core.logging.AssertException; import org.olat.core.logging.AssertException;
import org.olat.core.logging.OLATRuntimeException;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.util.CodeHelper; import org.olat.core.util.CodeHelper;
import org.olat.core.util.Encoder; import org.olat.core.util.Encoder;
...@@ -579,14 +580,19 @@ public class FeedManagerImpl extends FeedManager { ...@@ -579,14 +580,19 @@ public class FeedManagerImpl extends FeedManager {
* @param container * @param container
* @return The item * @return The item
*/ */
@Override
public Item loadItem(VFSItem container) { public Item loadItem(VFSItem container) {
VFSLeaf itemLeaf = null; VFSLeaf itemLeaf = null;
Item item = null; Item item = null;
if (container != null) { if (container != null) {
itemLeaf = (VFSLeaf) container.resolve(ITEM_FILE_NAME); itemLeaf = (VFSLeaf) container.resolve(ITEM_FILE_NAME);
if (itemLeaf != null) { if (itemLeaf != null && itemLeaf.getSize() > 0) {
item = (Item) XStreamHelper.readObject(xstream, itemLeaf.getInputStream()); try {
item = (Item) XStreamHelper.readObject(xstream, itemLeaf.getInputStream());
} catch (OLATRuntimeException e) {
log.error("Corrupted or empty feed item:" + itemLeaf, e);
}
} }
} }
return item; return item;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment