auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void findByApplicationEntityOrderByStateIndexDescShouldFindSingleStateForApplicationWithSingleState() { ApplicationEntity applicationEntity = getApplicationByCandidateName(CANDIDATE_NAME_B); StateEntity expectedStateEntity = getExpectedStateEntityForSingleState(); <START> StateEntity stateEntity = this.statesRepository.findByApplicationEntityOrderByStateIndexDesc(applicationEntity).get(ZEROTH_ELEMENT); <END> assertStateEntity(stateEntity, expectedStateEntity); }</code><technical_language>assert a single state in returned list</technical_language>

Target:
public void findByApplicationEntityOrderByStateIndexDescShouldFindSingleStateForApplicationWithSingleState() { ApplicationEntity applicationEntity = getApplicationByCandidateName(CANDIDATE_NAME_B); StateEntity expectedStateEntity = getExpectedStateEntityForSingleState(); List<StateEntity> stateEntityList = this.statesRepository.findByApplicationEntityOrderByStateIndexDesc(applicationEntity); assertThat(stateEntityList, notNullValue()); assertThat(stateEntityList.size(), is(VALUE_ONE)); StateEntity stateEntity = stateEntityList.get(ZEROTH_ELEMENT); assertStateEntity(stateEntity, expectedStateEntity); }
Source:
<code>public CompositeChange flatten() { return new CompositeChange( changes.stream() .map( change -> { <START> if (change instanceof CompositeChange) { <END> return ((CompositeChange) change).flatten().getChanges(); } else { return List.of(change); } }) .flatMap(Collection::stream) .collect(Collectors.toList())); }</code><technical_language>nit: A ternary worth consider here, lambda syntax a bit nicer</technical_language>

Target:
public CompositeChange flatten() { return new CompositeChange( changes.stream() .map( change -> change instanceof CompositeChange ? ((CompositeChange) change).flatten().getChanges() : List.of(change)) .flatMap(Collection::stream) .collect(Collectors.toList())); }
Source:
<code>RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final DepthCommit c = (DepthCommit)pending.next(); if (c == null) return null; if ((c.flags & RevWalk.PARSED) == 0) c.parseHeaders(walk); if (c.depth > depth) { c.flags |= UNINTERESTING; continue; } if (c.depth == depth) c.add(SHALLOW); int newDepth = c.depth + 1; for (final RevCommit p : c.parents) { DepthCommit dp = (DepthCommit)p; boolean add = false; if (dp.depth == -1) { dp.depth = newDepth; add = true; } if ((c.flags & UNINTERESTING) == 0 && ((p.flags & UNINTERESTING) != 0) <START> && (!p.has(BOUNDARY))) { <END> p.add(BOUNDARY); add = true; } if (add) pending.add(p); } return c; } }</code><technical_language>Style-nit: Parens !p.has(BOUNDARY) necessary. this NPE BOUNDARY allocated DepthRevWalk? I guess assume DepthRevWalk overrides markUninteresting() do assume UNINTERESTING set a RevCommit? a skeptical of method determine if BOUNDARY is null not</technical_language>

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final DepthCommit c = (DepthCommit)pending.next(); if (c == null) return null; if ((c.flags & RevWalk.PARSED) == 0) c.parseHeaders(walk); if (c.depth > depth) { c.flags |= UNINTERESTING; continue; } if (c.depth == depth) c.add(SHALLOW); int newDepth = c.depth + 1; for (final RevCommit p : c.parents) { DepthCommit dp = (DepthCommit)p; boolean add = false; if (dp.depth == -1) { dp.depth = newDepth; add = true; } if ((c.flags & UNINTERESTING) == 0 && ((p.flags & UNINTERESTING) != 0) && (BOUNDARY != null) && !p.has(BOUNDARY)) { if (BOUNDARY != null) p.add(BOUNDARY); add = true; } if (add) pending.add(p); } return c; } }
Source:
<code>AzureBlobWriter createNewWriter(String blobURL, AzureBlobWriterMetrics writerMetrics) { try { return writerFactory.getWriterInstance(containerAsyncClient, blobURL, asyncBlobThreadPool, writerMetrics, blockFlushThresholdSize, flushTimeoutMs, <START> new CompressionFactory().getCompression(config.getCompressionType(systemName)), <END> config.getSuffixRandomStringToBlobName(systemName), config.getMaxBlobSize(systemName), config.getMaxMessagesPerBlob(systemName)); } catch (Exception e) { throw new RuntimeException("Failed to create a writer for the producer.", e); } }</code><technical_language>CompressionFactory a singleton</technical_language>

Target:
AzureBlobWriter createNewWriter(String blobURL, AzureBlobWriterMetrics writerMetrics) { try { return writerFactory.getWriterInstance(containerAsyncClient, blobURL, asyncBlobThreadPool, writerMetrics, blockFlushThresholdSize, flushTimeoutMs, CompressionFactory.getInstance().getCompression(config.getCompressionType(systemName)), config.getSuffixRandomStringToBlobName(systemName), config.getMaxBlobSize(systemName), config.getMaxMessagesPerBlob(systemName)); } catch (Exception e) { throw new RuntimeException("Failed to create a writer for the producer.", e); } }
Source:
<code>public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { <START> ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); <END> final NSBlockOperation runOperation = new NSBlockOperation(); executor.schedule(new Runnable() { @Override public void run() { if (isUnsubscribed()) { return; } final Runnable actionRunner = new Runnable() { @Override public void run() { action.call(); } }; runOperation.addExecutionBlock$(actionRunner); operationQueue.addOperation(runOperation); } }, delayTime, unit); return Subscriptions.create(new Action0() { @Override public void call() { runOperation.cancel(); } }); }</code><technical_language>Starting a scheduled thread pool for direct-running task is wasteful, consider implementing schedule(Action0) forwarding timed overload</technical_language>

Target:
public Subscription schedule(final Action0 action, long delayTime, TimeUnit unit) { return scheduledAction(action, delayTime, unit); }
Source:
<code>PushCertificateParser(Repository into, ReceiveConfig cfg) { seed = cfg.certNonceSeed; nonceSlopLimit = cfg.certNonceSlopLimit; <START> nonceGenerator = new HMACSHA1NonceGenerator(); <END> db = into; }</code><technical_language>Push seed generator: nonceGenerator = cfg.certNonceSeed != null ? new HMACSHA1NonceGenerator(cfg.certNonceSeed) : null;</technical_language>

