auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void cancelFirmwareUpdate(final ThingUID thingUID){ Preconditions.checkNotNull(thingUID, "Thing UID must not be null."); final FirmwareUpdateHandler firmwareUpdateHandler = getFirmwareUpdateHandler(thingUID); if (firmwareUpdateHandler == null) { throw new IllegalArgumentException( String.format("There is no firmware update handler for thing with UID %s.", thingUID)); } logger.debug("Canceling firmware update for thing with UID {}.", thingUID); firmwareUpdateHandler.cancel(); }

Target:
public void cancelFirmwareUpdate(final ThingUID thingUID) { Preconditions.checkNotNull(thingUID, "Thing UID must not be null."); final FirmwareUpdateHandler firmwareUpdateHandler = getFirmwareUpdateHandler(thingUID); if (firmwareUpdateHandler == null) { throw new IllegalArgumentException( String.format("There is no firmware update handler for thing with UID %s.", thingUID)); } final ProgressCallbackImpl progressCallback = getProgressCallback(thingUID); getPool().submit(new Runnable() { @Override public void run() { try { SafeMethodCaller.call(new SafeMethodCaller.ActionWithException<Void>() { @Override public Void call() { logger.debug("Canceling firmware update for thing with UID {}.", thingUID); firmwareUpdateHandler.cancel(); return null; } }); } catch (ExecutionException e) { logger.error(String.format( "Unexpected exception occurred while canceling firmware update of thing with UID %s.", thingUID), e.getCause()); progressCallback.failedInternal("unexpected-handler-error-during-cancel"); } catch (TimeoutException e) { logger.error(String.format("Timeout occurred while canceling firmware update of thing with UID %s.", thingUID), e); progressCallback.failedInternal("timeout-error-during-cancel"); } } }); }
Source:
public CertificateAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration == null) ? Configuration.getGlobalConfiguration().clone() : configuration; URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { throw logger.logExceptionAsError(new IllegalStateException( KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } CertificateServiceVersion serviceVersion = version != null ? version : CertificateServiceVersion.getLatest(); if (pipeline != null) { return new CertificateAsyncClient(vaultUrl, pipeline, serviceVersion); } if (credential == null) { throw logger.logExceptionAsError(new IllegalStateException( KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIALS_REQUIRED))); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), properties.get(SDK_NAME), properties.get(SDK_VERSION), buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); return new CertificateAsyncClient(vaultUrl, pipeline, serviceVersion); }

Target:
public CertificateAsyncClient buildAsyncClient() { Configuration buildConfiguration = (configuration != null) ? configuration : Configuration.getGlobalConfiguration().clone(); URL buildEndpoint = getBuildEndpoint(buildConfiguration); if (buildEndpoint == null) { throw logger.logExceptionAsError(new IllegalStateException( KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED))); } CertificateServiceVersion serviceVersion = version != null ? version : CertificateServiceVersion.getLatest(); if (pipeline != null) { return new CertificateAsyncClient(vaultUrl, pipeline, serviceVersion); } if (credential == null) { throw logger.logExceptionAsError(new IllegalStateException( KeyVaultErrorCodeStrings.getErrorString(KeyVaultErrorCodeStrings.CREDENTIALS_REQUIRED))); } final List<HttpPipelinePolicy> policies = new ArrayList<>(); String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion, buildConfiguration)); HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); return new CertificateAsyncClient(vaultUrl, pipeline, serviceVersion); }
Source:
private void highlightSelectedText(String pageText) { if (this.selectionStart != this.selectionEnd) { int i = Math.min(this.selectionEnd, this.selectionStart); int j = Math.max(this.selectionEnd, this.selectionStart); String s = pageText.substring(i, j); int k = this.font.func_216863_a(pageText, 1, j, true); String s1 = pageText.substring(i, k); Point point = this.func_214194_c(pageText, i); Point point1 = new Point(point.x, point.y + 9); while(!s.isEmpty()) { int l = this.func_214216_b(s1, 114 - point.x); if (s.length() <= l) { point1.x = point.x + this.getTextWidth(s); this.drawSelectionBox(point, point1); break; } l = Math.min(l, s.length() - 1); String s2 = s.substring(0, l); char c0 = s.charAt(l); boolean flag = c0 == ' ' || c0 == '\n'; s = TextFormatting.getFormatString(s2) + s.substring(l + (flag ? 1 : 0)); s1 = TextFormatting.getFormatString(s2) + s1.substring(l + (flag ? 1 : 0)); point1.x = point.x + this.getTextWidth(s2 + " "); this.drawSelectionBox(point, point1); point.x = 0; point.y = point.y + 9; point1.y = point1.y + 9; } } }

Target:
private void highlightSelectedText(String pageText) { if (this.selectionStart != this.selectionEnd) { int i = Math.min(this.selectionEnd, this.selectionStart); int j = Math.max(this.selectionEnd, this.selectionStart); String s = pageText.substring(i, j); int k = this.font.func_216863_a(pageText, 1, j, true); String s1 = pageText.substring(i, k); Point point = StoneTabletUtils.createPointer(font, pageText, i); Point point1 = new Point(point.x, point.y + 9); while(!s.isEmpty()) { int l = StoneTabletUtils.sizeStringToWidth(font, s1, 114 - point.x); if (s.length() <= l) { point1.x = point.x + this.getTextWidth(s); this.drawSelectionBox(point, point1); break; } l = Math.min(l, s.length() - 1); String s2 = s.substring(0, l); char c0 = s.charAt(l); boolean flag = c0 == ' ' || c0 == '\n'; s = TextFormatting.getFormatString(s2) + s.substring(l + (flag ? 1 : 0)); s1 = TextFormatting.getFormatString(s2) + s1.substring(l + (flag ? 1 : 0)); point1.x = point.x + this.getTextWidth(s2 + " "); this.drawSelectionBox(point, point1); point.x = 0; point.y = point.y + 9; point1.y = point1.y + 9; } } }
Source:
private boolean solrSpellcheckHasResults(QueryResponse solrResponse) { return solrResponse.getSpellCheckResponse() != null && solrResponse.getResults().size() == 0 && solrResponse.getSpellCheckResponse().getCollatedResults().size() > 0; }

