auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void reportException(@Nonnull Throwable e) { String name = e.getMessage(); <START> if (name == null || name.length() == 0) { <END> LOGGER.log(Level.INFO, "No class name could be extracted from the throwable to determine if it's reportable", e); } else { reportException(name, e); } }</code><technical_language>if name is " " execute else clause suggestion if (String.isEmpty(name)) {</technical_language>

Target:
private static void reportException(@Nonnull Throwable e) { if (enabled()) { String name = e.getMessage(); if (name == null || name.trim().isEmpty()) { LOGGER.log(Level.INFO, "No class name could be extracted from the throwable to determine if it's reportable", e); } else { reportException(name, e); } } }
Source:
<code>void does_not_print_duplicate_snippets() { bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 13, singletonList("snippet") )); bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 14, singletonList("snippet") )); bus.send(new TestRunFinished( bus.getInstant() )); <START> assertThat(new String(out.toByteArray(), UTF_8), is("" + <END> LINE_ENDING + "0 Scenarios" + LINE_ENDING + "0 Steps" + LINE_ENDING + "0m0.000s" + LINE_ENDING + LINE_ENDING + LINE_ENDING + "You can implement missing steps with the snippets below:" + LINE_ENDING + LINE_ENDING + "snippet" + LINE_ENDING + LINE_ENDING + LINE_ENDING )); }</code><technical_language>Cheers! I more readable if equalToCompressingWhiteSpace instead of extracting new line character. <LINK_0></technical_language>

Target:
void does_not_print_duplicate_snippets() { bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 13, singletonList("snippet") )); bus.send(new SnippetsSuggestedEvent( bus.getInstant(), URI.create("classpath:com/example.feature"), 12, 14, singletonList("snippet") )); bus.send(new TestRunFinished( bus.getInstant() )); assertThat(new String(out.toByteArray(), UTF_8), equalToCompressingWhiteSpace("" + "\n" + "0 Scenarios\n" + "0 Steps\n" + "0m0.000s\n" + "\n" + "\n" + "You can implement missing steps with the snippets below:\n" + "\n" + "snippet\n" + "\n" + "\n" )); }
Source:
<code>public List<String> getColumnsCopy() { List<String> list = new <START> ArrayList<String>(); <END> for (String string : m_columns) { if (StringConstants.UNICODE_NULL.equals(string)) { list.add(null); } else { list.add(string); } } return list; }</code><technical_language>Default size necessary</technical_language>

Target:
public List<String> getColumnsCopy() { List<String> list = new ArrayList<String>(getColumnCount()); for (String string : getColumns()) { if (StringConstants.UNICODE_NULL.equals(string)) { list.add(null); } else { list.add(string); } } return list; }
Source:
<code>public void partDeactivated(IWorkbenchPart part) { <START> fTraceSelected = false; <END> }</code><technical_language>check part deactivated is 'this'</technical_language>

Target:
public void partDeactivated(IWorkbenchPart part) { }
Source:
<code>public Image selectById(UUID id) { Image image = sqlConnection.createQuery(ImageQueries.selectById) .setAutoDeriveColumnNames(true) .addParameter("id", id) .executeAndFetchFirst(Image.class); <START> if(image != null && image.getImageContent() != null) <END> { image.setHash(GuavaHashGenerator.calculateHash(image.getImageContent())); } return image; }</code><technical_language>a pick: do a method this if? logic line 41</technical_language>

Target:
public Image selectById(UUID id) { Image image = sqlConnection.createQuery(ImageQueries.selectById) .setAutoDeriveColumnNames(true) .addParameter("id", id) .executeAndFetchFirst(Image.class); if(imageIsHashable(image)) { image.setHash(GuavaHashGenerator.calculateHash(image.getImageContent())); } return image; }
Source:
<code>public XWikiAttachment addAttachment(XWikiDocument doc, byte[] data, String filename, String username, String comment) throws AttachmentToBigException, AddingAttachmentContentFailedException, DocumentSaveException { ByteArrayInputStream in = null; try { in = new ByteArrayInputStream(data); return addAttachment(doc, in, filename, username, comment); } finally { <START> if(in != null) { <END> try { in.close(); } catch (IOException ioe) { _LOGGER.error("Exception in byte[] to InputStream", ioe); } } } }</code><technical_language>improve readability: please guavas Closables.closeQuietly(in); instead <LINK_0></technical_language>

Target:
public XWikiAttachment addAttachment(XWikiDocument doc, byte[] data, String filename, String username, String comment) throws AttachmentToBigException, AddingAttachmentContentFailedException, DocumentSaveException { ByteArrayInputStream dataStream = null; try { dataStream = new ByteArrayInputStream(data); return addAttachment(doc, dataStream, filename, username, comment); } finally { IOUtils.closeQuietly(dataStream); } }
Source:
<code>public JsonNode getUserSettings() { JsonNode output = null; String homeDir = System.getProperty("user.home"); String settingsPath = ""; ObjectMapper mapper = new ObjectMapper(); try { if (Platform.isWindows()) { settingsPath = Paths.get(System.getenv("APPDATA"), "Code", "User", "settings.json") .toString(); } else if (Platform.isMac()) { settingsPath = Paths.get(homeDir, "Library", "Application Support", "Code", "User", "settings.json").toString(); } else if (Platform.isLinux()) { settingsPath = Paths.get(homeDir, ".config", "Code", "User", "settings.json") .toString(); <START> } <END> File settingsFile = new File(settingsPath); output = mapper.readTree(settingsFile); } catch (Exception e) { return output; } return output; }</code><technical_language>Handle situation a OS is used</technical_language>

