comparison flys-aft/src/main/java/de/intevation/aft/Sync.java @ 4110:06891562e633

Extracted and documented the error messages of the process. flys-aft/trunk@4054 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 16 Feb 2012 11:26:56 +0000
parents cdcf98245e36
children f939e1e6cfa4
comparison
equal deleted inserted replaced
4109:8ba11e13ae8a 4110:06891562e633
50 URL url; 50 URL url;
51 try { 51 try {
52 url = new URL(urlString); 52 url = new URL(urlString);
53 } 53 }
54 catch (MalformedURLException mfue) { 54 catch (MalformedURLException mfue) {
55 log.warn("Invalid URL '" + urlString + "'. Ignored.", mfue); 55 log.warn("NOTIFY: Invalid URL '" + urlString + "'. Ignored.", mfue);
56 continue; 56 continue;
57 } 57 }
58 58
59 Notification n = new Notification(notification); 59 Notification n = new Notification(notification);
60 60
92 } 92 }
93 93
94 File dipsFile = new File(dipsF); 94 File dipsFile = new File(dipsF);
95 95
96 if (!dipsFile.isFile() || !dipsFile.canRead()) { 96 if (!dipsFile.isFile() || !dipsFile.canRead()) {
97 log.error("Cannot find '" + dipsF + "'"); 97 log.error("DIPS: Cannot find '" + dipsF + "'.");
98 System.exit(1); 98 System.exit(1);
99 } 99 }
100 100
101 Document dips = XML.parseDocument(dipsFile, Boolean.FALSE); 101 Document dips = XML.parseDocument(dipsFile, Boolean.FALSE);
102 102
103 if (dips == null) { 103 if (dips == null) {
104 log.error("Cannot load DIPS document."); 104 log.error("DIPS: Cannot load DIPS document.");
105 System.exit(1); 105 System.exit(1);
106 } 106 }
107 107
108 String repairF = (String)XML.xpath( 108 String repairF = (String)XML.xpath(
109 config, XPATH_REPAIR, XPathConstants.STRING, null, null); 109 config, XPATH_REPAIR, XPathConstants.STRING, null, null);
110 110
111 if (repairF != null && repairF.length() > 0) { 111 if (repairF != null && repairF.length() > 0) {
112 File repairFile = new File(repairF); 112 File repairFile = new File(repairF);
113 if (!repairFile.isFile() || !repairFile.canRead()) { 113 if (!repairFile.isFile() || !repairFile.canRead()) {
114 log.warn("Cannot open DIPS repair XSLT file."); 114 log.warn("REPAIR: Cannot open DIPS repair XSLT file.");
115 } 115 }
116 else { 116 else {
117 Document fixed = XML.transform(dips, repairFile); 117 Document fixed = XML.transform(dips, repairFile);
118 if (fixed == null) { 118 if (fixed == null) {
119 log.warn("Fixing DIPS failed"); 119 log.warn("REPAIR: Fixing DIPS failed.");
120 } 120 }
121 else { 121 else {
122 dips = fixed; 122 dips = fixed;
123 } 123 }
124 } 124 }
143 syncContext.init(); 143 syncContext.init();
144 Rivers rivers = new Rivers(); 144 Rivers rivers = new Rivers();
145 modified = rivers.sync(syncContext); 145 modified = rivers.sync(syncContext);
146 } 146 }
147 catch (SQLException sqle) { 147 catch (SQLException sqle) {
148 log.error("syncing failed", sqle); 148 log.error("SYNC: Syncing failed.", sqle);
149 exitCode = 1; 149 exitCode = 1;
150 } 150 }
151 finally { 151 finally {
152 if (syncContext != null) { 152 if (syncContext != null) {
153 syncContext.close(); 153 syncContext.close();

http://dive4elements.wald.intevation.org