auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static long[][] filterGridLocs(StorageBroker sb, SecurityDispatcher secDisp, TileLayer tileLayer, String gridSetId, MimeType mime, long[][] linkGridLocs) throws GeoWebCacheException { for(int i=0;i<linkGridLocs.length; i++) { if(linkGridLocs[i][2] > 0) { ConveyorTile tile = new ConveyorTile(sb, tileLayer.getName(), gridSetId, linkGridLocs[i], mime, null, null, null); try { <START> tile.setTileLayer(tileLayer); <END> secDisp.checkSecurity(tile); tileLayer.applyRequestFilters(tile); } catch(SecurityException ex) { linkGridLocs[i][2] = -1; } catch(GreenTileException e) { } catch(RequestFilterException e) { linkGridLocs[i][2] = -1; continue; } if (mime.equals(XMLMime.kml)) { try { tileLayer.getTile(tile); } catch (IOException ioe) { log.error(ioe.getMessage()); linkGridLocs[i][2] = -1; } catch (GeoWebCacheException gwce) { linkGridLocs[i][2] = -1; } if (tile.getStatus() == 204) { linkGridLocs[i][2] = -1; } else if (tile.getStatus() != 200) { throw new GeoWebCacheException( "Unexpected response code from server " + tile.getStatus()); } } } } return linkGridLocs; }</code><technical_language>Minor nitpick, this need try block, need secDisp.checkSecurity(tile); here</technical_language>

Target:
public static long[][] filterGridLocs(StorageBroker sb, SecurityDispatcher secDisp, TileLayer tileLayer, String gridSetId, MimeType mime, long[][] linkGridLocs) throws GeoWebCacheException { for(int i=0;i<linkGridLocs.length; i++) { if(linkGridLocs[i][2] > 0) { ConveyorTile tile = new ConveyorTile(sb, tileLayer.getName(), gridSetId, linkGridLocs[i], mime, null, null, null); tile.setTileLayer(tileLayer); try { secDisp.checkSecurity(tile); tileLayer.applyRequestFilters(tile); } catch(SecurityException ex) { linkGridLocs[i][2] = -1; } catch(GreenTileException e) { } catch(RequestFilterException e) { linkGridLocs[i][2] = -1; continue; } if (mime.equals(XMLMime.kml)) { try { tileLayer.getTile(tile); } catch (IOException ioe) { log.error(ioe.getMessage()); linkGridLocs[i][2] = -1; } catch (GeoWebCacheException gwce) { linkGridLocs[i][2] = -1; } if (tile.getStatus() == 204) { linkGridLocs[i][2] = -1; } else if (tile.getStatus() != 200) { throw new GeoWebCacheException( "Unexpected response code from server " + tile.getStatus()); } } } } return linkGridLocs; }
Source:
<code>public String toString() { final StringBuilder sb = new StringBuilder("StreamResponseCommand{"); <START> sb.append(", id=").append(id); <END> sb.append("complete=").append(complete); sb.append(", response=").append(response); sb.append('}'); return sb.toString(); }</code><technical_language>Extra ", "</technical_language>

Target:
public String toString() { final StringBuilder sb = new StringBuilder("StreamResponseCommand{"); sb.append("id=").append(id); sb.append(", complete=").append(complete); sb.append(", response=").append(response); sb.append('}'); return sb.toString(); }
Source:
<code>public void flattenModule(LogicalPlan parentDAG, Configuration conf) { module.populateDAG(dag, conf); for (ModuleMeta subModuleMeta : dag.getAllModules()) { <START> subModuleMeta.flattenModule(dag, conf); <END> subModuleMeta.setParentModuleName(this.name); } dag.applyStreamLinks(); parentDAG.addDAGToCurrentDAG(dag, this.name); }</code><technical_language>flatten modules in dag? this flatten current module</technical_language>

Target:
public void flattenModule(LogicalPlan parentDAG, Configuration conf) { module.populateDAG(dag, conf); for (ModuleMeta subModuleMeta : dag.getAllModules()) { subModuleMeta.setParent(this); subModuleMeta.flattenModule(dag, conf); } dag.applyStreamLinks(); parentDAG.addDAGToCurrentDAG(this); }
Source:
<code>protected void onPushOpen(Context context, Intent intent) { super.onPushOpen(context, intent); final CourseUpdateNotificationPayload payload = ParseHandleHelper.extractPayload(intent); final String courseId = payload == null ? "" : payload.getCourseId(); EventBus.getDefault().postSticky(new CourseAnnouncementEvent( <START> CourseAnnouncementEvent.EventType.MESSAGE_TAPPED, courseId)); <END> Class activity = ParseHandleHelper.getActivityClass(payload); if (activity == CourseDetailTabActivity.class) { Bundle courseBundle = new Bundle(); courseBundle.putBoolean(Router.EXTRA_ANNOUNCEMENTS, true); courseBundle.putString(Router.EXTRA_COURSE_ID, payload.getCourseId()); Intent resultIntent = new Intent(context, CourseDetailTabActivity.class); resultIntent.setAction(Long.toString(System.currentTimeMillis())); resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); resultIntent.putExtra(Router.EXTRA_BUNDLE, courseBundle); context.startActivity(resultIntent); } }</code><technical_language>Do need send local events? send analytics event directly</technical_language>

Target:
protected void onPushOpen(Context context, Intent intent) { ParseAnalytics.trackAppOpenedInBackground(intent); final BaseNotificationPayload payload = ParseHandleHelper.extractPayload(intent); if (null != payload && null != payload.getAction()) { switch (payload.getAction()) { case ParseHandleHelper.COURSE_ANNOUNCEMENT_ACTION: { final String courseId = ((CourseUpdateNotificationPayload) payload).getCourseId(); segment.trackNotificationTapped(courseId); router.showCourseAnnouncementFromNotification(context, courseId); return; } } } segment.trackNotificationTapped(null); context.startActivity(new Intent(context, MyCoursesListActivity.class)); }
Source:
<code>public void createTable(TableElement tableDef) throws OseeCoreException { <START> String toExecute = "CREATE TABLE " + tableDef.getName() + " ( \n"; <END> toExecute += handleColumnCreationSection(tableDef.getColumns()); toExecute += handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName()); toExecute += handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName()); toExecute += " \n)\n"; getLogger().debug("Creating Table: [%s]", tableDef.getFullyQualifiedTableName()); ConnectionHandler.runPreparedUpdate(toExecute); }</code><technical_language>Change stringbuilder</technical_language>