Target:
private boolean solrSpellcheckHasResults(QueryResponse solrResponse) { return solrResponse.getSpellCheckResponse() != null && solrResponse.getResults().size() == 0 && CollectionUtils.isNotEmpty(solrResponse.getSpellCheckResponse().getCollatedResults()); }
Source:
public CliFunctionResult executeFunction(FunctionContext<Object[]> context) { Object[] arguments = context.getArguments(); String[] includeRegions = (String[]) arguments[0]; Set<String> includeRegionsSet = null; if (includeRegions != null) { includeRegionsSet = new HashSet<>(Arrays.asList(includeRegions)); } String[] excludeRegions = (String[]) arguments[1]; Set<String> excludeRegionsSet = null; if (excludeRegions != null) { excludeRegionsSet = new HashSet<>(Arrays.asList(excludeRegions)); } boolean shouldReassignPrimaries = (boolean) arguments[2]; boolean isStatusCommand = false; if (arguments.length > 3) { isStatusCommand = (boolean) arguments[3]; } RestoreRedundancyResults results; try { RestoreRedundancyOperation redundancyOperation = context.getCache().getResourceManager().createRestoreRedundancyOperation(); redundancyOperation.includeRegions(includeRegionsSet); redundancyOperation.excludeRegions(excludeRegionsSet); if (isStatusCommand) { results = redundancyOperation.redundancyStatus(); } else { redundancyOperation.shouldReassignPrimaries(shouldReassignPrimaries); results = redundancyOperation.start().get(); } } catch (Exception ex) { return new CliFunctionResult(context.getMemberName(), CliFunctionResult.StatusState.ERROR, ex.toString()); } if (results.getStatus().equals(ERROR)) { return new CliFunctionResult(context.getMemberName(), CliFunctionResult.StatusState.ERROR, results.getMessage()); } return new CliFunctionResult(context.getMemberName(), results); }

Target:
public CliFunctionResult executeFunction(FunctionContext<Object[]> context) { Object[] arguments = context.getArguments(); String[] includeRegions = (String[]) arguments[0]; Set<String> includeRegionsSet = null; if (includeRegions != null) { includeRegionsSet = new HashSet<>(Arrays.asList(includeRegions)); } String[] excludeRegions = (String[]) arguments[1]; Set<String> excludeRegionsSet = null; if (excludeRegions != null) { excludeRegionsSet = new HashSet<>(Arrays.asList(excludeRegions)); } boolean shouldReassignPrimaries = (boolean) arguments[2]; boolean isStatusCommand = (boolean) arguments[3]; RestoreRedundancyResults results; RestoreRedundancyOperation redundancyOperation = context.getCache().getResourceManager().createRestoreRedundancyOperation(); redundancyOperation.includeRegions(includeRegionsSet); redundancyOperation.excludeRegions(excludeRegionsSet); if (isStatusCommand) { results = redundancyOperation.redundancyStatus(); } else { redundancyOperation.shouldReassignPrimaries(shouldReassignPrimaries); results = redundancyOperation.start().join(); } if (results.getStatus().equals(ERROR)) { return new CliFunctionResult(context.getMemberName(), CliFunctionResult.StatusState.ERROR, results.getMessage()); } return new CliFunctionResult(context.getMemberName(), results); }
Source:
protected int getFontSize(String fontSizeExpression, EAttribute eAttribute, FontData defaultFontData) { int fontSize = defaultFontData.getHeight(); if (fontSizeExpression != null && !fontSizeExpression.isEmpty()) { Eval eval = new Eval(interpreter, variableManager); Integer fontSizeValue = eval.get(eAttribute, fontSizeExpression, Integer.class); if (fontSizeValue != null && fontSizeValue.intValue() != fontSize) { fontSize = fontSizeValue; } } return fontSize; }

Target:
private int getFontSize(String fontSizeExpression, EAttribute eAttribute, FontData defaultFontData) { int fontSize = defaultFontData.getHeight(); if (fontSizeExpression != null && !fontSizeExpression.isEmpty()) { Eval eval = new Eval(interpreter, variableManager); Integer fontSizeValue = eval.get(eAttribute, fontSizeExpression, Integer.class); if (fontSizeValue != null && fontSizeValue.intValue() != fontSize) { fontSize = fontSizeValue; } } return fontSize; }
Source:
public int getWrapIndex (Array<Glyph> glyphs, int start) { int i = start - 1; for (; i >= 1; i--) if (!isWhitespace((char)glyphs.get(i).id)) break; for (; i >= 1; i--) { char ch = (char)glyphs.get(i).id; if (isWhitespace(ch) || isBreakChar(ch)) return i + 1; } for (i=0; i<start; i++) { char ch = (char)glyphs.get(i).id; if (!isWhitespace(ch)) return i; } return 0; }

Target:
public int getWrapIndex (Array<Glyph> glyphs, int start) { int i = start - 1; for (; i >= 1; i--) if (!isWhitespace((char)glyphs.get(i).id)) break; for (; i >= 1; i--) { char ch = (char)glyphs.get(i).id; if (isWhitespace(ch) || isBreakChar(ch)) return i + 1; } return 0; }
Source:
public AgentRequestsStatus getRequestsStatus(BaragonRequest request, AgentRequestType requestType) { final Collection<BaragonAgentMetadata> agentMetadatas = loadBalancerDatastore.getAgentMetadata(request.getLoadBalancerService().getLoadBalancerGroups()); boolean success = true; for (BaragonAgentMetadata agentMetadata : agentMetadatas) { final String baseUrl = agentMetadata.getBaseAgentUri(); Optional<Long> maybePendingRequestTime = agentResponseDatastore.getPendingRequest(request.getLoadBalancerRequestId(), baseUrl); if (maybePendingRequestTime.isPresent()) { if ((System.currentTimeMillis() - maybePendingRequestTime.get()) > baragonMaxRequestTime) { return AgentRequestsStatus.FAILURE; } else { return AgentRequestsStatus.WAITING; } } final Optional<AgentResponseId> maybeAgentResponseId = agentResponseDatastore.getLastAgentResponseId(request.getLoadBalancerRequestId(), requestType, baseUrl); if (!maybeAgentResponseId.isPresent()) { return AgentRequestsStatus.WAITING; } final AgentResponseId agentResponseId = maybeAgentResponseId.get(); if ((agentResponseId.getAttempt() < baragonAgentMaxAttempts - 1) && !agentResponseId.isSuccess()) { return AgentRequestsStatus.RETRY; } else { success = success && agentResponseId.isSuccess(); } } return success ? AgentRequestsStatus.SUCCESS : AgentRequestsStatus.FAILURE; }

