auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Message postProcessMessage(Message message) throws AmqpException { ByteArrayOutputStream zipped = new ByteArrayOutputStream(); try { OutputStream zipper = getCompressorStream(zipped); FileCopyUtils.copy(new ByteArrayInputStream(message.getBody()), zipper); MessageProperties originalProperties = message.getMessageProperties(); <START> MessageBuilderSupport<MessageProperties> messagePropertiesMessageBuilder = <END> MessagePropertiesBuilder.fromClonedProperties(originalProperties) .setContentEncoding(getEncoding() + (originalProperties.getContentEncoding() == null ? "" : ":" + originalProperties.getContentEncoding())); if (this.autoDecompress) { messagePropertiesMessageBuilder.setHeader(MessageProperties.SPRING_AUTO_DECOMPRESS, true); } MessageProperties messageProperties = messagePropertiesMessageBuilder.build(); byte[] compressed = zipped.toByteArray(); if (this.logger.isTraceEnabled()) { this.logger.trace("Compressed " + message.getBody().length + " to " + compressed.length); } return new Message(compressed, messageProperties); } catch (IOException e) { throw new AmqpIOException(e); } }</code><technical_language>abstract type instead of MessagePropertiesBuilder</technical_language>

Target:
public Message postProcessMessage(Message message) throws AmqpException { try { ByteArrayOutputStream zipped = new ByteArrayOutputStream(); OutputStream zipper = getCompressorStream(zipped); FileCopyUtils.copy(new ByteArrayInputStream(message.getBody()), zipper); byte[] compressed = zipped.toByteArray(); if (this.logger.isTraceEnabled()) { this.logger.trace("Compressed " + message.getBody().length + " to " + compressed.length); } MessageProperties originalProperties = message.getMessageProperties(); MessagePropertiesBuilder messagePropertiesBuilder = this.copyProperties ? MessagePropertiesBuilder.fromClonedProperties(originalProperties) : MessagePropertiesBuilder.fromProperties(originalProperties); if (this.autoDecompress) { messagePropertiesBuilder.setHeader(MessageProperties.SPRING_AUTO_DECOMPRESS, true); } MessageProperties messageProperties = messagePropertiesBuilder.setContentEncoding(getEncoding() + (originalProperties.getContentEncoding() == null ? "" : ":" + originalProperties.getContentEncoding())) .build(); return new Message(compressed, messageProperties); } catch (IOException e) { throw new AmqpIOException(e); } }
Source:
<code>protected HashMap<String, String> evalDynamicProperties() throws ConfigurationException { HashMap<String, String> newParametersToSave = new HashMap<>(); <START> evalEnvironmentVariables(); <END> evalLoopbackURL(); evalServerStatusKey(newParametersToSave); return newParametersToSave; }</code><technical_language>newParametersToSave</technical_language>

Target:
protected HashMap<String, String> evalDynamicProperties() throws ConfigurationException { HashMap<String, String> newParametersToSave = new HashMap<>(); evalEnvironmentVariables(newParametersToSave); evalLoopbackURL(); evalServerStatusKey(newParametersToSave); return newParametersToSave; }
Source:
<code>public void addImport(String classQualifiedName) { if (couldNotBeLoaded.contains(classQualifiedName)) { loadJavaExtensions(Sets.newHashSet(classQualifiedName)); } if (classQualifiedName != null && classQualifiedName.contains(".") && !imports.contains(classQualifiedName)) { Set<String> addedImport = <START> Sets.newLinkedHashSet(); addedImport.add(classQualifiedName); <END> imports.add(classQualifiedName); loadJavaExtensions(addedImport); } }</code><technical_language>Collections.singleton()</technical_language>

Target:
public void addImport(String classQualifiedName) { if (couldNotBeLoaded.contains(classQualifiedName)) { loadJavaExtensions(Sets.newHashSet(classQualifiedName)); } if (classQualifiedName != null && classQualifiedName.contains(".") && !imports.contains(classQualifiedName)) { imports.add(classQualifiedName); loadJavaExtensions(Collections.singleton(classQualifiedName)); } }
Source:
<code>public void before() throws Exception { serverLooper = new NIOLooper(); clientLooper = new NIOLooper(); threadPools = Executors.newFixedThreadPool(2); backendStorage = mock(IStatefulStorage.class); HeronSocketOptions serverSocketOptions = <START> new HeronSocketOptions(100 * 1024 * 1024, 100, <END> 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024); serverPort = SysUtils.getFreePort(); checkpointManagerServer = new CheckpointManagerServer( TOPOLOGY_NAME, TOPOLOGY_ID, CHECKPOINT_MANAGER_ID, backendStorage, serverLooper, SERVER_HOST, serverPort, serverSocketOptions); runServer(); Thread.sleep(2 * 1000); }</code><technical_language>ouch. HeronSocketOptions needs updated ByteAmount in another pr</technical_language>

Target:
public void before() throws Exception { finishedSignal = new CountDownLatch(1); serverLooper = new NIOLooper(); clientLooper = new NIOLooper(); threadPools = Executors.newFixedThreadPool(2); backendStorage = mock(IStatefulStorage.class); HeronSocketOptions serverSocketOptions = new HeronSocketOptions(100 * 1024 * 1024, 100, 100 * 1024 * 1024, 100, 5 * 1024 * 1024, 5 * 1024 * 1024); serverPort = SysUtils.getFreePort(); checkpointManagerServer = new CheckpointManagerServer( TOPOLOGY_NAME, TOPOLOGY_ID, CHECKPOINT_MANAGER_ID, backendStorage, serverLooper, SERVER_HOST, serverPort, serverSocketOptions); runServer(); }
Source:
<code>public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { this(baseUrl, teamDomain, botUser, roomId, replyBroadcast); if (populatedToken == null) { <START> throw new IllegalArgumentException("populatedToken cannot be null"); <END> } this.populatedToken = populatedToken; }</code><technical_language>name like: suggestion throw new IllegalArgumentException("No slack token found, setup a secret text credential configure used");</technical_language>

