auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public ArrayInterface setDate(int index, Date value) { <END> return setObject(index, value); }</code><technical_language>I return Array here</technical_language>

Target:
public Array setDate(int index, Date value) { return setObject(index, value); }
Source:
<code>public void addDocument(BytesReference document, String index, String indexType, int ttlMs) throws Exception { Map<String, Map<String, String>> parameters = new HashMap<String, Map<String, String>>(); Map<String, String> indexParameters = new HashMap<String, String>(); indexParameters.put(INDEX_PARAM, index); indexParameters.put(TYPE_PARAM, indexType); if (ttlMs > 0) { indexParameters.put(TTL_PARAM, Long.toString(ttlMs)); } parameters.put(INDEX_OPERATION_NAME, indexParameters); XContentBuilder documentBuilder = jsonBuilder().value(parameters); <START> synchronized (bulkBuilder) { <END> bulkBuilder.append(documentBuilder.bytes().toUtf8()); bulkBuilder.append("\n"); bulkBuilder.append(document.toBytesArray().toUtf8()); bulkBuilder.append("\n"); } }</code><technical_language>consider instance of XContentBuilder morphline command instance, synchronization is necessary, scalability number of cores</technical_language>

Target:
public void addDocument(BytesReference document, String index, String indexType, int ttlMs) throws Exception { Map<String, Map<String, String>> parameters = new HashMap<String, Map<String, String>>(); Map<String, String> indexParameters = new HashMap<String, String>(); indexParameters.put(INDEX_PARAM, index); indexParameters.put(TYPE_PARAM, indexType); if (ttlMs > 0) { indexParameters.put(TTL_PARAM, Long.toString(ttlMs)); } parameters.put(INDEX_OPERATION_NAME, indexParameters); bulkBuilder.append(jsonBuilder().value(parameters).bytes().toUtf8()); bulkBuilder.append("\n"); bulkBuilder.append(document.toBytesArray().toUtf8()); bulkBuilder.append("\n"); }
Source:
<code>public void bind(final EditorSession session) { super.bind(session); <START> if(stateControlInitializer.isKogitoEnabled()) { <END> stateControlInitializer.setUndoCommand(this::execute); } else { session.getKeyboardControl().addKeyShortcutCallback(this::onKeyDownEvent); } }</code><technical_language>formatting</technical_language>

Target:
public void bind(final EditorSession session) { super.bind(session); bindCommand(); }
Source:
<code><START> public boolean canAmend() { return true; } <END></code><technical_language>support amend bisect</technical_language>

Target:
public boolean canAmend() { return false; }
Source:
<code>void getGames() { cache.put(ID_0, lobbyGame0); cache.put(new GameId(API_KEY_0, GAME_ID_1), lobbyGame1); cache.put(new GameId(API_KEY_1, GAME_ID_2), lobbyGame2); final List<LobbyGameListing> result = gameListing.getGames(); <START> assertThat((long) result.size(), is(cache.size())); <END> assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_0).lobbyGame(lobbyGame0).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_1).lobbyGame(lobbyGame1).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_2).lobbyGame(lobbyGame2).build())); }</code><technical_language>nit, I more conventional hamcrest 'actual' "naked" (so cast moved expected value). In this case though, right matcher achieve that, eg: assertThat(result, IsCollectionWithSize.hasSize(cache.size())</technical_language>

Target:
void getGames() { cache.put(ID_0, lobbyGame0); cache.put(new GameId(API_KEY_0, GAME_ID_1), lobbyGame1); cache.put(new GameId(API_KEY_1, GAME_ID_2), lobbyGame2); final List<LobbyGameListing> result = gameListing.getGames(); assertThat(result.size(), is((int) cache.size())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_0).lobbyGame(lobbyGame0).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_1).lobbyGame(lobbyGame1).build())); assertThat( result, IsCollectionContaining.hasItem( LobbyGameListing.builder().gameId(GAME_ID_2).lobbyGame(lobbyGame2).build())); }
Source:
<code>public Mono<Long> scheduleMessage(ServiceBusMessage message, Instant scheduledEnqueueTime) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(scheduledEnqueueTime, "'scheduledEnqueueTime' cannot be null."); return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName)) .flatMap(x -> x.schedule(message, scheduledEnqueueTime)) <START> .flatMap(scheduleSequenceNumber -> { <END> System.out.println(getClass().getName() + ".schedule scheduleSequenceNumber = " + scheduleSequenceNumber); return Mono.just(scheduleSequenceNumber); }); }</code><technical_language>map is sufficient this is asynchronous operation. replace usage of System.out logger</technical_language>