Target:
public void createTable(TableElement tableDef) throws OseeCoreException { StringBuilder builder = new StringBuilder(); builder.append("CREATE TABLE ").append(tableDef.getName()).append(" ( \n"); builder.append(handleColumnCreationSection(tableDef.getColumns())); builder.append(handleConstraintCreationSection(tableDef.getConstraints(), tableDef.getFullyQualifiedTableName())); builder.append(handleConstraintCreationSection(tableDef.getForeignKeyConstraints(), tableDef.getFullyQualifiedTableName())); builder.append(" \n)\n"); getLogger().debug("Creating Table: [%s]", tableDef.getFullyQualifiedTableName()); ConnectionHandler.runPreparedUpdate(builder.toString()); }
Source:
<code>@WorkerThread @Override public void onMessage(RelayMessage message) { kitty.trace("→ onMessage(%s)", message.getID()); String id = message.getID(); <START> SendMessageWithPromiseEvent callbackEvent = promiseCallbacks.get(id); <END> promiseCallbacks.remove(id); if (state.contains(STATE.STOPPED)) { if (callbackEvent != null) { callbackEvent.future.cancel(true); } return; } ping.onMessage(); RelayObject[] objects = message.getObjects() == null ? NULL : message.getObjects(); if (callbackEvent != null) { callbackEvent.future.complete(objects); for (RelayObject object : objects) BufferList.handleMessage(object, callbackEvent.originalMessageId); } else { for (RelayObject object : objects) BufferList.handleMessage(object, id); } }</code><technical_language>i remove() returns previous need get() remove()</technical_language>

Target:
@WorkerThread @Override public void onMessage(RelayMessage message) { kitty.trace("→ onMessage(%s)", message.getID()); if (state.contains(STATE.STOPPED)) return; ping.onMessage(); RelayObject[] objects = message.getObjects() == null ? NULL : message.getObjects(); String id = message.getID(); for (RelayObject object : objects) BufferList.handleMessage(object, id); }
Source:
<code>public Map<String, RangeSet<String>> getDomain() { Map<String, RangeSet<String>> retMap = new HashMap<>(); Range<String> range; if (start == null && end == null) { range = Range.all(); } else if (start == null) { range = Range.atMost(end); } else if (end == null) { range = Range.atLeast(start); } else { range = Range.closed(start, end); } <START> retMap.put(dimension, ImmutableRangeSet.of(range)); <END> return retMap; }</code><technical_language>ImmutableMap.of(dimension, ImmutableRangeSet.of(range)) is a bit more efficient (ImmutableMap.of optimized impls for zero element maps)</technical_language>

Target:
public Map<String, Range<String>> getDomain() { Range<String> range; if (start == null && end == null) { range = Range.all(); } else if (start == null) { range = Range.atMost(end); } else if (end == null) { range = Range.atLeast(start); } else { range = Range.closed(start, end); } return ImmutableMap.of(dimension, range); }
Source:
<code>public void testStartStreaming() throws InterruptedException { Mockito.when(client.initializeState(StreamFrom.BEGINNING, StreamTo.NOW)).thenReturn(Completable.complete()); Mockito.when(client.startStreaming(Mockito.<Short[]>anyVararg())).thenReturn(Completable.complete()); SessionState sessionState = Mockito.mock(SessionState.class); Mockito.when(sessionState.isAtEnd()).thenReturn(false, false, true); Mockito.when(client.sessionState()).thenReturn(sessionState); BlockingQueue<ByteBuf> resultsQueue = new ArrayBlockingQueue<>(3); streamingConnection.startStreaming(resultsQueue); Assert.assertTrue(streamingConnection.isStreaming()); <START> Thread.sleep(4 * 500); <END> Mockito.verify(client, Mockito.times(3)).sessionState(); }</code><technical_language>2000</technical_language>

