auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void flushSessions(Date now) { if (shuttingDown) { return; } updateBatchCountIfNeeded(DateUtils.roundTimeToLatestMinute(now)); if (!enqueuedSessionCounts.isEmpty() && flushingRequest.tryAcquire(1)) { try { Collection<SessionCount> requestValues = new ArrayList<SessionCount>(); requestValues.addAll(enqueuedSessionCounts); SessionPayload payload = new SessionPayload(requestValues, config); Delivery delivery = config.sessionDelivery; <START> delivery.deliver(config.serializer, payload, config.getErrorApiHeaders()); <END> enqueuedSessionCounts.removeAll(requestValues); } finally { flushingRequest.release(1); } } }</code><technical_language>This config.getSessionApiHeaders()</technical_language>

Target:
void flushSessions(Date now) { if (shuttingDown.get()) { return; } sendSessions(now); }
Source:
<code>protected static CompareEditorInput createCompareEditorInput(IWorkbenchPart part, AdapterFactory adapterFactory, Notifier left, Notifier right, Notifier origin) { CompareEditorInput input = null; ICompareEditingDomain editingDomain = createEMFCompareEditingDomain(part, left, right, origin); final CompareConfiguration configuration = new CompareConfiguration(); <START> IMatchEngine.Factory eObjectEngineFactory = new MatchEObjectEngineFactory(); <END> eObjectEngineFactory.setRanking(9); IMatchEngine.Factory.Registry matchEngineFactoryRegistry = EMFCompareRCPPlugin.getDefault() .getMatchEngineFactoryRegistry(); matchEngineFactoryRegistry.add(eObjectEngineFactory); EMFCompare comparator = EMFCompare.builder() .setMatchEngineFactoryRegistry(matchEngineFactoryRegistry).setPostProcessorRegistry( EMFCompareRCPPlugin.getDefault().getPostProcessorRegistry()).build(); IComparisonScope scope = EMFCompare.createDefaultScope(left, right, origin); input = new ComparisonScopeEditorInput(configuration, editingDomain, adapterFactory, comparator, scope); input.setTitle("Compare ('" + AdapterFactoryUtil.getText(adapterFactory, left) + "' - '" + AdapterFactoryUtil.getText(adapterFactory, right) + "')"); configuration.setContainer(input); return input; }</code><technical_language>Please rename this eObjectMatchEngineFactory closer real use</technical_language>

Target:
protected static CompareEditorInput createCompareEditorInput(IWorkbenchPart part, AdapterFactory adapterFactory, Notifier left, Notifier right, Notifier origin) { CompareEditorInput input = null; ICompareEditingDomain editingDomain = createEMFCompareEditingDomain(part, left, right, origin); final CompareConfiguration configuration = new CompareConfiguration(); IMatchEngine.Factory eObjectMatchEngineFactory = new MatchEObjectEngineFactory(); eObjectMatchEngineFactory.setRanking(9); IMatchEngine.Factory.Registry matchEngineFactoryRegistry = EMFCompareRCPPlugin.getDefault() .getMatchEngineFactoryRegistry(); matchEngineFactoryRegistry.add(eObjectMatchEngineFactory); EMFCompare comparator = EMFCompare.builder() .setMatchEngineFactoryRegistry(matchEngineFactoryRegistry).setPostProcessorRegistry( EMFCompareRCPPlugin.getDefault().getPostProcessorRegistry()).build(); IComparisonScope scope = EMFCompare.createDefaultScope(left, right, origin); input = new ComparisonScopeEditorInput(configuration, editingDomain, adapterFactory, comparator, scope); input.setTitle("Compare ('" + AdapterFactoryUtil.getText(adapterFactory, left) + "' - '" + AdapterFactoryUtil.getText(adapterFactory, right) + "')"); configuration.setContainer(input); return input; }
Source:
<code><START> public static SymbolicValue literal(boolean isTruthy) { <END> return isTruthy ? UNKNOWN_TRUTHY : UNKNOWN_FALSY; }</code><technical_language>![MAJOR](<LINK_0> Provide multiple methods instead of "isTruthy" determine action take. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public static SymbolicValue literal(boolean isTruthy) { return isTruthy ? TRUTHY : FALSY; }
Source:
<code>public boolean exists(String bucketName) { <START> return this.regionMap.get(bucketName) == null; <END> }</code><technical_language>need negate condition result</technical_language>

Target:
public boolean exists(String bucketName) { return this.regionMap.get(bucketName) != null; }
Source:
<code>public void testLogBundleEventInfo() throws Exception { <START> TestListener listener = new TestListener(); reader.addLogListener(listener); Bundle testBundle = installer.installBundle("test.logging.a"); END> synchronized (listener) { testBundle.start(); listener.waitForLogEntry(); } ExtendedLogEntry entry = listener.getEntryX(); assertTrue(entry.getLevel() == LogService.LOG_INFO); assertEquals("Wrong level.", LogLevel.INFO, entry.getLogLevel()); assertTrue("Wrong context: " + entry.getContext(), entry.getContext() instanceof BundleEvent); }</code><technical_language>need pass expected bundle location TestListener constructor: String testBundleLoc = installer.getBundleLocation("test.logging.a"); TestListener listener = new TestListener(testBundleLoc); ... This applies other tests removed bundle argument TestListener constructor</technical_language>

Target:
public void testLogBundleEventInfo() throws Exception { Bundle testBundle = installer.installBundle("test.logging.a"); TestListener listener = new TestListener(testBundle.getLocation()); reader.addLogListener(listener); synchronized (listener) { testBundle.start(); listener.waitForLogEntry(); } ExtendedLogEntry entry = listener.getEntryX(); assertTrue(entry.getLevel() == LogService.LOG_INFO); assertEquals("Wrong level.", LogLevel.INFO, entry.getLogLevel()); assertTrue("Wrong context: " + entry.getContext(), entry.getContext() instanceof BundleEvent); }
Source:
<code>public void productProjectionCanBeUsedToUpdateAProduct() throws Exception { withUpdateableProduct(client(), product -> { final MetaAttributes metaAttributes = MetaAttributes.metaAttributesOf(ENGLISH, "commercetools SPHERE.IO&#8482; - Next generation eCommerce", "SPHERE.IO&#8482; is the first and leading Platform-as-a-Service solution for eCommerce.", "Platform-as-a-Service, e-commerce, http, api, tool"); final List<UpdateAction<Product>> updateActions = MetaAttributesUpdateActions.of(metaAttributes); final ProductProjection productProjection = client().executeBlocking(ProductProjectionByIdGet.of(product, STAGED)); SphereJsonUtils.toJsonString(productProjection); SphereJsonUtils.toJsonNode(productProjection).forEach(System.out::println); <START> <END> final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(productProjection, updateActions)); final ProductData productData = updatedProduct.getMasterData().getStaged(); assertThat(productData.getMetaTitle()).isEqualTo(metaAttributes.getMetaTitle()); assertThat(productData.getMetaDescription()).isEqualTo(metaAttributes.getMetaDescription()); assertThat(productData.getMetaKeywords()).isEqualTo(metaAttributes.getMetaKeywords()); return updatedProduct; }); }</code><technical_language>Do need lines above? left overs testing</technical_language>

