You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/user_util/indexed_file/IndexedFileUtilMain.java
+26-28Lines changed: 26 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -138,39 +138,37 @@ public static void main(String[] args) {
138
138
System.exit(1);
139
139
}
140
140
} elseif ("migrate".equals(subCommand)) {
141
-
if (unrecognizedArgs.length != 2) {
142
-
if (unrecognizedArgs.length < 2) {
143
-
System.err.println("error: no indexed file is specified.");
144
-
} else {
145
-
System.err.println("error: too many indexed files are specified.");
146
-
}
141
+
if (unrecognizedArgs.length < 2) {
142
+
System.err.println("error: no indexed file is specified.");
147
143
System.exit(1);
148
144
}
149
-
StringindexedFilePath = unrecognizedArgs[1];
150
-
try {
151
-
migrateIndexedFile(indexedFilePath);
152
-
} catch (Exceptione) {
153
-
System.err.println("error: " + e.getMessage());
154
-
System.exit(1);
145
+
booleanhasError = false;
146
+
for (inti = 1; i < unrecognizedArgs.length; i++) {
147
+
StringindexedFilePath = unrecognizedArgs[i];
148
+
try {
149
+
migrateIndexedFile(indexedFilePath);
150
+
} catch (Exceptione) {
151
+
System.err.println("error: " + e.getMessage());
152
+
hasError = true;
153
+
}
155
154
}
156
-
System.exit(0);
155
+
System.exit(hasError ? 1 : 0);
157
156
} elseif ("unlock".equals(subCommand)) {
158
-
if (unrecognizedArgs.length != 2) {
159
-
if (unrecognizedArgs.length < 2) {
160
-
System.err.println("error: no indexed file is specified.");
161
-
} else {
162
-
System.err.println("error: too many indexed files are specified.");
163
-
}
157
+
if (unrecognizedArgs.length < 2) {
158
+
System.err.println("error: no indexed file is specified.");
164
159
System.exit(1);
165
160
}
166
-
StringindexedFilePath = unrecognizedArgs[1];
167
-
try {
168
-
unlockIndexedFile(indexedFilePath);
169
-
} catch (Exceptione) {
170
-
System.err.println("error: " + e.getMessage());
171
-
System.exit(1);
161
+
booleanhasError = false;
162
+
for (inti = 1; i < unrecognizedArgs.length; i++) {
163
+
StringindexedFilePath = unrecognizedArgs[i];
164
+
try {
165
+
unlockIndexedFile(indexedFilePath);
166
+
} catch (Exceptione) {
167
+
System.err.println("error: " + e.getMessage());
168
+
hasError = true;
169
+
}
172
170
}
173
-
System.exit(0);
171
+
System.exit(hasError ? 1 : 0);
174
172
} elseif ("load".equals(subCommand)) {
175
173
if (unrecognizedArgs.length < 2 || unrecognizedArgs.length > 3) {
0 commit comments