auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void testIntersectsOnGeometryCollection() { <END> OGCGeometry ogcGeometry = OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("POINT (1 1)"))); }</code><technical_language>I modified test ensure if intersects is symmetrical test failed NPE: @Test public void testIntersectsOnGeometryCollection() { assertIntersects("GEOMETRYCOLLECTION (POINT (1 1))", "POINT (1 1)", true); } private void assertIntersects(String wkt, String otherWkt, boolean intersects) { assertEquals(OGCGeometry.fromText(wkt).intersects(OGCGeometry.fromText(otherWkt)), intersects); assertEquals(OGCGeometry.fromText(otherWkt).intersects(OGCGeometry.fromText(wkt)), intersects); } is failure: java.lang.NullPointerException com.esri.core.geometry.RelationalOperations.relate(RelationalOperations.java:45) com.esri.core.geometry.OperatorDisjointLocal.execute(OperatorDisjointLocal.java:31) com.esri.core.geometry.GeometryEngine.disjoint(GeometryEngine.java:376) com.esri.core.geometry.ogc.OGCGeometry.disjoint(OGCGeometry.java:275) com.esri.core.geometry.ogc.OGCGeometry.intersects(OGCGeometry.java:280) com.esri.core.geometry.TestOGC.assertIntersects(TestOGC.java:1007) com.esri.core.geometry.TestOGC.testIntersectsOnGeometryCollection(TestOGC.java:1001)</technical_language>

Target:
public void testIntersectsOnGeometryCollection() { OGCGeometry ogcGeometry = OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("POINT (1 1)"))); ogcGeometry = OGCGeometry.fromText("POINT (1 1)"); assertTrue(ogcGeometry.intersects(OGCGeometry.fromText("GEOMETRYCOLLECTION (POINT (1 1))"))); }
Source:
<code>private void returnLocation() { if (location != null && (location.getLatitude() == 0d && location.getLongitude() == 0d && location.getAccuracy() == 0d)) { Toast.makeText( this, StringUtils.getStringRobust(CommCareApplication.instance(), R.string.wait_for_location_fix), Toast.LENGTH_LONG).show(); } else { Intent i = new Intent(); <START> i.putExtra(FormEntryConstants.LOCATION_RESULT, GeoUtils.locationToString(location)); <END> setResult(RESULT_OK, i); finish(); } }</code><technical_language>if location is null</technical_language>

Target:
private void returnLocation() { if (location == null || (location.getLatitude() == 0d && location.getLongitude() == 0d && location.getAccuracy() == 0d)) { Toast.makeText( this, StringUtils.getStringRobust(CommCareApplication.instance(), R.string.wait_for_location_fix), Toast.LENGTH_LONG).show(); } else { Intent i = new Intent(); i.putExtra(FormEntryConstants.LOCATION_RESULT, GeoUtils.locationToString(location)); setResult(RESULT_OK, i); finish(); } }
Source:
<code>ChecksumResult(long rowCount, Map<String, Object> checksums) { for (Object checksum : checksums.values()) { checkArgument( checksum == null || checksum instanceof Long || checksum instanceof Double || checksum instanceof SqlVarbinary, "checksum can only be one of (null, Long, Double, SqlVarbinary), found %s", checksum == null ? "null" : checksum.getClass().getName()); } this.rowCount = rowCount; <START> this.checksums = unmodifiableMap(requireNonNull(checksums, "checksums is null")); <END> }</code><technical_language>requireNonNull(checksums) top accessed in checksum.values()</technical_language>

Target:
ChecksumResult(long rowCount, Map<String, Object> checksums) { this.rowCount = rowCount; this.checksums = unmodifiableMap(requireNonNull(checksums, "checksums is null")); for (Object checksum : checksums.values()) { checkArgument( checksum == null || checksum instanceof Long || checksum instanceof Double || checksum instanceof SqlVarbinary, "checksum can only be one of (null, Long, Double, SqlVarbinary), found %s", checksum == null ? "null" : checksum.getClass().getName()); } }
Source:
<code>public final void testValidOnlyInterAndRootCert(){ X509Certificate certToCheck = getTestCert("/entrust_intermediate_old.cer"); <START> Assert.assertTrue("Our truststore should this chain of trust",certValidator.validateCert(certToCheck)); <END> }</code><technical_language>Need more meaningful message</technical_language>

Target:
public final void testValidOnlyInterAndRootCert() { X509Certificate certToCheck = getTestCert("/entrust_intermediate_old.cer"); Assert.assertTrue("Our truststore should contain only intermediate and root cert", certValidator.validateCert(certToCheck)); }
Source:
<code>boolean delayNextTimeToRun(Date timeToRunTheVm) { this.timeToRunTheVm = timeToRunTheVm; <START> return ++numOfSkips < MAXIMUM_NUM_OF_SKIPS_BEFORE_AUTO_START_VM; <END> }</code><technical_language>do like: numOfSkips = ++numOfSkips % MAXIMUM_NUM_OF_SKIPS_BEFORE_AUTO_START_VM; return numOfSkips == 0; remove clearSkipCounter, no? if this properly verified, merge this change master-only</technical_language>

Target:
boolean delayNextTimeToRun(Date timeToRunTheVm) { this.timeToRunTheVm = timeToRunTheVm; numOfSkips = ++numOfSkips % MAXIMUM_NUM_OF_SKIPS_BEFORE_AUTO_START_VM; return numOfSkips != 0; }
Source:
<code>public void testCreate() throws StripeException { Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1); params.put("currency", "usd"); params.put("id", "sapphire-elite"); params.put("interval", "month"); params.put("name", "Sapphire Elite"); <START> Plan plan = Plan.create(params); <END> assertNotNull(plan); verifyRequest( APIResource.RequestMethod.POST, "/v1/plans", params ); }</code><technical_language>called resource</technical_language>

