auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private ModelNode parse(final AttributeDefinition attribute, final String value) throws OperationFailedException { final String trimmed = value == null ? null : value.trim(); ModelNode node; if (trimmed != null) { if (attribute.isAllowExpression() && ParseUtils.isExpression(trimmed)) { node = ParseUtils.parsePossibleExpression(trimmed); } else { if(attribute.getType() == STRING || attribute.getType() == PROPERTY) { node = new ModelNode().set(value); } else { node = new ModelNode().set(trimmed); } } if (node.getType() != ModelType.EXPRESSION) { switch (attribute.getType()) { case BIG_DECIMAL: node.set(node.asBigDecimal()); break; case BIG_INTEGER: node.set(node.asBigInteger()); break; case BOOLEAN: node.set(node.asBoolean()); break; case BYTES: node.set(node.asBytes()); break; case DOUBLE: node.set(node.asDouble()); break; case INT: node.set(node.asInt()); break; case LONG: node.set(node.asLong()); break; } } } else { node = new ModelNode(); } final ParameterValidator validator; if (attribute instanceof ListAttributeDefinition) { validator = ((ListAttributeDefinition) attribute).getElementValidator(); } else if (attribute instanceof MapAttributeDefinition) { validator = ((MapAttributeDefinition) attribute).getElementValidator(); } else { validator = attribute.getValidator(); } validator.validateParameter(attribute.getXmlName(), node); return node; }

Target:
private ModelNode parse(final AttributeDefinition attribute, final String value) throws OperationFailedException { ModelNode node = ParseUtils.parseAttributeValue(value, attribute.isAllowExpression(), attribute.getType()); final ParameterValidator validator; if (attribute instanceof ListAttributeDefinition) { validator = ((ListAttributeDefinition) attribute).getElementValidator(); } else if (attribute instanceof MapAttributeDefinition) { validator = ((MapAttributeDefinition) attribute).getElementValidator(); } else { validator = attribute.getValidator(); } validator.validateParameter(attribute.getXmlName(), node); return node; }
Source:
private void reportMissingRegionServers(final ClusterMetrics clusterMetrics) { final Set<Address> regionServers = collectKnownRegionServers(clusterMetrics); final Set<Address> missingRegionServers = new HashSet<>(initialRegionServers); missingRegionServers.removeAll(regionServers); if (!missingRegionServers.isEmpty()) { final StringBuilder stringBuilder = new StringBuilder() .append("region server(s) are missing from this cluster report"); missingRegionServers.forEach(address -> { stringBuilder.append("\n ").append(address); }); getLogger().warn(stringBuilder.toString()); } }

Target:
private void reportMissingRegionServers(final ClusterMetrics clusterMetrics) { final Set<Address> regionServers = collectKnownRegionServers(clusterMetrics); final Set<Address> missingRegionServers = new HashSet<>(initialRegionServers); missingRegionServers.removeAll(regionServers); if (!missingRegionServers.isEmpty()) { final StringBuilder stringBuilder = new StringBuilder() .append("region server(s) are missing from this cluster report"); missingRegionServers.stream() .sorted() .forEach(address -> stringBuilder.append("\n ").append(address)); getLogger().warn(stringBuilder.toString()); } }
Source:
private String getStoriesId() { Stories stories = getAnnotation(Stories.class); if (stories != null){ return ("").equals(stories.id()) ? null : stories.id(); } else { return null; } }

Target:
private String getStoriesId() { Stories stories = getAnnotation(Stories.class); if(stories == null || stories.id() == null || stories.id().isEmpty()) { return null; } else { return stories.id(); } }
Source:
public static StringNormalizer.Result simplifyPhoneNumber(String phoneNumber) { int numCodePoints = Character.codePointCount(phoneNumber, 0, phoneNumber.length()); IntSequenceBuilder codePoints = new IntSequenceBuilder(numCodePoints); IntSequenceBuilder resultMap = new IntSequenceBuilder(numCodePoints); int i = 0; for (int iterCodePoint = 0; iterCodePoint < numCodePoints; iterCodePoint += 1) { int c = Character.codePointAt(phoneNumber, i); if (!(c == ' ' || c == '-' || c == '.' || c == '(' || c == ')' || c == ':' || c == '/')) { codePoints.add(c); resultMap.add(i); } i += Character.charCount(c); } return new StringNormalizer.Result(phoneNumber.length(), codePoints.toArray(), resultMap.toArray()); }

Target:
public static StringNormalizer.Result simplifyPhoneNumber(String phoneNumber) { int numCodePoints = Character.codePointCount(phoneNumber, 0, phoneNumber.length()); IntSequenceBuilder codePoints = new IntSequenceBuilder(numCodePoints); IntSequenceBuilder resultMap = new IntSequenceBuilder(numCodePoints); int i = 0; for (int iterCodePoint = 0; iterCodePoint < numCodePoints; iterCodePoint += 1) { int c = Character.codePointAt(phoneNumber, i); if (c != ' ' && c != '-' && c != '.' && c != '(' && c != ')' && c != ':' && c != '/') { codePoints.add(c); resultMap.add(i); } i += Character.charCount(c); } return new StringNormalizer.Result(phoneNumber.length(), codePoints.toArray(), resultMap.toArray()); }
Source:
public CompletableFuture<Pair<Set<String>, Set<String>>> sharedWith(FileWrapper file) { return file.getPath(network).thenCompose(path -> { AbsoluteCapability cap = file.getPointer().capability; Set<String> sharedReadAccessWith = network.sharedWithCache.getSharedWith(SharedWithCache.Access.READ, cap); Set<String> sharedWriteAccessWith = network.sharedWithCache.getSharedWith(SharedWithCache.Access.WRITE, cap); return CompletableFuture.completedFuture(new Pair<>(sharedReadAccessWith, sharedWriteAccessWith)); }); }

Target:
public CompletableFuture<Pair<Set<String>, Set<String>>> sharedWith(FileWrapper file) { AbsoluteCapability cap = file.getPointer().capability; Set<String> sharedReadAccessWith = sharedWithCache.getSharedWith(SharedWithCache.Access.READ, cap); Set<String> sharedWriteAccessWith = sharedWithCache.getSharedWith(SharedWithCache.Access.WRITE, cap); return CompletableFuture.completedFuture(new Pair<>(sharedReadAccessWith, sharedWriteAccessWith)); }
Source:
public OutputStream decorateLogger(AbstractBuild abstractBuild, OutputStream outputStream) throws IOException, InterruptedException { return null; }

