auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Schema getOutputSchema() { InputStream inputStream = null; ExternalRecord externalRecord = null; List<Schema.Field> fields = Lists.newArrayList(); try { inputStream = IOUtils.toInputStream(config.copybookContents, "UTF-8"); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); externalRecord = CopybookIOUtils.getExternalRecord(bufferedInputStream); String fieldName; for (ExternalField field : externalRecord.getRecordFields()) { fieldName = field.getName(); if ((fieldsToDrop.size() > 0 && !fieldsToDrop.contains(fieldName)) || fieldsToDrop.size() == 0) { fields.add(Schema.Field.of(field.getName(), Schema.nullableOf(Schema.of(getFieldSchemaType(field.getType()))))); } } return Schema.recordOf("record", fields); } catch (IOException e) { throw new IllegalArgumentException("Exception while creating input stream for COBOL Copybook. Invalid output " + "schema: " + e.getMessage(), e); } catch (RecordException e) { throw new IllegalArgumentException("Exception while creating record from COBOL Copybook. Invalid output " + "schema: " + e.getMessage(), e); } }

Target:
private Schema getOutputSchema() { InputStream inputStream = null; ExternalRecord externalRecord = null; List<Schema.Field> fields = Lists.newArrayList(); try { inputStream = IOUtils.toInputStream(config.copybookContents, "UTF-8"); BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); externalRecord = CopybookIOUtils.getExternalRecord(bufferedInputStream); String fieldName; for (ExternalField field : externalRecord.getRecordFields()) { fieldName = field.getName(); if (fieldsToDrop.contains(fieldName)) { continue; } fields.add(Schema.Field.of(field.getName(), Schema.nullableOf(Schema.of(getFieldSchemaType(field.getType()))))); } return Schema.recordOf("record", fields); } catch (IOException e) { throw new IllegalArgumentException("Exception while creating input stream for COBOL Copybook. Invalid output " + "schema: " + e.getMessage(), e); } catch (RecordException e) { throw new IllegalArgumentException("Exception while creating record from COBOL Copybook. Invalid output " + "schema: " + e.getMessage(), e); } }
Source:
private boolean isFixedSize(Size regionsContainerSize, boolean isVertical) { boolean result = regionsContainerSize.getWidth() != -1 && regionsContainerSize.getHeight() != -1; if (!result && (regionsContainerSize.getWidth() != -1 || regionsContainerSize.getHeight() != -1)) { EObject element = regionContainer.getElement(); if (element instanceof DNodeContainer) { DNodeContainer dnc = (DNodeContainer) element; if (isVertical && regionsContainerSize.getHeight() != -1) { result = regionsContainerSize.getHeight() == dnc.getHeight(); } else if (!isVertical && regionsContainerSize.getWidth() != -1) { result = regionsContainerSize.getWidth() == dnc.getWidth(); } } } return result; }

Target:
private boolean isFixedSize(Size regionsContainerSize, boolean isVertical) { boolean result = regionsContainerSize.getWidth() != -1 && regionsContainerSize.getHeight() != -1; if (!result && (regionsContainerSize.getWidth() != -1 || regionsContainerSize.getHeight() != -1)) { EObject element = regionsContainer.getElement(); if (element instanceof DNodeContainer) { DNodeContainer dnc = (DNodeContainer) element; if (isVertical && regionsContainerSize.getHeight() != -1) { result = regionsContainerSize.getHeight() == dnc.getHeight(); } else if (!isVertical && regionsContainerSize.getWidth() != -1) { result = regionsContainerSize.getWidth() == dnc.getWidth(); } } } return result; }
Source:
private List<Map<String,String>> findAllLangContentlets(final String contentletIdentifier){ return conAPI.findAllLangContentlets(contentletIdentifier).stream().map(contentlet -> { final Map <String,String> map = new HashMap<>(); map.put("inode",contentlet.getInode()); map.put("languageId",contentlet.getLanguageId()+""); return map; }).collect(CollectionsUtils.toImmutableList()); }

Target:
private List<Map<String,String>> findAllLangContentlets(final String contentletIdentifier){ return conAPI.findAllLangContentlets(contentletIdentifier).stream().map(contentlet -> { return map("inode",contentlet.getInode(), "languageId",contentlet.getLanguageId()+""); }).collect(toImmutableList()); }
Source:
private void unpack(File outputFile) throws NoSuchArchiverException { UnArchiver unarchiver = this.archiverManager.getUnArchiver(outputFile); unarchiver.setSourceFile(outputFile); if (unarchiver instanceof GZipUnArchiver) { unarchiver.setDestFile(new File(this.outputDirectory, this.outputFileName.replaceFirst("(.+)\\.gz(?:ip)?$", "$1"))); } else { unarchiver.setDestDirectory(this.outputDirectory); } unarchiver.extract(); outputFile.delete(); }

Target:
private void unpack(File outputFile) throws NoSuchArchiverException { UnArchiver unarchiver = this.archiverManager.getUnArchiver(outputFile); unarchiver.setSourceFile(outputFile); if (isFileUnArchiver(unarchiver)) { unarchiver.setDestFile(new File(this.outputDirectory, outputFileName.substring(0, outputFileName.lastIndexOf('.')))); } else { unarchiver.setDestDirectory(this.outputDirectory); } unarchiver.extract(); outputFile.delete(); }
Source:
public void testStacktraceTrimmingListCtor() throws Throwable { List<Map<String, Object>> elements = new ArrayList<>(); for (int k = 0; k < 1000; k++) { elements.add(Collections.singletonMap("Foo", new Object())); } Stacktrace stacktrace = new Stacktrace(elements); JSONArray jsonArray = streamableToJsonArray(stacktrace); assertEquals(200, jsonArray.length()); }

