{
    int start = index;
    PackageInfo packageInfo = new PackageInfo();
    if (index + 1 < arguments.length && !arguments[index + 1].startsWith("-"))
    {
      packageInfo.nsURI = arguments[++index];
      if (index + 1 < arguments.length && !arguments[index + 1].startsWith("-"))
      {
        packageInfo.base = arguments[++index];
        if (index + 1 < arguments.length && !arguments[index + 1].startsWith("-"))
        {
          packageInfo.prefix = arguments[++index];
        }
      }
      if (index - start != 1 && index - start != 3)
      {
        throw new IllegalArgumentException("Error: Expecting either 1 or 3 arguments for " + arguments[start]);
      }
      else
      {
        nsURIToPackageInfo.put(packageInfo.nsURI, packageInfo);
        nsURIToPackageInfo.put(packageInfo.nsURI.toLowerCase(), packageInfo);
        return index;
      }
    }
    else
    {
      throw new IllegalArgumentException("Error: No package name was specified for " + arguments[start]);
    }
  }