Target:
public void testStartStreaming() throws InterruptedException { Mockito.when(client.initializeState(StreamFrom.BEGINNING, StreamTo.NOW)).thenReturn(Completable.complete()); Mockito.when(client.startStreaming(Mockito.<Short[]>anyVararg())).thenReturn(Completable.complete()); SessionState sessionState = Mockito.mock(SessionState.class); Mockito.when(sessionState.isAtEnd()).thenReturn(false, false, true); Mockito.when(client.sessionState()).thenReturn(sessionState); BlockingQueue<ByteBuf> resultsQueue = new ArrayBlockingQueue<>(3); streamingConnection.startStreaming(resultsQueue); Assert.assertTrue(streamingConnection.isStreaming()); Thread.sleep(2000); Mockito.verify(client, Mockito.times(3)).sessionState(); }
Source:
<code>int runCmd(CommandLine cmdLine) throws Exception { final String includingBookieId = cmdLine.getOptionValue("missingreplica"); final String excludingBookieId = cmdLine.getOptionValue("excludingmissingreplica"); Predicate<List<String>> predicate = null; if (!StringUtils.isBlank(includingBookieId) && !StringUtils.isBlank(excludingBookieId)) { predicate = replicasList -> (replicasList.contains(includingBookieId) && !replicasList.contains(excludingBookieId)); } else if (!StringUtils.isBlank(includingBookieId)) { predicate = replicasList -> replicasList.contains(includingBookieId); } else if (!StringUtils.isBlank(excludingBookieId)) { predicate = replicasList -> !replicasList.contains(excludingBookieId); } LedgerManagerFactory mFactory = null; try { mFactory = LedgerManagerFactory.newLedgerManagerFactory( bkConf, <START> new ZkLayoutManager( <END> ZooKeeperClient.newBuilder() .connectString(bkConf.getZkServers()) .sessionTimeoutMs(bkConf.getZkTimeout()) .build(), bkConf.getZkLedgersRootPath(), ZkUtils.getACLs(bkConf))); LedgerUnderreplicationManager underreplicationManager = mFactory.newLedgerUnderreplicationManager(); Iterator<Long> iter = underreplicationManager.listLedgersToRereplicate(predicate); while (iter.hasNext()) { System.out.println(ledgerIdFormatter.formatLedgerId(iter.next())); } } finally { if (mFactory != null) { mFactory.uninitialize(); } } return 0; }</code><technical_language>I avoid construct ZkLayoutManager directly. A do this: try (RegistrationManager rm = ...) { try (LedgerManagerFactory mFactory = LedgerManagerFactory.newLedgerManagerFactory(.., rm.getLayoutManager()) { ... } }</technical_language>

Target:
int runCmd(CommandLine cmdLine) throws Exception { final String includingBookieId = cmdLine.getOptionValue("missingreplica"); final String excludingBookieId = cmdLine.getOptionValue("excludingmissingreplica"); Predicate<List<String>> predicate = null; if (!StringUtils.isBlank(includingBookieId) && !StringUtils.isBlank(excludingBookieId)) { predicate = replicasList -> (replicasList.contains(includingBookieId) && !replicasList.contains(excludingBookieId)); } else if (!StringUtils.isBlank(includingBookieId)) { predicate = replicasList -> replicasList.contains(includingBookieId); } else if (!StringUtils.isBlank(excludingBookieId)) { predicate = replicasList -> !replicasList.contains(excludingBookieId); } try (RegistrationManager rm = RegistrationManager.instantiateRegistrationManager(bkConf)) { try (LedgerManagerFactory mFactory = LedgerManagerFactory.newLedgerManagerFactory(bkConf, rm.getLayoutManager())) { LedgerUnderreplicationManager underreplicationManager = mFactory.newLedgerUnderreplicationManager(); Iterator<Long> iter = underreplicationManager.listLedgersToRereplicate(predicate); while (iter.hasNext()) { System.out.println(ledgerIdFormatter.formatLedgerId(iter.next())); } } } return 0; }
Source:
<code>public void testWriteAndReadBCFWithIndex() throws IOException { <START> final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); <END> Tribble.indexFile(bcfOutputFile).deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .setOptions(EnumSet.of(Options.INDEX_ON_THE_FLY)) .build()) { writer.writeHeader(header); writer.add(createVC(header)); writer.add(createVC(header)); } VariantContextTestProvider.VariantContextContainer container = VariantContextTestProvider .readAllVCs(bcfOutputFile, new BCF2Codec()); int counter = 0; final Iterator<VariantContext> it = container.getVCs().iterator(); while (it.hasNext()) { it.next(); counter++; } Assert.assertEquals(counter, 2); }</code><technical_language>this</technical_language>

Target:
public void testWriteAndReadBCFWithIndex() throws IOException { final File bcfOutputFile = File.createTempFile("testWriteAndReadVCF.", ".bcf", tempDir); bcfOutputFile.deleteOnExit(); Tribble.indexFile(bcfOutputFile).deleteOnExit(); final VCFHeader header = createFakeHeader(); try (final VariantContextWriter writer = new VariantContextWriterBuilder() .setOutputFile(bcfOutputFile).setReferenceDictionary(header.getSequenceDictionary()) .setOptions(EnumSet.of(Options.INDEX_ON_THE_FLY)) .build()) { writer.writeHeader(header); writer.add(createVC(header)); writer.add(createVC(header)); } VariantContextTestProvider.VariantContextContainer container = VariantContextTestProvider .readAllVCs(bcfOutputFile, new BCF2Codec()); int counter = 0; final Iterator<VariantContext> it = container.getVCs().iterator(); while (it.hasNext()) { it.next(); counter++; } Assert.assertEquals(counter, 2); }
Source:
<code>public void testGenerateInstructorJoinEmail() throws IOException { ______TS("instructor new account email"); String instructorEmail = "instructor@email.tmt"; String shortName = "Instr"; String regkey = "skxxxxxxxxxks"; @SuppressWarnings("deprecation") InstructorAttributes receiver = new InstructorAttributes("googleId", "courseId", "Instructor Name", instructorEmail); receiver.key = regkey; AccountAttributes sender = new AccountAttributes(); sender.email = "instructor-joe@gmail.com"; sender.name = "Joe Wilson"; String joinLink = Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_COURSE_JOIN) .withRegistrationKey(StringHelper.encrypt(regkey)) .withInstructorInstitution("Test Institute") .toAbsoluteString(); EmailWrapper email = new EmailGenerator() .generateNewInstructorAccountJoinEmail(instructorEmail, shortName, joinLink); String subject = String.format(EmailType.NEW_INSTRUCTOR_ACCOUNT.getSubject(), shortName); verifyEmail(email, instructorEmail, subject, "/instructorNewAccountEmail.html"); assertEquals(email.getBcc(), Config.SUPPORT_EMAIL); ______TS("instructor course join email"); CourseAttributes course = new CourseAttributes("course-id", "Course Name", "UTC"); email = new EmailGenerator().generateInstructorCourseJoinEmail(sender, receiver, course); subject = String.format(EmailType.INSTRUCTOR_COURSE_JOIN.getSubject(), course.getName(), course.getId()); <START> verifyEmail(email, receiver.email, subject, "/instructorCourseJoinEmail.html"); <END> }</code><technical_language>Check sender's email well</technical_language>