Target:
public void testStacktraceTrimmingListCtor() throws Throwable { List<Map<String, Object>> elements = new ArrayList<>(); for (int k = 0; k < 1000; k++) { elements.add(Collections.singletonMap("Foo", (Object) k)); } Stacktrace stacktrace = new Stacktrace(elements); JSONArray jsonArray = streamableToJsonArray(stacktrace); assertEquals(200, jsonArray.length()); assertEquals(0, jsonArray.getJSONObject(0).getInt("Foo")); assertEquals(199, jsonArray.getJSONObject(199).getInt("Foo")); }
Source:
void setupHistoryMonitoring(RemoteConnector remoteConnector, IPreferenceStore preferenceStore) throws IOException { MachineManager.MachineInfo minfo = null; if ((fRemoteConnection.getRemoteServices().getCapabilities() & IRemoteServices.CAPABILITY_SUPPORTS_COMMAND_SHELL) != 0) { fProcess = fRemoteConnection.getCommandShell(IRemoteProcessBuilder.ALLOCATE_PTY); } else { minfo = MachineManager.initializeMachine(fRemoteConnection); List<String> shellCommand = new ArrayList<String>(); shellCommand.add(minfo.shell); shellCommand.add("-l"); IRemoteProcessBuilder processBuilder = fRemoteConnection.getProcessBuilder(shellCommand); fProcess = processBuilder.start(IRemoteProcessBuilder.ALLOCATE_PTY); } remoteConnector.setInputStream(fProcess.getInputStream()); fControl.setState(TerminalState.CONNECTED); fControl.setTerminalTitle(fRemoteConnection.getName()); final OutputStream outputStream = fProcess.getOutputStream(); remoteConnector.setOutputStream(outputStream); MachineManager.setOutputStream(fRemoteConnection.getAddress(), outputStream); String startup = getDefault( preferenceStore.getString(Messages.SHELL_STARTUP_COMMAND), TerminalPrefs.SHELL_STARTUP_DEFAULT); if(minfo == null) { ; } else if(minfo.isCsh) { startup=startup.replaceFirst("export\\s+(\\w+)=", "setenv $1 "); } else if(minfo.isBash) { startup=startup.replaceFirst("setenv\\s+(\\w+)\\s+","export $1="); } outputStream.write((startup+"\n").getBytes()); outputStream.flush(); }

Target:
void setupHistoryMonitoring(RemoteConnector remoteConnector, IPreferenceStore preferenceStore) throws IOException { MachineManager.MachineInfo minfo = null; if ((fRemoteConnection.getRemoteServices().getCapabilities() & IRemoteServices.CAPABILITY_SUPPORTS_COMMAND_SHELL) != 0) { fProcess = fRemoteConnection.getCommandShell(IRemoteProcessBuilder.ALLOCATE_PTY); } else { minfo = MachineManager.initializeMachine(fRemoteConnection); List<String> shellCommand = new ArrayList<String>(); shellCommand.add(minfo.shell); shellCommand.add("-l"); IRemoteProcessBuilder processBuilder = fRemoteConnection.getProcessBuilder(shellCommand); fProcess = processBuilder.start(IRemoteProcessBuilder.ALLOCATE_PTY); } remoteConnector.setInputStream(fProcess.getInputStream()); fControl.setState(TerminalState.CONNECTED); fControl.setTerminalTitle(fRemoteConnection.getName()); final OutputStream outputStream = fProcess.getOutputStream(); remoteConnector.setOutputStream(outputStream); MachineManager.setOutputStream(fRemoteConnection.getAddress(), outputStream); String startup = getDefault( preferenceStore.getString(Messages.SHELL_STARTUP_COMMAND), TerminalPrefs.SHELL_STARTUP_DEFAULT); if (minfo != null) { if (minfo.isCsh) { startup = startup.replaceFirst("export\\s+(\\w+)=", "setenv $1 "); } else if (minfo.isBash) { startup = startup.replaceFirst("setenv\\s+(\\w+)\\s+", "export $1="); } } outputStream.write((startup + "\n").getBytes()); outputStream.flush(); }
Source:
private void doRequest(final int id, final Bundle bundle) { switch (id) { case ID_REQUEST_REFRESH_ARTICLE: showLoadingState(bundle.getBoolean(FLAG_SHOW_LOADING, true)); requestQueue.add(fetchRequestForArticleRefresh(bundle)); break; case ID_REQUEST_HOOAH: requestQueue.add(fetchRequestForHooah(bundle)); break; case ID_REQUEST_POST_COMMENT: requestQueue.add(fetchRequestForPostComment(bundle)); break; case ID_REQUEST_COMMENT_UPVOTE: requestQueue.add(fetchRequestForCommentUpvote(bundle)); break; case ID_REQUEST_COMMENT_DOWNVOTE: requestQueue.add(fetchRequestForCommentDownvote(bundle)); break; default: throw new IllegalArgumentException("No request matching " + id); } }

Target:
private void doRequest(final int id, final Bundle bundle) { switch (id) { case ID_REQUEST_REFRESH_ARTICLE: showLoadingState(bundle.getBoolean(FLAG_SHOW_LOADING, true)); requestQueue.add(fetchRequestForArticleRefresh(bundle)); break; case ID_REQUEST_HOOAH: requestQueue.add(fetchRequestForHooah(bundle)); break; case ID_REQUEST_POST_COMMENT: requestQueue.add(fetchRequestForPostComment(bundle)); break; case ID_REQUEST_COMMENT_UPVOTE: requestQueue.add(fetchRequestForCommentUpvote(bundle)); break; case ID_REQUEST_COMMENT_DOWNVOTE: requestQueue.add(fetchRequestForCommentDownvote(bundle)); break; default: Log.w(getClass().getSimpleName(), "No request matching " + id); } }
Source:
public void updateCallback(Map<String, Object> properties) { if (properties != null) { setMonitoredDirectoryPath((String) properties.get("monitoredDirectoryPath")); setProcessingMechanism((String) properties.get("processingMechanism")); setNumThreads((Integer) properties.get("numThreads")); setReadLockIntervalMilliseconds((Integer) properties.get("readLockIntervalMilliseconds")); String[] parameterArray = (String[]) properties.get(Constants.ATTRIBUTE_OVERRIDES_KEY); if (parameterArray != null) { setAttributeOverrides(Arrays.asList(parameterArray)); } destroy(0); init(); } }

