if (this.directory.isNegotiateContent())
extensions = getExtensions(fullEntryName); validVariant = (((extensions == null) && (this.baseExtensions == null)) || (this.baseExtensions == null) || extensions .containsAll(this.baseExtensions));  if (validVariant && this.baseExtensions.containsAll(extensions))
	private ReferenceList getVariantsReferences(boolean unique)	{		ReferenceList result = new ReferenceList(0);		try		{			Request contextCall = new Request(Method.GET, this.targetUri);			contextCall.getClientInfo().getAcceptedMediaTypes().add(					new Preference<MediaType>(MediaType.TEXT_URI_LIST));			Response contextResponse = getDispatcher().handle(contextCall);			if (contextResponse.getEntity() != null)			{				ReferenceList listVariants = new ReferenceList(contextResponse.getEntity());				Set<String> extensions = null;				String entryUri;				String fullEntryName;				String baseEntryName;				int lastSlashIndex;				int firstDotIndex;				for (Reference ref : listVariants)				{					entryUri = ref.toString();					lastSlashIndex = entryUri.lastIndexOf('/');					fullEntryName = (lastSlashIndex == -1) ? entryUri : entryUri							.substring(lastSlashIndex + 1);					baseEntryName = fullEntryName;					if (this.directory.isNegotiateContent())					{						// Remove the extensions from the base name						firstDotIndex = fullEntryName.indexOf('.');						if (firstDotIndex != -1)						{							baseEntryName = fullEntryName.substring(0, firstDotIndex);						}					}					// Check if the current file is a valid variant					if (baseEntryName.equals(this.baseName))					{						boolean validVariant = true;						if (this.directory.isNegotiateContent())						{							// Verify that the extensions are compatible							extensions = getExtensions(fullEntryName);							validVariant = (((extensions == null) && (this.baseExtensions == null))									|| (this.baseExtensions == null) || extensions									.containsAll(this.baseExtensions));							if (unique && validVariant)							{								validVariant = this.baseExtensions.containsAll(extensions);							}						}						if (validVariant)						{							result.add(ref);						}					}				}			}		}		catch (IOException ioe)		{			getLogger().log(Level.WARNING, "Unable to get resource variants", ioe);		}		return result;	}