auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Var getResultVarFromFunctionCall(URI function, List<ValueExpr> args) { FUNCTION_TYPE type = SEARCH_FUNCTIONS.get(function); if (type == null) { return findBinaryResultVar(args); } <START> else { <END> switch(type) { case GEO: return findBinaryResultVar(args); case FREETEXT: return findLiteralResultVar(args); case TEMPORAL: return findBinaryResultVar(args); default: return findBinaryResultVar(args); } } }</code><technical_language>This is kind of a style nit. conditional returns a value, need else clause</technical_language>

Target:
public static Var getResultVarFromFunctionCall(URI function, List<ValueExpr> args) { FUNCTION_TYPE type = SEARCH_FUNCTIONS.get(function); switch (type) { case GEO: return findBinaryResultVar(args); case FREETEXT: return findLiteralResultVar(args); case TEMPORAL: return findBinaryResultVar(args); default: return findBinaryResultVar(args); } }
Source:
<code>public void importCertToStore(String fileName, String certData, String keyStoreName) throws SecurityConfigException { try { if (keyStoreName == null) { throw new SecurityConfigException("Key Store name can't be null"); } KeyStoreManager keyMan = KeyStoreManager.getInstance(tenantId); KeyStore ks = keyMan.getKeyStore(keyStoreName); byte[] bytes = Base64.decode(certData); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate cert; try { cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); } catch (CertificateException e) { log.error(e.getMessage(), e); <START> throw new SecurityConfigException("Invalid format of the provided certificate file", e); <END> } if (ks.getCertificateAlias(cert) != null) { return; } ks.setCertificateEntry(fileName, cert); keyMan.updateKeyStore(keyStoreName, ks); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when importing cert to the keyStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }</code><technical_language>log exception need add , e) exception. throw exception message</technical_language>

Target:
public void importCertToStore(String fileName, String certData, String keyStoreName) throws SecurityConfigException { try { if (keyStoreName == null) { throw new SecurityConfigException("Key Store name can't be null"); } KeyStoreManager keyMan = KeyStoreManager.getInstance(tenantId); KeyStore ks = keyMan.getKeyStore(keyStoreName); byte[] bytes = Base64.decode(certData); CertificateFactory factory = CertificateFactory.getInstance("X.509"); X509Certificate cert; try { cert = (X509Certificate) factory .generateCertificate(new ByteArrayInputStream(bytes)); } catch (CertificateException e) { log.error(e.getMessage(), e); throw new SecurityConfigException("Invalid format of the provided certificate file"); } if (ks.getCertificateAlias(cert) != null) { return; } ks.setCertificateEntry(fileName, cert); keyMan.updateKeyStore(keyStoreName, ks); } catch (SecurityConfigException e) { throw e; } catch (Exception e) { String msg = "Error when importing cert to the keyStore"; log.error(msg, e); throw new SecurityConfigException(msg, e); } }
Source:
<code>public MetadataSegmentView( final @Coordinator DruidLeaderClient druidLeaderClient, final ObjectMapper jsonMapper, final BytesAccumulatingResponseHandler responseHandler, final BrokerSegmentWatcherConfig segmentWatcherConfig, final PlannerConfig plannerConfig ) { Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.coordinatorDruidLeaderClient = druidLeaderClient; this.jsonMapper = jsonMapper; this.responseHandler = responseHandler; this.segmentWatcherConfig = segmentWatcherConfig; this.isCacheEnabled = plannerConfig.isMetadataSegmentCacheEnable(); this.pollPeriodinMS = plannerConfig.getMetadataSegmentPollPeriod(); <START> this.publishedSegments = isCacheEnabled ? new ConcurrentHashMap<>(1000) : new ConcurrentHashMap<>(); <END> }</code><technical_language>null ifCacheEnabled = false</technical_language>

