Program: 5735
Project: 5735
Buggy source:
@Test public void testNamespaceIsolation() throws Exception {
  Id.Artifact systemAppArtifactId=Id.Artifact.from(Id.Namespace.SYSTEM,"String_Node_Str","String_Node_Str");
  File jar=createAppJar(PluginTestApp.class,new File(systemArtifactsDir1,"String_Node_Str"),createManifest(ManifestFields.EXPORT_PACKAGE,PluginTestRunnable.class.getPackage().getName()));
  artifactRepository.addSystemArtifacts();
  Assert.assertTrue(jar.delete());
  Set<ArtifactRange> parents=ImmutableSet.of(new ArtifactRange(systemAppArtifactId.getNamespace(),systemAppArtifactId.getName(),new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  NamespaceId namespace1=Ids.namespace("String_Node_Str");
  NamespaceId namespace2=Ids.namespace("String_Node_Str");
  Id.Artifact pluginArtifactId1=Id.Artifact.from(namespace1.toId(),"String_Node_Str","String_Node_Str");
  Id.Artifact pluginArtifactId2=Id.Artifact.from(namespace2.toId(),"String_Node_Str","String_Node_Str");
  try {
    Manifest manifest=createManifest(ManifestFields.EXPORT_PACKAGE,TestPlugin.class.getPackage().getName());
    File jarFile=createPluginJar(TestPlugin.class,new File(tmpDir,"String_Node_Str"),manifest);
    artifactRepository.addArtifact(pluginArtifactId1,jarFile,parents);
    artifactRepository.addArtifact(pluginArtifactId2,jarFile,parents);
    SortedMap<ArtifactDescriptor,Set<PluginClass>> extensions=artifactRepository.getPlugins(namespace1,systemAppArtifactId);
    Assert.assertEquals(1,extensions.keySet().size());
    Assert.assertEquals(2,extensions.values().iterator().next().size());
    extensions=artifactRepository.getPlugins(namespace2,systemAppArtifactId);
    Assert.assertEquals(1,extensions.keySet().size());
    Assert.assertEquals(2,extensions.values().iterator().next().size());
  }
  finally {
    artifactRepository.clear(NamespaceId.SYSTEM);
    artifactRepository.clear(namespace1);
    artifactRepository.clear(namespace2);
  }
}

Fixed version (ground truth):
@Test public void testNamespaceIsolation() throws Exception {
  Id.Artifact systemAppArtifactId=Id.Artifact.from(Id.Namespace.SYSTEM,"String_Node_Str","String_Node_Str");
  File jar=createAppJar(PluginTestApp.class,new File(systemArtifactsDir1,"String_Node_Str"),createManifest(ManifestFields.EXPORT_PACKAGE,PluginTestRunnable.class.getPackage().getName()));
  artifactRepository.addSystemArtifacts();
  Assert.assertTrue(jar.delete());
  Set<ArtifactRange> parents=ImmutableSet.of(new ArtifactRange(systemAppArtifactId.getNamespace().toEntityId(),systemAppArtifactId.getName(),new ArtifactVersion("String_Node_Str"),new ArtifactVersion("String_Node_Str")));
  NamespaceId namespace1=Ids.namespace("String_Node_Str");
  NamespaceId namespace2=Ids.namespace("String_Node_Str");
  Id.Artifact pluginArtifactId1=Id.Artifact.from(namespace1.toId(),"String_Node_Str","String_Node_Str");
  Id.Artifact pluginArtifactId2=Id.Artifact.from(namespace2.toId(),"String_Node_Str","String_Node_Str");
  try {
    Manifest manifest=createManifest(ManifestFields.EXPORT_PACKAGE,TestPlugin.class.getPackage().getName());
    File jarFile=createPluginJar(TestPlugin.class,new File(tmpDir,"String_Node_Str"),manifest);
    artifactRepository.addArtifact(pluginArtifactId1,jarFile,parents);
    artifactRepository.addArtifact(pluginArtifactId2,jarFile,parents);
    SortedMap<ArtifactDescriptor,Set<PluginClass>> extensions=artifactRepository.getPlugins(namespace1,systemAppArtifactId);
    Assert.assertEquals(1,extensions.keySet().size());
    Assert.assertEquals(2,extensions.values().iterator().next().size());
    extensions=artifactRepository.getPlugins(namespace2,systemAppArtifactId);
    Assert.assertEquals(1,extensions.keySet().size());
    Assert.assertEquals(2,extensions.values().iterator().next().size());
  }
  finally {
    artifactRepository.clear(NamespaceId.SYSTEM);
    artifactRepository.clear(namespace1);
    artifactRepository.clear(namespace2);
  }
}