Target:
public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken) { this(baseUrl, teamDomain, botUser, roomId, replyBroadcast); if (populatedToken == null) { throw new IllegalArgumentException("No slack token found, setup a secret text credential and configure it to be used"); } this.populatedToken = populatedToken; }
Source:
<code>public void testNormalWSDeflateFrameCompressionNegotiation() throws Exception { <START> String path = "/some/path"; <END> Buffer buff = Buffer.buffer("AAA"); server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT)).websocketHandler(ws -> { assertEquals("upgrade", ws.headers().get("Connection")); assertEquals("deflate-frame", ws.headers().get("sec-websocket-extensions")); ws.writeFrame(WebSocketFrame.binaryFrame(buff, true)); }); server.listen(ar -> { assertTrue(ar.succeeded()); HttpClientOptions options = new HttpClientOptions(); options.setTryWebsocketDefalteFrameCompression(true); client = vertx.createHttpClient(options); client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, ws -> { final Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); } }); }); }); await(); }</code><technical_language>indent is 2 spaces</technical_language>

Target:
public void testNormalWSDeflateFrameCompressionNegotiation() throws Exception { String path = "/some/path"; Buffer buff = Buffer.buffer("AAA"); server = vertx.createHttpServer(new HttpServerOptions().setPort(HttpTestBase.DEFAULT_HTTP_PORT)) .websocketHandler(ws -> { assertEquals("upgrade", ws.headers().get("Connection")); assertEquals("deflate-frame", ws.headers().get("sec-websocket-extensions")); ws.writeFrame(WebSocketFrame.binaryFrame(buff, true)); }); server.listen(ar -> { assertTrue(ar.succeeded()); HttpClientOptions options = new HttpClientOptions(); options.setTryUsePerFrameWebsocketCompression(true); client = vertx.createHttpClient(options); client.websocket(HttpTestBase.DEFAULT_HTTP_PORT, HttpTestBase.DEFAULT_HTTP_HOST, path, ws -> { final Buffer received = Buffer.buffer(); ws.handler(data -> { received.appendBuffer(data); if (received.length() == buff.length()) { assertEquals(buff, received); ws.close(); testComplete(); } }); }); }); await(); }
Source:
<code>public static CompositeName toDecomposedCompositeName(final Name name) throws InvalidNameException { if (name instanceof CompositeName) { return (CompositeName) name; } else { final CompositeName compositeName = new CompositeName(); <START> compositeName.addAll(new CompositeName(name.toString())); <END> return compositeName; } }</code><technical_language>I this work right name a compound name a scheme CompositeName parser support. I source name components added composite name function correctly for name types work differently SimpleName (i.e. right-to-left a non-slash separator)</technical_language>

Target:
public static CompositeName toDecomposedCompositeName(final Name name) throws InvalidNameException { if (name instanceof CompositeName) { return (CompositeName) name; } else { final CompositeName compositeName = new CompositeName(); final Enumeration<String> enumeration = name.getAll(); if (enumeration.hasMoreElements()) { int idx = 0; String item; do { item = enumeration.nextElement(); if (item == null) { throw Messages.log.invalidNullSegment(idx); } compositeName.add(item); idx ++; } while (enumeration.hasMoreElements()); } return compositeName; } }
Source:
<code>private void transformFileGroupingEvent( PromoteCompleteEvent event, FileGroupingEvent fileGroupingEvent ) { PathsPromoteCompleteEvent pathsPromoteCompleteEvent = null; if ( event instanceof PathsPromoteCompleteEvent ) { pathsPromoteCompleteEvent = (PathsPromoteCompleteEvent) event; } PathsPromoteResult promoteResult = pathsPromoteCompleteEvent.getPromoteResult(); String error = promoteResult.getError(); if ( error != null ) { logger.trace( "Error in promoteResult, skip audit." ); return; } Set<String> paths = promoteResult.getCompletedPaths(); <START> if ( paths.isEmpty() ) <END> { logger.trace( "No completedPaths, skip audit." ); return; } PathsPromoteRequest req = promoteResult.getRequest(); StoreKey source = req.getSource(); StoreKey target = req.getTarget(); Map<String, String> extra = new HashMap<>(); extra.put( "source", source.toString() ); extra.put( "target", target.toString() ); fileGroupingEvent.setExtra( extra ); fileGroupingEvent.setTimestamp( new Date() ); TrackingKey trackingKey = getTrackingKey( source ); if ( trackingKey == null ) { logger.trace( "No tracking key found to: {}", source ); return; } fileGroupingEvent.setSessionId( trackingKey.getId() ); }</code><technical_language>else? I currently type of PromoteCompleteEvent is Paths, I need prevent NPE if some new types added in future</technical_language>

Target:
private void transformFileGroupingEvent( PromoteCompleteEvent event, FileGroupingEvent fileGroupingEvent ) { PathsPromoteCompleteEvent pathsPromoteCompleteEvent = (PathsPromoteCompleteEvent)event; PathsPromoteResult promoteResult = pathsPromoteCompleteEvent.getPromoteResult(); String error = promoteResult.getError(); if ( error != null ) { logger.trace( "Error in promoteResult, skip audit." ); return; } Set<String> paths = promoteResult.getCompletedPaths(); if ( paths.isEmpty() ) { logger.trace( "No completedPaths, skip audit." ); return; } PathsPromoteRequest req = promoteResult.getRequest(); StoreKey source = req.getSource(); StoreKey target = req.getTarget(); TrackingKey trackingKey = getTrackingKey( source ); if ( trackingKey == null ) { logger.trace( "No tracking key found to: {}", source ); return; } Map<String, String> extra = new HashMap<>(); extra.put( EventConstants.SOURCE, source.toString() ); extra.put( EventConstants.TARGET, target.toString() ); fileGroupingEvent.setExtra( extra ); fileGroupingEvent.setTimestamp( new Date() ); fileGroupingEvent.setSessionId( trackingKey.getId() ); }
Source:
<code>public static void clean(ByteBuffer buffer) { if (buffer == null || !buffer.isDirect()) return; try { if (buffer.isDirect()) { <START> Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); <END> if (cleaner != null) { mhCleanerClean.bindTo(cleaner).invoke(); } else { Object attach = MemoryUtil.getAttachment(buffer); if (attach instanceof ByteBuffer && attach != buffer) clean((ByteBuffer) attach); } } } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }</code><technical_language>Woops. else</technical_language>