Target:
public Mono<Long> scheduleMessage(ServiceBusMessage message, Instant scheduledEnqueueTime) { Objects.requireNonNull(message, "'message' cannot be null."); Objects.requireNonNull(scheduledEnqueueTime, "'scheduledEnqueueTime' cannot be null."); return getSendLink() .flatMap(link -> link.getLinkSize().flatMap(size -> { int maxSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; return connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName, entityType)) .flatMap(managementNode -> managementNode.schedule(message, scheduledEnqueueTime, maxSize)); })); }
Source:
<code>private BasicDBObject createItemInsertQuery(final String userId, final String itemId, final School.ItemType itemType) { final BasicDBObject query = new BasicDBObject(DatabaseStringConstants.SELF_ID, new ObjectId(itemId)); if (School.ItemType.COURSE.equals(itemType)) { query.append(DatabaseStringConstants.COURSE_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } <START> if (School.ItemType.BANK_PROBLEM.equals(itemType)) { <END> query.append(DatabaseStringConstants.PROBLEM_BANK_ID, itemId) .append(DatabaseStringConstants.OWNER_ID, userId); } return query; }</code><technical_language>else-if</technical_language>

Target:
private BasicDBObject createItemInsertQuery(final String userId, final String itemId, final School.ItemType itemType) { final BasicDBObject query = new BasicDBObject(DatabaseStringConstants.SELF_ID, new ObjectId(itemId)); if (School.ItemType.COURSE.equals(itemType)) { query.append(DatabaseStringConstants.COURSE_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } else if (School.ItemType.BANK_PROBLEM.equals(itemType)) { query.append(DatabaseStringConstants.PROBLEM_BANK_ID, new ObjectId(itemId)) .append(DatabaseStringConstants.OWNER_ID, userId); } return query; }
Source:
<code><START> public void run() { <END> try { if (this.zooCache == null) { Instance instance = HdfsZooInstance.getInstance(); this.path = ZooUtil.getRoot(instance) + Constants.ZMONITOR_LOG4J_ADDR; this.zooCache = new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()); } Stat stat = new Stat(); byte[] loc = zooCache.get(path, stat); long modifiedTransactionId = stat.getMzxid(); if (modifiedTransactionId != lastModifiedTransactionId) { switchAppender(loc, modifiedTransactionId); } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>tests for this new code? :wink:</technical_language>

Target:
public void run() { try { MonitorLocation currentLocation = currentLocationSupplier.get(); if (!currentLocation.equals(lastLocation)) { if (lastSocketAppender != null) { parentAsyncAppender.removeAppender(lastSocketAppender); lastSocketAppender.close(); lastSocketAppender = null; } if (currentLocation.hasLocation()) { lastSocketAppender = appenderFactory.apply(currentLocation); lastSocketAppender.activateOptions(); parentAsyncAppender.addAppender(lastSocketAppender); } lastLocation = currentLocation; } } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>private int traverse(Deque<Chunk> traversedChunksDeque) { Chunk currentChunk; activeChunkLock.lock(); try { currentChunk = activeChunk; } finally { activeChunkLock.unlock(); } int valuesSize = 0; while (true) { valuesSize += currentChunk.cursor - currentChunk.startIndex; if (traversedChunksDeque != null) { traversedChunksDeque.addLast(currentChunk); } if (currentChunk.tailChunk == null) { break; } <START> currentChunk = currentChunk.tailChunk; <END> } return valuesSize; }</code><technical_language>Reading mutable fields synchronization. trim put do mutation of: - cursor - startIndex - tailChunk result totaly wrong, negative</technical_language>

Target:
private int traverse(Deque<Chunk> traversedChunksDeque) { Chunk currentChunk = activeChunk; int valuesSize = 0; while (true) { valuesSize += currentChunk.cursor - currentChunk.startIndex; if (traversedChunksDeque != null) { traversedChunksDeque.addLast(currentChunk); } if (currentChunk.tailChunk == null) { break; } currentChunk = currentChunk.tailChunk; } return valuesSize; }
Source:
<code>public ServiceCall<UtterancesTone> getChatTone(ToneChatInput chatInput) { <START> Validator.notNull(chatInput, "text cannot be null"); <END> RequestBuilder requestBuilder = RequestBuilder.post(PATH_CHAT_TONE).query(VERSION_DATE, versionDate); requestBuilder.bodyJson(GsonSingleton.getGson().toJsonTree(chatInput).getAsJsonObject()); return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(UtterancesTone.class)); }</code><technical_language>text null</technical_language>

Target:
public ServiceCall<UtterancesTone> getChatTone(ToneChatInput chatInput) { Validator.notNull(chatInput.getUtterances(), "Input utterances cannot be null"); RequestBuilder requestBuilder = RequestBuilder.post(PATH_CHAT_TONE).query(VERSION_DATE, versionDate); requestBuilder.bodyJson(GsonSingleton.getGson().toJsonTree(chatInput).getAsJsonObject()); return createServiceCall(requestBuilder.build(), ResponseConverterUtils.getObject(UtterancesTone.class)); }
Source:
<code><START> private String verhoeffChecksum(String input) { <END> int[][] op = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 2, 3, 4, 0, 6, 7, 8, 9, 5}, {2, 3, 4, 0, 1, 7, 8, 9, 5, 6}, {3, 4, 0, 1, 2, 8, 9, 5, 6, 7}, {4, 0, 1, 2, 3, 9, 5, 6, 7, 8}, {5, 9, 8, 7, 6, 0, 4, 3, 2, 1}, {6, 5, 9, 8, 7, 1, 0, 4, 3, 2}, {7, 6, 5, 9, 8, 2, 1, 0, 4, 3}, {8, 7, 6, 5, 9, 3, 2, 1, 0, 4}, {9, 8, 7, 6, 5, 4, 3, 2, 1, 0} }; int[][] p = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 5, 7, 6, 2, 8, 3, 0, 9, 4}, {5, 8, 0, 3, 7, 9, 6, 1, 4, 2}, {8, 9, 1, 6, 0, 4, 3, 5, 2, 7}, {9, 4, 5, 3, 1, 2, 6, 8, 7, 0}, {4, 2, 8, 6, 5, 7, 3, 9, 0, 1}, {2, 7, 9, 3, 8, 0, 6, 4, 1, 5}, {7, 0, 4, 6, 9, 1, 3, 2, 5, 8} }; int[] inv = {0, 4, 3, 2, 1, 5, 6, 7, 8, 9}; int check = 0; String[] mArray = ArrayUtilities.reverse(StringUtils.toArray(input), String[].class); for (int i = 0; i < mArray.length; i++) { check = op[check][p[((i + 1) % 8)][Integer.parseInt(mArray[i])]]; } return Integer.toString(inv[check]); }</code><technical_language>static</technical_language>