Target:
public void testCreate() throws StripeException { final Map<String, Object> params = new HashMap<String, Object>(); params.put("amount", 1); params.put("currency", "usd"); params.put("id", "sapphire-elite"); params.put("interval", "month"); params.put("name", "Sapphire Elite"); final Plan plan = Plan.create(params); assertNotNull(plan); verifyRequest( APIResource.RequestMethod.POST, "/v1/plans", params ); }
Source:
<code>public void checkResourceIsCloseable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); try(JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "default", "foobared", 2)){ <START> Jedis jedis = pool.getResource(); try { jedis.set("hello", "jedis"); } finally { jedis.close(); } <END> try (Jedis jedis2 = pool.getResource()){ assertEquals(jedis, jedis2); } } }</code><technical_language>try-with-resource</technical_language>

Target:
public void checkResourceIsCloseable() { GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxTotal(1); config.setBlockWhenExhausted(false); try(JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels, config, 1000, "default", "foobared", 2)){ Jedis jedis; try (Jedis jedis1 = pool.getResource()){ jedis = jedis1; jedis1.set("hello", "jedis"); } try (Jedis jedis2 = pool.getResource()){ assertEquals(jedis, jedis2); } } }
Source:
<code>private void throwLoot(SolGame game, SolItem item, boolean onDeath) { Vector2 lootVelocity = new Vector2(); <START> float speedAngle; <END> float speed; Vector2 position = new Vector2(); if (onDeath) { speedAngle = SolRandom.randomFloat(180); speed = SolRandom.randomFloat(0, Loot.MAX_SPD); SolMath.fromAl(position, speedAngle, SolRandom.randomFloat(myHull.config.getApproxRadius())); } else { speedAngle = getAngle(); speed = 1f; SolMath.fromAl(position, speedAngle, myHull.config.getApproxRadius()); } SolMath.fromAl(lootVelocity, speedAngle, speed); lootVelocity.add(myHull.getVelocity()); position.add(myHull.getPosition()); Loot l = game.getLootBuilder().build(game, position, item, lootVelocity, Loot.MAX_LIFE, SolRandom.randomFloat(Loot.MAX_ROT_SPD), this); game.getObjectManager().addObjDelayed(l); if (!onDeath) { game.getSoundManager().play(game, game.getSpecialSounds().lootThrow, position, this); } }</code><technical_language>velocityAngle? for speedAngle in other files, in case I missed it</technical_language>

Target:
private void throwLoot(SolGame game, SolItem item, boolean onDeath) { Vector2 lootVelocity = new Vector2(); float velocityAngle; float speed; Vector2 position = new Vector2(); if (onDeath) { velocityAngle = SolRandom.randomFloat(180); speed = SolRandom.randomFloat(0, Loot.MAX_SPD); SolMath.fromAl(position, velocityAngle, SolRandom.randomFloat(myHull.config.getApproxRadius())); } else { velocityAngle = getAngle(); speed = 1f; SolMath.fromAl(position, velocityAngle, myHull.config.getApproxRadius()); } SolMath.fromAl(lootVelocity, velocityAngle, speed); lootVelocity.add(myHull.getVelocity()); position.add(myHull.getPosition()); Loot l = game.getLootBuilder().build(game, position, item, lootVelocity, Loot.MAX_LIFE, SolRandom.randomFloat(Loot.MAX_ROT_SPD), this); game.getObjectManager().addObjDelayed(l); if (!onDeath) { game.getSoundManager().play(game, game.getSpecialSounds().lootThrow, position, this); } }
Source:
<code>public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { String uri = environment.getProperty("sample.jwk-set-uri", "mock://localhost:0"); if (uri.startsWith("mock://")) { try { this.server.start(new URI(uri).getPort()); <START> } catch (IOException | URISyntaxException e ) { <END> throw new IllegalStateException(e); } Map<String, Object> properties = new HashMap<>(); String url = this.server.url("/.well-known/jwks.json").toString(); properties.put("sample.jwk-set-uri", url); MapPropertySource propertySource = new MapPropertySource("mock", properties); environment.getPropertySources().addFirst(propertySource); } }</code><technical_language>URI.create avoid needing handle URISyntaxException</technical_language>

Target:
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { String uri = environment.getProperty("sample.jwk-set-uri", "mock://localhost:0"); if (uri.startsWith("mock://")) { try { this.server.start(URI.create(uri).getPort()); } catch (IOException e) { throw new IllegalStateException(e); } Map<String, Object> properties = new HashMap<>(); String url = this.server.url("/.well-known/jwks.json").toString(); properties.put("sample.jwk-set-uri", url); MapPropertySource propertySource = new MapPropertySource("mock", properties); environment.getPropertySources().addFirst(propertySource); } }
Source:
<code>protected PrintWriter createWriter(String outdir) throws IOException { new File(outdir).mkdirs(); String jvmArg = System.getProperty(JVM_ARG); if ((jvmArg != null) && (!jvmArg.trim().isEmpty())) { fileName = jvmArg; } <START> <END> return new PrintWriter(new BufferedWriter(new FileWriter(new File(outdir, fileName)))); }</code><technical_language>default if filename is null here</technical_language>

Target:
protected PrintWriter createWriter(String outdir) throws IOException { new File(outdir).mkdirs(); String jvmArg = System.getProperty(JVM_ARG); if (jvmArg != null && !jvmArg.trim().isEmpty()) { fileName = jvmArg; } return new PrintWriter(new BufferedWriter(new FileWriter(new File(outdir, fileName)))); }
Source:
<code>public void testAMeetingCanBeDeleted() { HomeTabletPage homePage = new HomeTabletPage(); <START> SchedulePage schedulePage = homePage <END> .clickScheduleBtn() .clickOverMeetingCreated(subject) .clickRemoveBtn() .confirmCredentials(password); Assert.assertTrue(schedulePage.isMessageMeetingDeletedDisplayed()); }</code><technical_language>variable homepage is wrong homeTablePage ...team convection review in Tcs</technical_language>