Target:
public MetadataSegmentView( final @Coordinator DruidLeaderClient druidLeaderClient, final ObjectMapper jsonMapper, final BytesAccumulatingResponseHandler responseHandler, final BrokerSegmentWatcherConfig segmentWatcherConfig, final PlannerConfig plannerConfig ) { Preconditions.checkNotNull(plannerConfig, "plannerConfig"); this.coordinatorDruidLeaderClient = druidLeaderClient; this.jsonMapper = jsonMapper; this.responseHandler = responseHandler; this.segmentWatcherConfig = segmentWatcherConfig; this.isCacheEnabled = plannerConfig.isMetadataSegmentCacheEnable(); this.pollPeriodInMS = plannerConfig.getMetadataSegmentPollPeriod(); this.publishedSegments = isCacheEnabled ? new ConcurrentHashMap<>(1000) : null; this.scheduledExec = Execs.scheduledSingleThreaded("MetadataSegmentView-Cache--%d"); }
Source:
<code>private ArchivedCoursesTable convertToArchivedCoursesTable(List<CourseAttributes> archivedCourses) { ArchivedCoursesTable archivedCoursesTable = new ArchivedCoursesTable(); int idx = this.activeCourses.getRows().size() - 1; for (CourseAttributes course : archivedCourses) { idx++; List<ElementTag> actionsParam = new ArrayList<>(); String unarchiveLink = getInstructorCourseArchiveLink(course.getId(), false, false); ElementTag unarchivedButton = createButton("Unarchive", "btn btn-default btn-xs", "t_course_unarchive" + idx, unarchiveLink, "", false); String deleteLink = getInstructorCourseDeleteLink(course.getId(), false); Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link", "t_course_delete" + idx, deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission); deleteButton.setAttribute("data-course-id", course.getId()); actionsParam.add(unarchivedButton); actionsParam.add(deleteButton); ArchivedCoursesTableRow row = new ArchivedCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), SanitizationHelper.sanitizeForHtml( course.getCreatedAtDateString()), SanitizationHelper.sanitizeForHtml( course.getCreatedAtDateStamp()), SanitizationHelper.sanitizeForHtml( <START> course.getCreatedAtFullDateTimeString()), <END> actionsParam); archivedCoursesTable.getRows().add(row); } return archivedCoursesTable; }</code><technical_language>I 3 fields need sanitisation safe strings input user generated system a date object</technical_language>

Target:
private ArchivedCoursesTable convertToArchivedCoursesTable(List<CourseAttributes> archivedCourses) { ArchivedCoursesTable archivedCoursesTable = new ArchivedCoursesTable(); int idx = this.activeCourses.getRows().size() - 1; for (CourseAttributes course : archivedCourses) { idx++; List<ElementTag> actionsParam = new ArrayList<>(); String unarchiveLink = getInstructorCourseArchiveLink(course.getId(), false, false); ElementTag unarchivedButton = createButton("Unarchive", "btn btn-default btn-xs", "t_course_unarchive" + idx, unarchiveLink, "", false); String deleteLink = getInstructorCourseDeleteLink(course.getId(), false); Boolean hasDeletePermission = instructorsForCourses.get(course.getId()).isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); ElementTag deleteButton = createButton("Delete", "btn btn-default btn-xs course-delete-link", "t_course_delete" + idx, deleteLink, Const.Tooltips.COURSE_DELETE, !hasDeletePermission); deleteButton.setAttribute("data-course-id", course.getId()); actionsParam.add(unarchivedButton); actionsParam.add(deleteButton); ArchivedCoursesTableRow row = new ArchivedCoursesTableRow(SanitizationHelper.sanitizeForHtml(course.getId()), SanitizationHelper.sanitizeForHtml(course.getName()), course.getCreatedAtDateString(), course.getCreatedAtDateStamp(), course.getCreatedAtFullDateTimeString(), actionsParam); archivedCoursesTable.getRows().add(row); } return archivedCoursesTable; }
Source:
<code>public Stage (Viewport viewport, Batch batch) { if (viewport == null) throw new IllegalArgumentException("viewport cannot be null."); if (batch == null) throw new IllegalArgumentException("batch cannot be null."); this.viewport = viewport; this.batch = batch; <START> setRoot(new Group()); <END> viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); }</code><technical_language>opinions that. If this is overriden in a subclass, subclass is intended do a behaviour. Invoking overridable methods is done in scene2d actors</technical_language>

Target:
public Stage (Viewport viewport, Batch batch) { if (viewport == null) throw new IllegalArgumentException("viewport cannot be null."); if (batch == null) throw new IllegalArgumentException("batch cannot be null."); this.viewport = viewport; this.batch = batch; root = new Group(); root.setStage(this); viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); }
Source:
<code>public void value(File file) throws IOException { super.flush(); <START> FileReader input = new FileReader(file); <END> char[] buffer = new char[1024 * 4]; int n = 0; while (-1 != (n = input.read(buffer))) { out.write(buffer, 0, n); } out.flush(); }</code><technical_language>Needs try/finally for close</technical_language>

Target:
void value(File file) throws IOException { super.flush(); FileReader input = null; try { input = new FileReader(file); IOUtils.copy(input, out); } finally { IOUtils.closeQuietly(input); } out.flush(); }
Source:
<code>public static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer(String servers, Map<String, Class<? extends ChangeEvent>> topicToClass) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", UUID.randomUUID().toString()); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); <START> props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"); <END> return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<ChangeEvent>(topicToClass)); }</code><technical_language>need configure deserializers inject explicitly</technical_language>

Target:
public static KafkaConsumer<String, ChangeEvent> buildKafkaConsumer(String servers, Map<String, Class<? extends ChangeEvent>> topicToClass) { Properties props = new Properties(); props.put("bootstrap.servers", servers); props.put("group.id", UUID.randomUUID().toString()); props.put("max.poll.interval.ms", "600000"); props.put("enable.auto.commit", "false"); return new KafkaConsumer<>(props, new StringDeserializer(), new JsonDeserializer<>(topicToClass)); }
Source:
<code>protected Map<String, String> createProps() { Map<String, String> props = super.createProps(); url = "memory://"; props.put(HdfsSinkConnectorConfig.HDFS_URL_CONFIG, url); props.put(StorageCommonConfig.STORE_URL_CONFIG, url); props.put(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG, "3"); props.put( StorageCommonConfig.STORAGE_CLASS_CONFIG, "io.confluent.connect.hdfs.storage.HdfsStorage" ); props.put(HdfsSinkConnectorConfig.FORMAT_CLASS_CONFIG, AvroFormat.class.getName()); props.put( PartitionerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName() ); props.put(PartitionerConfig.PARTITION_FIELD_NAME_CONFIG, "int"); props.put( PartitionerConfig.PARTITION_DURATION_MS_CONFIG, String.valueOf(TimeUnit.HOURS.toMillis(1)) ); props.put(PartitionerConfig.PATH_FORMAT_CONFIG, "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH/"); props.put(PartitionerConfig.LOCALE_CONFIG, "en"); props.put(PartitionerConfig.TIMEZONE_CONFIG, "America/Los_Angeles"); <START> props.put(HdfsSinkConnectorConfig.TOPIC_REGEX_CAPTURE_GROUP_CONFIG, "(.*)[\\.\\-](.*)"); <END> props.put(StorageCommonConfig.TOPICS_DIR_CONFIG, "${1}/${topic}"); return props; }</code><technical_language>Do belong in test base class? scope relevant test classes? idk, kinda 50/50 this. testing this config disabled, good. I refactor for topicsDir a Map, disable config options</technical_language>

