auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void verifyValidDestination(RepositoryObject destObj, PID pid) { RepositoryObject moveObj = repositoryObjectLoader.getRepositoryObject(pid); if (destObj instanceof AdminUnit) { if (!(moveObj instanceof CollectionObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a collection and cannot be added to an admin unit"); } } else if (destObj instanceof CollectionObject) { if (!(moveObj instanceof FolderObject) && !(moveObj instanceof WorkObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a folder or a work and cannot be added to a collection"); } } else if (destObj instanceof FolderObject) { if (!(moveObj instanceof FolderObject) && !(moveObj instanceof WorkObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a folder or a work and cannot be added to a folder"); } } else if (destObj instanceof WorkObject) { if (!(moveObj instanceof FileObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a file and cannot be added to a work"); } } else { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a container"); } }

Target:
private void verifyValidDestination(RepositoryObject destObj, PID pid) { RepositoryObject moveObj = repositoryObjectLoader.getRepositoryObject(pid); if (destObj instanceof AdminUnit) { if (!(moveObj instanceof CollectionObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a collection and cannot be added to an admin unit"); } } else if (destObj instanceof CollectionObject) { if (!(moveObj instanceof FolderObject) && !(moveObj instanceof WorkObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a folder or a work and cannot be added to a collection"); } } else if (destObj instanceof FolderObject) { if (!(moveObj instanceof FolderObject) && !(moveObj instanceof WorkObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a folder or a work and cannot be added to a folder"); } } else if (destObj instanceof WorkObject) { if (!(moveObj instanceof FileObject)) { throw new IllegalArgumentException( "Object with pid: " + pid + " is not a file and cannot be added to a work"); } } else { throw new IllegalArgumentException( "Object with pid: " + pid + " cannot be added to destination"); } }
Source:
private void startWsAgentComponents(final Iterator<Provider<WsAgentComponent>> componentProviderIterator) { if (componentProviderIterator.hasNext()) { Provider<WsAgentComponent> componentProvider = componentProviderIterator.next(); final WsAgentComponent component = componentProvider.get(); component.start(new Callback<WsAgentComponent, Exception>() { @Override public void onSuccess(WsAgentComponent result) { Log.error(component.getClass(), result); startWsAgentComponents(componentProviderIterator); } @Override public void onFailure(Exception reason) { Log.error(component.getClass(), reason); initializationFailed(reason.getMessage()); } }); } }

Target:
private void startWsAgentComponents(final Iterator<Provider<WsAgentComponent>> componentProviderIterator) { if (componentProviderIterator.hasNext()) { Provider<WsAgentComponent> componentProvider = componentProviderIterator.next(); final WsAgentComponent component = componentProvider.get(); component.start(new Callback<WsAgentComponent, Exception>() { @Override public void onSuccess(WsAgentComponent result) { startWsAgentComponents(componentProviderIterator); } @Override public void onFailure(Exception reason) { Log.error(component.getClass(), reason); initializationFailed(reason.getMessage()); } }); } }
Source:
public MerlinBuilder withRxCallbacks() { rxCallbacksManager = new RxCallbacksManager(); if (connectableRegisterer == null && disconnectableRegisterer == null) { return this.withConnectableCallbacks().withDisconnectableCallbacks(); } else if (connectableRegisterer == null) { return this.withConnectableCallbacks(); } else if (disconnectableRegisterer == null) { return this.withDisconnectableCallbacks(); } return this; }

Target:
public MerlinBuilder withRxCallbacks() { rxCallbacksManager = new RxCallbacksManager(); if (connectableRegisterer == null) { withConnectableCallbacks(); } if (disconnectableRegisterer == null) { withDisconnectableCallbacks(); } return this; }
Source:
private void waitForFeatures(Set<Feature> features) throws InterruptedException { final String featuresNamesString = StringUtils.join(features, ", "); LOGGER.trace("Waiting for features {}", featuresNamesString); long timeoutLimit = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(BUNDLE_WAIT_TIMEOUT); boolean starting = true; while (starting) { BundleStateSet bundleStates = getCurrentBundleStates(features); if (!bundleStates.getTransitionalBundles().isEmpty()) { if (System.currentTimeMillis() > timeoutLimit) { break; } if (LOGGER.isTraceEnabled()) { LOGGER.trace( "Waiting for the following bundles to become ACTIVE: {}", bundleStates .getTransitionalBundles() .stream() .map(Object::toString) .collect(Collectors.joining(", "))); } synchronized (this) { this.wait(TimeUnit.SECONDS.toMillis(1)); } } else { starting = false; } } }

Target:
private void waitForFeatures(Set<Feature> features) throws InterruptedException { final String featuresNamesString = StringUtils.join(features, ", "); LOGGER.trace("Waiting for features {}", featuresNamesString); long timeoutLimit = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(BUNDLE_WAIT_TIMEOUT); boolean starting = true; while (starting) { BundleStateSet bundleStates = getCurrentBundleStates(features); if (!bundleStates.getTransitionalBundles().isEmpty()) { if (System.currentTimeMillis() > timeoutLimit) { break; } if (LOGGER.isTraceEnabled()) { LOGGER.trace( "Waiting for the following bundles to become ACTIVE: {}", bundleStates .getTransitionalBundles() .stream() .map(Object::toString) .collect(Collectors.joining(", "))); } TimeUnit.MILLISECONDS.sleep(1); } else { starting = false; } } }
Source:
public void passivate(InternalCacheEntry entry) { Object key; if (enabled && (key = entry.getKey()) != null && (distributionManager == null || distributionManager.getLocality(key).isLocal())) { notifier.notifyCacheEntryPassivated(key, entry.getValue(), true, ImmutableContext.INSTANCE, null); if (trace) log.tracef("Passivating entry %s", key); try { MarshalledEntry marshalledEntry = marshalledEntryFactory.newMarshalledEntry(entry.getKey(), entry.getValue(), internalMetadata(entry)); persistenceManager.writeToAllStores(marshalledEntry, false); if (statsEnabled) passivations.getAndIncrement(); } catch (CacheException e) { log.unableToPassivateEntry(key, e); } notifier.notifyCacheEntryPassivated(key, null, false, ImmutableContext.INSTANCE, null); } }

Target:
public void passivate(InternalCacheEntry entry) { Object key; if (enabled && entry != null && !isL1Key(key = entry.getKey())) { notifier.notifyCacheEntryPassivated(key, entry.getValue(), true, ImmutableContext.INSTANCE, null); if (trace) log.tracef("Passivating entry %s", key); try { MarshalledEntry marshalledEntry = marshalledEntryFactory.newMarshalledEntry(entry.getKey(), entry.getValue(), internalMetadata(entry)); persistenceManager.writeToAllStores(marshalledEntry, false); if (statsEnabled) passivations.getAndIncrement(); } catch (CacheException e) { log.unableToPassivateEntry(key, e); } notifier.notifyCacheEntryPassivated(key, null, false, ImmutableContext.INSTANCE, null); } }
Source:
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { if (beanName != null && !bean.equals(null) && beanFactory.containsBean(beanName) && !beanFactory.isSingleton(beanName)) { return bean; } Class<?> targetClass = bean.getClass(); final ClassLoader classLoader = targetClass.getClassLoader(); if (parameterResolverFactory == null) { parameterResolverFactory = ClasspathParameterResolverFactory.forClassLoader(classLoader); } if (handlerDefinition == null) { handlerDefinition = ClasspathHandlerDefinition.forClassLoader(classLoader); } if (isPostProcessingCandidate(targetClass)) { T adapter = initializeAdapterFor(bean, parameterResolverFactory, handlerDefinition); return createAdapterProxy(bean, adapter, getAdapterInterfaces(), true, classLoader); } else if (!isInstance(bean, getAdapterInterfaces()) && isPostProcessingCandidate(AopProxyUtils.ultimateTargetClass(bean))) { try { Object targetBean = ((Advised) bean).getTargetSource().getTarget(); Object proxyInvokingBean = createJavaProxyInvoker(bean, targetBean); T adapter = initializeAdapterFor(proxyInvokingBean, parameterResolverFactory, handlerDefinition); return createAdapterProxy(proxyInvokingBean, adapter, getAdapterInterfaces(), false, classLoader); } catch (Exception e) { throw new AxonConfigurationException("Unable to wrap annotated handler.", e); } } return bean; }

Target:
public Object postProcessAfterInitialization(final Object bean, final String beanName) throws BeansException { if (beanName != null && !isNullBean(bean) && beanFactory.containsBean(beanName) && !beanFactory.isSingleton(beanName)) { return bean; } Class<?> targetClass = bean.getClass(); final ClassLoader classLoader = targetClass.getClassLoader(); if (parameterResolverFactory == null) { parameterResolverFactory = ClasspathParameterResolverFactory.forClassLoader(classLoader); } if (handlerDefinition == null) { handlerDefinition = ClasspathHandlerDefinition.forClassLoader(classLoader); } if (isPostProcessingCandidate(targetClass)) { T adapter = initializeAdapterFor(bean, parameterResolverFactory, handlerDefinition); return createAdapterProxy(bean, adapter, getAdapterInterfaces(), true, classLoader); } else if (!isInstance(bean, getAdapterInterfaces()) && isPostProcessingCandidate(AopProxyUtils.ultimateTargetClass(bean))) { try { Object targetBean = ((Advised) bean).getTargetSource().getTarget(); Object proxyInvokingBean = createJavaProxyInvoker(bean, targetBean); T adapter = initializeAdapterFor(proxyInvokingBean, parameterResolverFactory, handlerDefinition); return createAdapterProxy(proxyInvokingBean, adapter, getAdapterInterfaces(), false, classLoader); } catch (Exception e) { throw new AxonConfigurationException("Unable to wrap annotated handler.", e); } } return bean; }
Source:
private List<AliasMetaData> convertAliasResponse(String aliasResponse) { ObjectMapper mapper = new ObjectMapper(); try { JsonNode node = mapper.readTree(aliasResponse); node = node.findValue("aliases"); if (node == null) return Collections.emptyList(); Map<String, AliasData> aliasData = mapper.readValue(mapper.writeValueAsString(node), new TypeReference<Map<String, AliasData>>() {}); Iterable<Map.Entry<String, AliasData>> aliasIter = aliasData.entrySet(); List<AliasMetaData> aliasMetaDataList = new ArrayList<AliasMetaData>(); for (Map.Entry<String, AliasData> aliasentry : aliasIter) { AliasData data = aliasentry.getValue(); aliasMetaDataList.add(AliasMetaData.newAliasMetaDataBuilder(aliasentry.getKey()).filter(data.getFilter()) .routing(data.getRouting()).searchRouting(data.getSearch_routing()).indexRouting(data.getIndex_routing()) .build()); } return aliasMetaDataList; } catch (IOException e) { throw new ElasticsearchException("Could not map alias response : " + aliasResponse, e); } }

Target:
private List<AliasMetaData> convertAliasResponse(String aliasResponse) { ObjectMapper mapper = new ObjectMapper(); try { JsonNode node = mapper.readTree(aliasResponse); node = node.findValue("aliases"); if (node == null) { return Collections.emptyList(); } Map<String, AliasData> aliasData = mapper.readValue(mapper.writeValueAsString(node), new TypeReference<Map<String, AliasData>>() {}); Iterable<Map.Entry<String, AliasData>> aliasIter = aliasData.entrySet(); List<AliasMetaData> aliasMetaDataList = new ArrayList<AliasMetaData>(); for (Map.Entry<String, AliasData> aliasentry : aliasIter) { AliasData data = aliasentry.getValue(); aliasMetaDataList.add(AliasMetaData.newAliasMetaDataBuilder(aliasentry.getKey()).filter(data.getFilter()) .routing(data.getRouting()).searchRouting(data.getSearch_routing()).indexRouting(data.getIndex_routing()) .build()); } return aliasMetaDataList; } catch (IOException e) { throw new ElasticsearchException("Could not map alias response : " + aliasResponse, e); } }
Source:
public Optional<Map<DecoderColumnHandle, FieldValueProvider>> decodeRow(byte[] data, Map<String, String> dataMap) { GenericRecord avroRecord; try { DataFileStream<GenericRecord> dataFileReader = new DataFileStream<>(new ByteArrayInputStream(data), avroRecordReader); if (!dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "No avro record found"); } avroRecord = dataFileReader.next(); if (dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unexpected extra record found"); } } catch (Exception e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Decoding AVRO record failed.", e); } return Optional.of(columnDecoders.entrySet().stream() .collect(toImmutableMap( Map.Entry::getKey, entry -> entry.getValue().decodeField(avroRecord)))); }

Target:
public Optional<Map<DecoderColumnHandle, FieldValueProvider>> decodeRow(byte[] data, Map<String, String> dataMap) { GenericRecord avroRecord; DataFileStream<GenericRecord> dataFileReader = null; try { dataFileReader = new DataFileStream<>(new ByteArrayInputStream(data), avroRecordReader); if (!dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "No avro record found"); } avroRecord = dataFileReader.next(); if (dataFileReader.hasNext()) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unexpected extra record found"); } } catch (Exception e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Decoding AVRO record failed.", e); } finally { closeQuietly(dataFileReader); } return Optional.of(columnDecoders.entrySet().stream() .collect(toImmutableMap( Map.Entry::getKey, entry -> entry.getValue().decodeField(avroRecord)))); }
Source:
public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult result = new SwaggerParseResult(); try { JsonNode node = YAML_MAPPER.readValue(new URL(url), JsonNode.class); if(node != null && node.get("openapi") != null) { JsonNode version = node.get("openapi"); if(version.asText() != null && version.asText().startsWith("3.0")) { result.setOpenAPI(new OpenAPIResolver(new OpenAPIDeserializer().deserialize(node).getOpenAPI(),null,null).resolve()); } } } catch (Exception e) { result.setMessages(Arrays.asList(e.getMessage())); } return result; }

Target:
public SwaggerParseResult readLocation(String url, List<AuthorizationValue> auth, ParseOptions options) { SwaggerParseResult result = new SwaggerParseResult(); try { JsonNode node = YAML_MAPPER.readValue(new URL(url), JsonNode.class); if(node != null && node.get("openapi") != null) { JsonNode version = node.get("openapi"); if(auth == null) { auth = new ArrayList<>(); } if(version.asText() != null && version.asText().startsWith("3.0")) { if (options != null) { if (options.isResolve()) { result.setOpenAPI(new OpenAPIResolver(new OpenAPIDeserializer().deserialize(node).getOpenAPI(), auth, null).resolve()); }else{ result = new OpenAPIDeserializer().deserialize(node); } }else{ result = new OpenAPIDeserializer().deserialize(node); } } } } catch (Exception e) { result.setMessages(Arrays.asList(e.getMessage())); } return result; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout insertPoint = (RelativeLayout) findViewById(R.id.fragment_container); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.view_course_unit_pager, null); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); pager2 = findViewById(R.id.pager2); pagerAdapter = new CourseUnitPagerAdapter(this, environment.getConfig(), unitList, courseData, courseUpgradeData, this); pager2.setAdapter(pagerAdapter); pager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { private boolean firstPageLoad = true; @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { invalidateOptionsMenu(); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager2.SCROLL_STATE_IDLE) { tryToUpdateForEndOfSequential(); } } }); findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE); mPreviousBtn.setOnClickListener(view -> navigatePreviousComponent()); mNextBtn.setOnClickListener(view -> navigateNextComponent()); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout insertPoint = (RelativeLayout) findViewById(R.id.fragment_container); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.view_course_unit_pager, null); insertPoint.addView(v, 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); pager2 = findViewById(R.id.pager2); pagerAdapter = new CourseUnitPagerAdapter(this, environment.getConfig(), unitList, courseData, courseUpgradeData, this); pager2.setAdapter(pagerAdapter); pager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { invalidateOptionsMenu(); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager2.SCROLL_STATE_IDLE) { tryToUpdateForEndOfSequential(); } } }); UiUtil.enforceSingleScrollDirection(pager2); findViewById(R.id.course_unit_nav_bar).setVisibility(View.VISIBLE); mPreviousBtn.setOnClickListener(view -> navigatePreviousComponent()); mNextBtn.setOnClickListener(view -> navigateNextComponent()); }
Source:
private void doConnect(String host, int port) throws IOException { Stream stream; streamLock.lock(); stream = this.stream; streamLock.unlock(); if (stream != null) throw new SocketException("Already connected"); try { stream = torClient.openExitStreamTo(host, port); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SocketException("connect() interrupted"); } catch (TimeoutException e) { throw new SocketTimeoutException(); } catch (OpenFailedException e) { throw new ConnectException(e.getMessage()); } streamLock.lock(); this.stream = stream; streamLock.unlock(); }