Target:
public AgentRequestsStatus getRequestsStatus(BaragonRequest request, AgentRequestType requestType) { final Collection<BaragonAgentMetadata> agentMetadatas = loadBalancerDatastore.getAgentMetadata(request.getLoadBalancerService().getLoadBalancerGroups()); boolean success = true; for (BaragonAgentMetadata agentMetadata : agentMetadatas) { final String baseUrl = agentMetadata.getBaseAgentUri(); Optional<Long> maybePendingRequestTime = agentResponseDatastore.getPendingRequest(request.getLoadBalancerRequestId(), baseUrl); if (maybePendingRequestTime.isPresent()) { if ((System.currentTimeMillis() - maybePendingRequestTime.get()) > baragonAgentRequestTimeout) { LOG.info(String.format("Request %s reached maximum pending request time", request.getLoadBalancerRequestId())); return AgentRequestsStatus.FAILURE; } else { return AgentRequestsStatus.WAITING; } } final Optional<AgentResponseId> maybeAgentResponseId = agentResponseDatastore.getLastAgentResponseId(request.getLoadBalancerRequestId(), requestType, baseUrl); if (!maybeAgentResponseId.isPresent()) { return AgentRequestsStatus.WAITING; } final AgentResponseId agentResponseId = maybeAgentResponseId.get(); if ((agentResponseId.getAttempt() < baragonAgentMaxAttempts - 1) && !agentResponseId.isSuccess()) { return AgentRequestsStatus.RETRY; } else { success = success && agentResponseId.isSuccess(); } } return success ? AgentRequestsStatus.SUCCESS : AgentRequestsStatus.FAILURE; }
Source:
public Set<InstanceConfig> getInstances(String state, String resourceTag) { ResourceInfo resourceInfo = tagResourceInfoMap.get(resourceTag); if (resourceInfo != null) { return resourceInfo.getInstances(state); } return null; }

Target:
public Set<InstanceConfig> getInstances(String state, String resourceTag) { ResourceInfo resourceInfo = tagToResourceMap.get(resourceTag); if (resourceInfo != null) { return resourceInfo.getInstances(state); } return null; }
Source:
public void testVmPassesCpuSocketValidation() { setVmCpuValues(1, 1, 1); assertThat(validator.validateCpuSockets(vm.getStaticData(), COMPAT_VERSION_FOR_CPU_SOCKET_TEST), isValid()); }

Target:
public void testVmPassesCpuSocketValidation() { setVmCpuValues(1, 1, 1); assertThat(VmValidator.validateCpuSockets(vm.getStaticData(), COMPAT_VERSION_FOR_CPU_SOCKET_TEST), isValid()); }
Source:
private boolean isVariableHeight(int lineIndex) { if (styledText.wordWrap || styledText.visualWrap) { return true; } StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) { if (style.font != null || (style.metrics != null && (style.metrics.ascent != 0 || style.metrics.descent != 0)) || style.rise != 0) { return true; } } } return false; }

Target:
private boolean isVariableHeight(int lineIndex) { if (styledText.wordWrap || styledText.visualWrap) { return true; } boolean variableHeight = false; StyleRange[] styles = getStylesForLine(lineIndex); if (styles != null) { for (StyleRange style : styles) variableHeight |= style.isVariableHeight(); } return variableHeight; }
Source:
private EpochResult buildEpochResult(final double trainingLoss, final double testLoss) { modelAccessor.getAndResetMetrics(); return EpochResult.newBuilder() .addAppMetric(MetricKeys.TRAINING_LOSS, trainingLoss) .addAppMetric(MetricKeys.TEST_LOSS, testLoss) .build(); }

Target:
private EpochResult buildEpochResult(final double trainingLoss, final double testLoss) { return EpochResult.newBuilder() .addAppMetric(MetricKeys.TRAINING_LOSS, trainingLoss) .addAppMetric(MetricKeys.TEST_LOSS, testLoss) .build(); }
Source:
public PrimitiveField(Type type, int repetitionLevel, int definitionLevel, boolean required, RichColumnDescriptor descriptor, int id) { super(type, repetitionLevel, definitionLevel, required); this.descriptor = descriptor; this.id = id; }

Target:
public PrimitiveField(Type type, int repetitionLevel, int definitionLevel, boolean required, RichColumnDescriptor descriptor, int id) { super(type, repetitionLevel, definitionLevel, required); this.descriptor = requireNonNull(descriptor, "descriptor is required"); this.id = id; }
Source:
private void init(Map<String, Object> properties) { if (properties == null || properties.isEmpty() || !properties.containsKey(ATLAS_CONFIG_DIR)) { return; } String atlasConfigDir = (String) properties.get(ATLAS_CONFIG_DIR); log.info("Atlas config dir is configured with: ", atlasConfigDir); try { File file = Files.createFile(Paths.get(atlasConfigDir, "atlas-application.properties")).toFile(); file.deleteOnExit(); try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));) { for (Map.Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); log.info("Atlas property key:[{}] value:[{}]", key, value); bufferedWriter.write(key); bufferedWriter.write("="); bufferedWriter.write(value.toString()); bufferedWriter.newLine(); } } } catch (IOException e) { throw new RuntimeException(e); } System.setProperty(ATLAS_CONF, atlasConfigDir); log.info("System property is set as [{}]", ATLAS_CONF, atlasConfigDir); }

