auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public List<SelectItem> getBatchOptions() { List<SelectItem> result = new ArrayList<SelectItem>(); if (granularity == null) { result.add(new SelectItem("null", Helper.getTranslation("granularity.batches.noData"))); } else if (granularity == Granularity.YEARS) { result.add(new SelectItem("null", Helper.getTranslation("granularity.batches.notAvailable"))); } else { result.add(new SelectItem("null", Helper.getTranslation("granularity.null"))); switch (granularity) { case ISSUES: result.add(new SelectItem("issues", Helper.getTranslation("granularity.issues"))); case DAYS: result.add(new SelectItem("weeks", Helper.getTranslation("granularity.weeks"))); case WEEKS: result.add(new SelectItem("months", Helper.getTranslation("granularity.months"))); case MONTHS: result.add(new SelectItem("quarters", Helper.getTranslation("granularity.quarters"))); case QUARTERS: result.add(new SelectItem("years", Helper.getTranslation("granularity.years"))); break; <START> default: <END> break; } } return result; }</code><technical_language>expect this case, do we? adding assertion good here</technical_language>

Target:
public List<SelectItem> getBatchOptions() { List<SelectItem> result = new ArrayList<SelectItem>(); if (granularity == null) { result.add(new SelectItem("null", Helper.getTranslation("granularity.batches.noData"))); } else if (granularity == Granularity.YEARS) { result.add(new SelectItem("null", Helper.getTranslation("granularity.batches.notAvailable"))); } else { result.add(new SelectItem("null", Helper.getTranslation("granularity.null"))); switch (granularity) { case ISSUES: result.add(new SelectItem("issues", Helper.getTranslation("granularity.issues"))); case DAYS: result.add(new SelectItem("weeks", Helper.getTranslation("granularity.weeks"))); case WEEKS: result.add(new SelectItem("months", Helper.getTranslation("granularity.months"))); case MONTHS: result.add(new SelectItem("quarters", Helper.getTranslation("granularity.quarters"))); case QUARTERS: result.add(new SelectItem("years", Helper.getTranslation("granularity.years"))); break; default: assert false : granularity; } } return result; }
Source:
<code>public static void endTaskStep(Guid stepId, JobExecutionStatus exitStatus) { try { if (stepId != null) { Step step = JobRepositoryFactory.getJobRepository().getStep(stepId); if (step != null) { step.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(step); } } } catch (Exception e) { <START> log.error("Failed to terminate step '{}' with status '{}'", stepId, exitStatus); <END> log.error("Exception", e); } }</code><technical_language>put e.getMessage() reduce level of stack dumps easily</technical_language>

Target:
public static void endTaskStep(Guid stepId, JobExecutionStatus exitStatus) { try { if (stepId != null) { Step step = JobRepositoryFactory.getJobRepository().getStep(stepId); if (step != null) { step.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(step); } } } catch (Exception e) { log.error("Failed to terminate step '{}' with status '{}': {}", stepId, exitStatus, e.getMessage()); log.debug("Exception", e); } }
Source:
<code>public static Throwable getRootCause(final Throwable throwable) { <START> <END> Throwable slowPointer = throwable; boolean advanceSlowPointer = false; Throwable parent = throwable; Throwable cause; while ((cause = parent.getCause()) != null) { parent = cause; if (parent == slowPointer) { throw new IllegalArgumentException("loop in causal chain"); } if (advanceSlowPointer) { slowPointer = slowPointer.getCause(); } advanceSlowPointer = !advanceSlowPointer; } return throwable; }</code><technical_language>a broken test related this change</technical_language>

Target:
public static Throwable getRootCause(final Throwable throwable) { Throwable slowPointer = throwable; boolean advanceSlowPointer = false; Throwable parent = throwable; Throwable cause; while ((cause = parent.getCause()) != null) { parent = cause; if (parent == slowPointer) { throw new IllegalArgumentException("loop in causal chain"); } if (advanceSlowPointer) { slowPointer = slowPointer.getCause(); } advanceSlowPointer = !advanceSlowPointer; } return parent; }
Source:
<code>private <A extends Annotation> void initializeValidator( ConstraintDescriptor<A> descriptor, ConstraintValidator<A, ?> constraintValidator, HibernateConstraintValidatorInitializationContext initializationContext) { try { if ( constraintValidator instanceof HibernateConstraintValidator ) { ( (HibernateConstraintValidator) constraintValidator ).initialize( descriptor, initializationContext ); } else { constraintValidator.initialize( descriptor.getAnnotation() ); } } catch (RuntimeException e) { if ( e instanceof ConstraintDeclarationException ) { <START> throw e; <END> } throw LOG.getUnableToInitializeConstraintValidatorException( constraintValidator.getClass(), e ); } }</code><technical_language>@marko-bekhta I noticed this change. do this patch</technical_language>

Target:
private <A extends Annotation> void initializeValidator( ConstraintDescriptor<A> descriptor, ConstraintValidator<A, ?> constraintValidator, HibernateConstraintValidatorInitializationContext initializationContext) { try { if ( constraintValidator instanceof HibernateConstraintValidator ) { ( (HibernateConstraintValidator<A, ?>) constraintValidator ).initialize( descriptor, initializationContext ); } else { constraintValidator.initialize( descriptor.getAnnotation() ); } } catch (RuntimeException e) { if ( e instanceof ConstraintDeclarationException ) { throw e; } throw LOG.getUnableToInitializeConstraintValidatorException( constraintValidator.getClass(), e ); } }
Source:
<code>public <OutType> Yielder<OutType> toYielder( OutType initValue, YieldingAccumulator<OutType, T> accumulator ) { final Yielder<OutType> baseYielder; try { baseYielder = baseSequence.toYielder(initValue, accumulator); <START> } <END> catch (RuntimeException e) { try { Closeables.close(closeable, true); } catch (IOException ioe) { throw Throwables.propagate(ioe); } throw e; } return new ResourceClosingYielder<OutType>(baseYielder, closeable); }</code><technical_language>CloseQuietly</technical_language>