Target:
public void updateCallback(Map<String, Object> properties) { if (properties != null) { setMonitoredDirectoryPath((String) properties.get("monitoredDirectoryPath")); setProcessingMechanism((String) properties.get("processingMechanism")); setNumThreads((Integer) properties.get("numThreads")); setReadLockIntervalMilliseconds((Integer) properties.get("readLockIntervalMilliseconds")); String[] parameterArray = (String[]) properties.get(Constants.ATTRIBUTE_OVERRIDES_KEY); if (parameterArray != null) { setAttributeOverrides(Arrays.asList(parameterArray)); } CompletableFuture.runAsync( () -> { removeRoutes(); configure(); }, configurationExecutor); } }
Source:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.renderingDebugConfig = renderingConfig.getDebug(); this.shaderManager = context.get(ShaderManager.class); if (renderingConfig.isVrSupport()) { this.vrProvider = new OpenVRProvider(); if (this.vrProvider.init()) { playerCamera = new OpenVRStereoCamera(this.vrProvider); currentRenderingStage = RenderingStage.LEFT_EYE; context.put(OpenVRProvider.class, vrProvider); } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); }

Target:
public WorldRendererImpl(Context context, GLBufferPool bufferPool) { this.context = context; this.worldProvider = context.get(WorldProvider.class); this.backdropProvider = context.get(BackdropProvider.class); this.renderingConfig = context.get(Config.class).getRendering(); this.renderingDebugConfig = renderingConfig.getDebug(); this.shaderManager = context.get(ShaderManager.class); if (renderingConfig.isVrSupport()) { this.vrProvider = new OpenVRProvider(); context.put(OpenVRProvider.class, vrProvider); if (this.vrProvider.init()) { playerCamera = new OpenVRStereoCamera(this.vrProvider); currentRenderingStage = RenderingStage.LEFT_EYE; } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } } else { playerCamera = new PerspectiveCamera(renderingConfig.getCameraSettings()); currentRenderingStage = RenderingStage.MONO; } LocalPlayerSystem localPlayerSystem = context.get(LocalPlayerSystem.class); localPlayerSystem.setPlayerCamera(playerCamera); renderableWorld = new RenderableWorldImpl(worldProvider, context.get(ChunkProvider.class), bufferPool, playerCamera); renderQueues = renderableWorld.getRenderQueues(); initRenderingSupport(); }
Source:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { Throwable handlerError = eventHubNonTransientError.get(); if (handlerError != null && clock.currentTimeMillis() - lastRetryTs > config.getMinRetryIntervalMs(systemName)) { int currentRetryCount = retryCountWithinWindow.size(); long maxRetryCount = config.getMaxRetryCount(systemName); if (currentRetryCount < maxRetryCount) { LOG.warn("Received non transient error. Will retry.", handlerError); LOG.info("Current retry count within window: {}. max retry count allowed: {}. window size: ms", currentRetryCount, maxRetryCount, config.getRetryWindowMs(systemName)); long now = clock.currentTimeMillis(); retryCountWithinWindow.update(now); lastRetryTs = now; reconnectTaskStatus = reconnectTaskRunner.submit(this::renewEventHubsClient); } else { LOG.error("Retry exhaustion: reach max retry count allowed ({}) within window ({}ms)", currentRetryCount, config.getRetryWindowMs(systemName)); String msg = "Received a non transient error from event hub partition receiver"; throw new SamzaException(msg, handlerError); } } return super.poll(systemStreamPartitions, timeout); }

Target:
public Map<SystemStreamPartition, List<IncomingMessageEnvelope>> poll( Set<SystemStreamPartition> systemStreamPartitions, long timeout) throws InterruptedException { Throwable handlerError = eventHubNonTransientError.get(); if (handlerError != null && clock.currentTimeMillis() - lastRetryTs > config.getMinRetryIntervalMs(systemName)) { int currentRetryCount = recentRetryAttempts.size(); long maxRetryCount = config.getMaxRetryCount(systemName); if (currentRetryCount < maxRetryCount) { LOG.warn("Received non transient error. Will retry.", handlerError); LOG.info("Current retry count within window: {}. max retry count allowed: {}. window size: ms", currentRetryCount, maxRetryCount, config.getRetryWindowMs(systemName)); long now = clock.currentTimeMillis(); recentRetryAttempts.update(now); lastRetryTs = now; reconnectTaskStatus = reconnectTaskRunner.submit(this::renewEventHubsClient); } else { LOG.error("Retries exhausted. Reached max allowed retries: ({}) within window ms", currentRetryCount, config.getRetryWindowMs(systemName)); String msg = "Received a non transient error from event hub partition receiver"; throw new SamzaException(msg, handlerError); } } return super.poll(systemStreamPartitions, timeout); }
Source:
public List<SqlNode> operands() { if (hasAssignment() && !(call.getOperator() instanceof SqlUnresolvedFunction)) { return permutedOperands(call); } else { final List<SqlNode> operandList = call.getOperandList(); final SqlOperandTypeChecker checker = call.getOperator().getOperandTypeChecker(); if (checker == null) { return operandList; } final SqlOperandCountRange range = checker.getOperandCountRange(); final List<SqlNode> list = Lists.newArrayList(operandList); final SqlCall defaultCall = createDefaultCall(); while (list.size() < range.getMax() && checker.isOptional(list.size()) && checker.isFixedParameters()) { list.add(defaultCall); } return list; } }