Target:
PushCertificateParser(Repository into, ReceiveConfig cfg) { nonceSlopLimit = cfg.certNonceSlopLimit; nonceGenerator = cfg.certNonceSeed != null ? new HMACSHA1NonceGenerator(cfg.certNonceSeed) : null; db = into; }
Source:
<code>void maybeNotifyForBlobCreation() { if (isOperationComplete()) { <START> metadataPutChunk.maybeNotifyForFirstChunkCreation(); <END> if (blobId != null) { NotificationBlobType notificationBlobType = getNumDataChunks() == 1 ? NotificationBlobType.Simple : NotificationBlobType.Composite; notificationSystem.onBlobCreated(getBlobIdString(), getBlobProperties(), getUserMetadata(), notificationBlobType); } } }</code><technical_language>this be: java if (getNumDataChunks() > 1) { notifyForFirstChunkCreation(); }</technical_language>

Target:
void maybeNotifyForBlobCreation() { if (isOperationComplete()) { boolean composite = !getSuccessfullyPutChunkIdsIfComposite().isEmpty(); if (composite) { metadataPutChunk.notifyForFirstChunkCreation(); } if (blobId != null) { notificationSystem.onBlobCreated(getBlobIdString(), getBlobProperties(), getUserMetadata(), composite ? NotificationBlobType.Composite : NotificationBlobType.Simple); } } }
Source:
<code>public EventTypeCache eventTypeCache() throws Exception { final String connectString = zookeeperConfig.zooKeeperHolder().get().getZookeeperClient().getCurrentConnectionString(); final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework client = CuratorFrameworkFactory.newClient(connectString, retryPolicy); client.start(); <START> EventBodyMustRespectSchema strategy = new EventBodyMustRespectSchema(); <END> ValidationStrategy.register(EventBodyMustRespectSchema.NAME, strategy); return new EventTypeCache(dbRepo(), client); }</code><technical_language>final</technical_language>

Target:
public EventTypeCache eventTypeCache() throws Exception { final CuratorFramework client = zookeeperConfig.zooKeeperHolder().get(); final EventTypeCache cache = new EventTypeCache(dbRepo(), client); final EventBodyMustRespectSchema strategy = new EventBodyMustRespectSchema(); ValidationStrategy.register(EventBodyMustRespectSchema.NAME, strategy); return new EventTypeCache(dbRepo(), client); }
Source:
<code>private boolean isPropertyEmbeddedInJoinProperties(String propertyName) { EntityPersister entityPersister = this.getFromElement().getEntityPersister(); String propertyPath = String.join( ".", this.propertyPath, propertyName ); try { <START> Type propertyType = entityPersister.getPropertyType( propertyPath ); <END> return propertyType != null; } catch (QueryException e) { return false; } }</code><technical_language>cautious enough? I missed I this part of code I find a bit weird check entity a property name. a property name is foreign key for other table a totally value. code work in this case</technical_language>

Target:
private boolean isPropertyEmbeddedInJoinProperties(String propertyName) { String propertyPath = String.join( ".", this.propertyPath, propertyName ); try { Type propertyType = getFromElement().getPropertyType( this.propertyPath, propertyPath ); return propertyType != null; } catch (QueryException e) { return false; } }
Source:
<code>public CapableIndexReference index( int label, int... properties ) <START> { <END> ktx.assertOpen(); SchemaIndexDescriptor indexDescriptor = storeReadLayer.indexGetForSchema( new LabelSchemaDescriptor( label, properties ) ); if ( ktx.hasTxStateWithChanges() ) { LabelSchemaDescriptor descriptor = new LabelSchemaDescriptor( label, properties ); ReadableDiffSets<SchemaIndexDescriptor> diffSets = ktx.txState().indexDiffSetsByLabel( label ); if ( indexDescriptor != null ) { if ( diffSets.isRemoved( indexDescriptor ) ) { return CapableIndexReference.NO_INDEX; } else { return indexGetCapability( indexDescriptor ); } } else { Iterator<SchemaIndexDescriptor> fromTxState = filter( SchemaDescriptor.equalTo( descriptor ), diffSets.apply( emptyResourceIterator() ) ); if ( fromTxState.hasNext() ) { return DefaultCapableIndexReference.fromDescriptor( fromTxState.next() ); } else { return CapableIndexReference.NO_INDEX; } } } return indexDescriptor != null ? indexGetCapability( indexDescriptor ) : CapableIndexReference.NO_INDEX; }</code><technical_language>a ktx.assertOpen for consistency</technical_language>

Target:
public CapableIndexReference index( int label, int... properties ) { ktx.assertOpen(); LabelSchemaDescriptor descriptor; try { descriptor = SchemaDescriptorFactory.forLabel( label, properties ); } catch ( IllegalArgumentException ignore ) { return CapableIndexReference.NO_INDEX; } SchemaIndexDescriptor indexDescriptor = storeReadLayer.indexGetForSchema( descriptor ); if ( ktx.hasTxStateWithChanges() ) { ReadableDiffSets<SchemaIndexDescriptor> diffSets = ktx.txState().indexDiffSetsByLabel( label ); if ( indexDescriptor != null ) { if ( diffSets.isRemoved( indexDescriptor ) ) { return CapableIndexReference.NO_INDEX; } else { return indexGetCapability( indexDescriptor ); } } else { Iterator<SchemaIndexDescriptor> fromTxState = filter( SchemaDescriptor.equalTo( descriptor ), diffSets.apply( emptyResourceIterator() ) ); if ( fromTxState.hasNext() ) { return DefaultCapableIndexReference.fromDescriptor( fromTxState.next() ); } else { return CapableIndexReference.NO_INDEX; } } } return indexDescriptor != null ? indexGetCapability( indexDescriptor ) : CapableIndexReference.NO_INDEX; }
Source:
<code>public String getUnknownArtifactLink(String guid, BranchId branch) { String message = <START> String.format("Invalid Link: artifact with guid:[%s] on branchUuid:[%s] does not exist", guid, branch); <END> String internalLink = String.format("http://none/%s?guid=%s&amp;branchUuid=%s", "unknown", guid, branch); return String.format(WORDML_LINK_FORMAT, internalLink, message); }</code><technical_language>put "unkonwn" in format string instead of parameter</technical_language>