Target:
private void doConnect(String host, int port) throws IOException { Stream stream; streamLock.lock(); stream = this.stream; streamLock.unlock(); if (stream != null) throw new SocketException("Already connected"); try { stream = torClient.openExitStreamTo(host, port); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new SocketException("connect() interrupted"); } catch (TimeoutException e) { throw new SocketTimeoutException(); } catch (OpenFailedException e) { throw new ConnectException(e.getMessage()); } streamLock.lock(); if (this.stream != null) { streamLock.unlock(); stream.close(); } else { this.stream = stream; streamLock.unlock(); } }
Source:
public static Thread runInNewDaemonThread(final Runnable runnable) { if (!isDaemonThread()) { throw new APIAuthenticationException("Only daemon threads can spawn new daemon threads"); } DaemonThread thread = new DaemonThread() { @Override public void run() { isDaemonThread.set(true); try { Context.openSession(); new Thread(runnable).start(); } finally { Context.closeSession(); } } }; thread.start(); return thread; }

Target:
public static Thread runInNewDaemonThread(final Runnable runnable) { if (!isDaemonThread()) { throw new APIAuthenticationException("Only daemon threads can spawn new daemon threads"); } DaemonThread thread = new DaemonThread() { @Override public void run() { isDaemonThread.set(true); try { Context.openSession(); runnable.run(); } finally { Context.closeSession(); } } }; thread.start(); return thread; }
Source:
public void testSimpleSync() throws Exception { queue.enqueueAck(getDummyLogEventBuilder().setId("123").setConsistencyLevel(Timber.ConsistencyLevel.SYNC).build()); assertEquals(0, queue.size()); assertNotNull(mockChannel.getWriteObject()); assertEquals("123", ((Timber.AckEvent) mockChannel.getWriteObject()).getId(0)); }