Target:
public void productProjectionCanBeUsedToUpdateAProduct() throws Exception { withUpdateableProduct(client(), product -> { final MetaAttributes metaAttributes = MetaAttributes.metaAttributesOf(ENGLISH, "commercetools SPHERE.IO&#8482; - Next generation eCommerce", "SPHERE.IO&#8482; is the first and leading Platform-as-a-Service solution for eCommerce.", "Platform-as-a-Service, e-commerce, http, api, tool"); final List<UpdateAction<Product>> updateActions = MetaAttributesUpdateActions.of(metaAttributes); final ProductProjection productProjection = client().executeBlocking(ProductProjectionByIdGet.of(product, STAGED)); final Product updatedProduct = client().executeBlocking(ProductUpdateCommand.of(productProjection, updateActions)); final ProductData productData = updatedProduct.getMasterData().getStaged(); assertThat(productData.getMetaTitle()).isEqualTo(metaAttributes.getMetaTitle()); assertThat(productData.getMetaDescription()).isEqualTo(metaAttributes.getMetaDescription()); assertThat(productData.getMetaKeywords()).isEqualTo(metaAttributes.getMetaKeywords()); return updatedProduct; }); }
Source:
<code>public static Cursor streamCheckBeforeMessageSend(ZulipApp app, CharSequence streamName){ if (streamName == null) { streamName = ""; } <START> String query = "SELECT rowid _id, * FROM streams WHERE " + Stream.NAME_FIELD + " = '" + streamName +"' " <END> + " ORDER BY " +Stream.NAME_FIELD; Cursor cursor = ((AndroidDatabaseResults) app .getDao(Stream.class).queryRaw(query).closeableIterator() .getRawResults()).getRawCursor(); if (cursor.getCount()==1) { cursor.moveToFirst(); return cursor; }else { return null; } }</code><technical_language>Consider a case user entered a single quote ' in streamName, sql query give a syntax error app crash. I if ? in sql query provide [arguments](<LINK_0>,%20java.lang.String...)) in queryRaw</technical_language>

Target:
public static Stream streamCheckBeforeMessageSend(ZulipApp app, CharSequence streamName) { if (streamName == null) { return null; } try { return app.getDao(Stream.class) .queryBuilder().where() .eq(Stream.NAME_FIELD, new SelectArg(Stream.NAME_FIELD, streamName)).queryForFirst(); } catch (SQLException e) { ZLog.logException(e); } return null; }
Source:
<code><START> private void verifyInstructorCanViewProfile(InstructorAttributes instructor, String section) { <END> if (!instructor.isAllowedForPrivilege(section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)) { throw new UnauthorizedAccessException("Instructor does not have enough privileges to view the photo"); } }</code><technical_language>Lets update message well! view photo</technical_language>

Target:
private void verifyInstructorCanViewProfile(InstructorAttributes instructor, String section) { if (!instructor.isAllowedForPrivilege(section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)) { throw new UnauthorizedAccessException("Instructor does not have enough privileges to view the profile."); } }
Source:
<code>private void registerWithZooKeeper(CuratorFramework client) { try { String containerId = runtimeAttributes.getId(); String containerPath = Paths.build(Paths.ADMINS, containerId); Stat containerPathStat = client.checkExists().forPath(containerPath); if (containerPathStat != null) { long prevSession = containerPathStat.getEphemeralOwner(); long currSession = client.getZookeeperClient().getZooKeeper().getSessionId(); if (prevSession == currSession) { logger.info(String.format( "Existing registration for container runtime %s with session 0x%x detected", containerId, currSession)); return; } logger.info(String.format("Previous registration for container runtime %s with " + "session %x detected; current session: 0x%x", containerId, prevSession, currSession)); <START> int i = 1; <END> long startTime = System.currentTimeMillis(); while (client.checkExists().forPath(containerPath) != null) { logger.info("Waiting for container registration cleanup (elapsed time seconds)...", ((System.currentTimeMillis() - startTime) / 1000)); Thread.sleep(exponentialDelay(i++, 60) * 1000); } } synchronized (runtimeAttributes) { runtimeRepository.save(new ContainerRuntime(containerId, runtimeAttributes)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw ZooKeeperUtils.wrapThrowable(e); } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }</code><technical_language>This require some testing; I in case of admins OK simply delete ephemeral node previous session if exists. reason do this containers is containers create ephemeral nodes (for module deploy) block zk server cleans session, ensuring deletion of other ephemeral nodes</technical_language>

Target:
private void registerWithZooKeeper(CuratorFramework client) { try { String containerId = adminAttributes.getId(); String containerPath = Paths.build(Paths.ADMINS, containerId); Stat containerPathStat = client.checkExists().forPath(containerPath); if (containerPathStat != null) { long prevSession = containerPathStat.getEphemeralOwner(); long currSession = client.getZookeeperClient().getZooKeeper().getSessionId(); if (prevSession == currSession) { logger.info(String.format( "Existing registration for admin runtime %s with session 0x%x detected", containerId, currSession)); return; } logger.info(String.format("Trying to delete previous registration for admin runtime %s with " + "session %x detected; current session: 0x%x; path: %s", containerId, prevSession, currSession, containerPath)); try { client.delete().forPath(containerPath); } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } } synchronized (adminAttributes) { adminRepository.save(new Admin(containerId, adminAttributes)); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw ZooKeeperUtils.wrapThrowable(e); } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } }
Source:
<code>protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { final String realmName = Optional.ofNullable(req.getHeader(REALM_NAME_HEADER)).orElse(configuration.getRealmName()); final String authEndPoint = configuration.getAuthEndpoint(); final byte[] content = ConnectionUtils.readContent(req.getInputStream()); final URI url = new URI(authEndPoint + "/realms/" + realmName + "/protocol/openid-connect/token"); final HttpClientConnection clientConnection = new HttpClientConnection(url, RequestMethod.POST); clientConnection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final byte[] responseContent = clientConnection.readResponseContent(); ConnectionUtils.writeContent(resp.getOutputStream(), responseContent); <START> } catch (Exception e) { <END> resp.sendError(SC_HTTP_UNAUTHORIZED, "Can not authorize"); } }</code><technical_language>Add final keyword</technical_language>