Target:
public List<SqlNode> operands() { if (hasAssignment() && !(call.getOperator() instanceof SqlUnresolvedFunction)) { return permutedOperands(call); } else { final List<SqlNode> operandList = call.getOperandList(); final SqlOperandTypeChecker checker = call.getOperator().getOperandTypeChecker(); if (checker == null) { return operandList; } final SqlOperandCountRange range = checker.getOperandCountRange(); final List<SqlNode> list = Lists.newArrayList(operandList); while (list.size() < range.getMax() && checker.isOptional(list.size()) && checker.isFixedParameters()) { list.add(DefaultCallHolder.DEFAULT_CALL); } return list; } }
Source:
public boolean signInputs(ProposedTransaction propTx, KeyBag keyBag) { Transaction tx = propTx.partialTx; int numInputs = tx.getInputs().size(); for (int i = 0; i < numInputs; i++) { TransactionInput txIn = tx.getInput(i); if (txIn.getConnectedOutput() == null) { log.warn("Missing connected output, assuming input is already signed.", i); continue; } try { txIn.getScriptSig().correctlySpends(tx, i, txIn.getConnectedOutput().getScriptPubKey(), true); log.warn("Input already correctly spends output, assuming SIGHASH type used will be safe and skipping signing.", i); continue; } catch (ScriptException e) { } RedeemData redeemData = txIn.getOutpoint().getConnectedRedeemData(keyBag); ECKey key; if (redeemData == null || (key = redeemData.getFullKey()) == null) { log.warn("No local key found for input {}", i); continue; } Script scriptPubKey = txIn.getConnectedOutput().getScriptPubKey(); Script inputScript = txIn.getScriptSig(); byte[] script = redeemData.redeemScript.getProgram(); int keyIndex = redeemData.getKeyIndex(key); try { TransactionSignature signature = tx.calculateSignature(i, key, script, Transaction.SigHash.ALL, false); inputScript = scriptPubKey.getScriptSigWithSignature(inputScript, signature.encodeToBitcoin(), keyIndex); txIn.setScriptSig(inputScript); if (key instanceof DeterministicKey) propTx.keyPaths.put(txIn, (((DeterministicKey) key).getPath())); } catch (ECKey.KeyIsEncryptedException e) { throw e; } catch (ECKey.MissingPrivateKeyException e) { log.warn("No private key in keypair for input {}", i); } } return true; }

Target:
public boolean signInputs(ProposedTransaction propTx, KeyBag keyBag) { Transaction tx = propTx.partialTx; int numInputs = tx.getInputs().size(); for (int i = 0; i < numInputs; i++) { TransactionInput txIn = tx.getInput(i); if (txIn.getConnectedOutput() == null) { log.warn("Missing connected output, assuming input is already signed.", i); continue; } try { txIn.getScriptSig().correctlySpends(tx, i, txIn.getConnectedOutput().getScriptPubKey(), true); log.warn("Input already correctly spends output, assuming SIGHASH type used will be safe and skipping signing.", i); continue; } catch (ScriptException e) { } RedeemData redeemData = txIn.getConnectedRedeemData(keyBag); ECKey key; if (redeemData == null || (key = redeemData.getFullKey()) == null) { log.warn("No local key found for input {}", i); continue; } Script scriptPubKey = txIn.getConnectedOutput().getScriptPubKey(); Script inputScript = txIn.getScriptSig(); byte[] script = redeemData.redeemScript.getProgram(); try { TransactionSignature signature = tx.calculateSignature(i, key, script, Transaction.SigHash.ALL, false); int sigIndex = redeemData.getKeyIndex(key); inputScript = scriptPubKey.getScriptSigWithSignature(inputScript, signature.encodeToBitcoin(), sigIndex); txIn.setScriptSig(inputScript); if (key instanceof DeterministicKey) propTx.keyPaths.put(txIn, (((DeterministicKey) key).getPath())); } catch (ECKey.KeyIsEncryptedException e) { throw e; } catch (ECKey.MissingPrivateKeyException e) { log.warn("No private key in keypair for input {}", i); } } return true; }
Source:
public void stop() { CONNECTION_MANAGER_TIMER.purge(); }

Target:
public void stop() { CONNECTION_MANAGER_TIMER.cancel(); }
Source:
protected void tearDown() throws Exception { SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, Collections.singleton((DialectEditor) editorPart)); DialectUIManager.INSTANCE.closeEditor(editorPart, false); TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }

Target:
protected void tearDown() throws Exception { DialectUIManager.INSTANCE.closeEditor(editorPart, false); TestsUtil.emptyEventsFromUIThread(); super.tearDown(); }
Source:
private void logUpdatedEntityIds(Set<String> entityIds) { entityIds.forEach(UPDATED_ENTITY_IDS_LOG::info); }

Target:
private void logUpdatedEntityIds(Set<String> entityIds) { entityIds.forEach(entityId -> UPDATED_ENTITY_IDS_LOG.info(entityId)); }
Source:
String resolveTemplatePath(final Context context, final Writer writer, final RenderParams params, final String argument) { if (argument.contains("/")) { }else{ return (params.live) ? "/live/" + argument + "." + EXTENSION : "/working/" + argument + "." + EXTENSION; } }

Target:
String resolveTemplatePath(final Context context, final Writer writer, final RenderParams params, final String argument) { return (params.live) ? "/live/" + argument + "." + EXTENSION : "/working/" + argument + "." + EXTENSION; }
Source:
private Runnable failPendingRequests() { return () -> { if (!pendingRequests.isEmpty()) { final NoResourceAvailableException cause = new NoResourceAvailableException("Could not acquire the minimum required resources."); cancelPendingRequests( cause, request -> !isBatchSlotRequestTimeoutCheckDisabled || !request.isBatchRequest); } }; }

Target:
private void failPendingRequests() { if (!pendingRequests.isEmpty()) { final NoResourceAvailableException cause = new NoResourceAvailableException("Could not acquire the minimum required resources."); cancelPendingRequests( request -> !isBatchSlotRequestTimeoutCheckDisabled || !request.isBatchRequest(), cause ); } }
Source:
private void launchFilePicker() { startActivityForResult(BoxBrowseFileActivity.getLaunchIntent(this, BoxFolder.createFromIdAndName("0", "All Files"), session), REQUEST_CODE_FILE_PICKER); }

Target:
private void launchFilePicker() { startActivityForResult(BoxBrowseFileActivity.getLaunchIntent(this, BoxFolder.createFromIdAndName(ROOT_FOLDER_ID, ROOT_FOLDER_NAME), session), REQUEST_CODE_FILE_PICKER); }
Source:
@Nullable public HttpRequest request() { return null; }

Target:
@Override @Nullable public HttpRequest request() { return null; }
Source:
private void assertTwoMessages(String fileName, List<String> expectedMessages) throws Exception { File sourceFile = new File(baseDir, fileName); LocalizedMessages messages = processFile(sourceFile, check); assertThat(messages, is(not(nullValue()))); assertThat(messages.getMessages().isEmpty(), is(false)); assertThat(messages.getMessages().size(), is(2)); List<String> receivedMessages = new ArrayList<>(); for (LocalizedMessage message : messages.getMessages()) { receivedMessages.add(message.getMessage()); } assertThat(receivedMessages, containsInAnyOrder(expectedMessages.toArray())); }