Target:
public String getUnknownArtifactLink(String guid, BranchId branch) { String message = String.format("Invalid Link: artifact with guid:[%s] on branchUuid:[%s] does not exist", guid, branch); String internalLink = String.format("http://none/unknown?guid=%s&amp;branchUuid=%s", guid, branch); return String.format(WORDML_LINK_FORMAT, internalLink, message); }
Source:
<code>public void close() { List<String> connections = new ArrayList<>(channels.keySet()); <START> AtomicReference<Throwable> firstException = new AtomicReference<>(); <END> connections.forEach(id -> Utils.closeQuietly(() -> close(id), "close channel:" + id, firstException)); Utils.closeQuietly(nioSelector, "nioSelector", firstException); Utils.closeQuietly(sensors, "sensors", firstException); Utils.closeQuietly(channelBuilder, "channelBuilder", firstException); Throwable exception = firstException.get(); if (exception instanceof RuntimeException && !(exception instanceof SecurityException)) { throw (RuntimeException) exception; } }</code><technical_language>considered Utils.closeAll instead of multiple closeQuietly</technical_language>

Target:
public void close() { List<String> connections = new ArrayList<>(channels.keySet()); AtomicReference<Throwable> firstException = new AtomicReference<>(); Utils.closeAllQuietly(firstException, "release connections", connections.stream().map(id -> (AutoCloseable) () -> close(id)).toArray(AutoCloseable[]::new)); Utils.closeQuietly(nioSelector, "nioSelector", firstException); Utils.closeQuietly(sensors, "sensors", firstException); Utils.closeQuietly(channelBuilder, "channelBuilder", firstException); Throwable exception = firstException.get(); if (exception instanceof RuntimeException && !(exception instanceof SecurityException)) { throw (RuntimeException) exception; } }
Source:
<code>public void testGetNewInstance() { ITmfStateProvider clone = fStateProvider.getNewInstance(); <START> assertNotSame(fStateProvider, <END> clone); assertEquals(fStateProvider.getVersion(), clone.getVersion()); assertEquals(fStateProvider.getTrace(), clone.getTrace()); }</code><technical_language>add a message: getNewInstance return reference</technical_language>

Target:
public void testGetNewInstance() { ITmfStateProvider clone = fStateProvider.getNewInstance(); assertNotSame("The original CounterStateProvider and its clone do not share the same reference.", fStateProvider, clone); assertEquals(fStateProvider.getVersion(), clone.getVersion()); assertEquals(fStateProvider.getTrace(), clone.getTrace()); }
Source:
<code>public Bean<T> complete() { <START> ImmutableBean<T> result = new ImmutableBean<>(this); <END> if (createCallback == null) { throw BeanLogger.LOG.noCallbackSpecifiedForCustomBean(result.toString()); } return result; }</code><technical_language>Well, BeanAttributesConfiguratorImpl.qualifiers types package-private like: throw BeanLogger.LOG.noCallbackSpecifiedForCustomBean("Configurator [types: " + Formats.formatTypes(attributes.types) + ", qualifiers: " + Formats.formatAnnotations(attributes.qualifiers) + "]"); Hm, BeanAttributesConfiguratorImpl.types final - pls add this change too</technical_language>