Target:
protected Map<String, String> createProps() { Map<String, String> props = super.createProps(); url = "memory://"; props.put(HdfsSinkConnectorConfig.HDFS_URL_CONFIG, url); props.put(StorageCommonConfig.STORE_URL_CONFIG, url); props.put(HdfsSinkConnectorConfig.FLUSH_SIZE_CONFIG, "3"); props.put( StorageCommonConfig.STORAGE_CLASS_CONFIG, "io.confluent.connect.hdfs.storage.HdfsStorage" ); props.put(HdfsSinkConnectorConfig.FORMAT_CLASS_CONFIG, AvroFormat.class.getName()); props.put( PartitionerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName() ); props.put(PartitionerConfig.PARTITION_FIELD_NAME_CONFIG, "int"); props.put( PartitionerConfig.PARTITION_DURATION_MS_CONFIG, String.valueOf(TimeUnit.HOURS.toMillis(1)) ); props.put(PartitionerConfig.PATH_FORMAT_CONFIG, "'year'=YYYY/'month'=MM/'day'=dd/'hour'=HH/"); props.put(PartitionerConfig.LOCALE_CONFIG, "en"); props.put(PartitionerConfig.TIMEZONE_CONFIG, "America/Los_Angeles"); props.put(HdfsSinkConnectorConfig.TOPIC_CAPTURE_GROUPS_REGEX_CONFIG, "(.*)[\\.\\-](.*)"); props.put(StorageCommonConfig.TOPICS_DIR_CONFIG, "${1}/${topic}"); return props; }
Source:
<code>private void createComponent() { if (multipleSelection) schemaTable = CheckboxTableViewer.newCheckList(page, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); else schemaTable = CheckboxTableViewer.newCheckList(page, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.BORDER); schemaTable.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); schemaTable.setContentProvider(ArrayContentProvider.getInstance()); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); layoutData.widthHint = SWT.DEFAULT; layoutData.heightHint = 8 * schemaTable.getTable().getItemHeight(); schemaTable.getControl().setLayoutData(layoutData); schemaTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { setPageComplete(validate()); } }); schemaTable.addFilter(new ViewerFilter() { @Override public boolean select(Viewer viewer, Object parentElement, Object element) { String value = (String) element; <START> if (value.equalsIgnoreCase("information_schema") || value.startsWith("pg_")) <END> return false; return true; } }); setPageComplete(false); page.layout(true, true); }</code><technical_language>This is logic specific a type of database. UI care that. schema selector for a database return is appropriate</technical_language>

Target:
private void createComponent() { if (multipleSelection) schemaTable = CheckboxTableViewer.newCheckList(page, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); else schemaTable = CheckboxTableViewer.newCheckList(page, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); schemaTable.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return element.toString(); } }); schemaTable.setContentProvider(ArrayContentProvider.getInstance()); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); layoutData.widthHint = SWT.DEFAULT; layoutData.heightHint = 8 * schemaTable.getTable().getItemHeight(); schemaTable.getControl().setLayoutData(layoutData); schemaTable.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked() && (!multipleSelection)) { schemaTable.setAllChecked(false); schemaTable.setCheckedElements(new Object[] { event.getElement() }); } setPageComplete(validate()); } }); setPageComplete(false); page.layout(true, true); }
Source:
<code><START> public Map<String, Boolean> getPermissions() { <END> return Collections.unmodifiableMap(permissions); }</code><technical_language>this exposed poor user</technical_language>

Target:
public Set<String> getPermissions() { return Collections.unmodifiableSet(permissions.keySet()); }
Source:
<code>private void startImportingKeys() { boolean isEncrypted; try { isEncrypted = isEncryptedFile(mCurrentUri); } catch (IOException e) { e.printStackTrace(); Notify.create(mImportActivity, R.string.error_bad_data, Style.ERROR).show(); return; } if (isEncrypted) { Intent intent = new Intent(getActivity(), DecryptActivity.class); <START> intent.setAction(DecryptActivity.ACTION_DECRYPT_FILE_AND_RETURN); <END> intent.setData(mCurrentUri); startActivityForResult(intent, REQUEST_CODE_IMPORT_ENCRYPTED_KEY); } else { mImportActivity.loadCallback(new BytesLoaderState(null, mCurrentUri)); } }</code><technical_language>I this handled part of decryption operation, need roundtrip. get behavior encrypted keys of activity input activity stack. startActivity, finish proceed there</technical_language>

Target:
private void startImportingKeys() { boolean isEncrypted; try { isEncrypted = FileHelper.isEncryptedFile(mImportActivity, mCurrentUri); } catch (IOException e) { Log.e(Constants.TAG, "Error opening file", e); Notify.create(mImportActivity, R.string.error_bad_data, Style.ERROR).show(); return; } if (isEncrypted) { Intent intent = new Intent(mImportActivity, DecryptActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(mCurrentUri); startActivity(intent); } else { mImportActivity.loadCallback(new BytesLoaderState(null, mCurrentUri)); } }
Source:
<code>public void saveObs_ShouldEditObsWithEditReasonComplexConceptANdRequestWhichIsAnInstanceOfMultiHTTPServletRequest() { MockHttpSession mockSession = new MockHttpSession(); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); mockRequest.addParameter("saveObs", "saveObs"); mockRequest.setSession(mockSession); when(obsErrors.hasErrors()).thenReturn(false); final String fileName = "test.txt"; final byte[] content = "Hello World".getBytes(); MockMultipartFile mockMultipartFile = new MockMultipartFile("complexDataFile", fileName, "text/plain", content); <START> <END> mockRequest.addFile(mockMultipartFile); when(obsService.saveObs(mockObsWithComplexConcept, "Test Edit Reason")).thenReturn( RadiologyTestData.getEditedMockObs()); radiologyObsFormController.saveObs(mockRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObsWithComplexConcept, obsErrors); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(notNullValue())); assertThat((String) mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is("Obs.saved")); }</code><technical_language>@bgeVam remove empty line for readability (closeness of mockMultipartFile, mockRequest.addFile(mockMultipartFile))</technical_language>

