auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "close", button -> { final UniverseSetupScreen universeSetupScreen = getManager().createScreen(UniverseSetupScreen.ASSET_URI, UniverseSetupScreen.class); final WorldPreGenerationScreen worldPreGenerationScreen =getManager().createScreen(WorldPreGenerationScreen.ASSET_URI, WorldPreGenerationScreen.class ); UIText customWorldName = find("customisedWorldName", UIText.class); <START> if(customWorldName.getText().isEmpty()==false) { <END> newWorldName = new Name(customWorldName.getText()); world.setWorldName(newWorldName); } universeSetupScreen.refresh(worldsDropdown); worldPreGenerationScreen.setName(newWorldName); triggerBackAnimation(); }); }</code><technical_language>Minor whitespace style issues</technical_language>

Target:
public void initialise() { setAnimationSystem(MenuAnimationSystems.createDefaultSwipeAnimation()); WidgetUtil.trySubscribe(this, "close", button -> { final UniverseSetupScreen universeSetupScreen = getManager().createScreen(UniverseSetupScreen.ASSET_URI, UniverseSetupScreen.class); final WorldPreGenerationScreen worldPreGenerationScreen = getManager().createScreen(WorldPreGenerationScreen.ASSET_URI, WorldPreGenerationScreen.class); UIText customWorldName = find("customisedWorldName", UIText.class); if (!customWorldName.getText().isEmpty()) { newWorldName = new Name(customWorldName.getText()); world.setWorldName(newWorldName); universeSetupScreen.refreshWorldDropdown(worldsDropdown); worldPreGenerationScreen.setName(newWorldName); } triggerBackAnimation(); }); }
Source:
<code>private <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { if (dao instanceof BaseDAODbFacade) { <START> initBaseDAO((BaseDAODbFacade) dao); <END> } return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }</code><technical_language>I able this line :/</technical_language>

Target:
private <T extends DAO> T getDao(Class<T> daoType) { for (DAO dao : daos) { if (daoType.isAssignableFrom(dao.getClass())) { return (T) dao; } } log.error("Can't find dao for " + daoType); return null; }
Source:
<code>public synchronized boolean execute() throws IllegalStateException { if(hasExecuted) { throw new IllegalStateException("time bound operation has already executed"); } hasExecuted = true; thread = new Thread(new Runnable() { @Override public void run() { TimeBoundOperation.this.run(); } }); thread.start(); try { thread.join(timeout); }catch (InterruptedException e) { return false; <START> }; <END> commit(); return true; }</code><technical_language>unneeded ;</technical_language>

Target:
public synchronized boolean execute() throws IllegalStateException { if(hasExecuted) { throw new IllegalStateException("time bound operation has already executed"); } hasExecuted = true; Thread thread = new Thread(new Runnable() { @Override public void run() { TimeBoundOperation.this.run(); } }); thread.start(); try { thread.join(timeout); }catch (InterruptedException e) { return false; } commit(); return true; }
Source:
<code>private static String _getNight(final long time) { final LocalDateTime dt = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()); final int ampm = dt.get(ChronoField.AMPM_OF_DAY); final LocalDateTime start; final LocalDateTime end; if (ampm == 0) { start = dt.minus(1, ChronoUnit.DAYS); end = dt; } else { start = dt; end = dt.plus(1, ChronoUnit.DAYS); } final int startDay = start.get(ChronoField.DAY_OF_MONTH); final int endDay = end.get(ChronoField.DAY_OF_MONTH); final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateTimeFormatter f = DateTimeFormatter.ofPattern("MMM yyyy").withZone(ZoneId.of("UTC")); <START> buf.append(f.format(end)); <END> return buf.toString(); }</code><technical_language>formatting this date, is, in local time zone. formatting in UTC. Is okay</technical_language>

Target:
private static String _getNight(final long time) { final LocalDateTime dt = LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()); final int ampm = dt.get(ChronoField.AMPM_OF_DAY); final LocalDateTime start; final LocalDateTime end; if (ampm == 0) { start = dt.minus(1, ChronoUnit.DAYS); end = dt; } else { start = dt; end = dt.plus(1, ChronoUnit.DAYS); } final int startDay = start.get(ChronoField.DAY_OF_MONTH); final int endDay = end.get(ChronoField.DAY_OF_MONTH); final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateTimeFormatter f = DateTimeFormatter.ofPattern("MMM yyyy"); buf.append(f.format(end)); return buf.toString(); }
Source:
<code>private Column getColumnForInfo(ColumnInfo c) { try { return Column.getColumn(c.getName()); } catch (IllegalArgumentException e) { <START> throw new RuntimeException("Cannot compare non-Column enum ColumnInfo objects", e); <END> } }</code><technical_language>is error "Cannot compare non-Column enum ColumnInfo objects"? more "Not a valid ColumnInfo object." that? I in compare() method in this class, odd exception message if this method for other comparisons. if this method elsewhere, leave is</technical_language>

Target:
private Column getColumnForInfo(ColumnInfo c) { return Column.getColumn(c.getName()); }
Source:
<code>new RelType("WinAggRelType") { protected boolean canImplement(RexFieldAccess field) { return false; } protected boolean canImplement(RexDynamicParam param) { return false; } protected boolean canImplement(RexLiteral literal) { return false; } protected boolean canImplement(RexCall call) { return call instanceof RexOver; } protected boolean supportsCondition() { return false; } protected RelNode makeRel(RelOptCluster cluster, RelTraitSet traitSet, RelBuilder relBuilder, RelNode input, RexProgram program) { Preconditions.checkArgument(program.getCondition() == null, "WindowedAggregateRel cannot accept a condition"); List<RelCollation> collations = traitSet.getTraits(RelCollationTraitDef.INSTANCE); RelNode window = LogicalWindow.create(cluster, relBuilder, input, program); if (collations == null || collations.isEmpty() || collations.size() != 1) { return window; } RelCollation collation = collations.get(0); if (Objects.equals(collation, RelCollations.EMPTY)) { return window; } <START> return LogicalSort.create(window, collation, null, null); <END> } }</code><technical_language>is point of manually creating LogicalSort</technical_language>