Target:
public OutputStream decorateLogger(AbstractBuild abstractBuild, OutputStream outputStream) { return null; }
Source:
private static FairyModule getFairyModuleForLocale(Locale locale, Random random) { Reflections reflections = new Reflections(FAIRY_PACKAGE); FairyModule fairyModule = null; for (Class<? extends FairyModule> module : reflections.getSubTypesOf(FairyModule.class)) { if (module.getSimpleName().startsWith(capitalize(locale.getLanguage()))) { try { fairyModule = module.getConstructor(Random.class).newInstance(random); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } checkNotNull(fairyModule, FAIRY_MODULE_NOT_FOUND); return fairyModule; }

Target:
private static FairyModule getFairyModuleForLocale(Locale locale, Random random) { LanguageCode code = LanguageCode.valueOf(locale.getLanguage().toUpperCase()); switch (code) { case PL: return new PlFairyModule(random); case EN: return new EnFairyModule(random); default: return new EnFairyModule(random); } }
Source:
private void writeConfigToFile(File configFile) throws IOException { if (!SystemUtil.isWindows()) { update(configFile); return; } int retries = 1; while (retries <= 5) { try { update(configFile); return; } catch (Exception e) { try { System.out.println(String.format("Retry attempt - %s. Error: %s", retries, e.getMessage())); e.printStackTrace(); Thread.sleep(10); } catch (InterruptedException e1) { e1.printStackTrace(); } retries = retries + 1; } } throw new RuntimeException(String.format("Could not write to config file after %s attempts", retries)); }

Target:
private void writeConfigToFile(File configFile) throws IOException { if (!SystemUtil.isWindows()) { update(configFile); return; } int retries = 1; while (retries <= 5) { try { update(configFile); return; } catch (IOException e) { try { System.out.println(String.format("Retry attempt - %s. Error: %s", retries, e.getMessage())); e.printStackTrace(); Thread.sleep(10); } catch (InterruptedException e1) { e1.printStackTrace(); } retries = retries + 1; } } throw new RuntimeException(String.format("Could not write to config file after %s attempts", retries)); }
Source:
private void enrich(final List<BatchItem> batch, final EventType eventType) throws EnrichmentException { for (BatchItem item : batch) { try { item.setStep(EventPublishingStep.ENRICHING); enrichment.enrich(item.getEvent(), eventType); } catch (EnrichmentException e) { item.setPublishingStatus(EventPublishingStatus.FAILED); item.setDetail(e.getMessage()); throw e; } } }

Target:
private void enrich(final List<BatchItem> batch, final EventType eventType) throws EnrichmentException { for (BatchItem item : batch) { try { item.setStep(EventPublishingStep.ENRICHING); enrichment.enrich(item.getEvent(), eventType); } catch (EnrichmentException e) { item.updateStatusAndDetail(EventPublishingStatus.FAILED, e.getMessage()); throw e; } } }
Source:
private Stream<Feature> featuresFromNames(String feature, String... additionalFeatures) { Stream.Builder<Feature> transformedFeatures = Stream.builder(); toStream(feature, additionalFeatures) .forEach( f -> { try { transformedFeatures.add(featuresService.getFeature(f)); } catch (Exception e) { throw new SynchronizedInstallerException( "Failed to retrieve feature [" + f + "]", e); } }); return transformedFeatures.build(); }

Target:
private Stream<Feature> featuresFromNames(String feature, String... additionalFeatures) { return toStream(feature, additionalFeatures).map(this::getFeature); }
Source:
public RebaseOperation createRebaseOperation(ExecutionEvent event) throws ExecutionException { Ref ref; ISelection currentSelection = getCurrentSelectionChecked(event); if (currentSelection instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) currentSelection; Object selected = selection.getFirstElement(); ref = getRef(selected); } else ref = null; final Repository repository = getRepository(event); if (repository == null) return null; BasicConfigurationDialog.show(repository); String currentFullBranch = getFullBranch(repository); if (ref != null && ref.getName().equals(currentFullBranch)) ref = null; if (ref == null) { RebaseTargetSelectionDialog rebaseTargetSelectionDialog = new RebaseTargetSelectionDialog( getShell(event), repository); if (rebaseTargetSelectionDialog.open() == IDialogConstants.OK_ID) { String refName = rebaseTargetSelectionDialog.getRefName(); try { ref = repository.getRef(refName); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } else return null; } jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, Repository.shortenRefName(currentFullBranch), ref); return new RebaseOperation(repository, ref); }

Target:
public RebaseOperation createRebaseOperation(ExecutionEvent event) throws ExecutionException { Ref ref; ISelection currentSelection = getCurrentSelectionChecked(event); if (currentSelection instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) currentSelection; Object selected = selection.getFirstElement(); ref = getRef(selected); } else ref = null; final Repository repository = getRepository(event); if (repository == null) return null; BasicConfigurationDialog.show(repository); String currentFullBranch = getFullBranch(repository); if (ref != null && ref.getName().equals(currentFullBranch)) ref = null; if (ref == null) { RebaseTargetSelectionDialog rebaseTargetSelectionDialog = new RebaseTargetSelectionDialog( getShell(event), repository); if (rebaseTargetSelectionDialog.open() == IDialogConstants.OK_ID) { String refName = rebaseTargetSelectionDialog.getRefName(); try { ref = repository.getRef(refName); } catch (IOException e) { throw new ExecutionException(e.getMessage(), e); } } else return null; } jobname = NLS.bind( UIText.RebaseCurrentRefCommand_RebasingCurrentJobName, Repository.shortenRefName(currentFullBranch), ref.getName()); return new RebaseOperation(repository, ref); }
Source:
public void failsOverMultipleTimesWithFailingLeader() { for (int i = 0; i < FAILOVERS; i++) { target.continueOrPropagate( i % CLUSTER_SIZE == 0 ? EXCEPTION_WITHOUT_RETRY_AFTER : EXCEPTION_WITH_RETRY_AFTER); } }

