CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
File | Line |
---|---|
gov/nist/secauto/metaschema/maven/plugin/GenerateSchemaMojo.java | 257 |
gov/nist/secauto/metaschema/maven/plugin/GenerateSourcesMojo.java | 139 |
getLog().debug(String.format("Schema generation is configured to be skipped. Skipping.")); generate = false; } else if (!staleFile.exists()) { getLog().info(String.format("Stale file '%s' doesn't exist! Generating source files.", staleFile.getPath())); generate = true; } else { generate = isGenerationRequired(); } if (generate) { File outputDir = getOutputDirectory(); getLog().debug(String.format("Using outputDirectory: %s", outputDir.getPath())); if (!outputDir.exists()) { if (!outputDir.mkdirs()) { throw new MojoExecutionException("Unable to create output directory: " + outputDir); } } // generate Java sources based on provided Module sources final ModuleLoader loader = new ModuleLoader(); loader.allowEntityResolution(); final Set<IModule> modules = new HashSet<>(); for (File source : getSources().collect(Collectors.toList())) { getLog().info("Using metaschema source: " + source.getPath()); IModule module; try { module = loader.load(source); } catch (MetaschemaException | IOException ex) { throw new MojoExecutionException("Loading of metaschema failed", ex); } modules.add(module); } generate(modules); // create the stale file if (!staleFileDirectory.exists()) { if (!staleFileDirectory.mkdirs()) { throw new MojoExecutionException("Unable to create output directory: " + staleFileDirectory); } } try (OutputStream os = Files.newOutputStream(staleFile.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING)) { os.close(); getLog().info("Created stale file: " + staleFile); } catch (IOException ex) { throw new MojoExecutionException("Failed to write stale file: " + staleFile.getPath(), ex); } // for m2e getBuildContext().refresh(getOutputDirectory()); } |