Target:
new RelType("WinAggRelType") { protected boolean canImplement(RexFieldAccess field) { return false; } protected boolean canImplement(RexDynamicParam param) { return false; } protected boolean canImplement(RexLiteral literal) { return false; } protected boolean canImplement(RexCall call) { return call instanceof RexOver; } protected boolean supportsCondition() { return false; } protected RelNode makeRel(RelOptCluster cluster, RelTraitSet traitSet, RelBuilder relBuilder, RelNode input, RexProgram program) { Preconditions.checkArgument(program.getCondition() == null, "WindowedAggregateRel cannot accept a condition"); return LogicalWindow.create(cluster, traitSet, relBuilder, input, program); } }
Source:
<code>public int hashCode() { <START> int result = getAuthors() != null ? getAuthors().hashCode() : 0; <END> result = 31 * result + (getStudyName() != null ? getStudyName().hashCode() : 0); result = 31 * result + (getLastSearchDate() != null ? getLastSearchDate().hashCode() : 0); result = 31 * result + (getResearchQuestions() != null ? getResearchQuestions().hashCode() : 0); result = 31 * result + (getQueries() != null ? getQueries().hashCode() : 0); result = 31 * result + (getLibraries() != null ? getLibraries().hashCode() : 0); return result; }</code><technical_language>Objects.hashcode is friend ;-)</technical_language>

Target:
public int hashCode() { return Objects.hashCode(this); }
Source:
<code>private void cleanOnlyInDbZombieTasks(long timeForZombieTasks) { Iterator<AsyncTasks> tasksInDbIterator = tasksInDbAfterRestart.iterator(); while (tasksInDbIterator.hasNext()) { AsyncTasks task = tasksInDbIterator.next(); if (!_tasks.containsKey(task.gettask_id())) { if (task.getStartTime().getTime() < timeForZombieTasks) { <START> tasksInDbIterator.remove(); <END> DbFacade.getInstance().getAsyncTaskDao().remove(task.gettask_id()); } } } }</code><technical_language>I method of iterator.remoe() for case of ArrayList system copy of array out removed element</technical_language>

Target:
private void cleanOnlyInDbZombieTasks(long timeForZombieTasks) { List<AsyncTasks> toRemove = new ArrayList<AsyncTasks>(); for (AsyncTasks task:tasksInDbAfterRestart) { if (!_tasks.containsKey(task.gettask_id())) { if (task.getStartTime().getTime() < timeForZombieTasks) { toRemove.add(task); DbFacade.getInstance().getAsyncTaskDao().remove(task.gettask_id()); } } } tasksInDbAfterRestart.removeAll(toRemove); }
Source:
<code>public void getReserveTransactionByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setRequestInterceptor(BitreserveRestAdapter.getRequestInterceptor(null)).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); <START> return null; <END> } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getReserveTransactionById("foobar", new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/transactions/%s", MOCK_URL, "foobar")); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); }</code><technical_language>Add newline return</technical_language>

Target:
public void getReserveTransactionByIdShouldReturnTheRequest() throws Exception { final AtomicReference<Request> bodyRef = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); final RestAdapter adapter = new RestAdapter.Builder().setEndpoint(MOCK_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { bodyRef.set(request); latch.countDown(); return null; } }).build(); final ReserveService reserveService = adapter.create(ReserveService.class); reserveService.getReserveTransactionById("foobar", new RetrofitPromise<Transaction>()); latch.await(); Assert.assertEquals(bodyRef.get().getMethod(), "GET"); Assert.assertEquals(bodyRef.get().getUrl(), String.format("%s/v0/reserve/transactions/%s", MOCK_URL, "foobar")); }
Source:
<code>public String toJson() { <START> StringBuffer json = new StringBuffer("["); <END> for (int i = 0; i < size() - 1; i++) { json.append(get(i).toJson()); json.append(","); } json.append(get(size()-1).toJson()); json.append("]"); return json.toString(); }</code><technical_language>building JSON manually -- other toJson methods construct JsonArrays JsonObjects toString</technical_language>

Target:
public String toJson() { JsonArray array = new JsonArray(); for (int i = 0; i < size() - 1; i++) { array.add(get(i).toJsonObject()); } return array.toString(); }
Source:
<code><START> public static double xOfShape(final DMNShape shape) { <END> if (shape != null) { if (shape.getBounds() != null) { return shape.getBounds().getX(); } } return 0.0; }</code><technical_language>minor thing, methods duplicating code... create a common function takes shape a Function<Bounds, Double> null checks etc, methods xOfShape, yOfShape refactored a argument function (bounds) -> bounds.getX(), on..</technical_language>