Target:
public Bean<T> complete() { if (createCallback == null) { throw BeanLogger.LOG.noCallbackSpecifiedForCustomBean("bean [" + beanClass.toString() + ", with types: " + Formats.formatTypes(attributes.types) + ", and qualifiers: " + Formats.formatAnnotations(attributes.qualifiers) + "]"); } return new ImmutableBean<>(this); }
Source:
<code>private RawPacket doTransform(RawPacket pkt, boolean send) { RTCPIterator it = new RTCPIterator(pkt); while (it.hasNext()) { ByteArrayBuffer baf = it.next(); int pt = RTCPHeaderUtils.getPacketType(baf); <START> if (pt > -1 <END> && (byte) pt == RTCPRRPacket.RR || RTCPREMBPacket.isREMBPacket(baf) || RTCPTCCPacket.isTCCPacket(baf)) { it.remove(); continue; } if (!send && pt > -1) { int fmt = RTCPHeaderUtils.getReportCount(baf); if (((byte) pt == RTCPFeedbackMessageEvent.PT_PS && fmt == RTCPFeedbackMessageEvent.FMT_PLI) || ((byte) pt == RTCPFeedbackMessageEvent.PT_PS && fmt == RTCPFeedbackMessageEvent.FMT_FIR)) { long source = RTCPFBPacket.getSourceSSRC(baf); ((RTPTranslatorImpl) stream.getRTPTranslator()) .getRtcpFeedbackMessageSender() .requestKeyframe(source); it.remove(); continue; } } } return pkt.getLength() == 0 ? null : pkt; }</code><technical_language>if this is handle chrome ssrc of 1, i a constant (like CHROME_DEFAULT_RTCP_MEDIA_SSRC=1 check for specifically</technical_language>

Target:
private RawPacket doTransform(RawPacket pkt, boolean send) { RTCPIterator it = new RTCPIterator(pkt); while (it.hasNext()) { ByteArrayBuffer baf = it.next(); int pt = RTCPHeaderUtils.getPacketType(baf); if (pt == RTCPRRPacket.RR || RTCPREMBPacket.isREMBPacket(baf) || RTCPTCCPacket.isTCCPacket(baf)) { it.remove(); continue; } if (!send && pt > -1) { int fmt = RTCPHeaderUtils.getReportCount(baf); if ((pt == RTCPFeedbackMessageEvent.PT_PS && fmt == RTCPFeedbackMessageEvent.FMT_PLI) || (pt == RTCPFeedbackMessageEvent.PT_PS && fmt == RTCPFeedbackMessageEvent.FMT_FIR)) { long source = RTCPFBPacket.getSourceSSRC(baf); ((RTPTranslatorImpl) stream.getRTPTranslator()) .getRtcpFeedbackMessageSender() .requestKeyframe(source); it.remove(); continue; } } } return pkt.getLength() == 0 ? null : pkt; }
Source:
<code>public RowIterator get(ScannerConfiguration config) { RowIterator rowIter = txb.get(config); <START> while ((rowIter != null) && rowIter.hasNext()) { <END> Map.Entry<Bytes, ColumnIterator> rowEntry = rowIter.next(); ColumnIterator colIter = rowEntry.getValue(); while (colIter.hasNext()) { Map.Entry<Column, Bytes> colEntry = colIter.next(); txLog.filteredAdd( LogEntry.newSet(rowEntry.getKey(), colEntry.getKey(), colEntry.getValue()), filter); } } return rowIter; }</code><technical_language>Guava's ITerator class wrap</technical_language>

Target:
public RowIterator get(ScannerConfiguration config) { final RowIterator rowIter = txb.get(config); if (rowIter != null) { return new RowIterator() { @Override public boolean hasNext() { return rowIter.hasNext(); } @Override public Map.Entry<Bytes, ColumnIterator> next() { final Map.Entry<Bytes, ColumnIterator> rowEntry = rowIter.next(); if ((rowEntry != null) && (rowEntry.getValue() != null)) { final ColumnIterator colIter = rowEntry.getValue(); return new AbstractMap.SimpleEntry<Bytes, ColumnIterator>( rowEntry.getKey(), new ColumnIterator() { @Override public boolean hasNext() { return colIter.hasNext(); } @Override public Map.Entry<Column, Bytes> next() { Map.Entry<Column, Bytes> colEntry = colIter.next(); if (colEntry != null) { txLog.filteredAdd(LogEntry.newGet(rowEntry.getKey(), colEntry.getKey(), colEntry.getValue()), filter); } return colEntry; } }); } return rowEntry; } }; } return rowIter; }
Source:
<code>public String toString() { return "RSocketConnectedEvent{" + "destination='" + this.destination + '\'' + <START> ", data=" + Arrays.toString(this.data.asByteBuffer().array()) + <END> ", requester=" + this.requester + '}'; }</code><technical_language>I rendering a byte[] a bunch of ints is useful, omit this (or include length, perhaps)</technical_language>

Target:
public String toString() { return "RSocketConnectedEvent{" + "destination='" + this.destination + '\'' + ", requester=" + this.requester + '}'; }
Source:
<code>public int addNotes(long mid, long did, String[][] fieldsArr, String[] tagsArr) { if (tagsArr != null && fieldsArr.length != tagsArr.length) { throw new IllegalArgumentException("fieldsArr and tagsArr different length"); } <START> long startTimeMillis = SystemClock.uptimeMillis(); <END> Map<String, Note> existingNotesMap = createNotesMap(mid, did); Log.d("test", "notesMap took: " + (SystemClock.uptimeMillis() - startTimeMillis)); List<ContentValues> newNoteValuesList = new ArrayList<>(); for (int i = 0; i < fieldsArr.length; i++) { String[] fields = fieldsArr[i]; if (fields == null) { continue; } String tags = tagsArr[i]; if (fields.length >= 1) { String key = fields[0]; if (existingNotesMap.containsKey(key)) { Note note = existingNotesMap.get(key); if (note == null) { } else if (note.equals(fields, tags)) { } else { } continue; } existingNotesMap.put(key, null); } ContentValues values = new ContentValues(); values.put(FlashCardsContract.Note.MID, mid); values.put(FlashCardsContract.Note.FLDS, joinFields(fields)); if (tags != null) { values.put(FlashCardsContract.Note.TAGS, tags); } newNoteValuesList.add(values); } if (newNoteValuesList.isEmpty()) { return 0; } ContentValues[] newNoteValues = newNoteValuesList.toArray(new ContentValues[newNoteValuesList.size()]); return getCompat().addNewNotes(did, newNoteValues); }</code><technical_language>Remove debugging timing code imports</technical_language>

Target:
public int addNotes(long mid, long did, String[][] fieldsArr, String[] tagsArr) { if (tagsArr != null && fieldsArr.length != tagsArr.length) { throw new IllegalArgumentException("fieldsArr and tagsArr different length"); } Map<String, Note> existingNotesMap = createNotesMap(mid, did); List<ContentValues> newNoteValuesList = new ArrayList<>(); for (int i = 0; i < fieldsArr.length; i++) { String[] fields = fieldsArr[i]; if (fields == null) { continue; } String tags = tagsArr[i]; if (fields.length >= 1) { String key = fields[0]; if (existingNotesMap.containsKey(key)) { Note note = existingNotesMap.get(key); if (note == null) { } else if (note.equals(fields, tags)) { } else { } continue; } existingNotesMap.put(key, null); } ContentValues values = new ContentValues(); values.put(FlashCardsContract.Note.MID, mid); values.put(FlashCardsContract.Note.FLDS, joinFields(fields)); if (tags != null) { values.put(FlashCardsContract.Note.TAGS, tags); } newNoteValuesList.add(values); } if (newNoteValuesList.isEmpty()) { return 0; } ContentValues[] newNoteValues = newNoteValuesList.toArray(new ContentValues[newNoteValuesList.size()]); return getCompat().addNewNotes(did, newNoteValues); }
Source:
<code>public Optional<PaxosValue> getGreatestLearnedValue() { Set<PaxosValue> result = rpcClient .getLearnedValuesSince(paxosUseCase, ImmutableMap.of(client, lastKnownSequence)) .get(client); Optional<PaxosValue> greatestIfExists = result.stream() <START> .reduce((fst, snd) -> fst.getRound() > snd.getRound() ? fst : snd); <END> greatestIfExists.ifPresent(paxosValue -> updateLastKnownSequence(paxosValue.getRound())); return greatestIfExists; }</code><technical_language>Equivalent, I I readability of this better: suggestion .max(Comparator.comparingLong(PaxosValue::getRound));</technical_language>

Target:
public Optional<PaxosValue> getGreatestLearnedValue() { Set<PaxosValue> result = rpcClient .getLearnedValuesSince(paxosUseCase, ImmutableMap.of(client, lastKnownSequence.get())) .get(client); Optional<PaxosValue> greatestIfExists = result.stream().max(Comparator.comparingLong(PaxosValue::getRound)); greatestIfExists.ifPresent(paxosValue -> updateLastKnownSequence(paxosValue.getRound())); return greatestIfExists; }
Source:
<code>public void usedByBatch() { final MetadataService metadataService = gd.getMetadataService(); final Collection<String> uris = metadataService.findUris(project, identifier("attr.person.department"), identifier("attr.person.role")); <START> assertThat(metadataService.usedBy(project, new HashSet<>(uris), false).size(), is(2)); <END> }</code><technical_language>hasSize()</technical_language>

Target:
public void usedByBatch() { final MetadataService metadataService = gd.getMetadataService(); final Map<String, String> uris = metadataService.identifiersToUris(project, asList("attr.person.department", "attr.person.role")); final Collection<Usage> usages = metadataService.usedBy(project, uris.values(), false); assertThat(usages, hasSize(2)); final Iterator<Usage> usageIterator = usages.iterator(); final Usage usage1 = usageIterator.next(); assertTrue(uris.containsValue(usage1.getUri())); assertThat(usage1.getUsedBy(), hasSize(2)); final Usage usage2 = usageIterator.next(); assertTrue(uris.containsValue(usage2.getUri())); assertThat(usage2.getUsedBy(), hasSize(5)); }
Source:
<code>public boolean isSSLAuthenticationDisabled() { <START> return disableSSLAuthentication; <END> }</code><technical_language>Rename ivar match accessor</technical_language>

Target:
public boolean isSSLAuthenticationDisabled() { return isSSLAuthenticationDisabled; }
Source:
<code>private void restartModules(Collection<Module> modules, ServletContext servletContext) { for (Module module : modules) { if (moduleFactoryWrapper.isModuleStarted(module)) { moduleFactoryWrapper.stopModuleSkipRefresh(module, servletContext); } } boolean needsRefresh = false; for (Module module : moduleFactoryWrapper.getModulesInStartupOrder(modules)) { <START> if (moduleFactoryWrapper.isModuleStopped(module)) { <END> needsRefresh = moduleFactoryWrapper.startModuleSkipRefresh(module, servletContext) || needsRefresh; } } if (needsRefresh) { moduleFactoryWrapper.refreshWebApplicationContext(servletContext); } }</code><technical_language>I restart modules, work. running in debug mode, i noticed line returned false. this? start a failing unit test for restarting modules</technical_language>

Target:
private void restartModules(Collection<Module> modules, ServletContext servletContext) { stopModules(modules, servletContext, false); startModules(modules, servletContext); }
Source:
<code>public String getDescription(AbstractOperation op) { if (op instanceof CompositeOperation) { final CompositeOperation compositeOperation = (CompositeOperation) op; if (compositeOperation.getMainOperation() != null) { return getDescription(compositeOperation.getMainOperation()); } } final OperationCustomLabelProvider customLabelProvider = getLabelProvider(); final String decorate = decorate(customLabelProvider, op); <START> customLabelProvider.dispose(); <END> return decorate; }</code><technical_language>wrap dispose call() in finally block (e.g. in case of NPE)</technical_language>

Target:
public String getDescription(AbstractOperation op) { if (op instanceof CompositeOperation) { final CompositeOperation compositeOperation = (CompositeOperation) op; if (compositeOperation.getMainOperation() != null) { return getDescription(compositeOperation.getMainOperation()); } } final OperationCustomLabelProvider customLabelProvider = getLabelProvider(); String decorate; try { decorate = decorate(customLabelProvider, op); return decorate; } finally { customLabelProvider.dispose(); } }
Source:
<code>private static JavaRDD<ReportEntry> generateReportEntries(JavaSparkContext sparkContext, JavaRDD<DocumentText> processedEntities, JavaRDD<Fault> processedFaults) { <START> Preconditions.checkNotNull(sparkContext, "sparkContext has not been set"); <END> ReportEntry processedEnttiesCounter = ReportEntryFactory.createCounterReportEntry(COUNTER_PROCESSED_TOTAL, processedEntities.count()); ReportEntry processedFaultsCounter = ReportEntryFactory.createCounterReportEntry(COUNTER_PROCESSED_FAULT, processedFaults.count()); return sparkContext.parallelize(Lists.newArrayList(processedEnttiesCounter, processedFaultsCounter)); }</code><technical_language>calling this method try-with-resource block spark context resource I this check is necessary</technical_language>

Target:
private static JavaRDD<ReportEntry> generateReportEntries(JavaSparkContext sparkContext, JavaRDD<DocumentText> processedEntities, JavaRDD<Fault> processedFaults) { ReportEntry processedEntitiesCounter = ReportEntryFactory.createCounterReportEntry(COUNTER_PROCESSED_TOTAL, processedEntities.count()); ReportEntry processedFaultsCounter = ReportEntryFactory.createCounterReportEntry(COUNTER_PROCESSED_FAULT, processedFaults.count()); return sparkContext.parallelize(Lists.newArrayList(processedEntitiesCounter, processedFaultsCounter)); }
Source:
<code><START> @Override public PickupStatus getPickupStatus() { <END> PickupStatus customPickupStatus = this.customPickupStatus; return customPickupStatus != null ? customPickupStatus : getShooter() instanceof Monster ? PickupStatus.DISALLOWED : PickupStatus.ALLOWED; }</code><technical_language>Annotations line</technical_language>

Target:
public PickupStatus getPickupStatus() { PickupStatus customPickupStatus = this.customPickupStatus; return customPickupStatus != null ? customPickupStatus : getShooter() instanceof Monster ? PickupStatus.DISALLOWED : PickupStatus.ALLOWED; }
Source:
<code>private void restartIfNeeded() { if (isStarted()) { <START> this.initialDelay = period; <END> stop(); start(); } }</code><technical_language>built this test: @Test public void testVerifyInitialDelayChanged() { final long initialDelay = 10; final long period = 100; final ActiveMQScheduledComponent local = new ActiveMQScheduledComponent(scheduledExecutorService, executorService, initialDelay, period, TimeUnit.MILLISECONDS, false) { @Override public void run() { } }; local.start(); final long newInitialDelay = 1000; //the parameters valid? assert initialDelay != newInitialDelay && newInitialDelay != period; local.setInitialDelay(newInitialDelay); local.stop(); Assert.assertEquals("the initial dalay change", newInitialDelay, local.getInitialDelay()); } fail: is create a start(long forceInitialDelay) method call restartIfNeeded passing period, wdyt</technical_language>

Target:
private void restartIfNeeded() { if (isStarted()) { stop(); start(); } }
Source:
<code>public IModel retexture(ImmutableMap<String, String> textures) { List<ResourceLocation> locations = new ArrayList<>(); List<IModel> models = new ArrayList<>(); ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder(); for (Variant variant : this.variants) { ResourceLocation loc = variant.getModelLocation(); locations.add(loc); IModel model; if (loc.equals(MISSING)) { model = ModelLoaderRegistry.getMissingModel(); } else { try { model = ModelLoaderRegistry.getModel(loc); } catch (Exception e) { <START> throw new RuntimeException(e); <END> } } model = variant.process(model); for (ResourceLocation location : model.getDependencies()) { ModelLoaderRegistry.getModelOrMissing(location); } model = model.retexture(textures); models.add(model); builder.add(Pair.of(model, variant.getState())); } if (models.isEmpty()) { IModel missing = ModelLoaderRegistry.getMissingModel(); models.add(missing); builder.add(Pair.of(missing, TRSRTransformation.identity())); } return new SimpleModel(locations, models, variants, new MultiModelState(builder.build())); }</code><technical_language>this java Throwables.throwIfUnchecked(e); throw new RuntimeException(e); exception is wrapped if needs be. find out more here: <LINK_0></technical_language>

Target:
public IModel retexture(ImmutableMap<String, String> textures) { List<ResourceLocation> locations = new ArrayList<>(); List<IModel> models = new ArrayList<>(); ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder(); for (Variant variant : this.variants) { ResourceLocation loc = variant.getModelLocation(); locations.add(loc); IModel model; if (loc.equals(MISSING)) { model = ModelLoaderRegistry.getMissingModel(); } else { try { model = ModelLoaderRegistry.getModel(loc); } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } } model = variant.process(model); for (ResourceLocation location : model.getDependencies()) { ModelLoaderRegistry.getModelOrMissing(location); } model = model.retexture(textures); models.add(model); builder.add(Pair.of(model, variant.getState())); } if (models.isEmpty()) { IModel missing = ModelLoaderRegistry.getMissingModel(); models.add(missing); builder.add(Pair.of(missing, TRSRTransformation.identity())); } return new SimpleModel(locations, models, variants, new MultiModelState(builder.build())); }
Source:
<code>public void accept(OutputFrame outputFrame) { OutputFrame.OutputType outputType = outputFrame.getType(); String utf8String = outputFrame.getUtf8String(); utf8String = utf8String.replaceAll(FrameConsumerResultCallback.LINE_BREAK_AT_END_REGEX, ""); Map<String, String> originalMdc = MDC.getCopyOfContextMap(); MDC.setContextMap(mdc); try { switch (outputType) { case END: break; case STDOUT: logger.info("{}{}", prefix.isEmpty() ? "" : (prefix + ": "), utf8String); break; case STDERR: <START> logger.error("{}{}", prefix.isEmpty() ? "" : (prefix + ": "), utf8String); <END> break; default: throw new IllegalArgumentException("Unexpected outputType " + outputType); } } finally { if (originalMdc == null) { MDC.clear(); } else { MDC.setContextMap(originalMdc); } } }</code><technical_language>This feels a tad risky; STDERR solely for 'error' output in practice, confusion map logger's error level. I of situations right answer..</technical_language>

Target:
public void accept(OutputFrame outputFrame) { OutputFrame.OutputType outputType = outputFrame.getType(); String utf8String = outputFrame.getUtf8String(); utf8String = utf8String.replaceAll(FrameConsumerResultCallback.LINE_BREAK_AT_END_REGEX, ""); Map<String, String> originalMdc = MDC.getCopyOfContextMap(); MDC.setContextMap(mdc); try { switch (outputType) { case END: break; case STDOUT: if (separateOutputStreams) { logger.info("{}{}", prefix.isEmpty() ? "" : (prefix + ": "), utf8String); } else { logger.info("{}{}: {}", prefix, outputType, utf8String); } break; case STDERR: if (separateOutputStreams) { logger.error("{}{}", prefix.isEmpty() ? "" : (prefix + ": "), utf8String); } else { logger.info("{}{}: {}", prefix, outputType, utf8String); } break; default: throw new IllegalArgumentException("Unexpected outputType " + outputType); } } finally { if (originalMdc == null) { MDC.clear(); } else { MDC.setContextMap(originalMdc); } } }
Source:
<code>public static void writeObjectToConfig(Object o, Configuration config, String key) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); byte[] bytes = baos.toByteArray(); config.setBytes(key, bytes); <START> oos.close(); <END> }</code><technical_language>I this oos.writeObject(o);, in case is buffered data. In case, obtaining byte[] result</technical_language>

