Skip to content

Commit 5e3487b

Browse files
committed
Fix file mapping subparameters parsin
1 parent a56c5bb commit 5e3487b

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<dependency>
2121
<groupId>org.utplsql</groupId>
2222
<artifactId>java-api</artifactId>
23-
<version>1.0-Alpha1</version>
23+
<version>1.0-SNAPSHOT</version>
2424
<scope>compile</scope>
2525
</dependency>
2626
<dependency>

src/main/java/org/utplsql/cli/RunCommand.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,24 @@ public List<ReporterOptions> getReporterOptionsList() {
202202
public FileMapperOptions getMapperOptions(List<String> mappingParams, List<String> filePaths) {
203203
FileMapperOptions mapperOptions = new FileMapperOptions(filePaths);
204204

205+
final String OPT_OWNER="-owner=";
206+
final String OPT_REGEX="-regex_expression=";
207+
final String OPT_TYPE_MAPPING="-type_mapping=";
208+
final String OPT_OWNER_SUBEX="-owner_subexpression=";
209+
final String OPT_NAME_SUBEX="-name_subexpression=";
210+
final String OPT_TYPE_SUBEX="-type_subexpression=";
211+
205212
for (String p : mappingParams) {
206-
if (p.startsWith("-object_owner=")) {
207-
mapperOptions.setObjectOwner(p.substring("-object_owner=".length()));
213+
if (p.startsWith(OPT_OWNER)) {
214+
mapperOptions.setObjectOwner(p.substring(OPT_OWNER.length()));
208215
}
209216
else
210-
if (p.startsWith("-regex_pattern=")) {
211-
mapperOptions.setRegexPattern(p.substring("-regex_pattern=".length()));
217+
if (p.startsWith(OPT_REGEX)) {
218+
mapperOptions.setRegexPattern(p.substring(OPT_REGEX.length()));
212219
}
213220
else
214-
if (p.startsWith("-type_mapping=")) {
215-
String typeMappingsParam = p.substring("-type_mapping=".length());
221+
if (p.startsWith(OPT_TYPE_MAPPING)) {
222+
String typeMappingsParam = p.substring(OPT_TYPE_MAPPING.length());
216223

217224
List<KeyValuePair> typeMappings = new ArrayList<>();
218225
for (String mapping : typeMappingsParam.split("/")) {
@@ -223,23 +230,20 @@ public FileMapperOptions getMapperOptions(List<String> mappingParams, List<Strin
223230
mapperOptions.setTypeMappings(typeMappings);
224231
}
225232
else
226-
if (p.startsWith("-owner_subexpression=")) {
227-
mapperOptions.setOwnerSubExpression(Integer.parseInt(p.substring("-owner_subexpression=".length())));
233+
if (p.startsWith(OPT_OWNER_SUBEX)) {
234+
mapperOptions.setOwnerSubExpression(Integer.parseInt(p.substring(OPT_OWNER_SUBEX.length())));
228235
}
229236
else
230-
if (p.startsWith("-name_subexpression=")) {
231-
mapperOptions.setNameSubExpression(Integer.parseInt(p.substring("-name_subexpression=".length())));
237+
if (p.startsWith(OPT_NAME_SUBEX)) {
238+
mapperOptions.setNameSubExpression(Integer.parseInt(p.substring(OPT_NAME_SUBEX.length())));
232239
}
233240
else
234-
if (p.startsWith("-type_subexpression=")) {
241+
if (p.startsWith(OPT_TYPE_SUBEX)) {
235242
mapperOptions.setTypeSubExpression(Integer.parseInt(p.substring("-type_subexpression=".length())));
236243
}
237244
}
238245

239-
if (mapperOptions.getRegexPattern() == null || mapperOptions.getRegexPattern().isEmpty())
240-
return null;
241-
else
242-
return mapperOptions;
246+
return mapperOptions;
243247
}
244248

245249
}

0 commit comments

Comments
 (0)