Github user bhaisaab commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/735#discussion_r37953111
  
    --- Diff: 
plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java
 ---
    @@ -286,7 +287,11 @@ private void deleteExitingLinkLocalRouteTable(String 
linkLocalBr) {
                 String[] lines = parser.getLines().split("\\n");
                 for (String line : lines) {
                     String[] tokens = line.split(" ");
    -                if (!tokens[2].equalsIgnoreCase(linkLocalBr)) {
    +                if (tokens != null && tokens.length < 2) {
    +                    continue;
    +                }
    +                final String device = tokens[2];
    +                if (!Strings.isNullOrEmpty(device) && 
!device.equalsIgnoreCase(linkLocalBr)) {
    --- End diff --
    
    With respect to this specific code, I would like do this the next time we 
do a round of refactoring, possibly factor such code to a util class that can 
be used as a general purpose line parsing static method and add unit tests. For 
now, at least the code takes care of malformed inputs. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to