Target:
public static void clean(ByteBuffer buffer) { if (buffer == null || !buffer.isDirect()) return; try { Object cleaner = mhDirectBufferCleaner.bindTo(buffer).invoke(); if (cleaner != null) { mhCleanerClean.bindTo(cleaner).invoke(); } } catch (RuntimeException e) { throw e; } catch (Throwable e) { throw new RuntimeException(e); } }
Source:
<code><START> public static synchronized AppPrefs getInstance() <END> { if(instance == null) { throw new RuntimeException( "AppPrefs instance is null. Make sure it is initialized in ResearchStack before calling."); } return instance; }</code><technical_language>Do want this class compatible mark @Deprecated? I do this change -- a bad idea require context passed time of time context is ignored. Or, if goal is simply force loading of AppPrefs a point, call AppPrefs.getInstance(context) in ResearchStack.init</technical_language>

Target:
public static AppPrefs getInstance() { if(instance == null) { throw new RuntimeException( "AppPrefs instance is null. Make sure it is initialized in ResearchStack before calling."); } return instance; }
Source:
<code>public void assertCanDelete(Project project) throws CannotDeleteProjectException { try { if (db.submoduleSubscriptions().bySubmoduleProject(project.getNameKey()) .iterator().hasNext()) { throw new CannotDeleteProjectException("Project is subscribed by other projects."); } } catch (OrmException e) { <START> throw new CannotDeleteProjectException(e); <END> } }</code><technical_language>here, I SQLException wrapped a CannotDeleteProjectException OrmException</technical_language>

Target:
public void assertCanDelete(Project project) throws CannotDeleteProjectException, OrmException { if (db.submoduleSubscriptions().bySubmoduleProject(project.getNameKey()) .iterator().hasNext()) { throw new CannotDeleteProjectException( "Project is subscribed by other projects."); } }
Source:
<code><START> public Builder transform(List<? extends Transformation> transformations) { <END> if (transformations == null) { throw new IllegalArgumentException("Transformation list must not be null."); } for (Object transformation : transformations) { transform((Transformation) transformation); } return this; }</code><technical_language>want List<? super Transformation> here. get Transformation objects casting</technical_language>

Target:
public Builder transform(List<? extends Transformation> transformations) { if (transformations == null) { throw new IllegalArgumentException("Transformation list must not be null."); } for (Transformation transformation : transformations) { transform(transformation); } return this; }
Source:
<code>public boolean isRepoExist(String repo) { String fullItemUrl = artifactoryUrl + API_REPOSITORIES + "/" + repo; String encodedUrl = ArtifactoryHttpClient.encodeUrl(fullItemUrl); HttpRequestBase httpRequest = new HttpGet(encodedUrl); HttpResponse httpResponse = null; int connectionRetries = httpClient.getConnectionRetries(); try { httpResponse = httpClient.getHttpClient().execute(httpRequest); StatusLine statusLine = httpResponse.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { return false; } } catch (IOException e) { <START> return false; <END> } finally { httpClient.setConnectionRetries(connectionRetries); if (httpResponse != null) { EntityUtils.consumeQuietly(httpResponse.getEntity()); } } return true; }</code><technical_language>I is remove this catch allow this method throw exception</technical_language>

Target:
public boolean isRepoExist(String repo) throws IOException { String fullItemUrl = artifactoryUrl + API_REPOSITORIES + "/" + repo; String encodedUrl = ArtifactoryHttpClient.encodeUrl(fullItemUrl); HttpRequestBase httpRequest = new HttpGet(encodedUrl); HttpResponse httpResponse = null; int connectionRetries = httpClient.getConnectionRetries(); try { httpResponse = httpClient.getHttpClient().execute(httpRequest); StatusLine statusLine = httpResponse.getStatusLine(); if (statusLine.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { return false; } } finally { httpClient.setConnectionRetries(connectionRetries); if (httpResponse != null) { EntityUtils.consumeQuietly(httpResponse.getEntity()); } } return true; }
Source:
<code>private List getUniqKVCount(List<MemKey> memKeys) { <START> List<Integer> kvCounts = new ArrayList<Integer>(); <END> for (MemKey m : memKeys) { kvCounts.add(m.getKVCount()); } return ImmutableSet.copyOf(kvCounts).asList(); }</code><technical_language>this intended a Set<Integer></technical_language>

Target:
private int getUniqKVCount(List<MemKey> memKeys) { List<Integer> kvCounts = new ArrayList<Integer>(); for (MemKey m : memKeys) { kvCounts.add(m.getKVCount()); } return ImmutableSet.copyOf(kvCounts).size(); }
Source:
<code>public void refreshTraceType() { try { fTraceTypeId = getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE); } catch (CoreException e) { <START> Activator.getDefault().logError("Error refreshing trace type pesistent property for trace " + getName(), e); END> } }</code><technical_language>externalize</technical_language>