Target:
private JsonNode getUserSettings() { JsonNode output = null; String homeDir = System.getProperty("user.home"); String settingsPath = ""; ObjectMapper mapper = new ObjectMapper(); try { if (Platform.isWindows()) { settingsPath = Paths.get(System.getenv("APPDATA"), "Code", "User", "settings.json") .toString(); } else if (Platform.isMac()) { settingsPath = Paths.get(homeDir, "Library", "Application Support", "Code", "User", "settings.json").toString(); } else if (Platform.isLinux()) { settingsPath = Paths.get(homeDir, ".config", "Code", "User", "settings.json") .toString(); } else { throw logger.logExceptionAsError( new CredentialUnavailableException(PLATFORM_NOT_SUPPORTED_ERROR)); } File settingsFile = new File(settingsPath); output = mapper.readTree(settingsFile); } catch (Exception e) { return null; } return output; }
Source:
<code>private void addOrUpdateNewActivityCategories(Set<ActivityCategoryDto> activityCategoryDtos, Set<ActivityCategory> activityCategoriesInRepository) { Map<UUID, ActivityCategory> activityCategoriesInRepositoryMap = activityCategoriesInRepository.stream() .collect(Collectors.toMap(ActivityCategory::getId, ac -> ac)); activityCategoryDtos.stream() <START> .forEach(actCat -> addOrUpdateNewActivityCategory(actCat, activityCategoriesInRepositoryMap)); <END> }</code><technical_language>I prefer activityCategoryDto actCat</technical_language>

Target:
private void addOrUpdateNewActivityCategories(Set<ActivityCategoryDto> activityCategoryDtos, Set<ActivityCategory> activityCategoriesInRepository) { Map<UUID, ActivityCategory> activityCategoriesInRepositoryMap = activityCategoriesInRepository.stream() .collect(Collectors.toMap(ActivityCategory::getId, ac -> ac)); activityCategoryDtos.stream().forEach(a -> addOrUpdateNewActivityCategory(a, activityCategoriesInRepositoryMap)); }
Source:
<code>public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); <START> assertTrue(fs.supportsSymlinks()); <END> String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }</code><technical_language>This assertion is needed anymore</technical_language>

Target:
public void testCreateSymlinkOverrideExisting() throws IOException { FS fs = FS.DETECTED; Assume.assumeTrue(fs.supportsSymlinks()); File file = new File(trash, "x"); fs.createSymLink(file, "y"); String target = fs.readSymLink(file); assertEquals("y", target); fs.createSymLink(file, "z"); target = fs.readSymLink(file); assertEquals("z", target); }
Source:
<code>public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; checkForBackOff(); <START> String index = Optional.fromNullable( <END> (String) streamsDatum.getMetadata().get("index")) .or(""); String type = Optional.fromNullable( (String) streamsDatum.getMetadata().get("type")) .or(config.getType()); String id = Optional.fromNullable( (String) streamsDatum.getMetadata().get("id")) .or(streamsDatum.getId()); if(config.getForceUseConfig()) { index = config.getIndex(); type = config.getType(); } try { add(index, type, id, streamsDatum.getTimestamp() == null ? Long.toString(DateTime.now().getMillis()) : Long.toString(streamsDatum.getTimestamp().getMillis()), convertAndAppendMetadata(streamsDatum)); } catch (Throwable e) { LOGGER.warn("Unable to Write Datum to ElasticSearch: {}", e.getMessage()); } }</code><technical_language>I write this String index = streamsDatum.getMetadata().get("index"); if(index == null || config.getForceUseConfig()) { index = config.getIndex(); }</technical_language>