Target:
private void init(Map<String, Object> properties) { if (properties == null || properties.isEmpty() || !properties.containsKey(ATLAS_CONFIG_DIR)) { return; } String atlasConfigDir = (String) properties.get(ATLAS_CONFIG_DIR); LOG.info("Atlas config dir is configured with: ", atlasConfigDir); try { File file = Files.createFile(Paths.get(atlasConfigDir, "atlas-application.properties")).toFile(); file.deleteOnExit(); try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file));) { for (Map.Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); LOG.info("Atlas property key:[{}] value:[{}]", key, value); bufferedWriter.write(key); bufferedWriter.write("="); bufferedWriter.write(value.toString()); bufferedWriter.newLine(); } } } catch (IOException e) { throw new RuntimeException(e); } System.setProperty(ATLAS_CONF, atlasConfigDir); LOG.info("System property is set as [{}]", ATLAS_CONF, atlasConfigDir); }
Source:
protected void validate() { boolean remote = fInfo.getSessionType() == SessionType.REMOTE; StringBuilder sb = new StringBuilder(); String hostBinary = fHostBinaryText.getText().trim(); if ( hostBinary.isEmpty() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); } else { File file = new File( hostBinary ); if ( !file.exists() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); } else if ( file.isDirectory() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : Messages.GdbDebugNewExecutableCommand_Invalid_binary ); } } if ( fTargetBinaryText != null ) { if ( fTargetBinaryText.getText().trim().length() == 0 ) { if ( sb.length() != 0 ) { sb.append( "\n " ); } sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); } } if (fStopInMain != null && fStopInMainSymbol != null) { String mainSymbol = fStopInMainSymbol.getText().trim(); if (fStopInMain.getSelection() && mainSymbol.length() == 0) { sb.append("\n "); sb.append(LaunchMessages.getString("CDebuggerTab.Stop_on_startup_at_can_not_be_empty")); } } setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); }

Target:
protected void validate() { boolean remote = fInfo.getSessionType() == SessionType.REMOTE; StringBuilder sb = new StringBuilder(); String hostBinary = fHostBinaryText.getText().trim(); if ( hostBinary.isEmpty() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_must_be_specified : Messages.GdbDebugNewExecutableCommand_Binary_must_be_specified ); } else { File file = new File( hostBinary ); if ( !file.exists() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Host_binary_file_does_not_exist : Messages.GdbDebugNewExecutableCommand_Binary_file_does_not_exist ); } else if ( file.isDirectory() ) { sb.append( ( remote ) ? Messages.GdbDebugNewExecutableCommand_Invalid_host_binary : Messages.GdbDebugNewExecutableCommand_Invalid_binary ); } } if ( fTargetBinaryText != null ) { if ( fTargetBinaryText.getText().trim().length() == 0 ) { if ( sb.length() != 0 ) { sb.append( "\n " ); } sb.append( Messages.GdbDebugNewExecutableCommand_Binary_on_target_must_be_specified ); } } if (fStopInMain != null && fStopInMainSymbol != null) { String mainSymbol = fStopInMainSymbol.getText().trim(); if (fStopInMain.getSelection() && mainSymbol.length() == 0) { if (sb.length() > 0) { sb.append("\n "); } sb.append(LaunchMessages.getString("CDebuggerTab.Stop_on_startup_at_can_not_be_empty")); } } setErrorMessage( ( sb.length() != 0 ) ? sb.toString() : null ); getButton( IDialogConstants.OK_ID ).setEnabled( getErrorMessage() == null ); }
Source:
public void getCapabilitiesGetRequestWorksWithCORS() throws IOException { String url = wpsUrl + "?Service=WPS&Request=GetCapabilities"; method = new GetMethod(url); method.addRequestHeader("Origin", randomOrigin); int code = client.executeMethod(method); assertThat(code, is(equalTo(200))); Header acaoHeader = method.getResponseHeader("Access-Control-Allow-Origin"); assertThat(acaoHeader.toString(), containsString(randomOrigin.toString())); }

Target:
public void getCapabilitiesGetRequestWorksWithCORS() throws IOException { String url = wpsUrl + "?Service=WPS&Request=GetCapabilities"; method = new GetMethod(url); method.addRequestHeader("Origin", randomOrigin); int code = client.executeMethod(method); assertThat(code, is(equalTo(200))); Header acaoHeader = method.getResponseHeader("Access-Control-Allow-Origin"); assertNotNull(acaoHeader); assertThat(acaoHeader.toString(), containsString(randomOrigin.toString())); }
Source:
private void stopBackgroundFetch() { if (fetchStarted.compareAndSet(true, false)) { log.info( "Stopping scheduled fetch for stream[%s] partition[%s]", streamPartition.getStream(), streamPartition.getPartitionId() ); } }

Target:
private void stopBackgroundFetch() { if (fetchStarted.compareAndSet(true, false)) { log.debug( "Stopping scheduled fetch for stream[%s] partition[%s]", streamPartition.getStream(), streamPartition.getPartitionId() ); if (currentFetch != null && !currentFetch.isDone()) { currentFetch.cancel(true); } } }
Source:
Id getDuplicateMetricId(MessageDescription messageDescription) { return registry.createId("echo.pubsub.duplicateMessages") .withTag("subscription", messageDescription.getSubscriptionName()) .withTag("pubsubSystem", messageDescription.getPubsubSystem().toString()); }

Target:
private Id getDuplicateMetricId(MessageDescription messageDescription) { return registry.createId("echo.pubsub.duplicateMessages") .withTag("subscription", messageDescription.getSubscriptionName()) .withTag("pubsubSystem", messageDescription.getPubsubSystem().toString()); }
Source:
public final void actionPerformed(final AnActionEvent e) { MainWindow mainWindow = new MainWindow(); Project project = e.getProject(); if (project != null) { ToolWindowManager.getInstance(e.getProject()). getToolWindow(mainWindow.KODEBEAGLE).show(new Runnable() { @Override public void run() { try { new RefreshAction().init(); } catch (IOException ioe) { ioe.printStackTrace(); } } }); } }