Target:
public static double xOfShape(final DMNShape shape) { return extractValue(shape, org.kie.dmn.model.api.dmndi.Bounds::getX); }
Source:
<code>public void testLoadAndStoreWithLifespanAndIdle() throws Exception { assertFalse(cl.contains("k")); long lifespan = 200000; long idle = 120000; InternalCacheEntry se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); InternalCacheValue icv = se.toInternalCacheValue(); assertEquals(se.getCreated(), icv.getCreated()); assertEquals(se.getLastUsed(), icv.getLastUsed()); cl.write(marshalledEntry(se, getMarshaller())); assert cl.contains("k"); MarshalledEntry ice = cl.load("k"); assertCorrectExpiry(ice, "v", lifespan, idle, false); assertCorrectExpiry(TestingUtil.allEntries(cl).iterator().next(), "v", lifespan, idle, false); idle = 1; se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); cl.write(marshalledEntry(se, getMarshaller())); Thread.sleep(100); <START> CpurgeExpired(Collections.singleton("k"), 10000); <END> assert se.isExpired(System.currentTimeMillis()); assertEventuallyExpires("k"); assertFalse(cl.contains("k")); assertIsEmpty(); }</code><technical_language>[ERROR] /Users/g/Go/upstream/infinispan.git/core/src/test/java/org/infinispan/persistence/BaseStoreTest.java:[295,7] find symbol symbol: method CpurgeExpired(java.util.Set<java.lang.String>,int) location: class org.infinispan.persistence.BaseStoreTest</technical_language>

Target:
public void testLoadAndStoreWithLifespanAndIdle() throws Exception { assertFalse(cl.contains("k")); long lifespan = 200000; long idle = 120000; InternalCacheEntry se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); InternalCacheValue icv = se.toInternalCacheValue(); assertEquals(se.getCreated(), icv.getCreated()); assertEquals(se.getLastUsed(), icv.getLastUsed()); cl.write(marshalledEntry(se, getMarshaller())); assert cl.contains("k"); MarshalledEntry ice = cl.load("k"); assertCorrectExpiry(ice, "v", lifespan, idle, false); assertCorrectExpiry(TestingUtil.allEntries(cl).iterator().next(), "v", lifespan, idle, false); idle = 1; se = TestInternalCacheEntryFactory.create("k", wrap("k", "v"), lifespan, idle); cl.write(marshalledEntry(se, getMarshaller())); Thread.sleep(100); purgeExpired(Collections.singleton("k"), 10000); assert se.isExpired(System.currentTimeMillis()); assertEventuallyExpires("k"); assertFalse(cl.contains("k")); assertIsEmpty(); }
Source:
<code>public Set<Id> accountsOf(AccountGroup.UUID groupId) { try { return accountsOf.get(groupId); } catch (ExecutionException e) { <START> log.warn("Cannot load account of group", e); <END> return Collections.emptySet(); } }</code><technical_language>Nit: s/account/accounts/</technical_language>

Target:
public Set<Id> accountsOf(AccountGroup.UUID groupId) { try { return accounts.get(groupId); } catch (ExecutionException e) { log.warn("Cannot load accounts of group", e); return Collections.emptySet(); } }
Source:
<code>public void addValue(String key, String value) { if (StringUtils.isBlank(value)) return; String[] existingvals = md.get(key); if (existingvals == null || existingvals.length == 0) { setValue(key, value); return; } ArrayList<String> existing = new ArrayList<String>(existingvals.length); for (String v : existingvals) existing.add(v); existing.add(value); <START> md.put(key, existing.toArray(new String[existing.size()])); <END> }</code><technical_language>create array arrayCopy ? more efficient</technical_language>

Target:
public void addValue(String key, String value) { if (StringUtils.isBlank(value)) return; String[] existingvals = md.get(key); if (existingvals == null || existingvals.length == 0) { setValue(key, value); return; } int currentLength = existingvals.length; String[] newvals = new String[currentLength + 1]; newvals[currentLength] = value; System.arraycopy(existingvals, 0, newvals, 0, currentLength); md.put(key, newvals); }
Source:
<code>private ThrowingFunction<LogPosition,TransactionCursor,IOException> log( int... transactionCounts ) throws IOException { long baseOffset = LogPosition.start( 0 ).getByteOffset(); @SuppressWarnings( "unchecked" ) ThrowingFunction<LogPosition,TransactionCursor,IOException> result = mock( ThrowingFunction.class ); AtomicLong txId = new AtomicLong( 0 ); CommittedTransactionRepresentation[][] logs = new CommittedTransactionRepresentation[transactionCounts.length][]; for ( int logVersion = 0; logVersion < transactionCounts.length; logVersion++ ) { logs[logVersion] = transactions( transactionCounts[logVersion], txId ); } <START> when( result.apply( any( LogPosition.class ) ) ).thenAnswer( new Answer<TransactionCursor>() <END> { @Override public TransactionCursor answer( InvocationOnMock invocation ) throws Throwable { LogPosition position = invocation.getArgumentAt( 0, LogPosition.class ); if ( position == null ) { return null; } CommittedTransactionRepresentation[] transactions = logs[toIntExact( position.getLogVersion() )]; CommittedTransactionRepresentation[] subset = copyOfRange( transactions, toIntExact( position.getByteOffset() - baseOffset ), transactions.length ); ArrayUtil.reverse( subset ); return given( subset ); } } ); return result; }</code><technical_language>replaced a lambda</technical_language>

Target:
private ThrowingFunction<LogPosition,TransactionCursor,IOException> log( int... transactionCounts ) throws IOException { long baseOffset = LogPosition.start( 0 ).getByteOffset(); @SuppressWarnings( "unchecked" ) ThrowingFunction<LogPosition,TransactionCursor,IOException> result = mock( ThrowingFunction.class ); AtomicLong txId = new AtomicLong( 0 ); CommittedTransactionRepresentation[][] logs = new CommittedTransactionRepresentation[transactionCounts.length][]; for ( int logVersion = 0; logVersion < transactionCounts.length; logVersion++ ) { logs[logVersion] = transactions( transactionCounts[logVersion], txId ); } when( result.apply( any( LogPosition.class ) ) ).thenAnswer( invocation -> { LogPosition position = invocation.getArgumentAt( 0, LogPosition.class ); if ( position == null ) { return null; } CommittedTransactionRepresentation[] transactions = logs[toIntExact( position.getLogVersion() )]; CommittedTransactionRepresentation[] subset = copyOfRange( transactions, toIntExact( position.getByteOffset() - baseOffset ), transactions.length ); ArrayUtil.reverse( subset ); return given( subset ); } ); return result; }
Source:
<code>public ResponseEntity<String> repositories(@ApiParam(value = "The storageId", required = true) @PathVariable("storageId") String storageId) { try { Storage storage = configurationManager.getConfiguration().getStorage(storageId); if (storage == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("{ 'error': 'The requested storage was not found.' }"); } Map<String,SortedSet<String>> repos = new HashMap<>(); repos.put("repositories", new TreeSet<String>(storage.getRepositories().keySet())); <START> return ResponseEntity.ok(new ObjectMapper().writeValueAsString(repos)); <END> } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }</code><technical_language>new ObjectMapper() above. Inject please</technical_language>

