Remove 'throws IOException' declaration 09/105009/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 24 Mar 2023 12:27:46 +0000 (13:27 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 24 Mar 2023 12:27:46 +0000 (13:27 +0100)
This is a code smell reported by Sonar, fix it.

Change-Id: I0a4f2155f0fbf8f69ccd7bc4a1f25202b1fc4bbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/GeneratorTask.java
plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/YangToSourcesProcessor.java

index eb5aa8cbc1da505ccd1ba21f8090e618a100feb3..a253a4eb96dba500366784d03ffb8a44a22ecb8e 100644 (file)
@@ -72,10 +72,9 @@ final class GeneratorTask implements Identifiable<String> {
      * @param context model generation context
      * @return {@link FileState} for every generated file
      * @throws FileGeneratorException if the underlying generator fails
-     * @throws IOException when a generated file cannot be written
      */
     @NonNull List<FileState> execute(final MavenProject project, final BuildContext buildContext,
-            final ContextHolder context) throws FileGeneratorException, IOException {
+            final ContextHolder context) throws FileGeneratorException {
         final var access = new ProjectFileAccess(project, getIdentifier());
 
         // Step one: determine what files are going to be generated
@@ -102,7 +101,7 @@ final class GeneratorTask implements Identifiable<String> {
                     target = new File(access.transientPath(cell.getRowKey()), relativePath);
                     break;
                 default:
-                    throw new IllegalStateException("Unsupported file type in " + file);
+                    throw new FileGeneratorException("Unsupported file type in " + file);
             }
 
             dirs.put(target.getParentFile(), new WriteTask(target, cell.getValue()));
index 3e1fae9191df8a09cb4d359a774ddc26f05e11fe..99685df218ae1e803ac2c89417aa7cdb95a69023 100644 (file)
@@ -280,7 +280,7 @@ class YangToSourcesProcessor {
                 final List<FileState> files;
                 try {
                     files = factory.execute(project, buildContext, holder);
-                } catch (FileGeneratorException | IOException e) {
+                } catch (FileGeneratorException e) {
                     throw new MojoFailureException(LOG_PREFIX + " Generator " + factory + " failed", e);
                 }