Target:
public void failsOverMultipleTimesWithFailingLeader() { String initialUrl = target.url(); for (int i = 0; i < FAILOVERS; i++) { target.continueOrPropagate( target.url().equals(initialUrl) ? EXCEPTION_WITHOUT_RETRY_AFTER : EXCEPTION_WITH_RETRY_AFTER); } }
Source:
public BranchConfigurationDialog(Shell shell, String branchName, Repository repository) { super(shell); myBranchName = branchName; myRepository = repository; myConfig = myRepository.getConfig(); setShellStyle(getShellStyle() | SWT.SHELL_TRIM); myTitle = UIText.BranchConfigurationDialog_BranchConfiguration; setHelpAvailable(false); }

Target:
public BranchConfigurationDialog(Shell shell, String branchName, Repository repository) { super(shell); myBranchName = branchName; myRepository = repository; myConfig = myRepository.getConfig(); setShellStyle(getShellStyle() | SWT.SHELL_TRIM); myTitle = UIText.BranchConfigurationDialog_BranchConfigurationTitle; setHelpAvailable(false); }
Source:
private boolean visible(final Widget w) { if (w.isDisposed()) return false; return Display.syncExec(new ResultRunnable<Boolean>() { @Override public Boolean run() { return !((w instanceof Control) && !((Control) w).getVisible()); } }); }

Target:
private boolean visible(final Widget w) { if (w.isDisposed()) { return false; } return Display.syncExec(new ResultRunnable<Boolean>() { @Override public Boolean run() { return !((w instanceof Control) && !((Control) w).getVisible()); } }); }
Source:
public void adsFandomBtfBlockDesktop(String article) { AdsFandomObject fandomPage = loadPage(article); fandomPage.verifySlot(AdsFandomContent.TOP_LEADERBOARD); fandomPage.verifySlot(AdsFandomContent.TOP_BOXAD); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.INCONTENT_BOXAD), assertionMessage); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.BOTTOM_LEADERBOARD), assertionMessage); }

Target:
public void adsFandomBtfBlockDesktop(String article) { AdsFandomObject fandomPage = loadPage(article); fandomPage.verifySlot(AdsFandomContent.TOP_LEADERBOARD); fandomPage.verifySlot(AdsFandomContent.TOP_BOXAD); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.INCONTENT_BOXAD), ASSERT_MESSAGE); Assertion.assertNull(fandomPage.getSlot(AdsFandomContent.BOTTOM_LEADERBOARD), ASSERT_MESSAGE); }
Source:
public final void beforeRun() throws Exception { cacheService = getService(); try { recordStore = getOrCreateStoreIfAllowed(); CacheConfig<?, ?> cacheConfig = cacheService.getCacheConfig(name); if (cacheConfig != null) { tenantContext = cacheConfig.getTenantControl().setTenant(true); } } catch (CacheNotExistsException e) { dispose(); rethrowOrSwallowIfBackup(e); } catch (Throwable t) { dispose(); throw ExceptionUtil.rethrow(t, Exception.class); } if (recordStore != null && recordStore.isWanReplicationEnabled()) { wanEventPublisher = cacheService.getCacheWanEventPublisher(); } beforeRunInternal(); }

Target:
public final void beforeRun() throws Exception { cacheService = getService(); try { recordStore = getOrCreateStoreIfAllowed(); CacheConfig<?, ?> cacheConfig; if (recordStore != null) { cacheConfig = recordStore.getConfig(); } else { cacheConfig = cacheService.getCacheConfig(name); } if (cacheConfig != null) { tenantContext = getTenantControl(cacheConfig).setTenant(true); } } catch (CacheNotExistsException e) { dispose(); rethrowOrSwallowIfBackup(e); } catch (Throwable t) { dispose(); throw ExceptionUtil.rethrow(t, Exception.class); } if (recordStore != null && recordStore.isWanReplicationEnabled()) { wanEventPublisher = cacheService.getCacheWanEventPublisher(); } beforeRunInternal(); }
Source:
public String toFileHistory(final Branch.NameKey branch, final String file) { ParameterizedString pattern = new ParameterizedString(type.getFileHistory()); final Map<String, String> p = new HashMap<String, String>(); p.put("project", encode(branch.getParentKey().get())); p.put("branch", encode(branch.get())); p.put("file", URL.encodeQueryString(file)); return baseUrl + pattern.replace(p); }

Target:
public String toFileHistory(final Branch.NameKey branch, final String file) { ParameterizedString pattern = new ParameterizedString(type.getFileHistory()); final Map<String, String> p = new HashMap<String, String>(); p.put("project", encode(branch.getParentKey().get())); p.put("branch", encode(branch.get())); p.put("file", encode(file)); return baseUrl + pattern.replace(p); }
Source:
public CodecState( MediaTimeProvider mediaTimeProvider, MediaExtractor extractor, int trackIndex, MediaFormat format, MediaCodec codec, boolean limitQueueDepth, boolean tunneled, int audioSessionId) { mMediaTimeProvider = mediaTimeProvider; mExtractor = extractor; mTrackIndex = trackIndex; mFormat = format; mSawInputEOS = mSawOutputEOS = false; mLimitQueueDepth = limitQueueDepth; mTunneled = tunneled; mAudioSessionId = audioSessionId; mSampleBaseTimeUs = -1; mCodec = codec; mAvailableInputBufferIndices = new LinkedList<Integer>(); mAvailableOutputBufferIndices = new LinkedList<Integer>(); mAvailableOutputBufferInfos = new LinkedList<MediaCodec.BufferInfo>(); mPresentationTimeUs = 0; String mime = mFormat.getString(MediaFormat.KEY_MIME); Log.d(TAG, "CodecState::CodecState " + mime); mIsAudio = mime.startsWith("audio/"); if (mTunneled && !mIsAudio) { mCodec.setOnFrameRenderedListener(this, null); } }

