package uk.org.sappho.code.change.management.data.persistence;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

import com.google.inject.Inject;

import uk.org.sappho.code.change.management.data.RawData;

public class FilenameRawDataPersistence extends RawDataPersistence {

    private final String filename;
    private String zipFilename;

    @Inject
    public FilenameRawDataPersistence(String filename) {

        super();
        this.filename = filename;
        zipFilename = null;
        if (filename.endsWith(".zip")) {
            zipFilename = new File(filename.replaceFirst(".zip$", ".xml")).getName();
        }
    }

    public RawData load() throws IOException {

        return load(new FileInputStream(filename));
    }

    public void save(RawData rawData) throws IOException {

        save(rawData, new FileOutputStream(filename), zipFilename);
    }

    @Override
    public String getDescription() {

        return filename;
    }
}

@@ -373,40 +373,8 @@
 ame;
-%0A    private String zipFilename;
 %0A%0A  
@@ -496,173 +496,8 @@
 me;%0A
-        zipFilename = null;%0A        if (filename.endsWith(%22.zip%22)) %7B%0A            zipFilename = new File(filename.replaceFirst(%22.zip$%22, %22.xml%22)).getName();%0A        %7D%0A
     
@@ -658,32 +658,192 @@
  IOException %7B%0A%0A
+        String zipFilename = null;%0A        if (filename.endsWith(%22.zip%22))%0A            zipFilename = new File(filename.replaceFirst(%22.zip$%22, %22.xml%22)).getName();%0A
         save(raw

Simplify XML loader.