Target:
private static String verhoeffChecksum(String input) { int[][] op = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 2, 3, 4, 0, 6, 7, 8, 9, 5}, {2, 3, 4, 0, 1, 7, 8, 9, 5, 6}, {3, 4, 0, 1, 2, 8, 9, 5, 6, 7}, {4, 0, 1, 2, 3, 9, 5, 6, 7, 8}, {5, 9, 8, 7, 6, 0, 4, 3, 2, 1}, {6, 5, 9, 8, 7, 1, 0, 4, 3, 2}, {7, 6, 5, 9, 8, 2, 1, 0, 4, 3}, {8, 7, 6, 5, 9, 3, 2, 1, 0, 4}, {9, 8, 7, 6, 5, 4, 3, 2, 1, 0} }; int[][] p = new int[][]{ {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}, {1, 5, 7, 6, 2, 8, 3, 0, 9, 4}, {5, 8, 0, 3, 7, 9, 6, 1, 4, 2}, {8, 9, 1, 6, 0, 4, 3, 5, 2, 7}, {9, 4, 5, 3, 1, 2, 6, 8, 7, 0}, {4, 2, 8, 6, 5, 7, 3, 9, 0, 1}, {2, 7, 9, 3, 8, 0, 6, 4, 1, 5}, {7, 0, 4, 6, 9, 1, 3, 2, 5, 8} }; int[] inv = {0, 4, 3, 2, 1, 5, 6, 7, 8, 9}; ArrayList<Character> inputList = StringUtils.toList(input); Collections.reverse(inputList); int check = 0; for (int i = 0; i < inputList.size(); i++) { check = op[check][p[((i + 1) % 8)][Character.getNumericValue(inputList.get(i))]]; } return Integer.toString(inv[check]); }
Source:
<code>public List<Constituent> getConstituentsOverlappingCharSpan(int charStart, int charEnd) { Set<Constituent> output = new HashSet<>(); for(Constituent c : this.constituents) { if((c.startCharOffset <= charStart && c.endCharOffset >= charStart) || <START> (c.startCharOffset >= charEnd && c.endCharOffset <= charEnd) || <END> (c.startCharOffset >= charStart && c.endCharOffset <= charEnd) || (c.startCharOffset <= charStart && c.endCharOffset >= charEnd)) output.add(c); } List<Constituent> list = new ArrayList<>(output); Collections.sort(list, TextAnnotationUtilities.constituentStartComparator); return list; }</code><technical_language>condition incorrect. This capture empty constituents spanning (charEnd, charEnd)</technical_language>

Target:
public List<Constituent> getConstituentsOverlappingCharSpan(int charStart, int charEnd) { assert charStart <= charEnd: "The start offset should be smaller than the end offset"; Set<Constituent> output = new HashSet<>(); for(Constituent c : this.constituents) { if((c.startCharOffset <= charStart && c.endCharOffset >= charStart) || (c.startCharOffset <= charEnd && c.endCharOffset >= charEnd) || (c.startCharOffset >= charStart && c.endCharOffset <= charEnd) || (c.startCharOffset <= charStart && c.endCharOffset >= charEnd)) output.add(c); } List<Constituent> list = new ArrayList<>(output); Collections.sort(list, TextAnnotationUtilities.constituentStartComparator); return list; }
Source:
<code><START> private void whole(final long pos, final int type, final long sz) <END> throws IOException { objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); final byte[] data; boolean checkContentLater = false; if (type == Constants.OBJ_BLOB) { byte[] readBuffer = buffer(); InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = isCheckObjectCollisions() && readCurs.has(tempObjectId); data = null; } else { data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); } verifySafeObject(tempObjectId, type, data, sz); PackedObjectInfo obj = newInfo(tempObjectId, null, null); obj.setOffset(pos); onEndWholeObject(obj); if (data != null) onInflatedObjectData(obj, type, data); addObjectAndTrack(obj); if (checkContentLater) deferredCheckBlobs.add(obj); }</code><technical_language>Put a max object size check start of this method, update objectDigest, sz parameter. This allow catch object is in pack file in "whole" representation commit allocating buffer for it, computing SHA-1. downside is user SHA-1 is of huge object. I argue try, expensive inflate compute SHA-1 of is big rejected server. if want do that, instead do type == BLOB case below</technical_language>

Target:
private void whole(final long pos, final int type, final long sz) throws IOException { checkIfTooLarge(sz); objectDigest.update(Constants.encodedTypeString(type)); objectDigest.update((byte) ' '); objectDigest.update(Constants.encodeASCII(sz)); objectDigest.update((byte) 0); final byte[] data; boolean checkContentLater = false; if (type == Constants.OBJ_BLOB) { byte[] readBuffer = buffer(); InputStream inf = inflate(Source.INPUT, sz); long cnt = 0; while (cnt < sz) { int r = inf.read(readBuffer); if (r <= 0) break; objectDigest.update(readBuffer, 0, r); cnt += r; } inf.close(); tempObjectId.fromRaw(objectDigest.digest(), 0); checkContentLater = isCheckObjectCollisions() && readCurs.has(tempObjectId); data = null; } else { data = inflateAndReturn(Source.INPUT, sz); objectDigest.update(data); tempObjectId.fromRaw(objectDigest.digest(), 0); verifySafeObject(tempObjectId, type, data); } PackedObjectInfo obj = newInfo(tempObjectId, null, null); obj.setOffset(pos); onEndWholeObject(obj); if (data != null) onInflatedObjectData(obj, type, data); addObjectAndTrack(obj); if (checkContentLater) deferredCheckBlobs.add(obj); }
Source:
<code>public void init(ZeppelinConfiguration zConf) throws IOException { <START> this.fs = new FileSystemStorage(zConf, <END> zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_RECOVERY_DIR)); LOGGER.info("Creating FileSystem: " + this.fs.getFs().getClass().getName() + " for Zeppelin Notebook."); this.notebookDir = this.fs.makeQualified(new Path(zConf.getNotebookDir())); LOGGER.info("Using folder to store notebook", notebookDir); this.fs.tryMkDir(notebookDir); }</code><technical_language>change path notebook recovery</technical_language>

