auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void delete(String workspaceName, String userName) throws Exception { if (!exists(workspaceName, userName)) { return; } Workspace workspace = getByName(workspaceName, userName); if (workspace.getStatus() == STOPPING) { waitStatus(workspaceName, userName, STOPPED); } else if (workspace.getStatus() != STOPPED) { stop(workspaceName, userName); } requestFactory.fromUrl(getIdBasedUrl(workspace.getId())).useDeleteMethod().request(); WaitUtils.waitSuccessCondition( () -> { try { LOG.info( "Check workspace name='{}', id='{}', username='{}' existence", workspaceName, workspace.getId(), userName); return !exists(workspaceName, userName); } catch (Exception e) { throw new RuntimeException( format( "Error of waiting on workspace of name='%s', id='%s', username='%s' is removed.", workspaceName, workspace.getId(), userName), e); } }, TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC, 1000, TimeUnit.SECONDS); LOG.info( "Workspace name='{}', id='{}', username='{}' removed", workspaceName, workspace.getId(), userName); }

Target:
public void delete(String workspaceName, String userName) throws Exception { if (!exists(workspaceName, userName)) { return; } Workspace workspace = getByName(workspaceName, userName); if (workspace.getStatus() == STOPPING) { waitStatus(workspaceName, userName, STOPPED); } else if (workspace.getStatus() != STOPPED) { stop(workspaceName, userName); } requestFactory.fromUrl(getIdBasedUrl(workspace.getId())).useDeleteMethod().request(); WaitUtils.waitSuccessCondition( () -> { try { return !exists(workspaceName, userName); } catch (Exception e) { throw new RuntimeException( format( "Error of waiting on workspace name='%s', id='%s', username='%s' removal.", workspaceName, workspace.getId(), userName), e); } }, TestTimeoutsConstants.PREPARING_WS_TIMEOUT_SEC, 500, TimeUnit.SECONDS); LOG.info( "Workspace name='{}', id='{}', username='{}' removed", workspaceName, workspace.getId(), userName); }
Source:
public LightblueHealth checkHealth() { return null; }

Target:
public CRUDHealth checkHealth() { return new CRUDHealth(true, "Return always healthy for test"); }
Source:
public Optional<Predicate<ItemStackSnapshot>> getIngredientPredicate(int x, int y) { return Optional.ofNullable(ingredients.get(x, y)); }

Target:
public Predicate<ItemStackSnapshot> getIngredientPredicate(int x, int y) { return Optional.ofNullable(this.ingredients.get(x, y)) .orElseThrow(() -> new IndexOutOfBoundsException("Invalid ingredient predicate location")); }
Source:
static int updatedCount(int[] executeBatch) { int sum = 0; for (int count : executeBatch) { sum += count; } return sum; }

Target:
static int updatedCount(int[] executeBatch) { return Arrays.stream(executeBatch).sum(); }
Source:
private static void createSubtitleLabel(Composite parent, String text) { final Label label = new Label(parent, SWT.WRAP); label.setText(text + ':'); final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD); final Font boldFont = boldDescriptor.createFont(parent.getDisplay()); label.setFont(boldFont); label.addDisposeListener(event -> boldFont.dispose()); }

Target:
private static void createSubtitleLabel(Composite parent, String text) { final Label label = new Label(parent, SWT.WRAP); label.setText(text + ':'); final FontDescriptor boldDescriptor = FontDescriptor.createFrom(parent.getFont()).setStyle(SWT.BOLD); final Font boldFont = boldDescriptor.createFont(parent.getDisplay()); label.setFont(boldFont); label.addDisposeListener(event -> boldDescriptor.destroyFont(boldFont)); }
Source:
private Mono<PagedResponse<CustomFormModelInfo>> listNextPageModelInfo(String nextPageLink, Context context) { return service.listCustomModelsNextSinglePageAsync(nextPageLink) .doOnSubscribe(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)) .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)) .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, error)) .map(res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), toCustomFormModelInfo(res.getValue()), res.getContinuationToken(), null)); }