Target:
public void refreshTraceType() { try { fTraceTypeId = getResource().getPersistentProperty(TmfCommonConstants.TRACETYPE); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorRefreshingProperty + getName(), e); } }
Source:
<code>public boolean equals(Object obj) { <START> return obj != null && obj.equals(children); <END> }</code><technical_language>This implementation odd: want check obj is instance of NotLoadedFragmentMatch? a list elements equal this object, dangerous</technical_language>

Target:
public boolean equals(Object obj) { return obj instanceof NotLoadedFragmentMatch && obj.equals(children); }
Source:
<code>public PlannedTime.ItcOverheadProvider getInst() { <START> if (instr.site().displayName.equals("Gemini North")) { <END> return new InstGmosNorth(); } else if (instr.site().displayName.equals("Gemini South")) { return new InstGmosSouth(); } else { throw new Error("invalid site"); } }</code><technical_language>compare Site.GN string</technical_language>

Target:
public PlannedTime.ItcOverheadProvider getInst() { if (instr.site().equals(Site.GN)) { return new InstGmosNorth(); } else if (instr.site().equals(Site.GS)) { return new InstGmosSouth(); } else { throw new Error("invalid site"); } }
Source:
<code>public FixedHistogramJacknifeStateStrategy(long bucketCount, double min, double max) { <START> histogram = new FixedDoubleBreakdownHistogram((int) bucketCount, min, max); <END> }</code><technical_language>(int) -> toIntExact (from Math)</technical_language>

Target:
public FixedHistogramJacknifeStateStrategy(long bucketCount, double min, double max) { FixedHistogramStateStrategyUtils.validateParameters( bucketCount, min, max); histogram = new FixedDoubleBreakdownHistogram(toIntExact(bucketCount), min, max); }
Source:
<code>private void onSource(TransferPanelForm view, TransferForms forms, Source<?> source) { source.getFormList().thenAccept(formList -> { forms.load(formList); view.refresh(); updateActionButtons(); }).onError(cause -> { log.warn("Unable to load form list from {}", source.getDescription(), cause); <START> errorMessage("Error Loading Forms", "Briefcase hasn’t been able to load forms using the configured source. Try Reload or Reset."); <END> }); }</code><technical_language>I of this earlier, "hasn't able to" suggests repeated attempts. I suggest "Briefcase able ..."</technical_language>

Target:
private void onSource(TransferPanelForm view, TransferForms forms, Source<?> source) { source.getFormList().thenAccept(formList -> { forms.load(formList); view.refresh(); updateActionButtons(); }).onError(cause -> { log.warn("Unable to load form list from {}", source.getDescription(), cause); errorMessage("Error Loading Forms", "Briefcase wasn't able to load forms using the configured source. Try Reload or Reset."); }); }
Source:
<code>public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); <START> Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(), ApiMediaType.APPLICATION_X_VIRT_VIEWER); <END> return builder.build(); }</code><technical_language>Findbugs complain character encoding is explicitly specified: descriptor.getBytes(Charset.forName("UTF-8"))</technical_language>

Target:
public Response generateDescriptor() { String consoleString = HexUtils.hex2string(consoleId); GraphicsConsole console = new GraphicsConsole(); console.setProtocol(consoleString); validateEnums(GraphicsConsole.class, console); GraphicsType type = GraphicsType.valueOf(consoleString); org.ovirt.engine.core.common.businessentities.GraphicsType graphicsType = getMappingLocator().getMapper(GraphicsType.class, org.ovirt.engine.core.common.businessentities.GraphicsType.class).map(type, null); ConsoleOptions consoleOptions = new ConsoleOptions(graphicsType); consoleOptions.setVmId(vmGuid); ConsoleOptions configuredOptions = runQuery(VdcQueryType.ConfigureConsoleOptions, new ConfigureConsoleOptionsParams(consoleOptions, true)).getReturnValue(); String descriptor = runQuery(VdcQueryType.GetConsoleDescriptorFile, new ConsoleOptionsParams(configuredOptions)) .getReturnValue(); Response.ResponseBuilder builder = Response.ok(descriptor.getBytes(Charset.forName("UTF-8")), ApiMediaType.APPLICATION_X_VIRT_VIEWER); return builder.build(); }
Source:
<code>public static void returnBuffer(@NotNull byte[] buf) { if (enableStatistics) { numReturns.incrementAndGet(); } int len = buf.length; if (len <= T1) { pool1.returnBuffer(buf); } else if (len <= T2) { pool2.returnBuffer(buf); } else if (len < 2000) { pool3.returnBuffer(buf); } else { logger.warn( "Received a suspiciously large buffer (size = " + len + ")"); } if (ENABLE_BOOKKEEPING) { Integer arrayId = System.identityHashCode(buf); logger.info("Thread " + threadId() + " returned array " + arrayId); if (bookkeeping.containsKey(arrayId)) { returnedBookkeeping.put(arrayId, new ReturnedBufferBookkeepingInfo(bookkeeping.get(arrayId), getStackTrace())); bookkeeping.remove(arrayId); } else if (returnedBookkeeping.containsKey(arrayId)) { logger.info("Thread " + threadId() + " returned a previously-returned buffer at\n" + getStackTraceAsString() + "previously returned at\n" + stackTraceAsString(returnedBookkeeping.get(arrayId).deallocTrace)); } else { <START> logger.info("Thread " + threadId() <END> + " returned a buffer we didn't give out from\n" + getStackTraceAsString()); } } }</code><technical_language>debugging, finding I wish size of buffer here</technical_language>