Target:
public void init(ZeppelinConfiguration zConf) throws IOException { this.fs = new FileSystemStorage(zConf, zConf.getString(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR)); LOGGER.info("Creating FileSystem: " + this.fs.getFs().getClass().getName() + " for Zeppelin Notebook."); this.notebookDir = this.fs.makeQualified(new Path(zConf.getNotebookDir())); LOGGER.info("Using folder to store notebook", notebookDir); this.fs.tryMkDir(notebookDir); }
Source:
<code>public NotifyingFuture<Void> putAllAsync(final Map<? extends K, ? extends V> data, final long lifespan, final TimeUnit lifespanUnit, final long maxIdle, final TimeUnit maxIdleUnit) { assertRemoteCacheManagerIsStarted(); final NotifyingFutureImpl<Void> result = new NotifyingFutureImpl<Void>(); Future<Void> future = executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { <START> final ArrayList<NotifyingFuture<V>> putList = new ArrayList<NotifyingFuture<V>>(); <END> for (java.util.Map.Entry<? extends K, ? extends V> x : data.entrySet()) { putList.add(putAsync(x.getKey(), x.getValue(), lifespan, lifespanUnit, maxIdle, maxIdleUnit)); } for (NotifyingFuture<V> f : putList) { while (!f.isDone()) { try { Thread.sleep(1); } catch (InterruptedException x) { } } } try { result.notifyDone(null); } catch (Throwable t) { log.trace("Error when notifying", t); } return null; } catch (Exception e) { try { result.notifyException(e); } catch (Throwable t) { log.trace("Error when notifying", t); } throw e; } } }); result.setFuture(future); return result; }</code><technical_language>array list initialized size of map. is common practice interface in definition of variable. (ie. final List<NotifyingFuture<V>>..)</technical_language>

Target:
public NotifyingFuture<Void> putAllAsync(final Map<? extends K, ? extends V> data, final long lifespan, final TimeUnit lifespanUnit, final long maxIdle, final TimeUnit maxIdleUnit) { assertRemoteCacheManagerIsStarted(); final NotifyingFutureImpl<Void> result = new NotifyingFutureImpl<Void>(); Future<Void> future = executorService.submit(new Callable<Void>() { @Override public Void call() throws Exception { try { final ArrayList<NotifyingFuture<V>> putList = new ArrayList<NotifyingFuture<V>>(data.size()); for (java.util.Map.Entry<? extends K, ? extends V> x : data.entrySet()) { putList.add(putAsync(x.getKey(), x.getValue(), lifespan, lifespanUnit, maxIdle, maxIdleUnit)); } for (NotifyingFuture<V> f : putList) { f.get(); } try { result.notifyDone(null); } catch (Throwable t) { log.trace("Error when notifying", t); } return null; } catch (Exception e) { try { result.notifyException(e); } catch (Throwable t) { log.trace("Error when notifying", t); } throw e; } } }); result.setFuture(future); return result; }
Source:
<code>public List<Map<String, Object>> query(String url, Query query) { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.POST, new URL(url)).setContent( "application/json", jsonMapper.writeValueAsBytes(query) ), responseHandler ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while querying[%s] status[%s] content[%s]", getBrokerURL(), response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<Map<String, Object>>>() { } ); } catch (Exception e) { <START> log.error("exception: " + e.getMessage()); <END> throw Throwables.propagate(e); } }</code><technical_language>if exception is propagated is log needed, handles exception log ?however, if do log, do log.error(e, "exception")</technical_language>

Target:
public List<Map<String, Object>> query(String url, Query query) { try { StatusResponseHolder response = httpClient.go( new Request(HttpMethod.POST, new URL(url)).setContent( "application/json", jsonMapper.writeValueAsBytes(query) ), responseHandler ).get(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { throw new ISE( "Error while querying[%s] status[%s] content[%s]", getBrokerURL(), response.getStatus(), response.getContent() ); } return jsonMapper.readValue( response.getContent(), new TypeReference<List<Map<String, Object>>>() { } ); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void testValidateStorageAccount() throws Exception { System.out.println("validateStorageAccount"); StorageAccountInfo storageAccount = testEnv.sampleStorageAccount; <START> boolean expResult = true; <END> boolean result = WAStorageClient.validateStorageAccount(storageAccount); assertEquals(expResult, result); }</code><technical_language>do test case in classes</technical_language>

Target:
public void testValidateStorageAccount() throws Exception { System.out.println("validateStorageAccount"); StorageAccountInfo storageAccount = testEnv.sampleStorageAccount; boolean result = WAStorageClient.validateStorageAccount(storageAccount); assertEquals(true, result); assertEquals(true,WAStorageClient.validateStorageAccount(new StorageAccountInfo(testEnv.azureStorageAccountName, testEnv.azureStorageAccountKey1, ""))); testEnv.container.deleteIfExists(); }
Source:
<code>public long scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len < 0) { if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { LOG.error("Invalid record found with negative length: {}", len); <START> throw new IOException(); <END> } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } return recLog.fc.position(); } finally { recLog.close(); } }</code><technical_language>please 'message'? useful</technical_language>