Target:
public static void writeObjectToConfig(Object o, Configuration config, String key) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); byte[] bytes = baos.toByteArray(); config.setBytes(key, bytes); }
Source:
<code>private DataSource getDatasource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(config.getDatabaseUser()); dataSource.setPassword(config.getDatabasePassword()); dataSource.setUrl(config.getDatabaseConnectURI()); if (config.isValidationQuery()) { <START> dataSource.setValidationQuery("SELECT 1"); <END> dataSource.setTestOnBorrow(true); } return dataSource; }</code><technical_language>validation query set a parameter</technical_language>

Target:
private DataSource getDatasource() { BasicDataSource dataSource = new BasicDataSource(); dataSource.setUsername(config.getDatabaseUser()); dataSource.setPassword(config.getDatabasePassword()); dataSource.setUrl(config.getDatabaseConnectURI()); if (config.isValidationQuery()) { dataSource.setValidationQuery(config.getValidationQuery()); dataSource.setTestOnBorrow(true); } return dataSource; }
Source:
<code>public <A extends Arg> BuildRule createBuildRule( TargetGraph targetGraph, BuildRuleParams params, BuildRuleResolver resolver, A args) throws NoSuchBuildTargetException { SourcePathResolver pathResolver = new SourcePathResolver(resolver); BuildTarget abiJarTarget = params.getBuildTarget().withAppendedFlavors(CalculateAbi.FLAVOR); ImmutableSortedSet<BuildRule> exportedDeps = resolver.getAllRules(args.exportedDeps.get()); DefaultJavaLibrary defaultJavaLibrary = resolver.addToIndex( new DefaultJavaLibrary( params.appendExtraDeps( BuildRules.getExportedRules( Iterables.concat( params.getDeclaredDeps().get(), exportedDeps, resolver.getAllRules(args.providedDeps.get())))), pathResolver, args.srcs.get(), validateResources( pathResolver, params.getProjectFilesystem(), args.resources.get()), Optional.<Path>absent(), Optional.<SourcePath>absent(), ImmutableList.<String>of(), exportedDeps, resolver.getAllRules(args.providedDeps.get()), new BuildTargetSourcePath(abiJarTarget), false, ImmutableSet.<Path>of(), new KotlincToJarStepFactory( kotlinBuckConfig.getKotlinCompiler().get(), <START> args.extraKotlincArguments.or(ImmutableList.<String>of())), <END> Optional.<Path>absent(), Optional.<String>absent(), ImmutableSortedSet.<BuildTarget>of(), ImmutableSet.<Pattern>of())); resolver.addToIndex( CalculateAbi.of( abiJarTarget, pathResolver, params, new BuildTargetSourcePath(defaultJavaLibrary.getBuildTarget()))); return defaultJavaLibrary; }</code><technical_language>need for here, coercer map absent empty list: <LINK_0></technical_language>