Target:
public static void returnBuffer(@NotNull byte[] buf) { if (enableStatistics) { numReturns.incrementAndGet(); } int len = buf.length; if (ENABLE_BOOKKEEPING) { Integer arrayId = System.identityHashCode(buf); logger.info("Thread " + threadId() + " returned " + len + "-byte buffer " + arrayId); String s; ReturnedBufferBookkeepingInfo b; if ((s = bookkeeping.remove(arrayId)) != null) { returnedBookkeeping.put(arrayId, new ReturnedBufferBookkeepingInfo(s, UtilKt.getStackTrace())); } else if ((b = returnedBookkeeping.get(arrayId)) != null) { logger.info("Thread " + threadId() + " returned a previously-returned " + len + "-byte buffer at\n" + UtilKt.getStackTrace() + "previously returned at\n" + b.deallocTrace); } else { logger.info("Thread " + threadId() + " returned a " + len + "-byte buffer we didn't give out from\n" + UtilKt.getStackTrace()); } } if (len <= T1) { pool1.returnBuffer(buf); } else if (len <= T2) { pool2.returnBuffer(buf); } else if (len < 2000) { pool3.returnBuffer(buf); } else { logger.warn( "Received a suspiciously large buffer (size = " + len + ")"); } }
Source:
<code>protected void doOperation() { Datastore.initialize(); List<FeedbackQuestion> feedbackQuestions; if (target == ScriptTarget.BY_TIME) { Calendar startCal = Calendar.getInstance(); startCal.add(Calendar.DAY_OF_YEAR, -1 * numDays); feedbackQuestions = getOldQuestionsSince(startCal.getTime()); } else if (target == ScriptTarget.BY_COURSE) { feedbackQuestions = getFeedbackQuestionEntitiesForCourse(courseId); } else if (target == ScriptTarget.ALL) { feedbackQuestions = getAllOldQuestions(); } else { feedbackQuestions = null; Assumption.fail("no target selected"); } <START> List<FeedbackQuestionAttributes> feedbackQuestionAttributes = <END> FeedbackQuestionsDb.getListOfQuestionAttributes(feedbackQuestions); for (FeedbackQuestionAttributes old : feedbackQuestionAttributes) { FeedbackSessionAttributes session = new Logic().getFeedbackSession(old.getFeedbackSessionName(), old.getCourseId()); if (session == null) { System.out.println("question: " + old.getIdentificationString()); System.out.println(String.format("error finding session %s", old.getFeedbackSessionName() + ":" + old.getCourseId())); System.out.println("possibly due to orphaned responses"); continue; } if (isPreview) { FeedbackQuestionAttributes existingQn = new QuestionsDb().getFeedbackQuestion(old.feedbackSessionName, old.courseId, old.getId()); if (existingQn == null) { System.out.println("Will create question: " + old.getIdentificationString()); } else { System.out.println("new qn type already exists for question:" + existingQn.getIdentificationString()); } } else { try { new QuestionsDb().createFeedbackQuestion(session, old); } catch (EntityDoesNotExistException | InvalidParametersException e) { e.printStackTrace(); throw new RuntimeException( String.format("Unable to update existing session %s with question %s", session.getIdentificationString(), old.getIdentificationString()), e); } catch (EntityAlreadyExistsException e) { System.out.println("new qn type already exists for question:" + old.getIdentificationString()); } } } Datastore.getPersistenceManager().close(); }</code><technical_language>This name a misleading referring instance of FeedbackQuestionAttributes a list of</technical_language>

Target:
protected void doOperation() { Datastore.initialize(); List<FeedbackQuestionAttributes> feedbackQuestions = getFeedbackQuestionsToMigrate(target); int studentsSize = feedbackQuestions.size(); System.out.println("Size of feedbackQuestions = " + studentsSize); int i = 0; for (FeedbackQuestionAttributes old : feedbackQuestions) { i += 1; if (i % 100 == 0) { System.out.println("Question " + i + " out of " + studentsSize); } FeedbackSessionAttributes session = new Logic().getFeedbackSession(old.getFeedbackSessionName(), old.getCourseId()); if (session == null) { printErrorMessageForOrphanedQuestion(old); continue; } if (isPreview) { previewMigratedQuestion(old); } else { migrateQuestionInSession(old, session); } } System.out.println("Completed :)"); }
Source:
<code><START> private void logReturnedToken(final AuthenticationRequest request, final AuthenticationResult result) { <END> if (result != null && result.getAccessToken() != null) { String accessTokenHash = createHash(result.getAccessToken()); Logger.v(TAG, String.format("Token with hash %s returned. CorrelationId: %s", accessTokenHash, request.getCorrelationId())); } }</code><technical_language>I wondering if need log hash of refresh token. Technically, is returned refresh token bad if this happens, want find correlation id of request led bad refresh token. do think</technical_language>

Target:
private void logReturnedToken(final AuthenticationRequest request, final AuthenticationResult result) { if (result != null && result.getAccessToken() != null) { String accessTokenHash = createHash(result.getAccessToken()); String refreshTokenHash = createHash(result.getRefreshToken()); Logger.v(TAG, String.format( "Access TokenID %s and Refresh TokenID %s returned. CorrelationId: %s", accessTokenHash, refreshTokenHash, request.getCorrelationId())); } }
Source:
<code>public void shouldPerformExactLookupInCompositeIndex() throws Exception { int label = token.nodeLabel( "Person" ); int firstName = token.propertyKey( "firstname" ); int surname = token.propertyKey( "surname" ); CapableIndexReference index = schemaRead.index( label, firstName, surname ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { IndexValueCapability valueCapability = index.valueCapability( ValueGroup.TEXT ); read.nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.exact( firstName, "Joe" ), <START> IndexQuery.exact( firstName, "Dalton" ) ); <END> assertFoundNodesAndValue( node, uniqueIds, valueCapability, joeDalton ); } }</code><technical_language>firstName -> surname... feels unsettling this assertion error somewhere</technical_language>