Target:
public void saveObs_ShouldEditObsWithEditReasonComplexConceptANdRequestWhichIsAnInstanceOfMultiHTTPServletRequest() { MockHttpSession mockSession = new MockHttpSession(); MockMultipartHttpServletRequest mockRequest = new MockMultipartHttpServletRequest(); mockRequest.addParameter("saveObs", "saveObs"); mockRequest.setSession(mockSession); final String fileName = "test.txt"; final byte[] content = "Hello World".getBytes(); MockMultipartFile mockMultipartFile = new MockMultipartFile("complexDataFile", fileName, "text/plain", content); mockRequest.addFile(mockMultipartFile); when(obsErrors.hasErrors()).thenReturn(false); when(obsService.saveObs(mockObsWithComplexConcept, "Test Edit Reason")).thenReturn( RadiologyTestData.getEditedMockObs()); radiologyObsFormController.saveObs(mockRequest, null, "Test Edit Reason", mockRadiologyOrder, mockObsWithComplexConcept, obsErrors); assertThat(mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is(notNullValue())); assertThat((String) mockSession.getAttribute(WebConstants.OPENMRS_MSG_ATTR), is("Obs.saved")); }
Source:
<code>public static void write(Serializable ob, File outputCheck) { try { Serializable o = ob; if (outputCheck.getParentFile() != null) outputCheck.getParentFile().mkdirs(); outputCheck.createNewFile(); ObjectOutput output = getOutput(outputCheck.getPath()); try { <START> output.writeObject(o); <END> } finally { output.close(); } } catch (IOException ex) { logger.error("Cannot write to output." + ex); } }</code><technical_language>this is exception block, please leave println()</technical_language>

Target:
public static void write(Serializable ob, File outputCheck) { try { Serializable o = ob; if (outputCheck.getParentFile() != null) outputCheck.getParentFile().mkdirs(); outputCheck.createNewFile(); ObjectOutput output = getOutput(outputCheck.getPath()); try { output.writeObject(o); } finally { output.close(); } } catch (IOException ex) { System.err.println("Cannot write to output." + ex); } }
Source:
<code>protected ConfigurationBuilder clusterConfig() { <START> ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, false); <END> builder.jmxStatistics().enable(); return hotRodCacheConfiguration(builder); }</code><technical_language>this simplified call super.clusterConfig invoke jmxStatistics.enable()</technical_language>

Target:
protected ConfigurationBuilder clusterConfig() { ConfigurationBuilder builder = super.clusterConfig(); builder.jmxStatistics().enable(); return hotRodCacheConfiguration(builder); }
Source:
<code>public Package getSelectedPackage() { <START> if (packages.size() == 0) { <END> return null; } return packages.get(selectedPackage); }</code><technical_language>Optional nitpick: packages.isEmpty()</technical_language>

Target:
public Package getSelectedPackage() { if (packages.isEmpty()) { return null; } return packages.get(selectedPackage); }
Source:
<code>public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (player.getGameMode().equals(GameMode.SPECTATOR)) return false; if (player.getItemInHand() == null) return false; <START> switch (player.getItemInHand().getType()) { <END> case SHEARS: if (isSheared()) return false; if (!player.getGameMode().equals(GameMode.CREATIVE)) { ItemStack shears = player.getItemInHand(); if (shears.getDurability() < 238) { shears.setDurability((short) (shears.getDurability() + 1)); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } getWorld().playSound(getLocation(), Sound.ENTITY_SHEEP_SHEAR, 1, 1); Random r = new Random(); getWorld().dropItemNaturally(getLocation(), new ItemStack(Material.WOOL, r.nextInt(3) + 1, getColor().getWoolData())); setSheared(true); return true; case INK_SACK: { Dye dye = (Dye) player.getItemInHand().getData(); DyeColor color = dye.getColor(); SheepDyeWoolEvent event = new SheepDyeWoolEvent(this, color); if (event.isCancelled()) return false; color = event.getColor(); if (color.equals(getColor())) { return false; } if (!player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getItemInHand().getAmount() > 1) { player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } setColor(color); return true; } default: return false; } }</code><technical_language>shears a baby sheep</technical_language>

Target:
public boolean entityInteract(GlowPlayer player, InteractEntityMessage message) { super.entityInteract(player, message); if (!isAdult()) return false; if (player.getGameMode().equals(GameMode.SPECTATOR)) return false; if (player.getItemInHand() == null) return false; switch (player.getItemInHand().getType()) { case SHEARS: if (isSheared()) return false; if (!player.getGameMode().equals(GameMode.CREATIVE)) { ItemStack shears = player.getItemInHand(); if (shears.getDurability() < 238) { shears.setDurability((short) (shears.getDurability() + 1)); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } getWorld().playSound(getLocation(), Sound.ENTITY_SHEEP_SHEAR, 1, 1); Random r = new Random(); getWorld().dropItemNaturally(getLocation(), new ItemStack(Material.WOOL, r.nextInt(3) + 1, getColor().getWoolData())); setSheared(true); return true; case INK_SACK: { Dye dye = (Dye) player.getItemInHand().getData(); DyeColor color = dye.getColor(); SheepDyeWoolEvent event = new SheepDyeWoolEvent(this, color); if (event.isCancelled()) return false; color = event.getColor(); if (color.equals(getColor())) { return false; } if (!player.getGameMode().equals(GameMode.CREATIVE)) { if (player.getItemInHand().getAmount() > 1) { player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); } else { player.getInventory().clear(player.getInventory().getHeldItemSlot()); } } setColor(color); return true; } default: return false; } }
Source:
<code>public void testInvertMap() { final Map<String, String> in = new HashMap<>(5, 1); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final Set<String> inKeySet = new HashSet<>(in.keySet()); final Set<String> inValSet = new HashSet<>(in.values()); final Map<String, String> out = MapUtils.invertMap(in); final Set<String> outKeySet = new HashSet<>(out.keySet()); final Set<String> outValSet = new HashSet<>(out.values()); assertTrue( inKeySet.equals( outValSet )); assertTrue( inValSet.equals( outKeySet )); assertEquals( "1", out.get("A")); assertEquals( "2", out.get("B")); assertEquals( "3", out.get("C")); assertEquals( "4", out.get("D")); assertEquals( "5", out.get("E")); Map<String, String> emptyMap = new HashMap<>(); <START> Map<String, String> resultMap = MapUtils.invertMap(emptyMap); <END> assertEquals(emptyMap, resultMap); try { MapUtils.invertMap(null); fail("map"); } catch (final NullPointerException ex) { } }</code><technical_language>I put this in a new method testInvertMapNull that, this give granularity in test code</technical_language>