Target:
public <OutType> Yielder<OutType> toYielder( OutType initValue, YieldingAccumulator<OutType, T> accumulator ) { final Yielder<OutType> baseYielder; try { baseYielder = baseSequence.toYielder(initValue, accumulator); } catch (RuntimeException e) { CloseQuietly.close(closeable); throw e; } return new ResourceClosingYielder<OutType>(baseYielder, closeable); }
Source:
<code>@Override public <T> T get(Object key, Callable<T> valueLoader) { Object val = cache.get(key); if (val == null) { try { val = valueLoader.call(); } catch (Exception ignored) { <START> return null; <END> } put(key, val); } return (T)val; }</code><technical_language>throw some exception</technical_language>

Target:
@Override public <T> T get(Object key, Callable<T> valueLoader) { try { return cache.invoke(key, new ValueLoaderEntryProcessor<T>(), valueLoader); } catch (Exception e) { throw new ValueRetrievalException(key, valueLoader, e); } }
Source:
<code>private void printDebugMessage( String message ) { if(GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) { if(!message.endsWith("\n")) { message = message + "\n"; <START> } <END> GdbDebugOptions.trace(String.format( "%s %s %s", GdbPlugin.getDebugTime(), TIMEOUT_TRACE_IDENTIFIER, message)); } }</code><technical_language>If wants \n, this code swallow one. Please remove add a \n in String.format line below, replaces a println()</technical_language>

Target:
private void printDebugMessage( String message ) { if(GdbDebugOptions.DEBUG_COMMAND_TIMEOUTS) { GdbDebugOptions.trace(String.format( "%s %s %s\n", GdbPlugin.getDebugTime(), TIMEOUT_TRACE_IDENTIFIER, message)); } }
Source:
<code>public void testActionJoinIfPossibleAndNoTx() throws Exception { MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_JOIN_IF_POSSIBLE); ExecutionTemplate executionTemplate = createExecutionTemplate(config); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); <START> assertThat(TransactionCoordination.getInstance().getTransaction(), IsNull.nullValue()); <END> }</code><technical_language>static import</technical_language>

Target:
public void testActionJoinIfPossibleAndNoTx() throws Exception { MuleTransactionConfig config = new MuleTransactionConfig(ACTION_JOIN_IF_POSSIBLE); ExecutionTemplate executionTemplate = createExecutionTemplate(config); Object result = executionTemplate.execute(getEmptyTransactionCallback()); assertThat(result, is(RETURN_VALUE)); assertThat(getInstance().getTransaction(), nullValue()); }
Source:
<code>public void testSeekToReadaheadAndRead() throws Throwable { <START> describe("Seek to readahead limit and call InputStream.read(byte[])"); <END> Path path = path("testSeekToReadaheadAndRead"); FileSystem fs = getFileSystem(); writeTestDataset(path); try (FSDataInputStream in = fs.open(path)) { readAtEndAndReturn(in); final byte[] temp = new byte[5]; int offset = READAHEAD - 1; in.seek(offset); int l = in.read(temp); assertTrue("Reading in temp data", l > 0); LOG.info("Read of byte array at offset returned bytes", offset, l); assertDatasetEquals(offset, "read at end of boundary", temp, l); } }</code><technical_language>Seek readahead limit..</technical_language>

Target:
public void testSeekToReadaheadAndRead() throws Throwable { describe("Seek to just before readahead limit and call" + " InputStream.read(byte[])"); Path path = path("testSeekToReadaheadAndRead"); FileSystem fs = getFileSystem(); writeTestDataset(path); try (FSDataInputStream in = fs.open(path)) { readAtEndAndReturn(in); final byte[] temp = new byte[5]; int offset = READAHEAD - 1; in.seek(offset); int l = in.read(temp); assertTrue("Reading in temp data", l > 0); LOG.info("Read of byte array at offset returned bytes", offset, l); assertDatasetEquals(offset, "read at end of boundary", temp, l); } }
Source:
<code>private void setRuleset(List<Process> processes) { if (isActionParameterInvalid("ruleset")) { return; } try { List<Ruleset> rulesets = serviceManager.getRulesetService() .getByQuery("from Ruleset where title='" + this.parameters.get("ruleset") + "'"); if (rulesets == null || rulesets.size() == 0) { Helper.setFehlerMeldung(KITODO_SCRIPT_FIELD, "Could not find ruleset: ", "ruleset"); return; } Ruleset ruleset = rulesets.get(0); for (Process process : processes) { process.setRuleset(ruleset); serviceManager.getProcessService().save(process); } } catch (Exception e) { Helper.setFehlerMeldung(e); <START> logger.error(e.getMessage(), e); <END> } }</code><technical_language>setErrorMessage</technical_language>

Target:
private void setRuleset(List<Process> processes) { if (isActionParameterInvalid("ruleset")) { return; } try { List<Ruleset> rulesets = serviceManager.getRulesetService() .getByQuery("from Ruleset where title='" + this.parameters.get("ruleset") + "'"); if (rulesets == null || rulesets.size() == 0) { Helper.setFehlerMeldung(KITODO_SCRIPT_FIELD, "Could not find ruleset: ", "ruleset"); return; } Ruleset ruleset = rulesets.get(0); for (Process process : processes) { process.setRuleset(ruleset); serviceManager.getProcessService().save(process); } } catch (DataException | RuntimeException e) { Helper.setFehlerMeldung(e); logger.error(e.getMessage(), e); } }
Source:
<code><START> public void testLoadPrivateKeyFromKeyStore() throws Exception { <END> Optional<String> optPassword = x509TestContext.getKeyStorePassword().length() > 0 ? Optional.of(x509TestContext.getKeyStorePassword()) : Optional.empty(); PrivateKey privateKey = PemReader.loadPrivateKey( x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM), optPassword); Assert.assertEquals(x509TestContext.getKeyStoreKeyPair().getPrivate(), privateKey); }</code><technical_language>change exception type here</technical_language>