Target:
public final void actionPerformed(final AnActionEvent e) { Project project = e.getProject(); if (project != null) { ToolWindowManager.getInstance(e.getProject()). getToolWindow(MainWindow.KODEBEAGLE).show(new Runnable() { @Override public void run() { try { new RefreshAction().init(); } catch (IOException ioe) { ioe.printStackTrace(); } } }); } }
Source:
public void setBlog(@Nullable final Blog blog) { mBlogLocalId = BlogUtils.getBlogLocalId(blog); refreshBlogDetails(blog); PlansUtils.downloadAvailablePlansForSite(false, blog, null); }

Target:
public void setBlog(@Nullable final Blog blog) { mBlogLocalId = BlogUtils.getBlogLocalId(blog); refreshBlogDetails(blog); }
Source:
private SchedulerBase createSchedulerAndEnableCheckpointing( CheckpointIDCounter counter, CompletedCheckpointStore store) throws Exception { final Time timeout = Time.days(1L); JobVertex jobVertex = new JobVertex("MockVertex"); jobVertex.setInvokableClass(AbstractInvokable.class); final SchedulerBase scheduler = SchedulerTestingUtils.newSchedulerBuilder(new JobGraph(jobVertex)) .setRpcTimeout(timeout) .build(); scheduler.start(ComponentMainThreadExecutorServiceAdapter.forMainThread()); CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 100, 100, 100, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); scheduler.getExecutionGraph().enableCheckpointing( chkConfig, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), counter, store, new MemoryStateBackend(), CheckpointStatsTrackerTest.createTestTracker()); return scheduler; }

Target:
private SchedulerBase createSchedulerAndEnableCheckpointing( CheckpointIDCounter counter, CompletedCheckpointStore store) throws Exception { final Time timeout = Time.days(1L); final JobVertex jobVertex = new JobVertex("MockVertex"); jobVertex.setInvokableClass(AbstractInvokable.class); final JobGraph jobGraph = new JobGraph(jobVertex); final CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 100, 100, 100, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); final JobCheckpointingSettings checkpointingSettings = new JobCheckpointingSettings( Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), chkConfig, null); jobGraph.setSnapshotSettings(checkpointingSettings); final SchedulerBase scheduler = SchedulerTestingUtils.newSchedulerBuilder(jobGraph) .setCheckpointRecoveryFactory(new TestingCheckpointRecoveryFactory(store, counter)) .setRpcTimeout(timeout) .build(); scheduler.initialize(ComponentMainThreadExecutorServiceAdapter.forMainThread()); return scheduler; }
Source:
void recipeFuelBurnerItem() { addRecipe(findItemStack("Small Fuel Burner"), " ", " Cc", " ", Character.valueOf('C'), findItemStack("Combustion Chamber"), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); addRecipe(findItemStack("Medium Fuel Burner"), " ", " Cc", " ", Character.valueOf('C'), findItemStack("Combustion Chamber", 2), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); addRecipe(findItemStack("Medium Fuel Burner"), " ", " Cc", " ", Character.valueOf('C'), findItemStack("Combustion Chamber", 4), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); }

Target:
void recipeFuelBurnerItem() { addRecipe(findItemStack("Small Fuel Burner"), " ", " Cc", " ", Character.valueOf('C'), findItemStack("Combustion Chamber"), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); addRecipe(findItemStack("Medium Fuel Burner"), " ", " Cc", " C ", Character.valueOf('C'), findItemStack("Combustion Chamber"), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); addRecipe(findItemStack("Medium Fuel Burner"), " ", "CCc", "CC ", Character.valueOf('C'), findItemStack("Combustion Chamber"), Character.valueOf('c'), findItemStack("Copper Thermal Cable")); }
Source:
void testCloserCallOneClose() throws IOException, InterruptedException { Injector i = createInjector(); final Closer closer = i.getInstance(Closer.class); assert closer.getState() == Closer.State.OPEN; Closeable closeable = EasyMock.createMock(Closeable.class); closeable.close(); EasyMock.expectLastCall().times(1); EasyMock.replay(closeable); closer.addToClose(closeable); Runnable close = new Runnable() { @Override public void run() { try { closer.close(); } catch (IOException e) { assert false; } } }; Thread thread1 = new Thread(close); Thread thread2 = new Thread(close); thread1.start(); thread2.start(); thread1.join(); thread2.join(); EasyMock.verify(closeable); assert closer.getState() == Closer.State.CLOSED; }

Target:
void testCloserCallOneClose() throws IOException, InterruptedException { Injector i = createInjector(); final Closer closer = i.getInstance(Closer.class); Closeable closeable = createStrictMock(Closeable.class); closeable.close(); expectLastCall(); replay(closeable); closer.addToClose(closeable); Runnable closeContext = new Runnable() { @Override public void run() { try { closer.close(); } catch (IOException e) { assert false : e.getMessage(); } } }; Thread thread1 = new Thread(closeContext); Thread thread2 = new Thread(closeContext); thread1.start(); thread2.start(); thread1.join(); thread2.join(); verify(closeable); assert closer.getState() == Closer.State.DONE; }
Source:
private String tagsUrl(ListRefsRequest<TagInfo> lrr) { if (lrr.getLimit() != 0) { query = UrlUtils.appendToUrlQuery(query, "n=" + lrr.getLimit()); } if (lrr.getStart() != 0) { query = UrlUtils.appendToUrlQuery(query, "s=" + lrr.getStart()); } if (!Strings.isNullOrEmpty(lrr.getSubstring()) || !Strings.isNullOrEmpty(lrr.getRegex())) { throw new NotImplementedException(); } String url = "/tags"; if (!Strings.isNullOrEmpty(query)) { url += '?' + query; } return url; }