Target:
private Mono<PagedResponse<CustomFormModelInfo>> listNextPageModelInfo(String nextPageLink, Context context) { if (CoreUtils.isNullOrEmpty(nextPageLink)) { return Mono.empty(); } return service.listCustomModelsNextSinglePageAsync(nextPageLink, context) .doOnSubscribe(ignoredValue -> logger.info("Retrieving the next listing page - Page {}", nextPageLink)) .doOnSuccess(response -> logger.info("Retrieved the next listing page - Page {}", nextPageLink)) .doOnError(error -> logger.warning("Failed to retrieve the next listing page - Page {}", nextPageLink, error)) .map(res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), toCustomFormModelInfo(res.getValue()), res.getContinuationToken(), null)); }
Source:
public int size() { if (size == -1) { int tempsize = 0; if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { final BigInteger fromNum = new BigInteger(from.toString()); final BigInteger toNum = new BigInteger(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigInteger("1")); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else if (from instanceof Character && to instanceof Character) { final char fromNum = (Character) from; final char toNum = (Character) to; tempsize = toNum - fromNum + 1; } else if (((from instanceof BigDecimal || from instanceof BigInteger) && to instanceof Number) || ((to instanceof BigDecimal || to instanceof BigInteger) && from instanceof Number)) { final BigDecimal fromNum = new BigDecimal(from.toString()); final BigDecimal toNum = new BigDecimal(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(BigDecimal.valueOf(1.0)).toBigInteger(); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else { final Iterator<Comparable> iter = new StepIterator(this, 1); while (iter.hasNext()) { tempsize++; if (tempsize < 0) { break; } iter.next(); } } if (tempsize < 0) { tempsize = Integer.MAX_VALUE; } size = tempsize; } return size; }

Target:
public int size() { if (size == -1) { int tempsize = 0; if ((from instanceof Integer || from instanceof Long) && (to instanceof Integer || to instanceof Long)) { final BigInteger fromNum = new BigInteger(from.toString()); final BigInteger toNum = new BigInteger(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(new BigInteger("1")); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else if (from instanceof Character && to instanceof Character) { final char fromNum = (Character) from; final char toNum = (Character) to; tempsize = toNum - fromNum + 1; } else if (((from instanceof BigDecimal || from instanceof BigInteger) && to instanceof Number) || ((to instanceof BigDecimal || to instanceof BigInteger) && from instanceof Number)) { final BigDecimal fromNum = new BigDecimal(from.toString()); final BigDecimal toNum = new BigDecimal(to.toString()); final BigInteger sizeNum = toNum.subtract(fromNum).add(BigDecimal.ONE).toBigInteger(); tempsize = sizeNum.intValue(); if (!BigInteger.valueOf(tempsize).equals(sizeNum)) { tempsize = Integer.MAX_VALUE; } } else { final Iterator<Comparable> iter = new StepIterator(this, 1); while (iter.hasNext()) { tempsize++; if (tempsize < 0) { break; } iter.next(); } } if (tempsize < 0) { tempsize = Integer.MAX_VALUE; } size = tempsize; } return size; }
Source:
private static String getWhereClause( TupleDomain<Integer> tupleDomain, List<String> columnNames, List<Type> types, Set<Integer> uuidColumnIndexes, List<ValueBuffer> bindValues, Optional<String> additionalFixedCondition) { ImmutableList.Builder<String> conjunctsBuilder = ImmutableList.builder(); if (!tupleDomain.isNone()) { Map<Integer, Domain> domainMap = tupleDomain.getDomains().get(); for (Map.Entry<Integer, Domain> entry : domainMap.entrySet()) { int index = entry.getKey(); String columnName = columnNames.get(index); Type type = types.get(index); conjunctsBuilder.add(toPredicate(index, columnName, type, entry.getValue(), uuidColumnIndexes, bindValues)); } } if (additionalFixedCondition.isPresent()) { conjunctsBuilder.add(additionalFixedCondition.get()); } List<String> conjuncts = conjunctsBuilder.build(); if (conjuncts.isEmpty()) { return ""; } StringBuilder where = new StringBuilder("WHERE "); return Joiner.on(" AND\n").appendTo(where, conjuncts).toString(); }

Target:
private static String getWhereClause( TupleDomain<Integer> tupleDomain, List<String> columnNames, List<Type> types, Set<Integer> uuidColumnIndexes, List<ValueBuffer> bindValues, Optional<String> additionalFixedCondition) { ImmutableList.Builder<String> conjunctsBuilder = ImmutableList.builder(); if (!tupleDomain.isNone()) { Map<Integer, Domain> domainMap = tupleDomain.getDomains().get(); for (Map.Entry<Integer, Domain> entry : domainMap.entrySet()) { int index = entry.getKey(); String columnName = columnNames.get(index); Type type = types.get(index); conjunctsBuilder.add(toPredicate(index, columnName, type, entry.getValue(), uuidColumnIndexes, bindValues)); } } additionalFixedCondition.ifPresent(condition -> conjunctsBuilder.add(condition)); List<String> conjuncts = conjunctsBuilder.build(); if (conjuncts.isEmpty()) { return ""; } StringBuilder where = new StringBuilder("WHERE "); return Joiner.on(" AND\n").appendTo(where, conjuncts).toString(); }
Source:
private ContentFileInterface createContentFile(Process process, URI image) throws IOException { ContentFileInterface contentFileInterface = UghImplementation.INSTANCE.createContentFile(); URI path = serviceManager.getProcessService().getImagesTifDirectory(false, process).resolve(image); contentFileInterface.setLocation(path.getPath()); return contentFileInterface; }

Target:
private ContentFileInterface createContentFile(Process process, URI image) throws IOException { ContentFileInterface contentFile = UghImplementation.INSTANCE.createContentFile(); URI path = serviceManager.getProcessService().getImagesTifDirectory(false, process).resolve(image); contentFile.setLocation(path.getPath()); return contentFile; }
Source:
public long[] getLatencyBucketsBy100ms() { final long buckets[] = new long[HUNDRED_MS_BUCKET_COUNT]; for (int ii = 0; ii < HUNDRED_MS_BUCKET_COUNT; ii++) { buckets[ii] = m_latencyHistogram.getCountBetweenValues(ii * 100000, (ii + 1) * 100000); } return buckets; }

Target:
public long[] getLatencyBucketsBy100ms() { final long buckets[] = new long[HUNDRED_MS_BUCKET_COUNT]; for (int ii = 0; ii < HUNDRED_MS_BUCKET_COUNT; ii++) { buckets[ii] = m_latencyHistogram.getCountBetweenValues(ii * 100000L, (ii + 1) * 100000L); } return buckets; }
Source:
private <T extends Connection> T parseConnection(EClass conType) { T connection = (T) LibraryElementFactory.eINSTANCE.create(conType); connection.setResTypeConnection(false); String destinationElement = getAttributeValue(LibraryElementTags.DESTINATION_ATTRIBUTE); if (destinationElement != null) { IInterfaceElement destination = getConnectionEndPoint(destinationElement); if (null != destination) { connection.setDestination(destination); } else { Activator.getDefault().logError("Connection destination not found: " + destinationElement); return null; } } String sourceElement = getAttributeValue(LibraryElementTags.SOURCE_ATTRIBUTE); if (null != sourceElement) { IInterfaceElement source = getConnectionEndPoint(sourceElement); if (null != source) { connection.setSource(source); } else { Activator.getDefault().logError("Connection source not found: " + sourceElement); return null; } } String commentElement = getAttributeValue(LibraryElementTags.COMMENT_ATTRIBUTE); if (null != commentElement) { connection.setComment(commentElement); } parseConnectionRouting(connection); return connection; }

Target:
private <T extends Connection> T parseConnection(EClass conType) { T connection = (T) LibraryElementFactory.eINSTANCE.create(conType); connection.setResTypeConnection(false); String destinationElement = getAttributeValue(LibraryElementTags.DESTINATION_ATTRIBUTE); if (null != destinationElement) { IInterfaceElement destination = getConnectionEndPoint(destinationElement); if (null != destination) { connection.setDestination(destination); } else { Activator.getDefault().logError("Connection destination not found: " + destinationElement); return null; } } String sourceElement = getAttributeValue(LibraryElementTags.SOURCE_ATTRIBUTE); if (null != sourceElement) { IInterfaceElement source = getConnectionEndPoint(sourceElement); if (null != source) { connection.setSource(source); } else { Activator.getDefault().logError("Connection source not found: " + sourceElement); return null; } } String commentElement = getAttributeValue(LibraryElementTags.COMMENT_ATTRIBUTE); if (null != commentElement) { connection.setComment(commentElement); } parseConnectionRouting(connection); return connection; }
Source:
private String toFormattedAddress(InetSocketAddress clientAddress) { if (clientAddress.isUnresolved()) { return "UNKNOWN"; } else { return String.format("%s:%s", clientAddress.getAddress().getHostAddress(), clientAddress.getPort()); } }

Target:
private Optional<String> toFormattedAddress(InetSocketAddress clientAddress) { Optional<String> res = Optional.empty(); if (!clientAddress.isUnresolved()) { res = Optional.of(String.format("%s:%s", clientAddress.getAddress().getHostAddress(), clientAddress.getPort())); } return res; }
Source:
public boolean onOptionsItemSelected( final MenuItem item ) { final MainActivity main = MainActivity.getMainActivity(); NavigationView navigationView = (NavigationView) getActivity().findViewById(R.id.left_drawer); switch ( item.getItemId() ) { case MENU_USER_STATS: navigationView.getMenu().setGroupVisible(R.id.stats_group, true); MenuItem userStatsMenuItem = navigationView.getMenu().findItem(R.id.nav_user_stats); navigationView.getMenu().setGroupVisible(R.id.stats_group, true); userStatsMenuItem.setCheckable(true); userStatsMenuItem.setChecked(true); if (main != null) main.selectFragment(R.id.nav_user_stats); return true; case MENU_RANK_STATS: MenuItem rankStatsMenuItem = navigationView.getMenu().findItem(R.id.nav_rank); navigationView.getMenu().setGroupVisible(R.id.stats_group, true); rankStatsMenuItem.setCheckable(true); rankStatsMenuItem.setChecked(true); if (main != null) main.selectFragment(R.id.nav_rank); return true; } return false; }

Target:
public boolean onOptionsItemSelected( final MenuItem item ) { final MainActivity main = MainActivity.getMainActivity(); NavigationView navigationView = (NavigationView) getActivity().findViewById(R.id.left_drawer); switch ( item.getItemId() ) { case MENU_USER_STATS: MenuUtil.selectStatsSubmenuItem(navigationView, main, R.id.nav_user_stats); return true; case MENU_RANK_STATS: MenuUtil.selectStatsSubmenuItem(navigationView, main, R.id.nav_rank); return true; } return false; }
Source:
boolean isCollapsingExplicitlyDenied() { if (parent != null && parent.type == Type.OBJECTLIT && parent.docInfo != null && parent.docInfo.hasEnumParameterType()) { return false; } if (docInfo == null) { Ref ref = getDeclaration(); if (ref != null) { docInfo = getDocInfoForDeclaration(ref); } } return docInfo != null && docInfo.isNoCollapse(); }

Target:
boolean isCollapsingExplicitlyDenied() { if (isDescendantOfEnum()) { return false; } if (docInfo == null) { Ref ref = getDeclaration(); if (ref != null) { docInfo = getDocInfoForDeclaration(ref); } } return docInfo != null && docInfo.isNoCollapse(); }
Source:
public String render(T size) { if (isUnavailable(size)) { return CONSTANTS.unAvailablePropertyLabel(); } String res; switch (format) { case LEGACY: res = renderLegacySize(size.longValue()); break; case HUMAN_READABLE: res = renderHumanReadableSize(size.longValue()); break; default: throw new RuntimeException("Format '" + format + "' is not supported!"); } return res; }

Target:
public String render(T size) { if (isUnavailable(size)) { return CONSTANTS.unAvailablePropertyLabel(); } switch (format) { case GIGABYTE: return renderGigabyteSize(size.longValue()); case HUMAN_READABLE: return renderHumanReadableSize(size.longValue()); default: throw new RuntimeException("Format '" + format + "' is not supported!"); } }
Source:
private void activate() { for (ExtensionEntry entry : loadedEntries.values()) { entry.enabled = EngineLocalConfig.getInstance().getBoolean( "ENGINE_EXTENSION_ENABLE_" + entry.getName(), entry.enabled ); if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }

Target:
private void activate() { EngineLocalConfig config = EngineLocalConfig.getInstance(); for (ExtensionEntry entry : loadedEntries.values()) { entry.enabled = config.getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (entry.enabled) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } } }
Source:
public void testPush() throws Exception { Configuration conf = new Configuration(true); File tmpDir = Files.createTempDir(); tmpDir.deleteOnExit(); File tmp = new File(tmpDir, "version.bin"); tmp.deleteOnExit(); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig(); config.storageDirectory = tmpDir.getName(); HdfsDataSegmentPusher pusher = new HdfsDataSegmentPusher(config, conf, new DefaultObjectMapper()); DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(tmpDir, segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); final File dir = new File(config.getStorageDirectory()); FileUtils.deleteDirectory(dir); }

Target:
public void testPush() throws Exception { Configuration conf = new Configuration(true); File segmentDir = tempFolder.newFolder(); File tmp = new File(segmentDir, "version.bin"); final byte[] data = new byte[]{0x0, 0x0, 0x0, 0x1}; Files.write(data, tmp); final long size = data.length; HdfsDataSegmentPusherConfig config = new HdfsDataSegmentPusherConfig(); config.setStorageDirectory(tempFolder.newFolder().getAbsolutePath()); HdfsDataSegmentPusher pusher = new HdfsDataSegmentPusher(config, conf, new DefaultObjectMapper()); DataSegment segmentToPush = new DataSegment( "foo", new Interval("2015/2016"), "0", Maps.<String, Object>newHashMap(), Lists.<String>newArrayList(), Lists.<String>newArrayList(), new NoneShardSpec(), 0, size ); DataSegment segment = pusher.push(segmentDir, segmentToPush); Assert.assertEquals(segmentToPush.getSize(), segment.getSize()); }
Source:
public static void passInformationToTransformation(final VariableSpace variableSpace, final JobConf job) { variableSpace.setVariable("Internal.Hadoop.NumMapTasks", Integer.toString(job.getNumMapTasks())); variableSpace.setVariable("Internal.Hadoop.NumReduceTasks", Integer.toString(job.getNumReduceTasks())); String taskId = job.get("mapred.task.id"); variableSpace.setVariable("Internal.Hadoop.TaskId", taskId); String nodeNumber; if (Const.isEmpty(taskId)) { nodeNumber="0"; } else { int lastUnderscoreIndex = taskId.lastIndexOf("_"); if (lastUnderscoreIndex>=0) { nodeNumber = taskId.substring(lastUnderscoreIndex+1); } else { nodeNumber = "0"; } } variableSpace.setVariable("Internal.Hadoop.NodeNumber", Integer.toString(Integer.valueOf(nodeNumber))); }

Target:
public static void passInformationToTransformation(final VariableSpace variableSpace, final JobConf job) { if ( variableSpace != null && job != null ) { variableSpace.setVariable("Internal.Hadoop.NumMapTasks", Integer.toString(job.getNumMapTasks())); variableSpace.setVariable("Internal.Hadoop.NumReduceTasks", Integer.toString(job.getNumReduceTasks())); String taskId = job.get("mapred.task.id"); variableSpace.setVariable("Internal.Hadoop.TaskId", taskId); String nodeNumber; if (Const.isEmpty(taskId)) { nodeNumber="0"; } else { int lastUnderscoreIndex = taskId.lastIndexOf("_"); if (lastUnderscoreIndex>=0) { nodeNumber = taskId.substring(lastUnderscoreIndex+1); } else { nodeNumber = "0"; } } variableSpace.setVariable("Internal.Hadoop.NodeNumber", Integer.toString(Integer.valueOf(nodeNumber))); } }
Source:
public static AgentKeyImpl parse(String agentKey) throws IllegalArgumentException { String[] parts = agentKey.split(":"); if (parts.length == 1) { return new AgentKeyImpl(parts[0], null); } else if (parts.length == 2) { return new AgentKeyImpl(parts[0], parts[1]); } else { throw new IllegalArgumentException("" + agentKey); } }

Target:
public static AgentKeyImpl parse(String agentKey) throws IllegalArgumentException { String[] parts = agentKey.split(":"); if (parts.length == 1) { return new AgentKeyImpl(parts[0], null); } else if (parts.length == 2) { return new AgentKeyImpl(parts[0], parts[1]); } else { throw new IllegalArgumentException("Illegal format: " + agentKey); } }
Source:
SynchronousMessageSubscriber(long prefetch, SynchronousReceiveWork initialWork) { this.prefetch = prefetch; this.initialWork = initialWork; }

Target:
SynchronousMessageSubscriber(long prefetch, SynchronousReceiveWork initialWork) { this.workQueue.add(initialWork); requested = initialWork.getNumberOfEvents() > prefetch ? initialWork.getNumberOfEvents() : prefetch; }
Source:
public void noSequenceSizeItemSequenceInfoBinding() throws Exception { CoreEvent event = spy(testEvent()); when(event.getItemSequenceInfo()).thenReturn(Optional.of(ItemSequenceInfo.of(43))); TypedValue result = expressionLanguage.evaluate(ITEM_SEQUENCE_INFO + ".position", event, BindingContext.builder().build()); assertThat(result.getValue(), is(43)); result = expressionLanguage.evaluate(ITEM_SEQUENCE_INFO + ".sequenceSize", event, BindingContext.builder().build()); assertThat(result.getValue(), is(nullValue())); }

Target:
public void noSequenceSizeItemSequenceInfoBinding() throws Exception { CoreEvent event = spy(testEvent()); when(event.getItemSequenceInfo()).thenReturn(of(ItemSequenceInfo.of(43))); TypedValue result = expressionLanguage.evaluate(ITEM_SEQUENCE_INFO + ".position", event, BindingContext.builder().build()); assertThat(result.getValue(), is(43)); result = expressionLanguage.evaluate(ITEM_SEQUENCE_INFO + ".sequenceSize", event, BindingContext.builder().build()); assertThat(result.getValue(), is(nullValue())); }
Source:
public synchronized void close() throws IOException { scanHandler.cancel(); }

Target:
public void close() throws IOException { scanHandler.cancel(); }
Source:
public FilterBuilder withReferenceBases(String referenceBases) { if (referenceBases != null) { filters.add(new VariantRepositoryReferenceBasesFilter(new ArrayList<>(Arrays.asList(referenceBases)))); } return this; }

Target:
public FilterBuilder withReferenceBases(String referenceBases) { if (referenceBases != null) { filters.add(new VariantRepositoryReferenceBasesFilter(Collections.singletonList(referenceBases))); } return this; }
Source:
public void testAcceptedIssuersWithCRLs() throws Throwable { ServiceName serviceName = Capabilities.TRUST_MANAGER_RUNTIME_CAPABILITY.getCapabilityServiceName("trust-with-crl"); TrustManager trustManager = (TrustManager) services.getContainer().getService(serviceName).getValue(); Assert.assertNotNull(trustManager); Assert.assertTrue(((SSLDefinitions.ReloadableX509ExtendedTrustManager) trustManager).getAcceptedIssuers().length > 0); }

Target:
public void testAcceptedIssuersWithCRLs() throws Throwable { ServiceName serviceName = Capabilities.TRUST_MANAGER_RUNTIME_CAPABILITY.getCapabilityServiceName("trust-with-crl"); TrustManager trustManager = (TrustManager) services.getContainer().getService(serviceName).getValue(); Assert.assertNotNull(trustManager); Assert.assertTrue(((X509TrustManager) trustManager).getAcceptedIssuers().length > 0); }
Source:
private String getConfigPath() { return getInstallDir() + "/rabbitmq"; }

Target:
private String getConfigPath() { return getRunDir() + "/rabbitmq"; }
Source:
public boolean validateItemUnitPrice(PurApItem item) { boolean valid = true; if (item.getItemType().isLineItemIndicator()) { if (ObjectUtils.isNull(item.getItemUnitPrice())) { valid = false; String attributeLabel = businessObjectDictionaryService.getBusinessObjectEntry(item.getClass().getName()) .getAttributeDefinition(PurapPropertyConstants.ITEM_DESCRIPTION).getLabel(); GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, KFSKeyConstants.ERROR_REQUIRED, attributeLabel + " in " + item.getItemIdentifierString()); } } if (ObjectUtils.isNotNull(item.getItemUnitPrice())) { if ((BigDecimal.ZERO.compareTo(item.getItemUnitPrice()) > 0) && ((!item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE)) && (!item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE)))) { GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, PurapKeyConstants.ERROR_ITEM_AMOUNT_BELOW_ZERO, ItemFields.UNIT_COST, item.getItemIdentifierString()); valid = false; } else if ((BigDecimal.ZERO.compareTo(item.getItemUnitPrice()) < 0) && ((item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE)) || (item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE)))) { GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, PurapKeyConstants.ERROR_ITEM_AMOUNT_NOT_BELOW_ZERO, ItemFields.UNIT_COST, item.getItemIdentifierString()); valid = false; } } return valid; }