Target:
public ResponseEntity<String> repositories(@ApiParam(value = "The storageId", required = true) @PathVariable("storageId") String storageId) { try { Storage storage = configurationManager.getConfiguration().getStorage(storageId); if (storage == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body("{ 'error': 'The requested storage was not found.' }"); } Map<String,SortedSet<String>> repos = new HashMap<>(); repos.put("repositories", new TreeSet<String>(storage.getRepositories().keySet())); return ResponseEntity.ok(objectMapper.writer().writeValueAsString(repos)); } catch (Exception e) { logger.error(e.getMessage(), e); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(String.format("{ 'error': '%s' }", e.getMessage())); } }
Source:
<code>public OAuth2Authentication loadAuthentication(final String accessToken) throws AuthenticationException { final Timer.Context context = timer.time(); try { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.REMOTE_TOKENINFO)) { return remoteService.loadAuthentication(accessToken); } else { return localService.loadAuthentication(accessToken); } } catch (OAuth2Exception e) { throw e; <START> } catch (Exception e) { <END> throw new OAuth2Exception(e.getMessage(), e); } finally { context.stop(); } }</code><technical_language>RuntimeException</technical_language>

Target:
public OAuth2Authentication loadAuthentication(final String accessToken) throws AuthenticationException { final Timer.Context context = timer.time(); try { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.REMOTE_TOKENINFO)) { return remoteService.loadAuthentication(accessToken); } else { return localService.loadAuthentication(accessToken); } } catch (final OAuth2Exception e) { throw e; } catch (final RuntimeException e) { throw new OAuth2Exception(e.getMessage(), e); } finally { context.stop(); } }
Source:
<code>private InstructorAttributes extractUpdatedInstructor(String courseId, String instructorId, String instructorName, String instructorEmail) { String instructorRole = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ROLE_NAME); boolean isDisplayedToStudents = true; if (getRequestParamValue(Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT) != null) { <START> isDisplayedToStudents = Boolean.parseBoolean(getRequestParamValue( <END> Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT)); } String displayedName = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToEdit = updateBasicInstructorAttributes(courseId, instructorId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }</code><technical_language>getRequestParamAsBoolean</technical_language>

Target:
private InstructorAttributes extractUpdatedInstructor(String courseId, String instructorId, String instructorName, String instructorEmail) { String instructorRole = getNonNullRequestParamValue(Const.ParamsNames.INSTRUCTOR_ROLE_NAME); boolean isDisplayedToStudents = getBooleanRequestParamValue(Const.ParamsNames.INSTRUCTOR_IS_DISPLAYED_TO_STUDENT); String displayedName = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_DISPLAY_NAME); if (displayedName == null || displayedName.isEmpty()) { displayedName = InstructorAttributes.DEFAULT_DISPLAY_NAME; } instructorRole = SanitizationHelper.sanitizeName(instructorRole); displayedName = SanitizationHelper.sanitizeName(displayedName); InstructorAttributes instructorToEdit = updateBasicInstructorAttributes(courseId, instructorId, instructorName, instructorEmail, instructorRole, isDisplayedToStudents, displayedName); if (instructorRole.equals(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM)) { updateInstructorCourseLevelPrivileges(instructorToEdit); } updateInstructorWithSectionLevelPrivileges(courseId, instructorToEdit); instructorToEdit.privileges.validatePrivileges(); return instructorToEdit; }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (identity == null) { if (other.identity != null) { return false; } } else if (!identity.equals(other.identity)) { return false; } <START> if (virtualHost == null) { <END> if (other.virtualHost != null) { return false; } } else if (!virtualHost.equals(other.virtualHost)) { return false; } return true; }</code><technical_language>Compare name instead of identity do it</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } return true; }
Source:
<code>public void theStoredEventsAreFilteredAndRetrieved(final Map<String, String> expectedResponse) throws Throwable { final List<Event> events; if (getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION).equals("")) { events = this.retrieveStoredEvents(); } else { events = this.retrieveStoredEvents(getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION)); } Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_RESULT), events.size()); <START> <END> }</code><technical_language>Remove empty line</technical_language>

Target:
public void theStoredEventsAreFilteredAndRetrieved(final Map<String, String> expectedResponse) throws Throwable { final List<Event> events; if (getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION).isEmpty()) { events = this.retrieveStoredEvents(); } else { events = this.retrieveStoredEvents(getString(expectedResponse, Keys.KEY_DEVICE_IDENTIFICATION)); } Assert.assertEquals((int) getInteger(expectedResponse, Keys.KEY_RESULT), events.size()); }
Source:
<code>public ICPPExecution getExecution() { <START> if (declarators == null) { <END> return new ExecSimpleDeclaration(new ICPPExecution[] {}); } else { ICPPExecution[] declaratorExecutions = new ICPPExecution[declarators.length]; for (int i = 0; i < declarators.length; ++i) { declaratorExecutions[i] = ((ICPPExecutionOwner) declarators[i]).getExecution(); } return new ExecSimpleDeclaration(declaratorExecutions); } }</code><technical_language>Instead of adding this check, please getDeclarators() instead</technical_language>