Target:
public CodecState( MediaTimeProvider mediaTimeProvider, MediaExtractor extractor, int trackIndex, MediaFormat format, MediaCodec codec, boolean limitQueueDepth, boolean tunneled, int audioSessionId) { mMediaTimeProvider = mediaTimeProvider; mExtractor = extractor; mTrackIndex = trackIndex; mFormat = format; mSawInputEOS = mSawOutputEOS = false; mLimitQueueDepth = limitQueueDepth; mTunneled = tunneled; mAudioSessionId = audioSessionId; mSampleBaseTimeUs = -1; mCodec = codec; mAvailableInputBufferIndices = new LinkedList<Integer>(); mAvailableOutputBufferIndices = new LinkedList<Integer>(); mAvailableOutputBufferInfos = new LinkedList<MediaCodec.BufferInfo>(); mPresentationTimeUs = 0; String mime = mFormat.getString(MediaFormat.KEY_MIME); Log.d(TAG, "CodecState::CodecState " + mime); mIsAudio = mime.startsWith("audio/"); if (mTunneled && !mIsAudio) { mOnFrameRenderedListener = new OnFrameRenderedListener(mCodec); } }
Source:
public void markRead(List<Notification> notifications) { final String idListStr = joinNotificationIds(notifications); new EditTokenClient().request(wiki, new EditTokenClient.Callback() { @Override public void success(@NonNull Call<EditToken> call, @NonNull String token) { service.markRead(token, idListStr).enqueue(new retrofit2.Callback<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>>() { @Override public void onResponse(Call<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> call, Response<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> response) { } @Override public void onFailure(Call<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> call, Throwable t) { L.e(t); } }); } @Override public void failure(@NonNull Call<EditToken> call, @NonNull Throwable t) { L.e(t); } }); }

Target:
public void markRead(List<Notification> notifications) { final String idListStr = TextUtils.join("|", notifications); editTokenClient.request(wiki, new EditTokenClient.Callback() { @Override public void success(@NonNull Call<EditToken> call, @NonNull String token) { requestMarkRead(service, token, idListStr).enqueue(new retrofit2.Callback<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>>() { @Override public void onResponse(Call<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> call, Response<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> response) { } @Override public void onFailure(Call<MwQueryResponse<MarkReadResponse.QueryMarkReadResponse>> call, Throwable t) { L.e(t); } }); } @Override public void failure(@NonNull Call<EditToken> call, @NonNull Throwable t) { L.e(t); } }); }
Source:
public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (message.getHandSlot() == EquipmentSlot.HAND) { if (!InventoryUtil.isEmpty(player.getItemInHand()) && player.getItemInHand().getType() == Material.LEASH) { if (this.isLeashed()) { return false; } if (EventFactory.callEvent(new PlayerLeashEntityEvent(this, player, player)).isCancelled()) { return false; } setLeashHolder(player); } else if (player.equals(this.getLeashHolder())) { if (EventFactory.callEvent(new PlayerUnleashEntityEvent(this, player)).isCancelled()) { return false; } setLeashHolder(null); if (player.getGameMode() != GameMode.CREATIVE) { world.dropItemNaturally(this.location, new ItemStack(Material.LEASH)); } } return true; } return false; }

Target:
public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (message.getAction() != Action.INTERACT.ordinal()) { return false; } ItemStack handItem = InventoryUtil.itemOrEmpty(player.getInventory().getItem(message.getHandSlot())); if (isLeashed() && player.equals(this.getLeashHolder()) && message.getHandSlot() == EquipmentSlot.HAND) { if (EventFactory.callEvent(new PlayerUnleashEntityEvent(this, player)).isCancelled()) { return false; } setLeashHolder(null); if (player.getGameMode() != GameMode.CREATIVE) { world.dropItemNaturally(this.location, new ItemStack(Material.LEASH)); } return true; } else if (!InventoryUtil.isEmpty(handItem) && handItem.getType() == Material.LEASH) { if (!GlowLeashHitch.isAllowedLeashHolder(this.getType()) || this.isLeashed() || EventFactory.callEvent(new PlayerLeashEntityEvent(this, player, player)).isCancelled()) { return false; } if (player.getGameMode() != GameMode.CREATIVE) { if (handItem.getAmount() > 1) { handItem.setAmount(handItem.getAmount() - 1); } else { handItem = InventoryUtil.createEmptyStack(); } player.getInventory().setItem(message.getHandSlot(), handItem); } setLeashHolder(player); return true; } return false; }
Source:
public void handlesSocket() throws IOException { final Socket socket = Mockito.mock(Socket.class); Mockito.when(socket.getInputStream()).thenReturn( new ByteArrayInputStream( Joiner.on("\r\n").join( "POST / HTTP/1.1", "Host:localhost", "Content-Length: 4", "", "hi" ).getBytes() ) ); Mockito.when(socket.getLocalAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getLocalPort()).thenReturn(0); Mockito.when(socket.getInetAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getPort()).thenReturn(0); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Mockito.when(socket.getOutputStream()).thenReturn(baos); new BkBasic(new TkText("Hello world!")).accept(socket); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("Hello world") ); }

Target:
public void handlesSocket() throws IOException { final Socket socket = Mockito.mock(Socket.class); Mockito.when(socket.getInputStream()).thenReturn( new ByteArrayInputStream( Joiner.on("\r\n").join( "GET / HTTP/1.1", "Host:localhost", "Content-Length: 2", "", "hi" ).getBytes() ) ); Mockito.when(socket.getLocalAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getLocalPort()).thenReturn(0); Mockito.when(socket.getInetAddress()).thenReturn( InetAddress.getLocalHost() ); Mockito.when(socket.getPort()).thenReturn(0); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); Mockito.when(socket.getOutputStream()).thenReturn(baos); new BkBasic(new TkText("Hello world!")).accept(socket); MatcherAssert.assertThat( baos.toString(), Matchers.containsString("Hello world") ); }
Source:
private Mono<SearchPagedResponse> search(SearchRequest request, RequestOptions requestOptions, String continuationToken, SearchFirstPageResponseWrapper firstPageResponseWrapper, Context context) { if (continuationToken == null && firstPageResponseWrapper.getFirstPageResponse() != null) { return Mono.just(firstPageResponseWrapper.getFirstPageResponse()); } SearchRequest requestToUse = (continuationToken == null) ? request : SearchContinuationToken.deserializeToken(serviceVersion.getVersion(), continuationToken); return restClient.documents().searchPostWithRestResponseAsync(requestToUse, RequestOptionsConverter.map(requestOptions), context) .onErrorMap(MappingUtils::exceptionMapper) .map(searchDocumentResponse -> new SearchPagedResponse(searchDocumentResponse, serviceVersion)) .doOnNext(response -> { if (continuationToken == null) { firstPageResponseWrapper.setFirstPageResponse(response); } }); }