Target:
public void testInvertMap() { final Map<String, String> in = new HashMap<>(5, 1); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final Set<String> inKeySet = new HashSet<>(in.keySet()); final Set<String> inValSet = new HashSet<>(in.values()); final Map<String, String> out = MapUtils.invertMap(in); final Set<String> outKeySet = new HashSet<>(out.keySet()); final Set<String> outValSet = new HashSet<>(out.values()); assertEquals(inKeySet, outValSet); assertEquals(inValSet, outKeySet); assertEquals("1", out.get("A")); assertEquals("2", out.get("B")); assertEquals("3", out.get("C")); assertEquals("4", out.get("D")); assertEquals("5", out.get("E")); }
Source:
<code>private void rescheduleRunnable(long delayMillis) { if (started && !stopRequested) { try { scheduledExec.schedule(getRecordRunnable(), delayMillis, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { <START> log.info( <END> "Rejecting fetch records runnable submission, worker for partition[%s] is not in a valid state", streamPartition.getPartitionId() ); } } else { log.info("Worker for partition[%s] has been stopped", streamPartition.getPartitionId()); } }</code><technical_language>frequently this happen? log exception well</technical_language>

Target:
private void rescheduleRunnable(long delayMillis) { if (started && !stopRequested) { try { scheduledExec.schedule(getRecordRunnable(), delayMillis, TimeUnit.MILLISECONDS); } catch (RejectedExecutionException e) { log.warn( e, "Caught RejectedExecutionException, KinesisRecordSupplier for partition[%s] has likely temporarily shutdown the ExecutorService." + "This is expected behavior after calling seek(), seekToEarliest() and seekToLatest()", streamPartition.getPartitionId() ); } } else { log.info("Worker for partition[%s] has been stopped", streamPartition.getPartitionId()); } }
Source:
<code>public void shutdown() { try ( ErrorHandler errorHandler = new ErrorHandler( "Error when trying to shutdown cluster" ) ) { <START> shutdownCoreMembers( errorHandler ); <END> shutdownReadReplicas( errorHandler ); } }</code><technical_language>switched order of cores read replicas here</technical_language>

Target:
public void shutdown() { try ( ErrorHandler errorHandler = new ErrorHandler( "Error when trying to shutdown cluster" ) ) { shutdownReadReplicas( errorHandler ); shutdownCoreMembers( errorHandler ); } }
Source:
<code>private List<ApplicationDeployedEvent> getApplicationDeployedEvents() { List<Deployment> deployments = deploymentConverter.from(repositoryService <START> .createDeploymentQuery() <END> .list()); List<ApplicationDeployedEvent> applicationDeployedEvents = new ArrayList<>(); for (Deployment deployment : deployments) { if(deployment.getName().equals(APPLICATION_DEPLOYED_EVENT_NAME)) { ApplicationDeployedEventImpl applicationDeployedEvent = new ApplicationDeployedEventImpl(deployment); applicationDeployedEvents.add(applicationDeployedEvent); for (ProcessRuntimeEventListener<ApplicationDeployedEvent> listener : listeners) { listener.onEvent(applicationDeployedEvent); } } } return applicationDeployedEvents; }</code><technical_language>deployment name filtered if in line 62 removed: .deploymentName()</technical_language>

Target:
private List<ApplicationDeployedEvent> getApplicationDeployedEvents() { List<Deployment> deployments = deploymentConverter.from(repositoryService .createDeploymentQuery() .deploymentName(APPLICATION_DEPLOYMENT_NAME) .list()); List<ApplicationDeployedEvent> applicationDeployedEvents = new ArrayList<>(); for (Deployment deployment : deployments) { ApplicationDeployedEventImpl applicationDeployedEvent = new ApplicationDeployedEventImpl(deployment); applicationDeployedEvents.add(applicationDeployedEvent); } return applicationDeployedEvents; }
Source:
<code><START> private boolean isIsoVersionSupported(Version isoVersion, OVirtNodeInfo Info) { <END> boolean result = false; Version supported = new Version(Info.minimumVersion); if (isoVersion.compareTo(supported) > 0) { result = true; } return result; }</code><technical_language>removed static</technical_language>

Target:
private static boolean isIsoVersionSupported(Version isoVersion, OVirtNodeInfo Info) { boolean result = false; Version supported = new Version(Info.minimumVersion); if (isoVersion.compareTo(supported) > 0) { result = true; } return result; }
Source:
<code>public static Object createMessageParser(String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); for (Constructor<?> ctor : clazz.getConstructors()) { <START> if (config != null) { <END> Class<?>[] paramTypes = ctor.getParameterTypes(); if (paramTypes.length == 1) { Object[] args = {config}; return ctor.newInstance(args); } } else { return ctor.newInstance(); } } throw new IllegalArgumentException("Class not found " + className); }</code><technical_language>making this method universal, simply put codec creation logic suggested createCompressionCodec() method. code duplication</technical_language>

Target:
public static Object createMessageParser(String className, SecorConfig config) throws Exception { Class<?> clazz = Class.forName(className); for (Constructor<?> ctor : clazz.getConstructors()) { Class<?>[] paramTypes = ctor.getParameterTypes(); if (paramTypes.length == 1) { Object[] args = {config}; return ctor.newInstance(args); } } throw new IllegalArgumentException("Class not found " + className); }
Source:
<code><O> void updateListEditor(TakesConstrainedValueEditor<O> listEditor, ListModel<O> parentModel) { Collection<O> items = (Collection<O>) parentModel.getItems(); if (items != null) { if (items.size() > 0) { O value; if (parentModel.getSelectedItem() != null) { value = (O) parentModel.getSelectedItem(); } else { value = items.iterator().next(); parentModel.setSelectedItem(value); } if (items.contains(value)) { if (listEditor instanceof TakesConstrainedValueListEditor) { if (parentModel.getSelectedItems() != null) { ((TakesConstrainedValueListEditor<O>)listEditor).setListValue(parentModel.getSelectedItems()); } } else { listEditor.setValue(value); } } } else { if (listEditor instanceof TakesConstrainedValueListEditor) { ((TakesConstrainedValueListEditor<O>)listEditor).setListValue(null); } else { <START> listEditor.setValue(null); <END> } } if (listEditor instanceof TakesConstrainedValueListEditor) { ((TakesConstrainedValueListEditor<O>)listEditor).setAcceptableListValues(items); } else { listEditor.setAcceptableValues(items); } } }</code><technical_language>this is risky - lead NPEs frontend. need it</technical_language>

Target:
<O> void updateListEditor(TakesConstrainedValueEditor<O> listEditor, ListModel<O> parentModel) { Collection<O> items = (Collection<O>) parentModel.getItems(); if (items != null) { if (items.size() > 0) { O value; if (parentModel.getSelectedItem() != null) { value = (O) parentModel.getSelectedItem(); } else { value = items.iterator().next(); parentModel.setSelectedItem(value); } if (items.contains(value)) { if (listEditor instanceof TakesConstrainedValueListEditor) { if (parentModel.getSelectedItems() != null) { ((TakesConstrainedValueListEditor<O>)listEditor).setListValue(parentModel.getSelectedItems()); } } else { listEditor.setValue(value); } } } if (listEditor instanceof TakesConstrainedValueListEditor) { ((TakesConstrainedValueListEditor<O>)listEditor).setAcceptableListValues(items); } else { listEditor.setAcceptableValues(items); } } }
Source:
<code>default void initWireMock(Method testingMethod) { if (this.getClass().getAnnotation(WireMockRecording.class) == null) { WireMockFixture.startServerFor(this, testingMethod); } else { <START> SdkHttpClient.apiUrl("http://localhost:8089/"); <END> } }</code><technical_language>I think, port 8080</technical_language>

Target:
default void initWireMock(Method testingMethod) { if (this.getClass().getAnnotation(WireMockRecording.class) == null) { WireMockFixture.startServerFor(this, testingMethod); } else { SdkHttpClient.apiUrl("http://localhost:8080/"); } }
Source:
<code>public static String desanitizeIfHtmlSanitized(String string) { if (!isSanitizedHtml(string)) { return string; } <START> return desanitizeFromHtml(string); <END> }</code><technical_language>return ... ? ... : ...</technical_language>

Target:
public static String desanitizeIfHtmlSanitized(String string) { return isSanitizedHtml(string) ? desanitizeFromHtml(string) : string; }
Source:
<code>public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { <START> if(jobExecution.getExitStatus().equals("UNKNOWN")) { <END> return new FlowExecutionStatus("NOTIFY"); } else { return null; } }</code><technical_language>This line evaluate false comparing ExitCode String</technical_language>

Target:
public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) { if (shouldNotify()) { return new FlowExecutionStatus(NOTIFY); } else { return new FlowExecutionStatus(QUIET); } }
Source:
<code>public void fastWURefreshTest() throws Exception { try { if (testwuid == null || testwuid.isEmpty()) Assert.fail("Cannot test WsWorkunits.fastWURefreshTest without target WUID - provide 'targetwuid' System property!"); WorkunitWrapper wu = new WorkunitWrapper(); wu.setWuid(testwuid); client.fastWURefresh(wu); System.out.println("wuid: " + wu.getWuid()); } catch (AxisFault e) { e.printStackTrace(); Assert.fail(); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } catch (ArrayOfEspExceptionWrapper e) { e.toString(); <START> Assert.fail(); <END> } }</code><technical_language>question</technical_language>

