auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Page getNextPage() { if (finished) { return null; } long start = System.nanoTime(); try { List<Type> expectedTypes = columnHandles.stream().map(PinotColumnHandle::getDataType).collect(Collectors.toList()); PageBuilder pageBuilder = new PageBuilder(expectedTypes); ImmutableList.Builder<BlockBuilder> columnBlockBuilders = ImmutableList.builder(); ImmutableList.Builder<Type> columnTypes = ImmutableList.builder(); <START> for (int idx : brokerPql.getColumnIndicesExpected()) { <END> if (idx == -1) { continue; } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(idx); columnBlockBuilders.add(blockBuilder); columnTypes.add(expectedTypes.get(idx)); } int counter = issuePqlAndPopulate(brokerPql.getTable(), brokerPql.getPql(), brokerPql.getNumGroupByClauses(), columnBlockBuilders.build(), columnTypes.build()); pageBuilder.declarePositions(counter); Page page = pageBuilder.build(); finished = true; return page; } finally { readTimeNanos += System.nanoTime() - start; } }</code><technical_language>idx => index</technical_language>

Target:
public Page getNextPage() { if (finished) { return null; } long start = System.nanoTime(); try { List<Type> expectedTypes = columnHandles.stream() .map(PinotColumnHandle::getDataType) .collect(Collectors.toList()); PageBuilder pageBuilder = new PageBuilder(expectedTypes); ImmutableList.Builder<BlockBuilder> columnBlockBuilders = ImmutableList.builder(); ImmutableList.Builder<Type> columnTypes = ImmutableList.builder(); for (int i : brokerPql.getExpectedColumnIndices()) { if (i == -1) { continue; } BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(i); columnBlockBuilders.add(blockBuilder); columnTypes.add(expectedTypes.get(i)); } int counter = issuePqlAndPopulate( brokerPql.getTable(), brokerPql.getPql(), brokerPql.getGroupByClauses(), columnBlockBuilders.build(), columnTypes.build()); pageBuilder.declarePositions(counter); Page page = pageBuilder.build(); finished = true; return page; } finally { readTimeNanos += System.nanoTime() - start; } }
Source:
<code>public void execute(Tuple tuple) { R obj = (R) tuple.getValue(0); LOG.info(String.valueOf(obj)); <START> } <END></code><technical_language>Do need ack</technical_language>

Target:
public void execute(Tuple tuple) { R obj = (R) tuple.getValue(0); LOG.info(String.valueOf(obj)); collector.ack(tuple); }
Source:
<code>public Boolean getisLinearized() { if (baseObject == firstTrailer || linearizedDictionary == null) { return false; } <START> return true; <END> }</code><technical_language>please wrap else block</technical_language>

Target:
public Boolean getisLinearized() { return !(baseObject == firstTrailer || linearizedDictionary == null); }
Source:
<code>private Set<RelColumnMapping> getColumnMappings(SqlOperator op) { SqlReturnTypeInference inference = op.getReturnTypeInference(); if (inference == null) { return null; <START> } <END> if (inference instanceof TableFunctionReturnTypeInference) { return ((TableFunctionReturnTypeInference) inference).getColumnMappings(); } else { return null; } }</code><technical_language>L1065~1067 removed. If is null, instanceof return false</technical_language>

Target:
private Set<RelColumnMapping> getColumnMappings(SqlOperator op) { SqlReturnTypeInference inference = op.getReturnTypeInference(); if (inference instanceof TableFunctionReturnTypeInference) { return ((TableFunctionReturnTypeInference) inference).getColumnMappings(); } else { return null; } }
Source:
<code>private void runCommand(String command) throws KuraException { try { Process proc = Runtime.getRuntime().exec(command); proc.waitFor(); <START> } catch (IOException e) { <END> throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, e, "'" + command + "' failed"); } catch (InterruptedException e) { throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, e, "'" + command + "' failed"); } }</code><technical_language>catch multiple Exceptions in a single catch block</technical_language>

Target:
private void runCommand(String command) throws KuraException { try { Process proc = Runtime.getRuntime().exec(command); proc.waitFor(); } catch (IOException | InterruptedException e) { throw new KuraException(KuraErrorCode.OS_COMMAND_ERROR, e, "'" + command + "' failed"); } }
Source:
<code>public Optional<UpdateDownloadLink> getLatestUpdateDownloadLinkForCurrentVersion() { if (listOfHTVersionsDownloadLink.isEmpty()) { return Optional.empty(); } Collections.sort(listOfHTVersionsDownloadLink, Collections.reverseOrder()); Version current = Version.getCurrentVersion(); Optional<UpdateDownloadLink> updateLink = listOfHTVersionsDownloadLink.stream() .filter(link -> link.getVersion().getMajor() == current.getMajor() || <START> link.getVersion().getMajor() == current.getMajor() + 1) <END> .findFirst(); if (updateLink.isPresent()) { return updateLink; } return Optional.empty(); }</code><technical_language>factor this out a Version method</technical_language>

Target:
public Optional<HtDownloadLink> getLatestUpdateDownloadLinkForCurrentVersion() { if (downloadLinks.isEmpty()) { return Optional.empty(); } Collections.sort(downloadLinks, Collections.reverseOrder()); return downloadLinks.stream() .filter(link -> Version.isVersionMajorSameOrJustOneGreaterFromCurrent(link.getVersion())).findFirst(); }
Source:
<code>protected final void execute(final Channel channel) { channel.executingCalls.put(id,this); future = channel.executor.submit(new Runnable() { private int startIoId; private int calcLastIoId() { int endIoId = channel.lastIoId(); if (startIoId==endIoId) return 0; return endIoId; } public void run() { String oldThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(oldThreadName+" for "+channel.getName()+" id="+id); try { Command rsp; CURRENT.set(Request.this); startIoId = channel.lastIoId(); try { channel.pipeWriter.get(lastIoId).get(); RSP r = Request.this.perform(channel); rsp = new Response<RSP,EXC>(id,calcLastIoId(),r); } catch (Throwable t) { rsp = new Response<RSP,Throwable>(id,calcLastIoId(),t); } finally { CURRENT.set(null); } if(chainCause) rsp.createdAt.initCause(createdAt); synchronized (channel) { <START> if(!channel.isOutClosed()) { <END> channel.send(rsp); } else { throw new ClosedChannelException(); } } } catch (IOException e) { logger.log(Level.SEVERE, "Failed to send back a reply to the request " + this, e); } finally { channel.executingCalls.remove(id); Thread.currentThread().setName(oldThreadName); } } }); }</code><technical_language>arguably easier read if test is inverted</technical_language>