Target:
public <A extends Arg> BuildRule createBuildRule( TargetGraph targetGraph, BuildRuleParams params, BuildRuleResolver resolver, A args) throws NoSuchBuildTargetException { SourcePathResolver pathResolver = new SourcePathResolver(resolver); BuildTarget abiJarTarget = params.getBuildTarget().withAppendedFlavors(CalculateAbi.FLAVOR); ImmutableSortedSet<BuildRule> exportedDeps = resolver.getAllRules(args.exportedDeps.get()); DefaultJavaLibrary defaultJavaLibrary = resolver.addToIndex( new DefaultJavaLibrary( params.appendExtraDeps( BuildRules.getExportedRules( Iterables.concat( params.getDeclaredDeps().get(), exportedDeps, resolver.getAllRules(args.providedDeps.get())))), pathResolver, args.srcs.get(), validateResources( pathResolver, params.getProjectFilesystem(), args.resources.get()), Optional.<Path>absent(), Optional.<SourcePath>absent(), ImmutableList.<String>of(), exportedDeps, resolver.getAllRules(args.providedDeps.get()), new BuildTargetSourcePath(abiJarTarget), false, ImmutableSet.<Path>of(), new KotlincToJarStepFactory( kotlinBuckConfig.getKotlinCompiler().get(), args.extraKotlincArguments.get()), Optional.<Path>absent(), Optional.<String>absent(), ImmutableSortedSet.<BuildTarget>of(), ImmutableSet.<Pattern>of())); resolver.addToIndex( CalculateAbi.of( abiJarTarget, pathResolver, params, new BuildTargetSourcePath(defaultJavaLibrary.getBuildTarget()))); return defaultJavaLibrary; }
Source:
<code>public TestLayoutBuilder() { sequencerServers = new ArrayList<>(); layoutServers = new ArrayList<>(); unresponsiveServers = new ArrayList<>(); segments = new ArrayList<>(); <START> clusterId = UUID.fromString("00000000-0000-0000-0000-000000000000"); <END> }</code><technical_language>Layout.INVALID_CLUSTER_ID</technical_language>