Target:
public void testLoadPrivateKeyFromKeyStore() throws IOException, GeneralSecurityException { Optional<String> optPassword = x509TestContext.getKeyStorePassword().length() > 0 ? Optional.of(x509TestContext.getKeyStorePassword()) : Optional.empty(); PrivateKey privateKey = PemReader.loadPrivateKey(x509TestContext.getKeyStoreFile(KeyStoreFileType.PEM), optPassword); assertEquals(x509TestContext.getKeyStoreKeyPair().getPrivate(), privateKey); }
Source:
<code>public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) { fileTypeConsumer.consume(ElixirFileType.INSTANCE, "ex"); <START> fileTypeConsumer.consume(ElixirFileType.SCRIPT, "exs"); <END> }</code><technical_language>[x] I copying I did, I copying tutorial, good. call ElixirFileType.INSTANCE.getDefaultExtension ElixirFileType.SCRIPT.getDefaultExtension, leading java public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) { fileTypeConsumer.consume(ElixirFileType.INSTANCE, ElixirFileType.INSTANCE.getDefaultExtension()); fileTypeConsumer.consume(ElixirFileType.SCRIPT, ElixirFileType.SCRIPT.getDefaultExtension()); }</technical_language>

Target:
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) { fileTypeConsumer.consume(ElixirFileType.INSTANCE, ElixirFileType.INSTANCE.getDefaultExtension()); fileTypeConsumer.consume(ElixirFileType.SCRIPT, ElixirFileType.SCRIPT.getDefaultExtension()); }
Source:
<code>public <PT> void addProperty (ConfigurationProperty<PT> property, List<String> path) { _properties.add(property); <START> _pathsByPropertyUUID.put( property.getUUID(), path ); <END> }</code><technical_language>a giant pain instead change this to: _pathsByProperty.put(property, path) put UUID checks property.hashCode property.equals function? I a more places, multiple property types, I this code a lot cleaner implementation-dependent - i.e., properties needs a UUID</technical_language>

Target:
public <PT> void addProperty (ConfigurationProperty<PT> property, List<String> path) { _properties.add(property); _pathsByProperty.put( property, path ); }
Source:
<code>protected VmPool deprecatedPopulate(VmPool model, org.ovirt.engine.core.common.businessentities.VmPool entity) { if (model.isSetSize() && model.getSize() > 0) { VM vm = getVM(model); model.setTemplate(new Template()); model.getTemplate().setId(vm.getVmtGuid().toString()); model = getMapper(VM.class, VmPool.class).map(vm, model); DisplayHelper.adjustDisplayData(this, model.getVm()); if (vm.getInstanceTypeId() != null) { model.setInstanceType(new <START> org.ovirt.engine.api.model.InstanceType()); <END> model.getInstanceType().setId(vm.getInstanceTypeId().toString()); } } return model; }</code><technical_language>If import model type fully qualified name of backend type</technical_language>

Target:
protected VmPool deprecatedPopulate(VmPool model, org.ovirt.engine.core.common.businessentities.VmPool entity) { if (model.isSetSize() && model.getSize() > 0) { VM vm = getVM(model); model.setTemplate(new Template()); model.getTemplate().setId(vm.getVmtGuid().toString()); model = getMapper(VM.class, VmPool.class).map(vm, model); DisplayHelper.adjustDisplayData(this, model.getVm()); if (vm.getInstanceTypeId() != null) { model.setInstanceType(new InstanceType()); model.getInstanceType().setId(vm.getInstanceTypeId().toString()); } } return model; }
Source:
<code>public void call(final Subscriber<? super T> subscriber) { try { final Resource resource = resourceFactory.call(); final DisposeAction<Resource> disposeOnceOnly = new DisposeAction<Resource>(dispose, resource); subscriber.add(disposeOnceOnly); final Observable<? extends T> source = observableFactory .call(resource); final Observable<? extends T> observable; if (disposeEagerly) observable = source .doOnTerminate(disposeOnceOnly); else observable = source; try { <START> observable.unsafeSubscribe(Subscribers.from(subscriber)); <END> } catch (Throwable e) { Throwable disposeError = disposeEagerlyIfRequested(disposeOnceOnly); if (disposeError != null) subscriber.onError(new CompositeException(Arrays.asList(e, disposeError))); else subscriber.onError(e); } } catch (Throwable e) { subscriber.onError(e); } }</code><technical_language>This calls wrap</technical_language>

Target:
public void call(final Subscriber<? super T> subscriber) { try { final Resource resource = resourceFactory.call(); final DisposeAction<Resource> disposeOnceOnly = new DisposeAction<Resource>(dispose, resource); subscriber.add(disposeOnceOnly); final Observable<? extends T> source = observableFactory .call(resource); final Observable<? extends T> observable; if (disposeEagerly) observable = source .doOnTerminate(disposeOnceOnly); else observable = source; try { observable.unsafeSubscribe(Subscribers.wrap(subscriber)); } catch (Throwable e) { Throwable disposeError = disposeEagerlyIfRequested(disposeOnceOnly); if (disposeError != null) subscriber.onError(new CompositeException(Arrays.asList(e, disposeError))); else subscriber.onError(e); } } catch (Throwable e) { subscriber.onError(e); } }
Source:
<code>public void onResume() { super.onResume(); <START> if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { <END> editTextNewComment.post(new Runnable() { @Override public void run() { editTextNewComment.clearFocus(); } }); } }</code><technical_language>This immediately obvious me. clearing field landscape mode? orientation changes</technical_language>

