Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-22530

ArrayIndexOutOfBoundsException when parsing properties

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      a java property value can be wrapped in more than one line:

      name = value\
      split\
      in\
      more\
      lines\
      

      The code in hudson.plugins.android_emulator.util.Utils.parseConfigFile does not take this into account and tries to split every non-empty line at the = char. This causes an ArrayIndexOutOfBoundsException in the above situation.

      proposed fix:

      public static Map<String,String> parseConfigFile(File configFile) throws IOException {
      	FileReader fileReader = new FileReader(configFile);
      	BufferedReader reader = new BufferedReader(fileReader);
      	Properties properties = new Properties();
      	properties.load(reader);
      	reader.close();
      	
      	final Map<String,String> values = new HashMap<String,String>();
      	for (final Entry<Object, Object> entry : properties.entrySet()) {
      		values.put((String) entry.getKey(), (String) entry.getValue());
      	}
      
      	return values;
      }
      

        Attachments

          Activity

          bioparco Stefano Padovan created issue -
          orrc Christopher Orr made changes -
          Field Original Value New Value
          Status Open [ 1 ] In Progress [ 3 ]
          orrc Christopher Orr made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 154632 ] JNJira + In-Review [ 207594 ]

            People

            Assignee:
            bioparco Stefano Padovan
            Reporter:
            bioparco Stefano Padovan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: