(final Campaign campaign)
| 167 | } |
| 168 | |
| 169 | private void startItem(final Campaign campaign) |
| 170 | { |
| 171 | for (final Loader loader : loaders) |
| 172 | { |
| 173 | List<CampaignSourceEntry> files = loader.getFiles(campaign); |
| 174 | for (final CampaignSourceEntry cse : files) |
| 175 | { |
| 176 | final URI uri = cse.getURI(); |
| 177 | setChanged(); |
| 178 | notifyObservers(uri); |
| 179 | if (!"file".equalsIgnoreCase(uri.getScheme())) |
| 180 | { |
| 181 | Logging.log(Logging.WARNING, "Skipping campaign " + uri + " from " + campaign.getSourceURI() |
| 182 | + " as it is not a local file."); |
| 183 | continue; |
| 184 | } |
| 185 | File in = new File(uri); |
| 186 | // Use canonical name to stop reruns for the same file referred to using .. |
| 187 | URI canonicalUri; |
| 188 | try |
| 189 | { |
| 190 | canonicalUri = in.getCanonicalFile().toURI(); |
| 191 | } |
| 192 | catch (IOException e1) |
| 193 | { |
| 194 | Logging.log(Logging.WARNING, "Skipping campaign " + uri + " from " + campaign.getSourceURI() |
| 195 | + " as it could not be made canonical. " + e1.getMessage()); |
| 196 | continue; |
| 197 | } |
| 198 | if (written.contains(canonicalUri)) |
| 199 | { |
| 200 | continue; |
| 201 | } |
| 202 | written.add(canonicalUri); |
| 203 | File base = findSubRoot(rootDir, in); |
| 204 | if (base == null) |
| 205 | { |
| 206 | Logging.log(Logging.WARNING, "Skipping campaign " + uri + " from " + campaign.getSourceURI() |
| 207 | + " as it is not in the selected source directory."); |
| 208 | continue; |
| 209 | } |
| 210 | String relative = in.toString().substring(base.toString().length() + 1); |
| 211 | if (!in.exists()) |
| 212 | { |
| 213 | Logging.log(Logging.WARNING, "Skipping campaign " + uri + " from " + campaign.getSourceURI() |
| 214 | + " as it does not exist. Campaign is " + cse.getCampaign().getSourceURI()); |
| 215 | continue; |
| 216 | } |
| 217 | File outFile = new File(outDir, File.separator + relative); |
| 218 | if (outFile.exists()) |
| 219 | { |
| 220 | Logging.log(Logging.WARNING, "Won't overwrite: " + outFile); |
| 221 | continue; |
| 222 | } |
| 223 | ensureParents(outFile.getParentFile()); |
| 224 | try |
| 225 | { |
| 226 | changeLogWriter.append("\nProcessing ").append(String.valueOf(in)).append("\n"); |
no test coverage detected