Target:
public void fastWURefreshTest() throws Exception { try { if (testwuid == null || testwuid.isEmpty()) Assert.fail("Cannot test WsWorkunits.fastWURefreshTest without target WUID - provide 'targetwuid' System property!"); WorkunitWrapper wu = new WorkunitWrapper(); wu.setWuid(testwuid); client.fastWURefresh(wu); System.out.println("wuid: " + wu.getWuid()); } catch (AxisFault e) { e.printStackTrace(); Assert.fail(); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } catch (ArrayOfEspExceptionWrapper e) { Assert.fail(e.toString()); } }
Source:
<code>private void processEntry( ZipOutputStream zipOutputStream, PluginMetadata pluginMetadata, boolean isDirectory, String name, byte[] bytes ) throws IOException { logger.trace( "Processing zip entry: ", name ); AtomicBoolean output = new AtomicBoolean( false ); boolean wasHandled = false; for ( PluginFileHandler pluginFileHandler : pluginFileHandlers ) { if ( pluginFileHandler.handles( name ) ) { wasHandled = true; logger.trace( "Plugin file handler will handle {}", pluginFileHandler.toString(), name ); try { boolean handlerSaysOutput = pluginFileHandler .handle( name, bytes, pluginMetadata ); logger.trace( "Plugin file handler handled {}", pluginFileHandler.toString(), name ); output.compareAndSet( false, handlerSaysOutput ); } catch ( PluginHandlingException e ) { <START> logger.debug( "Plugin file handler " + pluginFileHandler.toString() + " threw exception when handling " <END> + name, e ); throw new IOException( e ); } } } if ( !wasHandled || output.get() ) { zipOutputStream.putNextEntry( new ZipEntry( name ) ); if ( isDirectory == false ) { IOUtils.write( bytes, zipOutputStream ); } zipOutputStream.closeEntry(); } }</code><technical_language>logger.error()</technical_language>