Target:
private String tagsUrl(ListRefsRequest<TagInfo> lrr) { String query = ""; if (lrr.getLimit() != 0) { query = UrlUtils.appendToUrlQuery(query, "n=" + lrr.getLimit()); } if (lrr.getStart() != 0) { query = UrlUtils.appendToUrlQuery(query, "s=" + lrr.getStart()); } if (!Strings.isNullOrEmpty(lrr.getSubstring()) || !Strings.isNullOrEmpty(lrr.getRegex())) { throw new NotImplementedException(); } String url = "/tags"; if (!Strings.isNullOrEmpty(query)) { url += '?' + query; } return url; }
Source:
public String getNetworkId (ClaudiaData claudiaData, NetworkInstance network, String region) { String networkId = null; try { List<NetworkInstance> loadAllNetworks = this.loadAllNetwork(claudiaData, region); for (NetworkInstance net : loadAllNetworks) { if (net.getNetworkName().equals(network.getNetworkName())) { if (net.getShared()) { networkId = net.getIdNetwork(); } else if (net.getTenantId().equals(claudiaData.getVdc())){ networkId = net.getIdNetwork(); } } } } catch (InfrastructureException e) { return networkId; } return networkId; }

Target:
public String getNetworkId (ClaudiaData claudiaData, NetworkInstance network, String region) { String networkId = null; try { List<NetworkInstance> loadAllNetworks = this.loadAllNetwork(claudiaData, region); for (NetworkInstance net : loadAllNetworks) { if (net.getNetworkName().equals(network.getNetworkName()) && (net.getShared() || net.getTenantId().equals(claudiaData.getVdc()))) { networkId = net.getIdNetwork(); } } } catch (InfrastructureException e) { return networkId; } return networkId; }
Source:
private void mergeValue() throws Exception { String key = parser.getKey(); String value = parser.getValue(); if(!keysConfig.getBoolean(key + "/" + MERGABLE_TOKEN, false)) { console.writeFormat(MERGE_NOT_SUPPORTED_MSG, key); console.writeLine(); return; } String version = parser.getVersion(); if (version == null) { version = startVersionDialog(key); } ConfigKey configKey = fetchConfigKey(key, version); if (configKey != null && configKey.getKey() != null && configKey.getDisplayValue().trim().length() > 0) { String valueInDb = configKey.getDisplayValue().trim(); String delimiter = keysConfig.getString(key + "/" + DELIMITER_TOKEN, ";"); value = concatenatedValues(value, valueInDb, delimiter); if(valueInDb.equals(value)) { console.writeFormat(MERGE_SAME_VALUE_MSG); console.writeLine(); return; } } if (!persist(key, value, version)) { log.debug("setValue: error concatenating " + key + "'s value. No such entry" + (version == null ? "" : " with version " + version) + "."); throw new IllegalArgumentException("Error setting " + key + "'s value. No such entry" + (version == null ? "" : " with version " + version) + "."); } }

Target:
private void mergeValue() throws Exception { String key = parser.getKey(); String value = parser.getValue(); if(!keysConfig.getBoolean(key + "/" + MERGABLE_TOKEN, false)) { console.writeFormat(MERGE_NOT_SUPPORTED_MSG, key); console.writeLine(); return; } String version = parser.getVersion(); if (version == null) { version = startVersionDialog(key); } ConfigKey configKey = fetchConfigKey(key, version); if (configKey != null && configKey.getKey() != null && configKey.getDisplayValue().trim().length() > 0) { String valueInDb = configKey.getDisplayValue().trim(); String delimiter = keysConfig.getString(key + "/" + DELIMITER_TOKEN, ";"); value = concatenatedValues(value, valueInDb, delimiter); if(valueInDb.equals(value)) { console.writeFormat(MERGE_SAME_VALUE_MSG); console.writeLine(); return; } } if (!persist(key, value, version)) { String msg = MessageFormat.format(MERGE_PERSIST_ERR_MSG, key, (version == null ? "" : " with version " + version) + "."); log.debug(msg); throw new IllegalArgumentException(msg); } }
Source:
public Kompile(KompileOptions kompileOptions, FileUtil files, KExceptionManager kem, boolean cacheParses) { this.files = files; this.kem = kem; this.kompileOptions = kompileOptions; this.parser = new ParserUtils(files, kem, kompileOptions.global); this.cacheParses = cacheParses; this.loader = new BinaryLoader(kem); this.sw = new Stopwatch(kompileOptions.global); }

Target:
public Kompile(KompileOptions kompileOptions, FileUtil files, KExceptionManager kem, boolean cacheParses) { this(kompileOptions, files, kem, new Stopwatch(kompileOptions.global), cacheParses); }
Source:
private boolean isValidLink(final String link) { try { final long starTime = System.currentTimeMillis(); if (!CACHE_ANALYZED_LINKS.containsKey(link)) { final URL url = new URL(link); final HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setConnectTimeout(Integer.getInteger("sun.net.client.defaultConnectTimeout", 5000)); int attempt = 0; while (true) { try { urlConn.connect(); CACHE_ANALYZED_LINKS.put(link, urlConn.getResponseCode()); break; } catch (IOException e) { LOG.warn(String.format("Attempt [%s/%s]: '%s' exception connecting to %s", ++attempt, RETRY_ATTEMPTS_NUM, e.getMessage(), link)); if (attempt == RETRY_ATTEMPTS_NUM) throw e; } finally { urlConn.disconnect(); } } } final boolean validLink = ACCEPTED_RESPONSE_CODE.contains(CACHE_ANALYZED_LINKS.get(link)); if (validLink) LOG.debug(String.format("Response code %d for %s [%dms]", CACHE_ANALYZED_LINKS.get(link), link, System.currentTimeMillis() - starTime)); else LOG.error(String.format("Response code %d for %s [%dms]", CACHE_ANALYZED_LINKS.get(link), link, System.currentTimeMillis() - starTime)); return validLink; } catch (IOException e) { LOG.error(String.format("'%s' exception connecting to %s", e.getMessage(), link)); return false; } }