Target:
public boolean validateItemUnitPrice(PurApItem item) { boolean valid = true; if (item.getItemType().isLineItemIndicator()) { if (ObjectUtils.isNull(item.getItemUnitPrice())) { valid = false; String attributeLabel = businessObjectDictionaryService.getBusinessObjectEntry(item.getClass().getName()) .getAttributeDefinition(PurapPropertyConstants.ITEM_UNIT_PRICE).getLabel(); GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, KFSKeyConstants.ERROR_REQUIRED, attributeLabel + " in " + item.getItemIdentifierString()); } } if (ObjectUtils.isNotNull(item.getItemUnitPrice())) { if ((BigDecimal.ZERO.compareTo(item.getItemUnitPrice()) > 0) && ((!item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE)) && (!item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE)))) { GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, PurapKeyConstants.ERROR_ITEM_AMOUNT_BELOW_ZERO, ItemFields.UNIT_COST, item.getItemIdentifierString()); valid = false; } else if ((BigDecimal.ZERO.compareTo(item.getItemUnitPrice()) < 0) && ((item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_ORDER_DISCOUNT_CODE)) || (item.getItemTypeCode().equals(ItemTypeCodes.ITEM_TYPE_TRADE_IN_CODE)))) { GlobalVariables.getMessageMap().putError(PurapPropertyConstants.ITEM_UNIT_PRICE, PurapKeyConstants.ERROR_ITEM_AMOUNT_NOT_BELOW_ZERO, ItemFields.UNIT_COST, item.getItemIdentifierString()); valid = false; } } return valid; }
Source:
public XBeePacket parsePacket() throws InvalidPacketException { try { readBytes = 0; lengthRead = false; checksum = new XBeeChecksum(); int hSize = readByte(); int lSize = readByte(); length = hSize << 8 | lSize; lengthRead = true; int apiID = readByte(); APIFrameType apiType = APIFrameType.get(apiID); XBeePacket packet = null; if (apiType == null) { byte[] payload = readBytes(length - 1); packet = new UnknownXBeePacket(apiID, payload); } else { switch (apiType) { case TX_64: packet = parseTX64Packet(); break; case TX_16: packet = parseTX16Packet(); break; case AT_COMMAND: packet = parseATCommandPacket(); break; case TRANSMIT_REQUEST: packet = parseTransmitRequestPacket(); break; case AT_COMMAND_RESPONSE: packet = parseATCommandResponsePacket(); break; case RX_64: packet = parseRX64Packet(); break; case RX_16: packet = parseRX16Packet(); break; case TX_STATUS: packet = parseTXStatusPacket(); break; case TRANSMIT_STATUS: packet = parseTransmitStatusPacket(); break; case RECEIVE_PACKET: packet = parseZigBeeReceivePacket(); break; case GENERIC: default: packet = parseGenericPacket(); } } readByte(); return packet; } catch (IOException e) { throw new InvalidPacketException("Error parsing packet: " + e.getMessage()); } }