Target:
public void shouldPerformExactLookupInCompositeIndex() throws Exception { int label = token.nodeLabel( "Person" ); int firstName = token.propertyKey( "firstname" ); int surname = token.propertyKey( "surname" ); CapableIndexReference index = schemaRead.index( label, firstName, surname ); try ( NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor(); PrimitiveLongSet uniqueIds = Primitive.longSet() ) { IndexValueCapability valueCapability = index.valueCapability( ValueGroup.TEXT ); read.nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.exact( firstName, "Joe" ), IndexQuery.exact( surname, "Dalton" ) ); assertFoundNodesAndValue( node, uniqueIds, valueCapability, joeDalton ); } }
Source:
<code>private static <T> T _request( APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { StripeResponse response = _rawRequest(method, url, params, type, options); int rCode = response.code(); String rBody = response.body(); <START> String requestId = response.requestId(); <END> if (rCode < 200 || rCode >= 300) { handleAPIError(rBody, rCode, requestId); } T resource = APIResource.GSON.fromJson(rBody, clazz); if (resource instanceof StripeObject) { StripeObject obj = (StripeObject)resource; obj.response = response; } return resource; }</code><technical_language>I strong feelings this, I if making interface closer OkHttp's is desirable keeping get/set prefixes for accessors else in library. +1 removing Response part name -- this is implicit methods a StripeResponse object</technical_language>

Target:
private static <T> T _request( APIResource.RequestMethod method, String url, Map<String, Object> params, Class<T> clazz, APIResource.RequestType type, RequestOptions options) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { StripeResponse response = _rawRequest(method, url, params, type, options); int rCode = response.code(); String rBody = response.body(); String requestId = response.requestId(); if (rCode < 200 || rCode >= 300) { handleAPIError(rBody, rCode, requestId); } T resource = APIResource.GSON.fromJson(rBody, clazz); if (resource instanceof StripeObject) { StripeObject obj = (StripeObject)resource; obj.setLastResponse(response); } return resource; }
Source:
<code>public static OrganisationUnit getOrgUnitByPhone(String imei) throws ApiCallException, ExistsMoreThanOneOrgUnitByPhoneException { String url = PreferencesState.getInstance().getDhisURL() + "/api/organisationUnits.json?filter=phoneNumber:like:%s&fields=id,name," + "description," + "code," + "ancestors[id," + "code,level],attributeValues[value,attribute[code]"; url = String.format(url, imei); try { if (!isNetworkAvailable()) { throw new NetworkException(); } Response response = ServerApiCallExecution.executeCall(null, url, "GET"); JSONObject body = ServerApiUtils.getApiResponseAsJSONObject(response); JSONArray orgUnitsArray = (JSONArray) body.get(TAG_ORGANISATIONUNITS); boolean moreThanOneOrgUnit = false; if (orgUnitsArray.length() == 0) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", imei, orgUnitsArray.length())); return null; } else if (orgUnitsArray.length() > 1) { <START> moreThanOneOrgUnit = true; <END> } JSONObject orgUnitJO = (JSONObject) orgUnitsArray.get(0); OrganisationUnit organisationUnit = parseOrgUnit(orgUnitJO); if (moreThanOneOrgUnit) { throw new ExistsMoreThanOneOrgUnitByPhoneException(imei, organisationUnit); } else { return organisationUnit; } } catch (ExistsMoreThanOneOrgUnitByPhoneException existsMoreThanOneOrgUnitByPhoneException) { throw existsMoreThanOneOrgUnitByPhoneException; } catch (Exception ex) { throw new ApiCallException(ex); } }</code><technical_language>@xurxodev do need this flag? ask for orgUnitsArray.length()>1 in condition throw exception</technical_language>

Target:
public static OrganisationUnit getOrgUnitByPhone(String imei) throws ApiCallException, ExistsMoreThanOneOrgUnitByPhoneException { String url = PreferencesState.getInstance().getDhisURL() + "/api/organisationUnits.json?filter=phoneNumber:like:%s&fields=id,name," + "description," + "code," + "ancestors[id," + "code,level],attributeValues[value,attribute[code]"; url = String.format(url, imei); try { if (!isNetworkAvailable()) { throw new NetworkException(); } Response response = ServerApiCallExecution.executeCall(null, url, "GET"); JSONObject body = ServerApiUtils.getApiResponseAsJSONObject(response); JSONArray orgUnitsArray = (JSONArray) body.get(TAG_ORGANISATIONUNITS); if (orgUnitsArray.length() == 0) { Log.e(TAG, String.format("getOrgUnitData(%s) -> Found %d matches", imei, orgUnitsArray.length())); return null; } JSONObject orgUnitJO = (JSONObject) orgUnitsArray.get(0); OrganisationUnit organisationUnit = parseOrgUnit(orgUnitJO); if (orgUnitsArray.length() > 1) { throw new ExistsMoreThanOneOrgUnitByPhoneException(imei, organisationUnit); } else { return organisationUnit; } } catch (ExistsMoreThanOneOrgUnitByPhoneException existsMoreThanOneOrgUnitByPhoneException) { throw existsMoreThanOneOrgUnitByPhoneException; } catch (Exception ex) { throw new ApiCallException(ex); } }
Source:
<code>private void loggedInAndFinish(ArrayList<Integer> oldSitesIds, boolean doLoginUpdate) { switch (getLoginMode()) { case FULL: case WPCOM_LOGIN_ONLY: ActivityLauncher.showMainActivityAndLoginEpilogue(this, oldSitesIds, doLoginUpdate); setResult(Activity.RESULT_OK); finish(); break; case JETPACK_STATS: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, true); break; case WPCOM_LOGIN_DEEPLINK: case WPCOM_REAUTHENTICATE: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, false); break; case SHARE_INTENT: case SELFHOSTED_ONLY: ArrayList<Integer> currentSiteIds = new ArrayList<>(); int newlyAddedSiteId = -1; for (SiteModel site : mSiteStore.getSites()) { currentSiteIds.add(site.getId()); } currentSiteIds.removeAll(oldSitesIds); if (currentSiteIds.size() == 1) { newlyAddedSiteId = currentSiteIds.get(0); } Intent intent = new Intent(); <START> intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, newlyAddedSiteId); <END> setResult(Activity.RESULT_OK, intent); finish(); break; } }</code><technical_language>do leaving out setting extra if find newly added selfhosted site? Feels weird setting Extra if passing it. Do need passed? While it, letting error condition (no site found) unhandled. thinking, check for currentSiteIds's size greater 0 report error message if 0? this: suggestion if (currentSiteIds.size() == 0) { Log.e(T.MAIN, "Couldn't detect newly added self-hosted site!"); ToastUtils.showToast(this, R.string.failed_selecting_added_site); } else { intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, currentSiteIds.get(0)); }</technical_language>