Target:
public void testGenerateInstructorJoinEmail() throws IOException { ______TS("instructor new account email"); String instructorEmail = "instructor@email.tmt"; String shortName = "Instr"; String regkey = "skxxxxxxxxxks"; @SuppressWarnings("deprecation") InstructorAttributes instructor = new InstructorAttributes("googleId", "courseId", "Instructor Name", instructorEmail); instructor.key = regkey; AccountAttributes inviter = new AccountAttributes(); inviter.email = "instructor-joe@gmail.com"; inviter.name = "Joe Wilson"; String joinLink = Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_COURSE_JOIN) .withRegistrationKey(StringHelper.encrypt(regkey)) .withInstructorInstitution("Test Institute") .toAbsoluteString(); EmailWrapper email = new EmailGenerator() .generateNewInstructorAccountJoinEmail(instructorEmail, shortName, joinLink); String subject = String.format(EmailType.NEW_INSTRUCTOR_ACCOUNT.getSubject(), shortName); verifyEmail(email, instructorEmail, subject, "/instructorNewAccountEmail.html"); assertEquals(email.getBcc(), Config.SUPPORT_EMAIL); ______TS("instructor course join email"); CourseAttributes course = new CourseAttributes("course-id", "Course Name", "UTC"); email = new EmailGenerator().generateInstructorCourseJoinEmail(inviter, instructor, course); subject = String.format(EmailType.INSTRUCTOR_COURSE_JOIN.getSubject(), course.getName(), course.getId()); verifyEmail(email, instructor.email, subject, "/instructorCourseJoinEmail.html"); }
Source:
<code>void report(LeaderElectionStatistics statistics) { long count = statistics.getCount().longValue(); weightedGaugeMean.update(statistics.getMean(), count); weightedGaugeP95.update(statistics.getP95(), count); weightedGaugeP99.update(statistics.getP99(), count); <START> lastElectionTime.setValue( <END> statistics.getPerceivedTime().map(SafeLong::longValue).orElse(0L)); }</code><technical_language>set empty</technical_language>

Target:
void report(LeaderElectionStatistics statistics) { long count = statistics.getCount().longValue(); weightedGaugeMean.update(statistics.getMean(), count); weightedGaugeP95.update(statistics.getP95(), count); weightedGaugeP99.update(statistics.getP99(), count); leaderElectionEstimate.setValue( statistics.getDurationEstimate().map(SafeLong::longValue).orElse(0L)); }
Source:
<code>public SafeHtmlCell getCell() { return new SafeHtmlCell() { @Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb, String id) { if (value != null) { String divStyle = "display:table-cell;width:100%;padding:0px <START> 4px;vertical-align:middle;vertical-align:middle;"; <END> sb.append(AssetProvider.getTemplates().divWithStringStyle(divStyle, id, value)); } } }; }</code><technical_language>Appears twice:"vertical-align:middle;". Is intentional</technical_language>

Target:
public SafeHtmlCell getCell() { return new SafeHtmlCell() { @Override public void render(Context context, SafeHtml value, SafeHtmlBuilder sb, String id) { if (value != null) { String divStyle = "display:table-cell;width:100%;padding:0px 4px;vertical-align:middle;"; sb.append(AssetProvider.getTemplates().divWithStringStyle(divStyle, id, value)); } } }; }
Source:
<code>public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); requireActivity().setTitle(R.string.fui_title_register_email); <START> FragmentActivity activity = getActivity(); <END> mListener = (AnonymousUpgradeListener) activity; }</code><technical_language>tiny nit: reason need cast getActivity() directly</technical_language>

Target:
public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FragmentActivity activity = requireActivity(); activity.setTitle(R.string.fui_title_register_email); if (!(activity instanceof AnonymousUpgradeListener)) { throw new IllegalStateException("Activity must implement CheckEmailListener"); } mListener = (AnonymousUpgradeListener) activity; }
Source:
<code>public byte[] read(Path path, BiConsumer<Long, Long> progressConsumer) { FileWrapper wrapper = getPath(path); long size = wrapper.getFileProperties().size; if (wrapper.getFileProperties().isDirectory) { <START> return null; <END> } ProgressConsumer<Long> monitor = (readBytes) -> progressConsumer.accept(readBytes, size); AsyncReader in = wrapper.getInputStream(userContext.network, userContext.crypto, size, monitor).join(); return Serialize.readFully(in, size).join(); }</code><technical_language>This raise</technical_language>

Target:
public byte[] read(Path path, BiConsumer<Long, Long> progressConsumer) { FileWrapper wrapper = getPath(path); long size = wrapper.getFileProperties().size; ProgressConsumer<Long> monitor = (readBytes) -> progressConsumer.accept(readBytes, size); AsyncReader in = wrapper.getInputStream(userContext.network, userContext.crypto, size, monitor).join(); return Serialize.readFully(in, size).join(); }
Source:
<code>protected void configureDispatch() { bind(ClientActionHandlerRegistry.class).to(builder.clientActionHandlerRegistryType).asEagerSingleton(); bind(RpcDispatchCallFactory.class).to(DefaultRpcDispatchCallFactory.class).in(Singleton.class); <START> bind(DispatchAsync.class).to(getDispatchAsyncClass()).in(Singleton.class); <END> bind(RpcInterceptorRegistry.class).to(builder.getInterceptorRegistry()).in(Singleton.class); bind(RpcDispatchHooks.class).to(builder.getDispatchHooks()).in(Singleton.class); }</code><technical_language>For consistency, this Builder</technical_language>

Target:
protected void configureDispatch() { bind(ClientActionHandlerRegistry.class).to(builder.clientActionHandlerRegistryType).asEagerSingleton(); bind(RpcDispatchCallFactory.class).to(builder.getDispatchCallFactory()).in(Singleton.class); bind(DispatchAsync.class).to(builder.getDispatchAsync()).in(Singleton.class); bind(RpcInterceptorRegistry.class).to(builder.getInterceptorRegistry()).in(Singleton.class); bind(RpcDispatchHooks.class).to(builder.getDispatchHooks()).in(Singleton.class); }
Source:
<code>public void testExplainProc() throws IOException, ProcCallException { Client client = getClient(); VoltTable vt = null; vt = client.callProcedure("@ExplainProc", "T1.insert" ).getResults()[0]; while (vt.advanceRow()) { System.out.println(vt); String name = vt.getString(0); String sql = vt.getString(1); String plan = vt.getString(2); assertTrue( name.contains("sql0")); assertTrue( sql.contains( "INSERT INTO T1 VALUES (?, ?, ?)" )); assertTrue( plan.contains( "INSERT into \"T1\"" )); assertTrue( plan.contains( "MATERIALIZE TUPLE from parameters and/or literals" )); } vt = client.callProcedure("@ExplainProc", "CreateStoredProcedure").getResults()[0]; for (int i = 0; i < 2; i++) { vt.advanceRow(); String name = vt.getString(0); String task = vt.getString(1); String plan = vt.getString(2); if (i == 0) { assertEquals("insert", name); assertEquals("insert into t4 values(?);", task); <START> } else if (i == 1) { <END> assertEquals("select", name); assertEquals("select * from t4 where A>=?;", task); } if (i == 0) { assertTrue(plan.contains("RECEIVE FROM ALL PARTITIONS")); assertTrue(plan.contains("SEND PARTITION RESULTS TO COORDINATOR")); assertTrue(plan.contains("INSERT into \"T4\"")); assertTrue(plan.contains("MATERIALIZE TUPLE from parameters and/or literals")); } else if (i == 1) { assertTrue(plan.contains("RETURN RESULTS TO STORED PROCEDURE")); assertTrue(plan.contains("SEQUENTIAL SCAN of \"T4\"")); } } }</code><technical_language>else 0 1, case</technical_language>