Target:
public XBeePacket parsePacket() throws InvalidPacketException { try { readBytes = 0; lengthRead = false; checksum = new XBeeChecksum(); int hSize = readByte(); int lSize = readByte(); length = hSize << 8 | lSize; lengthRead = true; int apiID = readByte(); APIFrameType apiType = APIFrameType.get(apiID); XBeePacket packet = null; if (apiType == null) { byte[] payload = readBytes(length - 1); packet = new UnknownXBeePacket(apiID, payload); } else { switch (apiType) { case TX_64: packet = parseTX64Packet(); break; case TX_16: packet = parseTX16Packet(); break; case AT_COMMAND: packet = parseATCommandPacket(); break; case TRANSMIT_REQUEST: packet = parseTransmitRequestPacket(); break; case AT_COMMAND_RESPONSE: packet = parseATCommandResponsePacket(); break; case RX_64: packet = parseRX64Packet(); break; case RX_16: packet = parseRX16Packet(); break; case TX_STATUS: packet = parseTXStatusPacket(); break; case TRANSMIT_STATUS: packet = parseTransmitStatusPacket(); break; case RECEIVE_PACKET: packet = parseZigBeeReceivePacket(); break; case GENERIC: default: packet = parseGenericPacket(); } } readByte(); return packet; } catch (IOException e) { throw new InvalidPacketException("Error parsing packet: " + e.getMessage(), e); } }
Source:
void deleteLeastRecentlyUsedActiveTokens() { Date leastRecentlyUsedDate = new Date(System.currentTimeMillis() - ONE_DAY_MILLIS * 30); OAuthRefreshTokenInformation toRemove = createRefreshToken("abcd", leastRecentlyUsedDate); OAuthRefreshTokenInformation doNotRemove1 = createRefreshToken("abcd", new Date()); OAuthRefreshTokenInformation doNotRemove2 = createRefreshToken("abcd", new Date(System.currentTimeMillis() - 1000 * 5)); OAuthRefreshTokenInformation expired = createRefreshToken("abcd", new Date(System.currentTimeMillis() - ONE_YEAR_MILLIS)); oauthRefreshTokenDao.deleteLeastRecentlyUsedTokensOverLimit(userId, client.getClient_id(), 2L); assertFalse(oauthRefreshTokenDao.getRefreshTokenMetadata(toRemove.getTokenId()).isPresent()); assertTrue(oauthRefreshTokenDao.getRefreshTokenMetadata(doNotRemove1.getTokenId()).isPresent()); assertTrue(oauthRefreshTokenDao.getRefreshTokenMetadata(doNotRemove2.getTokenId()).isPresent()); assertFalse(oauthRefreshTokenDao.getRefreshTokenMetadata(expired.getTokenId()).isPresent()); }