Target:
public void testAMeetingCanBeDeleted() { HomeTabletPage homeTabletPage = new HomeTabletPage(); SchedulePage schedulePage = homeTabletPage .clickScheduleBtn() .clickOverMeetingCreated(subject) .clickRemoveBtn() .confirmCredentials(password); Assert.assertTrue(schedulePage.isMessageMeetingDeletedDisplayed()); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpFields(); setUpListener(); Boolean addToClaim = getIntent().getBooleanExtra(ADD_TO_CLAIM, false); <START> if(addToClaim) { <END> User user = (User)getIntent().getSerializableExtra(EXTRA_USER); location = user.getLocation(); addLocationField.setText(location.getName() + "\n" + location.getAddress()); } }</code><technical_language>Space if</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setUpFields(); setUpListener(); boolean addToClaim = getIntent().getBooleanExtra(ADD_TO_CLAIM, false); if (addToClaim) { User user = (User)getIntent().getSerializableExtra(EXTRA_USER); location = user.getLocation(); addLocationField.setText(location.getName() + "\n" + location.getAddress()); } }
Source:
<code>public void testGetSubscriptionCursors() throws IOException { final EventType eventType = createEventType(); final Subscription subscription = createSubscription(eventType); commitCursors(subscription); <START> List<Cursor> actualCursors = getSubscriptionCursors(subscription); <END> Assert.assertEquals(Arrays.asList(new Cursor("0", "25")), actualCursors); }</code><technical_language>I this list final. managed pass stylecheck</technical_language>

Target:
public void testGetSubscriptionCursors() throws IOException { final EventType eventType = createEventType(); final Subscription subscription = createSubscription(eventType); commitCursors(subscription, "[{\"partition\":\"0\",\"offset\":\"25\"}]") .then() .statusCode(HttpStatus.SC_OK); final List<Cursor> actualCursors = getSubscriptionCursors(subscription); Assert.assertEquals(Arrays.asList(new Cursor("0", "25")), actualCursors); }
Source:
<code>public void taskRun() { try { if (myServerName != null && (myServerName.startsWith("http:") || myServerName.startsWith("https:") || myServerName.startsWith("ftp:"))) { httpTaskRun(); } else if (remoteUIXfer) { remoteUITaskRun(); } <START> if (myServerName!=null && myServerName.startsWith("file:")) <END> { fileTaskRun(); } else { stvTaskRun(); } if (Sage.DBG) System.out.println("Download completed for files server=" + myServerName + " src=" + mySrcFile + " dest=" + myDestFile + " abort=" + abort); } finally { cleanup(); if (uiMgrWeak == null) { resultMap.put(myDestFile, wasSuccessful() ? (Object)Boolean.TRUE : (Object)("Error: " + getStatusMessage())); } synchronized (fileMap) { fileMap.remove(myDestFile); } } }</code><technical_language>This 'else if'</technical_language>

Target:
public void taskRun() { try { if (myServerName != null && (myServerName.startsWith("http:") || myServerName.startsWith("https:") || myServerName.startsWith("ftp:"))) { httpTaskRun(); } else if (remoteUIXfer) { remoteUITaskRun(); } else if (myServerName!=null && myServerName.startsWith("file:")) { fileTaskRun(); } else { stvTaskRun(); } if (Sage.DBG) System.out.println("Download completed for files server=" + myServerName + " src=" + mySrcFile + " dest=" + myDestFile + " abort=" + abort); } finally { cleanup(); if (uiMgrWeak == null) { resultMap.put(myDestFile, wasSuccessful() ? (Object)Boolean.TRUE : (Object)("Error: " + getStatusMessage())); } synchronized (fileMap) { fileMap.remove(myDestFile); } } }
Source:
<code>public void shouldNotIncludeAccountIdsInQueryMapForEmptyString() { var params = new GatewayAccountSearchParams(); params.setAccountIds(new CommaDelimitedSetParameter("")); Map<String, Object> queryMap = params.getQueryMap(); <START> assertThat(queryMap, IsMapWithSize.anEmptyMap()); <END> }</code><technical_language>static import</technical_language>

Target:
public void shouldNotIncludeAccountIdsInQueryMapForEmptyString() { var params = new GatewayAccountSearchParams(); params.setAccountIds(new CommaDelimitedSetParameter("")); Map<String, Object> queryMap = params.getQueryMap(); assertThat(queryMap, anEmptyMap()); }
Source:
<code>public int read(final char[] chr, final int st, final int end) throws IOException { final int n = super.read(chr, st, end); if (n != -1) { <START> branch.write(chr, st, n); <END> } return n; }</code><technical_language>EOF in test</technical_language>

Target:
public int read(final char[] chr, final int st, final int end) throws IOException { final int n = super.read(chr, st, end); if (n != EOF) { branch.write(chr, st, n); } return n; }
Source:
<code>public void testRibbonRequest() throws URISyntaxException { String urlWithEncodedJson = "<LINK_0>"; URI uri = new URI(urlWithEncodedJson); Map<String, Collection<String>> headers = new HashMap<String, Collection<String>>(); Request requestOrign = Request.create("GET", uri.toASCIIString(), headers, null, Charset.forName("utf-8")); RibbonRequest ribbonRequest = new RibbonRequest(null, requestOrign, uri); Request requestGetFormToRequest = ribbonRequest.toRequest(); assertEquals(requestOrign.method(), requestGetFormToRequest.method()); assertEquals(requestOrign.url(), requestGetFormToRequest.url()); assertEquals(urlWithEncodedJson, requestGetFormToRequest.url()); assertEquals(requestOrign.body(), requestGetFormToRequest.body()); assertEquals(requestOrign.charset(), requestGetFormToRequest.charset()); assertNotNull(requestOrign.headers()); assertEquals(0, requestOrign.headers().size()); <START> assertNotNull(requestGetFormToRequest.headers()); END> Map<String, Collection<String>> headersFromNewRequest = requestGetFormToRequest.headers(); assertNotNull(headersFromNewRequest); assertEquals(1, headersFromNewRequest.size()); assertTrue(headersFromNewRequest.containsKey("Content-Length")); Collection<String> contentLengthValues = headersFromNewRequest.get("Content-Length"); assertNotNull(contentLengthValues); assertEquals(1, contentLengthValues.size()); assertEquals("0", contentLengthValues.iterator().next()); }</code><technical_language>avoid checks duplicated constructor (I this is null)</technical_language>

