title: Jenkins String index out of range: -1
body: <p>Updated Jenkins to latest version, updated all plugins and now get an String index out of range: -1 error (full log below).</p>
  
  <p>When I change authorizationStrategy from hudson.security.ProjectMatrixAuthorizationStrategy to hudson.security.FullControlOnceLoggedInAuthorizationStrategy the error is gone. I can login, basically do everything we normally do. But when we change it back, the error is there.</p>
  
  <p>Anybody any clue what to do to fix this? Or where to start debugging?</p>
  
  <p>Error log:</p>
  
  <pre><code>    at java.lang.String.substring(String.java:1967)
      at org.jenkinsci.plugins.matrixauth.AuthorizationContainer.add(AuthorizationContainer.java:76)
      at org.jenkinsci.plugins.matrixauth.AbstractAuthorizationContainerConverter.unmarshalContainer(AbstractAuthorizationContainerConverter.java:82)
      at org.jenkinsci.plugins.matrixauth.AbstractAuthorizationContainerConverter.unmarshal(AbstractAuthorizationContainerConverter.java:94)
      at hudson.util.XStream2$AssociatedConverterImpl.unmarshal(XStream2.java:464)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
  Caused: com.thoughtworks.xstream.converters.ConversionException: String index out of range: -1 : String index out of range: -1
  ---- Debugging information ----
  message             : String index out of range: -1
  cause-exception     : java.lang.StringIndexOutOfBoundsException
  cause-message       : String index out of range: -1
  class               : hudson.security.ProjectMatrixAuthorizationStrategy
  required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
  converter-type      : hudson.util.XStream2$AssociatedConverterImpl
  path                : /hudson/authorizationStrategy/denyAnonymousReadAccess
  line number         : 14
  -------------------------------
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:79)
      at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      at hudson.util.RobustReflectionConverter.unmarshalField(RobustReflectionConverter.java:391)
      at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:329)
  Caused: jenkins.util.xstream.CriticalXStreamException: String index out of range: -1 : String index out of range: -1
  ---- Debugging information ----
  message             : String index out of range: -1
  cause-exception     : java.lang.StringIndexOutOfBoundsException
  cause-message       : String index out of range: -1
  class               : hudson.security.ProjectMatrixAuthorizationStrategy
  required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
  converter-type      : hudson.util.XStream2$AssociatedConverterImpl
  path                : /hudson/authorizationStrategy/denyAnonymousReadAccess
  line number         : 14
  ------------------------------- : String index out of range: -1 : String index out of range: -1
  ---- Debugging information ----
  message             : String index out of range: -1
  cause-exception     : java.lang.StringIndexOutOfBoundsException
  cause-message       : String index out of range: -1
  class               : hudson.security.ProjectMatrixAuthorizationStrategy
  required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
  converter-type      : hudson.util.XStream2$AssociatedConverterImpl
  path                : /hudson/authorizationStrategy/denyAnonymousReadAccess
  line number         : 14
  -------------------------------
  message             : String index out of range: -1 : String index out of range: -1
  ---- Debugging information ----
  message             : String index out of range: -1
  cause-exception     : java.lang.StringIndexOutOfBoundsException
  cause-message       : String index out of range: -1
  class               : hudson.security.ProjectMatrixAuthorizationStrategy
  required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
  converter-type      : hudson.util.XStream2$AssociatedConverterImpl
  path                : /hudson/authorizationStrategy/denyAnonymousReadAccess
  line number         : 14
  -------------------------------
  cause-exception     : com.thoughtworks.xstream.converters.ConversionException
  cause-message       : String index out of range: -1 : String index out of range: -1
  class               : hudson.model.Hudson
  required-type       : hudson.security.ProjectMatrixAuthorizationStrategy
  converter-type      : hudson.util.RobustReflectionConverter
  path                : /hudson/authorizationStrategy/denyAnonymousReadAccess
  line number         : 14
  version             : not available
  -------------------------------
      at hudson.util.RobustReflectionConverter.doUnmarshal(RobustReflectionConverter.java:354)
      at hudson.util.RobustReflectionConverter.unmarshal(RobustReflectionConverter.java:268)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:72)
      at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:65)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:66)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:50)
      at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:134)
      at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:32)
      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1189)
      at hudson.util.XStream2.unmarshal(XStream2.java:161)
      at hudson.util.XStream2.unmarshal(XStream2.java:132)
      at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:1173)
      at hudson.XmlFile.unmarshal(XmlFile.java:178)
  Caused: java.io.IOException: Unable to read /var/jenkins_home/config.xml
      at hudson.XmlFile.unmarshal(XmlFile.java:181)
      at hudson.XmlFile.unmarshal(XmlFile.java:161)
      at jenkins.model.Jenkins.loadConfig(Jenkins.java:3078)
      at jenkins.model.Jenkins.access$1200(Jenkins.java:312)
      at jenkins.model.Jenkins$13.run(Jenkins.java:3180)
      at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:169)
      at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:296)
      at jenkins.model.Jenkins$5.runTask(Jenkins.java:1118)
      at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:214)
      at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
  Caused: org.jvnet.hudson.reactor.ReactorException
      at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:282)
      at jenkins.InitReactorRunner.run(InitReactorRunner.java:48)
      at jenkins.model.Jenkins.executeReactor(Jenkins.java:1152)
      at jenkins.model.Jenkins.&lt;init&gt;(Jenkins.java:959)
      at hudson.model.Hudson.&lt;init&gt;(Hudson.java:85)
      at hudson.model.Hudson.&lt;init&gt;(Hudson.java:81)
      at hudson.WebAppMain$3.run(WebAppMain.java:233)
  Caused: hudson.util.HudsonFailedToLoad
      at hudson.WebAppMain$3.run(WebAppMain.java:250)
  </code></pre>
  
  <p>Our Config:</p>
  
  <pre><code>&lt;hudson&gt;
    &lt;disabledAdministrativeMonitors&gt;
      &lt;string&gt;OldData&lt;/string&gt;
      &lt;string&gt;jenkins.security.s2m.MasterKillSwitchWarning&lt;/string&gt;
      &lt;string&gt;jenkins.security.csrf.CSRFAdministrativeMonitor&lt;/string&gt;
    &lt;/disabledAdministrativeMonitors&gt;
    &lt;version&gt;2.190.2&lt;/version&gt;
    &lt;installStateName&gt;DOWNGRADE&lt;/installStateName&gt;
    &lt;numExecutors&gt;2&lt;/numExecutors&gt;
    &lt;mode&gt;NORMAL&lt;/mode&gt;
    &lt;useSecurity&gt;true&lt;/useSecurity&gt;
    &lt;authorizationStrategy class="hudson.security.ProjectMatrixAuthorizationStrategy"&gt;
      &lt;denyAnonymousReadAccess&gt;false&lt;/denyAnonymousReadAccess&gt;
    &lt;/authorizationStrategy&gt;
    &lt;securityRealm class="hudson.security.HudsonPrivateSecurityRealm"&gt;
      &lt;disableSignup&gt;true&lt;/disableSignup&gt;
      &lt;enableCaptcha&gt;false&lt;/enableCaptcha&gt;
    &lt;/securityRealm&gt;
    &lt;disableRememberMe&gt;false&lt;/disableRememberMe&gt;
    &lt;projectNamingStrategy class="jenkins.model.ProjectNamingStrategy$DefaultProjectNamingStrategy"/&gt;
    &lt;workspaceDir&gt;${JENKINS_HOME}/workspace/${ITEM_FULL_NAME}&lt;/workspaceDir&gt;
    &lt;buildsDir&gt;${ITEM_ROOTDIR}/builds&lt;/buildsDir&gt;
    &lt;markupFormatter class="hudson.markup.EscapedMarkupFormatter"/&gt;
    &lt;jdks/&gt;
    &lt;viewsTabBar class="hudson.views.DefaultViewsTabBar"/&gt;
    &lt;myViewsTabBar class="hudson.views.DefaultMyViewsTabBar"/&gt;
    &lt;clouds/&gt;
    &lt;quietPeriod&gt;5&lt;/quietPeriod&gt;
    &lt;scmCheckoutRetryCount&gt;0&lt;/scmCheckoutRetryCount&gt;
    &lt;views&gt;
    ...
    &lt;/views&gt;                                                                                                              
    &lt;primaryView&gt;all&lt;/primaryView&gt;                                                                                        
    &lt;slaveAgentPort&gt;50000&lt;/slaveAgentPort&gt;                                                                                
    &lt;label&gt;&lt;/label&gt;                                                                                                       
    &lt;nodeProperties/&gt;                                                                                                     
    &lt;globalNodeProperties/&gt;                                                                                               
  &lt;/hudson&gt;
  </code></pre>