Target:
public void testSimpleSync() throws Exception { queue.enqueueAck(newDummyLogEventBuilder().setId("123").setConsistencyLevel(Timber.ConsistencyLevel.SYNC).build()); assertEquals(0, queue.size()); assertNotNull(mockChannel.getWrittenObject()); assertEquals("123", ((Timber.AckEvent) mockChannel.getWrittenObject()).getId(0)); }
Source:
private void updateAPAIArtifactsForAccessControl() throws APIMigrationException { log.info("Updating API artifacts for Publisher Access Control started."); for (Tenant tenant : getTenantsArray()) { try { registryService.startTenantFlow(tenant); log.info("Updating APIs for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); GenericArtifact[] artifacts = registryService.getGenericAPIArtifacts(); for (GenericArtifact artifact : artifacts) { String path = artifact.getPath(); if (registryService.isGovernanceRegistryResourceExists(path)) { Object apiResource = registryService.getGovernanceRegistryResource(path); if (apiResource == null) { continue; } registryService.updateGenericAPIArtifactsForAccessControl(path, artifact); } } log.info("End Updating API artifacts tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); } catch (GovernanceException e) { log.error("Error when accessing API artifact in registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (RegistryException e) { log.error("Error while updating API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (UserStoreException e) { log.error("Error while updating the API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } finally { registryService.endTenantFlow(); } } log.info("Updating API artifacts done for all the tenants for Publisher Access Control feature."); }

Target:
private void updateAPAIArtifactsForAccessControl() throws APIMigrationException { log.info("Updating API artifacts for Publisher Access Control started."); for (Tenant tenant : getTenantsArray()) { try { registryService.startTenantFlow(tenant); log.debug("Updating APIs for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); GenericArtifact[] artifacts = registryService.getGenericAPIArtifacts(); for (GenericArtifact artifact : artifacts) { String path = artifact.getPath(); if (registryService.isGovernanceRegistryResourceExists(path)) { Object apiResource = registryService.getGovernanceRegistryResource(path); if (apiResource == null) { continue; } registryService.updateGenericAPIArtifactsForAccessControl(path, artifact); } } log.info("End Updating API artifacts tenant " + tenant.getId() + '(' + tenant.getDomain() + ')'); } catch (GovernanceException e) { log.error("Error when accessing API artifact in registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (RegistryException e) { log.error("Error while updating API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } catch (UserStoreException e) { log.error("Error while updating the API artifact in the registry for tenant " + tenant.getId() + '(' + tenant.getDomain() + ')', e); } finally { registryService.endTenantFlow(); } } log.info("Updating API artifacts done for all the tenants for Publisher Access Control feature."); }
Source:
public void testConfLinkRegexNamedGroupMapping() throws Exception { conf.setBoolean(CONFIG_VIEWFS_ENABLE_INNER_CACHE, false); URI viewFsUri = new URI(FsConstants.VIEWFS_SCHEME, CLUSTER_NAME, "/", null, null); String regexStr = "^/(?<firstDir>\\w+)"; String dstPathStr = targetTestRoot + "$firstDir"; Path srcPath = new Path("/testConfLinkRegexNamedGroupMapping1"); Path expectedResolveResult = new Path( dstPathStr.replace("$firstDir", "testConfLinkRegexNamedGroupMapping1")); FSDataOutputStream outputStream = fsTarget.create((expectedResolveResult)); fsTarget.listStatus(expectedResolveResult); outputStream.close(); ConfigUtil.addLinkRegex(conf, CLUSTER_NAME, regexStr, dstPathStr, null); FileSystem vfs = FileSystem.get(viewFsUri, conf); Assert.assertTrue(expectedResolveResult.equals(vfs.resolvePath(srcPath))); Assert.assertEquals(0L, vfs.getFileStatus(srcPath).getLen()); dstPathStr = targetTestRoot + "${firstDir}"; srcPath = new Path("/testConfLinkRegexNamedGroupMapping2"); expectedResolveResult = new Path(dstPathStr .replace("${firstDir}", "testConfLinkRegexNamedGroupMapping2")); outputStream = fsTarget.create(expectedResolveResult); fsTarget.listStatus(expectedResolveResult); outputStream.close(); ConfigUtil.addLinkRegex(conf, CLUSTER_NAME, regexStr, dstPathStr, null); vfs = FileSystem.get(viewFsUri, conf); Assert.assertTrue(expectedResolveResult.equals(vfs.resolvePath(srcPath))); Assert.assertEquals(0L, vfs.getFileStatus(srcPath).getLen()); }

Target:
public void testConfLinkRegexNamedGroupMapping() throws Exception { URI viewFsUri = new URI( FsConstants.VIEWFS_SCHEME, CLUSTER_NAME, "/", null, null); String regexStr = "^/(?<firstDir>\\w+)"; String dstPathStr = targetTestRoot + "$firstDir"; Path srcPath = new Path("/testConfLinkRegexNamedGroupMapping1"); Path expectedResolveResult = new Path( dstPathStr.replace("$firstDir", "testConfLinkRegexNamedGroupMapping1")); testRegexMountpoint( new Configuration(conf), regexStr, dstPathStr, null, srcPath, expectedResolveResult, 3); dstPathStr = targetTestRoot + "${firstDir}"; srcPath = new Path("/testConfLinkRegexNamedGroupMapping2"); expectedResolveResult = new Path( dstPathStr.replace( "${firstDir}", "testConfLinkRegexNamedGroupMapping2")); testRegexMountpoint( new Configuration(conf), regexStr, dstPathStr, null, srcPath, expectedResolveResult, 5); }
Source:
public Collection<SmeltingRecipe> getRecipes() { ImmutableList.Builder<SmeltingRecipe> builder = ImmutableList.builder(); for (Map.Entry<ItemStack, ItemStack> smeltingEntry : smeltingList.entrySet()) { ItemStack nativeIngredient = smeltingEntry.getKey(); if (!nativeIngredientToCustomRecipe.containsKey(nativeIngredient)) { ItemStack nativeExemplaryResult = smeltingEntry.getValue(); ItemStackSnapshot exemplaryResult = ItemStackUtil.snapshotOf(nativeExemplaryResult); ItemStackSnapshot exemplaryIngredient = ItemStackUtil.snapshotOf(nativeIngredient); Predicate<ItemStackSnapshot> ingredientPredicate = new MatchSmeltingVanillaItemStack(exemplaryIngredient); double experience = (double) experienceList.get(nativeExemplaryResult); builder.add(new SpongeSmeltingRecipe(exemplaryResult, exemplaryIngredient, ingredientPredicate, experience)); } } builder.addAll(customRecipes); return builder.build(); }

Target:
public Collection<SmeltingRecipe> getRecipes() { ImmutableList.Builder<SmeltingRecipe> builder = ImmutableList.builder(); for (Map.Entry<ItemStack, ItemStack> smeltingEntry : this.smeltingList.entrySet()) { ItemStack nativeIngredient = smeltingEntry.getKey(); if (!this.nativeIngredientToCustomRecipe.containsKey(nativeIngredient)) { ItemStack nativeExemplaryResult = smeltingEntry.getValue(); ItemStackSnapshot exemplaryResult = ItemStackUtil.snapshotOf(nativeExemplaryResult); ItemStackSnapshot exemplaryIngredient = ItemStackUtil.snapshotOf(nativeIngredient); Predicate<ItemStackSnapshot> ingredientPredicate = new MatchSmeltingVanillaItemStack(exemplaryIngredient); double experience = (double) this.experienceList.get(nativeExemplaryResult); builder.add(new SpongeSmeltingRecipe(exemplaryResult, exemplaryIngredient, ingredientPredicate, experience)); } } builder.addAll(this.customRecipes); return builder.build(); }
Source:
Result okResult(ObjectWriter writer, Object object) throws JsonGenerationException, JsonMappingException, IOException { String jsonString = writer.writeValueAsString(object); return okResult(BridgeObjectMapper.get().readTree(jsonString)); }

Target:
Result okResult(ObjectWriter writer, Object object) throws JsonGenerationException, JsonMappingException, IOException { return ok( writer.writeValueAsString(object) ).as(BridgeConstants.JSON_MIME_TYPE); }
Source:
protected void handleIdle() { if (streams.isEmpty()) { return; } super.handleIdle(); }

Target:
protected void handleIdle() { synchronized (this) { if (streams.isEmpty()) { return; } } super.handleIdle(); }
Source:
public String createFunctionDefinitionSignature(IProgressMonitor monitor) { try { ModificationCollector collector = new ModificationCollector(); ImplementMethodRefactoring implementMethodRefactoring = (ImplementMethodRefactoring) wizard .getRefactoring(); CCompositeChange finalChange = null; synchronized (implementMethodRefactoring) { implementMethodRefactoring.createDefinition(collector, config, monitor, -1); finalChange = collector.createFinalChange(); } InsertEdit insertEdit = getInsertEdit(finalChange); if (insertEdit == null) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } return insertEdit.getText().trim(); } catch (OperationCanceledException e) { return Messages.ImplementMethodRefactoringPage_PreviewCanceled; } catch (CoreException e) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } }

Target:
public String createFunctionDefinitionSignature(IProgressMonitor monitor) { try { ModificationCollector collector = new ModificationCollector(); ImplementMethodRefactoring implementMethodRefactoring = (ImplementMethodRefactoring) wizard .getRefactoring(); CCompositeChange finalChange = null; synchronized (implementMethodRefactoring) { implementMethodRefactoring.createDefinition(collector, config, monitor); finalChange = collector.createFinalChange(); } InsertEdit insertEdit = getInsertEdit(finalChange); if (insertEdit == null) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } return insertEdit.getText().trim(); } catch (OperationCanceledException e) { return Messages.ImplementMethodRefactoringPage_PreviewCanceled; } catch (CoreException e) { return Messages.ImplementMethodRefactoringPage_PreviewGenerationNotPossible; } }
Source:
public void validation() throws JSONException { JSONObject jsonObject; ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(new Properties())); try { jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); new DataNode(null, jsonObject, clusterMapConfig); fail("Should have failed validation."); } catch (IllegalStateException e) { } jsonObject = TestUtils.getJsonDataNode("", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode("hostname.invalid", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), -1, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, -1, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 100 * 1000, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 100* 1000, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); }

Target:
public void validation() throws JSONException { JSONObject jsonObject; ClusterMapConfig clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(new Properties())); try { jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); new DataNode(null, jsonObject, clusterMapConfig); fail("Should have failed validation."); } catch (IllegalStateException e) { } jsonObject = TestUtils.getJsonDataNode("", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode("hostname.invalid", 6666, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), -1, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, -1, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 100 * 1000, 7666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 100 * 1000, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 6666, HardwareState.AVAILABLE, getDisks()); failValidation(jsonObject, clusterMapConfig); }
Source:
public void destroy() throws Exception { super.destroy(); server.shutdown(); logger.info(this.getName() + " destroyed..."); }

Target:
public void destroy() throws Exception { try { super.destroy(); server.shutdown(); logger.info(this.getName() + " destroyed..."); }catch(Exception e) { logger.error("failed to cleanup RestAPI command processor", e); throw e; } }
Source:
public void testEmailAction() throws Exception { ETLStage action = new ETLStage( "email", new ETLPlugin("Email", PostAction.PLUGIN_TYPE, ImmutableMap.of("recipientEmailAddress", "to@test.com", "senderEmailAddress", "from@test.com", "message", "testing body", "subject", "Test", "port", Integer.toString(port)), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addPostAction(action) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "actionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager("ETLWorkflow"); manager.start(); manager.waitForFinish(5, TimeUnit.MINUTES); server.stop(); Assert.assertEquals(1, server.getReceivedEmailSize()); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); Assert.assertEquals("Test", email.getHeaderValue("Subject")); Assert.assertTrue(email.getBody().startsWith("testing body")); Assert.assertFalse(emailIter.hasNext()); }

Target:
public void testEmailAction() throws Exception { ETLStage action = new ETLStage( "email", new ETLPlugin("Email", PostAction.PLUGIN_TYPE, ImmutableMap.of("recipients", "to@test.com", "sender", "from@test.com", "message", "testing body", "subject", "Test", "port", Integer.toString(port)), null)); ETLStage source = new ETLStage("source", new ETLPlugin("KVTable", BatchSource.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSource"), null)); ETLStage sink = new ETLStage("sink", new ETLPlugin("KVTable", BatchSink.PLUGIN_TYPE, ImmutableMap.of("name", "emailTestSink"), null)); ETLBatchConfig etlConfig = ETLBatchConfig.builder("* * * * *") .addStage(source) .addStage(sink) .addPostAction(action) .addConnection(source.getName(), sink.getName()) .build(); AppRequest<ETLBatchConfig> appRequest = new AppRequest<>(ETLBATCH_ARTIFACT, etlConfig); Id.Application appId = Id.Application.from(Id.Namespace.DEFAULT, "actionTest"); ApplicationManager appManager = deployApplication(appId, appRequest); WorkflowManager manager = appManager.getWorkflowManager("ETLWorkflow"); manager.start(); manager.waitForFinish(5, TimeUnit.MINUTES); server.stop(); Assert.assertEquals(1, server.getReceivedEmailSize()); Iterator emailIter = server.getReceivedEmail(); SmtpMessage email = (SmtpMessage) emailIter.next(); Assert.assertEquals("Test", email.getHeaderValue("Subject")); Assert.assertTrue(email.getBody().startsWith("testing body")); Assert.assertFalse(emailIter.hasNext()); }
Source:
public Stream<Datastream> getAllDatastreams() { return _zkClient.getChildren(_rootPath).stream().sorted().map(this::getDatastream).filter(stream -> stream != null); }

Target:
public Stream<String> getAllDatastreams() { return _datastreamList.stream().sorted(); }
Source:
public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; modCount += n; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }

Target:
public synchronized void remove(int n) throws IOException { if (isEmpty()) { throw new NoSuchElementException(); } if (n < 0) { throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements."); } if (n == 0) { return; } if (n == elementCount) { clear(); return; } if (n > elementCount) { throw new IllegalArgumentException( "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ")."); } final int eraseStartPosition = first.position; int eraseTotalLength = 0; int newFirstPosition = first.position; int newFirstLength = first.length; for (int i = 0; i < n; i++) { eraseTotalLength += Element.HEADER_LENGTH + newFirstLength; newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength); ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH); newFirstLength = readInt(buffer, 0); } writeHeader(fileLength, elementCount - n, newFirstPosition, last.position); elementCount -= n; modCount++; first = new Element(newFirstPosition, newFirstLength); ringErase(eraseStartPosition, eraseTotalLength); }
Source:
private int getNumberOfManagedClusteredFileSystemsInComputeCluster(long zoneId, long clusterId) { int numberOfManagedClusteredFileSystemsInComputeCluster = 0; List<VolumeVO> volumes = volumeDao.findByDc(zoneId); if (volumes == null || volumes.size() == 0) { return numberOfManagedClusteredFileSystemsInComputeCluster; } for (VolumeVO volume : volumes) { Long instanceId = volume.getInstanceId(); if (instanceId != null) { VMInstanceVO vmInstanceVO = vmInstanceDao.findById(instanceId); if (vmInstanceVO != null) { Long vmHostId = vmInstanceVO.getHostId(); if (vmHostId == null) { vmHostId = vmInstanceVO.getLastHostId(); } if (vmHostId != null) { HostVO vmHostVO = hostDao.findById(vmHostId); if (vmHostVO != null) { Long vmHostClusterId = vmHostVO.getClusterId(); if (vmHostClusterId != null && vmHostClusterId == clusterId) { StoragePoolVO storagePoolVO = storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { numberOfManagedClusteredFileSystemsInComputeCluster++; } } } } } } } return numberOfManagedClusteredFileSystemsInComputeCluster; }

Target:
private int getNumberOfManagedClusteredFileSystemsInComputeCluster(long zoneId, long clusterId) { int numberOfManagedClusteredFileSystemsInComputeCluster = 0; List<VolumeVO> volumes = volumeDao.findByDc(zoneId); if (CollectionUtils.isEmpty(volumes)) { return numberOfManagedClusteredFileSystemsInComputeCluster; } for (VolumeVO volume : volumes) { Long instanceId = volume.getInstanceId(); if (instanceId == null) { continue; } VMInstanceVO vmInstanceVO = vmInstanceDao.findById(instanceId); if (vmInstanceVO == null) { continue; } Long vmHostId = vmInstanceVO.getHostId(); if (vmHostId == null) { vmHostId = vmInstanceVO.getLastHostId(); } if (vmHostId == null) { continue; } HostVO vmHostVO = hostDao.findById(vmHostId); if (vmHostVO == null) { continue; } Long vmHostClusterId = vmHostVO.getClusterId(); if (vmHostClusterId != null && vmHostClusterId == clusterId) { StoragePoolVO storagePoolVO = storagePoolDao.findById(volume.getPoolId()); if (storagePoolVO != null && storagePoolVO.isManaged()) { numberOfManagedClusteredFileSystemsInComputeCluster++; } } } return numberOfManagedClusteredFileSystemsInComputeCluster; }
Source:
private Map<String, Set<String>> getIndividualPermission( ShareableMetacardImpl shareableMetacard) { return ImmutableMap.of( Security.ACCESS_INDIVIDUALS, Optional.of(shareableMetacard) .map(w -> w.getAttribute(Security.ACCESS_INDIVIDUALS)) .map(Attribute::getValues) .orElseGet(Collections::emptyList) .stream() .map(Object::toString) .collect(Collectors.toSet())); }

Target:
private Map<String, Set<String>> getIndividualPermission( ShareableMetacardImpl shareableMetacard) { return ImmutableMap.of(Security.ACCESS_INDIVIDUALS, shareableMetacard.getAccessIndividuals()); }
Source:
public void visitToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: if (isVerifiable(ast)) { visitMethodDef(ast); } break; case TokenTypes.TYPE_UPPER_BOUNDS: case TokenTypes.TYPE_ARGUMENT: visitGenericArgumentDef(ast); break; case TokenTypes.VARIABLE_DEF: if (isVerifiable(ast)) { visitVariableDef(ast); } break; case TokenTypes.PARAMETER_DEF: visitParameterDef(ast); break; case TokenTypes.IMPORT: visitImport(ast); break; default: throw new IllegalStateException(ast.toString()); } }

Target:
public void visitToken(DetailAST ast) { switch (ast.getType()) { case TokenTypes.METHOD_DEF: if (isVerifiable(ast)) { visitMethodDef(ast); } break; case TokenTypes.VARIABLE_DEF: if (isVerifiable(ast)) { visitVariableDef(ast); } break; case TokenTypes.PARAMETER_DEF: visitParameterDef(ast); break; case TokenTypes.IMPORT: visitImport(ast); break; default: throw new IllegalStateException(ast.toString()); } }
Source:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); em.getTransaction().begin(); try { String findTaskErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.activityId in (select at.taskId from AuditTaskImpl at where status in (:status))"; errorsToAck = em.createQuery(findTaskErrorsQuery) .setParameter("type", TaskExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(Status.Completed.toString(), Status.Exited.toString(), Status.Failed.toString(), Status.Obsolete.toString(), Status.Error.toString())) .getResultList(); em.getTransaction().commit(); } catch (Exception e) { logger.error("Execution error in command TaskAutoAckErrorCommand", e); em.getTransaction().rollback(); } return errorsToAck; }

Target:
protected List<ExecutionErrorInfo> findErrorsToAck(EntityManager em) { List<ExecutionErrorInfo> errorsToAck = new ArrayList<>(); TransactionManager txm = TransactionManagerFactory.get().newTransactionManager(); boolean txOwner = txm.begin(); try { String findTaskErrorsQuery = "select error from ExecutionErrorInfo error " + "where error.type = :type " + "and error.acknowledged =:acknowledged " + "and error.activityId in (select at.taskId from AuditTaskImpl at where status in (:status))"; errorsToAck = em.createQuery(findTaskErrorsQuery, ExecutionErrorInfo.class) .setParameter("type", TaskExecutionErrorFilter.TYPE) .setParameter("acknowledged", new Short("0")) .setParameter("status", Arrays.asList(Status.Completed.toString(), Status.Exited.toString(), Status.Failed.toString(), Status.Obsolete.toString(), Status.Error.toString())) .getResultList(); txm.commit(txOwner); } catch (Exception e) { logger.error("Execution error in command TaskAutoAckErrorCommand", e); txm.rollback(txOwner); } return errorsToAck; }
Source:
protected String getProgressText(T object) { Integer progressValue = getProgressValue(object); if (progressValue != null && progressValue >= 100) { return "Exceeded"; } if (progressValue != null && progressValue < 0) { return "Unlimited"; } return progressValue != null ? progressValue + "%" : "0%"; }

Target:
protected String getProgressText(T object) { Integer progressValue = getProgressValue(object); if (progressValue != null && progressValue >= 100) { return getaApplicationConstants().exceeded(); } if (progressValue != null && progressValue < 0) { return getaApplicationConstants().unlimited(); } return progressValue != null ? progressValue + "%" : "0%"; }
Source:
public static void refreshEntity(Object obj) { log.trace("clearing session"); getContextDAO().refreshEntity(obj); }

Target:
public static void refreshEntity(Object obj) { log.trace("refreshing object: "+obj); getContextDAO().refreshEntity(obj); }
Source:
protected static String generateMetricsPrefix(String connectorName, String simpleClassName) { return StringUtils.isBlank(connectorName) ? simpleClassName : connectorName + "_" + simpleClassName; }

Target:
protected static String generateMetricsPrefix(String connectorName, String simpleClassName) { return StringUtils.isBlank(connectorName) ? simpleClassName : connectorName + "." + simpleClassName; }
Source:
public Collection<Artifact> performSearch(boolean exactMatch) throws OseeCoreException { List<Artifact> results = new ArrayList<Artifact>(); if (values != null && values.size() > 0) { for (String value : values) { List<Artifact> searchResult = ArtifactQuery.getArtifactListFromAttributeKeywords(AtsUtil.getAtsBranch(), value, false, EXCLUDE_DELETED, false, attributeType); if (exactMatch) { List<Artifact> removeArts = new ArrayList<Artifact>(); for (Artifact artifact : searchResult) { boolean found = false; for (String value2 : values) { if (artifact.getAttributesToStringList(attributeType).contains(value2)) { found = true; break; } } if (found) { results.add(artifact); } else { removeArts.add(artifact); } } searchResult.removeAll(removeArts); } else { results.addAll(searchResult); } } } return results; }

Target:
public Collection<Artifact> performSearch(boolean exactMatch) throws OseeCoreException { List<Artifact> results = new ArrayList<Artifact>(); if (values != null && values.size() > 0) { for (String value : values) { List<Artifact> searchResult = ArtifactQuery.getArtifactListFromAttributeKeywords(AtsUtil.getAtsBranch(), value, false, EXCLUDE_DELETED, false, attributeType); if (exactMatch) { for (Artifact artifact : searchResult) { boolean found = false; for (String value2 : values) { if (artifact.getAttributesToStringList(attributeType).contains(value2)) { found = true; break; } } if (found) { results.add(artifact); } } } else { results.addAll(searchResult); } } } return results; }
Source:
private static String getBuildRevision(Run<?, ?> build) { BuildData action = build.getAction(BuildData.class); try { Field lastBuildField = action.getClass().getDeclaredField("lastBuild"); lastBuildField.setAccessible(true); Build lastBuild = (Build) lastBuildField.get(action); return lastBuild.getMarked().getSha1String(); } catch (NoSuchFieldException | IllegalAccessException e) { return null; } }

Target:
private static String getBuildRevision(Run<?, ?> build) { BuildData action = build.getAction(BuildData.class); return action.getLastBuild(action.getLastBuiltRevision().getSha1()).getMarked().getSha1String(); }