Target:
protected final void execute(final Channel channel) { channel.executingCalls.put(id,this); future = channel.executor.submit(new Runnable() { private int startIoId; private int calcLastIoId() { int endIoId = channel.lastIoId(); if (startIoId==endIoId) return 0; return endIoId; } public void run() { String oldThreadName = Thread.currentThread().getName(); Thread.currentThread().setName(oldThreadName+" for "+channel.getName()+" id="+id); try { Command rsp; CURRENT.set(Request.this); startIoId = channel.lastIoId(); try { channel.pipeWriter.get(lastIoId).get(); RSP r = Request.this.perform(channel); rsp = new Response<RSP,EXC>(id,calcLastIoId(),r); } catch (Throwable t) { rsp = new Response<RSP,Throwable>(id,calcLastIoId(),t); } finally { CURRENT.set(null); } if(chainCause) rsp.createdAt.initCause(createdAt); channel.send(rsp); } catch (IOException e) { logger.log(Level.WARNING, "Failed to send back a reply to the request " + this, e); } finally { channel.executingCalls.remove(id); Thread.currentThread().setName(oldThreadName); } } }); }
Source:
<code>public static Test suite() { if (CommonTestUtil.fixProxyConfiguration()) { CommonTestUtil.dumpSystemInfo(System.err); } TestSuite suite = new ManagedTestSuite(AllBugzillaTests.class.getName()); <START> TestConfiguration testConfiguration = ManagedSuite.getTestConfiguration(); <END> if (testConfiguration == null) { testConfiguration = TestConfiguration.getDefault(); } addTests(suite, testConfiguration); return suite; }</code><technical_language>I see. I sense. TestKind is for of Trac tests. part of TestConfigurationProperty intrinsic property of tests depend suite running in</technical_language>

Target:
public static Test suite() { if (CommonTestUtil.fixProxyConfiguration()) { CommonTestUtil.dumpSystemInfo(System.err); } TestSuite suite = new ManagedTestSuite(AllBugzillaTests.class.getName()); TestConfiguration testConfiguration = ManagedSuite.getTestConfigurationOrCreateDefault(); addTests(suite, testConfiguration); return suite; }
Source:
<code>public void setUp() throws InjectionException { final Injector injector = Tang.Factory.getTang().newInjector(); groupInfoMap = injector.getInstance(GroupInfoMap.class); <START> injector.bindVolatileParameter(ThreadNumSoftLimit.class, THREAD_NUM_SOFT_LIMIT); <END> handler = injector.getInstance(ProportionalGroupMetricHandler.class); }</code><technical_language>name SOFT_LIMIT is proper here. omitting SOFT</technical_language>

Target:
public void setUp() throws InjectionException { final Injector injector = Tang.Factory.getTang().newInjector(); groupInfoMap = injector.getInstance(GroupInfoMap.class); injector.bindVolatileParameter(ThreadNumLimit.class, THREAD_NUM_SOFT_LIMIT); handler = injector.getInstance(ProportionalGroupMetricHandler.class); }
Source:
<code><START> public Long getLogTail() { <END> return logMetadata.getGlobalTail(); }</code><technical_language>please long</technical_language>

Target:
public long getLogTail() { return logMetadata.getGlobalTail(); }
Source:
<code>public void testUseCatalog() throws Exception { TestingExecutor executor = new TestingExecutorBuilder() .setUseCatalogConsumer((ignored1, catalogName) -> { if (!catalogName.equals("cat")) { throw new SqlExecutionException("unexpected catalog name: " + catalogName); } }) .build(); InputStream inputStream = new ByteArrayInputStream("use catalog cat;\n".getBytes()); ByteArrayOutputStream outputStream = new ByteArrayOutputStream(256); CliClient cliClient = null; SessionContext sessionContext = new SessionContext("test-session", new Environment()); String sessionId = executor.openSession(sessionContext); <START> try (Terminal terminal = new DumbTerminal(inputStream, outputStream)) { <END> cliClient = new CliClient(terminal, sessionId, executor, File.createTempFile("history", "tmp").toPath()); cliClient.open(); assertThat(executor.getNumUseCatalogCalls(), is(1)); String output = new String(outputStream.toByteArray()); assertFalse(output.contains("unexpected catalog name")); } finally { if (cliClient != null) { cliClient.close(); } } }</code><technical_language>try(resources) avoid call finally here</technical_language>

Target:
public void testUseCatalog() throws Exception { TestingExecutor executor = new TestingExecutorBuilder() .setUseCatalogConsumer((ignored1, catalogName) -> { if (!catalogName.equals("cat")) { throw new SqlExecutionException("unexpected catalog name: " + catalogName); } }) .build(); String output = testExecuteSql(executor, "use catalog cat;"); assertThat(executor.getNumUseCatalogCalls(), is(1)); assertFalse(output.contains("unexpected catalog name")); }
Source:
<code><START> public List<String> getWordConfidence() { <END> return wordConfidence; }</code><technical_language>I need reset changes <LINK_0></technical_language>

Target:
public List<SpeechWordConfidence> getWordConfidence() { return wordConfidence; }
Source:
<code>private void scanDisks() { <START> StorageDomain storageDomain = getSelectedItem(); <END> Frontend.getInstance().runAction(VdcActionType.ScanStorageForUnregisteredDisks, new StorageDomainParametersBase(storageDomain.getStoragePoolId(), storageDomain.getId())); }</code><technical_language>check for null</technical_language>