Target:
private void processEntry( ZipOutputStream zipOutputStream, PluginMetadata pluginMetadata, boolean isDirectory, String name, byte[] bytes ) throws IOException { logger.trace( "Processing zip entry: ", name ); AtomicBoolean output = new AtomicBoolean( false ); boolean wasHandled = false; for ( PluginFileHandler pluginFileHandler : pluginFileHandlers ) { if ( pluginFileHandler.handles( name ) ) { wasHandled = true; logger.trace( "Plugin file handler will handle {}", pluginFileHandler.toString(), name ); try { boolean handlerSaysOutput = pluginFileHandler .handle( name, bytes, pluginMetadata ); logger.trace( "Plugin file handler handled {}", pluginFileHandler.toString(), name ); output.compareAndSet( false, handlerSaysOutput ); } catch ( PluginHandlingException e ) { logger.error( "Plugin file handler " + pluginFileHandler.toString() + " threw exception when handling " + name, e ); throw new IOException( e ); } } } if ( !wasHandled || output.get() ) { zipOutputStream.putNextEntry( new ZipEntry( name ) ); if ( isDirectory == false ) { IOUtils.write( bytes, zipOutputStream ); } zipOutputStream.closeEntry(); } }
Source:
<code>private ThreadPoolExecutor getFixedThreadPoolExecutor(int poolSize) { <START> return new ThreadPoolExecutor(5, poolSize, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), <END> new ThreadFactoryBuilder() .setNameFormat("workload-thread %d") .setUncaughtExceptionHandler(ExceptionLogger.INSTANCE) .build()); }</code><technical_language>a meaningful constant for 5</technical_language>

Target:
private ThreadPoolExecutor getFixedThreadPoolExecutor(int poolSize) { return new ThreadPoolExecutor(CORE_POOL_SIZE, poolSize, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), new ThreadFactoryBuilder() .setNameFormat("workload-thread %d") .setUncaughtExceptionHandler(ExceptionLogger.INSTANCE) .build()); }
Source:
<code><START> public HttpMessage getBaseMsg() { <END> return msg; }</code><technical_language>This change longer needed</technical_language>

Target:
protected HttpMessage getBaseMsg() { return msg; }
Source:
<code>protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) { int index = (int)(invokers.size() * Math.random()); Invoker<T> invoker = invokers.get(index); <START> cpuUsage.computeIfAbsent(invoker.getUrl().getAddress(), value -> { <END> CpuUsageService cpuUsageService = dubboCpuUsageFactory.createCpuUsageService(invoker.getUrl()); CpuUsageListener cpuUsageListener = new CpuUsageListenerImpl(); listeners.put(invoker.getUrl().getAddress(), cpuUsageListener); cpuUsageService.addListener("statisticsloadbalance", cpuUsageListener); return 0.0f; }); throw new IllegalStateException("Method unimplemented"); }</code><technical_language>Listener invalid provider restart. address listener removes offline addresses needed</technical_language>

Target:
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) { int index = (int)(invokers.size() * Math.random()); Invoker<T> invoker = invokers.get(index); if (invoker.getUrl() != null) { cpuUsage.computeIfAbsent(invoker.getUrl().getAddress(), value -> { URLBuilder urlBuilder = URLBuilder.from(invoker.getUrl()); urlBuilder.setPath(CpuUsageService.class.getName()); urlBuilder.addParameter(INTERFACE_KEY, CpuUsageService.class.getName()); urlBuilder.addParameter("bean.name", CpuUsageService.class.getName()); urlBuilder.addParameter(METHODS_KEY, "addListener,removeListener"); urlBuilder.addParameters(CHECK_KEY, String.valueOf(false), REFERENCE_FILTER_KEY, ""); urlBuilder.addParameter("addListener.1.callback", true); CpuUsageService cpuUsageService = cpuUsageFactory.createCpuUsageService(invoker.getUrl()); cpuUsageService.addListener(NetUtils.getLocalHost(), new CpuUsageListenerImpl()); return 0.0f; }); } return invoker; }
Source:
<code><START> S3SelectRecordCursor( <END> Configuration configuration, Path path, RecordReader recordReader, long totalBytes, Properties splitSchema, List<HiveColumnHandle> columns, DateTimeZone hiveStorageTimeZone, TypeManager typeManager) { super(configuration, path, recordReader, totalBytes, updateSplitSchema(splitSchema, columns), columns, hiveStorageTimeZone, typeManager); }</code><technical_language>this public, constructor is logically part of public API for class. Access is controlled class level. If wanted class public, need change access of constructor</technical_language>

Target:
public S3SelectRecordCursor( Configuration configuration, Path path, RecordReader recordReader, long totalBytes, Properties splitSchema, List<HiveColumnHandle> columns, DateTimeZone hiveStorageTimeZone, TypeManager typeManager) { super(configuration, path, recordReader, totalBytes, updateSplitSchema(splitSchema, columns), columns, hiveStorageTimeZone, typeManager); }
Source:
<code>protected RowMapper<VmStatistics> createEntityRowMapper() { return new RowMapper<VmStatistics>() { @Override public VmStatistics mapRow(ResultSet rs, int rowNum) throws SQLException { VmStatistics entity = new VmStatistics(); entity.setcpu_sys(rs.getDouble("cpu_sys")); entity.setcpu_user(rs.getDouble("cpu_user")); entity.setelapsed_time(rs.getDouble("elapsed_time")); entity.setusage_cpu_percent((Integer) rs .getObject("usage_cpu_percent")); entity.setusage_mem_percent((Integer) rs .getObject("usage_mem_percent")); entity.setMigrationProgressPercent((Integer) rs <START> .getObject("migration_progress_percent")); <END> entity.setusage_network_percent((Integer) rs .getObject("usage_network_percent")); entity.setDisksUsage((String) rs .getObject("disks_usage")); entity.setId(getGuidDefaultEmpty(rs, "vm_guid")); return entity; } }; }</code><technical_language>rs.getInt()</technical_language>