Target:
public TestLayoutBuilder() { sequencerServers = new ArrayList<>(); layoutServers = new ArrayList<>(); unresponsiveServers = new ArrayList<>(); segments = new ArrayList<>(); clusterId = Layout.INVALID_CLUSTER_ID; }
Source:
<code>private void connectToQueue() throws IOException { ConnectionFactory factory = this.getConnectionFactory(); factory.setHost(this.properties.getProperty("queue.host")); factory.setPort(Integer.parseInt(this.properties.getProperty("queue.port"))); factory.setUsername(this.properties.getProperty("queue.username")); factory.setPassword(this.properties.getProperty("queue.password")); factory.setVirtualHost(this.properties.getProperty("queue.vhost")); factory.setAutomaticRecoveryEnabled(true); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); String exchangeName = this.properties.getProperty("queue.exchangeName"); String[] bindKeys = this.properties.getProperty("queue.bindKey").split(","); channel.exchangeDeclare(exchangeName, "topic", true); String queueName = channel.queueDeclare().getQueue(); for (String bindKey : bindKeys) { <START> bindKey = bindKey.trim(); <END> channel.queueBind(queueName, exchangeName, bindKey); LOG.info("[*] Subscribed on topic exchange '" + exchangeName + "' using binding key '" + bindKey + "'"); } LOG.info("[*] Waiting for messages..."); channel.basicQos(2); channel.basicConsume(queueName, true, this.getWorkerConsumer(channel, worker)); }</code><technical_language>is .trim() added here? properties list separator a ',' whitespaces</technical_language>

Target:
private void connectToQueue() throws IOException { ConnectionFactory factory = this.getConnectionFactory(); factory.setHost(this.properties.getProperty("queue.host")); factory.setPort(Integer.parseInt(this.properties.getProperty("queue.port"))); factory.setUsername(this.properties.getProperty("queue.username")); factory.setPassword(this.properties.getProperty("queue.password")); factory.setVirtualHost(this.properties.getProperty("queue.vhost")); factory.setAutomaticRecoveryEnabled(true); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); String exchangeName = this.properties.getProperty("queue.exchangeName"); List<String> bindKeys = Arrays.asList(this.properties.getProperty("queue.bindKey").split(",")); channel.exchangeDeclare(exchangeName, "topic", true); String queueName = channel.queueDeclare().getQueue(); for (String bindKey : bindKeys) { channel.queueBind(queueName, exchangeName, bindKey); LOG.info("[*] Subscribed on topic exchange '" + exchangeName + "' using binding key '" + bindKey + "'"); } LOG.info("[*] Waiting for messages..."); channel.basicQos(2); channel.basicConsume(queueName, true, this.getWorkerConsumer(channel, worker)); }
Source:
<code>public ExponentiallyWeightedInterpolationQuantileMethod(double lambda) { <START> this.lambda = lambda; <END> }</code><technical_language>constraint range of lambda? formula calculating weights breaks in some cases</technical_language>

Target:
public ExponentiallyWeightedInterpolationQuantileMethod(double lambda) { ArgChecker.inRangeExclusive(lambda, 0.0d, 1.0d, "exponential weight"); this.lambda = lambda; }
Source:
<code>public Float getFinishedPercentage() { int totalSpectra = spectra.size(); <START> return totalSpectra == 0 ? null : (float) (processedSpectra / totalSpectra); <END> }</code><technical_language>This work, processedSpectra equal totalSpectra. I in this case is difficult estimate progress (the track number of bytes read divide file size), return null</technical_language>

Target:
public Float getFinishedPercentage() { return null; }
Source:
<code>private StatusAdapter getSingleSelection() { IStructuredSelection selection = statusListViewer.getStructuredSelection(); <START> if (selection.size() == 1) { <END> return (StatusAdapter) selection.getFirstElement(); } return null; }</code><technical_language>Remove if check simply return getFirstElement</technical_language>