Target:
public void write(StreamsDatum streamsDatum) { if(streamsDatum == null || streamsDatum.getDocument() == null) return; checkForBackOff(); String index = (String) streamsDatum.getMetadata().get("index"); String type = (String) streamsDatum.getMetadata().get("type"); String id = Optional.fromNullable( (String) streamsDatum.getMetadata().get("id")) .or(streamsDatum.getId()); if(index == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { index = config.getIndex(); } if(type == null || (config.getForceUseConfig() != null && config.getForceUseConfig())) { type = config.getType(); } try { add(index, type, id, streamsDatum.getTimestamp() == null ? Long.toString(DateTime.now().getMillis()) : Long.toString(streamsDatum.getTimestamp().getMillis()), convertAndAppendMetadata(streamsDatum)); } catch (Throwable e) { LOGGER.warn("Unable to Write Datum to ElasticSearch: {}", e.getMessage()); } }
Source:
<code>CacheProvider(final boolean disk, CacheModule module, TypeLiteral<Cache<K, V>> typeLiteral) { this.disk = disk; this.module = module; memoryLimit(1024); maxAge(90, DAYS); evictionPolicy(LFU); Type[] tmp = ((ParameterizedType) typeLiteral.getType()).getActualTypeArguments(); keyClass = (Class<K>) tmp[0]; valueClass = (Class<V>) tmp[1]; for (Constructor c : valueClass.getDeclaredConstructors()) { if (c.getAnnotation(Inject.class) != null) { valueProvider = module.getValueProvider(valueClass); } } ProtobufCodec<K> keyCodec = CodecFactory.encoder(keyClass); K k = keyCodec.decode(new byte[0]); <START> if (k == null) { <END> throw new IllegalStateException("Cannot support " + keyClass + " on protobuf"); } if (valueProvider == null) { ProtobufCodec<V> valueCodec = CodecFactory.encoder(valueClass); V v = valueCodec.decode(new byte[0]); if (v == null) { throw new IllegalStateException("Cannot support " + valueClass + " on protobuf"); } } if (disk) { diskLimit(16384); } }</code><technical_language>returning null here. throw exception if decode fail, is RuntimeException. instead: try { keyCodec.decode(new byte[0]); } catch (RuntimeException err) { throw new IllegalStateException("Cannot support " + keyClass + " in protobuf format", err); }</technical_language>

Target:
CacheProvider(final boolean disk, CacheModule module, TypeLiteral<Cache<K, V>> typeLiteral) { this.disk = disk; this.module = module; memoryLimit(1024); maxAge(90, DAYS); evictionPolicy(LFU); Type[] tmp = ((ParameterizedType) typeLiteral.getType()).getActualTypeArguments(); keyClass = (Class<K>) tmp[0]; valueClass = (Class<V>) tmp[1]; for (Constructor c : valueClass.getDeclaredConstructors()) { if (c.getAnnotation(Inject.class) != null) { valueProvider = module.getValueProvider(valueClass); } } try { ProtobufCodec<K> keyCodec = CodecFactory.encoder(keyClass); keyCodec.decode(new byte[0]); } catch (RuntimeException err) { throw new IllegalStateException("Cannot support " + keyClass + " in protobuf format", err); } if (valueProvider == null) { try { ProtobufCodec<V> valueCodec = CodecFactory.encoder(valueClass); valueCodec.decode(new byte[0]); } catch (RuntimeException err) { throw new IllegalStateException("Cannot support " + valueClass + " in protobuf format", err); } } if (disk) { diskLimit(16384); } }
Source:
<code><START> final public void execute() { <END> if (isSafe()) { executeIfSafe(); return; } cancel(); if (reasonUnsafe == null) { reasonUnsafe = "the required safety conditions haven't been met"; } LogKitten.e("SafetyCommand " + getName() + " cannot run because " + reasonUnsafe + ". Cancelling..."); }</code><technical_language>public final</technical_language>

Target:
public final void execute() { if (isSafe()) { executeIfSafe(); return; } cancel(); if (reasonUnsafe == null) { reasonUnsafe = "the required safety conditions haven't been met"; } LogKitten.e("SafetyCommand " + getName() + " cannot run because " + reasonUnsafe + ". Cancelling..."); }
Source:
<code>public LocalMemoryContext localUserMemoryContext() { <START> return new UncloseableLocalMemoryContext(new InternalLocalMemoryContext(operatorMemoryContext.localUserMemoryContext(), memoryFuture)); <END> }</code><technical_language>delegations now: uncloseable context -> internal context -> local user memory context. add constructor arguments InternalLocalMemoryContext InternalAggregatedMemoryContext tells support close (and remove uncloseable contexts)</technical_language>

Target:
public LocalMemoryContext localUserMemoryContext() { return new InternalLocalMemoryContext(operatorMemoryContext.localUserMemoryContext(), memoryFuture, this::updatePeakMemoryReservations, false); }
Source:
<code>public boolean isSupported() { <START> return version.compareTo(MINIMUM_SUPPORTED_VERSION) >= 0 && version.compareTo(MAXIMUM_SUPPORTED_VERSION) < 0; <END> }</code><technical_language>Shouldnt this <= ? Is pulled latest changes? I this changed < 2_12_0 <= 2_11_0 equivalent (and maintain of MAXIMUM_SUPPORTED_VERSION)</technical_language>

Target:
public boolean isSupported() { return version.compareTo(MINIMUM_SUPPORTED_VERSION) >= 0 && version.compareTo(MAXIMUM_SUPPORTED_VERSION) <= 0; }
Source:
<code>private boolean rowsAreEqual(SearchRow rowOne, SearchRow rowTwo) { if (rowOne == rowTwo) { return true; } for (int index : columnIds) { Value v1 = rowOne.getValue(index); Value v2 = rowTwo.getValue(index); if (v1 == null ? v2 != null : !v1.equals(v2)) { <START> break; <END> } } return rowOne.getKey() == rowTwo.getKey(); }</code><technical_language>return false? BTW, ValueStringIgnoreCase.equals() other types return true for strings. this ugly data type addressed in a separate issue, more unrelated problems due equals() implementation</technical_language>

Target:
private boolean rowsAreEqual(SearchRow rowOne, SearchRow rowTwo) { if (rowOne == rowTwo) { return true; } for (int index : columnIds) { Value v1 = rowOne.getValue(index); Value v2 = rowTwo.getValue(index); if (v1 == null ? v2 != null : !v1.equals(v2)) { return false; } } return rowOne.getKey() == rowTwo.getKey(); }
Source:
<code>public boolean recoverOne(int hostId, Integer portOffset, String rejoinHost, boolean liveRejoin) { <START> if (isNewCli) { <END> return recoverOne( false, 0, hostId, portOffset, rejoinHost, StartAction.PROBE); } else { return recoverOne( false, 0, hostId, portOffset, rejoinHost, liveRejoin ? StartAction.LIVE_REJOIN : StartAction.REJOIN); } }</code><technical_language>decide start action code recoverOne java StartAction action = isNewCli ? StartAction.PROBE : liveRejoin ? StartAction.LIVE_REJOIN : StartAction.REJOIN;</technical_language>

Target:
public boolean recoverOne(int hostId, Integer portOffset, String rejoinHost, boolean liveRejoin) { StartAction startAction = isNewCli ? StartAction.PROBE : (liveRejoin ? StartAction.LIVE_REJOIN : StartAction.REJOIN); return recoverOne( false, 0, hostId, portOffset, rejoinHost, startAction); }
Source:
<code>public void setDelay(int delay) { <START> this.delayExpression = new SupplierExpression<>(() -> delay); <END> }</code><technical_language>Good idea, of course, permissions live :smile: I existing ValueExpression<V> here. setter is already, WDYT more delay XSD attribute ? In addition need consider move this "strange" Expression implementations SF SpEL module</technical_language>

Target:
public void setDelay(int delay) { this.delayExpression = new ValueExpression<>(delay); }
Source:
<code>private void setDataView(Content content) { if (content == null) { this.resetComponent(); return; } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (content.getSize() == 0) { return; } byte[] data = new byte[(int) content.getSize()]; try { content.read(data, 0x0, content.getSize()); } catch (TskCoreException ex) { <START> logger.log(Level.WARNING, "Failed to read file content.", ex); <END> } ByteBuffer buf = ByteBuffer.wrap(data); RegistryHive h = new RegistryHiveBuffer(buf); this.regview = new RejView(h); this.add(this.regview, BorderLayout.CENTER); this.setCursor(null); }</code><technical_language>exit here</technical_language>

Target:
private void setDataView(Content content) { if (content == null) { this.resetComponent(); return; } this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (content.getSize() == 0) { return; } byte[] data = new byte[(int) content.getSize()]; try { content.read(data, 0x0, content.getSize()); } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to read file content.", ex); return; } ByteBuffer buf = ByteBuffer.wrap(data); RegistryHive h = new RegistryHiveBuffer(buf); this.regview = new RejView(h); this.add(this.regview, BorderLayout.CENTER); this.setCursor(null); }
Source:
<code>public static void waitSuccessCondition( BooleanSupplier condition, long timeout, long delayBetweenAttemptsInMilliseconds, TimeUnit timeoutTimeUnit) throws InterruptedException { final long waitingTime = timeoutTimeUnit.toMillis(timeout); final long startingTime = System.currentTimeMillis(); final long finishTime = startingTime + waitingTime; Callable<Boolean> waitTrueState = () -> { <START> while (System.currentTimeMillis() <= finishTime) { <END> if (condition.getAsBoolean()) { return true; } sleepQuietly(delayBetweenAttemptsInMilliseconds, TimeUnit.MILLISECONDS); } throw new TimeoutException( "The condition has not being in \"true\" state during timeout"); }; List<Future<Boolean>> result = Executors.newSingleThreadScheduledExecutor() .invokeAll(asList(waitTrueState), timeout, timeoutTimeUnit); if (result.get(0).isCancelled()) { throw new TimeoutException("The condition has not being in \"true\" state during timeout"); } }</code><technical_language>If System.currentTimeMillis() = finishTime sense continue execution timeout exceeded</technical_language>

Target:
public static void waitSuccessCondition( BooleanSupplier condition, long timeout, long delayBetweenAttemptsInMilliseconds, TimeUnit timeoutTimeUnit) throws InterruptedException, TimeoutException { ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit( () -> { while (!condition.getAsBoolean()) { sleepQuietly(delayBetweenAttemptsInMilliseconds, TimeUnit.MILLISECONDS); } }); executor.shutdown(); if (!executor.awaitTermination(timeout, timeoutTimeUnit)) { throw new TimeoutException( String.format( "Expected condition failed: waiting for %s %s with %s MILLISECONDS interval", timeout, timeoutTimeUnit, delayBetweenAttemptsInMilliseconds)); } }
Source:
<code>public ReaderWebView(Context context, AttributeSet attrs) { super(context, attrs); <START> TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BoundedWidth); <END> mBoundedWidth = a.getDimensionPixelSize(R.styleable.BoundedWidth_bounded_width, 0); a.recycle(); init(); }</code><technical_language>avoid obtaining mBoundedWidth in next constructor simply calling this(context, attrs, 0); here</technical_language>

Target:
public ReaderWebView(Context context, AttributeSet attrs) { super(context, attrs); init(); }
Source:
<code>protected boolean checkLevelExists(int level) { <START> return !(level < levelQuarks.size() || level >= 0); <END> }</code><technical_language>This is equivalent</technical_language>

Target:
protected boolean checkLevelExists(int level) { return !(level >= levelQuarks.size() || level < 0); }
Source:
<code>public void setAndInitZkEventThreadMonitor(ZkEventThread zkEventThread) { if (_zkEventThreadMetric == null) { <START> _zkEventThreadMetric = new ZkThreadMetric(zkEventThread); <END> } }</code><technical_language>nit, throw Exception if _zkEventThreadMetric set monitor object registered. Otherwise, unexpected monitor in final result</technical_language>

Target:
public synchronized boolean setAndInitZkEventThreadMonitor(ZkEventThread zkEventThread) { if (_zkEventThreadMetric == null) { _zkEventThreadMetric = new ZkThreadMetric(zkEventThread); return true; } return false; }
Source:
<code>@Override protected void onStart() { super.onStart(); adapter.setLogs(lumberYard.bufferedLogs()); subscriptions = new CompositeSubscription(); subscriptions.add(lumberYard.logs() <START> .subscribeOn(AndroidSchedulers.mainThread()) END> .subscribe(adapter)); }</code><technical_language>I want observeOn here... effect is same</technical_language>

Target:
@Override protected void onStart() { super.onStart(); adapter.setLogs(lumberYard.bufferedLogs()); subscriptions = new CompositeSubscription(); subscriptions.add(lumberYard.logs() .observeOn(AndroidSchedulers.mainThread()) .subscribe(adapter)); }
Source:
<code>public static void runRebaseJob(final Repository repository, String jobname, Ref ref) { final RebaseOperation rebase = new RebaseOperation(repository, ref); Job job = new Job(jobname) { @Override protected IStatus run(IProgressMonitor monitor) { if (!repository.getRepositoryState().equals( RepositoryState.SAFE)) <START> throw new IllegalStateException("Can't nest rebase"); END> try { rebase.execute(monitor); } catch (final CoreException e) { if (!repository.getRepositoryState().equals( RepositoryState.SAFE)) { try { new RebaseOperation(repository, Operation.ABORT) .execute(monitor); } catch (CoreException e1) { return createMultiStatus(e, e1); } } return e.getStatus(); } return Status.OK_STATUS; } }; job.setUser(true); job.setRule(rebase.getSchedulingRule()); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent cevent) { IStatus result = cevent.getJob().getResult(); if (result.getSeverity() == IStatus.CANCEL) { Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); MessageDialog .openInformation( shell, UIText.RebaseCurrentRefCommand_RebaseCanceledTitle, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage); } }); } else if (result.isOK()) { RebaseResultDialog.show(rebase.getResult(), repository); } } }); job.schedule(); }</code><technical_language>better: start rebase in repository state ..</technical_language>