Target:
public long scanJournal(long journalId, long journalPos, JournalScanner scanner) throws IOException { JournalChannel recLog; if (journalPos <= 0) { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize); } else { recLog = new JournalChannel(journalDirectory, journalId, journalPreAllocSize, journalWriteBufferSize, journalPos); } int journalVersion = recLog.getFormatVersion(); try { ByteBuffer lenBuff = ByteBuffer.allocate(4); ByteBuffer recBuff = ByteBuffer.allocate(64 * 1024); while (true) { long offset = recLog.fc.position(); lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); int len = lenBuff.getInt(); if (len == 0) { break; } boolean isPaddingRecord = false; if (len < 0) { if (len == PADDING_MASK && journalVersion >= JournalChannel.V5) { lenBuff.clear(); fullRead(recLog, lenBuff); if (lenBuff.remaining() != 0) { break; } lenBuff.flip(); len = lenBuff.getInt(); if (len == 0) { continue; } isPaddingRecord = true; } else { LOG.error("Invalid record found with negative length: {}", len); throw new IOException("Invalid record found with negative length " + len); } } recBuff.clear(); if (recBuff.remaining() < len) { recBuff = ByteBuffer.allocate(len); } recBuff.limit(len); if (fullRead(recLog, recBuff) != len) { break; } recBuff.flip(); if (!isPaddingRecord) { scanner.process(journalVersion, offset, recBuff); } } return recLog.fc.position(); } finally { recLog.close(); } }
Source:
<code><START> public void setDockerImageRepository(DockerImageURI uri) { <END> set(DOCKER_IMAGE_REPO, uri.getAbsoluteUri()); }</code><technical_language>difference #setDockerImageRepositorySpec</technical_language>

Target:
public void setDockerImageRepository(DockerImageURI uri) { setDockerImageRepository(uri.getAbsoluteUri()); }
Source:
<code>private LanguageRegistry() { List<Language> languagesList = new ArrayList<>(); ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class); <START> for (Language aLanguageLoader : languageLoader) { <END> try { languagesList.add(aLanguageLoader); } catch (UnsupportedClassVersionError e) { System.err.println("Ignoring language for PMD: " + e.toString()); } } Collections.sort(languagesList, new Comparator<Language>() { @Override public int compare(Language o1, Language o2) { return o1.getTerseName().compareToIgnoreCase(o2.getTerseName()); } }); languages = new LinkedHashMap<>(); for (Language language : languagesList) { languages.put(language.getName(), language); } }</code><technical_language>careful here. code done loading of Language done try-catch block, allowing capture UnsupportedClassVersionError (when running Java 7 Apex in classpath). This change simply break this point captured skipped</technical_language>

Target:
private LanguageRegistry() { List<Language> languagesList = new ArrayList<>(); ServiceLoader<Language> languageLoader = ServiceLoader.load(Language.class); Iterator<Language> iterator = languageLoader.iterator(); while (iterator.hasNext()) { try { Language language = iterator.next(); languagesList.add(language); } catch (UnsupportedClassVersionError e) { System.err.println("Ignoring language for PMD: " + e.toString()); } } Collections.sort(languagesList, new Comparator<Language>() { @Override public int compare(Language o1, Language o2) { return o1.getTerseName().compareToIgnoreCase(o2.getTerseName()); } }); languages = new LinkedHashMap<>(); for (Language language : languagesList) { languages.put(language.getName(), language); } }
Source:
<code>private void readEnergy() throws InvalidSensorException { byte[] rawArray = statusEnergy.read(); if (rawArray != null) { cachedCurrent = (((rawArray[1] & 0xFF) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; cachedPower = (((rawArray[1] & 0x0F) << 12) | (rawArray[2] << 4) | ((rawArray[4] & 0xF0) >> 4)) * 0.125; cachedEnergy = (((rawArray[4] & 0x0F) << 24) | (rawArray[5] << 16) | (rawArray[6] << 8) | (rawArray[7])) * 0.000125 * rawArray[0]; lastRead = System.currentTimeMillis(); } else if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { <START> throw new InvalidSensorException("Can not read voltage from PDP"); <END> } }</code><technical_language>Wrong error message</technical_language>

Target:
private void readEnergy() throws InvalidSensorException { byte[] rawArray = statusEnergy.read(); if (rawArray != null) { cachedCurrent = (((rawArray[1] & 0xFF) << 4) | ((rawArray[2] & 0xF0) >> 4)) * 0.125; cachedPower = (((rawArray[1] & 0x0F) << 12) | (rawArray[2] << 4) | ((rawArray[4] & 0xF0) >> 4)) * 0.125; cachedEnergy = (((rawArray[4] & 0x0F) << 24) | (rawArray[5] << 16) | (rawArray[6] << 8) | (rawArray[7])) * 0.000125 * rawArray[0]; lastRead = System.currentTimeMillis(); } else if (System.currentTimeMillis() - lastRead > PDP.MAX_AGE) { throw new InvalidSensorException("Can not read energy from PDP"); } }
Source:
<code>public Result applySuffix(List<Term> terms, MetaData metaData) { Term newTerm = terms.get(0).shallowCopy(); <START> newTerm.setLocation("("+metaData.startLine+","+metaData.startColumn+","+metaData.endLine+","+metaData.endColumn+")"); <END> return new Accept(Arrays.asList(newTerm)); }</code><technical_language>do in this diff, for later: filename</technical_language>

Target:
public List<Term> applySuffix(List<Term> terms, MetaData metaData) { Term newTerm = terms.get(0).shallowCopy(); newTerm.setLocation("("+metaData.start.line+","+metaData.start.column+","+metaData.end.line+","+metaData.end.column+")"); return Arrays.asList(newTerm); }
Source:
<code>private boolean writeDictionaryRowGroup(Block dictionary, int valueCount, IntBigArray dictionaryIndexes, int maxDirectBytes) { int[][] segments = dictionaryIndexes.getSegments(); for (int i = 0; valueCount > 0 && i < segments.length; i++) { int[] segment = segments[i]; int positionCount = Math.min(valueCount, segment.length); DictionaryBlock dictionaryBlock = new DictionaryBlock(positionCount, dictionary, segment); directColumnWriter.writeBlock(dictionaryBlock); valueCount -= positionCount; if (directColumnWriter.getBufferedBytes() > maxDirectBytes) { <START> directColumnWriter.close(); <END> directColumnWriter.reset(); return false; } } checkState(valueCount == 0); return true; }</code><technical_language>curious, move here. I ask caller is directColumnWriter.finishRowGroup();</technical_language>

Target:
private boolean writeDictionaryRowGroup(Block dictionary, int valueCount, IntBigArray dictionaryIndexes, int maxDirectBytes) { int[][] segments = dictionaryIndexes.getSegments(); for (int i = 0; valueCount > 0 && i < segments.length; i++) { int[] segment = segments[i]; int positionCount = Math.min(valueCount, segment.length); Block block = new DictionaryBlock(positionCount, dictionary, segment); while (block != null) { int chunkPositionCount = block.getPositionCount(); Block chunk = block.getRegion(0, chunkPositionCount); while (chunkPositionCount > 1 && chunk.getLogicalSizeInBytes() > DIRECT_CONVERSION_CHUNK_MAX_LOGICAL_BYTES) { chunkPositionCount /= 2; chunk = chunk.getRegion(0, chunkPositionCount); } directColumnWriter.writeBlock(chunk); if (directColumnWriter.getBufferedBytes() > maxDirectBytes) { return false; } if (chunkPositionCount < block.getPositionCount()) { block = block.getRegion(chunkPositionCount, block.getPositionCount() - chunkPositionCount); } else { block = null; } } valueCount -= positionCount; } checkState(valueCount == 0); return true; }
Source:
<code>public void onFinish(ISuite suite) { try { TestServerUtils.stopServer(); } catch (Exception e) { <START> SeLionLogger.getLogger().info(e.getMessage()); <END> } }</code><technical_language>Please change log level WARNING</technical_language>

Target:
public void onFinish(ISuite suite) { try { TestServerUtils.stopServer(); } catch (Exception e) { System.err.println(" Unable to stop test server"); } }
Source:
<code>public void writeExternal(ObjectOutput out) throws IOException { <START> out.writeObject(aggregator); <END> out.writeBoolean(eliminatedNulls); out.writeUTF(separator); }</code><technical_language>Please consider writing a class version number (e.g. 1) part of SerDe in case this is stored disk</technical_language>

Target:
public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(VERSION); out.writeObject(aggregator); out.writeBoolean(eliminatedNulls); out.writeUTF(separator); }
Source:
<code>private static Optional<RemoteEndpointAwareJdkSSLOptions> sslOptions(CassandraKeyValueServiceConfig config) { if (config.sslConfiguration().isPresent()) { SSLContext sslContext = SslSocketFactories.createSslContext(config.sslConfiguration().get()); return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder() .withSSLContext(sslContext) .build()); <START> } else if (config.ssl().isPresent() && config.ssl().get()) { <END> return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder().build()); } else { return Optional.empty(); } }</code><technical_language>config.ssl().orElse(false)</technical_language>