Target:
protected RowMapper<VmStatistics> createEntityRowMapper() { return new RowMapper<VmStatistics>() { @Override public VmStatistics mapRow(ResultSet rs, int rowNum) throws SQLException { VmStatistics entity = new VmStatistics(); entity.setcpu_sys(rs.getDouble("cpu_sys")); entity.setcpu_user(rs.getDouble("cpu_user")); entity.setelapsed_time(rs.getDouble("elapsed_time")); entity.setusage_cpu_percent((Integer) rs .getObject("usage_cpu_percent")); entity.setusage_mem_percent((Integer) rs .getObject("usage_mem_percent")); entity.setMigrationProgressPercent(rs .getInt("migration_progress_percent")); entity.setusage_network_percent((Integer) rs .getObject("usage_network_percent")); entity.setDisksUsage((String) rs .getObject("disks_usage")); entity.setId(getGuidDefaultEmpty(rs, "vm_guid")); return entity; } }; }
Source:
<code>private String getMeasurementName(final String name) { <START> if (measurementMappings == null) { <END> return name; } for (Map.Entry<String, Pattern> entry : measurementMappings.entrySet()) { final Pattern pattern = entry.getValue(); if (pattern.matcher(name).matches()) { return entry.getKey(); } } return name; }</code><technical_language>initialize empty map</technical_language>

Target:
private String getMeasurementName(final String name) { for (Map.Entry<String, Pattern> entry : measurementMappings.entrySet()) { final Pattern pattern = entry.getValue(); if (pattern.matcher(name).matches()) { return entry.getKey(); } } return name; }
Source:
<code>public TransportOptions getClusterAdminTransportOptions() throws IOException { <START> return createTransportOptions(this.clusterAdminHost); <END> }</code><technical_language>if clusterAdminHost is null, this get ugly. throw supported exception if clusterAdminHost is set</technical_language>

Target:
public TransportOptions getClusterAdminTransportOptions() throws IOException { Preconditions.checkNotNull("clusterAdminHost was not set.", clusterAdminHost); return createTransportOptions(this.clusterAdminHost); }
Source:
<code>protected IStatus executeAnalysis() { MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null); Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); <START> } catch (TmfAnalysisException e) { <END> } status.add(module.schedule()); } } return status; }</code><technical_language>handle this exception? (add error status)</technical_language>

Target:
protected IStatus executeAnalysis() { MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null); Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); status.add(module.schedule()); } catch (TmfAnalysisException e) { status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e)); } } } return status; }
Source:
<code>public void testCacheEmptyGets() { final Set<byte[]> oneRow = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).add(ROW_BYTES).build(); final ColumnSelection oneColumn = ColumnSelection.create(ImmutableList.of(COL_BYTES)); final SortedMap<byte[], RowResult<byte[]>> emptyResults = ImmutableSortedMap.<byte[], RowResult<byte[]>>orderedBy(PtBytes.BYTES_COMPARATOR).build(); final Set<byte[]> noRows = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).build(); mockery.checking(new Expectations() { { oneOf(transaction).getRows(table, oneRow, oneColumn); will(returnValue(emptyResults)); oneOf(transaction).getRows(table, noRows, oneColumn); will(returnValue(emptyResults)); } }); <START> Assert.assertEquals(emptyResults, cachingTransaction.getRows(table, oneRow, oneColumn)); <END> Assert.assertEquals(emptyResults, cachingTransaction.getRows(table, oneRow, oneColumn)); mockery.assertIsSatisfied(); }</code><technical_language>nit: assertEquals suffice here, I think, static imported junit Assert</technical_language>

Target:
public void testCacheEmptyGets() { final Set<byte[]> oneRow = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).add(ROW_BYTES).build(); final ColumnSelection oneColumn = ColumnSelection.create(ImmutableList.of(COL_BYTES)); final SortedMap<byte[], RowResult<byte[]>> emptyResults = ImmutableSortedMap.<byte[], RowResult<byte[]>>orderedBy(PtBytes.BYTES_COMPARATOR).build(); final Set<byte[]> noRows = ImmutableSortedSet.orderedBy(PtBytes.BYTES_COMPARATOR).build(); mockery.checking(new Expectations() { { oneOf(transaction).getRows(table, oneRow, oneColumn); will(returnValue(emptyResults)); oneOf(transaction).getRows(table, noRows, oneColumn); will(returnValue(emptyResults)); } }); assertEquals(emptyResults, cachingTransaction.getRows(table, oneRow, oneColumn)); assertEquals(emptyResults, cachingTransaction.getRows(table, oneRow, oneColumn)); mockery.assertIsSatisfied(); }
Source:
<code>public String toString() { <START> return "CommandSubscribeRequest{" + "subscriptionId=" + subscriptionId + ", device=" + device + ", names=" + names + ", timestamp=" + timestamp + ", limit=" + limit + '}'; <END> }</code><technical_language>avoid long code lines. java.lang.String.format method? Also, please double-check single quotes missed</technical_language>

Target:
public String toString() { return "CommandSubscribeRequest{" + "subscriptionId='" + subscriptionId + '\'' + ", device='" + device + '\'' + ", names=" + names + ", timestamp=" + timestamp + ", limit=" + limit + '}'; }
Source:
<code>public List<String> lines() { return getList("lines", String.class); <START> } <END></code><technical_language>alias getLines() deprecate lines()</technical_language>

Target:
public List<String> lines() { return getLines(); }