Target:
public ICPPExecution getExecution() { IASTDeclarator[] declarators = getDeclarators(); ICPPExecution[] declaratorExecutions = new ICPPExecution[declarators.length]; for (int i = 0; i < declarators.length; ++i) { declaratorExecutions[i] = ((ICPPExecutionOwner) declarators[i]).getExecution(); } return new ExecSimpleDeclaration(declaratorExecutions); }
Source:
<code>public void snapshotState(FunctionSnapshotContext context) throws Exception { try { <START> bufferedResultsLock.lock(); <END> bufferedResultsState.clear(); bufferedResultsState.addAll(bufferedResults); firstBufferedResultOffsetState.clear(); firstBufferedResultOffsetState.add(firstBufferedResultOffset); } finally { bufferedResultsLock.unlock(); } }</code><technical_language>put lock() try</technical_language>

Target:
public void snapshotState(FunctionSnapshotContext context) throws Exception { bufferedResultsLock.lock(); try { bufferedResultsState.clear(); bufferedResultsState.addAll(bufferedResults); offsetState.clear(); offsetState.add(offset); uncompletedCheckpointMap.put(context.getCheckpointId(), offset); if (LOG.isDebugEnabled()) { LOG.debug("Checkpoint begin with checkpointId = " + context.getCheckpointId() + ", lastCheckpointedOffset = " + lastCheckpointedOffset + ", num buffered results = " + bufferedResults.size()); } } finally { bufferedResultsLock.unlock(); } }
Source:
<code>private void waitNotificationEqualsTo(String notificationMessage, String parentWindowHandle) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { if (seleniumWebDriverHelper.isOpenedSomeWin()) { <START> seleniumWebDriver.switchTo().window(parentWindowHandle); <END> theiaIde.switchToIdeFrame(); } return theiaIde.isDisplayedNotificationEqualsTo(notificationMessage); }, LOADER_TIMEOUT_SEC); }</code><technical_language>able replace seleniumWebDriver driver</technical_language>

Target:
private void waitNotificationEqualsTo(String notificationMessage, String parentWindowHandle) { seleniumWebDriverHelper.waitSuccessCondition( driver -> { if (seleniumWebDriverHelper.isTwoOrMoreWindowsOpened()) { driver.switchTo().window(parentWindowHandle); theiaIde.switchToIdeFrame(); } return theiaIde.isNotificationEqualsTo(notificationMessage); }, LOADER_TIMEOUT_SEC); }
Source:
<code><START> public String display() { <END> StringBuilder sb = new StringBuilder(); sb.append("<meta "); for (String attrib : attribs.keySet()) { sb.append(attrib).append("=\"").append(attribs.get(attrib)).append("\" "); } if (content.isPresent()) { sb.append("content=\"").append(content.get()).append("\" "); } sb.append("/>"); return sb.toString(); }</code><technical_language>NotNull/Nullable missing</technical_language>

Target:
public @NotNull String display() { StringBuilder sb = new StringBuilder(); sb.append("<meta "); for (String attrib : attribs.keySet()) { sb.append(attrib).append("=\"").append(attribs.get(attrib)).append("\" "); } if (content.isPresent()) { sb.append("content=\"").append(content.get()).append("\" "); } sb.append("/>"); return sb.toString(); }
Source:
<code>public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { PreparedStatement stmt = (fields == null) ? readAllStmt.get() : readStmts.get(fields); if (stmt == null) { Select.Builder selectBuilder; if (fields == null) { selectBuilder = QueryBuilder.select().all(); } else { selectBuilder = QueryBuilder.select(); for (String col : fields) { ((Select.Selection) selectBuilder).column(col); } } stmt = session.prepare(selectBuilder.from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())) .limit(1)); stmt.setConsistencyLevel(readConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = (fields == null) ? readAllStmt.getAndSet(stmt) : readStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } if (debug) { System.out.println(stmt.getQueryString()); <START> System.out.println("key = " + key); <END> } ResultSet rs = session.execute(stmt.bind(key)); if (rs.isExhausted()) { return Status.NOT_FOUND; } Row row = rs.one(); ColumnDefinitions cd = row.getColumnDefinitions(); for (ColumnDefinitions.Definition def : cd) { ByteBuffer val = row.getBytesUnsafe(def.getName()); if (val != null) { result.put(def.getName(), new ByteArrayByteIterator(val.array())); } else { result.put(def.getName(), null); } } return Status.OK; } catch (Exception e) { e.printStackTrace(); System.out.println("Error reading key: " + key); return Status.ERROR; } }</code><technical_language>nit: Mind switching this a logging framework long retooling</technical_language>