Target:
public void testRibbonRequest() throws URISyntaxException { String urlWithEncodedJson = "<LINK_0>"; String method = "GET"; URI uri = new URI(urlWithEncodedJson); Map<String, Collection<String>> headers = new LinkedHashMap<String, Collection<String>>(); Request requestOrigin = Request.create(method, uri.toASCIIString(), headers, null, Charset.forName("utf-8")); RibbonRequest ribbonRequest = new RibbonRequest(null, requestOrigin, uri); Request requestRecreate = ribbonRequest.toRequest(); assertThat(requestOrigin.toString()).isEqualTo(String.format("%s %s HTTP/1.1\n", method, urlWithEncodedJson)); assertThat(requestRecreate.toString()).isEqualTo(String.format("%s %s HTTP/1.1\nContent-Length: 0\n", method, urlWithEncodedJson)); }
Source:
<code>public String toString() { StringBuilder buf = new StringBuilder(30); buf.append(getChronology().toString()) .append(' ') .append(getEra()) .append(' ') .append(getYearOfEra()); <START> if (isLeapDay()) { <END> buf.append("-leap-day"); } else if (isYearDay()) { buf.append("-year-day"); } else { buf.append(getMonth() < 10 ? "-0" : '-') .append(getMonth()) .append(getDayOfMonth() < 10 ? "-0" : '-') .append(getDayOfMonth()); } return buf.toString(); }</code><technical_language>I I prefer spaces "leap-day" "year-day", important. Wikipedia words capitalized (and hyphen "Day", either), want check some of original references</technical_language>

Target:
public String toString() { StringBuilder buf = new StringBuilder(30); return buf.append(getChronology().toString()) .append(' ') .append(getEra()) .append(' ') .append(getYearOfEra()) .append(this.month < 10 && this.month > 0 ? "/0" : '/') .append(this.month) .append(this.day < 10 && this.day > 0 ? "/0" : '/') .append(this.day) .toString(); }
Source:
<code>private void updateSkipNum() { numSkipLines -= NUM_ROWS_TO_EXPAND; <START> skipNum.setText(PatchUtil.C.patchSkipRegion(Integer <END> .toString(numSkipLines))); checkAndUpdateArrows(); }</code><technical_language>PatchUtil.M</technical_language>

Target:
private void updateSkipNum() { numSkipLines -= NUM_ROWS_TO_EXPAND; skipNum.setText(PatchUtil.M.patchSkipRegion(Integer .toString(numSkipLines))); checkAndUpdateArrows(); }
Source:
<code>public void verifyViewAndViewIndexes() throws Exception { String tableName = generateUniqueName(); String schemaName = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); if (multiTenant) { tenantId = generateUniqueName(); props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId); } try (Connection conn = DriverManager.getConnection(getUrl(), props)) { prepareForTest(conn, schemaName, tableName); String viewQuery = IndexUpgradeTool.getViewSql(tableName, schemaName); ResultSet rs = conn.createStatement().executeQuery(viewQuery); int countViews = 0; List<String> views = new ArrayList<>(); List<String> tenants = new ArrayList<>(); while (rs.next()) { views.add(rs.getString(1)); if(multiTenant) { Assert.assertNotNull(rs.getString(2)); } <START> tenants.add(rs.getString(2)); <END> countViews++; } Assert.assertEquals("view count in system table doesn't match", 2, countViews); for (int i = 0; i < views.size(); i++) { String viewName = SchemaUtil.getTableNameFromFullName(views.get(i)); String viewIndexQuery = IndexUpgradeTool.getViewIndexesSql(viewName, schemaName, tenants.get(i)); rs = conn.createStatement().executeQuery(viewIndexQuery); int indexes = 0; while (rs.next()) { indexes++; } Assert.assertEquals(VERIFY_COUNT_ASSERT_MESSAGE, 2-i, indexes); } } }</code><technical_language>this adding null for multiTenant=false</technical_language>

Target:
public void verifyViewAndViewIndexes() throws Exception { String tableName = generateUniqueName(); String schemaName = generateUniqueName(); Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); if (multiTenant) { tenantId = generateUniqueName(); props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantId); } try (Connection conn = DriverManager.getConnection(getUrl(), props)) { prepareForTest(conn, schemaName, tableName); String viewQuery = IndexUpgradeTool.getViewSql(tableName, schemaName); ResultSet rs = conn.createStatement().executeQuery(viewQuery); List<String> views = new ArrayList<>(); List<String> tenants = new ArrayList<>(); while (rs.next()) { views.add(rs.getString(1)); if(multiTenant) { Assert.assertNotNull(rs.getString(2)); } tenants.add(rs.getString(2)); } Assert.assertEquals("view count in system table doesn't match", 2, views.size()); for (int i = 0; i < views.size(); i++) { String viewName = SchemaUtil.getTableNameFromFullName(views.get(i)); String viewIndexQuery = IndexUpgradeTool.getViewIndexesSql(viewName, schemaName, tenants.get(i)); rs = conn.createStatement().executeQuery(viewIndexQuery); int indexes = 0; while (rs.next()) { indexes++; } Assert.assertEquals(VERIFY_COUNT_ASSERT_MESSAGE, 2-i, indexes); } } }
Source:
<code>public void saveRejectedVillageHealthSubFacility(VillageHealthSubFacilityImportRejection villageHealthSubFacilityImportRejection) { <START> if( villageHealthSubFacilityRejectionDataService.findByUniqueCode(villageHealthSubFacilityImportRejection.getVillageCode(),villageHealthSubFacilityImportRejection.getHealthSubFacilityCode()) == null){ <END> villageHealthSubFacilityRejectionDataService.create(villageHealthSubFacilityImportRejection); } else { villageHealthSubFacilityRejectionDataService.update(villageHealthSubFacilityImportRejection); } }</code><technical_language>this call if clause check if output is null not.. Do in other places</technical_language>

