@@ -247,16 +247,18 @@ public void setProxy(String host, int port, String proxyUser, String proxyPasswo
247247 public String getFileContent (String branchName , String filePath , String revision ) {
248248 ByteArrayOutputStream baos = new ByteArrayOutputStream ();
249249 try {
250- if (repository .checkPath (getBranchName (branchName ), -1L ) == SVNNodeKind .NONE ) {
251- throw new EVCSBranchNotFound (getRepoUrl (), getBranchName (branchName ));
252- }
253250 repository .getFile (new File (getBranchName (branchName ), filePath ).getPath ().replace ("\\ " , "/" ),
254251 (revision == null || revision .isEmpty ()) ? -1 : Long .parseLong (revision ), new SVNProperties (), baos );
255252 return baos .toString (StandardCharsets .UTF_8 .name ());
256- } catch (EVCSBranchNotFound e ) {
257- throw e ;
258253 } catch (SVNException e ) {
259254 if (e .getErrorMessage ().getErrorCode ().getCode () == SVN_FILE_NOT_FOUND_ERROR_CODE ) {
255+ try {
256+ if (repository .checkPath (getBranchName (branchName ), -1L ) == SVNNodeKind .NONE ) {
257+ throw new EVCSBranchNotFound (getRepoUrl (), getBranchName (branchName ));
258+ }
259+ } catch (SVNException e1 ) {
260+ throw new EVCSException (e1 );
261+ }
260262 throw new EVCSFileNotFound (getRepoUrl (), getBranchName (branchName ), filePath , revision );
261263 }
262264 throw new EVCSException (e );
@@ -348,15 +350,15 @@ private List<VCSDiffEntry> fillUnifiedDiffs(final String srcBranchName, final St
348350 }
349351
350352 protected SVNLogEntry getBranchFirstCommit (final String branchPath ) throws Exception {
351- final List < SVNLogEntry > logEntries = new ArrayList <>();
352- repository .log (new String [] { getBranchName (branchPath ) }, - 1 /* start from head descending */ ,
353- 0 , true , true , - 1 , new ISVNLogEntryHandler () {
353+ final SVNLogEntry [] firstEntryHolder = new SVNLogEntry [ 1 ];
354+ repository .log (new String [] { getBranchName (branchPath ) }, 0 /* start from first commit */ ,
355+ - 1 /* to the head commit */ , true , true , 1 /* limit */ , new ISVNLogEntryHandler () {
354356 @ Override
355357 public void handleLogEntry (SVNLogEntry logEntry ) throws SVNException {
356- logEntries . add ( logEntry ) ;
358+ firstEntryHolder [ 0 ] = logEntry ;
357359 }
358360 });
359- return logEntries . get ( logEntries . size () - 1 ) ;
361+ return firstEntryHolder [ 0 ] ;
360362 }
361363
362364
0 commit comments