Target:
public Status read(String table, String key, Set<String> fields, Map<String, ByteIterator> result) { try { PreparedStatement stmt = (fields == null) ? readAllStmt.get() : readStmts.get(fields); if (stmt == null) { Select.Builder selectBuilder; if (fields == null) { selectBuilder = QueryBuilder.select().all(); } else { selectBuilder = QueryBuilder.select(); for (String col : fields) { ((Select.Selection) selectBuilder).column(col); } } stmt = session.prepare(selectBuilder.from(table) .where(QueryBuilder.eq(YCSB_KEY, QueryBuilder.bindMarker())) .limit(1)); stmt.setConsistencyLevel(readConsistencyLevel); if (trace) { stmt.enableTracing(); } PreparedStatement prevStmt = (fields == null) ? readAllStmt.getAndSet(stmt) : readStmts.putIfAbsent(new HashSet(fields), stmt); if (prevStmt != null) { stmt = prevStmt; } } logger.debug(stmt.getQueryString()); logger.debug("key = {}", key); ResultSet rs = session.execute(stmt.bind(key)); if (rs.isExhausted()) { return Status.NOT_FOUND; } Row row = rs.one(); ColumnDefinitions cd = row.getColumnDefinitions(); for (ColumnDefinitions.Definition def : cd) { ByteBuffer val = row.getBytesUnsafe(def.getName()); if (val != null) { result.put(def.getName(), new ByteArrayByteIterator(val.array())); } else { result.put(def.getName(), null); } } return Status.OK; } catch (Exception e) { logger.error(MessageFormatter.format("Error reading key: {}", key).getMessage(), e); return Status.ERROR; } }
Source:
<code>private boolean addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { final boolean isAllowedToExecute = loggedIn || isPublic; final boolean operationCanBeAdded = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute) { if (operationCanBeAdded && operationQueue.add(operation)) { processor.processOperation(this); <START> VdcOperationExecutedEvent.fire(eventBus, operation); <END> } } return isAllowedToExecute; }</code><technical_language>Instead of firing this receiver figure out if do something, determine if fire event here, receiver do needs do receives event</technical_language>

Target:
private boolean addOperation(final VdcOperation<?, ?> operation, final boolean isPublic) { final boolean isAllowedToExecute = loggedIn || isPublic; final boolean operationCanBeAdded = !operationQueue.contains(operation) || operation.allowDuplicates(); if (isAllowedToExecute) { if (operationCanBeAdded && operationQueue.add(operation)) { processor.processOperation(this); if (engineSessionRefreshed(operation)) { EngineSessionRefreshedEvent.fire(eventBus); } } } return isAllowedToExecute; }
Source:
<code>protected void renderArguments(FunctionRenderContext context, WindowFunction windowFunction) { Iterator<String> argumentIterator = windowFunction.getArguments().iterator(); while (argumentIterator.hasNext()) { context.addChunk(argumentIterator.next()); if (argumentIterator.hasNext()) { context.addChunk(", "); } } <START> } <END></code><technical_language>dealing array lists here, prefer iteration like: List<String> arguments = windowFunction.getArguments(); int size = arguments.size(); if (size != 0) { context.addChunk(arguments.get(0)); for (int i = 1; i < size; i++) { context.addChunk(", "); context.addChunk(arguments.get(i)); } } for other iterations in this class</technical_language>

Target:
protected void renderArguments(FunctionRenderContext context, WindowFunction windowFunction) { List<String> arguments = windowFunction.getArguments(); int size = arguments.size(); if (size != 0) { List<String> filterExpressions = windowFunction.getFilterExpressions(); int filtersSize = filterExpressions.size(); if (supportsFilterClause || filtersSize == 0) { renderArgument(context, windowFunction, null, null, arguments.get(0), 0); for (int i = 1; i < size; i++) { context.addChunk(", "); renderArgument(context, windowFunction, null, null, arguments.get(i), i); } } else { String caseWhenPre = getCaseWhenPre(filterExpressions); String caseWhenPost = getCaseWhenPost(); renderArgument(context, windowFunction, caseWhenPre, caseWhenPost, arguments.get(0), 0); for (int i = 1; i < size; i++) { context.addChunk(", "); renderArgument(context, windowFunction, caseWhenPre, caseWhenPost, arguments.get(i), i); } } } }
Source:
<code>static Endpoint parseEndpoint(JsonParser parser) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IOException("Not a valid JSON object, start token: " + parser.currentToken()); } String serviceName = null, ipv4 = null, ipv6 = null; int port = 0; while (parser.nextToken() != JsonToken.END_OBJECT) { JsonToken value = parser.nextValue(); if (value == JsonToken.VALUE_NULL) { continue; } switch (parser.currentName()) { case "serviceName": serviceName = parser.getText(); break; case "ipv4": ipv4 = parser.getText(); break; case "ipv6": ipv6 = parser.getText(); break; case "port": port = parser.getIntValue(); break; default: } } if (serviceName == null && ipv4 == null && ipv6 == null && port == 0) return null; <START> return Endpoint.newBuilder() <END> .serviceName(serviceName) .ip(ipv4) .ip(ipv6) .port(port) .build(); }</code><technical_language>I presume this part a straight port of one.. I forget precedence of ipv4 ipv6</technical_language>

Target:
static Endpoint parseEndpoint(JsonParser parser) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IllegalArgumentException("Not a valid JSON object, start token: " + parser.currentToken()); } String serviceName = null, ipv4 = null, ipv6 = null; int port = 0; while (parser.nextToken() != JsonToken.END_OBJECT) { JsonToken value = parser.nextValue(); if (value == JsonToken.VALUE_NULL) { continue; } switch (parser.currentName()) { case "serviceName": serviceName = parser.getText(); break; case "ipv4": ipv4 = parser.getText(); break; case "ipv6": ipv6 = parser.getText(); break; case "port": port = parser.getIntValue(); break; default: } } if (serviceName == null && ipv4 == null && ipv6 == null && port == 0) return null; return Endpoint.newBuilder() .serviceName(serviceName) .ip(ipv4) .ip(ipv6) .port(port) .build(); }
Source:
<code>public Jdbi build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name) { <START> final Jdbi jdbi = this.newInstance(dataSource); <END> environment.lifecycle().manage(dataSource); final String validationQuery = configuration.getValidationQuery(); environment.healthChecks().register(name, new JdbiHealthCheck( environment.getHealthCheckExecutorService(), configuration.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)), jdbi, validationQuery)); jdbi.setTimingCollector(new InstrumentedTimingCollector(environment.metrics(), nameStrategy)); if (configuration.isAutoCommentsEnabled()) { final TemplateEngine original = jdbi.getConfig(SqlStatements.class).getTemplateEngine(); jdbi.setTemplateEngine(new NamePrependingTemplateEngine(original)); } configure(jdbi, configuration); return jdbi; }</code><technical_language>this redundant, superclass for JdbiFactory a method name</technical_language>