Target:
protected void doPost(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { try { final String realmName = Optional.ofNullable(req.getHeader(REALM_NAME_HEADER)).orElse(configuration.getRealmName()); final String authEndPoint = configuration.getAuthEndpoint(); final byte[] content = ConnectionUtils.readContent(req.getInputStream()); final URI url = new URI(authEndPoint + "/realms/" + realmName + "/protocol/openid-connect/token"); final HttpClientConnection clientConnection = new HttpClientConnection(url, RequestMethod.POST); clientConnection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded"); clientConnection.setDoOutput(true); clientConnection.writeRequestContent(content); final int responseCode = clientConnection.readResponseCode(); if(responseCode == SC_HTTP_UNAUTHORIZED) { throw new DolphinRuntimeException("Invalid login!"); } final byte[] responseContent = clientConnection.readResponseContent(); ConnectionUtils.writeContent(resp.getOutputStream(), responseContent); } catch (final Exception e) { resp.sendError(SC_HTTP_UNAUTHORIZED, "Can not authorize"); } }
Source:
<code><START> public void edit(T object) { <END> doEdit(object); updateUiCommonMaps(); updateUiCommonEditorVisitor(); registerPropertyChangeListener(object); accept(visitor); }</code><technical_language>call removePropertyChangeListener, call doEdit, doEdit change current object</technical_language>

Target:
public void edit(T object) { removePropertyChangeListener(getObject()); doEdit(object); updateUiCommonMaps(); updateUiCommonEditorVisitor(); updatePropertyChangeListener(object); accept(visitor); }
Source:
<code>PinotDataTableWithSize(DataTable dataTable, int estimatedSizeInBytes) { <START> this.dataTable = dataTable; <END> this.estimatedSizeInBytes = estimatedSizeInBytes; }</code><technical_language>requireNonNull</technical_language>

Target:
PinotDataTableWithSize(DataTable dataTable, int estimatedSizeInBytes) { this.dataTable = requireNonNull(dataTable); this.estimatedSizeInBytes = estimatedSizeInBytes; }
Source:
<code>private boolean isReloadConfigEvent(Event event) { boolean isTarget = false; if (EventConstants.RELOAD_DAEMON_CONFIG_UEI.equals(event.getUei())) { Parm target = event.getParm(EventConstants.PARM_DAEMON_NAME); <START> if (target != null && "Eventd".equalsIgnoreCase(target.getValue().getContent())) { <END> isTarget = true; } } else if (EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI.equals(event.getUei())) { isTarget = true; } return isTarget; }</code><technical_language>Dumb question: target.getValue() null? If so, check that, too</technical_language>

Target:
private boolean isReloadConfigEvent(Event event) { boolean isTarget = false; if (EventConstants.RELOAD_DAEMON_CONFIG_UEI.equals(event.getUei())) { final Parm target = event.getParm(EventConstants.PARM_DAEMON_NAME); if (target != null && "Eventd".equalsIgnoreCase(target.getValue().getContent())) { isTarget = true; } } else if (EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI.equals(event.getUei())) { isTarget = true; } return isTarget; }
Source:
<code>public void blockNumericListUnsupported() { builder.setSupportedBlockTypes(Sets.newHashSet(BlockType.PARAGRAPH)); buildList(BlockType.NUMERIC_LIST); assertContent("<p>test 0</p><p>test <START> 1</p><br/><br/>"); <END> }</code><technical_language>thinking provide a strategy for some block types, table, numeric list bulleted list - need for <br/> <br/> terminate these</technical_language>

Target:
public void blockNumericListUnsupported() { builder.setSupportedBlockTypes(Sets.newHashSet(BlockType.PARAGRAPH)); buildList(BlockType.NUMERIC_LIST); assertContent("<p>test 0</p><p>test 1</p><br/>"); }
Source:
<code><START> default Collection<Class> getServices() { <END> return Collections.emptyList(); }</code><technical_language>type Class <? extends ThingHandlerService>. This remove warning returned list classes implement THS</technical_language>

Target:
default Collection<Class<? extends ThingHandlerService>> getServices() { return Collections.emptyList(); }
Source:
<code>public void passesWindowsEndsOfLineWithoutException() throws Exception { this.validateCheckstyle( <START> "MainWindows.java", false, <END> Matchers.containsString("LICENSE found") ); }</code><technical_language>@prahladyeri false next line</technical_language>

Target:
public void passesWindowsEndsOfLineWithoutException() throws Exception { this.validateCheckstyle( "WindowsEol.java", false, Matchers.containsString("LICENSE found") ); }
Source:
<code>private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { mWifiTetherRequested = enable; final WifiManager mgr = getWifiManager(); if (mgr == null) { <START> mLog.e(TAG, "setWifiTethering: <END> failed to get WifiManager!"); rval = TETHER_ERROR_SERVICE_UNAVAIL; } else if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { rval = TETHER_ERROR_NO_ERROR; } } } finally { Binder.restoreCallingIdentity(ident); } if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return rval; }</code><technical_language>build fail if remove TAG</technical_language>

Target:
private int setWifiTethering(final boolean enable) { int rval = TETHER_ERROR_MASTER_ERROR; final long ident = Binder.clearCallingIdentity(); try { synchronized (mPublicSync) { mWifiTetherRequested = enable; final WifiManager mgr = getWifiManager(); if (mgr == null) { mLog.e("setWifiTethering: failed to get WifiManager!"); rval = TETHER_ERROR_SERVICE_UNAVAIL; } else if ((enable && mgr.startSoftAp(null )) || (!enable && mgr.stopSoftAp())) { rval = TETHER_ERROR_NO_ERROR; } } } finally { Binder.restoreCallingIdentity(ident); } if (rval != TETHER_ERROR_NO_ERROR) { mWifiTetherRequested = false; } return rval; }
Source:
<code>public void execute(Database database) throws CustomChangeException { try { T task = this.typeClass.getConstructor(Database.class, CustomTaskLogger.class) .newInstance(database, new LiquibaseCustomTaskLogger()); task.execute(); <START> task.close(); <END> } catch (Exception e) { throw new CustomChangeException(e); } }</code><technical_language>put this in a finally block? new try-with-resources syntax</technical_language>

Target:
public void execute(Database database) throws CustomChangeException { CustomTaskLogger logger = new LiquibaseCustomTaskLogger(); try (T task = this.instantiateTask(database, logger)) { task.execute(); } catch (Exception e) { throw new CustomChangeException(e); } }
Source:
<code>public boolean apply(Resource resource) { Predicate<EObject> hasOuterRef = new EObjectHasReferencesTo(modifiedResources); <START> boolean result = Iterators.any(EcoreUtil.<EObject> getAllProperContents(resource, false), hasOuterRef); <END> return result; }</code><technical_language>for debugging purpose, "result" local necessary</technical_language>

Target:
public boolean apply(Resource resource) { Predicate<EObject> hasOuterRef = new EObjectHasReferencesTo(modifiedResources); return Iterators.any(EcoreUtil.<EObject> getAllProperContents(resource, false), hasOuterRef); }
Source:
<code>public Response toResponse(NotFoundException ex){ String uri = request.getRequestURI(); String exMessage = ex.getMessage(); String outputMessage; <START> if (exMessage != null && exMessage.startsWith("Datafile")) { <END> outputMessage = exMessage; } else { outputMessage = "endpoint does not exist on this server. Please check your code for typos, or consult our API guide at <LINK_0>"; } return Response.status(404) .entity( Json.createObjectBuilder() .add("status", "ERROR") .add("code", 404) .add("message", "'" + uri + "' " + outputMessage) .build()) .type("application/json").build(); }</code><technical_language>This startsWith a bit brittle in code base occasionally spell "DataFile"</technical_language>

Target:
public Response toResponse(NotFoundException ex){ String uri = request.getRequestURI(); String exMessage = ex.getMessage(); String outputMessage; if (exMessage != null && exMessage.toLowerCase().startsWith("datafile")) { outputMessage = exMessage; } else { outputMessage = "endpoint does not exist on this server. Please check your code for typos, or consult our API guide at <LINK_0>"; } return Response.status(404) .entity( Json.createObjectBuilder() .add("status", "ERROR") .add("code", 404) .add("message", "'" + uri + "' " + outputMessage) .build()) .type("application/json").build(); }
Source:
<code>private void setLengths() { if (common_alg != null) { switch (common_alg) { case AES_CCM_16_64_128: case AES_CCM_64_64_128: <START> case AES_CCM_16_128_128: <END> case AES_CCM_64_128_128: iv_length = ivLength(common_alg); id_length = iv_length - 6; key_length = common_alg.getKeySize() / 8; break; default: LOGGER.error("Unable to set lengths, since algorithm"); throw new RuntimeException("Unable to set lengths, since algorithm"); } } else { LOGGER.error("Common_alg has not yet been initiated."); throw new RuntimeException("Common_alg has not yet been initiated."); } }</code><technical_language>If iv-length is 7, resulting id-length is 1. Is intended</technical_language>

Target:
private void setLengths() { if (common_alg != null) { iv_length = EncryptCommon.ivLength(common_alg); if (iv_length > 0) { id_length = iv_length - 6; key_length = common_alg.getKeySize() / 8; } else { LOGGER.error("Unable to set lengths, since algorithm"); throw new RuntimeException("Unable to set lengths, since algorithm"); } } else { LOGGER.error("Common_alg has not yet been initiated."); throw new RuntimeException("Common_alg has not yet been initiated."); } }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProgramState that = (ProgramState) o; return Objects.equals(values, that.values) && Objects.equals(constraints, that.constraints) && Objects.equals(exitSymbolicValue, that.exitSymbolicValue) && Objects.equals(stack, that.stack) && <START> Objects.equals(lastAssociatedSymbol, that.lastAssociatedSymbol); <END> }</code><technical_language>do need in equality? lastEvaluated symbol for it, I fear destroy caching of PS</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } ProgramState that = (ProgramState) o; return Objects.equals(values, that.values) && Objects.equals(constraints, that.constraints) && Objects.equals(exitSymbolicValue, that.exitSymbolicValue) && Objects.equals(stack, that.stack); }
Source:
<code>public void testDoWhile() throws Exception{ final DefaultConfiguration configurationTestDoWhile = createCheckConfig(WhitespaceAfterCheck.class); configurationTestDoWhile.addAttribute("tokens", "DO_WHILE"); final String[] expected = { <START> "18:16 " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "do{}while"), <END> }; verify(configurationTestDoWhile, getPath("InputDoWhile.java"), expected); }</code><technical_language>@MaksimP , is "do{}while" ? expect space "while" (the fact is do-while is AST tree), violation is "while" token</technical_language>