Target:
public void testExplainProc() throws IOException, ProcCallException { Client client = getClient(); VoltTable vt = null; vt = client.callProcedure("@ExplainProc", "T1.insert" ).getResults()[0]; while (vt.advanceRow()) { System.out.println(vt); String name = vt.getString(0); String sql = vt.getString(1); String plan = vt.getString(2); assertEquals("sql0", name); assertEquals("INSERT INTO T1 VALUES (?, ?, ?);", sql); assertTrue(plan.contains("INSERT into \"T1\"")); assertTrue(plan.contains("MATERIALIZE TUPLE from parameters and/or literals")); } vt = client.callProcedure("@ExplainProc", "JavaProcedure").getResults()[0]; for (int i = 0; i < 2; i++) { vt.advanceRow(); String name = vt.getString(0); String task = vt.getString(1); String plan = vt.getString(2); if (i == 0) { assertEquals("insert", name); assertEquals("insert into t4 values(?);", task); assertTrue(plan.contains("RECEIVE FROM ALL PARTITIONS")); assertTrue(plan.contains("SEND PARTITION RESULTS TO COORDINATOR")); assertTrue(plan.contains("INSERT into \"T4\"")); assertTrue(plan.contains("MATERIALIZE TUPLE from parameters and/or literals")); } else { assertEquals("select", name); assertEquals("select * from t4 where A>=?;", task); assertTrue(plan.contains("RETURN RESULTS TO STORED PROCEDURE")); assertTrue(plan.contains("SEQUENTIAL SCAN of \"T4\"")); } } }
Source:
<code>public static String getDownloadUrl( final Path path, final String clientId ) { <START> return URLHelper.getServletUrl( clientId ) + "?" + FileManagerFields.FORM_FIELD_PATH + "=" + URL.encode( path.toURI() ); <END> }</code><technical_language>want remove ? adding getServletUrl(..) method too</technical_language>

Target:
public static String getDownloadUrl( final Path path, final String clientId ) { return URLHelper.getServletUrl( clientId ) + "&" + FileManagerFields.FORM_FIELD_PATH + "=" + URL.encode( path.toURI() ); }
Source:
<code>public void hook(ExtensionHook extensionHook) { extensionHook.addOptionsParamSet(getRuleConfigParam()); <START> extensionHook.getHookView().addOptionPanel(getOptionsRuleConfigPanel()); <END> API.getInstance().registerApiImplementor(new RuleConfigAPI(this)); }</code><technical_language>added if view</technical_language>

Target:
public void hook(ExtensionHook extensionHook) { extensionHook.addOptionsParamSet(getRuleConfigParam()); if (extensionHook.getView() != null) { extensionHook.getHookView().addOptionPanel(getOptionsRuleConfigPanel()); } API.getInstance().registerApiImplementor(new RuleConfigAPI(this)); }
Source:
<code>protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopGlusterVolumeProfile, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_PROFILE_STOP_FAILED, returnValue.getVdsError().getMessage()); <START> return; <END> } }</code><technical_language>return statement is redundant here</technical_language>

Target:
protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.StopGlusterVolumeProfile, new GlusterVolumeVDSParameters(upServer.getId(), getGlusterVolumeName())); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.GLUSTER_VOLUME_PROFILE_STOP_FAILED, returnValue.getVdsError().getMessage()); } }
Source:
<code>private int getClosingBracketStartOffset(int startOffset, boolean isCDATA) { int counter = startOffset + 1; while (startOffset < content.length()) { <START> if (content.charAt(counter) == '>' && (!isCDATA || content.charAt(counter - 1) == ']')) { <END> return counter; } counter++; } throw new IllegalStateException("No \">\" found."); }</code><technical_language>@vilchik-elena minor: this highlight correctly <![CDATA[ aa]>bb ]]></technical_language>

Target:
private int getClosingBracketStartOffset(int startOffset, boolean isCDATA) { int counter = startOffset + 1; while (startOffset < content.length()) { if (content.charAt(counter) == '>' && bracketsBefore(isCDATA, counter)) { return counter; } counter++; } throw new IllegalStateException("No \">\" found."); }
Source:
<code>private PlannerContext( final DruidOperatorTable operatorTable, final ExprMacroTable macroTable, final PlannerConfig plannerConfig, final DateTime localNow, final Map<String, Object> queryContext, final List<TypedValue> parameters, final AuthenticationResult authenticationResult ) { this.operatorTable = operatorTable; this.macroTable = macroTable; this.plannerConfig = Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.queryContext = queryContext != null ? new HashMap<>(queryContext) : new HashMap<>(); <START> this.parameters = parameters != null ? parameters : ImmutableList.of(); <END> this.localNow = Preconditions.checkNotNull(localNow, "localNow"); this.authenticationResult = Preconditions.checkNotNull(authenticationResult, "authenticationResult"); String sqlQueryId = (String) this.queryContext.get(CTX_SQL_QUERY_ID); if (Strings.isNullOrEmpty(sqlQueryId)) { sqlQueryId = UUID.randomUUID().toString(); } this.sqlQueryId = sqlQueryId; }</code><technical_language>Allowing null more difficult realize a code path forgot correctly set parameters. For example, in DruidStatement#execute(), sqlLifecycle.setParameters(parameters) needs called sqlLifecycle.planAndAuthorize(authenticationResult). assert null caller explicitly pass in empty parameter list if parameters relevant</technical_language>

