Search in sources :

Example 1 with StudyUnrecognizedFormatException

use of org.stepik.core.serialization.StudyUnrecognizedFormatException in project intellij-plugins by StepicOrg.

the class StepikProjectManager method loadState.

@Override
public void loadState(Element state) {
    try {
        logger.info("Start load the StepikProjectManager state");
        int version = StudySerializationUtils.getVersion(state);
        switch(version) {
            case 1:
                state = StudySerializationUtils.convertToSecondVersion(state);
            case 2:
                state = StudySerializationUtils.convertToThirdVersion(state);
            case 3:
                state = StudySerializationUtils.convertToFourthVersion(state);
        }
        String xml = elementToXml(state);
        XStream xs = getXStream();
        xs.fromXML(xml, this);
        this.version = CURRENT_VERSION;
        refreshCourse();
        updateSelection();
        logger.info("The StepikProjectManager state loaded");
    } catch (XStreamException | StudyUnrecognizedFormatException e) {
        logger.warn("Failed deserialization StepikProjectManager \n" + e.getMessage() + "\n" + project);
    }
}
Also used : XStreamException(com.thoughtworks.xstream.XStreamException) StudyUnrecognizedFormatException(org.stepik.core.serialization.StudyUnrecognizedFormatException) XStream(com.thoughtworks.xstream.XStream)

Aggregations

XStream (com.thoughtworks.xstream.XStream)1 XStreamException (com.thoughtworks.xstream.XStreamException)1 StudyUnrecognizedFormatException (org.stepik.core.serialization.StudyUnrecognizedFormatException)1