Target:
void deleteLeastRecentlyUsedActiveTokens() { Long tokenLimit = 2L; OAuthRefreshTokenInformation oldToken1 = createRefreshToken("abcd", new Date(System.currentTimeMillis() - ONE_YEAR_MILLIS)); OAuthRefreshTokenInformation oldToken2 = createRefreshToken("abcd", new Date(System.currentTimeMillis() - ONE_DAY_MILLIS)); OAuthRefreshTokenInformation newToken1 = createRefreshToken("abcd", new Date(System.currentTimeMillis() - ONE_HOUR_MILLIS)); OAuthRefreshTokenInformation newToken2 = createRefreshToken("abcd", new Date()); oauthRefreshTokenDao.deleteLeastRecentlyUsedTokensOverLimit(userId, client.getClient_id(), tokenLimit); assertFalse(oauthRefreshTokenDao.getRefreshTokenMetadata(oldToken1.getTokenId()).isPresent()); assertFalse(oauthRefreshTokenDao.getRefreshTokenMetadata(oldToken2.getTokenId()).isPresent()); assertTrue(oauthRefreshTokenDao.getRefreshTokenMetadata(newToken1.getTokenId()).isPresent()); assertTrue(oauthRefreshTokenDao.getRefreshTokenMetadata(newToken2.getTokenId()).isPresent()); }
Source:
public void writeTo(StreamOutput out) throws IOException { windowDefinition.writeTo(out); out.writeGenericValue(startFrameOffset); out.writeGenericValue(endFrameOffset); Symbols.toStream(standaloneWithInputs, out); out.writeVInt(functionsWithInputs.size()); for (Map.Entry<WindowFunction, List<Symbol>> functionWithInputs : functionsWithInputs.entrySet()) { Symbols.toStream(functionWithInputs.getKey(), out); Symbols.toStream(functionWithInputs.getValue(), out); } }