Target:
private void assertTwoMessages(String fileName, List<String> expectedMessages) throws Exception { File sourceFile = new File(baseDir, fileName); LocalizedMessages messages = processFile(sourceFile, check); assertThat(messages.getMessages().isEmpty(), is(false)); assertThat(messages.getMessages().size(), is(2)); List<String> receivedMessages = new ArrayList<>(); for (LocalizedMessage message : messages.getMessages()) { receivedMessages.add(message.getMessage()); } assertThat(receivedMessages, containsInAnyOrder(expectedMessages.toArray())); }
Source:
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { for (ManagedExecutorService executorService : executors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("internal-executor") .withDiscriminator("executor", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } for (ManagedExecutorService executorService : durableExecutors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("durable-executor") .withDiscriminator("executor", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } for (ManagedExecutorService executorService : scheduleDurableExecutors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("scheduled-durable-executor") .withDiscriminator("executor", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } }

Target:
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) { for (ManagedExecutorService executorService : executors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("executor.internal") .withDiscriminator("name", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } for (ManagedExecutorService executorService : durableExecutors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("executor.durable.internal") .withDiscriminator("name", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } for (ManagedExecutorService executorService : scheduleDurableExecutors.values()) { MetricDescriptor executorDescriptor = descriptor .copy() .withPrefix("executor.scheduled.internal") .withDiscriminator("name", executorService.getName()) .withExcludedTarget(MANAGEMENT_CENTER); context.collect(executorDescriptor, executorService); } }
Source:
public ModelAndView getLoanDetail() { String loginName = LoginUserInfo.getLoginName(); ExperienceLoanDto experienceLoanDto = experienceLoanDetailService.findExperienceLoanDtoDetail(1, LoginUserInfo.getLoginName()); ModelAndView modelAndView = new ModelAndView("/experience-loan", "responsive", true); modelAndView.addObject("loan", experienceLoanDto); long expectedInterest = investService.estimateInvestIncome(experienceLoanDto.getId(), loginName, 1000000L, new Date()); modelAndView.addObject("interestPerTenThousands", String.valueOf(expectedInterest)); modelAndView.addObject("verifyTime", new DateTime().withTimeAtStartOfDay().toString("yyyy-MM-dd HH:mm:ss")); modelAndView.addObject("interestPointName", experienceLoanDto.getLoanType().getInterestPointName()); modelAndView.addObject("experienceBalance", userService.getExperienceBalanceByLoginName(LoginUserInfo.getLoginName())); modelAndView.addObject("isAccount", accountService.findByLoginName(LoginUserInfo.getLoginName()) == null ? "false" : "true"); return modelAndView; }

Target:
public ModelAndView getLoanDetail() { ExperienceLoanDto experienceLoanDto = experienceLoanDetailService.findExperienceLoanDtoDetail(1, LoginUserInfo.getLoginName()); ModelAndView modelAndView = new ModelAndView("/experience-loan", "responsive", true); modelAndView.addObject("loan", experienceLoanDto); modelAndView.addObject("experienceBalance", userService.getExperienceBalanceByLoginName(LoginUserInfo.getLoginName())); modelAndView.addObject("isAccount", accountService.findByLoginName(LoginUserInfo.getLoginName()) == null ? "false" : "true"); return modelAndView; }
Source:
public Contact(String start_first_name, String start_last_name, String start_phone_number, String start_second_phone) { if (start_first_name == null){ start_first_name = ""; } if (start_last_name == null){ start_last_name = ""; } if (start_phone_number == null){ start_phone_number = ""; } if (start_second_phone == null){ start_second_phone = ""; } first_name = start_first_name; last_name = start_last_name; phone_number = start_phone_number; second_phone = start_second_phone; }

Target:
public Contact(String start_first_name, String start_last_name, String start_phone_number, String start_second_phone) { if (start_first_name == null || start_first_name.equals("")){ throw new IllegalArgumentException(); } if (start_last_name == null){ start_last_name = ""; } if (start_phone_number == null || start_phone_number.length() < 3){ throw new IllegalArgumentException(); } if (start_second_phone == null){ start_second_phone = ""; } first_name = start_first_name; last_name = start_last_name; phone_number = start_phone_number; second_phone = start_second_phone; }
Source:
public BaseTestMethod clone() { TestNGMethod clone = new TestNGMethod( getConstructorOrMethod().getMethod(), getAnnotationFinder(), false, getXmlTest(), getInstance()); ITestClass tc = getTestClass(); NoOpTestClass testClass = new NoOpTestClass(tc); testClass.setBeforeTestMethods(clone(tc.getBeforeTestMethods())); testClass.setAfterTestMethod(clone(tc.getAfterTestMethods())); clone.m_testClass = testClass; clone.setDate(getDate()); clone.setGroups(getGroups()); clone.setGroupsDependedUpon(getGroupsDependedUpon(), Collections.emptyList()); clone.setMethodsDependedUpon(getMethodsDependedUpon()); clone.setAlwaysRun(isAlwaysRun()); clone.m_beforeGroups = getBeforeGroups(); clone.m_afterGroups = getAfterGroups(); clone.m_currentInvocationCount = m_currentInvocationCount; clone.setMissingGroup(getMissingGroup()); clone.setThreadPoolSize(getThreadPoolSize()); clone.setDescription(getDescription()); clone.setEnabled(getEnabled()); clone.setParameterInvocationCount(getParameterInvocationCount()); clone.setInvocationCount(getInvocationCount()); clone.m_successPercentage = getSuccessPercentage(); clone.setTimeOut(getTimeOut()); clone.setRetryAnalyzer(getRetryAnalyzer(null)); clone.setSkipFailedInvocations(skipFailedInvocations()); clone.setInvocationNumbers(getInvocationNumbers()); clone.setPriority(getPriority()); return clone; }

Target:
public BaseTestMethod clone() { TestNGMethod clone = new TestNGMethod( getConstructorOrMethod().getMethod(), getAnnotationFinder(), false, getXmlTest(), getInstance()); ITestClass tc = getTestClass(); NoOpTestClass testClass = new NoOpTestClass(tc); testClass.setBeforeTestMethods(clone(tc.getBeforeTestMethods())); testClass.setAfterTestMethod(clone(tc.getAfterTestMethods())); clone.m_testClass = testClass; clone.setDate(getDate()); clone.setGroups(getGroups()); clone.setGroupsDependedUpon(getGroupsDependedUpon(), Collections.emptyList()); clone.setMethodsDependedUpon(getMethodsDependedUpon()); clone.setAlwaysRun(isAlwaysRun()); clone.m_beforeGroups = getBeforeGroups(); clone.m_afterGroups = getAfterGroups(); clone.m_currentInvocationCount = m_currentInvocationCount; clone.setMissingGroup(getMissingGroup()); clone.setThreadPoolSize(getThreadPoolSize()); clone.setDescription(getDescription()); clone.setEnabled(getEnabled()); clone.setParameterInvocationCount(getParameterInvocationCount()); clone.setInvocationCount(getInvocationCount()); clone.m_successPercentage = getSuccessPercentage(); clone.setTimeOut(getTimeOut()); clone.setRetryAnalyzer(getRetryAnalyzer()); clone.setRetryAnalyzerClass(getRetryAnalyzerClass()); clone.setSkipFailedInvocations(skipFailedInvocations()); clone.setInvocationNumbers(getInvocationNumbers()); clone.setPriority(getPriority()); return clone; }
Source:
public static int getTotalPageNumber(long totalResults, int pageSize) { return (int)(totalResults/pageSize); }

Target:
public static long getTotalPageNumber(long totalResults, int pageSize) { return totalResults/pageSize; }
Source:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); VDS vds = vdsDao.get(getParameters().getVdsId()); List<GlusterGlobalVolumeOptionEntity> globalVolumeOptionsList = glusterOptionDao.getGlobalVolumeOptions(vds.getClusterId()); if (!globalVolumeOptionsList.isEmpty()) { for (GlusterGlobalVolumeOptionEntity option : globalVolumeOptionsList) { if (option.getKey().equalsIgnoreCase(getParameters().getVolumeOption().getKey())) { volumeName = "all"; glusterOptionDao.updateGlobalVolumeOption(vds.getClusterId(), getParameters().getVolumeOption().getKey(), getParameters().getVolumeOption().getValue()); break; } } } else { GlusterVolumeGlobalOptionsInfoReturn entity = getBroker().glusterVolumeGlobalOptionsGet(); List<GlusterGlobalVolumeOptionEntity> globalVolumeOptionsListFromVds = entity.globalOptionList(); if (!globalVolumeOptionsListFromVds.isEmpty()) { for (GlusterGlobalVolumeOptionEntity option : globalVolumeOptionsListFromVds) { option.setClusterId(vds.getClusterId()); option.setId(Guid.newGuid()); glusterOptionDao.saveGlobalVolumeOption(option); if (option.getKey().equalsIgnoreCase(getParameters().getVolumeOption().getKey())) { volumeName = "all"; } } } } status = getBroker().glusterVolumeSet(volumeName, getParameters().getVolumeOption().getKey(), getParameters().getVolumeOption().getValue()); proceedProxyReturnValue(); }

Target:
protected void executeVdsBrokerCommand() { String volumeName = getParameters().getVolumeName(); VDS vds = vdsDao.get(getParameters().getVdsId()); List<GlusterGlobalVolumeOptionEntity> globalVolumeOptionsList = glusterOptionDao.getGlobalVolumeOptions(vds.getClusterId()); if (!globalVolumeOptionsList.isEmpty()) { for (GlusterGlobalVolumeOptionEntity option : globalVolumeOptionsList) { if (option.getKey().equalsIgnoreCase(getParameters().getVolumeOption().getKey())) { volumeName = "all"; break; } } } else { GlusterVolumeGlobalOptionsInfoReturn entity = getBroker().glusterVolumeGlobalOptionsGet(); List<GlusterGlobalVolumeOptionEntity> globalVolumeOptionsListFromVds = entity.globalOptionList(); if (!globalVolumeOptionsListFromVds.isEmpty()) { for (GlusterGlobalVolumeOptionEntity option : globalVolumeOptionsListFromVds) { option.setClusterId(vds.getClusterId()); option.setId(Guid.newGuid()); glusterOptionDao.saveGlobalVolumeOption(option); if (option.getKey().equalsIgnoreCase(getParameters().getVolumeOption().getKey())) { volumeName = "all"; } } } } status = getBroker().glusterVolumeSet(volumeName, getParameters().getVolumeOption().getKey(), getParameters().getVolumeOption().getValue()); proceedProxyReturnValue(); }
Source:
public static String getErrorMessage(@NonNull Throwable ex, @NonNull Context context) { String errorMessage = null; if (ex instanceof RetroHttpException) { RetrofitError cause = ((RetroHttpException) ex).getCause(); switch (cause.getKind()) { case NETWORK: { if (NetworkUtil.isConnected(context)) { errorMessage = context.getString(R.string.network_connected_error); } else { errorMessage = context.getString(R.string.reset_no_network_message); } break; } case HTTP: { if (cause.getResponse() != null) { final int status = cause.getResponse().getStatus(); switch (status) { case HttpURLConnection.HTTP_UNAVAILABLE: errorMessage = context.getString(R.string.network_service_unavailable); break; case HttpURLConnection.HTTP_NOT_FOUND: case HttpURLConnection.HTTP_INTERNAL_ERROR: errorMessage = context.getString(R.string.action_not_completed); break; } } } case CONVERSION: case UNEXPECTED: { break; } } } if (null == errorMessage) { logger.error(ex, true ); errorMessage = context.getString(R.string.error_unknown); } return errorMessage; }

Target:
public static String getErrorMessage(@NonNull Throwable ex, @NonNull Context context) { String errorMessage = null; if (ex instanceof HttpConnectivityException) { if (NetworkUtil.isConnected(context)) { errorMessage = context.getString(R.string.network_connected_error); } else { errorMessage = context.getString(R.string.reset_no_network_message); } } else if (ex instanceof HttpResponseStatusException) { final int status = ((HttpResponseStatusException) ex).getStatusCode(); switch (status) { case HttpURLConnection.HTTP_UNAVAILABLE: errorMessage = context.getString(R.string.network_service_unavailable); break; case HttpURLConnection.HTTP_NOT_FOUND: case HttpURLConnection.HTTP_INTERNAL_ERROR: errorMessage = context.getString(R.string.action_not_completed); break; } } if (null == errorMessage) { logger.error(ex, true ); errorMessage = context.getString(R.string.error_unknown); } return errorMessage; }
Source:
public void Case() { NumberExpression<Float> numExpression = employee.salary.floatValue().divide(employee2.salary.floatValue()).multiply(100); NumberExpression<Float> numExpression2 = employee.id.when(0).then(0.0F).otherwise(numExpression); query().from(employee, employee2).list(numExpression2); }

Target:
public void Case() { NumberExpression<Float> numExpression = employee.salary.floatValue().divide(employee2.salary.floatValue()).multiply(100.1); NumberExpression<Float> numExpression2 = employee.id.when(0).then(0.0F).otherwise(numExpression); assertEquals(ImmutableList.of(87, 90, 88, 87, 83, 80, 75), query().from(employee, employee2) .where(employee.id.eq(employee2.id.add(1))) .orderBy(employee.id.asc(), employee2.id.asc()) .list(numExpression2.floor().intValue())); }
Source:
public Response checkItemAvailability(@PathParam("id") String id) throws IOException { Response response; try (ItemManager itemManager = new ItemManager(); DownloadManager downloadManager = new DownloadManager()) { Item item = itemManager.load(id); if (item == null) { response = Response.status(NOT_FOUND).build(); } else { Download download = downloadManager.load(id); if (download != null) { String persistenceURI = download.getPersistanceURI(); if (download.isProblem()) { response = Response.status(NOT_IMPLEMENTED).build(); } else if (StringUtils.isBlank(persistenceURI)) { response = Response.status(ACCEPTED).build(); } else { if (!downloadManager.downloadFileExistsOnFilesystem(download)) { new DownloadService().delete(id); DownloadUtility.stageAsyncItemDownload(id); response = Response.status(ACCEPTED).build(); } else { response = Response.status(OK).build(); } } } else { DownloadUtility.stageAsyncItemDownload(id); response = Response.status(ACCEPTED).build(); } } } return response; }

Target:
public Response checkItemAvailability(@PathParam("id") String id) throws IOException { Response response; try (ItemManager itemManager = new ItemManager(); DownloadManager downloadManager = new DownloadManager()) { Item item = itemManager.load(id); if (item == null) { response = Response.status(NOT_FOUND).build(); } else { Download download = downloadManager.load(id); if (download != null) { String persistenceURI = download.getPersistanceURI(); if (download.isProblem()) { response = Response.status(INTERNAL_SERVER_ERROR).build(); } else if (StringUtils.isBlank(persistenceURI)) { response = Response.status(ACCEPTED).build(); } else { if (!downloadManager.downloadFileExistsOnFilesystem(download)) { new DownloadService().delete(id); DownloadUtility.stageAsyncItemDownload(id); response = Response.status(ACCEPTED).build(); } else { response = Response.status(OK).build(); } } } else { DownloadUtility.stageAsyncItemDownload(id); response = Response.status(ACCEPTED).build(); } } } return response; }
Source:
public void init(StreamGraph graph, Config config) { MessageStream<String> pageViews = graph.<String, String, String>getInputStream(INPUT_TOPIC, (k, v) -> v); OutputStream<String, String, WindowPane<String, Collection<String>>> outputStream = graph .getOutputStream(OUTPUT_TOPIC, m -> m.getKey().getKey(), m -> new Integer(m.getMessage().size()).toString()); Function<String, String> keyFn = pageView -> new PageView(pageView).getCountry(); pageViews .partitionBy(keyFn) .window(Windows.keyedTumblingWindow(keyFn, Duration.ofSeconds(3))) .sendTo(outputStream); }

Target:
public void init(StreamGraph graph, Config config) { MessageStream<String> pageViews = graph.<String, String, String>getInputStream(INPUT_TOPIC, (k, v) -> v); OutputStream<String, String, WindowPane<String, Integer>> outputStream = graph .getOutputStream(OUTPUT_TOPIC, m -> m.getKey().getKey(), m -> m.getMessage().toString()); Function<String, String> keyFn = pageView -> new PageView(pageView).getCountry(); pageViews .partitionBy(keyFn) .window(Windows.keyedTumblingWindow(keyFn, Duration.ofSeconds(3), () -> 0, (m, prevCount) -> prevCount + 1)) .sendTo(outputStream); }
Source:
public ThriftMessageParser(SecorConfig config) throws InstantiationException, IllegalAccessException, ClassNotFoundException { super(config); String factoryClassName = mConfig.getThriftProtocolClass().concat("$Factory"); TProtocolFactory protocolFactory = ((Class<? extends TProtocolFactory>) Class.forName(factoryClassName)).newInstance(); mDeserializer = new TDeserializer(protocolFactory); mThriftPath = new ThriftPath(mConfig.getMessageTimestampName(), (short) mConfig.getMessageTimestampId()); mTimestampType = mConfig.getMessageTimestampType(); }

Target:
public ThriftMessageParser(SecorConfig config) throws InstantiationException, IllegalAccessException, ClassNotFoundException { super(config); TProtocolFactory protocolFactory = null; String protocolName = mConfig.getThriftProtocolClass(); if (StringUtils.isNotEmpty(protocolName)) { String factoryClassName = protocolName.concat("$Factory"); protocolFactory = ((Class<? extends TProtocolFactory>) Class.forName(factoryClassName)).newInstance(); } else protocolFactory = new TBinaryProtocol.Factory(); mDeserializer = new TDeserializer(protocolFactory); mThriftPath = new ThriftPath(mConfig.getMessageTimestampName(),(short) mConfig.getMessageTimestampId()); mTimestampType = mConfig.getMessageTimestampType(); }
Source:
private void cancel(int id, String paragraphId) { if (livyVersion.isCancelSupported()) { try { LOGGER.info("Cancelling statement " + id); cancelStatement(id); paragraphsToCancel.remove(paragraphId); } catch (LivyException e) { LOGGER.error("Fail to cancel statement " + id + " for paragraph " + paragraphId, e); } } else { LOGGER.warn("cancel is not supported for this version of livy: " + livyVersion); } }

Target:
private void cancel(int id, String paragraphId) { if (livyVersion.isCancelSupported()) { try { LOGGER.info("Cancelling statement " + id); cancelStatement(id); } catch (LivyException e) { LOGGER.error("Fail to cancel statement " + id + " for paragraph " + paragraphId, e); } finally { paragraphsToCancel.remove(paragraphId); } } else { LOGGER.warn("cancel is not supported for this version of livy: " + livyVersion); paragraphsToCancel.clear(); } }
Source:
private String formatHeadRef(Ref ref) { final String name = ref.getName(); if (name.startsWith(Constants.R_HEADS)) { return name.substring(Constants.R_HEADS.length()); } else if (name.startsWith(Constants.R_REMOTES)) { return name.substring(Constants.R_REMOTES.length()); } return name; }

Target:
private String formatHeadRef(Ref ref) { final String name = ref.getName(); if (name.startsWith(Constants.R_HEADS)) return name.substring(Constants.R_HEADS.length()); else if (name.startsWith(Constants.R_REMOTES)) return name.substring(Constants.R_REMOTES.length()); return name; }
Source:
public void canSubscribeIfInvited() throws Exception { System.out.println("\n\n\n***** this test"); Map<String, String> configuration = new HashMap<String, String>(); configuration.put(Conf.ACCESS_MODEL, AccessModel.local.toString()); configuration.put(Conf.DEFAULT_AFFILIATION, Affiliations.member.toString()); Mockito.when(channelManager.getNodeConf(Mockito.anyString())) .thenReturn(configuration); membership = new NodeMembershipImpl(node, jid, Subscriptions.invited, Affiliations.none, null); Mockito.when( channelManager.getNodeMembership(Mockito.anyString(), Mockito.any(JID.class))).thenReturn(membership); subscribe.process(element, new JID("francisco@denmark.lit"), request, null); IQ response = (IQ) queue.poll(); Assert.assertEquals(IQ.Type.result, response.getType()); Assert.assertEquals(Subscriptions.subscribed, Subscriptions .valueOf(response.getChildElement().element("subscription") .attributeValue("subscription"))); }

Target:
public void canSubscribeIfInvited() throws Exception { Map<String, String> configuration = new HashMap<String, String>(); configuration.put(Conf.ACCESS_MODEL, AccessModel.local.toString()); configuration.put(Conf.DEFAULT_AFFILIATION, Affiliations.member.toString()); Mockito.when(channelManager.getNodeConf(Mockito.anyString())) .thenReturn(configuration); membership = new NodeMembershipImpl(node, jid, Subscriptions.invited, Affiliations.none, null); Mockito.when( channelManager.getNodeMembership(Mockito.anyString(), Mockito.any(JID.class))).thenReturn(membership); subscribe.process(element, new JID("francisco@denmark.lit"), request, null); IQ response = (IQ) queue.poll(); Assert.assertEquals(IQ.Type.result, response.getType()); Assert.assertEquals(Subscriptions.subscribed, Subscriptions .valueOf(response.getChildElement().element("subscription") .attributeValue("subscription"))); }
Source:
public void testUndo() { if (!hasExecuted) { aDeleteNodeCommand.execute(); } int numOfNodes = aRootNodes.size(); aDeleteNodeCommand.undo(); assertEquals(numOfNodes+1, aRootNodes.size()); try { assertTrue((boolean)aNeedsLayout.get(aGraph)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }

Target:
public void testUndo() { aDeleteNodeCommand.execute(); assertEquals(0, aGraph.getRootNodes().size()); aDeleteNodeCommand.undo(); assertEquals(1, aGraph.getRootNodes().size()); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(); try { RevCommit a = getCommit(nodes.get(0)); RevCommit b = getCommit(nodes.get(1)); if (a != null && b != null) { Repository repo = (nodes.get(0).getRepository()); IWorkbenchPage workbenchPage = HandlerUtil .getActiveWorkbenchWindowChecked(event).getActivePage(); if (a.getCommitTime() <= b.getCommitTime()) { compare(workbenchPage, repo, b.getName(), a.getName()); } else { compare(workbenchPage, repo, a.getName(), b.getName()); } } } catch (IOException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(); Ref ref1 = getRef(nodes.get(0)); Ref ref2 = getRef(nodes.get(1)); if (ref1 != null && ref2 != null) { Repository repo = (nodes.get(0).getRepository()); IWorkbenchPage workbenchPage = HandlerUtil .getActiveWorkbenchWindowChecked(event).getActivePage(); try { RevCommit a = repo.parseCommit(ref1.getObjectId()); RevCommit b = repo.parseCommit(ref2.getObjectId()); if (a.getCommitTime() <= b.getCommitTime()) { compare(workbenchPage, repo, b.getName(), a.getName()); } else { compare(workbenchPage, repo, a.getName(), b.getName()); } } catch (IOException e) { throw new ExecutionException(e.getLocalizedMessage(), e); } } return null; }
Source:
public AmazonS3 provideAmazonS3Client(AWSCredentials awsCredentials) { if (awsCredentials == null) { InstanceProfileCredentialsProvider iamCredentials = new InstanceProfileCredentialsProvider(true); return new AmazonS3Client(iamCredentials); } return new AmazonS3Client(awsCredentials); }

Target:
public AmazonS3 provideAmazonS3Client(AWSCredentials awsCredentials) { if (awsCredentials == null) { InstanceProfileCredentialsProvider iamCredentials = new InstanceProfileCredentialsProvider(); return new AmazonS3Client(iamCredentials); } return new AmazonS3Client(awsCredentials); }