#199862 - StringIndexOutOfBoundsException: String index out of range: -1
authorMartin Fousek <marfous@netbeans.org>
Mon, 04 Jul 2011 13:49:41 +0200
changeset 175114055d0cc7b95
parent 17510 180ed2653ebd
child 17513 70949fcf86f2
#199862 - StringIndexOutOfBoundsException: String index out of range: -1
php.smarty/manifest.mf
php.smarty/src/org/netbeans/modules/php/smarty/editor/indent/TplIndenter.java
     1.1 --- a/php.smarty/manifest.mf	Sun Jun 26 20:48:46 2011 +0800
     1.2 +++ b/php.smarty/manifest.mf	Mon Jul 04 13:49:41 2011 +0200
     1.3 @@ -2,5 +2,5 @@
     1.4  OpenIDE-Module: org.netbeans.modules.php.smarty
     1.5  OpenIDE-Module-Layer: org/netbeans/modules/php/smarty/resources/layer.xml
     1.6  OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/php/smarty/resources/Bundle.properties
     1.7 -OpenIDE-Module-Specification-Version: 1.53
     1.8 +OpenIDE-Module-Specification-Version: 1.54
     1.9  
     2.1 --- a/php.smarty/src/org/netbeans/modules/php/smarty/editor/indent/TplIndenter.java	Sun Jun 26 20:48:46 2011 +0800
     2.2 +++ b/php.smarty/src/org/netbeans/modules/php/smarty/editor/indent/TplIndenter.java	Mon Jul 04 13:49:41 2011 +0200
     2.3 @@ -319,16 +319,19 @@
     2.4  
     2.5      private boolean isBodyCommand(String tplToken, IndenterContextData<TplTopTokenId> context) {
     2.6          String tokenText = tplToken.toLowerCase();
     2.7 +        if (tokenText.isEmpty()) return false;
     2.8          return bodyCommands.contains(tokenText) || bodyCommands.contains(tokenText.substring(1));
     2.9      }
    2.10  
    2.11      private boolean isElseCommand(String tplToken) {
    2.12          String tokenText = tplToken.toLowerCase();
    2.13 +        if (tokenText.isEmpty()) return false;
    2.14          return elseCommands.contains(tokenText) || elseCommands.contains(tokenText.substring(1));
    2.15      }
    2.16  
    2.17      private boolean isInRelatedCommand(String actualString, String comparingString) {
    2.18          if (comparingString != null && actualString != null) {
    2.19 +            if (actualString.isEmpty()) return false;
    2.20              return actualString.substring(1).equals(comparingString)
    2.21                      || (relatedCommands.get(comparingString) != null
    2.22                      && relatedCommands.get(comparingString).contains(actualString));