Target:
public void writeTo(StreamOutput out) throws IOException { windowDefinition.writeTo(out); if (out.getVersion().onOrAfter(Version.V_4_1_0)) { out.writeGenericValue(startFrameOffset); out.writeGenericValue(endFrameOffset); } Symbols.toStream(standaloneWithInputs, out); out.writeVInt(functionsWithInputs.size()); for (Map.Entry<WindowFunction, List<Symbol>> functionWithInputs : functionsWithInputs.entrySet()) { Symbols.toStream(functionWithInputs.getKey(), out); Symbols.toStream(functionWithInputs.getValue(), out); } }
Source:
public void initialize() { logger.debug("Initializing Meteoblue bridge"); MeteoBlueBridgeConfig config = getConfigAs(MeteoBlueBridgeConfig.class); String apiKeyTemp = config.getApiKey(); if (StringUtils.isBlank(apiKeyTemp)) { logger.warn("Cannot initialize Meteoblue bridge. No apiKey provided."); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR); return; } apiKey = apiKeyTemp; updateStatus(ThingStatus.ONLINE); }

Target:
public void initialize() { logger.debug("Initializing meteoblue bridge"); MeteoBlueBridgeConfig config = getConfigAs(MeteoBlueBridgeConfig.class); String apiKeyTemp = config.getApiKey(); if (StringUtils.isBlank(apiKeyTemp)) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Cannot initialize meteoblue bridge. No apiKey provided."); return; } apiKey = apiKeyTemp; healthCheck(); }
Source:
public void onActivityCreated(Activity activity, Bundle savedInstanceState) { checkForDecideUpdates(activity); }

Target:
public void onActivityCreated(Activity activity, Bundle savedInstanceState) { }
Source:
private boolean createShellExecutor(String executorClassName) { try { Class<?> clazz = Class.forName(executorClassName); Constructor<?> ctor = clazz.getConstructor(); executor = (SqlExecutor) ctor.newInstance(); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { return false; } return true; }

Target:
private void createShellExecutor(String executorClassName) throws ExecutorException { try { Class<?> clazz = Class.forName(executorClassName); Constructor<?> ctor = clazz.getConstructor(); executor = (SqlExecutor) ctor.newInstance(); } catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new ExecutorException(e); } }
Source:
public void stop(Runnable callback) { try { this.connectionManager.stop(callback); } finally { this.connectionLatch = new CountDownLatch(1); } }

Target:
public void stop(Runnable callback) { this.connectionManager.stop(callback); }
Source:
public void draw(UiDrawer uiDrawer) { uiDrawer.draw(rectangle, SolColor.UI_INACTIVE); uiDrawer.draw(sliderTexture, rectangle.width, rectangle.height, 0, 0, rectangle.x, rectangle.y, 0, SolColor.WHITE); uiDrawer.setTextMode(true); String trimmedValue = Float.toString(value); int lenght = trimmedValue.substring(trimmedValue.indexOf('.')).length(); System.out.println(value); if(lenght > trimAt) { String leftSubstring = trimmedValue.substring(0, trimmedValue.indexOf('.')); String rightSubstring = trimmedValue.substring(trimmedValue.indexOf('.'), leftSubstring.length() + 1 + trimAt); trimmedValue = leftSubstring + rightSubstring; } uiDrawer.drawString(text + trimmedValue, rectangle.x + rectangle.width * 0.5f, rectangle.y + rectangle.height * 0.5f, 1, true, SolColor.WHITE); uiDrawer.setTextMode(false); uiDrawer.draw(sliderMarkerTexture, rectangle.width * HANDLE_SCALE, rectangle.height, rectangle.width * HANDLE_SCALE * 0.5f, 0, rectangle.x + value * rectangle.width, rectangle.y, 0, SolColor.WHITE); }

Target:
public void draw(UiDrawer uiDrawer) { uiDrawer.draw(rectangle, SolColor.UI_INACTIVE); uiDrawer.draw(sliderTexture, rectangle.width, rectangle.height, 0, 0, rectangle.x, rectangle.y, 0, SolColor.WHITE); uiDrawer.setTextMode(true); String trimmedValue = Float.toString(value); int length = trimmedValue.substring(trimmedValue.indexOf('.')).length(); if (length > trimAt) { String leftSubstring = trimmedValue.substring(0, trimmedValue.indexOf('.')); String rightSubstring = trimmedValue.substring(trimmedValue.indexOf('.'), leftSubstring.length() + 1 + trimAt); trimmedValue = leftSubstring + rightSubstring; } uiDrawer.drawString(text + trimmedValue, rectangle.x + rectangle.width * 0.5f, rectangle.y + rectangle.height * 0.5f, 1, true, SolColor.WHITE); uiDrawer.setTextMode(false); uiDrawer.draw(sliderMarkerTexture, rectangle.width * HANDLE_SCALE, rectangle.height, rectangle.width * HANDLE_SCALE * 0.5f, 0, rectangle.x + value * rectangle.width, rectangle.y, 0, SolColor.WHITE); }
Source:
Main(Logger console) { this.console = console; this.jc = new JCommander(this); this.help = new Help(jc, console); jc.setProgramName(DEFAULT_PROGRAM_NAME); jc.addCommand("help", help, "-h", "-help", "--help"); jc.addCommand("create", new CreateDatasetCommand(console)); jc.addCommand("copy", new CopyCommand(console)); jc.addCommand("transform", new TransformCommand(console)); jc.addCommand("update", new UpdateDatasetCommand(console)); jc.addCommand("delete", new DeleteDatasetCommand(console)); jc.addCommand("schema", new SchemaCommand(console)); jc.addCommand("info", new InfoCommand(console)); jc.addCommand("show", new ShowRecordsCommand(console)); jc.addCommand("csv-schema", new CSVSchemaCommand(console)); jc.addCommand("csv-import", new CSVImportCommand(console)); jc.addCommand("obj-schema", new ObjectSchemaCommand(console)); jc.addCommand("informat-import", new InputFormatImportCommand(console)); jc.addCommand("partition-config", new CreatePartitionStrategyCommand(console)); jc.addCommand("mapping-config", new CreateColumnMappingCommand(console)); jc.addCommand("log4j-config", new Log4jConfigCommand(console)); jc.addCommand("flume-config", new FlumeConfigCommand(console)); }

Target:
Main(Logger console) { this.console = console; this.jc = new JCommander(this); this.help = new Help(jc, console); jc.setProgramName(DEFAULT_PROGRAM_NAME); jc.addCommand("help", help, "-h", "-help", "--help"); jc.addCommand("create", new CreateDatasetCommand(console)); jc.addCommand("copy", new CopyCommand(console)); jc.addCommand("transform", new TransformCommand(console)); jc.addCommand("update", new UpdateDatasetCommand(console)); jc.addCommand("delete", new DeleteCommand(console)); jc.addCommand("schema", new SchemaCommand(console)); jc.addCommand("info", new InfoCommand(console)); jc.addCommand("show", new ShowRecordsCommand(console)); jc.addCommand("obj-schema", new ObjectSchemaCommand(console)); jc.addCommand("inputformat-import", new InputFormatImportCommand(console)); jc.addCommand("csv-schema", new CSVSchemaCommand(console)); jc.addCommand("csv-import", new CSVImportCommand(console)); jc.addCommand("json-schema", new JSONSchemaCommand(console)); jc.addCommand("json-import", new JSONImportCommand(console)); jc.addCommand("partition-config", new CreatePartitionStrategyCommand(console)); jc.addCommand("mapping-config", new CreateColumnMappingCommand(console)); jc.addCommand("log4j-config", new Log4jConfigCommand(console)); jc.addCommand("flume-config", new FlumeConfigCommand(console)); }
Source:
public Operation build() { return new Operation(method, summary, notes, responseModel, uniqueId, position, tags, produces, consumes, protocol, securityReferences, parameters, responseMessages, deprecated, isHidden, nickname); }

Target:
public Operation build() { return new Operation(method, summary, notes, responseModel, uniqueId, position, tags, produces, consumes, protocol, securityReferences, parameters, responseMessages, deprecated, isHidden); }
Source:
public List<ClientModel> getAlwaysDisplayInConsoleClients(RealmModel realm) { String cacheKey = getRealmClientsQueryCacheKey(realm.getId()); boolean queryDB = invalidations.contains(cacheKey) || listInvalidations.contains(realm.getId()); if (queryDB) { return getClientDelegate().getAlwaysDisplayInConsoleClients(realm); } ClientListQuery query = cache.get(cacheKey, ClientListQuery.class); if (query != null) { logger.tracev("getClients cache hit: {0}", realm.getName()); } if (query == null) { Long loaded = cache.getCurrentRevision(cacheKey); List<ClientModel> model = getClientDelegate().getAlwaysDisplayInConsoleClients(realm); if (model == null) return null; Set<String> ids = new HashSet<>(); for (ClientModel client : model) ids.add(client.getId()); query = new ClientListQuery(loaded, cacheKey, realm, ids); logger.tracev("adding realm clients cache miss: realm {0} key {1}", realm.getName(), cacheKey); cache.addRevisioned(query, startupRevision); return model; } List<ClientModel> list = new LinkedList<>(); for (String id : query.getClients()) { ClientModel client = session.realms().getClientById(id, realm); if (client == null) { invalidations.add(cacheKey); return getRealmDelegate().getAlwaysDisplayInConsoleClients(realm); } list.add(client); } return list; }

Target:
public List<ClientModel> getAlwaysDisplayInConsoleClients(RealmModel realm) { return getClientDelegate().getAlwaysDisplayInConsoleClients(realm); }
Source:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.numberOfThreads = args.getNumberOfThreads(); this.directory = args.getDirectory(); if (Guard.isStringNullOrEmpty(this.directory) || directory.equals(".")) { this.outputPath = FileSystems.getDefault().getPath("."); } else { final Path dirPath = FileSystems.getDefault().getPath(directory); this.outputPath = FileSystems.getDefault().getPath(".").resolve(dirPath); } LOG.info("Output Path = " + this.outputPath); this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(directory)) { throw new CommandException("Cannot set both directory and --discard"); } if (this.discard) { LOG.warn("Using /dev/null getter -- all incoming data will be discarded"); } if(!Guard.isStringNullOrEmpty(args.getPrefix())) { this.prefixes = ImmutableList.copyOf(args.getPrefix().split(PREFIX_SEPARATOR)); } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } return this; }