Target:
public void saveRejectedVillageHealthSubFacility(VillageHealthSubFacilityImportRejection villageHealthSubFacilityImportRejection) { VillageHealthSubFacilityImportRejection villageHealthSubFacilityImportRejection1 = villageHealthSubFacilityRejectionDataService.findByUniqueCode(villageHealthSubFacilityImportRejection.getVillageCode(),villageHealthSubFacilityImportRejection.getHealthSubFacilityCode()); if( villageHealthSubFacilityImportRejection1 == null){ villageHealthSubFacilityRejectionDataService.create(villageHealthSubFacilityImportRejection); } else { villageHealthSubFacilityRejectionDataService.update(villageHealthSubFacilityImportRejection); } }
Source:
<code><START> public void dimExtractionScanAndAggregate( <END> TopNQuery query, LongColumnSelector selector, Cursor cursor, Aggregator[][] rowSelector, Long2ObjectMap<Aggregator[]> aggregatesStore ) { long key = selector.get(); Aggregator[] theAggregators = aggregatesStore.get(key); if (theAggregators == null) { theAggregators = BaseTopNAlgorithm.makeAggregators(cursor, query.getAggregatorSpecs()); aggregatesStore.put(key, theAggregators); } for (Aggregator aggregator : theAggregators) { aggregator.aggregate(); } }</code><technical_language>In DimExtractionTopNAlgorithm, if pull cursor iteration dimExtractionScanAndAggregate methods, reduce virtual call overhead. instead of: java while (!cursor.isDone()) { selectorPlus.getColumnSelectorStrategy().dimExtractionScanAndAggregate( query, selectorPlus.getSelector(), cursor, rowSelector, aggregatesStore ); cursor.advance(); } do: java selectorPlus.getColumnSelectorStrategy().dimExtractionScanAndAggregate( query, selectorPlus.getSelector(), cursor, rowSelector, aggregatesStore ); move while (!cursor.isDone) ... cursor.advance() part strategies</technical_language>

Target:
public void dimExtractionScanAndAggregate( TopNQuery query, LongColumnSelector selector, Cursor cursor, Aggregator[][] rowSelector, Long2ObjectMap<Aggregator[]> aggregatesStore ) { while (!cursor.isDone()) { long key = selector.get(); Aggregator[] theAggregators = aggregatesStore.get(key); if (theAggregators == null) { theAggregators = BaseTopNAlgorithm.makeAggregators(cursor, query.getAggregatorSpecs()); aggregatesStore.put(key, theAggregators); } for (Aggregator aggregator : theAggregators) { aggregator.aggregate(); } cursor.advance(); } }
Source:
<code>private void rebuildIndexes(Connection conn, Configuration conf, String dataTableFullName) { if (upgrade) { prepareToRebuildIndexes(conn, dataTableFullName); if(!test) { indexingTool = new IndexTool(); } indexingTool.setConf(conf); <START> if(rebuildMap.get(dataTableFullName).size() != 0 ) { <END> rebuildIndexes(conn, dataTableFullName, indexingTool); } } }</code><technical_language>I crash rebuildMap for dataTableFullName. This change moves crash point</technical_language>

Target:
private void rebuildIndexes(Connection conn, Configuration conf, String dataTableFullName) { try { HashMap<String, IndexInfo> rebuildMap = prepareToRebuildIndexes(conn, dataTableFullName); if (rebuildMap.isEmpty()) { LOGGER.info("No indexes to rebuild for table " + dataTableFullName); return; } if(!test) { indexingTool = new IndexTool(); indexingTool.setConf(conf); } startIndexRebuilds(conn, dataTableFullName, rebuildMap, indexingTool); } catch (SQLException e) { LOGGER.severe("Failed to prepare the map for index rebuilds " + e); throw new RuntimeException("Failed to prepare the map for index rebuilds"); } }
Source:
<code>public static IVolumeSource create(ModelNode node) { if (node.has(VolumeType.EMPTY_DIR)) { return new EmptyDirVolumeSource(node); } else if (node.has(VolumeType.SECRET)) { return new SecretVolumeSource(node); } else if (node.has(VolumeType.PERSISTENT_VOLUME_CLAIM)) { return new PersistentVolumeClaimVolumeSource(node); } else { <START> return new UnsupportedVolumeSource(node); <END> } }</code><technical_language>return anonymous class implementation instead of 'Unsupported' returning something. Unsupported sound unable do some generic representation of a volume source specifics this time</technical_language>

Target:
public static IVolumeSource create(ModelNode node) { if (node.has(VolumeType.EMPTY_DIR)) { return new EmptyDirVolumeSource(node); } else if (node.has(VolumeType.SECRET)) { return new SecretVolumeSource(node); } else if (node.has(VolumeType.PERSISTENT_VOLUME_CLAIM)) { return new PersistentVolumeClaimVolumeSource(node); } else { return new VolumeSource(node) {}; } }
Source:
<code>public boolean isEntryRemovedInContext(Object key) { <START> throw new CacheException("This context is immutable"); <END> }</code><technical_language>if context is immutable return false</technical_language>

Target:
public boolean isEntryRemovedInContext(Object key) { return false; }
Source:
<code>public void testSlice() { <START> System.out.println( "slice" ); <END> String[] strings = new String[]{ "1", "2", "3" }; int begin = 0; int length = 2; String[] expResult = new String[]{ "1", "2" }; String[] result = ArrayHelper.slice( strings, begin, length ); assertArrayEquals( expResult, result ); }</code><technical_language>remove System.out.? unecessary</technical_language>