Target:
private PlannerContext( final DruidOperatorTable operatorTable, final ExprMacroTable macroTable, final PlannerConfig plannerConfig, final DateTime localNow, final Map<String, Object> queryContext, final List<TypedValue> parameters, final AuthenticationResult authenticationResult ) { this.operatorTable = operatorTable; this.macroTable = macroTable; this.plannerConfig = Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.queryContext = queryContext != null ? new HashMap<>(queryContext) : new HashMap<>(); this.parameters = Preconditions.checkNotNull(parameters); this.localNow = Preconditions.checkNotNull(localNow, "localNow"); this.authenticationResult = Preconditions.checkNotNull(authenticationResult, "authenticationResult"); String sqlQueryId = (String) this.queryContext.get(CTX_SQL_QUERY_ID); if (Strings.isNullOrEmpty(sqlQueryId)) { sqlQueryId = UUID.randomUUID().toString(); } this.sqlQueryId = sqlQueryId; }
Source:
<code>protected boolean promptForInputChange(String requestPreviewMessage, IProgressMonitor monitor) { List<IResource> relevantResources = getRelevantResources(); boolean showPrompt = false; for (IResource resource : relevantResources) if (hasChanged(resource)) { showPrompt = true; break; <START> } <END> if(showPrompt) return super.promptForInputChange(requestPreviewMessage, monitor); return false; }</code><technical_language>please extract block a separate method, e.g. shouldShowPrompt? break return true</technical_language>

Target:
protected boolean promptForInputChange(String requestPreviewMessage, IProgressMonitor monitor) { List<IResource> relevantResources = getRelevantResources(); for (IResource resource : relevantResources) if (hasChanged(resource)) return super.promptForInputChange(requestPreviewMessage, monitor); return false; }
Source:
<code>public final I_C_Invoice creditInvoice(@NonNull final I_C_Invoice invoice, final InvoiceCreditContext creditCtx) { Check.errorIf(isCreditMemo(invoice), "Param 'invoice'={} may not be a credit memo"); Check.assume(invoice.getGrandTotal().signum() != 0, "GrandTotal!=0 for {}", invoice); <START> if (creditCtx.isCreditedInvoiceReinvoicable()) <END> { Check.errorIf(invoice.isPaid(), "Param 'invoice'={} may not yet be paid"); final BigDecimal openAmt = Services.get(IAllocationDAO.class).retrieveOpenAmt(invoice, false); Check.assume(openAmt.signum() != 0, "OpenAmt != zero for {}", invoice); } final Properties ctx = InterfaceWrapperHelper.getCtx(invoice); final DocTypeId targetDocTypeId = getTarget_DocType_ID(ctx, invoice, creditCtx.getDocTypeId()); final I_C_Invoice creditMemo = InterfaceWrapperHelper.create( copyFrom(invoice, SystemTime.asTimestamp(), targetDocTypeId.getRepoId(), invoice.isSOTrx(), false, creditCtx.isReferenceOriginalOrder(), creditCtx.isReferenceInvoice(), true, new CreditMemoInvoiceCopyHandler(creditCtx)), I_C_Invoice.class); return creditMemo; }</code><technical_language>this isCreditedInvoiceReinvoicable() referenceInvoice()</technical_language>

Target:
public final I_C_Invoice creditInvoice(@NonNull final I_C_Invoice invoice, final InvoiceCreditContext creditCtx) { Check.errorIf(isCreditMemo(invoice), "Param 'invoice'={} may not be a credit memo"); Check.assume(invoice.getGrandTotal().signum() != 0, "GrandTotal!=0 for {}", invoice); if (creditCtx.isReferenceInvoice()) { if (invoice.isPaid()) { throw new AdempiereException( MSG_InvoiceMayNotBePaid, new Object[] { invoice.getDocumentNo() }); } final BigDecimal openAmt = Services.get(IAllocationDAO.class).retrieveOpenAmt(invoice, false); if (openAmt.signum() == 0) { throw new AdempiereException( MSG_InvoiceMayNotHaveOpenAmtZero, new Object[] { invoice.getDocumentNo() }); } } final Properties ctx = InterfaceWrapperHelper.getCtx(invoice); final DocTypeId targetDocTypeId = getTarget_DocType_ID(ctx, invoice, creditCtx.getDocTypeId()); final I_C_Invoice creditMemo = InterfaceWrapperHelper.create( copyFrom(invoice, SystemTime.asTimestamp(), targetDocTypeId.getRepoId(), invoice.isSOTrx(), false, creditCtx.isReferenceOriginalOrder(), creditCtx.isReferenceInvoice(), true, new CreditMemoInvoiceCopyHandler(creditCtx)), I_C_Invoice.class); return creditMemo; }
Source:
<code>public double sumDouble(int columnIndex) { double result = 0; for (int i = 0; i < partitionCount; i++) { openPartition(i); final int base = getColumnBase(i); final int index = getPrimaryColumnIndex(base, columnIndex); final ReadOnlyColumn column = columns.getQuick(index); if (column != null) { for (int pageIndex = 0, pageCount = column.getPageCount(); pageIndex < pageCount; pageIndex++) { long a = column.getPageAddress(pageIndex); long count = column.getPageSize(pageIndex) / Double.BYTES; <START> result += Vect.sumDoubleNeumaier(a, count); <END> } } } return result; }</code><technical_language>roll this line commit C-level impls integrated SQL</technical_language>

