diff options
| author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-11-13 16:13:10 +0100 |
|---|---|---|
| committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2012-11-13 16:13:10 +0100 |
| commit | 94cebec29ed45667389f25b6001a143cc4b410aa (patch) | |
| tree | 2035d2633e411d1589227af4526cdf43be26e4c6 /trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java | |
| parent | ca197c4558de3c98c8168746ba6283505675ee54 (diff) | |
| download | pdf-over-94cebec29ed45667389f25b6001a143cc4b410aa.tar.gz pdf-over-94cebec29ed45667389f25b6001a143cc4b410aa.tar.bz2 pdf-over-94cebec29ed45667389f25b6001a143cc4b410aa.zip | |
+ extracting log4j config to ~/.pdfover
+ loading log4j properties from the local file
Diffstat (limited to 'trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java')
| -rw-r--r-- | trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java index 41d44f52..6c8181d4 100644 --- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java +++ b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareConfigurationState.java @@ -192,6 +192,44 @@ public class PrepareConfigurationState extends State { } } + inputStream = null; + pdfOverConfig = null; + try { + inputStream = this.getClass().getResourceAsStream( + "/" + ConfigManipulator.DEFAULT_LOG4J_FILE); //$NON-NLS-1$ + pdfOverConfig = new FileOutputStream(this.stateMachine.getConfigProvider().getConfigurationDirectory() + + "/" //$NON-NLS-1$ + + ConfigManipulator.DEFAULT_LOG4J_FILE); + + while ((byteCount = inputStream.read(buffer)) >= 0) { + pdfOverConfig.write(buffer, 0, byteCount); + } + } catch (Exception e) { + log.error( + "Failed to write log4j config file to config directory", e); //$NON-NLS-1$ + throw new InitializationException( + "Failed to write log4j config file to config directory", //$NON-NLS-1$ + e); + } finally { + if (pdfOverConfig != null) { + try { + pdfOverConfig.close(); + } catch (IOException e) { + log.warn( + "Failed to close File stream for log4j config", e); //$NON-NLS-1$ + } + } + + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.warn( + "Failed to close Resource stream for log4j config", e); //$NON-NLS-1$ + } + } + } + InputStream is = this.getClass().getResourceAsStream( "/cfg/PDFASConfig.zip"); //$NON-NLS-1$ |