Target:
private Mono<SearchPagedResponse> search(SearchRequest request, RequestOptions requestOptions, String continuationToken, SearchFirstPageResponseWrapper firstPageResponseWrapper, Context context) { if (continuationToken == null && firstPageResponseWrapper.getFirstPageResponse() != null) { return Mono.just(firstPageResponseWrapper.getFirstPageResponse()); } SearchRequest requestToUse = (continuationToken == null) ? request : SearchContinuationToken.deserializeToken(serviceVersion.getVersion(), continuationToken); return restClient.documents().searchPostWithRestResponseAsync(requestToUse, RequestOptionsConverter.map(requestOptions), context) .onErrorMap(MappingUtils::exceptionMapper) .map(searchDocumentResponse -> { SearchPagedResponse response = new SearchPagedResponse(searchDocumentResponse, serviceVersion); if (continuationToken == null) { firstPageResponseWrapper.setFirstPageResponse(response); } return response; }); }
Source:
protected Ord<RelDataType> getNewFieldForOldInput(int oldOrdinal, int existingOffset) { assert currentRel != null; int newOrdinal = 0; RelNode oldInput = null; RelNode newInput = null; for (RelNode oldInput1 : currentRel.getInputs()) { newInput = getNewForOldRel(oldInput1); RelDataType oldInputType = oldInput1.getRowType(); int n = oldInputType.getFieldCount(); if (oldOrdinal < n) { oldInput = oldInput1; break; } newOrdinal += newInput.getRowType().getFieldCount(); oldOrdinal -= n; } assert oldInput != null; assert newInput != null; RelDataType oldInputType = oldInput.getRowType(); final int newOffset = calculateFlattenedOffset(oldInputType, oldOrdinal) + existingOffset; newOrdinal += newOffset; final RelDataTypeField field = newInput.getRowType().getFieldList().get(newOffset); return Ord.of(newOrdinal, field.getType()); }

Target:
private Ord<RelDataType> getNewFieldForOldInput(int oldOrdinal, int existingOffset) { assert currentRel != null; int newOrdinal = 0; RelNode oldInput = null; RelNode newInput = null; for (RelNode oldInput1 : currentRel.getInputs()) { newInput = getNewForOldRel(oldInput1); RelDataType oldInputType = oldInput1.getRowType(); int n = oldInputType.getFieldCount(); if (oldOrdinal < n) { oldInput = oldInput1; break; } newOrdinal += newInput.getRowType().getFieldCount(); oldOrdinal -= n; } assert oldInput != null; assert newInput != null; RelDataType oldInputType = oldInput.getRowType(); final int newOffset = calculateFlattenedOffset(oldInputType, oldOrdinal) + existingOffset; newOrdinal += newOffset; final RelDataTypeField field = newInput.getRowType().getFieldList().get(newOffset); return Ord.of(newOrdinal, field.getType()); }
Source:
private void getFlowingFlowNodes(FlowNode node) { Collection<SequenceFlow> sequenceFlow = node.getOutgoing(); FlowNode flowNode = sequenceFlow.iterator().next().getTarget(); if (flowNode instanceof Gateway) { getFlowingFlowNodesWithConditions((Gateway) flowNode); } else if (flowNode instanceof Task) { this.followingFlowNodes.add(flowNode); getFlowingFlowNodes(flowNode); } }

Target:
private void getFlowingFlowNodes(FlowNode node) { Collection<SequenceFlow> sequenceFlow = node.getOutgoing(); if (sequenceFlow.iterator().hasNext()) { FlowNode flowNode = sequenceFlow.iterator().next().getTarget(); if (flowNode instanceof Gateway) { getFlowingFlowNodesWithConditions((Gateway) flowNode); } else if (flowNode instanceof Task) { this.followingFlowNodes.add(flowNode); getFlowingFlowNodes(flowNode); } } }
Source:
void createWidget (int index) { super.createWidget (index); items = new TableItem [4]; columns = new TableColumn [4]; itemCount = columnCount = 0; if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { setFontDescription(defaultFont().handle); } }