Target:
private void loggedInAndFinish(ArrayList<Integer> oldSitesIds, boolean doLoginUpdate) { switch (getLoginMode()) { case FULL: case WPCOM_LOGIN_ONLY: ActivityLauncher.showMainActivityAndLoginEpilogue(this, oldSitesIds, doLoginUpdate); setResult(Activity.RESULT_OK); finish(); break; case JETPACK_STATS: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, true); break; case WPCOM_LOGIN_DEEPLINK: case WPCOM_REAUTHENTICATE: ActivityLauncher.showLoginEpilogueForResult(this, true, oldSitesIds, false); break; case SHARE_INTENT: case SELFHOSTED_ONLY: ArrayList<Integer> newSitesIds = new ArrayList<>(); for (SiteModel site : mSiteStore.getSites()) { newSitesIds.add(site.getId()); } newSitesIds.removeAll(oldSitesIds); if (newSitesIds.size() > 0) { Intent intent = new Intent(); intent.putExtra(SitePickerActivity.KEY_LOCAL_ID, newSitesIds.get(0)); setResult(Activity.RESULT_OK, intent); } else { AppLog.e(T.MAIN, "Couldn't detect newly added self-hosted site. " + "Expected at least 1 site ID but was 0."); ToastUtils.showToast(this, R.string.site_picker_failed_selecting_added_site); setResult(Activity.RESULT_OK); } finish(); break; } }
Source:
<code>public void start() { Jmx.register(EsSettingsMBean.OBJECT_NAME, settings); initBootstrap(); Settings esSettings = settings.build(); <START> if (esSettings.getAsInt("discovery.zen.minimum_master_nodes", 1) >= 2) { <END> LOGGER.info("Elasticsearch is waiting for node(s) to be up to start.", esSettings.get("discovery.initial_state_timeout"), esSettings.get("discovery.zen.minimum_master_nodes") ); } node = NodeBuilder.nodeBuilder().settings(esSettings).build(); node.start(); }</code><technical_language>"discovery.zen.minimum_master_nodes" defined in a constant 3 times in this class</technical_language>

Target:
public void start() { Jmx.register(EsSettingsMBean.OBJECT_NAME, settings); initBootstrap(); Settings esSettings = settings.build(); if (esSettings.getAsInt(MIMINUM_MASTER_NODES, 1) >= 2) { LOGGER.info("Elasticsearch is waiting for node(s) to be up to start.", esSettings.get(INITIAL_STATE_TIMEOUT), esSettings.get(MIMINUM_MASTER_NODES) ); } node = NodeBuilder.nodeBuilder().settings(esSettings).build(); node.start(); }
Source:
<code>private boolean doIsSubType(HierarchyType other) { if (fSuperclass != null && (other.isTypeEquivalentTo(fSuperclass) || fSuperclass.doIsSubType(other))) return true; <START> for (HierarchyType fInterface : fInterfaces) { <END> if (other.isTypeEquivalentTo(fInterface) || fInterface.doIsSubType(other)) { return true; } } return false; }</code><technical_language>fix this</technical_language>

Target:
private boolean doIsSubType(HierarchyType other) { if (fSuperclass != null && (other.isTypeEquivalentTo(fSuperclass) || fSuperclass.doIsSubType(other))) return true; for (HierarchyType intf : fInterfaces) { if (other.isTypeEquivalentTo(intf) || intf.doIsSubType(other)) { return true; } } return false; }
Source:
<code>public JavascriptTestExecutor login() { <START> return login((JSObjectBuilder)null, null); <END> }</code><technical_language>suggestion return login((String)null, null);</technical_language>

Target:
public JavascriptTestExecutor login() { return login((String)null, null); }
Source:
<code>private void updateProgress() { <START> int correctIndex = mIndex + 1; <END> if (correctIndex > mCardList.length) { correctIndex = mIndex; } progressSeekBar.setProgress(correctIndex); String progress = correctIndex + "/" + mCardList.length; progressText.setText(progress); }</code><technical_language>I implication of "correct" index, implying is incorrect index, shifting math 1. other parts of app do this Java zero-based arrays, a part of language. do math based index (which is correct incorrect, is, a language fact)</technical_language>

Target:
private void updateProgress() { if (progressSeekBar.getProgress() != mIndex) { progressSeekBar.setProgress(mIndex); } String progress = (mIndex + 1) + "/" + mCardList.length; progressText.setText(progress); }
Source:
<code>public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getStatus() == OzoneManagerProtocolProtos.Status.OK) { omMetadataManager.getVolumeTable().putWithBatch(batchOperation, <START> omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), <END> omVolumeArgs); } }</code><technical_language>need check OMResponse flag also. for existing acl, set OMResponse response false. in case, need added DB</technical_language>