Target:
private boolean isValidLink(final String link) { try { final long starTime = System.currentTimeMillis(); if (!CACHE_ANALYZED_LINKS.containsKey(link)) { final URL url = new URL(link); final HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); urlConn.setConnectTimeout(Integer.getInteger("sun.net.client.defaultConnectTimeout", 5000)); with() .pollDelay(Duration.ZERO) .pollInterval(LINK_POLL_INTERVAL_DURATION) .await() .atMost(LINK_POLL_AT_MOST_DURATION) .until(() -> { try { urlConn.connect(); return true; } catch (IOException e) { LOG.warn(String.format("'%s' exception connecting to %s", e.getMessage(), link)); return false; } finally { urlConn.disconnect(); } }); CACHE_ANALYZED_LINKS.put(link, urlConn.getResponseCode()); } final boolean validLink = ACCEPTED_RESPONSE_CODE.contains(CACHE_ANALYZED_LINKS.get(link)); if (validLink) LOG.debug(String.format("Response code %d for %s [%dms]", CACHE_ANALYZED_LINKS.get(link), link, System.currentTimeMillis() - starTime)); else LOG.error(String.format("Response code %d for %s [%dms]", CACHE_ANALYZED_LINKS.get(link), link, System.currentTimeMillis() - starTime)); return validLink; } catch (IOException | ConditionTimeoutException e) { LOG.error(String.format("'%s' exception connecting to %s", e.getMessage(), link)); return false; } }
Source:
private BinaryContent writeWorkbook(Workbook workbook) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { workbook.write(byteArrayOutputStream); } catch (IOException e) { LOGGER.warn("There was a problem writing the XLSX file.", e); } return new BinaryContentImpl( new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), mimeType); }

Target:
private static BinaryContent writeWorkbook(Workbook workbook) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { workbook.write(byteArrayOutputStream); } catch (IOException e) { LOGGER.debug("There was a problem writing the XLSX file.", e); } return new BinaryContentImpl( new ByteArrayInputStream(byteArrayOutputStream.toByteArray()), mimeType); }
Source:
public void setEndTime_afterComputeAggregates_resetsAreAggregatesComputed() { DayActivity dayActivityMock = mock(DayActivity.class); Activity activity = createActivity("21:30", "21:31"); activity.setDayActivity(dayActivityMock); activity.setEndTime(activity.getEndTime().plusMinutes(5)); verify(dayActivityMock, atLeastOnce()).resetAggregatesComputed(); }

Target:
public void setEndTime_afterComputeAggregates_resetsAreAggregatesComputed() { DayActivity dayActivityMock = mock(DayActivity.class); Activity activity = createActivity("21:30", "21:31"); activity.setDayActivity(dayActivityMock); dayActivityMock.computeAggregates(); activity.setEndTime(activity.getEndTime().plusMinutes(5)); verify(dayActivityMock, atLeastOnce()).resetAggregatesComputed(); }
Source:
StackView(final List<Long> quantities, final double width, final Long max) { double rectangleWidth = width * SPACING_SCALE; Rectangle reference = new Rectangle(); reference.setHeight(VERTICAL_SCALE); reference.setWidth(rectangleWidth); reference.setStyle(FX_FILL + ColorUtils.webCode(defaultColor)); Rectangle insertion = new Rectangle(); insertion.setHeight(VERTICAL_SCALE * quantities.get(1) / max); insertion.setWidth(rectangleWidth); insertion.setStyle(FX_FILL + ColorUtils.webCode(Mutation.INSERTION.getColor())); Rectangle deletion = new Rectangle(); deletion.setLayoutY(insertion.getHeight()); deletion.setHeight(VERTICAL_SCALE * quantities.get(2) / max); deletion.setWidth(rectangleWidth); deletion.setStyle(FX_FILL + ColorUtils.webCode(Mutation.DELETION.getColor())); Rectangle polymorphism = new Rectangle(); polymorphism.setLayoutY(insertion.getHeight() + deletion.getHeight()); polymorphism.setHeight(VERTICAL_SCALE * quantities.get(3) / max); polymorphism.setWidth(rectangleWidth); polymorphism.setStyle(FX_FILL + ColorUtils.webCode(Mutation.POLYMORPHISM.getColor())); getChildren().addAll(reference, insertion, deletion, polymorphism); }

Target:
StackView(final List<Long> quantities, final double width, final Long max) { rectangleWidth = width * SPACING_SCALE; getChildren().add(drawPart(VERTICAL_SCALE, 0.0, defaultColor)); List<Paint> colors = Arrays.asList(Mutation.INSERTION.getColor(), Mutation.DELETION.getColor(), Mutation.POLYMORPHISM.getColor()); double offset = 0.0; for (int index = 1; index <= 3; index++) { double height = VERTICAL_SCALE * quantities.get(index) / max; getChildren().add(drawPart(height, offset, colors.get(index - 1))); offset += height; } }
Source:
private Header readHeaders() throws IOException { Header h = new Header(); String line; while ((line = in.readString()) != PacketLineIn.END) { if (line.startsWith("restart ")) h.restartToken = line.substring("restart ".length()); else if (line.startsWith("last-pack-number ")) h.lastPackId = line.substring("last-pack-number ".length()); } return h; }

Target:
private Header readHeaders() throws IOException { Header h = new Header(); String line; while ((line = in.readString()) != PacketLineIn.END) { if (line.startsWith("restart ")) h.restartToken = line.substring("restart ".length()); else if (line.startsWith("last-pack-id ")) h.lastPackId = line.substring("last-pack-id ".length()); } return h; }
Source:
public boolean isElementInViewPort(WebElement element) { int offset = getOffset(); try { return (Boolean) js.executeScript( "return ($(window).scrollTop() + " + offset + " < $(arguments[0]).offset().top) && ($(window).scrollTop() " + "+ $(window).height() > $(arguments[0]).offset().top + $(arguments[0]).height() + " + offset + ")", element); } catch (Exception e) { String windowScrollTop = "((window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement " + "|| document.body.parentNode || document.body).scrollTop)"; String elementOffsetTop = "(arguments[0]).offsetTop"; String windowHeight = "(window.innerHeight)"; String elementOuterHeight = "(arguments[0]).clientHeight"; return (boolean) js.executeScript("return (" + windowScrollTop + " + " + offset + " < " + elementOffsetTop + " && " + windowScrollTop + " + " + windowHeight + " > " + elementOffsetTop + " + " + elementOuterHeight + " + " + offset + ")", element); } }