Target:
public Jdbi build(Environment environment, PooledDataSourceFactory configuration, ManagedDataSource dataSource, String name) { final Jdbi jdbi = newInstance(dataSource); environment.lifecycle().manage(dataSource); final String validationQuery = configuration.getValidationQuery(); environment.healthChecks().register(name, new JdbiHealthCheck( environment.getHealthCheckExecutorService(), configuration.getValidationQueryTimeout().orElseGet(() -> Duration.seconds(5)), jdbi, validationQuery)); jdbi.setTimingCollector(new InstrumentedTimingCollector(environment.metrics(), nameStrategy)); if (configuration.isAutoCommentsEnabled()) { final TemplateEngine original = jdbi.getConfig(SqlStatements.class).getTemplateEngine(); jdbi.setTemplateEngine(new NamePrependingTemplateEngine(original)); } configure(jdbi); return jdbi; }
Source:
<code>private ValidationResult validateCoherentNetworkIdentification(NetworkAttachment attachment) { Guid networkId = attachment.getNetworkId(); String networkName = attachment.getNetworkName(); Guid violatingEntityId = attachment.getId(); <START> return validateCoherentIdentification(violatingEntityId == null ? null : violatingEntityId.toString(), <END> networkId, networkName, EngineMessage.NETWORK_ATTACHMENT_REFERENCES_NETWORK_INCOHERENTLY, networkBusinessEntityMap); }</code><technical_language>String.valueOf(str)</technical_language>

Target:
private ValidationResult validateCoherentNetworkIdentification(NetworkAttachment attachment) { Guid networkId = attachment.getNetworkId(); String networkName = attachment.getNetworkName(); Guid violatingEntityId = attachment.getId(); return validateCoherentIdentification(String.valueOf(violatingEntityId), networkId, networkName, EngineMessage.NETWORK_ATTACHMENT_REFERENCES_NETWORK_INCOHERENTLY, networkBusinessEntityMap); }
Source:
<code>public String getUsernameWithProfile() { String user = String.format("%s@%s", <START> StringUtils.defaultIfEmpty(username, <END> ""), StringUtils.defaultIfEmpty(profile, "")); return "@".equals(user) ? "N/A" : user; }</code><technical_language>please java.util.Objects.toString(username, "") instead</technical_language>

Target:
public String getUsernameWithProfile() { String user = String.format("%s@%s", java.util.Objects.toString(username, ""), java.util.Objects.toString(profile, "")); return "@".equals(user) ? "N/A" : user; }
Source:
<code>private Container getRandomContainer(short accountId) { short refContainerId = Utils.getRandomShort(TestUtils.RANDOM); String refContainerName = UtilsTest.getRandomString(10); Container.ContainerStatus refContainerStatus = Container.ContainerStatus.ACTIVE; String refContainerDescription = UtilsTest.getRandomString(10); boolean refContainerEncryption = TestUtils.RANDOM.nextBoolean(); boolean refContainerPreviousEncryption = refContainerEncryption || TestUtils.RANDOM.nextBoolean(); boolean refContainerCaching = TestUtils.RANDOM.nextBoolean(); boolean refContainerMediaScanDisabled = TestUtils.RANDOM.nextBoolean(); <START> boolean refContainerTtlRequired = TestUtils.RANDOM.nextBoolean(); <END> return new ContainerBuilder(refContainerId, refContainerName, refContainerStatus, refContainerDescription, accountId).setEncrypted(refContainerEncryption) .setPreviouslyEncrypted(refContainerPreviousEncryption) .setCacheable(refContainerCaching) .setMediaScanDisabled(refContainerMediaScanDisabled) .setTtlRequired(refContainerTtlRequired) .build(); }</code><technical_language>this random</technical_language>

Target:
private Container getRandomContainer(short accountId) { short refContainerId = Utils.getRandomShort(TestUtils.RANDOM); String refContainerName = UtilsTest.getRandomString(10); Container.ContainerStatus refContainerStatus = Container.ContainerStatus.ACTIVE; String refContainerDescription = UtilsTest.getRandomString(10); boolean refContainerEncryption = TestUtils.RANDOM.nextBoolean(); boolean refContainerPreviousEncryption = refContainerEncryption || TestUtils.RANDOM.nextBoolean(); boolean refContainerCaching = TestUtils.RANDOM.nextBoolean(); boolean refContainerMediaScanDisabled = TestUtils.RANDOM.nextBoolean(); return new ContainerBuilder(refContainerId, refContainerName, refContainerStatus, refContainerDescription, accountId).setEncrypted(refContainerEncryption) .setPreviouslyEncrypted(refContainerPreviousEncryption) .setCacheable(refContainerCaching) .setMediaScanDisabled(refContainerMediaScanDisabled) .setTtlRequired(false) .build(); }
Source:
<code>private static String getPathString(IPath path, boolean isCygwin) { String s = path.toString(); if (isCygwin) { <START> s = s.replaceAll("^([A-Z])(:)", "/" + CYGWIN_PREFIX + "/$1"); END> } else { s = s.replaceAll("^([A-Z])(:)", "/$1"); } return s; }</code><technical_language>is in brackets? check capitals, drive letter lowercase? I windows case insensitive if user typed lowercase</technical_language>