Target:
public void testSlice() { String[] strings = new String[]{ "1", "2", "3" }; int begin = 0; int length = 2; String[] expResult = new String[]{ "1", "2" }; String[] result = ArrayHelper.slice( strings, begin, length ); assertArrayEquals( expResult, result ); }
Source:
<code>public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); <START> final Set<EndpointLogLine> endpointLogLines = Sets.newTreeSet(new EndpointComparator()); <END> msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { endpointLogLines.addAll(new EndpointLogger(urlPattern, klass).getEndpointLogLines()); } if (!endpointLogLines.isEmpty()) { for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }</code><technical_language>Do need a TreeSet? Basically duplicates care speed of lookup. need, a sorted collection. ordinary ArrayList some expected size avoid resizing sort it. collection is small, sorting fast. TreeSet a big memory footprint cache-friendly. I it, if alternatives</technical_language>

Target:
public String getEndpointsInfo() { final StringBuilder msg = new StringBuilder(1024); final List<EndpointLogLine> endpointLogLines = Lists.newArrayList(); msg.append("The following paths were found for the configured resources:"); msg.append(NEWLINE).append(NEWLINE); final Set<Class<?>> allResources = Sets.newHashSet(); for (Class<?> clazz : allClasses()) { if (!clazz.isInterface() && Resource.from(clazz) != null) { allResources.add(clazz); } } for (Class<?> klass : allResources) { new EndpointLogger(urlPattern, klass).populate(endpointLogLines); } if (!endpointLogLines.isEmpty()) { Collections.sort(endpointLogLines, new EndpointComparator()); for (EndpointLogLine line : endpointLogLines) { msg.append(line).append(NEWLINE); } } else { msg.append(" NONE").append(NEWLINE); } return msg.toString(); }
Source:
<code>public Date startOfNextDay() { <START> return startOfNextDay(new Date()); <END> }</code><technical_language>I fix this in PR. a separate PR for this fix better. related this change</technical_language>

Target:
public Date startOfNextDay() { Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.DATE, 1); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTime(); }
Source:
<code>public void putActionResult(String key, byte[] in) throws IOException, InterruptedException { <START> put(key, in.length, new ByteArrayInputStream(in)); <END> }</code><technical_language>issue OnDiskBlobStore action key prefix</technical_language>

Target:
public void putActionResult(String key, byte[] in) throws IOException, InterruptedException { diskCache.putActionResult(key, in); remoteCache.putActionResult(key, in); }
Source:
<code>public void <START> setZoomPercentageBy0_5_isHalfCropWidth() <END> throws InterruptedException { Rect cropRegionMaxZoom = getSensorRect(); mZoomControl.setZoomPercentage(0f); HandlerUtil.waitForLooperToIdle(mHandler); Rect cropRegionMinZoom = getSessionCropRegion(mControlUpdateListener); mZoomControl.setZoomPercentage(0.5f); HandlerUtil.waitForLooperToIdle(mHandler); Rect cropRegionHalfZoom = getSessionCropRegion(mControlUpdateListener); Assert.assertEquals(cropRegionHalfZoom.width(), (cropRegionMinZoom.width() + cropRegionMaxZoom.width()) / 2.0f, 10); }</code><technical_language>is NPE I run this test Pixel3 XL</technical_language>

Target:
public void setZoomPercentageBy0_5_isHalfCropWidth() throws InterruptedException { mZoomControl.setZoomPercentage(1f); HandlerUtil.waitForLooperToIdle(mHandler); Rect cropRegionMaxZoom = getSessionCropRegion(mControlUpdateListener); Rect cropRegionMinZoom = getSensorRect(); mZoomControl.setZoomPercentage(0.5f); HandlerUtil.waitForLooperToIdle(mHandler); Rect cropRegionHalfZoom = getSessionCropRegion(mControlUpdateListener); Assert.assertEquals(cropRegionHalfZoom.width(), (cropRegionMinZoom.width() + cropRegionMaxZoom.width()) / 2.0f, 10); }
Source:
<code>public void testInjection() throws Exception { props .put(Constants.ConfigurationKeys.AZKABAN_STORAGE_LOCAL_BASEDIR, AZKABAN_LOCAL_TEST_STORAGE); final Injector injector = Guice.createInjector( new AzkabanCommonModule(props), new AzkabanExecServerModule() ); <START> SERVICE_PROVIDER.unsetInjector(); <END> SERVICE_PROVIDER.setInjector(injector); assertNotNull(SERVICE_PROVIDER.getInstance(AzkabanExecutorServer.class)); }</code><technical_language>is this change necessary</technical_language>

Target:
public void testInjection() throws Exception { props .put(Constants.ConfigurationKeys.AZKABAN_STORAGE_LOCAL_BASEDIR, AZKABAN_LOCAL_TEST_STORAGE); final Injector injector = Guice.createInjector( new AzkabanCommonModule(props), new AzkabanExecServerModule() ); assertNotNull(injector.getInstance(AzkabanExecutorServer.class)); }
Source:
<code><START> public static ProgramNode generateIRTree(InputStream stream, String filename) throws IOException { <END> CharStream chars = new ANTLRInputStream(stream); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); ASTGenerator generator = new ASTGenerator(filename); ProgramNode irtree = (ProgramNode) generator.visitProgram(parser.program()); if (verbose) { System.out.println("Parsed: " + filename); } return irtree; }</code><technical_language>If this package-private (i.e. default i.e. remove 'public') move unit tests package class testing, access this method tests while isolating other code</technical_language>

Target:
static ProgramNode generateIRTree(InputStream stream, String filename) throws IOException { CharStream chars = new ANTLRInputStream(stream); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); ASTGenerator generator = new ASTGenerator(filename); ProgramNode irtree = (ProgramNode) generator.visitProgram(parser.program()); if (verbose) { System.out.println("Parsed: " + filename); } return irtree; }
Source:
<code>protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Save schema", ProgressIndicator.UNKNOWN); try (OutputStream out = getTarget().getOutput(); Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) { JsonStreamBuilder builder = new JsonStreamBuilder(writer, true); new SchemaToJson().schemasToJson(builder, getSchemas().getSchemas(), null); reporter.setSuccess(true); } catch (Exception e) { <START> e.printStackTrace(); <END> reporter.error(new IOMessageImpl(e.getMessage(), e)); reporter.setSuccess(false); } finally { progress.end(); } return reporter; }</code><technical_language>removed</technical_language>