Target:
public static void runRebaseJob(final Repository repository, String jobname, Ref ref) { final RebaseOperation rebase = new RebaseOperation(repository, ref); Job job = new Job(jobname) { @Override protected IStatus run(IProgressMonitor monitor) { if (!repository.getRepositoryState().equals( RepositoryState.SAFE)) throw new IllegalStateException( "Can't start rebase if repository state isn't SAFE"); try { rebase.execute(monitor); } catch (final CoreException e) { if (!repository.getRepositoryState().equals( RepositoryState.SAFE)) { try { new RebaseOperation(repository, Operation.ABORT) .execute(monitor); } catch (CoreException e1) { return createMultiStatus(e, e1); } } return e.getStatus(); } return Status.OK_STATUS; } }; job.setUser(true); job.setRule(rebase.getSchedulingRule()); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent cevent) { IStatus result = cevent.getJob().getResult(); if (result.getSeverity() == IStatus.CANCEL) { Display.getDefault().asyncExec(new Runnable() { public void run() { Shell shell = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getShell(); MessageDialog .openInformation( shell, UIText.RebaseCurrentRefCommand_RebaseCanceledTitle, UIText.RebaseCurrentRefCommand_RebaseCanceledMessage); } }); } else if (result.isOK()) { RebaseResultDialog.show(rebase.getResult(), repository); } } }); job.schedule(); }
Source:
<code>public InputReader(InputStream inputStream, @Nullable final ICommandOutputListener listener, final boolean isStdOut) { fResult = new StringBuilder(); fReader = new InputStreamReader(inputStream); fThread = new Thread() { @Override public void run() { final char[] buffer = new char[BYTES_PER_KB]; int read; try { while (!fDone && (read = fReader.read(buffer)) > 0) { fResult.append(buffer, 0, read); if (listener != null) { if (isStdOut) { <START> listener.outputUpdated(checkNotNull(String.valueOf(buffer, 0, read))); <END> } else { listener.errorOutputUpdated(checkNotNull(String.valueOf(buffer, 0, read))); } } } } catch (IOException e) { } } }; fThread.start(); }</code><technical_language>external annotations for String.valueOf</technical_language>