Target:
private static Optional<RemoteEndpointAwareJdkSSLOptions> sslOptions(CassandraKeyValueServiceConfig config) { if (config.sslConfiguration().isPresent()) { SSLContext sslContext = SslSocketFactories.createSslContext(config.sslConfiguration().get()); return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder() .withSSLContext(sslContext) .build()); } else if (config.ssl().orElse(false)) { return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder().build()); } return Optional.empty(); }
Source:
<code>public void testExpiration() throws InterruptedException { cache.put(1, "a"); <START> Thread.sleep(300); <END> assertThat(cache.get(1)).isNull(); assertThat(tierStatistics.getExpirations()).isEqualTo(1); }</code><technical_language>huh? please inject a TimeSource enables simulate time - sleep needs</technical_language>

Target:
public void testExpiration() throws InterruptedException { cache.put(1, "a"); timeSource.advanceTime(TIME_TO_EXPIRATION); assertThat(cache.get(1)).isNull(); assertThat(tierStatistics.getExpirations()).isEqualTo(1); }
Source:
<code>protected void finish() { <START> MetricsFile<BaseDistributionByCycleMetrics, ?> metrics = getMetricsFile(); <END> this.hist.addToMetricsFile(metrics); metrics.write(this.OUTPUT); if (this.hist.isEmpty()) { this.log.warn(new Object[]{"No valid bases found in input file. No plot will be produced."}); } else { int rResult = RExecutor.executeFromClasspath("picard/analysis/baseDistributionByCycle.R", new String[]{this.OUTPUT.getAbsolutePath(), this.CHART_OUTPUT.getAbsolutePath(), this.INPUT.getName(), this.plotSubtitle}); if (rResult != 0) { throw new PicardException("R script nucleotideDistributionByCycle.R failed with return code " + rResult); } } }</code><technical_language>final</technical_language>