Target:
public void testDoWhile() throws Exception { final DefaultConfiguration configurationTestDoWhile = createCheckConfig(WhitespaceAfterCheck.class); configurationTestDoWhile.addAttribute("tokens", "DO_WHILE"); final String[] expected = { "18:16: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "while"), }; verify(configurationTestDoWhile, getPath("InputDoWhile.java"), expected); }
Source:
<code>public void testGLnotOverridePL() { VCFFileReader reader = new VCFFileReader(new File("src/test/resources/htsjdk/variant/test_withGLandPL.vcf"), false); VariantContext variant = reader.iterator().next(); <START> reader.close(); <END> Assert.assertEquals(variant.getGenotype(0).getPL(), new int[]{45, 0, 50}); }</code><technical_language>do this in a try-with-resources instead of manual call close</technical_language>

Target:
public void testGLnotOverridePL() { final VariantContext variant; try (final VCFFileReader reader = new VCFFileReader( new File("src/test/resources/htsjdk/variant/test_withGLandPL.vcf"), false)) { variant = reader.iterator().next(); } Assert.assertEquals(variant.getGenotype(0).getPL(), new int[]{45, 0, 50}); }
Source:
<code>public void anonCanSignUpWithUsernameContainingJapaneseSpecialCharacters() { WikiBasePageObject base = new WikiBasePageObject(); SignUpPageObject signUp = base.navigateToSpecialSignUpPage(wikiURL); signUp.disableCaptcha(); String userName = "ユーザー" + signUp.getTimeStamp(); String password = "パス" + signUp.getTimeStamp(); String email = credentials.emailQaart2; RegisterArea register = new RegisterArea(false); register.typeEmailAddress(email); register.typeUsername(userName); register.typePassword(password); register.typeBirthdate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); register.clickSignUpSubmitButton(); base.verifyUserLoggedIn(userName); BannerNotifications notification = new BannerNotifications(); Assertion.assertEquals(notification.getBannerNotificationTextEmailNotConfirmed(), <START> "メールアドレスの認証が完了していないようです。受信トレイの確認メールをチェックしてみてください。確認メールが見つからない場合は、ここをクリックすると新しい確認メールが送信されます。メールアドレスを変更する必要がある場合は、「個人設定」ページにアクセスしてください。"); <END> }</code><technical_language>japanese string a variable shorter. long</technical_language>

Target:
public void anonCanSignUpWithUsernameContainingJapaneseSpecialCharacters() { WikiBasePageObject base = new WikiBasePageObject(); SignUpPageObject signUp = base.navigateToSpecialSignUpPage(wikiURL); signUp.disableCaptcha(); String userName = "ユーザー" + signUp.getTimeStamp(); String password = "パス" + signUp.getTimeStamp(); String email = credentials.emailQaart2; RegisterArea register = new RegisterArea(false); register.typeEmailAddress(email); register.typeUsername(userName); register.typePassword(password); register.typeBirthdate(PageContent.WIKI_SIGN_UP_BIRTHMONTH, PageContent.WIKI_SIGN_UP_BIRTHDAY, PageContent.WIKI_SIGN_UP_BIRTHYEAR); register.clickSignUpSubmitButton(); base.verifyUserLoggedIn(userName); BannerNotifications notification = new BannerNotifications(); String banerNotifMessageJapanese = "メールアドレスの認証が完了していないようです。受信トレイの確認メー" + "ルをチェックしてみてください。確認メールが見つからない場合は、こ" + "こをクリックすると新しい確認メールが送信されます。メールアドレス" + "を変更する必要がある場合は、" + "「個人設定」ページにアクセスしてください。"; Assertion.assertEquals( notification.getBannerNotificationTextEmailNotConfirmed(), banerNotifMessageJapanese); }
Source:
<code>protected List<DockerInspectTransformVolume> transformMounts(List<Object> mounts) { if (mounts == null) { return null; } List<DockerInspectTransformVolume> volumes = new ArrayList<DockerInspectTransformVolume>(); for (Object mount : mounts) { Map<String, Object> mountObj = (Map<String, Object>)mount; String am = ((boolean)mountObj.get(ACCESS_MODE)) ? "rw" : "ro"; String dr = (String)mountObj.get(DRIVER); String containerPath = (String)mountObj.get(DEST); String hostPath = (String)mountObj.get(SRC); String name = (String)mountObj.get(NAME); String externalId = null; <START> if (StringUtils.startsWith(hostPath, "/var/lib/rancher/volumes/rancher-")) { <END> name = Paths.get(hostPath).getFileName().toString(); dr = Paths.get(hostPath).getParent().getFileName().toString(); } if (StringUtils.isEmpty(name)) { name = hostPath; } else { externalId = name; } if ("rancher-cni".equals(name)) { continue; } boolean isBindMount = (dr == null); String uriPrefix = StringUtils.isEmpty(dr) || StringUtils.equals(dr, VolumeConstants.LOCAL_DRIVER) ? VolumeConstants.FILE_PREFIX : dr; String uri = String.format(VolumeConstants.URI_FORMAT, uriPrefix, hostPath); volumes.add(new DockerInspectTransformVolume(containerPath, uri, am, isBindMount, dr, name, externalId)); } return volumes; }</code><technical_language>feel bad :)</technical_language>