Target:
public InputReader(InputStream inputStream, @Nullable final ICommandOutputListener listener, final boolean isStdOut) { fResult = new StringBuilder(); fReader = new InputStreamReader(inputStream); fThread = new Thread() { @Override public void run() { final char[] buffer = new char[BYTES_PER_KB]; int read; try { while (!fDone && (read = fReader.read(buffer)) > 0) { fResult.append(buffer, 0, read); if (listener != null) { if (isStdOut) { listener.outputUpdated(String.valueOf(buffer, 0, read)); } else { listener.errorOutputUpdated(String.valueOf(buffer, 0, read)); } } } } catch (IOException e) { } } }; fThread.start(); }
Source:
<code><START> public void getParam(String key){ <END> this.params.get(key); }</code><technical_language>This return something, no? :)</technical_language>

Target:
public Param<?> getParam(String key){ return this.params.get(key); }
Source:
<code>private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); try { OnHeapValueHolder<V> result = map.computeIfPresent(key, new BiFunction<K, OnHeapValueHolder<V>, OnHeapValueHolder<V>>() { @Override public OnHeapValueHolder<V> apply(K mappedKey, OnHeapValueHolder<V> mappedValue) { final long now = timeSource.getTimeMillis(); if (mappedValue.isExpired(now, TimeUnit.MILLISECONDS)) { onExpiration(mappedKey, mappedValue); return null; } if (updateAccess) { <START> if (setAccessTimeAndExpiryThenReturnMapping(key, mappedValue, now) == null) { <END> onExpiration(mappedKey, mappedValue); return null; } } return mappedValue; } }); if (result == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); } else { getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); } return result; } catch (RuntimeException re) { handleRuntimeException(re); return null; } }</code><technical_language>this block hidden a method. version more locations equivalent code called, changed a version longer notifies. I initial version more _correct_ needed some refactoring extract duplication</technical_language>

Target:
private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); try { OnHeapValueHolder<V> result = map.computeIfPresent(key, new BiFunction<K, OnHeapValueHolder<V>, OnHeapValueHolder<V>>() { @Override public OnHeapValueHolder<V> apply(K mappedKey, OnHeapValueHolder<V> mappedValue) { final long now = timeSource.getTimeMillis(); if (mappedValue.isExpired(now, TimeUnit.MILLISECONDS)) { onExpiration(mappedKey, mappedValue); return null; } if (updateAccess) { return setAccessTimeAndExpiryThenReturnMapping(key, mappedValue, now, false); } return mappedValue; } }); if (result == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); } else { getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); } return result; } catch (RuntimeException re) { handleRuntimeException(re); return null; } }
Source:
<code>private M mergeOldAndNewMetadata(@Nonnull M previousMetadata, @Nullable M userMetadata, boolean isCreate) { M.Builder builder = previousMetadata.toBuilder(); for (Descriptors.FieldDescriptor fieldDescriptor : previousMetadata.getDescriptorForType().getFields()) { if (fieldDescriptor.getOptions().getExtension(CorfuOptions.schema).getVersion()) { builder.setField( fieldDescriptor, Optional.ofNullable(previousMetadata.getField(fieldDescriptor)) .map(previousVersion -> (isCreate ? 0L : ((Long) previousVersion) + 1)) .orElse(0L)); } else if (fieldDescriptor.isRepeated()) { int count = previousMetadata.getRepeatedFieldCount(fieldDescriptor); for (int i = 0; i < count; i++) { builder.setRepeatedField(fieldDescriptor, i, <START> previousMetadata.getRepeatedField(fieldDescriptor, i)); <END> } } else if (userMetadata != null) { if (!userMetadata.hasField(fieldDescriptor)) { builder.setField(fieldDescriptor, previousMetadata.getField(fieldDescriptor)); } else { builder.setField(fieldDescriptor, userMetadata.getField(fieldDescriptor)); } } } return (M) builder.build(); }</code><technical_language>repeated field set metadata's values? if new metadata this field set? Shouldnt new values in case</technical_language>

Target:
private M mergeOldAndNewMetadata(@Nonnull M previousMetadata, @Nullable M userMetadata, boolean isCreate) { M.Builder builder = previousMetadata.toBuilder(); for (Descriptors.FieldDescriptor fieldDescriptor : previousMetadata.getDescriptorForType().getFields()) { if (fieldDescriptor.getOptions().getExtension(CorfuOptions.schema).getVersion()) { builder.setField( fieldDescriptor, Optional.ofNullable(previousMetadata.getField(fieldDescriptor)) .map(previousVersion -> (isCreate ? 0L : ((Long) previousVersion) + 1)) .orElse(0L)); } else if (fieldDescriptor.isRepeated()) { if (userMetadata != null) { try { int count = userMetadata.getRepeatedFieldCount(fieldDescriptor); for (int i = 0; i < count; i++) { builder.setRepeatedField(fieldDescriptor, i, userMetadata.getRepeatedField(fieldDescriptor, i)); } } catch (IllegalArgumentException iae) { int count = previousMetadata.getRepeatedFieldCount(fieldDescriptor); for (int i = 0; i < count; i++) { builder.setRepeatedField(fieldDescriptor, i, previousMetadata.getRepeatedField(fieldDescriptor, i)); } } } } else if (userMetadata != null) { if (!userMetadata.hasField(fieldDescriptor)) { builder.setField(fieldDescriptor, previousMetadata.getField(fieldDescriptor)); } else { builder.setField(fieldDescriptor, userMetadata.getField(fieldDescriptor)); } } } return (M) builder.build(); }
Source:
<code><START> protected MergeResult<RawText> contentMerge(CanonicalTreeParser base, <END> CanonicalTreeParser ours, CanonicalTreeParser theirs) throws IOException { RawText baseText = base == null ? RawText.EMPTY_TEXT : getRawText( base.getEntryObjectId(), db); RawText ourText = ours == null ? RawText.EMPTY_TEXT : getRawText( ours.getEntryObjectId(), db); RawText theirsText = theirs == null ? RawText.EMPTY_TEXT : getRawText( theirs.getEntryObjectId(), db); return (mergeAlgorithm.merge(RawTextComparator.DEFAULT, baseText, ourText, theirsText)); }</code><technical_language>need change this method signature. I leave this method private</technical_language>