Target:
protected void finish() { final MetricsFile<BaseDistributionByCycleMetrics, ?> metrics = getMetricsFile(); hist.addToMetricsFile(metrics); metrics.write(OUTPUT); if (hist.isEmpty()) { log.warn("No valid bases found in input file. No plot will be produced."); } else { final int rResult = RExecutor.executeFromClasspath("picard/analysis/baseDistributionByCycle.R", OUTPUT.getAbsolutePath(), CHART_OUTPUT.getAbsolutePath(), INPUT.getName(), plotSubtitle); if (rResult != 0) { throw new PicardException("R script nucleotideDistributionByCycle.R failed with return code " + rResult); } } }
Source:
<code>private void populateSchemaMigration(Connection connection, long maxMigrationNumber) { try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES (?)")) { batchExecute( 0, maxMigrationNumber + 1, preparedStatement, connection, (statement, counter) -> statement.setString(1, String.valueOf(counter))); } catch (SQLException e) { <START> throw new RuntimeException("Failed to insert rows into table SCHEMA_MIGRATIONS", e); <END> } }</code><technical_language>![MAJOR](<LINK_1> 'Severity: MAJOR') Define throw a dedicated exception instead of a generic one. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
private static void populateSchemaMigration(Connection connection, long maxMigrationNumber) { try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES (?)")) { batchExecute( 0, maxMigrationNumber + 1, preparedStatement, connection, (statement, counter) -> statement.setString(1, String.valueOf(counter))); } catch (SQLException e) { throw new RuntimeException("Failed to insert rows into table SCHEMA_MIGRATIONS", e); } }
Source:
<code>public Long getUuid() { <START> return new Long(artifactObject.getArtId()); <END> }</code><technical_language>Long.valueOf() instead of new Long() - for performance reasons</technical_language>

Target:
public Long getUuid() { return Long.valueOf(artifactObject.getArtId()); }
Source:
<code><START> public void addProperty(String name, Object value) { <END> this.properties.put(name, value); }</code><technical_language>null checks</technical_language>

Target:
public void addProperty(String name, Object value) { Assert.hasText(name, "'name' must not be null"); this.properties.put(name, value); }
Source:
<code>public void showFetchingError(String s) { <START> if (Network.getConnectivityStatusString(getContext()).equals("Not connected to Internet")) { <END> viewFlipper.setDisplayedChild(2); noClientText.setText(R.string.failed_to_fetch_client_details_account); } else { Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show(); } }</code><technical_language>Network.isOnline(Context) please do hardcoded string</technical_language>

Target:
public void showFetchingError(String s) { if (Network.isOnline(getContext())) { viewFlipper.setDisplayedChild(2); noClientText.setText(R.string.failed_to_fetch_client_details_account); } else { Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show(); } }
Source:
<code>private void sanitizeInput(final String value) throws SanitizationException { try { CleanResults result = antiSamy.scan(value); List<String>errorMsgList = result.getErrorMessages(); <START> if (CollectionUtils.isNotEmpty(errorMsgList)) { <END> throw new SanitizationException("Malicious code has been detected on the HTTP header"); } } catch (ScanException | PolicyException | SanitizationException ex) { throw new SanitizationException(ex); } }</code><technical_language>need define errorMsgList. inline here</technical_language>

Target:
private void sanitizeInput(final String value) throws SanitizationException { try { CleanResults result = antiSamy.scan(value); if (CollectionUtils.isNotEmpty(result.getErrorMessages())) { throw new SanitizationException("Malicious code has been detected on the HTTP header"); } } catch (ScanException | PolicyException | SanitizationException ex) { throw new SanitizationException(ex); } }
Source:
<code>private List<IGraphicalEditPart> cleanSelectedObjects(List<?> selectedObjects) { List<IGraphicalEditPart> result = Lists.newArrayList(); for (Object selectedObject : selectedObjects) { if (selectedObject instanceof IGraphicalEditPart) { <START> if (!(selectedObject instanceof AbstractGeneratedDiagramNameEditPart) || !(selectedObjects.contains(((IGraphicalEditPart) selectedObject).getParent()))) { <END> result.add((IGraphicalEditPart) selectedObject); } } } return result; }</code><technical_language>1. IDiagramNameEditPart more general testing a specific implementation class 2. contains() costly large ArrayLists, especially calling in a loop. selectedObjects transformed a Set (with O(1) containment test) loop. 3. boolean condition is a hard read. introducing a named variable: boolean isLabelOfSelectedParent = (selectedObject instanceof IDiagramNameEditPart) && selectedObjects.contains(((IGEP) selectedObject).getParent()); if (!isLabelOfSelectedParent) { ... }</technical_language>

Target:
private List<IGraphicalEditPart> cleanSelectedObjects(List<?> selectedObjects) { List<IGraphicalEditPart> result = Lists.newArrayList(); final Set<Object> selection = new HashSet<Object>(selectedObjects); for (Object selectedObject : selection) { if (selectedObject instanceof IGraphicalEditPart) { if (!(selectedObject instanceof IDiagramNameEditPart) || !(selection.contains(((IGraphicalEditPart) selectedObject).getParent()))) { boolean isLabelOfSelectedParent = (selectedObject instanceof IDiagramNameEditPart) && selection.contains(((IDiagramNameEditPart) selectedObject).getParent()); if (!isLabelOfSelectedParent) { result.add((IGraphicalEditPart) selectedObject); } } } } return result; }
Source:
<code>public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public boolean isNull() { if (NullHandling.replaceWithDefault()) { return false; } final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @Override public double getDouble() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { <START> return 0.0; <END> } return (Double) dims[dimIndex]; } @SuppressWarnings("deprecation") @Nullable @Override public Double getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Double) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }</code><technical_language>throw if sqlCompatible</technical_language>

Target:
public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public boolean isNull() { final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @Override public double getDouble() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { assert NullHandling.replaceWithDefault(); return 0.0; } return (Double) dims[dimIndex]; } @SuppressWarnings("deprecation") @Nullable @Override public Double getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Double) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }
Source:
<code>GHPullRequestReviewBuilder(GHPullRequest pr) { this.pr = pr; <START> this.builder = pr.root.retrieve().method("POST"); <END> }</code><technical_language>remove .method("POST") calling create() method</technical_language>

Target:
GHPullRequestReviewBuilder(GHPullRequest pr) { this.pr = pr; this.builder = pr.root.createRequest(); }
Source:
<code>public String pretrainedUrl(PretrainedType pretrainedType) { if (pretrainedType == PretrainedType.IMAGENET) if (inputShape[1] == 448 && inputShape[2] == 448) <START> return "<LINK_2>"; <END> else return "<LINK_1>"; else return null; }</code><technical_language>nit-pick is add a version extension other pretrained models. instead this <LINK_3></technical_language>