Target:
private StatusAdapter getSingleSelection() { return (StatusAdapter) statusListViewer.getStructuredSelection().getFirstElement(); }
Source:
<code>private String svg() throws Exception { return new XSLT( new StreamSource( IOUtils.toInputStream( this.build.info( this.uriInfo().getBaseUri(), this.stand ) ) ), new StreamSource( IOUtils.toInputStream( String.format( IOUtils.toString( servletContext() .getResourceAsStream("/xsl/button.xsl") ) <START> , <END> this.rule ) ) ) ).xml(); }</code><technical_language>this comma is next line?</technical_language>

Target:
private String svg() throws Exception { return new XSLT( new StreamSource( IOUtils.toInputStream( this.build.info( this.uriInfo().getBaseUri(), this.stand ) ) ), new StreamSource( IOUtils.toInputStream( String.format( IOUtils.toString( this.getClass().getResourceAsStream( "button.xsl" ) ), this.rule ) ) ) ).xml(); }
Source:
<code>public String encode(String data) { String encodedData = ""; for (int i = 0; i < data.length(); i++) { char c = data.charAt(i); if (i != 0 && c == data.charAt(i - 1)) continue; int amt = 1; for (int j = i + 1; j < data.length() && c == data.charAt(j); j++) { amt++; } if (amt == 1) encodedData += c; <START> else encodedData += amt + Character.toString(c); <END> } return encodedData; }</code><technical_language>a good idea put curly brackets branch, i.e. if (amt == 1) { encodedData += c; } else { encodedData += amt = Character.toString(c) } [StringBuilder](<LINK_0> appending string a bit easier (and more performant) :)</technical_language>

Target:
public String encode(String data) { StringBuilder encodedDataBuilder = new StringBuilder(); if (data.length() == 0) { return data; } int previousCharCount = 1; char previousChar = data.charAt(0); for (int i = 1; i < data.length(); i++) { char currentChar = data.charAt(i); if (previousChar == currentChar) { previousCharCount++; } if (previousChar != currentChar || i == data.length() - 1) { addChars(encodedDataBuilder, previousChar, previousCharCount); if (previousChar != currentChar && i == data.length() - 1) { addChars(encodedDataBuilder, currentChar, 1); } previousChar = currentChar; previousCharCount = 1; } } return encodedDataBuilder.toString(); }
Source:
<code>public String read(String key) { String data = dataManager.read(key); <START> return (data != null) ? encode(cryptoBox.decrypt(iv, decode(data))) : data; <END> }</code><technical_language>I flip this for clarity: return data == null ? null : encode(cryptoBox.decrypt(iv, decode(data));</technical_language>

Target:
public String read(String key) { String data = dataManager.read(key); return (data == null) ? null : encode(cryptoBox.decrypt(iv, decode(data))); }
Source:
<code>public SpringServiceImpl withTracing(String appInsightInstrumentationKey) { <START> this.addPostRunDependent( context -> manager().inner().getMonitoringSettings() .updatePatchAsync(resourceGroupName(), name(), new MonitoringSettingProperties() .withAppInsightsInstrumentationKey(appInsightInstrumentationKey) .withTraceEnabled(true)) .then(context.voidMono()) ); <END> return this; }</code><technical_language>object configured, delay postRunDependency e.g. beforeCreating</technical_language>

Target:
public SpringServiceImpl withTracing(String appInsightInstrumentationKey) { monitoringSettingTask = context -> manager().inner().getMonitoringSettings() .updatePatchAsync(resourceGroupName(), name(), new MonitoringSettingProperties() .withAppInsightsInstrumentationKey(appInsightInstrumentationKey) .withTraceEnabled(true)) .then(context.voidMono()); return this; }
Source:
<code>public IAtsCountry getCountry(IAtsProgram atsProgram) { IAtsCountry country = null; ArtifactReadable artifact = ((ArtifactReadable) atsProgram.getStoreObject()); if (artifact != null) { <START> country = atsServer.getConfigItemFactory().getCountry(artifact); <END> } return country; }</code><technical_language>is IAtsProgram IAtsCountry? Here, IAtsProgram (ArtifactReadable) is passed getCountry. implementation of getCountry checks if ArtifactReadable passed is instance of a Country. produce desired result. If this is issue, I of Object in method signatures needs addressed. would've pointed this issue out</technical_language>

Target:
public IAtsCountry getCountry(IAtsProgram atsProgram) { IAtsCountry country = null; ArtifactReadable artifact = ((ArtifactReadable) atsProgram.getStoreObject()); if (artifact != null) { ArtifactReadable countryArt = artifact.getRelated(AtsRelationTypes.CountryToProgram_Country).getAtMostOneOrNull(); if (countryArt != null) { country = atsServer.getConfigItemFactory().getCountry(countryArt); } } return country; }
Source:
<code><START> private Guid getVmToAttach(NGuid poolId) { <END> if (vmToAttach == null) { Guid vmGuid = Guid.Empty; vmGuid = getPrestartedVmToAttach(poolId); if (vmGuid == null || Guid.Empty.equals(vmGuid)) { vmGuid = getNonPrestartedVmToAttach(poolId); } vmToAttach = vmGuid; } return vmToAttach; }</code><technical_language>this method is called canDoAction a lock prevent attaching a vm users, i this patch breaks this</technical_language>

Target:
private Guid getVmToAttach(NGuid poolId) { if (vmToAttach == null) { Guid vmGuid = getPrestartedVmToAttach(poolId); if (vmGuid == null || Guid.Empty.equals(vmGuid)) { vmGuid = getNonPrestartedVmToAttach(poolId); } vmToAttach = vmGuid; } return vmToAttach; }
Source:
<code>public String toString() { StringBuilder b = new StringBuilder(); <START> b.append("Commit(id:" + commitMetadata.getCommitId()); <END> b.append(", snapshots:" + snapshots.size()); b.append(", " + diff.toString()); b.append(")"); return b.toString(); }</code><technical_language>getId() :)</technical_language>

Target:
public String toString() { StringBuilder b = new StringBuilder(); b.append("Commit(id:" + commitMetadata.getId()); b.append(", snapshots:" + snapshots.size()); b.append(", " + diff.toString()); b.append(")"); return b.toString(); }
Source:
<code>public ControllerPermission(String name, String actions) { super(name, actions); <START> } <END></code><technical_language>do this constructor</technical_language>

Target:
public ControllerPermission(String name, String actions) { super(validatePermissionName(name), validatePermissionActions(actions)); }