Target:
private MergeResult<RawText> contentMerge(CanonicalTreeParser base, CanonicalTreeParser ours, CanonicalTreeParser theirs) throws IOException { RawText baseText = base == null ? RawText.EMPTY_TEXT : getRawText( base.getEntryObjectId(), db); RawText ourText = ours == null ? RawText.EMPTY_TEXT : getRawText( ours.getEntryObjectId(), db); RawText theirsText = theirs == null ? RawText.EMPTY_TEXT : getRawText( theirs.getEntryObjectId(), db); return (mergeAlgorithm.merge(RawTextComparator.DEFAULT, baseText, ourText, theirsText)); }
Source:
<code>public void shouldReportNodesThatAreNotIndexed() throws Exception { IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.empty() ); Iterator<IndexRule> indexRuleIterator = new SchemaStorage( fixture.directStoreAccess().nativeStores().getSchemaStore() ).indexesGetAll(); while ( indexRuleIterator.hasNext() ) { IndexRule indexRule = indexRuleIterator.next(); IndexAccessor accessor = fixture.directStoreAccess().indexes(). apply( indexRule.getProviderDescriptor() ).getOnlineAccessor( indexRule.getId(), indexRule.getIndexDescriptor(), samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.remove( asPrimitiveLongSet( indexedNodes ) ); updater.close(); <START> accessor.force(); <END> accessor.close(); } ConsistencySummaryStatistics stats = check(); on( stats ).verify( RecordType.NODE, 3 ) .andThatsAllFolks(); }</code><technical_language>point force specifically closing accessor</technical_language>

Target:
public void shouldReportNodesThatAreNotIndexed() throws Exception { IndexSamplingConfig samplingConfig = new IndexSamplingConfig( Config.defaults() ); Iterator<IndexRule> indexRuleIterator = new SchemaStorage( fixture.directStoreAccess().nativeStores().getSchemaStore() ).indexesGetAll(); while ( indexRuleIterator.hasNext() ) { IndexRule indexRule = indexRuleIterator.next(); IndexAccessor accessor = fixture.directStoreAccess().indexes(). apply( indexRule.getProviderDescriptor() ).getOnlineAccessor( indexRule.getId(), indexRule.getIndexDescriptor(), samplingConfig ); IndexUpdater updater = accessor.newUpdater( IndexUpdateMode.ONLINE ); updater.remove( asPrimitiveLongSet( indexedNodes ) ); updater.close(); accessor.force(); accessor.close(); } ConsistencySummaryStatistics stats = check(); on( stats ).verify( RecordType.NODE, 3 ) .andThatsAllFolks(); }
Source:
<code>protected SimpleKeyManagerFactory() { <START> this(""); <END> }</code><technical_language>nit: StringUtil.EMPTY_STRING</technical_language>

Target:
protected SimpleKeyManagerFactory() { this(StringUtil.EMPTY_STRING); }
Source:
<code><START> public static Predicate<Element> hasModifiers(Modifier... modifiers) { <END> final Collection<Modifier> modifierCollection = Lists.newArrayList(modifiers); return new Predicate<Element>() { @Override public boolean apply(Element input) { return input.getModifiers().containsAll(modifierCollection); } }; }</code><technical_language>I I a preference for a Set<Modifier> here. Callers easily ImmutableSet.of EnumSet.of</technical_language>

Target:
public static Predicate<Element> hasModifiers(Modifier... modifiers) { return hasModifiers(ImmutableSet.copyOf(modifiers)); }
Source:
<code>public static IDeploymentConfig getDeploymentConfig(IServerAttributes attributes) { <START> String dcKey = "deploymentconfig"; <END> IService service = getService(attributes); if (service == null) { return null; } String dcName = service.getPods().stream().filter(p -> p.getLabels().containsKey(dcKey)) .findFirst() .map(p -> p.getLabels().get(dcKey)) .orElse(null); if (dcName == null) { return null; } Connection connection = getConnection(attributes); if (connection == null) { return null; } IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, service.getNamespace(), dcName); return dc; }</code><technical_language>a constant</technical_language>

Target:
public static IDeploymentConfig getDeploymentConfig(IServerAttributes attributes) { IService service = getService(attributes); if (service == null) { return null; } String dcName = service.getPods().stream().filter(p -> p.getLabels().containsKey(DEPLOYMENT_CONFIG_KEY)) .findFirst() .map(p -> p.getLabels().get(DEPLOYMENT_CONFIG_KEY)) .orElse(null); if (dcName == null) { return null; } Connection connection = getConnection(attributes); if (connection == null) { return null; } IDeploymentConfig dc = connection.getResource(ResourceKind.DEPLOYMENT_CONFIG, service.getNamespace(), dcName); return dc; }
Source:
<code>private void updateGMFFontStyle(View view, BasicLabelStyle basicLabelStyle) { FontStyle fontStyle = (FontStyle) createOrFindStyle(view, NotationPackage.eINSTANCE.getFontStyle()); List<FontFormat> labelFormat = basicLabelStyle.getLabelFormat(); <START> fontStyle.setBold(false); fontStyle.setItalic(false); fontStyle.setUnderline(false); fontStyle.setStrikeThrough(false); for (FontFormat fontFormat : labelFormat) { switch (fontFormat.getValue()) { case FontFormat.BOLD: fontStyle.setBold(true); break; case FontFormat.ITALIC: fontStyle.setItalic(true); break; case FontFormat.UNDERLINE: fontStyle.setUnderline(true); break; case FontFormat.STRIKE_THROUGH: fontStyle.setStrikeThrough(true); break; default: break; } <END> } fontStyle.setFontHeight(basicLabelStyle.getLabelSize()); if (fontStyle.getFontName() == null) { fontStyle.setFontName(DEFAULT_FONT_STYLE); } RGBValues labelColor = basicLabelStyle.getLabelColor(); if (labelColor != null) { fontStyle.setFontColor(FigureUtilities.RGBToInteger(new RGB(labelColor.getRed(), labelColor.getGreen(), labelColor.getBlue()))); } }</code><technical_language>touch notifications for elements a font syle Normal. setXXX(false) produce a notification setXXX(true) notification: changes notification instead of a touch one. fonStyle.setBold(labelformat.contains(FontFormat.BOLD)); better</technical_language>