Target:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.numberOfThreads = args.getNumberOfThreads(); this.directory = args.getDirectory(); if (Guard.isStringNullOrEmpty(this.directory) || directory.equals(".")) { this.outputPath = FileSystems.getDefault().getPath("."); } else { final Path dirPath = FileSystems.getDefault().getPath(directory); this.outputPath = FileSystems.getDefault().getPath(".").resolve(dirPath); } LOG.info("Output Path = {}", this.outputPath); this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(directory)) { throw new CommandException("Cannot set both directory and --discard"); } if (this.discard) { LOG.warn("Using /dev/null getter -- all incoming data will be discarded"); } final String[] prefix = args.getOptionValues(PREFIXES.getOpt()); if(prefix != null && prefix.length > 0) { this.prefixes = ImmutableList.copyOf(prefix); } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } return this; }
Source:
public void finishJob() { log.info("Shutting down..."); cleanShutdown = true; shuttingDown = true; for (final Map.Entry<Long, Sink> entry : sinks.entrySet()) { persistAndMerge(entry.getKey(), entry.getValue()); } while (!sinks.isEmpty()) { try { log.info( "Cannot shut down yet! Sinks remaining: %s", Joiner.on(", ").join( Iterables.transform( sinks.values(), new Function<Sink, String>() { @Override public String apply(Sink input) { return input.getSegment().getIdentifier(); } } ) ) ); synchronized (handoffCondition) { while (!sinks.isEmpty()) { handoffCondition.wait(); } } } catch (InterruptedException e) { throw Throwables.propagate(e); } } shutdownExecutors(); stopped = true; if (!cleanShutdown) { throw new ISE("Exception occurred during persist and merge."); } }