Target:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { progress.begin("Save schema", ProgressIndicator.UNKNOWN); try (OutputStream out = getTarget().getOutput(); Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) { JsonStreamBuilder builder = new JsonStreamBuilder(writer, true); new SchemaToJson().schemasToJson(builder, getSchemas().getSchemas(), null); reporter.setSuccess(true); } catch (Exception e) { reporter.error(new IOMessageImpl(e.getMessage(), e)); reporter.setSuccess(false); } finally { progress.end(); } return reporter; }
Source:
<code>public void traceOpened(TmfTraceOpenedSignal signal) { boolean signalIsForUs = false; for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) { if (trace == this) { signalIsForUs = true; break; } } if (!signalIsForUs) { return; } IStatus[] statuses = new IStatus[2]; statuses[0] = buildStatistics(); statuses[1] = buildStateSystem(); for (IStatus status : statuses) { if (!status.isOK()) { Activator.log(status); } } <START> <END> try { if (fResource != null) { fResource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); } } catch (CoreException e) { e.printStackTrace(); } if (signal.getTrace() == this) { if (getNbEvents() == 0) { return; } if (getStreamingInterval() > 0) { return; } final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH); final TmfTraceRangeUpdatedSignal rangeUpdatedsignal = new TmfTraceRangeUpdatedSignal(this, this, timeRange); new Thread() { @Override public void run() { broadcast(rangeUpdatedsignal); } }.start(); return; } }</code><technical_language>a MultiStatus instead of looping log in activator</technical_language>

Target:
public void traceOpened(TmfTraceOpenedSignal signal) { boolean signalIsForUs = false; for (ITmfTrace trace : TmfTraceManager.getTraceSet(signal.getTrace())) { if (trace == this) { signalIsForUs = true; break; } } if (!signalIsForUs) { return; } MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null); status.add(buildStatistics()); status.add(buildStateSystem()); if (!status.isOK()) { Activator.log(status); } try { if (fResource != null) { fResource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); } } catch (CoreException e) { e.printStackTrace(); } if (signal.getTrace() == this) { if (getNbEvents() == 0) { return; } if (getStreamingInterval() > 0) { return; } final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(), TmfTimestamp.BIG_CRUNCH); final TmfTraceRangeUpdatedSignal rangeUpdatedsignal = new TmfTraceRangeUpdatedSignal(this, this, timeRange); new Thread() { @Override public void run() { broadcast(rangeUpdatedsignal); } }.start(); return; } }
Source:
<code>private synchronized void registerWeatherDiscoveryService(WeatherUndergroundBridgeHandler bridgeHandler) { WeatherUndergroundDiscoveryService discoveryService = new WeatherUndergroundDiscoveryService(bridgeHandler, locationProvider); <START> bridgeHandler.getDiscoveryServiceRegs().put(bridgeHandler.getThing().getUID(), bundleContext <END> .registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>())); }</code><technical_language>I bundleContext prevents fro internalizing discoveryService creation bridge handler. a setter instead, handler instance discovery service</technical_language>

Target:
private synchronized void registerWeatherDiscoveryService(WeatherUndergroundBridgeHandler bridgeHandler) { WeatherUndergroundDiscoveryService discoveryService = new WeatherUndergroundDiscoveryService( bridgeHandler.getThing().getUID(), locationProvider); bridgeHandler.setDiscoveryService(bundleContext.registerService(DiscoveryService.class.getName(), discoveryService, new Hashtable<String, Object>())); }
Source:
<code>public void spec104_mustSignalOnErrorWhenFails() throws Throwable { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { <START> public void onError(Throwable cause) { <END> latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(env.defaultTimeoutMillis(), String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); Thread.sleep(env.defaultTimeoutMillis()); env.verifyNoAsyncErrors(); } }); }</code><technical_language>@Override</technical_language>

Target:
public void spec104_mustSignalOnErrorWhenFails() throws Throwable { errorPublisherTest(new PublisherTestRun<T>() { @Override public void run(final Publisher<T> pub) throws InterruptedException { final Latch latch = new Latch(env); pub.subscribe(new TestEnvironment.TestSubscriber<T>(env) { @Override public void onError(Throwable cause) { latch.assertOpen(String.format("Error-state Publisher %s called `onError` twice on new Subscriber", pub)); latch.close(); } }); latch.expectClose(String.format("Error-state Publisher %s did not call `onError` on new Subscriber", pub)); Thread.sleep(env.defaultTimeoutMillis()); env.verifyNoAsyncErrors(); } }); }
Source:
<code>public void onCreate() { super.onCreate(); setUpPicasso(); if (!BuildConfig.DEBUG) { FirebaseApp.initializeApp(this); setUpCrashlytics(); } Mapbox.getInstance(this, getString(R.string.access_token)); <START> if (Mapbox.getTelemetry() != null) { <END> Mapbox.getTelemetry().setDebugLoggingEnabled(true); } setUpTileLoadingMeasurement(); }</code><technical_language>If in debug mode, throw exception? a good test case for manual QA</technical_language>

Target:
public void onCreate() { super.onCreate(); setUpPicasso(); if (!BuildConfig.DEBUG) { FirebaseApp.initializeApp(this); setUpCrashlytics(); } Mapbox.getInstance(this, getString(R.string.access_token)); if (BuildConfig.DEBUG) { if (Mapbox.getTelemetry() == null) { throw new RuntimeException("Mapbox.getTelemetry() == null in debug config"); } else { Mapbox.getTelemetry().setDebugLoggingEnabled(true); } } setUpTileLoadingMeasurement(); }
Source:
<code>public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { <START> throw new IOException("Throwed IOException from publisher!"); <END> }</code><technical_language>(again, threw)</technical_language>