Target:
private void updateGMFFontStyle(View view, BasicLabelStyle basicLabelStyle) { FontStyle fontStyle = (FontStyle) createOrFindStyle(view, NotationPackage.eINSTANCE.getFontStyle()); List<FontFormat> labelFormat = basicLabelStyle.getLabelFormat(); if (fontStyle.isBold() != labelFormat.contains(FontFormat.BOLD_LITERAL)) { fontStyle.setBold(labelFormat.contains(FontFormat.BOLD_LITERAL)); } if (fontStyle.isItalic() != labelFormat.contains(FontFormat.ITALIC_LITERAL)) { fontStyle.setItalic(labelFormat.contains(FontFormat.ITALIC_LITERAL)); } if (fontStyle.isUnderline() != labelFormat.contains(FontFormat.UNDERLINE_LITERAL)) { fontStyle.setUnderline(labelFormat.contains(FontFormat.UNDERLINE_LITERAL)); } if (fontStyle.isStrikeThrough() != labelFormat.contains(FontFormat.STRIKE_THROUGH_LITERAL)) { fontStyle.setStrikeThrough(labelFormat.contains(FontFormat.STRIKE_THROUGH_LITERAL)); } fontStyle.setFontHeight(basicLabelStyle.getLabelSize()); if (fontStyle.getFontName() == null) { fontStyle.setFontName(DEFAULT_FONT_STYLE); } RGBValues labelColor = basicLabelStyle.getLabelColor(); if (labelColor != null) { fontStyle.setFontColor(FigureUtilities.RGBToInteger(new RGB(labelColor.getRed(), labelColor.getGreen(), labelColor.getBlue()))); } }
Source:
<code>private Iterator<HiveFileInfo> getLocatedFileStatusRemoteIterator(Path path, PathFilter pathFilter) { try (TimeStat.BlockTimer ignored = namenodeStats.getListLocatedStatus().time()) { <START> return new FileStatusIterator(path, listDirectoryOperation, namenodeStats, pathFilter); <END> } }</code><technical_language>nit: consider com.google.common.collect.Iterators#filter instead</technical_language>

Target:
private Iterator<HiveFileInfo> getLocatedFileStatusRemoteIterator(Path path, PathFilter pathFilter) { try (TimeStat.BlockTimer ignored = namenodeStats.getListLocatedStatus().time()) { return Iterators.filter(new FileStatusIterator(path, listDirectoryOperation, namenodeStats), input -> pathFilter.accept(input.getPath())); } }
Source:
<code>public Iterable<String> precompiledHeaderArgs(Path pchOutputPath) { String hFilename = pchOutputPath.getFileName().toString(); <START> String pchFilename = hFilename.substring(0, hFilename.length() - 4) + ".pch"; <END> return ImmutableList.of("/Yu", pchFilename); }</code><technical_language>strip file extension here? <LINK_0></technical_language>

