Show
Ignore:
Timestamp:
09/04/10 07:44:35 (21 months ago)
Author:
stefan
Message:

fixed bug #88: sometimes JLE does not react when after initiating the svn update

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/jlatexeditor/tools/SVN.java

    r744 r834  
    33import util.Pair; 
    44import util.ProcessUtil; 
     5import util.StreamUtils; 
    56 
    67import java.io.BufferedReader; 
     
    2930    } catch (Exception e) { 
    3031      e.printStackTrace(); 
    31       throw new Exception("SVN update failed!"); 
     32      throw new Exception("SVN update failed!", e); 
    3233    } 
    3334 
     
    6162    } 
    6263 
     64    checkProcessResult(svn, "SVN update"); 
     65 
    6366    return results; 
    6467  } 
    6568 
    66   public synchronized Pair<Boolean, String> commit(File dir, String message) { 
     69  /** 
     70   * Check if the return code of the svn process is OK. 
     71   * 
     72   * @param process svn process 
     73   */ 
     74  private void checkProcessResult(Process process, String action) throws Exception { 
     75 
     76    try { 
     77      String errorString = new String(StreamUtils.readBytesFromInputStream(process.getErrorStream())); 
     78      throw new Exception(action + " failed due to the following error:\n" + errorString); 
     79    } catch (IOException e) { 
     80      e.printStackTrace(); 
     81      throw new Exception(action + " failed!", e); 
     82    } 
     83  } 
     84 
     85  public synchronized Pair<Boolean, String> commit(File dir, String message) throws Exception { 
    6786    message = message.replace('"', ' '); 
    6887    message = message.replace('\\', ' '); 
     
    7392    } catch (Exception e) { 
    7493      e.printStackTrace(); 
    75       return new Pair<Boolean, String>(false, "<font color=red><b>Exception: " + e.getMessage() + "</b></font>"); 
     94      throw new Exception("SVN update failed!", e); 
     95//      return new Pair<Boolean, String>(false, "<font color=red><b>Exception: " + e.getMessage() + "</b></font>"); 
    7696    } 
    7797 
     
    98118    } 
    99119 
     120    checkProcessResult(svn, "SVN update"); 
     121 
    100122    return new Pair<Boolean, String>(success, builder.toString()); 
    101123  } 
     
    106128    Process svn; 
    107129    try { 
    108       svn = ProcessUtil.exec(new String[]{"svn", "--show-updates", "status"}, dir); 
    109     } catch (Exception e) { 
    110       e.printStackTrace(); 
    111       throw new Exception("SVN status failed!"); 
     130      svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "--show-updates", "status"}, dir); 
     131    } catch (Exception e) { 
     132      e.printStackTrace(); 
     133      throw new Exception("SVN status failed!", e); 
    112134    } 
    113135 
     
    152174    Process svn = null; 
    153175    try { 
    154       svn = ProcessUtil.exec(new String[]{"svn", "resolved", file.getName()}, file.getParentFile()); 
     176      svn = ProcessUtil.exec(new String[]{"svn", "--non-interactive", "resolved", file.getName()}, file.getParentFile()); 
    155177      svn.waitFor(); 
    156178    } catch (Exception e) {