Target:
public void finishJob() { log.info("Shutting down..."); shuttingDown = true; for (final Map.Entry<Long, Sink> entry : sinks.entrySet()) { persistAndMerge(entry.getKey(), entry.getValue()); } while (!sinks.isEmpty()) { try { log.info( "Cannot shut down yet! Sinks remaining: %s", Joiner.on(", ").join( Iterables.transform( sinks.values(), new Function<Sink, String>() { @Override public String apply(Sink input) { return input.getSegment().getIdentifier(); } } ) ) ); synchronized (handoffCondition) { while (!sinks.isEmpty()) { handoffCondition.wait(); } } } catch (InterruptedException e) { throw Throwables.propagate(e); } } shutdownExecutors(); stopped = true; if (!cleanShutdown) { throw new ISE("Exception occurred during persist and merge."); } }
Source:
public void testGetIscsiInitiatorsByHostIdAndStorageTargetId() { List<VdsNetworkInterface> interfaces = dao.getIscsiInitiatorsByHostIdAndStorageTargetId(VDS_ID, TARGET_ID); assertNotNull(interfaces); assertTrue(interfaces.size() == 1); }

Target:
public void testGetIscsiInitiatorsByHostIdAndStorageTargetId() { List<VdsNetworkInterface> interfaces = dao.getIscsiInitiatorsByHostIdAndStorageTargetId(VDS_ID, TARGET_ID); assertNotNull(interfaces); for (VdsNetworkInterface nic : interfaces) { assertEquals(VDS_ID, nic.getVdsId()); } }
Source:
private void testWithAllStorageFormats(BiConsumer<Session, HiveStorageFormat> test) { for (HiveStorageFormat storageFormat : HiveStorageFormat.values()) { Session session = getSession(); if (storageFormat == PAGEFILE) { session = Session.builder(getSession()) .setCatalogSessionProperty(catalog, "compression_codec", "SNAPPY") .build(); } test.accept(session, storageFormat); } }

Target:
private void testWithAllStorageFormats(BiConsumer<Session, HiveStorageFormat> test) { for (HiveStorageFormat storageFormat : HiveStorageFormat.values()) { test.accept(getSession(), storageFormat); } }