Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/FileSystemHelper.java @ 622:4e6179bde4fc
Update to comply with Java 1.5 target
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Mon, 20 May 2013 16:56:40 +0200 |
| parents | bd5926e24aa3 |
| children | 661e77dc88ba |
comparison
equal
deleted
inserted
replaced
| 621:99ad1e3a4e4d | 622:4e6179bde4fc |
|---|---|
| 61 command.set(command.indexOf("%2"), targetFilename); | 61 command.set(command.indexOf("%2"), targetFilename); |
| 62 execHelper.cwd(parentDir); | 62 execHelper.cwd(parentDir); |
| 63 try { | 63 try { |
| 64 execHelper.exec(command); | 64 execHelper.exec(command); |
| 65 } catch (InterruptedException ex) { | 65 } catch (InterruptedException ex) { |
| 66 throw new IOException(ex); | 66 IOException e = new IOException(); |
| 67 ex.initCause(ex); // XXX Java 1.5 | |
| 68 throw e; | |
| 67 } | 69 } |
| 68 } | 70 } |
| 69 | 71 |
| 70 public void setExecutableBit(File parentDir, String fname) throws IOException { | 72 public void setExecutableBit(File parentDir, String fname) throws IOException { |
| 71 if (chmodCmd.isEmpty()) { | 73 if (chmodCmd.isEmpty()) { |
| 75 command.set(command.indexOf("%1"), fname); | 77 command.set(command.indexOf("%1"), fname); |
| 76 execHelper.cwd(parentDir); | 78 execHelper.cwd(parentDir); |
| 77 try { | 79 try { |
| 78 execHelper.exec(command); | 80 execHelper.exec(command); |
| 79 } catch (InterruptedException ex) { | 81 } catch (InterruptedException ex) { |
| 80 throw new IOException(ex); | 82 IOException e = new IOException(); |
| 83 ex.initCause(ex); // XXX Java 1.5 | |
| 84 throw e; | |
| 81 } | 85 } |
| 82 } | 86 } |
| 83 | 87 |
| 84 public int getFileMode(File file, int defaultValue) throws IOException { | 88 public int getFileMode(File file, int defaultValue) throws IOException { |
| 85 if (statCmd.isEmpty()) { | 89 if (statCmd.isEmpty()) { |
| 88 ArrayList<String> command = new ArrayList<String>(statCmd); | 92 ArrayList<String> command = new ArrayList<String>(statCmd); |
| 89 command.set(command.indexOf("%1"), file.getAbsolutePath()); | 93 command.set(command.indexOf("%1"), file.getAbsolutePath()); |
| 90 String result = null; | 94 String result = null; |
| 91 try { | 95 try { |
| 92 result = execHelper.exec(command).toString().trim(); | 96 result = execHelper.exec(command).toString().trim(); |
| 93 if (result.isEmpty()) { | 97 if (result.length() == 0) { // XXX Java 1.5 isEmpty() |
| 94 return defaultValue; | 98 return defaultValue; |
| 95 } | 99 } |
| 96 return Integer.parseInt(result, 8); | 100 return Integer.parseInt(result, 8); |
| 97 } catch (InterruptedException ex) { | 101 } catch (InterruptedException ex) { |
| 98 throw new IOException(ex); | 102 IOException e = new IOException(); |
| 103 ex.initCause(ex); // XXX Java 1.5 | |
| 104 throw e; | |
| 99 } catch (NumberFormatException ex) { | 105 } catch (NumberFormatException ex) { |
| 100 ctx.getLog().dump(getClass(), Warn, ex, String.format("Bad value for access rights:%s", result)); | 106 ctx.getLog().dump(getClass(), Warn, ex, String.format("Bad value for access rights:%s", result)); |
| 101 return defaultValue; | 107 return defaultValue; |
| 102 } | 108 } |
| 103 } | 109 } |
