Skip to content

Commit

Permalink
feat(objectionary#226): handle the case when 'modified' folder is absent
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed May 20, 2024
1 parent 049ca81 commit 70eb294
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 20 deletions.
37 changes: 18 additions & 19 deletions src/it/spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,25 +114,24 @@ SOFTWARE.
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.38.1</version>
<executions>
<execution>
<id>convert-xmir-to-phi</id>
<phase>process-classes</phase>
<goals>
<goal>xmir-to-phi</goal>
</goals>
<configuration>
<phiInputDir>${project.build.directory}/generated-sources/opeo-decompile-modified-xmir</phiInputDir>
<phiOutputDir>${project.build.directory}/generated-sources/opeo-decompile-modified-phi</phiOutputDir>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.38.1</version>
<executions>
<execution>
<id>convert-xmir-to-phi</id>
<phase>process-classes</phase>
<goals>
<goal>xmir-to-phi</goal>
</goals>
<configuration>
<phiInputDir>${project.build.directory}/generated-sources/opeo-decompile-modified-xmir</phiInputDir>
<phiOutputDir>${project.build.directory}/generated-sources/opeo-decompile-modified-phi</phiOutputDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>ineo-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import java.nio.file.Path;
import java.util.stream.Stream;
import org.eolang.opeo.storage.FileStorage;
import org.eolang.opeo.storage.Storage;
import org.eolang.opeo.storage.XmirEntry;
Expand Down Expand Up @@ -66,7 +67,26 @@ private FormattingDecompiler(final Decompiler original, final Storage modified)
@Override
public void decompile() {
this.original.decompile();
this.modified.all().map(this::format).forEach(this.modified::save);
this.all().map(this::format).forEach(this.modified::save);
}

/**
* All XMIR entries.
* @return Stream of XMIR entries.
*/
private Stream<XmirEntry> all() {
Stream<XmirEntry> result;
try {
result = this.modified.all();
} catch (final IllegalArgumentException exception) {
Logger.info(
this,
"No modified XMIRs found. Original storage threw the following exception '%s'",
exception.getMessage()
);
result = Stream.empty();
}
return result;
}

/**
Expand Down

0 comments on commit 70eb294

Please sign in to comment.