Target:
protected List<DockerInspectTransformVolume> transformMounts(List<Object> mounts) { if (mounts == null) { return null; } List<DockerInspectTransformVolume> volumes = new ArrayList<DockerInspectTransformVolume>(); for (Object mount : mounts) { Map<String, Object> mountObj = (Map<String, Object>)mount; String am = ((boolean)mountObj.get(ACCESS_MODE)) ? DockerVolumeConstants.READ_WRITE : DockerVolumeConstants.READ_ONLY; String dr = (String)mountObj.get(DRIVER); String containerPath = (String)mountObj.get(DEST); String hostPath = (String)mountObj.get(SRC); String name = (String)mountObj.get(NAME); String externalId = null; if (StringUtils.startsWith(hostPath, RANCHER_VOLUME_PREFIX)) { name = Paths.get(hostPath).getFileName().toString(); dr = Paths.get(hostPath).getParent().getFileName().toString(); } if (StringUtils.isEmpty(name)) { name = hostPath; } else { externalId = name; } if ("rancher-cni".equals(name)) { continue; } boolean isBindMount = (dr == null); String uriPrefix = StringUtils.isEmpty(dr) || StringUtils.equals(dr, VolumeConstants.LOCAL_DRIVER) ? VolumeConstants.FILE_PREFIX : dr; String uri = String.format(VolumeConstants.URI_FORMAT, uriPrefix, hostPath); volumes.add(new DockerInspectTransformVolume(containerPath, uri, am, isBindMount, dr, name, externalId)); } return volumes; }
Source:
<code>public static void getNextPageUsersInCategory(String nextURL, CanvasCallback<User[]> callback) { <START> if (APIHelpers.paramIsNull(callback, nextURL)) { <END> return; } callback.setIsNextPage(true); buildInterface(callback).getNextPageUsersInCategory(nextURL, callback); }</code><technical_language>Inline please</technical_language>

