18
18
*/
19
19
20
20
/*
21
- * Copyright (c) 2006, 2022 , Oracle and/or its affiliates. All rights reserved.
21
+ * Copyright (c) 2006, 2024 , Oracle and/or its affiliates. All rights reserved.
22
22
* Portions Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
23
23
*/
24
24
package org .opengrok .indexer .history ;
@@ -81,13 +81,12 @@ void parse(File file, String sinceRevision, String tillRevision, Integer numComm
81
81
Executor executor = repository .getHistoryLogExecutor (file , sinceRevision , tillRevision , false ,
82
82
numCommits );
83
83
int status = executor .exec (true , this );
84
-
85
84
if (status != 0 ) {
86
- throw new HistoryException ("Failed to get history for: \" " + file . getAbsolutePath () +
87
- " \" Exit code: " + status );
85
+ throw new HistoryException (String . format ( "Failed to get history for '%s' (exit status %d)" ,
86
+ file . getAbsolutePath (), status ) );
88
87
}
89
88
} catch (IOException e ) {
90
- throw new HistoryException ("Failed to get history for: \" " + file .getAbsolutePath () + " \" " , e );
89
+ throw new HistoryException (String . format ( "Failed to get history for '%s'" , file .getAbsolutePath ()) , e );
91
90
}
92
91
93
92
// If a changeset to start from is specified, remove that changeset from the list,
@@ -151,7 +150,7 @@ private void removeChangesets(List<RepositoryWithHistoryTraversal.ChangesetInfo>
151
150
* {@link org.opengrok.indexer.history.RepositoryWithHistoryTraversal.ChangesetInfo} elements.
152
151
*
153
152
* @param input The output from the process
154
- * @throws java.io. IOException If an error occurs while reading the stream
153
+ * @throws IOException If an error occurs while reading the stream
155
154
*/
156
155
@ Override
157
156
public void processStream (InputStream input ) throws IOException {
@@ -182,7 +181,7 @@ public void processStream(InputStream input) throws IOException {
182
181
} else if (s .startsWith (MercurialRepository .FILES ) && entry != null ) {
183
182
String [] strings = s .split (" " );
184
183
for (int ii = 1 ; ii < strings .length ; ++ii ) {
185
- if (strings [ii ].length () > 0 ) {
184
+ if (! strings [ii ].isEmpty () ) {
186
185
File f = new File (mydir , strings [ii ]);
187
186
try {
188
187
String path = env .getPathRelativeToSourceRoot (f );
@@ -221,7 +220,7 @@ public void processStream(InputStream input) throws IOException {
221
220
} else if (s .equals (MercurialRepository .END_OF_ENTRY )
222
221
&& entry != null ) {
223
222
entry = null ;
224
- } else if (s . length () > 0 ) {
223
+ } else if (! s . isEmpty () ) {
225
224
LOGGER .log (Level .WARNING ,
226
225
"Invalid/unexpected output {0} from hg log for repo {1}" ,
227
226
new Object []{s , repository .getDirectoryName ()});
@@ -235,10 +234,10 @@ public void processStream(InputStream input) throws IOException {
235
234
* This is to prevent problems if the log message contains one of the
236
235
* prefixes that {@link #processStream(InputStream)} is looking for (bug
237
236
* #405).
238
- *
237
+ * <p>
239
238
* This method is way too tolerant, and won't complain if the line has
240
239
* a different format than expected. It will return weird results, though.
241
- *
240
+ * </p>
242
241
* @param line the XML encoded line
243
242
* @return the decoded description
244
243
*/
0 commit comments