Target:
public boolean isElementInViewPort(WebElement element) { int offset = getOffset(); try { return (Boolean) js.executeScript( "return ($(window).scrollTop() + " + offset + " < $(arguments[0]).offset().top) && ($(window).scrollTop() " + "+ $(window).height() > $(arguments[0]).offset().top + $(arguments[0]).height() + " + offset + ")", element); } catch (WebDriverException e) { String windowScrollTop = "((window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement " + "|| document.body.parentNode || document.body).scrollTop)"; String elementOffsetTop = "(arguments[0]).offsetTop"; String windowHeight = "(window.innerHeight)"; String elementOuterHeight = "(arguments[0]).clientHeight"; return (boolean) js.executeScript("return (" + windowScrollTop + " + " + offset + " < " + elementOffsetTop + " && " + windowScrollTop + " + " + windowHeight + " > " + elementOffsetTop + " + " + elementOuterHeight + " + " + offset + ")", element); } }
Source:
public void testContainerWithHostConfig() throws Exception { assumeTrue("Docker API should be at least v1.18 to support Container Creation with HostConfig, got " + sut.version().apiVersion(), versionCompare(sut.version().apiVersion(), "1.18") >= 0); sut.pull("busybox"); final boolean privileged = true; final boolean publishAllPorts = true; final String dns = "1.2.3.4"; final HostConfig expected = HostConfig.builder() .privileged(privileged) .publishAllPorts(publishAllPorts) .dns(dns) .cpuShares((long) 4096) .build(); final ContainerConfig config = ContainerConfig.builder() .image("busybox") .hostConfig(expected) .build(); final String name = randomName(); final ContainerCreation creation = sut.createContainer(config, name); final String id = creation.id(); sut.startContainer(id); final HostConfig actual = sut.inspectContainer(id).hostConfig(); assertThat(actual.privileged(), equalTo(expected.privileged())); assertThat(actual.publishAllPorts(), equalTo(expected.publishAllPorts())); assertThat(actual.dns(), equalTo(expected.dns())); }

Target:
public void testContainerWithHostConfig() throws Exception { assumeTrue("Docker API should be at least v1.18 to support Container Creation with " + "HostConfig, got " + sut.version().apiVersion(), versionCompare(sut.version().apiVersion(),"1.18") >= 0); sut.pull("busybox"); final boolean privileged = true; final boolean publishAllPorts = true; final String dns = "1.2.3.4"; final HostConfig expected = HostConfig.builder() .privileged(privileged) .publishAllPorts(publishAllPorts) .dns(dns) .cpuShares((long) 4096) .build(); final ContainerConfig config = ContainerConfig.builder() .image("busybox") .hostConfig(expected) .build(); final String name = randomName(); final ContainerCreation creation = sut.createContainer(config, name); final String id = creation.id(); sut.startContainer(id); final HostConfig actual = sut.inspectContainer(id).hostConfig(); assertThat(actual.privileged(), equalTo(expected.privileged())); assertThat(actual.publishAllPorts(), equalTo(expected.publishAllPorts())); assertThat(actual.dns(), equalTo(expected.dns())); }
Source:
private void setVolumeSync(float volumeLeft, float volumeRight) { playerLock.lock(); if (media != null && media.getMediaType() == MediaType.AUDIO) { Playable playable = getPlayable(); if (playable instanceof FeedMedia) { FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); float reductionFactor = feedVolumeReduction.getReductionFactor(preferences); volumeLeft *= reductionFactor; volumeRight *= reductionFactor; } mediaPlayer.setVolume(volumeLeft, volumeRight); Log.d(TAG, "Media player volume was set to " + volumeLeft + " " + volumeRight); } playerLock.unlock(); }

Target:
private void setVolumeSync(float volumeLeft, float volumeRight) { playerLock.lock(); Playable playable = getPlayable(); if (playable instanceof FeedMedia) { FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); VolumeAdaptionSetting volumeAdaptionSetting = preferences.getVolumeAdaptionSetting(); float adaptionFactor = volumeAdaptionSetting.getAdaptionFactor(); volumeLeft *= adaptionFactor; volumeRight *= adaptionFactor; } mediaPlayer.setVolume(volumeLeft, volumeRight); Log.d(TAG, "Media player volume was set to " + volumeLeft + " " + volumeRight); playerLock.unlock(); }
Source:
public void testStitchCommandEquals() { Sprite sprite = new Sprite("firstSprite"); StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite); StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite); StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite); StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite")); StitchCommand command5 = command1; assertEquals(command1, command5); assertNotEquals(command1, command2); assertNotEquals(command1, command3); assertNotEquals(command1, command4); }

Target:
public void testStitchCommandEquals() { Sprite sprite = new Sprite("firstSprite"); StitchCommand command1 = new DSTStitchCommand(0, 0, 0, sprite); StitchCommand command2 = new DSTStitchCommand(0, 1, 0, sprite); StitchCommand command3 = new DSTStitchCommand(0, 0, 1, sprite); StitchCommand command4 = new DSTStitchCommand(0, 0, 0, new Sprite("secondSprite")); StitchCommand command5 = new DSTStitchCommand(0, 0, 0, sprite); assertEquals(command1, command5); assertNotEquals(command1, command2); assertNotEquals(command1, command3); assertNotEquals(command1, command4); }
Source:
public ImapMailInboundChannelAdapterSpec() { this.receiver = new ImapMailReceiver(); }

Target:
ImapMailInboundChannelAdapterSpec() { this.receiver = new ImapMailReceiver(); }