Target:
private static String getPathString(IPath path, boolean isCygwin) { String s = path.toString(); if (isCygwin) { s = s.replaceAll("^([a-zA-Z]):", "/" + CYGWIN_PREFIX + "/$1"); } else { s = s.replaceAll("^([a-zA-Z]):", "/$1"); } return s; }
Source:
<code>private List<NetworkAttachment> getNetworkAttachmentsToSync(Guid hostId, List<Network> networks) { List<NetworkAttachment> allAttachmentsOfHost = networkAttachmentDao.getAllForHost(hostId); Map<Guid, NetworkAttachment> attachmentsByNetworkId = new MapNetworkAttachments(allAttachmentsOfHost).byNetworkId(); List<NetworkAttachment> attachmentsToSync = new ArrayList<>(); for (Network network : networks) { Guid networkId = network.getId(); NetworkAttachment attachmentToSync = attachmentsByNetworkId.get(networkId); attachmentToSync.setOverrideConfiguration(!attachmentToSync.isQosOverridden()); <START> attachmentsToSync.add(attachmentToSync); <END> } return attachmentsToSync; }</code><technical_language>HostSetupNetworks ignore it. adding 'attachmentsToSync' in case 'attachmentToSync.isQosOverridden()'. important, giving +2..</technical_language>

Target:
private List<NetworkAttachment> getNetworkAttachmentsToSync(Guid hostId, List<Network> networks) { List<NetworkAttachment> allAttachmentsOfHost = networkAttachmentDao.getAllForHost(hostId); Map<Guid, NetworkAttachment> attachmentsByNetworkId = new MapNetworkAttachments(allAttachmentsOfHost).byNetworkId(); List<NetworkAttachment> attachmentsToSync = new ArrayList<>(); for (Network network : networks) { Guid networkId = network.getId(); NetworkAttachment attachmentToSync = attachmentsByNetworkId.get(networkId); if (!attachmentToSync.isQosOverridden()) { attachmentToSync.setOverrideConfiguration(true); attachmentsToSync.add(attachmentToSync); } } return attachmentsToSync; }
Source:
<code>public static Object[] inject(final Parameter[] parameters, final Set<InjectableParameter> filters, final Object[] args, final Method injectionMethod, final ITestContext context, final ITestResult testResult) { if (filters == null || filters.isEmpty()) { return args; } final ArrayList<Object> arguments = new ArrayList<>(args.length); final ListBackedImmutableQueue<Object> queue = new ListBackedImmutableQueue<>(args); boolean firstMethodInjected = false; for (final Parameter parameter : parameters) { boolean inject = false; Object injectObject = null; for (final InjectableParameter injectableParameter : filters) { inject = canInject(parameter, injectableParameter); switch (injectableParameter) { case CURRENT_TEST_METHOD: injectObject = injectionMethod; if (inject && !firstMethodInjected) { firstMethodInjected = true; } else { inject = false; } break; case ITEST_CONTEXT: injectObject = context; break; case ITEST_RESULT: injectObject = testResult; break; case XML_TEST: injectObject = context != null ? context.getCurrentXmlTest() : null; break; default: break; } if (inject) { arguments.add(injectObject); break; } } if (!inject) { arguments.add(queue.poll()); } } <START> if (!queue.backingList.isEmpty()) { END> String msg = MethodMatcherException.generateMessage("Missing one or more parameters " + "that are being injected by the data provider. Please add the below arguments to the method.", injectionMethod, queue.backingList.toArray()); boolean block = Boolean.parseBoolean(System.getProperty("strictParameterMatch")); if (block) { throw new MethodMatcherException(msg); } else { System.err.println(":::WARNING:::\n" + msg); } } final Object[] injectedArray = new Object[arguments.size()]; return arguments.toArray(injectedArray); }</code><technical_language>find a remove logic Parameters#getInjectedParameter</technical_language>

Target:
public static Object[] inject(final Parameter[] parameters, final Set<InjectableParameter> filters, final Object[] args, final Method injectionMethod, final ITestContext context, final ITestResult testResult) { return nativelyInject(parameters, filters, args, injectionMethod, context, testResult); }
Source:
<code><START> public String getNickname() <END> { return nickname; }</code><technical_language>break lines</technical_language>

Target:
public String getNickname() { return _nickname; }
Source:
<code>private boolean isEqualParameterTypes(IService service1, IService service2) { final List<IType> paramTypes1 = service1.getParameterTypes(queryEnvironment); final List<IType> paramTypes2 = service2.getParameterTypes(queryEnvironment); boolean result = paramTypes1.size() == paramTypes2.size(); if (result) { final Iterator<IType> it1 = paramTypes1.iterator(); final Iterator<IType> it2 = paramTypes2.iterator(); <START> while (it1.hasNext()) { <END> IType paramType1 = it1.next(); IType paramType2 = it2.next(); if (!paramType2.equals(paramType1)) { result = false; break; } } } return result; }</code><technical_language>&& result</technical_language>

Target:
private boolean isEqualParameterTypes(IService service1, IService service2) { final List<IType> paramTypes1 = service1.getParameterTypes(queryEnvironment); final List<IType> paramTypes2 = service2.getParameterTypes(queryEnvironment); boolean result = paramTypes1.size() == paramTypes2.size(); final Iterator<IType> it1 = paramTypes1.iterator(); final Iterator<IType> it2 = paramTypes2.iterator(); while (result && it1.hasNext()) { IType paramType1 = it1.next(); IType paramType2 = it2.next(); if (!paramType2.equals(paramType1)) { result = false; } } return result; }
Source:
<code>protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception { if (frame instanceof CloseWebSocketFrame) { serverReceivedCloseHandshake = true; <START> frame.retain(); <END> return; } super.decode(ctx, frame, out); }</code><technical_language>do retain ? This a memory leak</technical_language>

Target:
protected void decode(ChannelHandlerContext ctx, WebSocketFrame frame, List<Object> out) throws Exception { if (frame instanceof CloseWebSocketFrame) { serverReceivedCloseHandshake = true; return; } super.decode(ctx, frame, out); }