Target:
public double sumDouble(int columnIndex) { double result = 0; for (int i = 0; i < partitionCount; i++) { openPartition(i); final int base = getColumnBase(i); final int index = getPrimaryColumnIndex(base, columnIndex); final ReadOnlyColumn column = columns.getQuick(index); if (column != null) { for (int pageIndex = 0, pageCount = column.getPageCount(); pageIndex < pageCount; pageIndex++) { long a = column.getPageAddress(pageIndex); long count = column.getPageSize(pageIndex) / Double.BYTES; result += Vect.sumDouble(a, count); } } } return result; }
Source:
<code><START> Boolean isHierhicalStateMachine() { <END> return hiearhical; }</code><technical_language>Typo, _isHierarchicalStateMachine_</technical_language>

Target:
Boolean isHierhicalStateMachine() { return hierarchical; }
Source:
<code>public List<IndirectCostRecoveryAccount> getActiveIndirectCostRecoveryAccounts() { <START> List<IndirectCostRecoveryAccount> activeList = new ArrayList(); <END> for (IndirectCostRecoveryAccount icr : getIndirectCostRecoveryAccounts()) { if (icr.isActive()) { activeList.add(IndirectCostRecoveryAccount.copyICRAccount(icr)); } } return activeList; }</code><technical_language>Diamond operator is missing this statement</technical_language>

Target:
public List<IndirectCostRecoveryAccount> getActiveIndirectCostRecoveryAccounts() { List<IndirectCostRecoveryAccount> activeList = new ArrayList<>(); for (IndirectCostRecoveryAccount icr : getIndirectCostRecoveryAccounts()) { if (icr.isActive()) { activeList.add(IndirectCostRecoveryAccount.copyICRAccount(icr)); } } return activeList; }
Source:
<code>public void endRequestMonitoring() { if (!ended) { ended = true; activeRequests.dec(); context.stop(); } else { <START> LOGGER.warn("Request already ended"); <END> } }</code><technical_language>a good idea add metric nameSpace this warn metric "double ended."</technical_language>

Target:
public void endRequestMonitoring() { if (!ended) { ended = true; activeRequests.dec(); context.stop(); } else { LOGGER.warn("Request already ended for :: " + metricNamespace); } }
Source:
<code>public <T extends Resource> T getResource(String href, Class<T> clazz, Map<String, Object> queryParameters) { Assert.hasText(href, "href argument cannot be null or empty."); <START> Assert.notNull(clazz, "Resource class argument cannot be null."); <END> SanitizedQuery sanitized = QuerySanitizer.sanitize(href, queryParameters); return getResource(sanitized.getHrefWithoutQuery(), clazz, sanitized.getQuery()); }</code><technical_language>Assert.notNull(clazz, "clazz argument null.");</technical_language>

Target:
public <T extends Resource> T getResource(String href, Class<T> clazz, Map<String, Object> queryParameters) { ResourceDataResult result = getResourceData(href, clazz, queryParameters); return instantiate(clazz, result.getData(), result.getUri().getQuery()); }
Source:
<code>private void setupHistory() throws IOException { if (this.history != null) { return; } this.history = new FileHistory(new File(getOpts().getHistoryFile())); ShutdownHookManager.addShutdownHook(new Runnable() { @Override public void run() { try { history.flush(); } catch (IOException e) { error(e); <START> } finally { <END> close(); } } }); }</code><technical_language>This shutdown hook is added part of setupHistory method, for close is clean. create a separate function for adding shutdown hook</technical_language>

Target:
private void setupHistory() throws IOException { if (this.history != null) { return; } this.history = new FileHistory(new File(getOpts().getHistoryFile())); }
Source:
<code>public synchronized List<Sample<T>> finishSampling(int count) { <START> List<Sample<T>> results = Collections.EMPTY_LIST; <END> if (enabled) { enabled = false; results = summary.topK(count) .stream() .map(c -> new Sample<T>(c.getItem(), c.getCount(), c.getError())) .collect(Collectors.toList()); } return results; }</code><technical_language>Collections.emptyList() is safer</technical_language>

Target:
public synchronized List<Sample<T>> finishSampling(int count) { List<Sample<T>> results = Collections.emptyList(); if (endTimeMillis != -1) { endTimeMillis = -1; results = summary.topK(count) .stream() .map(c -> new Sample<T>(c.getItem(), c.getCount(), c.getError())) .collect(Collectors.toList()); } return results; }
Source:
<code>public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()); for(Map.Entry<String,String> tag : tags.entrySet()) { batchPointsBuilder.tag(tag.getKey(),tag.getValue()); } BatchPoints batchPoints = batchPointsBuilder.consistency(writeConsistency).build(); for (Result result : results) { log.debug("Query result: {}", result); Map<String, Object> resultValues = result.getValues(); HashMap<String, Object> filteredValues = newHashMap(); for (Map.Entry<String, Object> values : resultValues.entrySet()) { Object value = values.getValue(); if (isValidNumber(value)) { String key; if(typeNamesAsTags) { key = KeyUtils.getPrefixedKeyString(query, result, values, Collections.<String>emptyList(), values.getKey()); } else { key = KeyUtils.getPrefixedKeyString(query, result, values, typeNames, values.getKey()); <START> } <END> filteredValues.put(key, value); } } if (!filteredValues.isEmpty()) { filteredValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); log.debug("Point: {}", point); batchPoints.point(point); } } influxDB.write(batchPoints); }</code><technical_language>typeNames = typeNameAsTags ? typeNames : Collections.<String>emptyList(); key = KeyUtils.getPrefixedKeyString(query, result, values, typeNames, values.getKey());</technical_language>

Target:
public void doWrite(Server server, Query query, Iterable<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints.Builder batchPointsBuilder = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()); for(Map.Entry<String,String> tag : tags.entrySet()) { batchPointsBuilder.tag(tag.getKey(),tag.getValue()); } BatchPoints batchPoints = batchPointsBuilder.consistency(writeConsistency).build(); for (Result result : results) { log.debug("Query result: {}", result); Map<String, Object> resultValues = result.getValues(); HashMap<String, Object> filteredValues = newHashMap(); for (Map.Entry<String, Object> values : resultValues.entrySet()) { Object value = values.getValue(); if (isValidNumber(value)) { typeNames = typeNamesAsTags ? typeNames : Collections.<String>emptyList(); String key = KeyUtils.getPrefixedKeyString(query, result, values, typeNames, values.getKey()); filteredValues.put(key, value); } } if (!filteredValues.isEmpty()) { filteredValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); log.debug("Point: {}", point); batchPoints.point(point); } } influxDB.write(batchPoints); }
Source:
<code>public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) <START> || AccountTransaction.Type.TAX_REFUND.equals(accountTransaction.getType()) <END> || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.TAX_REFUND); else if (AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.TAXES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.TAXES); else throw new IllegalArgumentException(); client.markDirty(); }</code><technical_language>TAX_REFUND TAX_REFUND</technical_language>