Target:
public static void getNextPageUsersInCategory(String nextURL, CanvasCallback<User[]> callback) { if (APIHelpers.paramIsNull(callback, nextURL)) return; callback.setIsNextPage(true); buildInterface(callback).getNextPageUsersInCategory(nextURL, callback); }
Source:
<code>public void testCall() { String change_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !"); gAccess.pushFile(); change_id = gAccess.getChangeId(); } catch (Exception e1) { fail(e1.getMessage()); } GetChangeCommand command = fGerrit.getChange(change_id); command.addOption(ChangeOption.DETAILED_LABELS); ChangeInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } catch (ClientProtocolException e) { fail(e.getMessage()); } <START> for (Entry<String, String[]> entry : result.getPermittedLabels().entrySet()) { <END> System.out.println(entry.getKey() + ": "); for (String strArr : entry.getValue()) { System.out.println(strArr); } } assertEquals(change_id, result.getChange_id()); }</code><technical_language>needed for test ..</technical_language>

Target:
public void testCall() { String change_id = null; try { GitAccess gAccess = new GitAccess(); Git git = gAccess.getGitProject(); gAccess.addFile("EGerritTestReviewFile.java", "Hello reviewers community !"); gAccess.pushFile(); change_id = gAccess.getChangeId(); } catch (Exception e1) { fail(e1.getMessage()); } GetChangeCommand command = fGerrit.getChange(change_id); command.addOption(ChangeOption.DETAILED_LABELS); ChangeInfo result = null; try { result = command.call(); } catch (EGerritException e) { fail(e.getMessage()); } catch (ClientProtocolException e) { fail(e.getMessage()); } assertEquals(change_id, result.getChange_id()); }
Source:
<code><START> public static final Object[][] collapse() { <END> return new Object[][]{ { "project43", "SyntheticTests/AdType/Collapse", new String[] { AdsContent.TOP_LB, AdsContent.MEDREC } }, }; }</code><technical_language>do of testing this ad type in another slot for example MIC new BLB</technical_language>

Target:
public static final Object[][] collapse() { return new Object[][]{ { "project43", "SyntheticTests/AdType/Collapse", "wka.life/_project43 new String[] { AdsContent.TOP_LB, AdsContent.MEDREC } }, }; }
Source:
<code>public void updateScores(HashMap<Integer, Double> scoreMap) { for (Integer id : scoreMap.keySet()) { GameObject go = gameObjects.get(id); <START> if (go != null && go instanceof BoDCharacter) <END> { BoDCharacter bodCharacter = (BoDCharacter)go; double score = scoreMap.get(id); bodCharacter.setScore(score); } } }</code><technical_language>want exception if cast fails, instanceof</technical_language>

Target:
public void updateScores(HashMap<Integer, Double> scoreMap) { for (Integer id : scoreMap.keySet()) { GameObject go = gameObjects.get(id); if (go != null ) { BoDCharacter bodCharacter = (BoDCharacter)go; double score = scoreMap.get(id); bodCharacter.setScore(score); } } }
Source:
<code>private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException { MimeHeaders mimeHeaders = new MimeHeaders(); if (inputStream instanceof TransportInputStream) { TransportInputStream transportInputStream = (TransportInputStream) inputStream; <START> Iterator<String> headerNamesWithDuplicate = transportInputStream.getHeaderNames(); <END> List<String> headerKeys = new ArrayList<String>(); while (headerNamesWithDuplicate.hasNext()) { String key = headerNamesWithDuplicate.next(); if(!headerKeys.contains(key)) { headerKeys.add(key); } } for (Iterator<String> headerNames = headerKeys.iterator(); headerNames.hasNext();) { String headerName = headerNames.next(); for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) { String headerValue = headerValues.next(); StringTokenizer tokenizer = new StringTokenizer(headerValue, ","); while (tokenizer.hasMoreTokens()) { mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim()); } } } } return mimeHeaders; }</code><technical_language>AFAIK, SAAJ MimeHeaders is capable of dealing multiple entries header name. need remove duplicates here</technical_language>

Target:
private MimeHeaders parseMimeHeaders(InputStream inputStream) throws IOException { MimeHeaders mimeHeaders = new MimeHeaders(); if (inputStream instanceof TransportInputStream) { TransportInputStream transportInputStream = (TransportInputStream) inputStream; for (Iterator<String> headerNames = transportInputStream.getHeaderNames(); headerNames.hasNext();) { String headerName = headerNames.next(); for (Iterator<String> headerValues = transportInputStream.getHeaders(headerName); headerValues.hasNext();) { String headerValue = headerValues.next(); StringTokenizer tokenizer = new StringTokenizer(headerValue, ","); while (tokenizer.hasMoreTokens()) { mimeHeaders.addHeader(headerName, tokenizer.nextToken().trim()); } } } } return mimeHeaders; }
Source:
<code>private DiskImage createMetadataDisk(VM vm, Snapshot snapshot) { StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, memoryDiskDomainMap.get(snapshot.getMetadataDiskId())); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, snapshot.getMetadataDiskId()); if (sd == null || disk != null) { return null; } DiskImage memoryDisk = <START> MemoryUtils.createSnapshotMetadataDisk(vm, <END> MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(snapshot.getMetadataDiskId()); memoryDisk.setImageId(getMemoryDiskImageId(snapshot.getMetadataDiskId())); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(sd.getId()))); memoryDisk.setStoragePoolId(getStoragePoolId()); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }</code><technical_language>VM's name, pass name string instead of VM object</technical_language>

