private static void setUserAndGroup(TarArchiveEntry entry, FileEntry layerEntry) {
    entry.setUserId(0);
    entry.setGroupId(0);
    entry.setUserName("");
    entry.setGroupName("");

    if (!layerEntry.getOwnership().isEmpty()) {
      // Parse "<user>:<group>" string.
      String user = layerEntry.getOwnership();
      String group = "";
      int colonIndex = user.indexOf(':');
      if (colonIndex != -1) {
        group = user.substring(colonIndex + 1);
        user = user.substring(0, colonIndex);
      }

      if (!user.isEmpty()) {
        // Check if it's a number, and set either UID or user name.
        try {
          entry.setUserId(Long.parseLong(user));
        } catch (NumberFormatException ignored) {
          entry.setUserName(user);
        }
      }
      if (!group.isEmpty()) {
        // Check if it's a number, and set either GID or group name.
        try {
          entry.setGroupId(Long.parseLong(group));
        } catch (NumberFormatException ignored) {
          entry.setGroupName(group);
        }
      }
    }
  }
Adds a {@link TarArchiveEntry} if its extraction path does not exist yet. Also adds all of
the parent directories on the extraction path, if the parent does not exist. Parent will have
modification time set to {@link FileEntriesLayer#DEFAULT_MODIFICATION_TIME}.

@param tarArchiveEntry the {@link TarArchiveEntry}
@throws IOException if an I/O error occurs
jib-core/src/main/java/com/google/cloud/tools/jib/image/ReproducibleLayerBuilder.java