Example usage for java.io IOException setStackTrace

List of usage examples for java.io IOException setStackTrace

Introduction

In this page you can find the example usage for java.io IOException setStackTrace.

Prototype

public void setStackTrace(StackTraceElement[] stackTrace) 

Source Link

Document

Sets the stack trace elements that will be returned by #getStackTrace() and printed by #printStackTrace() and related methods.

Usage

From source file:de.innovationgate.wga.model.WGADesignConfigurationModel.java

@Override
public void reload() throws IOException {
    _syncInfo = DesignDefinition.load(_syncInfoFile);
    _designDirectory = _syncInfoFile.getParentFile();
    _csConfigFile = new File(_designDirectory, "files/system/csconfig.xml");
    if (!_csConfigFile.exists()) {
        File files = new File(_designDirectory, "files");
        if (!files.exists()) {
            files.mkdir();/*from  ww w  . j  ava 2s .co m*/
        }
        File system = new File(files, "system");
        if (!system.exists()) {
            system.mkdir();
        }
        _csConfig = new CSConfig();
        _csConfig.write(_csConfigFile);
    } else {
        try {
            _csConfig = CSConfig.load(_csConfigFile);
        } catch (InvalidCSConfigVersionException e) {
            IOException io = new IOException("Invalid cs config version: " + e.getMessage());
            io.setStackTrace(e.getStackTrace());
            throw io;
        }
    }

    _csConfigFileBase = new File(_designDirectory, "files/system/base-csconfig.xml");
    if (_csConfigFileBase.exists()) {
        try {
            _csConfigBase = CSConfig.load(_csConfigFileBase);
        } catch (InvalidCSConfigVersionException e) {
            IOException io = new IOException("Invalid base cs config version: " + e.getMessage());
            io.setStackTrace(e.getStackTrace());
            throw io;
        }
    }

    try {
        ensureCorrectCSConfigVersion();
    } catch (Exception e) {
        IOException ioe = new IOException(e.getMessage());
        ioe.setStackTrace(e.getStackTrace());
        throw ioe;
    }

    loadVersionProperties();
    loadPluginVersionProperties();

    // migrate design encoding to csConfig
    String encValue = _syncInfo.getFileEncoding();
    if (encValue != null && !encValue.trim().equalsIgnoreCase("csconfig")) {
        _syncInfo.setFileEncoding(null);
        if (encValue.trim().equals("")) {
            removePublisherOption(PublisherOption.OPTION_DESIGN_ENCODING);
        } else {
            setPublisherOption(PublisherOption.OPTION_DESIGN_ENCODING, encValue, false);
        }
    } else if (encValue == null) {
        // design encoding is not defined in _syncinfo -> syncinfo has priority so change model to reflect correct encoding
        setPublisherOption(PublisherOption.OPTION_DESIGN_ENCODING, STRING_NOT_SET, false);
    }

}