Target:
private DiskImage createMetadataDisk(VM vm, Snapshot snapshot) { StorageDomainStatic sd = validateStorageDomainExistsInDb(snapshot, memoryDiskDomainMap.get(snapshot.getMetadataDiskId())); DiskImage disk = isMemoryDiskAlreadyExistsInDb(snapshot, snapshot.getMetadataDiskId()); if (sd == null || disk != null) { return null; } DiskImage memoryDisk = MemoryUtils.createSnapshotMetadataDisk(vm.getname(), MemoryUtils.generateMemoryDiskDescription(vm, snapshot.getDescription())); memoryDisk.setId(snapshot.getMetadataDiskId()); memoryDisk.setImageId(getMemoryDiskImageId(snapshot.getMetadataDiskId())); memoryDisk.setStorageIds(new ArrayList<>(Collections.singletonList(sd.getId()))); memoryDisk.setStoragePoolId(getStoragePoolId()); memoryDisk.setCreationDate(snapshot.getCreationDate()); memoryDisk.setActive(true); memoryDisk.setWipeAfterDelete(vm.getDiskList().stream().anyMatch(DiskImage::isWipeAfterDelete)); return memoryDisk; }
Source:
<code>private void updateMultiselectMenu() { if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) { return; } <START> mActionBarMenu.findItem(R.id.action_preview).setVisible(mCheckedCardPositions.size() == 1); <END> if (!mCheckedCardPositions.isEmpty()) { DeckTask.launchDeckTask(DeckTask.TASK_TYPE_CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new DeckTask.TaskData(new Object[]{mCheckedCardPositions, getCards()})); } if (mCheckedCardPositions.size() < getCards().size()) { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_all); } else { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_none); } }</code><technical_language>I this limitation is necessary, send previewer list of currently selected card ids</technical_language>

Target:
private void updateMultiselectMenu() { if (mActionBarMenu == null || mActionBarMenu.findItem(R.id.action_suspend_card) == null) { return; } if (!mCheckedCardPositions.isEmpty()) { DeckTask.launchDeckTask(DeckTask.TASK_TYPE_CHECK_CARD_SELECTION, mCheckSelectedCardsHandler, new DeckTask.TaskData(new Object[]{mCheckedCardPositions, getCards()})); } if (mCheckedCardPositions.size() < getCards().size()) { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_all); } else { mActionBarMenu.findItem(R.id.action_select_all).setTitle(R.string.card_browser_select_none); } }
Source:
<code>public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { CacheAffinityInfo affinityInfo = cacheAffinity.get(cacheId); if (affinityInfo == null || affinityInfo.keyCfg == null || affinityInfo.partMapping == null) return null; Object binaryKey = binary.toBinary(key); if (!affinityInfo.keyCfg.isEmpty()) { int typeId = binary.typeId(key.getClass().getName()); <START> <END> Integer fieldId = affinityInfo.keyCfg.get(typeId); if (fieldId != null) { if (binaryKey instanceof BinaryObjectExImpl) binaryKey = ((BinaryObjectExImpl)binaryKey).field(fieldId); else return null; } } return affinityInfo.nodeForKey(binaryKey); }</code><technical_language>This inefficient: toBinary marshal byte[] unmarshal back. For simple keys (numbers strings - common case) this conversion is unnecessary, get hash directly. I check for simple types first, deal user-defined classes</technical_language>

Target:
public UUID affinityNode(IgniteBinary binary, int cacheId, Object key) { CacheAffinityInfo affinityInfo = cacheAffinity.get(cacheId); if (affinityInfo == null || affinityInfo == NOT_APPLICABLE_CACHE_AFFINITY_INFO) return null; Object binaryKey = binary.toBinary(key); if (!affinityInfo.keyCfg.isEmpty()) { int typeId = binary.typeId(key.getClass().getName()); Integer fieldId = affinityInfo.keyCfg.get(typeId); if (fieldId != null) { if (binaryKey instanceof BinaryObjectExImpl) binaryKey = ((BinaryObjectExImpl)binaryKey).field(fieldId); else return null; } } return affinityInfo.nodeForKey(binaryKey); }
Source:
<code>public Iterable<IEObjectDescription> getElements(EObject object) { Iterable<IEObjectDescription> result = super.getElements(object); if (Iterables.isEmpty(result) && (object instanceof EPackage)) { final EPackage ePackage = (EPackage) object; Iterable<IEObjectDescription> localElements = getLocalElementsByEClass(EcorePackage.Literals.EPACKAGE); result = Iterables.filter(localElements, new Predicate<IEObjectDescription>() { @Override public boolean apply(IEObjectDescription input) { <START> return input.getQualifiedName().toString().equals(ePackage.getNsURI()); <END> } }); } return result; }</code><technical_language>toString(".") here, for clarity</technical_language>