Target:
private void scanDisks() { StorageDomain storageDomain = getSelectedItem(); if (storageDomain != null) { Frontend.getInstance().runAction(VdcActionType.ScanStorageForUnregisteredDisks, new StorageDomainParametersBase(storageDomain.getStoragePoolId(), storageDomain.getId())); } }
Source:
<code>private DiskImage mockDiskImage(Guid guid) { DiskImage disk = new DiskImage(); disk.setImageId(guid); ArrayList<Guid> <START> storageIdList = <END> new ArrayList<>(); storageIdList.add(storageDomainId); disk.setStorageIds(storageIdList); disk.setStoragePoolId(storagePoolId); disk.setActive(true); disk.setId(Guid.newGuid()); when(diskDao.get(guid)).thenReturn(disk); return disk; }</code><technical_language>IMHO "storageIds" is a name, call</technical_language>

Target:
private DiskImage mockDiskImage(Guid guid) { DiskImage disk = new DiskImage(); disk.setImageId(guid); ArrayList<Guid> storageIds = new ArrayList<>(); storageIds.add(storageDomainId); disk.setStorageIds(storageIds); disk.setStoragePoolId(storagePoolId); disk.setActive(true); disk.setId(Guid.newGuid()); when(diskDao.get(guid)).thenReturn(disk); return disk; }
Source:
<code>public InputStream[] call(CallContext callContext) { checkAllowedArgs(callContext.getEndpointState(), callContext.getSessionState(), callContext.getWorkUnit()); return getCaller().arrayCall(getClient(), callContext.getEndpointState(), callContext.getSessionState(), <START> callContext.getWorkUnit()); <END> }</code><technical_language>noted above, set endpoint state in call context and, in deprecated method, get return endpoint state call context</technical_language>

