Program: 108328
Project: 108328
Buggy source:
/** 
 * Reads the configuration from the file
 * @param prefix
 * @param output
 * @param map
 * @param zip
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws SAXException
 */
private void readConfiguration(final String prefix,final boolean output,final Map<String,ARXNode> map,final ZipFile zip) throws IOException, ClassNotFoundException, SAXException {
  final ZipEntry entry=zip.getEntry(prefix + "String_Node_Str");
  if (entry == null) {
    return;
  }
  final ObjectInputStream oos=new ObjectInputStream(zip.getInputStream(entry));
  final ModelConfiguration config=(ModelConfiguration)oos.readObject();
  config.setMetric(Metric.createMetric(config.getMetric()));
  config.getConfig().setMetric(Metric.createMetric(config.getConfig().getMetric()));
  oos.close();
  if (!output) {
    readInput(config,zip);
    model.setInputConfig(config);
    readDefinition(config,model.getInputDefinition(),prefix,zip);
  }
 else {
    config.setInput(model.getInputConfig().getInput());
    model.setOutputConfig(config);
    DataDefinition definition=new DataDefinition();
    readDefinition(config,definition,prefix,zip);
    final int historySize=model.getHistorySize();
    final double snapshotSizeSnapshot=model.getSnapshotSizeSnapshot();
    final double snapshotSizeDataset=model.getSnapshotSizeDataset();
    final Metric<?> metric=config.getMetric();
    final long time=model.getTime();
    final ARXNode optimalNode;
    final ARXNode outputNode;
    if (model.getOptimalNodeAsString() != null) {
      optimalNode=map.get(model.getOptimalNodeAsString());
    }
 else {
      optimalNode=null;
    }
    if (model.getOutputNodeAsString() != null) {
      outputNode=map.get(model.getOutputNodeAsString());
    }
 else {
      outputNode=null;
    }
    model.setSelectedNode(outputNode);
    model.setResult(new ARXResult(config.getInput().getHandle(),definition,lattice,historySize,snapshotSizeSnapshot,snapshotSizeDataset,metric,model.getOutputConfig().getConfig(),optimalNode,time));
    final ARXAnonymizer f=new ARXAnonymizer();
    model.setAnonymizer(f);
    f.setHistorySize(historySize);
    f.setMaximumSnapshotSizeSnapshot(snapshotSizeSnapshot);
    f.setMaximumSnapshotSizeDataset(snapshotSizeDataset);
  }
}

Fixed version (ground truth):
/** 
 * Reads the configuration from the file
 * @param prefix
 * @param output
 * @param map
 * @param zip
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws SAXException
 */
private void readConfiguration(final String prefix,final boolean output,final Map<String,ARXNode> map,final ZipFile zip) throws IOException, ClassNotFoundException, SAXException {
  final ZipEntry entry=zip.getEntry(prefix + "String_Node_Str");
  if (entry == null) {
    return;
  }
  final ObjectInputStream oos=new ObjectInputStream(zip.getInputStream(entry));
  final ModelConfiguration config=(ModelConfiguration)oos.readObject();
  config.setMetric(Metric.createMetric(config.getMetric(),ARXLattice.DESERIALIZATION_CONTEXT_MIN_LEVEL,ARXLattice.DESERIALIZATION_CONTEXT_MAX_LEVEL));
  config.getConfig().setMetric(Metric.createMetric(config.getConfig().getMetric(),ARXLattice.DESERIALIZATION_CONTEXT_MIN_LEVEL,ARXLattice.DESERIALIZATION_CONTEXT_MAX_LEVEL));
  oos.close();
  if (!output) {
    readInput(config,zip);
    model.setInputConfig(config);
    readDefinition(config,model.getInputDefinition(),prefix,zip);
  }
 else {
    config.setInput(model.getInputConfig().getInput());
    model.setOutputConfig(config);
    DataDefinition definition=new DataDefinition();
    readDefinition(config,definition,prefix,zip);
    final int historySize=model.getHistorySize();
    final double snapshotSizeSnapshot=model.getSnapshotSizeSnapshot();
    final double snapshotSizeDataset=model.getSnapshotSizeDataset();
    final Metric<?> metric=config.getMetric();
    final long time=model.getTime();
    final ARXNode optimalNode;
    final ARXNode outputNode;
    if (model.getOptimalNodeAsString() != null) {
      optimalNode=map.get(model.getOptimalNodeAsString());
    }
 else {
      optimalNode=null;
    }
    if (model.getOutputNodeAsString() != null) {
      outputNode=map.get(model.getOutputNodeAsString());
    }
 else {
      outputNode=null;
    }
    model.setSelectedNode(outputNode);
    model.setResult(new ARXResult(config.getInput().getHandle(),definition,lattice,historySize,snapshotSizeSnapshot,snapshotSizeDataset,metric,model.getOutputConfig().getConfig(),optimalNode,time));
    final ARXAnonymizer f=new ARXAnonymizer();
    model.setAnonymizer(f);
    f.setHistorySize(historySize);
    f.setMaximumSnapshotSizeSnapshot(snapshotSizeSnapshot);
    f.setMaximumSnapshotSizeDataset(snapshotSizeDataset);
  }
}