Target:
public Iterable<IEObjectDescription> getElements(EObject object) { Iterable<IEObjectDescription> result = super.getElements(object); if (Iterables.isEmpty(result) && (object instanceof EPackage)) { final EPackage ePackage = (EPackage) object; Iterable<IEObjectDescription> localElements = getLocalElementsByEClass(EcorePackage.Literals.EPACKAGE); result = Iterables.filter(localElements, new Predicate<IEObjectDescription>() { @Override public boolean apply(IEObjectDescription input) { return input.getQualifiedName().toString(".").equals(ePackage.getNsURI()); } }); } return result; }
Source:
<code><START> private HttpHeaders setResponseHeader(String headerName, Object headerValue) <END> throws RestServiceException { if (headerName != null && headerValue != null) { try { responseMetadataChangeLock.lock(); verifyResponseAlive(); if (headerValue instanceof Date) { HttpHeaders.setDateHeader(responseMetadata, headerName, (Date) headerValue); } else { HttpHeaders.setHeader(responseMetadata, headerName, headerValue); } logger.trace("Header set to for channel {}", headerName, responseMetadata.headers().get(headerName), ctx.channel()); return responseMetadata.headers(); } catch (RestServiceException e) { nettyMetrics.deadResponseAccessError.inc(); throw e; } finally { responseMetadataChangeLock.unlock(); } } else { throw new IllegalArgumentException("Header name [" + headerName + "] or header value [" + headerValue + "] null"); } }</code><technical_language>do return headers</technical_language>

Target:
private void setResponseHeader(String headerName, Object headerValue) throws RestServiceException { if (headerName != null && headerValue != null) { responseMetadataChangeLock.lock(); try { verifyResponseMetadataAlive(); if (headerValue instanceof Date) { HttpHeaders.setDateHeader(responseMetadata, headerName, (Date) headerValue); } else { HttpHeaders.setHeader(responseMetadata, headerName, headerValue); } logger.trace("Header set to for channel {}", headerName, responseMetadata.headers().get(headerName), ctx.channel()); } catch (RestServiceException e) { nettyMetrics.deadResponseAccessError.inc(); throw e; } finally { responseMetadataChangeLock.unlock(); } } else { throw new IllegalArgumentException("Header name [" + headerName + "] or header value [" + headerValue + "] null"); } }
Source:
<code>public Map<String,String> asRelativePathSettingsMap() { try { Settings.initialize(m_voltdbRoot); File currDir = new File("").getCanonicalFile(); File voltdbroot = m_voltdbRoot.getCanonicalFile(); String relativePath = currDir.toPath().relativize(voltdbroot.toPath()).toString(); return ImmutableMap.<String, String>builder() .put(NodeSettings.VOLTDBROOT_PATH_KEY, relativePath) .build(); } catch (IOException e) { <START> throw new SettingsException("Failed to relativize voltdbroot"); <END> } }</code><technical_language>If feasible, pass path information in exception exception message</technical_language>

Target:
public Map<String,String> asRelativePathSettingsMap() { Settings.initialize(m_voltdbRoot); File currDir; File voltdbroot; try { currDir = new File("").getCanonicalFile(); voltdbroot = m_voltdbRoot.getCanonicalFile(); } catch (IOException e) { throw new SettingsException( "Failed to relativize voltdbroot " + m_voltdbRoot.getPath() + ". Reason: " + e.getMessage()); } String relativePath = currDir.toPath().relativize(voltdbroot.toPath()).toString(); return ImmutableMap.<String, String>builder() .put(NodeSettings.VOLTDBROOT_PATH_KEY, relativePath) .build(); }
Source:
<code>public void checkSpecificAccessControl() { if (!(userInfo.isStudent || userInfo.isInstructor)) { throw new UnauthorizedAccessException("Student or instructor privilege is required to access this resource."); } String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (userInfo.isInstructor) { if (courseId == null) { <START> gateKeeper.verifyInstructorPrivileges(logic.getAccount(userInfo.getId())); <END> } else { CourseAttributes courseAttributes = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), courseAttributes); } } if (userInfo.isStudent) { if (courseId == null) { gateKeeper.verifyStudentPrivileges(logic.getAccount(userInfo.getId())); } else { CourseAttributes courseAttributes = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getStudentForGoogleId(courseId, userInfo.getId()), courseAttributes); } } }</code><technical_language>Is this necessary? usesrInfo.isInstructor perform this check already</technical_language>

Target:
public void checkSpecificAccessControl() { String entityType = getNonNullRequestParamValue(Const.ParamsNames.ENTITY_TYPE); if (!(entityType.equals(Const.EntityType.STUDENT) || entityType.equals(Const.EntityType.INSTRUCTOR))) { throw new UnauthorizedAccessException("entity type not supported."); } String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); if (entityType.equals(Const.EntityType.STUDENT)) { if (!userInfo.isStudent) { throw new UnauthorizedAccessException("User " + userInfo.getId() + " does not have student privileges"); } if (courseId != null) { CourseAttributes courseAttributes = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getStudentForGoogleId(courseId, userInfo.getId()), courseAttributes); } } else { if (!userInfo.isInstructor) { throw new UnauthorizedAccessException("User " + userInfo.getId() + " does not have instructor privileges"); } if (courseId != null) { CourseAttributes courseAttributes = logic.getCourse(courseId); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), courseAttributes); } } }
Source:
<code>public boolean publishMessage(String channel, String message) { ByteBuf messageByteBuffer; try { messageByteBuffer = Coder.getArrayResponse(context.getByteBufAllocator(), Arrays.asList("message", channel, message)); } catch (CoderException e) { throw new RuntimeException(e); } CountDownLatch latch = new CountDownLatch(1); ChannelFutureListener channelFutureListener = future -> latch.countDown(); ChannelFuture channelFuture = context.writeToChannelWithListener(messageByteBuffer, channelFutureListener); try { <START> latch.await(1, TimeUnit.SECONDS); <END> } catch (InterruptedException e) { throw new RuntimeException(e); } return channelFuture.cause() == null; }</code><technical_language>Is this timeout SLA guess? if a message takes 2s send, is bad? a timeout configured a more lenient</technical_language>

Target:
public boolean publishMessage(String channel, String message) { ByteBuf messageByteBuffer = constructResponse(channel, message); if (messageByteBuffer == null) { return false; } return writeToChannelSynchronously(messageByteBuffer); }