Target:
public String pretrainedUrl(PretrainedType pretrainedType) { if (pretrainedType == PretrainedType.IMAGENET) if (inputShape[1] == 448 && inputShape[2] == 448) return "<LINK_3>"; else return "<LINK_0>"; else return null; }
Source:
<code>public boolean canDownloadFile(FileMetadata fileMetadata){ if (fileMetadata == null){ return false; } if ((fileMetadata.getId() == null) || (fileMetadata.getDataFile().getId() == null)){ return false; } Long fid = fileMetadata.getId(); boolean isRestrictedFile = fileMetadata.isRestricted(); if (this.fileDownloadPermissionMap.containsKey(fid)){ return this.fileDownloadPermissionMap.get(fid); } if (fileMetadata.getDatasetVersion().isDeaccessioned()) { if (this.doesSessionUserHavePermission(Permission.EditDataset, fileMetadata)) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (!isRestrictedFile){ this.fileDownloadPermissionMap.put(fid, true); return true; } <START> if (session.getUser() instanceof GuestUser){ <END> boolean guestHasAccessDueToIpGroup = permissionService.requestOn(dvRequestService.getDataverseRequest(), fileMetadata.getDataFile()).has(Permission.DownloadFile); if (guestHasAccessDueToIpGroup) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (this.doesSessionUserHavePermission(Permission.DownloadFile, fileMetadata)){ this.fileDownloadPermissionMap.put(fid, true); return true; } this.fileDownloadPermissionMap.put(fid, false); return false; }</code><technical_language>Is a need treat guest user differently? below, is a call check permissions (a call a method, doesSessionUserHavePermission. I able change method use: this.permissionService.On(objectToCheck).has(permissionToCheck); instead of: this.permissionService.userOn(this.session.getUser(), objectToCheck).has(permissionToCheck); This a nice code cleanup</technical_language>

Target:
public boolean canDownloadFile(FileMetadata fileMetadata){ if (fileMetadata == null){ return false; } if ((fileMetadata.getId() == null) || (fileMetadata.getDataFile().getId() == null)){ return false; } Long fid = fileMetadata.getId(); boolean isRestrictedFile = fileMetadata.isRestricted(); if (this.fileDownloadPermissionMap.containsKey(fid)){ return this.fileDownloadPermissionMap.get(fid); } if (fileMetadata.getDatasetVersion().isDeaccessioned()) { if (this.doesSessionUserHavePermission(Permission.EditDataset, fileMetadata)) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (!isRestrictedFile){ this.fileDownloadPermissionMap.put(fid, true); return true; } if (permissionService.requestOn(dvRequestService.getDataverseRequest(), fileMetadata.getDataFile()).has(Permission.DownloadFile)) { logger.fine("The DataverseRequest (User plus IP address) has access to download the file."); this.fileDownloadPermissionMap.put(fid, true); return true; } this.fileDownloadPermissionMap.put(fid, false); return false; }
Source:
<code>protected void executeCommand() { boolean removingVmPool = isRemovingVmPool(); if (!removingVmPool) { applyNextRunConfiguration(); <START> boolean removedStatelessSnapshot = detachUsers(); <END> if (!removedStatelessSnapshot && !templateVersionChanged) { removeVmStatelessImages(); } } getQuotaManager().rollbackQuotaByVmId(getVmId()); if (!removingVmPool) { removeStatelessVmUnmanagedDevices(); boolean vmHasDirectPassthroughDevices = releaseUsedHostDevices(); Guid hostId = cleanupVfs(); refreshHostIfNeeded(hostId == null ? (vmHasDirectPassthroughDevices ? getVm().getDedicatedVmForVds() : null) : hostId); } }</code><technical_language>need detach users anyway</technical_language>

Target:
protected void executeCommand() { boolean removingVmPool = isRemovingVmPool(); if (!removingVmPool) { applyNextRunConfiguration(); boolean removedStatelessSnapshot = detachUsers(); if (!removedStatelessSnapshot && !templateVersionChanged) { removeVmStatelessImages(); } } getQuotaManager().rollbackQuotaByVmId(getVmId()); if (!removingVmPool) { removeStatelessVmUnmanagedDevices(); boolean vmHasDirectPassthroughDevices = releaseUsedHostDevices(); Guid hostId = cleanupVfs(); Guid alternativeHostsList = vmHasDirectPassthroughDevices ? getVm().getDedicatedVmForVdsList().get(0) : null; refreshHostIfNeeded(hostId == null ? alternativeHostsList : hostId); } }
Source:
<code>public CodeSystems execute(ServiceProvider context) { final List<CodeSystem> codeSystemList = Lists.newArrayList(); final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); repositories.forEach(repositoryInfo -> { CodeSystems css = CodeSystemRequests.prepareSearchCodeSystem() .all() .filterByIds(ids) .setFields(fields) .setExpand(expand) .build(repositoryInfo.id()) .getRequest() .execute(context); codeSystemList.addAll(css.getItems()); }); <START> return new CodeSystems(codeSystemList, null, 50, codeSystemList.size()); <END> }</code><technical_language>Replace limit 50 codeSystemList.size()</technical_language>

Target:
public CodeSystems execute(ServiceProvider context) { final List<CodeSystem> codeSystemList = Lists.newArrayList(); final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); repositories.forEach(repositoryInfo -> { CodeSystems css = CodeSystemRequests.prepareSearchCodeSystem() .all() .filterByIds(ids) .setFields(fields) .setExpand(expand) .build(repositoryInfo.id()) .getRequest() .execute(context); codeSystemList.addAll(css.getItems()); }); return new CodeSystems(codeSystemList, null, codeSystemList.size(), codeSystemList.size()); }