Target:
public void onResume() { super.onResume(); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { SoftKeyboardUtil.clearViewFocus(editTextNewComment); } }
Source:
<code>public static void main(String[] args) <START> throws Exception { <END> final Display display = new Display(); Shell shell = new Shell(display); shell.setSize(400, 600); shell.setLayout(new FillLayout()); shell.setText("ExpandBar Bug"); expandBar(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }</code><technical_language>This a compiler warning, please suppress remove exception throw entirely. Warnings in snippets noise build process submit patches introduce them</technical_language>

Target:
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setSize(400, 600); shell.setLayout(new FillLayout()); shell.setText("ExpandBar Bug"); expandBar(shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Source:
<code>private void onChunkOperationComplete(GetChunk chunk) { if (chunk.getChunkException() != null) { setOperationException(chunk.getChunkException()); } if (chunk == firstChunk) { if (operationCallbackInvoked.compareAndSet(false, true)) { long timeElapsed = time.milliseconds() - submissionTimeMs; routerMetrics.getBlobOperationLatencyMs.update(timeElapsed); if (hasRange) { <START> routerMetrics.getBlobWithRangeOperationLatencyMs.update(timeElapsed); <END> } Exception e = getOperationException(); getBlobResult = e == null ? new GetBlobResult() : null; if (e != null) { routerMetrics.onGetBlobError(e, options); } operationCompleteCallback.completeOperation(operationFuture, operationCallback, getBlobResult, e); } } chunk.postCompletionCleanup(); if (getBlobResult != null) { getBlobResult.maybeWriteToChannel(); } }</code><technical_language>is this useful</technical_language>

Target:
private void onChunkOperationComplete(GetChunk chunk) { if (chunk.getChunkException() != null) { setOperationException(chunk.getChunkException()); } if (chunk == firstChunk) { if (operationCallbackInvoked.compareAndSet(false, true)) { long timeElapsed = time.milliseconds() - submissionTimeMs; routerMetrics.getBlobOperationLatencyMs.update(timeElapsed); Exception e = getOperationException(); getBlobResult = e == null ? new GetBlobResult() : null; if (e != null) { routerMetrics.onGetBlobError(e, options); } operationCompleteCallback.completeOperation(operationFuture, operationCallback, getBlobResult, e); } } chunk.postCompletionCleanup(); if (getBlobResult != null) { getBlobResult.maybeWriteToChannel(); } }
Source:
<code><START> public BuiltInFunctionSymbolicValue(Constraint returnedValueConstraint, IntFunction<Constraint> signature) { <END> this.returnedValueConstraint = returnedValueConstraint; this.signature = signature; this.argumentsConstrainer = null; }</code><technical_language>@vilchik-elena this constructor call one</technical_language>

Target:
public BuiltInFunctionSymbolicValue(Constraint returnedValueConstraint, IntFunction<Constraint> signature) { this(returnedValueConstraint, null, signature); }
Source:
<code>protected void doSetSelection(ISelection selection) { if (!selection.isEmpty() && selection instanceof StructuredSelection) { Object selected = ((StructuredSelection) selection) .getFirstElement(); if (selected instanceof FileDiffRegion) { FileDiffRegion newRange = (FileDiffRegion) selected; if (!newRange.equals(currentFileDiffRange)) { currentFileDiffRange = newRange; <START> selectAndReveal(newRange.getOffset(), 0); <END> } return; } } super.doSetSelection(selection); }</code><technical_language>Add if (outlinePage != null) { outlinePage.setSelection(new StructuredSelection(selected)); } normal outline page follow selection in quick outline</technical_language>

Target:
protected void doSetSelection(ISelection selection) { if (!selection.isEmpty() && selection instanceof StructuredSelection) { Object selected = ((StructuredSelection) selection) .getFirstElement(); if (selected instanceof FileDiffRegion) { FileDiffRegion newRange = (FileDiffRegion) selected; if (!newRange.equals(currentFileDiffRange)) { currentFileDiffRange = newRange; selectAndReveal(newRange.getOffset(), 0); if (outlinePage != null) { outlinePage.setSelection( new StructuredSelection(selected)); } } return; } } super.doSetSelection(selection); }
Source:
<code>public void remove(final String name) { try { <START> new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel( String.format( "/page/rules/rule[name='%s']/links/link[@rel='remove']/@href", name ) ) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public void remove(final String name) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel( String.format( "/page/rules/rule[name='%s']/links/link[@rel='remove']/@href", name ) ) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>protected void executeCommand() { String connectionId = getConnection().getid(); getStorageServerConnectionDao().remove(connectionId); <START> log.debugFormat("Removing connection %s from database ", connectionId); <END> if (Guid.isNullOrEmpty(getParameters().getVdsId())) { log.debug("No vdsId passed - hosts will not be disconnected."); } else { disconnectStorage(); } setSucceeded(true); }</code><technical_language>I {0}</technical_language>

Target:
protected void executeCommand() { String connectionId = getConnection().getid(); getStorageServerConnectionDao().remove(connectionId); log.debugFormat("Removing connection {0} from database ", connectionId); if (Guid.isNullOrEmpty(getParameters().getVdsId())) { log.debug("No vdsId passed - hosts will not be disconnected."); } else { disconnectStorage(); } setSucceeded(true); }
Source:
<code>public void _diff(diffOptions options) throws UnsupportedEncodingException, IOException, Exception { List<String> args = options._arguments(); String newer = args.remove(0); String older = args.size() > 0 ? args.remove(0) : null; RepositoryPlugin rnewer = findRepo(newer); RepositoryPlugin rolder = older == null ? null : findRepo(older); if (rnewer == null) { bnd.messages.NoSuchRepository_(newer); return; } if (older != null && rolder == null) { bnd.messages.NoSuchRepository_(newer); return; } PrintWriter pw = IO.writer(bnd.out, UTF_8); Tree tNewer = RepositoryElement.getTree(rnewer); if (rolder == null) { if (options.json()) codec.enc() .to(pw) .put(tNewer.serialize()) .flush(); else DiffCommand.show(pw, tNewer, 0); } else { Tree tOlder = RepositoryElement.getTree(rolder); Diff diff = new DiffImpl(tNewer, tOlder); MultiMap<String, String> map = new MultiMap<>(); for (Diff bsn : diff.getChildren()) { for (Diff version : bsn.getChildren()) { if (version.getDelta() == Delta.UNCHANGED) continue; if (options.remove() == false && options.added() == false || (options.remove() && version.getDelta() == Delta.REMOVED) || (options.added() && version.getDelta() == Delta.ADDED)) { map.add(bsn.getName(), version.getName()); } } } if (options.json()) codec.enc() .to(pw) .put(map) .flush(); else if (!options.diff()) <START> MultiMap.format(map); <END> else DiffCommand.show(pw, diff, 0, !options.full()); } pw.flush(); }</code><technical_language>This a String discards it. Is meant? I assume want print String here</technical_language>

Target:
public void _diff(diffOptions options) throws UnsupportedEncodingException, IOException, Exception { List<String> args = options._arguments(); String newer = args.remove(0); String older = args.size() > 0 ? args.remove(0) : null; RepositoryPlugin rnewer = findRepo(newer); RepositoryPlugin rolder = older == null ? null : findRepo(older); if (rnewer == null) { bnd.messages.NoSuchRepository_(newer); return; } if (older != null && rolder == null) { bnd.messages.NoSuchRepository_(newer); return; } PrintWriter pw = IO.writer(bnd.out, UTF_8); Tree tNewer = RepositoryElement.getTree(rnewer); if (rolder == null) { if (options.json()) codec.enc() .to(pw) .put(tNewer.serialize()) .flush(); else DiffCommand.show(pw, tNewer, 0); } else { Tree tOlder = RepositoryElement.getTree(rolder); Diff diff = new DiffImpl(tNewer, tOlder); MultiMap<String, String> map = new MultiMap<>(); for (Diff bsn : diff.getChildren()) { for (Diff version : bsn.getChildren()) { if (version.getDelta() == Delta.UNCHANGED) continue; if (options.remove() == false && options.added() == false || (options.remove() && version.getDelta() == Delta.REMOVED) || (options.added() && version.getDelta() == Delta.ADDED)) { map.add(bsn.getName(), version.getName()); } } } if (options.json()) codec.enc() .to(pw) .put(map) .flush(); else if (!options.diff()) bnd.out.println(MultiMap.format(map)); else DiffCommand.show(pw, diff, 0, !options.full()); } pw.flush(); }
Source:
<code>public String toStringShort() { return MoreObjects.toStringHelper("Channel") .add("ClientType", getStringFromOptional(mClientType)) <START> .add("ServerAddress", mServerAddress) <END> .add("ChannelId", mChannelId) .omitNullValues() .toString(); }</code><technical_language>is client hostname part of this</technical_language>

Target:
public String toStringShort() { return MoreObjects.toStringHelper("Channel") .add("ClientType", getStringFromOptional(mClientType)) .add("ClientHostname", mLocalHostName) .add("ServerAddress", mServerAddress) .add("ChannelId", mChannelId) .omitNullValues() .toString(); }
Source:
<code><START> public void reconfigure(Object... updatedPolicyParameters) { <END> this.timer.cancel(); setCheckNodeStateEach(updatedPolicyParameters); this.scheduleRestartTimer(); }</code><technical_language>if is empty for now, call super.reconfigure</technical_language>

Target:
public void reconfigure(Object... updatedPolicyParameters) { super.reconfigure(updatedPolicyParameters); this.timer.cancel(); setCheckNodeStateEach(updatedPolicyParameters); this.scheduleRestartTimer(); }
Source:
<code>public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(idMono).verifyComplete(); Mono<LongIdDomainPartition> saveMono = this.repository.save(DOMAIN_1); <START> StepVerifier.create(saveMono).thenConsumeWhile(domain -> true).expectComplete().verify(); <END> Mono<LongIdDomainPartition> findIdMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(findIdMono).expectNext(DOMAIN_1).expectComplete().verify(); Mono<Void> deleteMono = this.repository.delete(DOMAIN_1); StepVerifier.create(deleteMono).verifyComplete(); Mono<LongIdDomainPartition> afterDelIdMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(afterDelIdMono).verifyComplete(); }</code><technical_language>Here, test response is saved DOMAIN_1 this -> suggestion StepVerifier.create(findIdMono).expectNext(DOMAIN_1).expectComplete().verify();</technical_language>

Target:
public void testLongIdDomainPartition() { Mono<Void> deletedMono = this.repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<LongIdDomainPartition> idMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(idMono).expectNextCount(0).verifyComplete(); Mono<LongIdDomainPartition> saveMono = this.repository.save(DOMAIN_1); StepVerifier.create(saveMono).expectNext(DOMAIN_1).expectComplete().verify(); Mono<LongIdDomainPartition> findIdMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(findIdMono).expectNext(DOMAIN_1).expectComplete().verify(); Mono<Void> deleteMono = this.repository.delete(DOMAIN_1); StepVerifier.create(deleteMono).verifyComplete(); Mono<LongIdDomainPartition> afterDelIdMono = this.repository.findById(ID_1, new PartitionKey(entityInformation.getPartitionKeyFieldValue(DOMAIN_1))); StepVerifier.create(afterDelIdMono).expectNextCount(0).verifyComplete(); }
Source:
<code>public ResponseEntity<?> getTicketTokensOpenForTransfer(Authentication auth) { UserDetails currentUser = (UserDetails) auth.getPrincipal(); Collection<TicketTransferToken> tokens = ticketService.getTicketTransferTokensByUser(currentUser.getUsername()); <START> return createResponseEntity(HttpStatus.OK, "Ticket transfer tokens successfully retrieved", tokens); <END> }</code><technical_language>a '.' end of a sentence</technical_language>

Target:
public ResponseEntity<?> getTicketTokensOpenForTransfer(Authentication auth) { UserDetails currentUser = (UserDetails) auth.getPrincipal(); Collection<TicketTransferToken> tokens = ticketService.getValidTicketTransferTokensByUser(currentUser.getUsername()); return createResponseEntity(HttpStatus.OK, "Ticket transfer tokens successfully retrieved.", tokens); }
Source:
<code>String getConstraintType() { final ConstraintType constraintType = presenter.getConstraintType(); <START> if (constraintType == null) { <END> return presenter.inferComponentType(presenter.getConstraintValue()).value(); } else { return constraintType.toString(); } }</code><technical_language>This benefit (proposed) ConstraintType.EMPTY enumeration item</technical_language>

Target:
private String getConstraintType() { if (presenter.getConstraintType() == null) { return presenter.inferComponentType(presenter.getConstraintValue()).value(); } else { return presenter.getConstraintType().toString(); } }
Source:
<code>private void writeVideo(VmDevice device) { writer.writeStartElement("video"); writer.writeStartElement("model"); writer.writeAttributeString("type", device.getDevice()); if (device.getSpecParams() != null) { Object vram = device.getSpecParams().get(VdsProperties.VIDEO_VRAM); writer.writeAttributeString("vram", vram != null ? vram.toString() : "32768"); Object heads = device.getSpecParams().get(VdsProperties.VIDEO_HEADS); writer.writeAttributeString("heads", heads != null ? heads.toString() : "1"); if (device.getSpecParams().containsKey(VdsProperties.VIDEO_RAM)) { writer.writeAttributeString("ram", device.getSpecParams().get(VdsProperties.VIDEO_RAM).toString()); } if (device.getSpecParams().containsKey(VdsProperties.VIDEO_VGAMEM)) { writer.writeAttributeString("vgamem", device.getSpecParams().get(VdsProperties.VIDEO_VGAMEM).toString()); <START> } <END> } writer.writeEndElement(); writeAddress(device); writer.writeEndElement(); }</code><technical_language>yeah.. happen in other methods writeRng device is set specParams=null specParams=emptyMap(). generalize this in line 765 in writeDevices method iterate devices replace specParams null empty map instead. do think</technical_language>

Target:
private void writeVideo(VmDevice device) { writer.writeStartElement("video"); writer.writeStartElement("model"); writer.writeAttributeString("type", device.getDevice()); Object vram = device.getSpecParams().get(VdsProperties.VIDEO_VRAM); writer.writeAttributeString("vram", vram != null ? vram.toString() : "32768"); Object heads = device.getSpecParams().get(VdsProperties.VIDEO_HEADS); writer.writeAttributeString("heads", heads != null ? heads.toString() : "1"); if (device.getSpecParams().containsKey(VdsProperties.VIDEO_RAM)) { writer.writeAttributeString("ram", device.getSpecParams().get(VdsProperties.VIDEO_RAM).toString()); } if (device.getSpecParams().containsKey(VdsProperties.VIDEO_VGAMEM)) { writer.writeAttributeString("vgamem", device.getSpecParams().get(VdsProperties.VIDEO_VGAMEM).toString()); } writer.writeEndElement(); writeAddress(device); writer.writeEndElement(); }
Source:
<code>private static void writeValueToFile(String value, String filename) throws IOException { if (TextUtils.isEmpty(value)) { return; } BufferedWriter writer = null; try { String path = Constants.FILES_PATH + "/" + filename; if (!TextUtils.isEmpty(value) && TextUtils.getTrimmedLength(value) > 0) { writer = new BufferedWriter(new FileWriter(path)); writer.write(value); writer.flush(); } } catch (IOException e) { <START> e.printStackTrace(); <END> } finally { if (writer != null) { writer.close(); } } }</code><technical_language>HockeyLog</technical_language>

Target:
private static void writeValueToFile(String value, String filename) throws IOException { if (TextUtils.isEmpty(value)) { return; } BufferedWriter writer = null; try { String path = Constants.FILES_PATH + "/" + filename; if (!TextUtils.isEmpty(value) && TextUtils.getTrimmedLength(value) > 0) { writer = new BufferedWriter(new FileWriter(path)); writer.write(value); writer.flush(); } } catch (IOException e) { HockeyLog.error("Failed to write value to " + filename, e); } finally { if (writer != null) { writer.close(); } } }
Source:
<code>private void logLicensingInfo() { String type = getLicenseType(); SimpleDateFormat formatter = new SimpleDateFormat(); hostLog.info("LICENSE INFORMATION: " + type + " license issued by VoltDB to " + m_licenseApi.licensee() + " on " + formatter.format(m_licenseApi.issued())); hostLog.info("LICENSE KEY: " + m_licenseApi.signature()); hostLog.info("LICENSE EXPIRES: " + formatter.format(m_licenseApi.expires())); hostLog.info("LICENSE CONSTRAINTS: " + m_licenseApi.maxHostcount() + " nodes"); <START> hostLog.info("LICENCE FEATURES: " + "commandLoggingEnabled=" + m_licenseApi.isCommandLoggingAllowed() <END> + ", activeActiveDREnabled=" + m_licenseApi.isDrActiveActiveAllowed() + ", isDatabaseReplicationAllowed=" + m_licenseApi.isDrReplicationAllowed()); }</code><technical_language>Typo: LICENSE</technical_language>

Target:
private void logLicensingInfo() { SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d, yyyy"); hostLog.info("LICENSE INFORMATION: " + m_licenseApi.getLicenseType() + " license issued by VoltDB to " + m_licenseApi.licensee() + " on " + sdf.format(m_licenseApi.issued().getTime())); hostLog.info("LICENSE KEY: " + m_licenseApi.getSignature()); hostLog.info("LICENSE EXPIRES: " + sdf.format(m_licenseApi.expires().getTime())); hostLog.info("LICENSE CONSTRAINTS: " + m_licenseApi.maxHostcount() + " nodes"); if(m_licenseApi.isUnrestricted()) { hostLog.info("LICENSE FEATURES: Unrestricted"); } else { hostLog.info("LICENSE FEATURES: " + "commandLoggingEnabled=" + m_licenseApi.isCommandLoggingAllowed() + ", activeActiveDREnabled=" + m_licenseApi.isDrActiveActiveAllowed() + ", isDatabaseReplicationAllowed=" + m_licenseApi.isDrReplicationAllowed()); } }
Source:
<code>public Streamlet<R> setName(String sName) { <START> if (sName == null) { <END> throw new IllegalArgumentException("Streamlet name cannot be null"); } this.name = sName; return this; }</code><technical_language>check if sName is empty</technical_language>

Target:
public Streamlet<R> setName(String sName) { if (sName == null || sName.isEmpty()) { throw new IllegalArgumentException("Streamlet name cannot be null/empty"); } this.name = sName; return this; }
Source:
<code>public Response deletePolicy(@PathParam("tenant") String tenant, @PathParam("subject") String subject, @PathParam("policyId") String policyId) { String id = URLEncoding.decode(policyId); <START> LOGGER.debug("Removing policy with id [" + policyId + "] for [" + tenant + "] and subject [" + subject + "]"); <END> Policy p = dao.loadPolicy(tenant, subject, id); if (p != null) { dao.deletePolicy(p); return Response.ok(p.getPolicy()).build(); } else { return Response.status(404).build(); } }</code><technical_language><LINK_0></technical_language>

Target:
public Response deletePolicy(@PathParam("tenant") String tenant, @PathParam("subject") String subject, @PathParam("policyId") String policyId) { String id = URLEncoding.decode(policyId); LOGGER.debug("Removing policy with id for and subject [{}]", policyId, tenant, subject); Policy p = dao.loadPolicy(tenant, subject, id); if (p != null) { dao.deletePolicy(p); return Response.ok(p.getPolicy()).build(); } else { return Response.status(404).build(); } }
Source:
<code>public static long getDirectorySize(Path path, FileSystem fs) throws IOException { <START> return getDirectorySize(path, fs, PathFilters.ACCEPT_ALL_PATHS_FILTER); <END> }</code><technical_language>fyi: if counting everything, fs.getContentSummary(path) efficient</technical_language>

Target:
public static long getDirectorySize(Path path, FileSystem fs) throws IOException { ContentSummary cs = fs.getContentSummary(path); return cs.getLength(); }
Source:
<code>public void testDistinctCountWithOtherAggregationGroupByPushdown() { Map<String, String> outputVariables = ImmutableMap.of("agg", "count(*)", "count(regionid)", "DISTINCTCOUNT(regionId)"); PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); PlanNode markDistinct = buildPlan(planBuilder -> markDistinct(planBuilder, v("regionid$distinct"), ImmutableList.of(v("regionid")), justScan)); testPQL( new PinotConfig().setAllowMultipleAggregations(true), planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(markDistinct).singleGroupingSet(v("city")).addAggregation(planBuilder.variable("agg"), getRowExpression("count(*)", defaultSessionHolder)).addAggregation(planBuilder.variable("count(regionid)"), getRowExpression("count(regionid)", defaultSessionHolder), Optional.empty(), Optional.empty(), false, Optional.of(v("regionid$distinct")))), <START> "SELECT __expressions__ FROM realtimeOnly GROUP BY city TOP 10000", <END> defaultSessionHolder, outputVariables); }</code><technical_language>spelling out __expressions__</technical_language>

Target:
public void testDistinctCountWithOtherAggregationGroupByPushdown() { PlanNode justScan = buildPlan(planBuilder -> tableScan(planBuilder, pinotTable, regionId, secondsSinceEpoch, city, fare)); PlanNode markDistinct = buildPlan(planBuilder -> markDistinct(planBuilder, variable("regionid$distinct"), ImmutableList.of(variable("regionid")), justScan)); PlanNode aggregate = buildPlan(planBuilder -> planBuilder.aggregation(aggBuilder -> aggBuilder.source(markDistinct).singleGroupingSet(variable("city")).addAggregation(planBuilder.variable("agg"), getRowExpression("count(*)", defaultSessionHolder)).addAggregation(planBuilder.variable("count(regionid)"), getRowExpression("count(regionid)", defaultSessionHolder), Optional.empty(), Optional.empty(), false, Optional.of(variable("regionid$distinct"))))); String expectedPQL; if (aggregate.getOutputVariables().get(1).getName().equalsIgnoreCase("count(regionid)")) { expectedPQL = "SELECT DISTINCTCOUNT(regionId), count(*) FROM realtimeOnly GROUP BY city TOP 10000"; } else { expectedPQL = "SELECT count(*), DISTINCTCOUNT(regionId) FROM realtimeOnly GROUP BY city TOP 10000"; } testPQL(new PinotConfig().setAllowMultipleAggregations(true), aggregate, expectedPQL); }
Source:
<code>private WebElement getMinOptionsToBeRankedCheckbox(int qnNumber) { <START> if ("RANK_OPTIONS".equals(getQuestionType(qnNumber))) { <END> return browser.driver.findElement(By.id("minOptionsToBeRankedEnabled-" + qnNumber)); } return browser.driver.findElement(By.id("minRecipientsToBeRankedEnabled-" + qnNumber)); }</code><technical_language>"RANK_OPTIONS".equals(getQuestionType(qnNumber)) extracted out</technical_language>

Target:
private WebElement getMinOptionsToBeRankedCheckbox(int qnNumber) { if (isRankOptionsQuestion(qnNumber)) { return browser.driver.findElement(By.id("minOptionsToBeRankedEnabled-" + qnNumber)); } return browser.driver.findElement(By.id("minRecipientsToBeRankedEnabled-" + qnNumber)); }
Source:
<code>public void testPrintXpathOption() throws Exception { final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "`--OBJBLOCK -> OBJBLOCK [3:28]", " |--METHOD_DEF -> METHOD_DEF [4:4]", " | `--SLIST -> { [4:20]", " | |--VARIABLE_DEF -> VARIABLE_DEF [5:8]", <START> " | | |--IDENT -> a [5:12]"); <END> exit.checkAssertionAfterwards(() -> { assertEquals("Unexpected output log", expected, systemOut.getLog()); assertEquals("Unexpected system error log", "", systemErr.getLog()); }); Main.main("-b", "/CLASS_DEF getPath("InputMainXPath.java")); }</code><technical_language>some issues indentation ? " alligned</technical_language>

Target:
public void testPrintXpathOption() throws Exception { final String expected = addEndOfLine( "CLASS_DEF -> CLASS_DEF [3:0]", "`--OBJBLOCK -> OBJBLOCK [3:28]", " |--METHOD_DEF -> METHOD_DEF [4:4]", " | `--SLIST -> { [4:20]", " | |--VARIABLE_DEF -> VARIABLE_DEF [5:8]", " | | |--IDENT -> a [5:12]"); exit.checkAssertionAfterwards(() -> { Assert.assertThat("Unexpected output log", systemOut.getLog(), is(expected)); Assert.assertThat("Unexpected system error log", systemErr.getLog(), is("")); }); Main.main("-b", "/CLASS_DEF getPath("InputMainXPath.java")); }
Source:
<code>public static ClickType getClickType(int mode, int button, int slot) { switch (mode) { case 0: if (button == 0) { return slot == -1 ? ClickType.WINDOW_BORDER_LEFT : ClickType.LEFT; } else if (button == 1) { return slot == -1 ? ClickType.WINDOW_BORDER_RIGHT : ClickType.RIGHT; } break; case 1: if (button == 0) { return ClickType.SHIFT_LEFT; } else if (button == 1) { return ClickType.SHIFT_RIGHT; } break; case 2: return ClickType.NUMBER_KEY; case 3: if (button == 2) { return ClickType.MIDDLE; } break; case 4: if (button == 0) { return ClickType.DROP; } else if (button == 1) { return ClickType.CONTROL_DROP; } break; case 6: return ClickType.DOUBLE_CLICK; <START> case 5: END> default: return ClickType.UNKNOWN; } return ClickType.UNKNOWN; }</code><technical_language>Is this correct is implemented yet</technical_language>

Target:
public static ClickType getClickType(int mode, int button, int slot) { switch (mode) { case 0: if (button == 0) { return slot == -1 ? ClickType.WINDOW_BORDER_LEFT : ClickType.LEFT; } else if (button == 1) { return slot == -1 ? ClickType.WINDOW_BORDER_RIGHT : ClickType.RIGHT; } break; case 1: if (button == 0) { return ClickType.SHIFT_LEFT; } else if (button == 1) { return ClickType.SHIFT_RIGHT; } break; case 2: return ClickType.NUMBER_KEY; case 3: if (button == 2) { return ClickType.MIDDLE; } break; case 4: if (button == 0) { return ClickType.DROP; } else if (button == 1) { return ClickType.CONTROL_DROP; } break; case 5: break; case 6: return ClickType.DOUBLE_CLICK; default: return ClickType.UNKNOWN; } return ClickType.UNKNOWN; }
Source:
<code>private Logger(){ setLayout(new BorderLayout()); list = new JList<>(); JScrollPane pane = new JScrollPane(list); add(pane, BorderLayout.CENTER); JButton button = new JButton("Clear Logger"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearLogger(); <START> addMessage("Logger cleared", false); <END> } }); add(button, BorderLayout.SOUTH); list.setCellRenderer(getRenderer()); model = new DefaultListModel<>(); list.setModel(model); setPreferredSize(new Dimension((int) GamePanel.getInstance().getPreferredSize().getWidth(), 150)); model.addElement("Logger started"); setVisible(false); }</code><technical_language>this message enable logger</technical_language>

Target:
private Logger(){ setLayout(new BorderLayout()); list = new JList<>(); JScrollPane pane = new JScrollPane(list); add(pane, BorderLayout.CENTER); JButton button = new JButton("Clear Logger"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { clearLogger(); addMessage("Logger started", false); } }); add(button, BorderLayout.SOUTH); list.setCellRenderer(getRenderer()); model = new DefaultListModel<>(); list.setModel(model); setPreferredSize(new Dimension((int) GamePanel.getInstance().getPreferredSize().getWidth(), 150)); model.addElement("Logger started"); setVisible(false); }
Source:
<code>public long countStudiesByGid(final int gid) throws MiddlewareQueryException { try { final SQLQuery query = this.getSession() .createSQLQuery("select count(distinct p.project_id) " + "FROM stock s " + "LEFT JOIN nd_experiment_stock es ON s.stock_id = es.stock_id " + "LEFT JOIN nd_experiment e on es.nd_experiment_id = e.nd_experiment_id " + "LEFT JOIN nd_experiment_project ep ON ep.nd_experiment_id = e.nd_experiment_id " + "LEFT JOIN project_relationship pr ON pr.subject_project_id = ep.project_id " + "LEFT JOIN project p ON pr.object_project_id = p.project_id " + "WHERE s.dbxref_id = " + gid <START> + " AND p.project_id NOT IN (SELECT pp.project_id FROM projectprop pp WHERE pp.variable_id = " <END> + TermId.STUDY_STATUS.getId() + " AND pp.value = " + TermId.DELETED_STUDY.getId() + ")"); return ((BigInteger) query.uniqueResult()).longValue(); } catch (final HibernateException e) { throw new MiddlewareQueryException("Error in countStudiesByGid=" + gid + " in StockDao: " + e.getMessage(), e); } }</code><technical_language>Cleanup: Remove **throws MiddlewareQueryException** clauses</technical_language>

Target:
public long countStudiesByGid(final int gid) { try { final SQLQuery query = this.getSession() .createSQLQuery("select count(distinct p.project_id) " + "FROM stock s " + "LEFT JOIN nd_experiment_stock es ON s.stock_id = es.stock_id " + "LEFT JOIN nd_experiment e on es.nd_experiment_id = e.nd_experiment_id " + "LEFT JOIN nd_experiment_project ep ON ep.nd_experiment_id = e.nd_experiment_id " + "LEFT JOIN project_relationship pr ON pr.subject_project_id = ep.project_id " + "LEFT JOIN project p ON pr.object_project_id = p.project_id " + "WHERE s.dbxref_id = " + gid + " AND p.project_id NOT IN (SELECT pp.project_id FROM projectprop pp WHERE pp.variable_id = " + TermId.STUDY_STATUS.getId() + " AND pp.value = " + TermId.DELETED_STUDY.getId() + ")"); return ((BigInteger) query.uniqueResult()).longValue(); } catch (final HibernateException e) { throw new MiddlewareQueryException("Error in countStudiesByGid=" + gid + " in StockDao: " + e.getMessage(), e); } }
Source:
<code>protected void updateEntityFields(CashPoint cashPoint) { cashPoint.setName(cashPoint.getName() + " updated"); cashPoint.setDescription(cashPoint.getDescription() + " updated"); <START> cashPoint.setLocation(Context.getLocationService().getLocation(1)); <END> cashPoint.setCreator(Context.getAuthenticatedUser()); cashPoint.setDateChanged(new Date()); }</code><technical_language>This a location set in createEntity, verify changing location is saved</technical_language>

Target:
protected void updateEntityFields(CashPoint cashPoint) { cashPoint.setName(cashPoint.getName() + " updated"); cashPoint.setDescription(cashPoint.getDescription() + " updated"); cashPoint.setLocation(Context.getLocationService().getLocation(0)); }