Target:
public Iterable<String> precompiledHeaderArgs(Path pchOutputPath) { String hFilename = pchOutputPath.getFileName().toString(); String pchFilename = Files.getNameWithoutExtension(hFilename) + ".pch"; return ImmutableList.of("/Yu", pchFilename); }
Source:
<code>private String tokenPayload(CardAuthorisationGatewayRequest request) { List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("card[cvc]", request.getAuthCardDetails().getCvc())); params.add(new BasicNameValuePair("card[exp_month]", request.getAuthCardDetails().expiryMonth())); params.add(new BasicNameValuePair("card[exp_year]", request.getAuthCardDetails().expiryYear())); params.add(new BasicNameValuePair("card[number]", request.getAuthCardDetails().getCardNo())); params.add(new BasicNameValuePair("card[name]", request.getAuthCardDetails().getCardHolder())); if (request.getAuthCardDetails().getAddress().isPresent()) { Address address = request.getAuthCardDetails().getAddress().get(); params.add(new BasicNameValuePair("card[address_line1]", address.getLine1())); params.add(new BasicNameValuePair("card[address_line2]", address.getLine2())); params.add(new BasicNameValuePair("card[address_city]", address.getCity())); params.add(new BasicNameValuePair("card[address_country]", address.getCountry())); params.add(new BasicNameValuePair("card[address_zip]", address.getPostcode())); <START> } <END> return URLEncodedUtils.format(params, UTF_8); }</code><technical_language>ifPresent( ) instead of isPresent() avoid get(): request.getAuthCardDetails().getAddress().ifPresent(address -> { params.add(new BasicNameValuePair("card[address_line1]", address.getLine1())); // });</technical_language>

Target:
private String tokenPayload(CardAuthorisationGatewayRequest request) { List<BasicNameValuePair> params = new ArrayList<>(); params.add(new BasicNameValuePair("card[cvc]", request.getAuthCardDetails().getCvc())); params.add(new BasicNameValuePair("card[exp_month]", request.getAuthCardDetails().expiryMonth())); params.add(new BasicNameValuePair("card[exp_year]", request.getAuthCardDetails().expiryYear())); params.add(new BasicNameValuePair("card[number]", request.getAuthCardDetails().getCardNo())); params.add(new BasicNameValuePair("card[name]", request.getAuthCardDetails().getCardHolder())); request.getAuthCardDetails().getAddress().ifPresent(address -> { params.add(new BasicNameValuePair("card[address_line1]", address.getLine1())); if (StringUtils.isNotBlank(address.getLine2())) { params.add(new BasicNameValuePair("card[address_line2]", address.getLine2())); } params.add(new BasicNameValuePair("card[address_city]", address.getCity())); params.add(new BasicNameValuePair("card[address_country]", address.getCountry())); params.add(new BasicNameValuePair("card[address_zip]", address.getPostcode())); }); return URLEncodedUtils.format(params, UTF_8); }
Source:
<code>protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags, GlobalConfigurationBuilder gcb, ConfigurationBuilder builder) { GlobalConfigurationBuilder clone = GlobalConfigurationBuilder.defaultClusteredBuilder(); Transport transport = clone.transport().getTransport(); GlobalConfiguration original = gcb.build(); clone.read(original); clone.transport().transport(transport); <START> clone.serialization().addContextInitializer(TestDataSCI.INSTANCE); <END> clone.transport().clusterName("ISPN(SITE " + siteName + ")"); if (original.globalJmxStatistics().enabled()) { clone.globalJmxStatistics().jmxDomain(original.globalJmxStatistics().domain() + cacheManagers.size()); } EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(clone, builder, flags); cacheManagers.add(cm); return cm; }</code><technical_language>I remember I removed this line: belong here, configuring SCI part of test setup, this method clones existing configuration replaces some instances safe reuse. A solution IMO put needed, in this case in BaseSiteUnreachableTest.createSites()</technical_language>

Target:
protected EmbeddedCacheManager addClusterEnabledCacheManager(TransportFlags flags, GlobalConfigurationBuilder gcb, ConfigurationBuilder builder) { GlobalConfigurationBuilder clone = GlobalConfigurationBuilder.defaultClusteredBuilder(); Transport transport = clone.transport().getTransport(); GlobalConfiguration original = gcb.build(); clone.read(original); clone.transport().transport(transport); clone.transport().clusterName("ISPN(SITE " + siteName + ")"); if (original.globalJmxStatistics().enabled()) { clone.globalJmxStatistics().jmxDomain(original.globalJmxStatistics().domain() + cacheManagers.size()); } EmbeddedCacheManager cm = TestCacheManagerFactory.createClusteredCacheManager(clone, builder, flags); cacheManagers.add(cm); return cm; }
Source:
<code>public void write(ByteBuf src) throws IOException { int copied = 0; boolean shouldForceWrite = false; synchronized (this) { int len = src.readableBytes(); while (copied < len) { int bytesToCopy = Math.min(src.readableBytes() - copied, writeBuffer.writableBytes()); writeBuffer.writeBytes(src, src.readerIndex() + copied, bytesToCopy); copied += bytesToCopy; if (!writeBuffer.isWritable()) { flushInternal(); } } position.addAndGet(copied); <START> unpersistedBytes.addAndGet(copied); <END> if (unpersistedBytesBound > 0) { if (unpersistedBytes.get() >= unpersistedBytesBound) { flushInternal(); shouldForceWrite = true; } } } if (shouldForceWrite) { forceWrite(false); } }</code><technical_language>do need AtomicInteger if this is incremented withing a synchronized block</technical_language>

Target:
public void write(ByteBuf src) throws IOException { int copied = 0; boolean shouldForceWrite = false; synchronized (this) { int len = src.readableBytes(); while (copied < len) { int bytesToCopy = Math.min(src.readableBytes() - copied, writeBuffer.writableBytes()); writeBuffer.writeBytes(src, src.readerIndex() + copied, bytesToCopy); copied += bytesToCopy; if (!writeBuffer.isWritable()) { flush(); } } position.addAndGet(copied); unpersistedBytes.addAndGet(copied); if (unpersistedBytesBound > 0) { if (unpersistedBytes.get() >= unpersistedBytesBound) { flush(); shouldForceWrite = true; } } } if (shouldForceWrite) { forceWrite(false); } }
Source:
<code>public String getWorkflowConfigurationFileContents(String workflowId) throws Exception { File configDir = new File(WORKFLOW_CONFIGURATION_PATH); File defaultsDir = new File(DEFAULTS_CONFIGURATION_PATH); <START> WorkflowConfigurationParser parser = new WorkflowConfigurationParser(defaultsDir).parseConfiguration(configDir); <END> String filePath = parser.getWorkflowConfiguration().getWorkflowJSFileName(new WorkflowID(workflowId)); if (filePath == null) { return null; } try { return FileUtils.readFileToString(new File(filePath)); } catch (IOException e) { LOGGER.error("Failed to load JS config file: " + filePath + ": " + e.getMessage(), e); throw e; } }</code><technical_language>Please create a utility method getWorkflowConfigurationParser contains 3 lines ^, in makeDefaultScheduler</technical_language>

Target:
public String getWorkflowConfigurationFileContents(String workflowId) throws Exception { WorkflowConfigurationParser parser = getWorkflowConfigurationParser(); String filePath = parser.getWorkflowConfiguration().getWorkflowJSFileName(new WorkflowID(workflowId)); if (filePath == null) { return null; } return FileUtils.readFileToString(new File(filePath)); }
Source:
<code>public CompletableFuture<Void> deleteAsync(K key) { <START> delete(key); <END> return CompletableFuture.completedFuture(null); }</code><technical_language>delete() executed future right away</technical_language>

Target:
public CompletableFuture<Void> deleteAsync(K key) { CompletableFuture<Void> future = new CompletableFuture(); try { delete(key); future.complete(null); } catch (Exception e) { future.completeExceptionally(e); } return future; }
Source:
<code>public void testPostNullMessage() throws Exception { WebResource resource = client().resource("/api/metrics/store"); WebResource.Builder builder = resource.type(MediaType.APPLICATION_JSON_TYPE); boolean badStatus = false; try { builder.post(Control.class, null); } catch (UniformInterfaceException e) { badStatus = true; assertEquals("Unexpected status", 400, e.getResponse().getClientResponseStatus().getStatusCode()); } <START> if (!badStatus){ <END> fail("expected 400 status"); } }</code><technical_language>If expecting exception invoke fail() call builder.post() line 47</technical_language>

Target:
public void testPostNullMessage() throws Exception { WebResource resource = client().resource("/api/metrics/store"); WebResource.Builder builder = resource.type(MediaType.APPLICATION_JSON_TYPE); try { builder.post(Control.class, null); fail("expected 400 status"); } catch (UniformInterfaceException e) { assertEquals("Unexpected status", 400, e.getResponse().getClientResponseStatus().getStatusCode()); } }