Target:
public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (getOMResponse().getSuccess()) { if ((getOMResponse().hasAddAclResponse() && getOMResponse().getAddAclResponse().getResponse()) || (getOMResponse().hasRemoveAclResponse() && getOMResponse().getRemoveAclResponse().getResponse()) || (getOMResponse().hasSetAclResponse() && getOMResponse().getSetAclResponse().getResponse())) { omMetadataManager.getVolumeTable().putWithBatch(batchOperation, omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), omVolumeArgs); } } }
Source:
<code>public static boolean isDyeable(Item item) { if (item.equals(Items.DYE)) { return true; } final Block block = Block.getBlockFromItem(item); return block.equals(Blocks.WOOL) || block.equals(Blocks.STAINED_GLASS) || block.equals(Blocks.CARPET) || block.equals(Blocks.STAINED_GLASS_PANE) || block.equals(Blocks.STAINED_HARDENED_CLAY) || block.equals(Blocks.CONCRETE) || block.equals(Blocks.CONCRETE_POWDER) <START> || block.equals(Blocks.BED); <END> }</code><technical_language>bed blocks bed items paired? I suggest Items.BED in checks</technical_language>

Target:
public static boolean isDyeable(Item item) { if (item.equals(Items.DYE) || item.equals(Items.BED)) { return true; } final Block block = Block.getBlockFromItem(item); return block.equals(Blocks.WOOL) || block.equals(Blocks.STAINED_GLASS) || block.equals(Blocks.CARPET) || block.equals(Blocks.STAINED_GLASS_PANE) || block.equals(Blocks.STAINED_HARDENED_CLAY) || block.equals(Blocks.CONCRETE) || block.equals(Blocks.CONCRETE_POWDER); }
Source:
<code>private String getCommitMessage(MergeRequest mergeRequest) { if (!step.useMRDescription) return step.mergeCommitMessage; <START> println("Merge description is: "+mergeRequest.getDescription()); <END> String message = "Merge branch '"+mergeRequest.getSourceBranch()+"' into '"+mergeRequest.getTargetBranch()+"'\n\n"+ mergeRequest.getTitle()+"\n\n"+ mergeRequest.getDescription()+"\n\n" + "See merge request !"+mergeRequest.getIid(); return message; }</code><technical_language>this LOGGER object instead</technical_language>

Target:
private String getCommitMessage(MergeRequest mergeRequest) { if (!step.useMRDescription) return step.mergeCommitMessage; String message = "Merge branch '"+mergeRequest.getSourceBranch()+"' into '"+mergeRequest.getTargetBranch()+"'\n\n"+ mergeRequest.getTitle()+"\n\n"+ mergeRequest.getDescription()+"\n\n" + "See merge request !"+mergeRequest.getIid(); return message; }
Source:
<code>private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { <START> if ( descriptor.getApplyingConstraintValidatorClasses().isEmpty() ) { <END> return false; } if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND && !constraintViolations.isEmpty() ) { return false; } if ( executionContext.isFailFastModeEnabled() && !constraintViolations.isEmpty() ) { return false; } return true; }</code><technical_language>_getMatchingConstraintValidatorClasses_ better? _Applying_ sounds strange</technical_language>

Target:
private <T> boolean mainConstraintNeedsEvaluation(ValidationContext<T> executionContext, Set<ConstraintViolation<T>> constraintViolations) { if ( descriptor.getMatchingConstraintValidatorClasses().isEmpty() ) { return false; } if ( descriptor.isReportAsSingleViolation() && descriptor.getCompositionType() == AND && !constraintViolations.isEmpty() ) { return false; } if ( executionContext.isFailFastModeEnabled() && !constraintViolations.isEmpty() ) { return false; } return true; }
Source:
<code>public EntityMetadata lookup(DBCollection collection,String entityName,String version) { EntityMetadata md; EntityVersion v=new EntityVersion(entityName,version); WeakReference<EntityMetadata> ref=cache.get(v); if(ref!=null) md=ref.get(); else md=null; long now=System.currentTimeMillis(); if(lastCacheRefreshTime+cacheTTLMsecs<now) <START> fullRefresh(collection,now); <END> else if(lastVersionLookupTime+versionLookupPeriodMsecs<now) refreshCollectionVersion(collection,now,false); return md; }</code><technical_language>full refresh done cache? this point stale metadata, edge of TTL for cache</technical_language>

Target:
public EntityMetadata lookup(DBCollection collection,String entityName,String version) { long now=System.currentTimeMillis(); if(lastCacheRefreshTime+cacheTTLMsecs<now) fullRefresh(collection,now); else if(lastVersionLookupTime+versionLookupPeriodMsecs<now) refreshCollectionVersion(collection,now,false); EntityMetadata md; EntityVersion v=new EntityVersion(entityName,version); WeakReference<EntityMetadata> ref=cache.get(v); if(ref!=null) md=ref.get(); else md=null; return md; }
Source:
<code>public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ <START> throw new APIException("obs cannot be null!!", (Object[]) null); END> } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewAndVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }</code><technical_language>pass in message</technical_language>

Target:
public Obs saveObs(Obs obs, String changeMessage) throws APIException { if(obs == null){ throw new APIException("Obs.error.cannot.be.null", (Object[]) null); } if(obs.getId() != null && changeMessage == null){ throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null); } handleExistingObsWithComplexConcept(obs); ensureRequirePrivilege(obs); if (obs.getObsId() == null || obs.getVoided()) { return saveNewOrVoidedObs(obs,changeMessage); } else if(!obs.isDirty()){ setPersonFromEncounter(obs); return saveObsNotDirty(obs, changeMessage); } else { setPersonFromEncounter(obs); return saveExistingObs(obs,changeMessage); } }
Source:
<code>public Collection<Component> getOppositeAlignedItems() { <START> return oppositeAlignedItems; <END> }</code><technical_language>return of collection field</technical_language>

Target:
public Collection<Component> getOppositeAlignedItems() { return Collections.unmodifiableCollection(oppositeAlignedItems); }