Target:
public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { throw new IOException("Threw IOException from publisher!"); }
Source:
<code>private static boolean isWithinTryHeader(Tree syntaxNode) { Tree parent = syntaxNode; <START> while ((parent = parent.parent()) != null) { <END> if (parent.is(Tree.Kind.VARIABLE)) { break; } } if (parent != null && parent.is(Tree.Kind.VARIABLE)) { return isTryStatementResource((VariableTree) parent); } return false; }</code><technical_language>Please do assignement comparison expression. avoid break testing nullness kind in while condition assignement in body of while</technical_language>

Target:
private static boolean isWithinTryHeader(Tree syntaxNode) { Tree parent = syntaxNode; while (parent != null && !parent.is(Tree.Kind.VARIABLE) ) { parent = parent.parent(); } if (parent != null && parent.is(Tree.Kind.VARIABLE)) { return isTryStatementResource((VariableTree) parent); } return false; }
Source:
<code>public boolean isOnlyHEADSelected(Set<RefFilter> filters) { for (RefFilter filter : filters) { if (filter.isSelected()) { <START> if (!filtersForHEAD.contains(filter)) <END> return false; } else { if (filtersForHEAD.contains(filter)) return false; } } return true; }</code><technical_language>missing braces</technical_language>

Target:
public boolean isOnlyHEADSelected(Set<RefFilter> filters) { for (RefFilter filter : filters) { if (filter.isSelected()) { if (!filtersForHEAD.contains(filter)) { return false; } } else { if (filtersForHEAD.contains(filter)) { return false; } } } return true; }
Source:
<code>public InputStream fetchResource(String resourceName, ResourceUriCallback callback) { try { if (resources.containsKey(resourceName)) { final byte[] resourceByteArray = resources.get(resourceName); <START> System.out.println("CacheResourceLoader hits: " + String.valueOf(++hits)); <END> return toInputStreamOrNull(resourceByteArray); } InputStream resource = null; if (resourceLoader instanceof ResourceLoaderExtended) { resource = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourceName, callback); } else { resource = resourceLoader.fetchResource(resourceName); } final byte[] resourceByteArray = resource == null ? null : IOUtils.toByteArray(resource); resources.put(resourceName, resourceByteArray); return toInputStreamOrNull(resourceByteArray); } catch (final IOException e) { return resourceLoader.fetchResource(resourceName); } }</code><technical_language>guessing System.out there. Is hits variable important</technical_language>

Target:
public InputStream fetchResource(String resourceName, ResourceUriCallback callback) { try { if (resources.containsKey(resourceName)) { final byte[] resourceByteArray = resources.get(resourceName); return toInputStreamOrNull(resourceByteArray); } InputStream resource = null; if (resourceLoader instanceof ResourceLoaderExtended) { resource = ((ResourceLoaderExtended) resourceLoader).fetchResource(resourceName, callback); } else { resource = resourceLoader.fetchResource(resourceName); } final byte[] resourceByteArray = resource == null ? null : IOUtils.toByteArray(resource); resources.put(resourceName, resourceByteArray); return toInputStreamOrNull(resourceByteArray); } catch (final IOException e) { return resourceLoader.fetchResource(resourceName); } }
Source:
<code>private void stressTestDeleting(MotechDataService service) { Long startTime = System.nanoTime(); for (Object object : service.retrieveAll()) { service.delete(object); } double endTime = (System.nanoTime() - startTime) / 1000000; LOGGER.info("MDS Service: Deleting " + TEST_INSTANCES + " instances took " + endTime + "ms."); <START> logToFile(endTime); <END> }</code><technical_language>convert Long double, generally logToFile methods, double parameter long, I matter. convert Long double</technical_language>

Target:
private void stressTestDeleting(MotechDataService service) { Long startTime = System.nanoTime(); for (Object object : service.retrieveAll()) { service.delete(object); } Long endTime = (System.nanoTime() - startTime) / 1000000; LOGGER.info("MDS Service: Deleting " + TEST_INSTANCES + " instances took " + endTime + "ms."); logToFile((double) endTime); }
Source:
<code>private static Partition getPartition(byte[] rowKey, long conglomId) throws IOException { PartitionAdmin admin= SIDriver.driver().getTableFactory().getAdmin(); Iterable<? extends Partition> partitions = admin.allPartitions(Long.toString(conglomId)); List<Partition> partitionList = Lists.newArrayList(partitions); partitionList.sort(new Comparator<Partition>() { @Override public int compare(Partition o1, Partition o2) { byte[] k1 = o1.getStartKey(); byte[] k2 = o2.getStartKey(); if (k1 == null || k1.length == 0) { if (k2 == null || k2.length == 0) return 0; else return -1; } else { if (k2 == null || k2.length == 0) return 1; else return Bytes.compareTo(k1, k2); } } }); byte[][] startKeys = new byte[partitionList.size()][]; for (int i = 0; i < partitionList.size(); ++i) { Partition p = partitionList.get(i); byte[] k = p.getStartKey(); startKeys[i] = k; } <START> int index = binarySearchStartKey(startKeys, rowKey); <END> assert index != -1; Partition p = partitionList.get(index); return p; }</code><technical_language>more needed. scan regions region largest startKey is equal smaller rowkey. complexity O(N) instead of O(NlogN)</technical_language>

Target:
private static Partition getPartition(byte[] rowKey, long conglomId) throws IOException { PartitionAdmin admin= SIDriver.driver().getTableFactory().getAdmin(); Iterable<? extends Partition> partitions = admin.allPartitions(Long.toString(conglomId)); List<Partition> partitionList = Lists.newArrayList(partitions); for(Partition p : partitionList) { byte[] start = p.getStartKey(); byte[] end = p.getEndKey(); if (Bytes.compareTo(rowKey, start) >= 0 && Bytes.compareTo(rowKey, end) < 0) { return p; } } assert false; return null; }