Skip to content

Commit 12284f1

Browse files
committed
[rf2] report error when any of the specified RF2 sources is a directory
1 parent eed4351 commit 12284f1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/main/java/com/b2international/rf2/RF2Create.java

+13
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.List;
2424
import java.util.stream.Collectors;
2525

26+
import com.b2international.rf2.model.RF2Directory;
2627
import com.b2international.rf2.model.RF2File;
2728
import com.b2international.rf2.spec.RF2ReleaseSpecification;
2829
import com.b2international.rf2.spec.RF2Specification;
@@ -99,6 +100,18 @@ public void doRun() throws Exception {
99100
sources = Collections.emptyList();
100101
}
101102

103+
boolean validSources = true;
104+
for (RF2File source : sources) {
105+
if (source instanceof RF2Directory) {
106+
console.log("Only .txt and .zip files are accepted as RF2 source files. '%s' is a directory.", source.getPath());
107+
validSources = false;
108+
}
109+
}
110+
111+
if (!validSources) {
112+
return;
113+
}
114+
102115
specification
103116
.prepare(outputDirectory)
104117
.create(new RF2CreateContext(specification, sources, console));

0 commit comments

Comments
 (0)