CPD Results
The following document contains the results of PMD's CPD 7.5.0.
Duplications
File | Line |
---|---|
gov/nist/secauto/metaschema/maven/plugin/GenerateSchemaMojo.java | 252 |
gov/nist/secauto/metaschema/maven/plugin/GenerateSourcesMojo.java | 136 |
} if (generate) { File outputDir = getOutputDirectory(); if (getLog().isDebugEnabled()) { getLog().debug(String.format("Using outputDirectory: %s", outputDir.getPath())); } if (!outputDir.exists() && !outputDir.mkdirs()) { throw new MojoExecutionException("Unable to create output directory: " + outputDir); } BindingModuleLoader loader = newModuleLoader(); // generate Java sources based on provided metaschema sources final Set<IModule> modules = new HashSet<>(); for (File source : getModuleSources().collect(Collectors.toList())) { assert source != null; if (getLog().isInfoEnabled()) { getLog().info("Using metaschema source: " + source.getPath()); } IBindingMetaschemaModule module; try { module = loader.load(source); } catch (MetaschemaException | IOException ex) { throw new MojoExecutionException("Loading of metaschema failed", ex); } // IValidationResult result = IBindingContext.instance().validate( // module.getSourceNodeItem(), // IBindingContext.instance().newBoundLoader(), // null); // // LoggingValidationHandler.instance().handleValidationResults(validationResult); modules.add(module); } generate(modules); // create the stale file if (!staleFileDirectory.exists() && !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(); if (getLog().isInfoEnabled()) { 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()); } |