Target:
public InputStream[] call(CallContext callContext) { try { return getResponseData(callContext, false); } catch(Exception ex) { throw new InternalError("Exception occurred while fetching data"); } }
Source:
<code>protected void executeVmCommand() { vmHandler.warnMemorySizeLegal(getParameters().getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (!canAddVm(destStorages.values())) { log.error("Failed to add VM. The reasons are: {}", String.join(",", getReturnValue().getValidationMessages())); return; } if <START> (!addDefaultVmLease(getParameters().getVm().getStaticData())) <END> { return; } TransactionSupport.executeInNewTransaction(() -> { addVmStatic(); addVmDynamic(); addVmNetwork(); addVmNumaNodes(); addVmStatistics(); addActiveSnapshot(); addVmPermission(); addVmInit(); addVmRngDevice(); addAffinityLabels(); getCompensationContext().stateChanged(); return null; }); if (addVmImages()) { TransactionSupport.executeInNewTransaction(() -> { copyDiskVmElements(); copyVmDevices(); addDiskPermissions(); addVmPayload(); updateSmartCardDevices(); addVmWatchdog(); addGraphicsDevice(); getVmDeviceUtils().updateVirtioScsiController(getVm().getStaticData(), getParameters().isVirtioScsiEnabled()); setActionReturnValue(getVm().getId()); setSucceeded(true); return null; }); } if (getParameters().getPoolId() != null) { addVmToPool(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); }</code><technical_language>I find confusing. method name sounds add a 'default' lease, this true, add a default lease if needed (leaseDomainId is null). change addDefaultVmLease() getDefaultVmLease() call addVmLease() returned in case getParameters().getVm().getLeaseStorageDomainId() is null</technical_language>

Target:
protected void executeVmCommand() { vmHandler.warnMemorySizeLegal(getParameters().getVm().getStaticData(), getEffectiveCompatibilityVersion()); if (!canAddVm(destStorages.values())) { log.error("Failed to add VM. The reasons are: {}", String.join(",", getReturnValue().getValidationMessages())); return; } getParameters().getVm().setLeaseStorageDomainId(getDefaultVmLease(getParameters().getVm().getStaticData())); if (!addVmLease(getParameters().getVm().getLeaseStorageDomainId(), getVmId(), false)) { return; } TransactionSupport.executeInNewTransaction(() -> { addVmStatic(); addVmDynamic(); addVmNetwork(); addVmNumaNodes(); addVmStatistics(); addActiveSnapshot(); addVmPermission(); addVmInit(); addVmRngDevice(); addAffinityLabels(); getCompensationContext().stateChanged(); return null; }); if (addVmImages()) { TransactionSupport.executeInNewTransaction(() -> { copyDiskVmElements(); copyVmDevices(); addDiskPermissions(); addVmPayload(); updateSmartCardDevices(); addVmWatchdog(); addGraphicsDevice(); getVmDeviceUtils().updateVirtioScsiController(getVm().getStaticData(), getParameters().isVirtioScsiEnabled()); setActionReturnValue(getVm().getId()); setSucceeded(true); return null; }); } if (getParameters().getPoolId() != null) { addVmToPool(); } discardHelper.logIfDisksWithIllegalPassDiscardExist(getVmId()); }
Source:
<code>public void testExecute_withNewStudent_shouldBeAddedToDatabase() { String courseId = typicalBundle.students.get("student1InCourse1").getCourse(); StudentAttributes newStudent = getTypicalNewStudent(courseId); StudentsEnrollRequest req = prepareRequest(Arrays.asList(newStudent)); loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").getGoogleId()); List<StudentData> enrolledStudents = executeActionAndReturnResults(courseId, req); assertEquals(1, enrolledStudents.size()); <START> verifyStudentInDatabase(newStudent, enrolledStudents.get(0).getCourseId(), enrolledStudents.get(0).getEmail()); <END> }</code><technical_language>verify test case verifying enrolledStudents correct content</technical_language>

Target:
public void testExecute_withNewStudent_shouldBeAddedToDatabase() { String courseId = typicalBundle.students.get("student1InCourse1").getCourse(); StudentAttributes newStudent = getTypicalNewStudent(courseId); StudentsEnrollRequest req = prepareRequest(Arrays.asList(newStudent)); loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").getGoogleId()); List<StudentData> enrolledStudents = executeActionAndReturnResults(courseId, req); assertEquals(1, enrolledStudents.size()); verifyStudentInDatabase(newStudent, enrolledStudents.get(0).getCourseId(), enrolledStudents.get(0).getEmail()); verifyCorrectResponseData(req.getStudentEnrollRequests().get(0), enrolledStudents.get(0)); }
Source:
<code>public void configure(ResourceInfo resourceInfo, FeatureContext context) { AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); <START> if (am.isAnnotationPresent(Auth.class)) { <END> context.register(new AuthFilter(authHandler)); } }</code><technical_language>resourceInfo.getResourceMethod().getParameterAnnotations(), do need abandon exiting Auth marker annotation? I admit, I @Context SecurityContext securityContext in Resource parameter @Auth SomeRandomAuthType authParam preserve compatibility, this biggest concern in this change. Namely, is do this force redo auth code</technical_language>

Target:
public void configure(ResourceInfo resourceInfo, FeatureContext context) { AnnotatedMethod am = new AnnotatedMethod(resourceInfo.getResourceMethod()); if (am.isAnnotationPresent(Auth.class)) { Auth auth = am.getAnnotation(Auth.class); context.register(new AuthFilter(authHandler, auth.required())); } }
Source:
<code>public void getMetadataTest() { <START> HashMap<String, String> metaData = new HashMap<String, String>(); <END> metaData.put("a", "1"); metaData.put("b", "2"); metaData.put("c", "3"); se1.setMetaData(metaData); assertEquals("2", se1.getMeta("b")); }</code><technical_language>Map type</technical_language>

Target:
public void getMetadataTest() { Map<String, String> metaData = new HashMap<String, String>(); metaData.put("a", "1"); metaData.put("b", "2"); metaData.put("c", "3"); se1.setMetaData(metaData); assertEquals("2", se1.getMeta("b")); }
Source:
<code><START> public void fetchesCommit() throws IOException { <END> final Commit cmmt = StatusTest.commit(); MatcherAssert.assertThat( new Status.Smart( new RtStatus(cmmt, Json.createObjectBuilder().build()) ).commit(), Matchers.equalTo(cmmt) ); }</code><technical_language>@cvrebert declare this method (as other methods in this class) throwing Exception, prescribed [here](<LINK_0></technical_language>

Target:
public void fetchesCommit() throws Exception { final Commit cmmt = StatusTest.commit(); MatcherAssert.assertThat( new Status.Smart( new RtStatus(cmmt, Json.createObjectBuilder().build()) ).commit(), Matchers.equalTo(cmmt) ); }
Source:
<code>public void invalidateCachedUsernames(String[] usernameList) { if (usernameList == null || usernameList.length == 0) { log.debug("No username received to invalidate Gateway Username Cache."); return; } for (String username : usernameList) { String tenantDomain = MultitenantUtils.getTenantDomain(username); boolean startTenantFlow = startTenantFlow(tenantDomain); Cache gatewayUsernameCache = getCacheManager(). getCache(APIConstants.GATEWAY_USERNAME_CACHE_NAME); Cache gatewayInvalidUsernameCache = getCacheManager(). getCache(APIConstants.GATEWAY_INVALID_USERNAME_CACHE_NAME); if (gatewayUsernameCache != null) { gatewayUsernameCache.remove(username); } if (gatewayInvalidUsernameCache != null) { gatewayInvalidUsernameCache.put(username, UUID.randomUUID().toString()); } <START> if (startTenantFlow) { <END> endTenantFlow(); } } }</code><technical_language>end tenant flow in a finally block</technical_language>

Target:
public void invalidateCachedUsernames(String[] usernameList) { if (usernameList == null || usernameList.length == 0) { log.debug("No username received to invalidate Gateway Username Cache."); return; } Map<String, Set<String>> tenantDomainMap = new HashMap<>(); for (String username : usernameList) { String tenantDomain = MultitenantUtils.getTenantDomain(username); Set<String> usersInTenant = tenantDomainMap.get(tenantDomain); if (usersInTenant == null) { usersInTenant = new HashSet<>(); } usersInTenant.add(username); tenantDomainMap.put(tenantDomain, usersInTenant); } for (Map.Entry<String, Set<String>> tenantEntry : tenantDomainMap.entrySet()) { boolean startTenantFlow = false; try { startTenantFlow = startTenantFlow(tenantEntry.getKey()); Cache gatewayUsernameCache = getCacheManager(). getCache(APIConstants.GATEWAY_USERNAME_CACHE_NAME); Cache gatewayInvalidUsernameCache = getCacheManager(). getCache(APIConstants.GATEWAY_INVALID_USERNAME_CACHE_NAME); for (String username : tenantEntry.getValue()) { if (gatewayUsernameCache != null) { gatewayUsernameCache.remove(username); } if (gatewayInvalidUsernameCache != null) { gatewayInvalidUsernameCache.put(username, UUID.randomUUID().toString()); } } } finally { if (startTenantFlow) { endTenantFlow(); } } } }
Source:
<code>public String getUuidProperty() { <START> return RestConstants.PROGRAM_ATTRIBUTE_TYPE_UUID; <END> }</code><technical_language>this compile</technical_language>

Target:
public String getUuidProperty() { return RestTestConstants2_2.PROGRAM_ATTRIBUTE_TYPE_UUID; }
Source:
<code>public void listenBucketNotification(String bucketName, String prefix, String suffix, String[] events, BucketEventListener eventCallback) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidResponseException { Multimap<String,String> queryParamMap = HashMultimap.create(); queryParamMap.put("prefix", prefix); queryParamMap.put("suffix", suffix); for (String event: events) { queryParamMap.put("events", event); } String bodyContent = ""; Scanner scanner = null; HttpResponse response = null; ObjectMapper mapper = new ObjectMapper(); try { response = executeReq(Method.GET, getRegion(bucketName), bucketName, "", null, queryParamMap, null, 0); scanner = new Scanner(response.body().charStream()); <START> scanner.useDelimiter("\n"); <END> while (scanner.hasNext()) { if (!continueListening) { bodyContent = scanner.next().trim(); if (bodyContent.equals("")) { continue; } NotificationInfo ni = mapper.readValue(bodyContent, NotificationInfo.class); eventCallback.updateEvent(ni); } else { break ; } } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw e; } finally { if (response != null) { response.body().close(); } if (scanner != null) { scanner.close(); } } }</code><technical_language>suggestion is deprecate this style of API introduce lazy eval'ed style java public Iterable<Result<NotificationInfo>> listenBucketNotification(String bucketName, String prefix, String suffix, String[] events) If stick current style, fix is while (continueListening || scanner.hasNext())</technical_language>

Target:
public void listenBucketNotification(String bucketName, String prefix, String suffix, String[] events, BucketEventListener eventCallback) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidResponseException { Multimap<String,String> queryParamMap = HashMultimap.create(); queryParamMap.put("prefix", prefix); queryParamMap.put("suffix", suffix); for (String event: events) { queryParamMap.put("events", event); } String bodyContent = ""; Scanner scanner = null; HttpResponse response = null; ObjectMapper mapper = new ObjectMapper(); try { response = executeReq(Method.GET, getRegion(bucketName), bucketName, "", null, queryParamMap, null, 0); scanner = new Scanner(response.body().charStream()); scanner.useDelimiter("\n"); while (scanner.hasNext()) { bodyContent = scanner.next().trim(); if (bodyContent.equals("")) { continue; } NotificationInfo ni = mapper.readValue(bodyContent, NotificationInfo.class); eventCallback.updateEvent(ni); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw e; } finally { if (response != null) { response.body().close(); } if (scanner != null) { scanner.close(); } } }
Source:
<code>private SafeHtmlBuilder formatHashtags(JsArrayString hashtags) { SafeHtmlBuilder html = new SafeHtmlBuilder(); Iterator<String> itr = Natives.asList(hashtags).iterator(); while (itr.hasNext()) { String hashtagName = itr.next(); html.openSpan() .setAttribute(DATA_ID, hashtagName) .setStyleName(style.hashtagName()) .openAnchor() .setAttribute("href", "#" + PageLinks.toChangeQuery("hashtag:\"" + hashtagName + "\"")) .setAttribute("role", "listitem") .append("#").append(hashtagName) .closeAnchor() .openElement("button") .setAttribute("title", "Remove hashtag") .setAttribute("onclick", REMOVE + "(event)") .append( <START> "â") <END> .closeElement("button") .closeSpan(); if (itr.hasNext()) { html.append(' '); } } return html; }</code><technical_language>fixed in [1]. [1] <LINK_0></technical_language>

Target:
private SafeHtmlBuilder formatHashtags(JsArrayString hashtags) { SafeHtmlBuilder html = new SafeHtmlBuilder(); Iterator<String> itr = Natives.asList(hashtags).iterator(); while (itr.hasNext()) { String hashtagName = itr.next(); html.openSpan() .setAttribute(DATA_ID, hashtagName) .setStyleName(style.hashtagName()) .openAnchor() .setAttribute("href", "#" + PageLinks.toChangeQuery("hashtag:\"" + hashtagName + "\"")) .setAttribute("role", "listitem") .append("#").append(hashtagName) .closeAnchor() .openElement("button") .setAttribute("title", "Remove hashtag") .setAttribute("onclick", REMOVE + "(event)") .append( "☒") .closeElement("button") .closeSpan(); if (itr.hasNext()) { html.append(' '); } } return html; }
Source:
<code>public void showDriverVersion(){ try { DatabaseMetaData meta = connection.getMetaData(); logger.info(String.format(Locale.ENGLISH,"Using JDBC Driver %s",meta.getDriverVersion())); <START> } catch( SQLException e ) { <END> logger.warn(String.format(Locale.ENGLISH,"Can't get JDBC Driver version. Reason: %s",e.toString())); } }</code><technical_language>I need catch SQLException Connection#getMetaData#getDriverVersion throw exception normally. If thrown, access database all</technical_language>

Target:
public void showDriverVersion() throws SQLException { DatabaseMetaData meta = connection.getMetaData(); logger.info(String.format(Locale.ENGLISH,"Using JDBC Driver %s",meta.getDriverVersion())); }
Source:
<code>public void testGetDocIds() throws Exception { <START> long startTime = new Date().getTime(); <END> RecordingDocIdPusher pusher = (RecordingDocIdPusher) context.getDocIdPusher(); config.overrideKey("feed.maxUrls", "5"); adaptor.init(context); adaptor.getDocIds(pusher); List<Record> golden = ImmutableList.of( new Record.Builder(new DocId("pseudo/type=document")) .setCrawlImmediately(true).build()); assertEquals(golden, pusher.getRecords()); }</code><technical_language>Unused</technical_language>

Target:
public void testGetDocIds() throws Exception { RecordingDocIdPusher pusher = getContextPusher(); config.overrideKey("feed.maxUrls", "5"); adaptor.init(context); adaptor.getDocIds(pusher); assertEquals(ImmutableList.of( new Record.Builder(newDocId(new Checkpoint("type=document"))) .setCrawlImmediately(true).build()), pusher.getRecords()); }
Source:
<code>public XMLExplorerView() { <START> super(TMF_XMLEXPLORER_VIEW); <END> fXmlFilesPath = XmlUtils.getXmlFilesPath(); }</code><technical_language>Send ID instead, remove need for this field</technical_language>

Target:
public XMLExplorerView() { super(ID); fXmlFilesPath = XmlUtils.getXmlFilesPath(); }
Source:
<code>public void submitCloudletList(List<? extends Cloudlet> list) { sortCloudletsIfComparatorIsSet(list); setBrokerForEntities(list); lastSubmittedCloudlet = setIdForEntitiesWithoutOne(list, lastSubmittedCloudlet); if(list.isEmpty()) { return; } setSimulationForCloudletUtilizationModels(list); cloudletWaitingList.addAll(list); if (!isStarted()) { return; } println(String.format( "%.2f: %s: List of %d Cloudlets submitted to the broker during simulation execution.", getSimulation().clock(), getName(), list.size())); <START> if(getVmWaitingList().isEmpty()){ <END> println(" Cloudlets creation request sent to Datacenter."); requestDatacentersToCreateWaitingCloudlets(); notifyOnCreationOfWaitingVmsFinishListeners(); } else println(String.format( " Waiting creation of %d VMs to send Cloudlets creation request to Datacenter.", vmWaitingList.size())); }</code><technical_language>access attribute</technical_language>

Target:
public void submitCloudletList(List<? extends Cloudlet> list) { sortCloudletsIfComparatorIsSet(list); setBrokerForEntities(list); lastSubmittedCloudlet = setIdForEntitiesWithoutOne(list, lastSubmittedCloudlet); if(list.isEmpty()) { return; } setSimulationForCloudletUtilizationModels(list); cloudletWaitingList.addAll(list); if (!isStarted()) { return; } println(String.format( "%.2f: %s: List of %d Cloudlets submitted to the broker during simulation execution.", getSimulation().clock(), getName(), list.size())); if(vmWaitingList.isEmpty()){ println(" Cloudlets creation request sent to Datacenter."); requestDatacentersToCreateWaitingCloudlets(); notifyOnCreationOfWaitingVmsFinishListeners(); } else println(String.format( " Waiting creation of %d VMs to send Cloudlets creation request to Datacenter.", vmWaitingList.size())); }
Source:
<code>public void notifyCheckpointComplete(long checkpointId) throws Exception { <START> if (keyedStateBackend != null && keyedStateBackend instanceof CheckpointListener) { <END> ((CheckpointListener) keyedStateBackend).notifyCheckpointComplete(checkpointId); } }</code><technical_language>suggestion if (keyedStateBackend instanceof CheckpointListener) { instanceof operator returns false for null, is need additional null check</technical_language>

Target:
public void notifyCheckpointComplete(long checkpointId) throws Exception { if (keyedStateBackend instanceof CheckpointListener) { ((CheckpointListener) keyedStateBackend).notifyCheckpointComplete(checkpointId); } }
Source:
<code>public String rangeParser(List<String> values) { try { return String.valueOf(ThreadLocalRandom.current().nextInt( Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1)))); } catch <START> (NullPointerException | <END> IllegalArgumentException e) { log.error("range values are wrong, skip and parse 0, " + "please review applicaion.conf {}", e.getStackTrace()); return "0"; } }</code><technical_language>please catch this exception. If is thrown please find fix it</technical_language>

Target:
public String rangeParser(List<String> values) { try { return String.valueOf(ThreadLocalRandom.current().nextInt( Integer.valueOf(values.get(0)), Integer.valueOf(values.get(1)))); } catch (IllegalArgumentException e) { log.error("range values must be a list of string {}", values, e.getStackTrace()); return "0"; } }
Source:
<code>public NodeInstanceList getProcessInstanceFullHistoryByType(long processInstanceId, String entryType, Integer page, Integer pageSize) { logger.debug("About to search for node instances with page and page size {}", page, pageSize); Collection<NodeInstanceDesc> result = null; result = runtimeDataService.getProcessInstanceFullHistoryByType(processInstanceId, EntryType.valueOf(entryType), buildQueryContext(page, pageSize)); NodeInstanceList nodeInstanceList = convertToNodeInstanceList(result); <START> logger.debug("Returning result of node instances search: {}", nodeInstanceList); <END> return nodeInstanceList; }</code><technical_language>useful print out memory address - toString method is implemented in NodeInstanceList class</technical_language>

Target:
public NodeInstanceList getProcessInstanceFullHistoryByType(long processInstanceId, String entryType, Integer page, Integer pageSize) { logger.debug("About to search for node instances with page and page size {}", page, pageSize); Collection<NodeInstanceDesc> result = null; result = runtimeDataService.getProcessInstanceFullHistoryByType(processInstanceId, EntryType.valueOf(entryType), buildQueryContext(page, pageSize)); return convertToNodeInstanceList(result); }
Source:
<code><START> TestJettyHttpsClientPem() <END> { super("localhost", getResource("server.keystore").toString()); }</code><technical_language>public constructed TestNG (which bypasses security fine bad rely that)</technical_language>

Target:
public TestJettyHttpsClientPem() { super("localhost", getResource("server.keystore").toString()); }
Source:
<code>private void stopChores() { ChoreService choreService = getChoreService(); if (choreService != null) { choreService.cancelChore(this.mobFileCleanerChore); choreService.cancelChore(this.mobFileCompactionChore); choreService.cancelChore(this.balancerChore); <START> Optional.ofNullable(this.regionNormalizerManager) <END> .map(RegionNormalizerManager::getRegionNormalizerChore) .ifPresent(choreService::cancelChore); choreService.cancelChore(this.clusterStatusChore); choreService.cancelChore(this.catalogJanitorChore); choreService.cancelChore(this.clusterStatusPublisherChore); choreService.cancelChore(this.snapshotQuotaChore); choreService.cancelChore(this.logCleaner); choreService.cancelChore(this.hfileCleaner); choreService.cancelChore(this.replicationBarrierCleaner); choreService.cancelChore(this.snapshotCleanerChore); choreService.cancelChore(this.hbckChore); choreService.cancelChore(this.regionsRecoveryChore); } }</code><technical_language>a null check</technical_language>

Target:
private void stopChores() { ChoreService choreService = getChoreService(); if (choreService != null) { choreService.cancelChore(this.mobFileCleanerChore); choreService.cancelChore(this.mobFileCompactionChore); choreService.cancelChore(this.balancerChore); if (regionNormalizerManager != null) { choreService.cancelChore(regionNormalizerManager.getRegionNormalizerChore()); } choreService.cancelChore(this.clusterStatusChore); choreService.cancelChore(this.catalogJanitorChore); choreService.cancelChore(this.clusterStatusPublisherChore); choreService.cancelChore(this.snapshotQuotaChore); choreService.cancelChore(this.logCleaner); choreService.cancelChore(this.hfileCleaner); choreService.cancelChore(this.replicationBarrierCleaner); choreService.cancelChore(this.snapshotCleanerChore); choreService.cancelChore(this.hbckChore); choreService.cancelChore(this.regionsRecoveryChore); } }
Source:
<code>public boolean isDepleted() { <START> return ExcavatorHandler.mineralVeinYield==0||getDepletion() >= ExcavatorHandler.mineralVeinYield; <END> }</code><technical_language>depletion negative? If case is redundant</technical_language>

Target:
public boolean isDepleted() { return ExcavatorHandler.mineralVeinYield > 0&&getDepletion() >= ExcavatorHandler.mineralVeinYield; }
Source:
<code>public RemoveExternalSubnetModel(SearchableListModel<?> sourceListModel, List<ExternalSubnet> subnets) { setTitle(ConstantsManager.getInstance().getConstants().removeExternalSubnetTitle()); setHashName("remove_external_subnet"); this.sourceListModel = sourceListModel; this.subnets = subnets; ArrayList<String> items = new ArrayList<String>(); for (ExternalSubnet subnet : subnets) <START> { <END> items.add(subnet.getName()); } setItems(items); UICommand tempVar = new UICommand("OnRemove", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); getCommands().add(tempVar2); }</code><technical_language>Please format parentheses file, requested do</technical_language>

Target:
public RemoveExternalSubnetModel(SearchableListModel<?> sourceListModel, List<ExternalSubnet> subnets) { setHashName("remove_external_subnet"); this.sourceListModel = sourceListModel; this.subnets = subnets; ArrayList<String> items = new ArrayList<String>(); for (ExternalSubnet subnet : subnets) { items.add(subnet.getName()); } setItems(items); UICommand tempVar = new UICommand("OnRemove", this); tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok()); tempVar.setIsDefault(true); getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel()); tempVar2.setIsCancel(true); getCommands().add(tempVar2); }
Source:
<code>private void checkRead() { if (isPageFullyConsumed()) { if (isFullyConsumed()) { <START> if (LOGGER.isDebugEnabled()) { <END> LOGGER.debug("end reached"); } repetitionLevel = 0; return; } readPage(); } readRepetitionAndDefinitionLevels(); }</code><technical_language>call debug internally check log level, right? I thought is necessary add a conditional isDebugEnabled if operation is expensive if avoiding logging in a tight loop do in writers. For writing a static debug string, is this needed</technical_language>

Target:
private void checkRead() { if (isPageFullyConsumed()) { if (isFullyConsumed()) { LOGGER.debug("end reached"); repetitionLevel = 0; return; } readPage(); } readRepetitionAndDefinitionLevels(); }
Source:
<code>public static String toHexString(byte[] digest) { <START> StringBuffer buf <END> = new StringBuffer(); for (int i = 0; i < digest.length; i++) { if ((digest[i] & 0xFF) < 0x10) buf.append('0'); buf.append(Integer.toHexString(digest[i] & 0xFF)); } return buf.toString(); }</code><technical_language>StringBuilder please</technical_language>

Target:
public static String toHexString(byte[] digest) { StringBuilder buf = new StringBuilder(); for (byte element : digest) { if ((element & 0xFF) < 0x10) buf.append('0'); buf.append(Integer.toHexString(element & 0xFF)); } return buf.toString(); }
Source:
<code>private Pages getPages(Board b) { if (savedBoards.contains(b.code)) { long lastUpdateTime = boardTimeMap.get(b.code); <START> if (lastUpdateTime + 3 * 1000 * 60 > System.currentTimeMillis()) { <END> } else { Logger.d(TAG, "Requesting existing board pages, timeout"); requestBoard(b); } return boardPagesMap.get(b.code); } else { Logger.d(TAG, "Requesting new board pages"); requestBoard(b); return null; } }</code><technical_language>flip this boolean else if block, avoid empty blocks</technical_language>

Target:
private Pages getPages(Board b) { if (savedBoards.contains(b.code)) { shouldUpdate(b, false); return boardPagesMap.get(b.code); } else { Logger.d(TAG, "Requesting new board pages"); requestBoard(b); return null; } }
Source:
<code>public void addThreadFactoryInGUI() { String name = "ThreadFactoryGUI" + RandomStringUtils.randomAlphanumeric(6); ConfigFragment config = page.getConfigFragment(); WizardWindow wizard = config.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", name); editor.text(JNDI_NAME, JNDI_VALID); wizard.clickSave(); <START> Console.withBrowser(browser).dismissReloadRequiredWindowIfPresent(); <END> assertTrue("Thread factory should be present in table", config.resourceIsPresent(name)); ResourceAddress address = new ResourceAddress(eeAddress).add(EE_CHILD, name); verifier.verifyResource(address, true, 5000); removeEEChild(EE_CHILD, name); }</code><technical_language>In <LINK_0> merged WizardWindow.finishAndDismissReloadRequiredWindow() instead</technical_language>

Target:
public void addThreadFactoryInGUI() { String name = "ThreadFactoryGUI" + RandomStringUtils.randomAlphanumeric(6); ConfigFragment config = page.getConfigFragment(); WizardWindow wizard = config.getResourceManager().addResource(); Editor editor = wizard.getEditor(); editor.text("name", name); editor.text(JNDI_NAME, JNDI_VALID); wizard.saveAndDismissReloadRequiredWindow(); assertTrue("Thread factory should be present in table", config.resourceIsPresent(name)); ResourceAddress address = new ResourceAddress(eeAddress).add(EE_CHILD, name); verifier.verifyResource(address, true, 5000); removeEEChild(EE_CHILD, name); }
Source:
<code>public void start() throws StoreException { <START> if (started) <END> throw new StoreException("Store already started", StoreErrorCodes.Store_Already_Started); try { File dataFile = new File(dataDir); if (!dataFile.exists()) { logger.info("data directory not found. creating it", dataDir); boolean created = dataFile.mkdir(); if (!created) throw new StoreException("Failed to create directory for data dir " + dataDir, StoreErrorCodes.Initialization_Error); } if(!dataFile.isDirectory() || !dataFile.canRead()) throw new StoreException(dataFile.getAbsolutePath() + " is either not a directory or is not readable", StoreErrorCodes.Initialization_Error); fileLock = new FileLock(new File(dataDir, LockFile)); if(!fileLock.tryLock()) throw new StoreException("Failed to acquire lock on file " + dataDir + ". Another process or thread is using this directory.", StoreErrorCodes.Initialization_Error); log = new Log(dataDir, metrics, capacityGB); index = new BlobPersistantIndex(dataDir, scheduler, log, config, factory); log.setLogEndOffset(index.getCurrentEndOffset()); started = true; } catch (Exception e) { logger.error("Error while starting store for directory with exception {}",dataDir, e); throw new StoreException("Error while starting store for dir " + dataDir, StoreErrorCodes.Initialization_Error); } }</code><technical_language>add lock this method. "started = true" line 77 is gap "if (started)" check setting "started = true"</technical_language>

Target:
public void start() throws StoreException { synchronized (lock) { if (started) throw new StoreException("Store already started", StoreErrorCodes.Store_Already_Started); try { File dataFile = new File(dataDir); if (!dataFile.exists()) { logger.info("data directory not found. creating it", dataDir); boolean created = dataFile.mkdir(); if (!created) throw new StoreException("Failed to create directory for data dir " + dataDir, StoreErrorCodes.Initialization_Error); } if(!dataFile.isDirectory() || !dataFile.canRead()) throw new StoreException(dataFile.getAbsolutePath() + " is either not a directory or is not readable", StoreErrorCodes.Initialization_Error); fileLock = new FileLock(new File(dataDir, LockFile)); if(!fileLock.tryLock()) throw new StoreException("Failed to acquire lock on file " + dataDir + ". Another process or thread is using this directory.", StoreErrorCodes.Initialization_Error); log = new Log(dataDir, metrics, capacityGB); index = new BlobPersistentIndex(dataDir, scheduler, log, config, factory); log.setLogEndOffset(index.getCurrentEndOffset()); started = true; } catch (Exception e) { logger.error("Error while starting store for directory with exception {}",dataDir, e); throw new StoreException("Error while starting store for dir " + dataDir, StoreErrorCodes.Initialization_Error); } } }
Source:
<code>void notifyAllListeners(List<RealmResults<? extends RealmModel>> realmResultsToBeNotified) { <START> for (Iterator<RealmResults<? extends RealmModel>> it = realmResultsToBeNotified.iterator(); it.hasNext() && !realm.isClosed(); ) { <END> RealmResults<? extends RealmModel> realmResults = it.next(); realmResults.notifyChangeListeners(false); } notifyRealmObjectCallbacks(); if (!realm.isClosed() && threadContainsAsyncEmptyRealmObject()) { updateAsyncEmptyRealmObject(); } notifyGlobalListeners(); }</code><technical_language>HandlerController is a Realm instance, means local a thread. do need checking if realm closed</technical_language>

Target:
void notifyAllListeners(List<RealmResults<? extends RealmModel>> realmResultsToBeNotified) { for (Iterator<RealmResults<? extends RealmModel>> it = realmResultsToBeNotified.iterator(); !realm.isClosed() && it.hasNext(); ) { RealmResults<? extends RealmModel> realmResults = it.next(); realmResults.notifyChangeListeners(false); } notifyRealmObjectCallbacks(); if (!realm.isClosed() && threadContainsAsyncEmptyRealmObject()) { updateAsyncEmptyRealmObject(); } notifyGlobalListeners(); }
Source:
<code>public static TrafficClass getDefault() <START> { <END> return TrafficClass.CS1; }</code><technical_language>Braces inconsistent</technical_language>

Target:
public static TrafficClass getDefault() { return TrafficClass.DSCP_CS1; }
Source:
<code>public CcAES(final Codec codec, final byte[] key) throws IOException { final int block = 16; if (key.length != block) { throw new IllegalArgumentException( "Key length must be in 128-bit." ); } this.origin = codec; final byte[] passcode = new byte[key.length]; System.arraycopy(key, 0, passcode, 0, key.length); <START> final SecureRandom random = new SecureRandom(); <END> final byte[] ivbytes = new byte[block]; random.nextBytes(ivbytes); final AlgorithmParameterSpec spec = new IvParameterSpec(ivbytes); this.secret = new SecretKeySpec(passcode, "AES"); this.enc = this.create(Cipher.ENCRYPT_MODE, spec); this.dec = this.create(Cipher.DECRYPT_MODE, spec); }</code><technical_language>@super132 declare variables time, inline</technical_language>

Target:
public CcAES(final Codec codec, final byte[] key) throws IOException { final int block = 16; if (key.length != block) { throw new IllegalArgumentException( "Key must be with a length of 128 bits." ); } this.origin = codec; final byte[] passcode = new byte[key.length]; System.arraycopy(key, 0, passcode, 0, key.length); final SecureRandom random = new SecureRandom(); final byte[] ivbytes = new byte[block]; random.nextBytes(ivbytes); final AlgorithmParameterSpec spec = new IvParameterSpec(ivbytes); this.secret = new SecretKeySpec(passcode, "AES"); this.enc = this.create(Cipher.ENCRYPT_MODE, spec); this.dec = this.create(Cipher.DECRYPT_MODE, spec); }