Changeset 343:7f06d669913d for kraken-linux-api/src/main/java/org/krakenapps/linux/api/RoutingTable.java
- Timestamp:
- 09/18/11 13:55:15 (8 months ago)
- Branch:
- default
- Convert:
- svn:7c3792e6-d75b-4784-96a6-b298f655ee64/trunk@2777
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kraken-linux-api/src/main/java/org/krakenapps/linux/api/RoutingTable.java
r307 r343 1 /* 2 * Copyright 2011 Future Systems 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 1 16 package org.krakenapps.linux.api; 2 17 … … 12 27 13 28 public class RoutingTable { 14 public static List<RoutingEntry> getRoutingEntries() {29 public static List<RoutingEntry> getRoutingEntries() throws IOException { 15 30 List<RoutingEntry> entries = new ArrayList<RoutingEntry>(); 16 31 java.lang.Process p = null; … … 37 52 int use = Integer.parseInt(tokens[6]); 38 53 String iface = tokens[7]; 39 entries.add(new RoutingEntry(destination, gateway, genmask, flags, metric, ref, use, iface, null, 40 null, null)); 54 entries.add(new RoutingEntry(destination, gateway, genmask, flags, metric, ref, use, iface, null, null, null)); 41 55 } else if (tokens.length == 11) { 42 56 InetAddress destination = (!tokens[0].equals("default")) ? InetAddress.getByName(tokens[0]) : null; … … 51 65 int window = Integer.parseInt(tokens[9]); 52 66 int irtt = Integer.parseInt(tokens[10]); 53 entries.add(new RoutingEntry(destination, gateway, genmask, flags, metric, ref, use, iface, mss, 54 window, irtt)); 67 entries.add(new RoutingEntry(destination, gateway, genmask, flags, metric, ref, use, iface, mss, window, irtt)); 55 68 } 56 69 } 57 } catch (IOException e) {58 e.printStackTrace();59 70 } finally { 60 71 if (p != null) 61 72 p.destroy(); 62 try { 63 if (br != null) 64 br.close(); 65 } catch (IOException e) { 66 e.printStackTrace(); 67 } 73 if (br != null) 74 br.close(); 68 75 } 69 76 … … 71 78 } 72 79 73 public static List<RoutingEntryV6> getIpv6RoutingEntries() {80 public static List<RoutingEntryV6> getIpv6RoutingEntries() throws IOException { 74 81 List<RoutingEntryV6> entries = new ArrayList<RoutingEntryV6>(); 75 82 java.lang.Process p = null; … … 106 113 entries.add(new RoutingEntryV6(destination, nextHop, mask, flags, metric, ref, use, iface)); 107 114 } 108 } catch (IOException e) {109 e.printStackTrace();110 115 } finally { 111 116 if (p != null) 112 117 p.destroy(); 113 try { 114 if (br != null) 115 br.close(); 116 } catch (IOException e) { 117 e.printStackTrace(); 118 } 118 if (br != null) 119 br.close(); 119 120 } 120 121 … … 170 171 } 171 172 172 public static RoutingEntry findRoute(InetAddress ip) {173 public static RoutingEntry findRoute(InetAddress ip) throws IOException { 173 174 int target = toInt((Inet4Address) ip); 174 175
Note: See TracChangeset
for help on using the changeset viewer.