Target:
void createWidget (int index) { super.createWidget (index); items = new TableItem [4]; columns = new TableColumn [4]; itemCount = columnCount = 0; if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
public void entityFieldsShouldBeSerialized() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { JCUser user = ObjectsFactory.getUserWithAllNotInheritedFieldsFilled(); user.setAvatar(new byte[]{1}); user.setVersion(1L); user.setBanReason("Ban Reason"); user.setRole("Role"); Method setLastLogin = User.class.getDeclaredMethod("setLastLogin", DateTime.class); Method setEncodedUsername = User.class.getDeclaredMethod("setEncodedUsername", String.class); setLastLogin.setAccessible(true); setEncodedUsername.setAccessible(true); setLastLogin.invoke(user,new DateTime()); setEncodedUsername.invoke(user,"Encoded Username"); byte[] serialize = SerializationUtils.serialize(user); JCUser serializedUser = (JCUser)SerializationUtils.deserialize(serialize); assertReflectionEquals(user, serializedUser); }

Target:
public void entityFieldsShouldBeSerialized() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { JCUser user = ObjectsFactory.getUserWithAllFieldsFilled(); byte[] serialize = SerializationUtils.serialize(user); JCUser serializedUser = (JCUser)SerializationUtils.deserialize(serialize); assertReflectionEquals(user, serializedUser); }
Source:
private void createAsset(Source source, String assetPath, ResourceResolver r, boolean versioning) throws Exception { try { boolean versioned = false; if (!dryRunMode) { disableWorkflowProcessing(r); AssetManager assetManager = r.adaptTo(AssetManager.class); String type = mimetypeService.getMimeType(source.getName()); if (versioning) { Asset asset = r.getResource(assetPath).adaptTo(Asset.class); versioned = asset != null; assetManager.createRevision(asset, "initial version of asset", asset.getName()); r.commit(); r.refresh(); } Asset asset = assetManager.createAsset(assetPath, source.getStream(), type, false); if (asset == null) { Logger.getLogger(AssetIngestor.class.getName()).log(Level.SEVERE, null, new AssetIngestorException("Cannot create asset: asset is null on path " + assetPath)); } else { saveMigrationInfo(source, asset); } r.commit(); r.refresh(); } if (versioned) { trackDetailedActivity(assetPath, "Revised", "Created new version of asset", source.getLength()); } else { trackDetailedActivity(assetPath, "Create", "Imported asset", source.getLength()); } incrementBytes(importedData, source.getLength()); incrementCount(importedAssets, 1L); } finally { source.close(); } }

Target:
private void createAsset(Source source, String assetPath, ResourceResolver r, boolean versioning) throws Exception { try { boolean versioned = false; if (!dryRunMode) { disableWorkflowProcessing(r); AssetManager assetManager = r.adaptTo(AssetManager.class); String type = mimetypeService.getMimeType(source.getName()); if (versioning) { Asset asset = r.getResource(assetPath).adaptTo(Asset.class); versioned = asset != null; assetManager.createRevision(asset, "initial version of asset", asset.getName()); r.commit(); r.refresh(); } Asset asset = assetManager.createAsset(assetPath, source.getStream(), type, false); if (asset == null) { AssetIngestorException ex = new AssetIngestorException("Cannot create asset: asset is null on path " + assetPath); Logger.getLogger(AssetIngestor.class.getName()).log(Level.SEVERE, null, ex); throw ex; } saveMigrationInfo(source, asset); r.commit(); r.refresh(); } if (versioned) { trackDetailedActivity(assetPath, "Revised", "Created new version of asset", source.getLength()); } else { trackDetailedActivity(assetPath, "Create", "Imported asset", source.getLength()); } incrementBytes(importedData, source.getLength()); incrementCount(importedAssets, 1L); } finally { source.close(); } }
Source:
public User signup(String name) { control(by.input("username")).set(name); control(by.name("Submit")).clickAndWaitToBecomeStale(); return new User(getJenkins(), name); }

Target:
public User signup(String name) { control(by.input("username")).set(name); control(by.name("Submit")).resolve().submit(); return new User(getJenkins(), name); }
Source:
public DSLSentence copy() { final DSLSentence copy = new DSLSentence(); copy.drl = getDrl(); copy.definition = getDefinition(); if (getValues() != null) { copy.values = new ArrayList<>(getValues()); } return copy; }

Target:
public DSLSentence copy() { final DSLSentence copy = new DSLSentence(); copy.drl = getDrl(); copy.definition = getDefinition(); copy.values = mapCopy(getValues()); return copy; }
Source:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); fLayout = getLayoutFromEnv(); ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); builder.add(new ContextVtidAspect(fLayout)); builder.add(new ContextVpidAspect(fLayout)); builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }

Target:
public void initTrace(IResource resource, String path, Class<? extends ITmfEvent> eventType) throws TmfTraceException { super.initTrace(resource, path, eventType); ILttngUstEventLayout layout = getLayoutFromEnv(); fLayout = layout; ImmutableSet.Builder<ITmfEventAspect<?>> builder = ImmutableSet.builder(); builder.addAll(LTTNG_UST_ASPECTS); if (checkFieldPresent(layout.contextVtid())) { builder.add(new ContextVtidAspect(layout)); } if (checkFieldPresent(layout.contextVpid())) { builder.add(new ContextVpidAspect(layout)); } builder.addAll(createCounterAspects(this)); fUstTraceAspects = builder.build(); }
Source:
public static void unzipFiles(ZipFile zipFile, String targetDirectory, String[] zipEntries, Map<String, String> zipEntryToFilenameMap) throws IOException { byte[] buf = new byte[FILE_COPY_BUFFER_SIZE]; File dir = new File(targetDirectory); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create target directory: " + targetDirectory); } if (zipEntryToFilenameMap == null) { zipEntryToFilenameMap = new HashMap<>(); } BufferedInputStream zis = null; BufferedOutputStream bos = null; try { for (String requestedEntry : zipEntries) { ZipEntry ze = zipFile.getEntry(requestedEntry); if (ze != null) { String name = ze.getName(); if (zipEntryToFilenameMap.containsKey(name)) { name = zipEntryToFilenameMap.get(name); } validateFilename(name, dir); File destFile = new File(dir, name); if (!ze.isDirectory()) { Timber.i("uncompress %s", name); zis = new BufferedInputStream(zipFile.getInputStream(ze)); bos = new BufferedOutputStream(new FileOutputStream(destFile), FILE_COPY_BUFFER_SIZE); int n; while ((n = zis.read(buf, 0, FILE_COPY_BUFFER_SIZE)) != -1) { bos.write(buf, 0, n); } bos.flush(); bos.close(); zis.close(); } } } } finally { if (bos != null) { bos.close(); } if (zis != null) { zis.close(); } } }

Target:
public static void unzipFiles(ZipFile zipFile, String targetDirectory, String[] zipEntries, Map<String, String> zipEntryToFilenameMap) throws IOException { byte[] buf = new byte[FILE_COPY_BUFFER_SIZE]; File dir = new File(targetDirectory); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create target directory: " + targetDirectory); } if (zipEntryToFilenameMap == null) { zipEntryToFilenameMap = new HashMap<>(); } BufferedInputStream zis = null; BufferedOutputStream bos = null; try { for (String requestedEntry : zipEntries) { ZipEntry ze = zipFile.getEntry(requestedEntry); if (ze != null) { String name = ze.getName(); if (zipEntryToFilenameMap.containsKey(name)) { name = zipEntryToFilenameMap.get(name); } File destFile = new File(dir, name); if (!isInside(destFile, dir)) { Timber.e("Refusing to decompress invalid path: " + destFile.getCanonicalPath()); throw new IOException("File is outside extraction target directory."); } if (!ze.isDirectory()) { Timber.i("uncompress %s", name); zis = new BufferedInputStream(zipFile.getInputStream(ze)); bos = new BufferedOutputStream(new FileOutputStream(destFile), FILE_COPY_BUFFER_SIZE); int n; while ((n = zis.read(buf, 0, FILE_COPY_BUFFER_SIZE)) != -1) { bos.write(buf, 0, n); } bos.flush(); bos.close(); zis.close(); } } } } finally { if (bos != null) { bos.close(); } if (zis != null) { zis.close(); } } }
Source:
private static <E> View<E> load(Configuration conf) { Class<E> type; try { type = (Class<E>)conf.getClass(KITE_TYPE, GenericData.Record.class); } catch (RuntimeException e) { if (e.getCause() instanceof ClassNotFoundException) { throw new RuntimeException(String.format( "The Java class %s for the entity type could not be found", conf.get(KITE_TYPE)), e.getCause()); } else { throw e; } } String inputUri = conf.get(KITE_INPUT_URI); if (inputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(inputUri, type); }

Target:
private static <E> View<E> load(Configuration conf) { Class<E> type; try { type = (Class<E>)conf.getClass(KITE_TYPE, GenericData.Record.class); } catch (RuntimeException e) { if (e.getCause() instanceof ClassNotFoundException) { throw new TypeNotFoundException(String.format( "The Java class %s for the entity type could not be found", conf.get(KITE_TYPE)), e.getCause()); } else { throw e; } } String inputUri = conf.get(KITE_INPUT_URI); if (inputUri == null) { return Datasets.<E, View<E>>load( new URIBuilder( conf.get(KITE_REPOSITORY_URI), conf.get(KITE_DATASET_NAME)) .build(), type); } return Datasets.<E, View<E>>load(inputUri, type); }
Source:
public PercentType[] toRGB() { PercentType red = null; PercentType green = null; PercentType blue = null; BigDecimal h = hue.divide(BigDecimal.valueOf(100), 10, BigDecimal.ROUND_HALF_UP); BigDecimal s = saturation.divide(BigDecimal.valueOf(100)); int hInt = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .intValue(); BigDecimal f = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .remainder(BigDecimal.ONE); PercentType a = new PercentType(value.multiply(BigDecimal.ONE.subtract(s))); PercentType b = new PercentType(value.multiply(BigDecimal.ONE.subtract(s.multiply(f)))); PercentType c = new PercentType( value.multiply(BigDecimal.ONE.subtract((BigDecimal.ONE.subtract(f)).multiply(s)))); if (hInt == 0 || hInt == 6) { red = getBrightness(); green = c; blue = a; } else if (hInt == 1) { red = b; green = getBrightness(); blue = a; } else if (hInt == 2) { red = a; green = getBrightness(); blue = c; } else if (hInt == 3) { red = a; green = b; blue = getBrightness(); } else if (hInt == 4) { red = c; green = a; blue = getBrightness(); } else if (hInt == 5) { red = getBrightness(); green = a; blue = b; } else { throw new RuntimeException(); } return new PercentType[] { red, green, blue }; }

Target:
public PercentType[] toRGB() { PercentType red = null; PercentType green = null; PercentType blue = null; BigDecimal h = hue.divide(BigDecimal.valueOf(100), 10, BigDecimal.ROUND_HALF_UP); BigDecimal s = saturation.divide(BigDecimal.valueOf(100)); int hInt = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .intValue(); BigDecimal f = h.multiply(BigDecimal.valueOf(5)).divide(BigDecimal.valueOf(3), 10, BigDecimal.ROUND_HALF_UP) .remainder(BigDecimal.ONE); PercentType a = new PercentType(value.multiply(BigDecimal.ONE.subtract(s))); PercentType b = new PercentType(value.multiply(BigDecimal.ONE.subtract(s.multiply(f)))); PercentType c = new PercentType( value.multiply(BigDecimal.ONE.subtract((BigDecimal.ONE.subtract(f)).multiply(s)))); switch (hInt) { case 0: case 6: red = getBrightness(); green = c; blue = a; break; case 1: red = b; green = getBrightness(); blue = a; break; case 2: red = a; green = getBrightness(); blue = c; break; case 3: red = a; green = b; blue = getBrightness(); break; case 4: red = c; green = a; blue = getBrightness(); break; case 5: red = getBrightness(); green = a; blue = b; break; default: throw new RuntimeException(); } return new PercentType[] { red, green, blue }; }
Source:
public SimpleGarbageCollector(Opts opts, VolumeManager fs, ServerConfigurationFactory confFactory) { super(confFactory); this.opts = opts; this.fs = fs; final AccumuloConfiguration conf = getConfiguration(); GcMetrics2 gcMetrics2 = null; MetricsSystemHelper.configure("acc_gc"); gcMetrics2 = GcMetrics2.init(this, MetricsSystemHelper.getInstance()); gcMetrics2.register(); final long gcDelay = conf.getTimeInMillis(Property.GC_CYCLE_DELAY); final String useFullCompaction = conf.get(Property.GC_USE_FULL_COMPACTION); log.info("start delay: milliseconds", getStartDelay()); log.info("time delay: milliseconds", gcDelay); log.info("safemode: {}", opts.safeMode); log.info("verbose: {}", opts.verbose); log.info("memory threshold: of bytes", CANDIDATE_MEMORY_PERCENTAGE, Runtime.getRuntime().maxMemory()); log.info("delete threads: {}", getNumDeleteThreads()); log.info("gc post metadata action: {}", useFullCompaction); }

Target:
public SimpleGarbageCollector(Opts opts, VolumeManager fs, ServerConfigurationFactory confFactory) { super(confFactory); this.opts = opts; this.fs = fs; final AccumuloConfiguration conf = getConfiguration(); if (conf.getBoolean(Property.GC_ENABLE_METRICS2)) { MetricsSystemHelper.configure("acc_gc"); GcHadoopMetrics2 gcHadoopMetrics2 = GcHadoopMetrics2.init(this, MetricsSystemHelper.getInstance()); gcHadoopMetrics2.register(); } else { MetricsSystemHelper.configure(SimpleGarbageCollector.class.getSimpleName()); } final long gcDelay = conf.getTimeInMillis(Property.GC_CYCLE_DELAY); final String useFullCompaction = conf.get(Property.GC_USE_FULL_COMPACTION); log.info("start delay: milliseconds", getStartDelay()); log.info("time delay: milliseconds", gcDelay); log.info("safemode: {}", opts.safeMode); log.info("verbose: {}", opts.verbose); log.info("memory threshold: of bytes", CANDIDATE_MEMORY_PERCENTAGE, Runtime.getRuntime().maxMemory()); log.info("delete threads: {}", getNumDeleteThreads()); log.info("gc post metadata action: {}", useFullCompaction); }
Source:
public static <A, B, C, D> Equal<P4<A, B, C, D>> p4Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed) { return new Equal<P4<A, B, C, D>>(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4())); }

Target:
public static <A, B, C, D> Equal<P4<A, B, C, D>> p4Equal(final Equal<A> ea, final Equal<B> eb, final Equal<C> ec, final Equal<D> ed) { return equal(p1 -> p2 -> ea.eq(p1._1(), p2._1()) && eb.eq(p1._2(), p2._2()) && ec.eq(p1._3(), p2._3()) && ed.eq(p1._4(), p2._4())); }
Source:
protected void buildVmWatchdog() { throw new NotImplementedException("not implemented"); }

Target:
protected void buildVmWatchdog() { }
Source:
public void cleanup() { if (sharedTestEnv.isBigtable() && !enableTestForBigtable()) { return; } try (Admin admin = getConnection().getAdmin()) { delete(admin, tableName); delete(admin, anotherTableName); delete(admin, clonedTableName); for (SnapshotDescription snapDesc : admin.listSnapshots(snapshotName + ".*")) { admin.deleteSnapshot(snapDesc.getName()); } for (SnapshotDescription snapDesc : admin.listSnapshots(anotherSnapshotName + ".*")) { admin.deleteSnapshot(snapDesc.getName()); } } catch (Exception e) { e.printStackTrace(); } }

Target:
public void cleanup() { if (sharedTestEnv.isBigtable() && !enableTestForBigtable()) { return; } try (Admin admin = getConnection().getAdmin()) { delete(admin, tableName); delete(admin, anotherTableName); delete(admin, clonedTableName); for (SnapshotDescription snapDesc : admin.listSnapshots(snapshotName + ".*")) { deleteSnapshot(snapDesc.getName()); } for (SnapshotDescription snapDesc : admin.listSnapshots(anotherSnapshotName + ".*")) { deleteSnapshot(snapDesc.getName()); } } catch (Exception e) { e.printStackTrace(); } }
Source:
public boolean test(MessageInfo messageInfo) { if (accountService != null) { Account account = accountService.getAccountById(messageInfo.getAccountId()); if (account == null) { logger.info("Can't get account through accountService : {}", accountService); return false; } Container container = account.getContainerById(messageInfo.getContainerId()); if (container == null) { logger.info("Can't get container through account : {}", account); return false; } Container.ContainerStatus status = container.getStatus(); if (status == Container.ContainerStatus.DELETE_IN_PROGRESS && container.getDeleteTriggerTime() + TimeUnit.DAYS.toMillis( replicationConfig.replicationContainerDeletionRetentionDays) < System.currentTimeMillis()) { logger.trace("Container is not qualified with retention time yet", container); return false; } if (status == Container.ContainerStatus.DELETE_IN_PROGRESS || status == Container.ContainerStatus.INACTIVE) { logger.trace("Container will be skipped during replication", container); return true; } else { logger.trace("Container is Active", container); return false; } } else { logger.trace("Current accountService : {}", accountService); return false; } }

Target:
public boolean test(MessageInfo messageInfo) { if (accountService != null) { Account account = accountService.getAccountById(messageInfo.getAccountId()); if (account == null) { logger.info("Can't get account through accountService : {}", accountService); return false; } Container container = account.getContainerById(messageInfo.getContainerId()); if (container == null) { logger.info("Can't get container through account : {}", account); return false; } Container.ContainerStatus status = container.getStatus(); if (status == Container.ContainerStatus.DELETE_IN_PROGRESS && container.getDeleteTriggerTime() + TimeUnit.DAYS.toMillis( replicationConfig.replicationContainerDeletionRetentionDays) > System.currentTimeMillis()) { logger.debug("Container is not qualified as it’s still within retention time", container); return false; } if (status == Container.ContainerStatus.DELETE_IN_PROGRESS || status == Container.ContainerStatus.INACTIVE) { logger.info("Container will be skipped during replication", container); return true; } else { logger.debug("Container is Active", container); return false; } } else { logger.debug("Current accountService : {}", accountService); return false; } }
Source:
public boolean canReadFile(File file) { return file.canRead(); }

Target:
public static boolean canReadFile(File file) { return file.canRead(); }
Source:
void normalizeLinks(CheServiceImpl serviceToNormalizeLinks, Map<String, CheServiceImpl> services) { final List<String> containerLinks = serviceToNormalizeLinks.getLinks(); for (int i = 0; i < containerLinks.size(); i++) { String serviceNameAndAliasToLink[] = containerLinks.get(i).split(":"); String serviceName = serviceNameAndAliasToLink[0]; String serviceAlias = (serviceNameAndAliasToLink.length > 1) ? serviceNameAndAliasToLink[1] : null; CheServiceImpl serviceLinkTo = services.get(serviceName); if (serviceLinkTo != null) { String containerNameLinkTo = serviceLinkTo.getContainerName(); containerLinks.set(i, (serviceAlias == null) ? containerNameLinkTo + ':' + serviceName : containerNameLinkTo + ':' + serviceAlias); } else { LOG.error("Attempt to link non existing service to service.", serviceName, serviceToNormalizeLinks); } } }

Target:
void normalizeLinks(CheServiceImpl serviceToNormalizeLinks, Map<String, CheServiceImpl> services) { serviceToNormalizeLinks.setLinks( serviceToNormalizeLinks.getLinks() .stream() .map(link -> { String serviceNameAndAliasToLink[] = link.split(":", 2); String serviceName = serviceNameAndAliasToLink[0]; String serviceAlias = (serviceNameAndAliasToLink.length > 1) ? serviceNameAndAliasToLink[1] : null; CheServiceImpl serviceLinkTo = services.get(serviceName); if (serviceLinkTo != null) { String containerNameLinkTo = serviceLinkTo.getContainerName(); return (serviceAlias == null) ? containerNameLinkTo : containerNameLinkTo + ':' + serviceAlias; } else { throw new IllegalArgumentException("Attempt to link non existing service " + serviceName + " to " + serviceToNormalizeLinks + " service."); } }).collect(toList())); }