Target:
public void run() { AccountTransaction accountTransaction = transaction.getTransaction(); if (AccountTransaction.Type.DEPOSIT.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES_REFUND.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.TAX_REFUND); else if (AccountTransaction.Type.REMOVAL.equals(accountTransaction.getType()) || AccountTransaction.Type.FEES.equals(accountTransaction.getType()) || AccountTransaction.Type.INTEREST_CHARGE.equals(accountTransaction.getType())) accountTransaction.setType(AccountTransaction.Type.TAXES); else throw new IllegalArgumentException(); client.markDirty(); }
Source:
<code>private void execute(String signature, SquidClassLoader classLoader) { BytecodeCFGMethodVisitor cfgVisitor = new BytecodeCFGMethodVisitor(); MethodLookup lookup = MethodLookup.lookup(signature, classLoader, cfgVisitor); if (lookup == null) { <START> LOG.debug("Method lookup failed for %s", signature); <END> return; } methodBehavior.setDeclaredExceptions(lookup.declaredExceptions); methodBehavior.setVarArgs(lookup.isVarArgs); BytecodeCFG bytecodeCFG = cfgVisitor.getCfg(); if (bytecodeCFG == null || methodIsBlacklisted(signature)) { return; } steps = 0; for (ProgramState startingState : startingStates(signature, ProgramState.EMPTY_STATE, lookup.isStatic)) { enqueue(new ProgramPoint(bytecodeCFG.entry()), startingState); } while (!workList.isEmpty()) { steps++; if (steps > maxSteps()) { throw new ExplodedGraphWalker.MaximumStepsReachedException("Too many steps resolving "+methodBehavior.signature()); } setNode(workList.removeFirst()); if (programPosition.block.successors().isEmpty()) { endOfExecutionPath.add(node); continue; } if (programPosition.i < programPosition.block.elements().size()) { executeInstruction((Instruction) programPosition.block.elements().get(programPosition.i)); } else { handleBlockExit(programPosition); } } handleEndOfExecutionPath(); executeCheckEndOfExecution(); methodBehavior.completed(); workList = null; node = null; programState = null; constraintManager = null; }</code><technical_language>Message is confusing : method is harmless analysis, I word fail in this kind of message</technical_language>

Target:
private void execute(String signature, SquidClassLoader classLoader) { BytecodeCFGMethodVisitor cfgVisitor = new BytecodeCFGMethodVisitor(); MethodLookup lookup = MethodLookup.lookup(signature, classLoader, cfgVisitor); if (lookup == null) { LOG.debug("Method body not found: %s", signature); return; } methodBehavior.setDeclaredExceptions(lookup.declaredExceptions); methodBehavior.setVarArgs(lookup.isVarArgs); BytecodeCFG bytecodeCFG = cfgVisitor.getCfg(); if (bytecodeCFG == null) { return; } steps = 0; for (ProgramState startingState : startingStates(signature, ProgramState.EMPTY_STATE, lookup.isStatic)) { enqueue(new ProgramPoint(bytecodeCFG.entry()), startingState); } while (!workList.isEmpty()) { steps++; if (steps > maxSteps()) { throw new ExplodedGraphWalker.MaximumStepsReachedException("Too many steps resolving "+methodBehavior.signature()); } setNode(workList.removeFirst()); if (programPosition.block.successors().isEmpty()) { endOfExecutionPath.add(node); continue; } if (programPosition.i < programPosition.block.elements().size()) { executeInstruction((Instruction) programPosition.block.elements().get(programPosition.i)); } else { handleBlockExit(programPosition); } } handleEndOfExecutionPath(); executeCheckEndOfExecution(); methodBehavior.completed(); workList = null; node = null; programState = null; constraintManager = null; }
Source:
<code>public List<String> getUserRoles(String userName) { LOGGER.debug("Invoking LightblueLdapRoleProvider#getUserRoles"); List<String> userRoles = new ArrayList<>(); try { List<String> userRolesFromCache = getUserRolesFromCache(userName); <START> if( userRolesFromCache != null && userRolesFromCache.isEmpty() ) { <END> userRoles.addAll(userRolesFromCache); } if (userRoles.isEmpty()) { SearchResult searchResult = new LdapFindUserByUidCommand(ldapContext, ldapSearchBase, userName).execute(); userRoles.addAll(getUserRolesFromLdap(searchResult)); } } catch (NamingException ne) { LOGGER.error("Naming problem with LDAP for user: " + userName, ne); } catch (HystrixRuntimeException ce) { LOGGER.error("Not found in cache, returns an empty list " + userName, ce); } return userRoles; }</code><technical_language>Condition !userRolesFromCache.isEmpty() (missing !)</technical_language>

Target:
public List<String> getUserRoles(String userName) { LOGGER.debug("Invoking LightblueLdapRoleProvider#getUserRoles"); List<String> userRoles = new ArrayList<>(); try { List<String> userRolesFromCache = getUserRolesFromCache(userName); if( userRolesFromCache != null && !userRolesFromCache.isEmpty() ) { userRoles.addAll(userRolesFromCache); } if (userRoles.isEmpty()) { SearchResult searchResult = new LdapFindUserByUidCommand(ldapContext, ldapSearchBase, userName).execute(); userRoles.addAll(getUserRolesFromLdap(searchResult)); } } catch (NamingException ne) { LOGGER.error("Naming problem with LDAP for user: " + userName, ne); } catch (HystrixRuntimeException ce) { LOGGER.error("Not found in cache, returns an empty list " + userName, ce); } return userRoles; }