auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void save(BrixNode node) { node.setProperty("email", configuration.getEmail()); node.setProperty("feedbackEmailLabel", configuration.getFeedbackEmailLabel()); node.setProperty("feedbackMessageLabel", configuration.getFeedbackMessageLabel()); <START> node.setProperty("feedbackSubmittedMessage", configuration.getFeedbackSubmittedMessage()); <END> }</code><technical_language>this is anti-pattern; distributing internal node-knowledge places; FeedbackTileConfiguration needs functions: public static FeedbackTileConfiguration load(JcrNode node); public static void save(JcrNode node, FeedbackTileConfiguration); center logic identification a single place;</technical_language>

Target:
public void save(BrixNode node) { configuration.save(node); }
Source:
<code>public void markRequestException(Exception e) { <START> String errorMessage = e.getMessage().replaceAll(REGEX, "."); <END> metricsRegistry.meter(errorNamespace(metricNamespace, e, errorMessage)).mark(); }</code><technical_language>error message in metric get messy. arbitrary strings, long. For Error, error code-a _very_ thing, known, short. exception type name is enough for Exceptions</technical_language>

Target:
public void markRequestException(Exception e) { metricsRegistry.meter(errorNamespace(metricNamespace, e, null)).mark(); }
Source:
<code>public static <K, V> List<Pair<K, V>> zip( final List<? extends K> ks, final List<? extends V> vs, boolean strict) { final int size; if (strict) { if (ks.size() != vs.size()) { throw new IllegalArgumentException( <START> "The size of two lists to be combined is required to be equal."); <END> } size = ks.size(); } else { size = Math.min(ks.size(), vs.size()); } return new ZipList<>(ks, vs, size); }</code><technical_language>size -> sizes is -></technical_language>

Target:
public static <K, V> List<Pair<K, V>> zip( final List<? extends K> ks, final List<? extends V> vs, boolean strict) { final int kSize = ks.size(); final int vSize = vs.size(); final int size; if (strict) { if (kSize != vSize) { throw new IllegalArgumentException( "The size of two lists to be combined is required to be equal. " + "The size of the first list is " + kSize + ", while the size of the second list is " + vSize + "."); } size = kSize; } else { size = Math.min(kSize, vSize); } return new ZipList<>(ks, vs, size); }
Source:
<code>public static boolean highIODevice( Path pathOnDevice, boolean defaultHunch ) { if ( SystemUtils.IS_OS_MAC ) { return true; } if ( SystemUtils.IS_OS_LINUX ) { try { FileStore fileStore = Files.getFileStore( pathOnDevice ); String name = fileStore.name(); <START> if ( name.equals( "tmpfs" ) || name.equals( "hugetlbfs" ) ) <END> { return true; } if ( name.startsWith( "/dev/nvme" ) ) { return true; } Path device = Paths.get( name ).toRealPath(); Path deviceName = device.getName( device.getNameCount() - 1 ); Path sysblock = Paths.get( "/sys/block" ); Path rotational = sysblock.resolve( deviceName ).resolve( "queue" ).resolve( "rotational" ); if ( Files.exists( rotational ) ) { return readFirstCharacter( rotational ) == '0'; } else { String namePart = deviceName.toString(); int len = namePart.length(); while ( Character.isDigit( namePart.charAt( len - 1 ) ) ) { len--; } namePart = namePart.substring( 0, len ); rotational = sysblock.resolve( namePart ).resolve( "queue" ).resolve( "rotational" ); if ( Files.exists( rotational ) ) { return readFirstCharacter( rotational ) == '0'; } } } catch ( Exception e ) { return defaultHunch; } } return defaultHunch; }</code><technical_language>i flip constants name</technical_language>

Target:
public static boolean highIODevice( Path pathOnDevice, boolean defaultHunch ) { if ( SystemUtils.IS_OS_MAC ) { return true; } if ( SystemUtils.IS_OS_LINUX ) { try { FileStore fileStore = Files.getFileStore( pathOnDevice ); String name = fileStore.name(); if ( name.equals( "tmpfs" ) || name.equals( "hugetlbfs" ) ) { return true; } if ( name.startsWith( "/dev/nvme" ) ) { return true; } Path device = Paths.get( name ).toRealPath(); Path deviceName = device.getName( device.getNameCount() - 1 ); Path rotational = rotationalPathFor( deviceName ); if ( Files.exists( rotational ) ) { return readFirstCharacter( rotational ) == '0'; } else { String namePart = deviceName.toString(); int len = namePart.length(); while ( Character.isDigit( namePart.charAt( len - 1 ) ) ) { len--; } deviceName = Paths.get( namePart.substring( 0, len ) ); rotational = rotationalPathFor( deviceName ); if ( Files.exists( rotational ) ) { return readFirstCharacter( rotational ) == '0'; } } } catch ( Exception e ) { return defaultHunch; } } return defaultHunch; }
Source:
<code>private static String getEnumOptions(Attribute attr) { <START> return attr.getEnumOptions() != null ? StringUtils.join(attr.getEnumOptions(), ",") : ""; <END> }</code><technical_language>Java 8 String.join instead of a party library</technical_language>

Target:
private static String getEnumOptions(Attribute attr) { return attr.getEnumOptions() != null ? String.join(",", attr.getEnumOptions()) : ""; }
Source:
<code>private boolean allReadyCoupledWithOtherDevice(final SmartMeter coupledDevice, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) { <START> final int channel = mbusChannelElementsResponseDto.getChannel(); <END> return channel == coupledDevice.getChannel(); }</code><technical_language>This kind of code nullable object types assigned primitive type variables suspicious. other suspicious comparisons is difference in channel type (Short in entity, Integer in DTO)</technical_language>

Target:
private boolean allReadyCoupledWithOtherDevice(final SmartMeter coupledDevice, final MbusChannelElementsResponseDto mbusChannelElementsResponseDto) { final Short channel = mbusChannelElementsResponseDto.getChannel(); return channel != null && channel.equals(coupledDevice.getChannel()); }
Source:
<code>public void drawCurve(final Material mat, final PhysicsSpace physicsSpace, RigidBodyControl rigidBody, final Node node, Vector3f[] pts) { phys = rigidBody; this.refreshControlPoints(); CustomCurveMesh curve = new CustomCurveMesh(getSplinePoints()); Mesh mesh = curve.CreateMesh(); <START> geo = new Geometry("curve", mesh); <END> geo.setMaterial(mat); geo.addControl(phys); phys.setRestitution(0.5f); phys.setFriction(0.5f); physicsSpace.add(phys); node.attachChild(geo); }</code><technical_language>call setMesh()</technical_language>

Target:
public void drawCurve(final Material mat, final PhysicsSpace physicsSpace, RigidBodyControl rigidBody, final Node node, Vector3f[] pts) { phys = rigidBody; this.refreshControlPoints(); CustomCurveMesh curve = new CustomCurveMesh(getSplinePoints()); Mesh mesh = curve.CreateMesh(); geo.setMesh(mesh); geo.setMaterial(mat); geo.addControl(phys); phys.setRestitution(0.5f); phys.setFriction(0.5f); physicsSpace.add(phys); node.attachChild(geo); }
Source:
<code>public VirtualMachine getVirtualMachine() { if ( ATTACHED == valueOf(target.getState()) ) { RESTLink vmLink = checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_MACHINE), ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.VIRTUAL_MACHINE); vmLink.setType(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE); HttpResponse response = context.getApi().get(vmLink); ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto> parser = new ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto>( context.utils().xml(), <START> TypeLiteral.get(VirtualMachineWithNodeExtendedDto.class)); <END> return wrap(context, VirtualMachine.class, parser.apply(response)); } return null; }</code><technical_language>Is a "proper" API call here, making a raw HTTP call do apply parsing etc. ourselves</technical_language>

Target:
public VirtualMachine getVirtualMachine() { checkState(ATTACHED == VolumeState.valueOf(target.getState()), "Volume is not attached to a VM"); RESTLink vmLink = checkNotNull(target.searchLink(ParentLinkName.VIRTUAL_MACHINE), ValidationErrors.MISSING_REQUIRED_LINK + " " + ParentLinkName.VIRTUAL_MACHINE); vmLink.setType(VirtualMachineWithNodeExtendedDto.BASE_MEDIA_TYPE); HttpResponse response = context.getApi().get(vmLink); ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto> parser = context.utils().injector() .getInstance(Key.get(new TypeLiteral<ParseXMLWithJAXB<VirtualMachineWithNodeExtendedDto>>(){})); return wrap(context, VirtualMachine.class, parser.apply(response)); }
Source:
<code>public int compareTo(TemporalField<T> that) { if (this == that) { return 0; } <START> if (this.getStartDate() != null) { <END> if (that.getStartDate() != null) { return this.getStartDate().compareTo(that.getStartDate()); } else { return 1; } } else { if (that.getStartDate() != null) { return -1; } else { return 0; } } }</code><technical_language>ComparisonChain pls</technical_language>

Target:
public int compareTo(TemporalField<T> that) { if (this == that) { return 0; } return ComparisonChain.start() .compare(this.startDate, that.startDate, Ordering.natural().nullsLast()) .result(); }
Source:
<code>private void handleBlogRemoved() { if (!AccountHelper.isSignedIn()) { ActivityLauncher.showSignInForResult(this); } else { MySiteFragment mySiteFragment = getMySiteFragment(); if (mySiteFragment != null) { List<Map<String, Object>> allBlogs = WordPress.wpDB.getAllBlogs(); <START> if (allBlogs.isEmpty()) { <END> mySiteFragment.setBlog(null); } else { showSitePickerWithCurrentBlog(); } } } }</code><technical_language>This is nitpicky, please feel free ignore. I wondering if sense add a method in WordPressDB return number of blogs. This path rarely, if all, deleting a site, if need similar checks in other places, I thought give a small performance boost</technical_language>

Target:
private void handleBlogRemoved() { if (!AccountHelper.isSignedIn()) { ActivityLauncher.showSignInForResult(this); } else { Blog blog = WordPress.getCurrentBlog(); MySiteFragment mySiteFragment = getMySiteFragment(); if (mySiteFragment != null) { mySiteFragment.setBlog(blog); } if (blog != null) { int blogId = blog.getLocalTableBlogId(); ActivityLauncher.showSitePickerForResult(this, blogId); } } }
Source:
<code>public static String map(org.ovirt.engine.core.common.businessentities.DisplayType type, String incoming) { <START> if (type==null) { <END> return null; } else { switch(type) { case vnc: return DisplayType.VNC.value(); case qxl: return DisplayType.SPICE.value(); default: return null; } } }</code><technical_language>i test failed suppose fail, NULL, iirc in GUI default display type for host is QXL for desktop VNC</technical_language>

Target:
public static String map(org.ovirt.engine.core.common.businessentities.DisplayType type, String incoming) { switch(type) { case vnc: return DisplayType.VNC.value(); case qxl: return DisplayType.SPICE.value(); default: return null; } }
Source:
<code>public List<String> saveJar(final List<ByteBuffer> jarFiles) throws IOException { final List<String> paths = new LinkedList<>(); for (final ByteBuffer jarFileBytes : jarFiles) { final byte[] byteBufferHash = HashUtils.getByteBufferHash(jarFileBytes); final ByteBuffer wrappedHash = ByteBuffer.wrap(byteBufferHash); final Tuple<ByteBuffer, String> jarInfo = hashInfoMap.get(wrappedHash); if (jarInfo != null) { if (Arrays.equals(jarFileBytes.array(), jarInfo.getKey().array())) { LOG.log(Level.INFO, "The jar file submitted was already previously submitted."); final String path = jarInfo.getValue(); paths.add(path); } else { <START> throw new RuntimeException("SHA-256 hash collision between two different files."); <END> } } else { final String path = String.format("submitted-%s.jar", fileNameGenerator.generate()); LOG.log(Level.INFO, "New jar " + path + " was submitted."); final Path jarFilePath = Paths.get(tmpFolderPath, path); hashInfoMap.put(wrappedHash, new Tuple<>(jarFileBytes, jarFilePath.toString())); final File jarFile = jarFilePath.toFile(); final FileChannel wChannel = new FileOutputStream(jarFile, false).getChannel(); wChannel.write(jarFileBytes); wChannel.close(); paths.add(jarFile.getAbsolutePath()); } } return paths; }</code><technical_language>I handle this situation</technical_language>

Target:
public List<String> saveJar(final List<ByteBuffer> jarFiles) throws IOException { final List<String> paths = new LinkedList<>(); for (final ByteBuffer jarFileBytes : jarFiles) { final byte[] byteBufferHash = HashUtils.getByteBufferHash(jarFileBytes); final ByteBuffer wrappedHash = ByteBuffer.wrap(byteBufferHash); List<Tuple<ByteBuffer, String>> jarInfoList = hashInfoMap.get(wrappedHash); if (jarInfoList != null) { synchronized (jarInfoList) { if (!checkSameJar(jarFileBytes, jarInfoList, paths)) { final String path = String.format("submitted-%s.jar", fileNameGenerator.generate()); LOG.log(Level.INFO, "New jar " + path + " was submitted with a SHA-256 hash collision."); final Path jarFilePath = Paths.get(tmpFolderPath, path); jarInfoList.add(new Tuple<>(jarFileBytes, jarFilePath.toString())); createJarFile(jarFileBytes, jarFilePath, paths); } } } else { final String path = String.format("submitted-%s.jar", fileNameGenerator.generate()); final Path jarFilePath = Paths.get(tmpFolderPath, path); final List<Tuple<ByteBuffer, String>> newPathsList = new ArrayList<>(); final Tuple<ByteBuffer, String> newJarTuple = new Tuple<>(jarFileBytes, jarFilePath.toString()); newPathsList.add(newJarTuple); if (hashInfoMap.putIfAbsent(wrappedHash, newPathsList) == null) { LOG.log(Level.INFO, "New jar " + path + " was submitted."); createJarFile(jarFileBytes, jarFilePath, paths); } else { jarInfoList = hashInfoMap.get(wrappedHash); synchronized (jarInfoList) { if (!checkSameJar(jarFileBytes, jarInfoList, paths)) { LOG.log(Level.INFO, "New jar " + path + " was submitted with a SHA-256 hash collision."); jarInfoList.add(newJarTuple); createJarFile(jarFileBytes, jarFilePath, paths); } } } } } return paths; }
Source:
<code>public void setUp() throws Exception { reset(violationServiceMock, mockTeamOperations, mockViolationConverter); createViolation = new CreateViolation(); createViolation.setEventId(UUID.randomUUID().toString()); createViolation.setAccountId("2547093960"); createViolation.setRegion("eu-west-1"); <START> createViolation.setMetaInfo("this is a meta info object of string"); <END> createViolation.setViolationType("OUTDATED_TAUPAGE"); createViolation.setInstanceId("eu-2174329546"); createViolation.setUsername("testuser"); createViolation.setApplicationId("testapp"); createViolation.setApplicationVersion("2"); violationRequest = new Violation(); violationRequest.setAccountId(ACCOUNT_ID); violationRequest.setRegion(REGION); violationRequest.setEventId(UUID.randomUUID().toString()); violationResult = INITIALIZER.create(violation().id(0L).version(0L)); SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("test-user", null)); mockMvc = MockMvcBuilders.webAppContextSetup(wac).alwaysDo(print()).build(); objectMapper = new ObjectMapper(); when(mockViolationConverter.convert(any(ViolationEntity.class))).thenAnswer(invocationOnMock -> { final ViolationEntity entity = (ViolationEntity) invocationOnMock.getArguments()[0]; final Violation dto = new Violation(); dto.setId(entity.getId()); return dto; }); }</code><technical_language>please test meta info of type Map<String,String> this is more common case</technical_language>

Target:
public void setUp() throws Exception { reset(violationServiceMock, mockTeamOperations, mockViolationConverter); Map<String, String> metainfo = new HashMap<String, String>(); metainfo.put("info", "meta info test string"); createViolation = new CreateViolation(); createViolation.setEventId(UUID.randomUUID().toString()); createViolation.setAccountId("2547093960"); createViolation.setRegion("eu-west-1"); createViolation.setMetaInfo(metainfo); createViolation.setViolationType("OUTDATED_TAUPAGE"); createViolation.setInstanceId("eu-2174329546"); createViolation.setUsername("testuser"); createViolation.setApplicationId("testapp"); createViolation.setApplicationVersion("2"); violationRequest = new Violation(); violationRequest.setAccountId(ACCOUNT_ID); violationRequest.setRegion(REGION); violationRequest.setEventId(UUID.randomUUID().toString()); violationResult = INITIALIZER.create(violation().id(0L).version(0L)); SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("test-user", null)); mockMvc = MockMvcBuilders.webAppContextSetup(wac).alwaysDo(print()).build(); objectMapper = new ObjectMapper(); when(mockViolationConverter.convert(any(ViolationEntity.class))).thenAnswer(invocationOnMock -> { final ViolationEntity entity = (ViolationEntity) invocationOnMock.getArguments()[0]; final Violation dto = new Violation(); dto.setId(entity.getId()); return dto; }); }
Source:
<code>public static void tick() { Iterator<AsyncCubeIOProvider> cubeItr = cubeTasks.values().iterator(); while (cubeItr.hasNext()) { AsyncCubeIOProvider task = cubeItr.next(); if (task.isFinished()) { if (task.hasCallbacks()) { task.runCallbacks(); } task.runSynchronousPart(); cubeItr.remove(); } } Iterator<AsyncColumnIOProvider> columnIter = columnTasks.values().iterator(); while (columnIter.hasNext()) { AsyncColumnIOProvider task = columnIter.next(); if (task.isFinished()) { if (task.hasCallbacks()) { task.runCallbacks(); } <START> task.runSynchronousPart(); <END> columnIter.remove(); } } }</code><technical_language>Is reason split of callbacks runSynchronousPart()? call in location</technical_language>

Target:
public static void tick() { Iterator<AsyncCubeIOProvider> cubeItr = cubeTasks.values().iterator(); while (cubeItr.hasNext()) { AsyncCubeIOProvider task = cubeItr.next(); if (task.isFinished()) { task.runSynchronousPart(); cubeItr.remove(); } } Iterator<AsyncColumnIOProvider> columnIter = columnTasks.values().iterator(); while (columnIter.hasNext()) { AsyncColumnIOProvider task = columnIter.next(); if (task.isFinished()) { task.runSynchronousPart(); columnIter.remove(); } } }
Source:
<code>private void preprocessParameters(StudentProfileAttributes studentProfile) { if(studentProfile.shortName != null){ <START> studentProfile.shortName = studentProfile.shortName.trim();; <END> } if(studentProfile.email != null){ studentProfile.email = studentProfile.email.trim(); } if(studentProfile.gender != null){ studentProfile.gender = studentProfile.gender.trim(); } if(studentProfile.nationality != null){ studentProfile.nationality = studentProfile.nationality.trim(); } if(studentProfile.institute != null){ studentProfile.institute = studentProfile.institute.trim(); } if(studentProfile.moreInfo != null){ studentProfile.moreInfo = studentProfile.moreInfo.trim(); } }</code><technical_language>double semicolon</technical_language>

Target:
private void preprocessParameters(StudentProfileAttributes studentProfile) { studentProfile.shortName = StringHelper.trimIfNotNull(studentProfile.shortName); studentProfile.email = StringHelper.trimIfNotNull(studentProfile.email); studentProfile.gender = StringHelper.trimIfNotNull(studentProfile.gender); studentProfile.nationality = StringHelper.trimIfNotNull(studentProfile.nationality); studentProfile.institute = StringHelper.trimIfNotNull(studentProfile.institute); studentProfile.moreInfo = StringHelper.trimIfNotNull(studentProfile.moreInfo); }
Source:
<code>public Object clone() { final Radiogroup clone = (Radiogroup) super.clone(); fixClone(clone); if (clone._model != null) { if (clone._model instanceof ComponentCloneListener) { final ListModel model = (ListModel) ((ComponentCloneListener) clone._model).willClone(clone); if (model != null) clone._model = model; } clone._dataListener = null; clone.initDataListener(); } <START> getRadio(clone); <END> if (_interns != null) { for (Radio radio : _interns) { radio.setRadiogroup(clone); } clone.setSelectedIndex(-1); } return clone; }</code><technical_language>Fix Radio instead</technical_language>

Target:
public Object clone() { final Radiogroup clone = (Radiogroup) super.clone(); fixClone(clone); if (clone._model != null) { if (clone._model instanceof ComponentCloneListener) { final ListModel model = (ListModel) ((ComponentCloneListener) clone._model).willClone(clone); if (model != null) clone._model = model; } clone._dataListener = null; clone.initDataListener(); } return clone; }
Source:
<code><START> public <T extends ExtractionNamespace> Future<?> schedule(final T namespace) <END> { final ExtractionNamespaceFunctionFactory<T> factory = (ExtractionNamespaceFunctionFactory<T>) namespaceFunctionFactoryMap.get(namespace.getClass()); if (factory == null) { throw new ISE("Cannot find factory for namespace [%s]", namespace); } final String cacheId = UUID.randomUUID().toString(); return schedule(namespace, factory, getPostRunnable(namespace, factory, cacheId), cacheId); }</code><technical_language>reason changing this a regular Future? ListenableFuture if possible</technical_language>

Target:
public <T extends ExtractionNamespace> ListenableFuture<?> schedule(final T namespace) { final ExtractionNamespaceFunctionFactory<T> factory = (ExtractionNamespaceFunctionFactory<T>) namespaceFunctionFactoryMap.get(namespace.getClass()); if (factory == null) { throw new ISE("Cannot find factory for namespace [%s]", namespace); } final String cacheId = UUID.randomUUID().toString(); return schedule(namespace, factory, getPostRunnable(namespace, factory, cacheId), cacheId); }
Source:
<code>protected void addProvider(Provider<Rule> provider) { super.addProvider(provider); Collection<Rule> rules = new LinkedList<Rule>(elementMap.get(provider)); for (Rule rule : rules) { try { Rule resolvedRule = resolveRuleByTemplate(rule); if (rule != resolvedRule) { update(resolvedRule); } <START> } catch (Exception e) { <END> logger.error("Added rule '{}' is invalid", rule.getUID(), e); } } }</code><technical_language>catch generic Exceptions. this more specific</technical_language>

Target:
protected void addProvider(Provider<Rule> provider) { super.addProvider(provider); Collection<Rule> rules = new LinkedList<Rule>(elementMap.get(provider)); for (Rule rule : rules) { try { Rule resolvedRule = resolveRuleByTemplate(rule); if (rule != resolvedRule && provider instanceof ManagedRuleProvider) { update(resolvedRule); } } catch (IllegalArgumentException e) { logger.error("Added rule '{}' is invalid", rule.getUID(), e); } } }
Source:
<code>public Option[] config() { <START> return new Option[] { carbonDistribution(Paths.get("target", "wso2carbon-kernel-test-5.2.0-SNAPSHOT")), }; <END> }</code><technical_language>5.2.0-SNAPSHOT, this break test case in next release, Instead derive programmatically, based current version</technical_language>

Target:
public Option[] config() { return new Option[] { carbonDistribution( Paths.get("target", "wso2carbon-kernel-test-" + System.getProperty("carbon.kernel.version"))), }; }
Source:
<code>public void usedBy() { final MetadataService metadataService = gd.getMetadataService(); final String uri = metadataService.findUris(project, identifier("attr.person.department")).iterator().next(); <START> metadataService.usedBy(project, uri, false); <END> }</code><technical_language>add assert</technical_language>

Target:
public void usedBy() { final MetadataService metadataService = gd.getMetadataService(); final String uri = metadataService.findUris(project, identifier("attr.person.department")).iterator().next(); final Collection<Entry> usage = metadataService.usedBy(project, uri, false); assertThat(usage, hasSize(5)); }
Source:
<code>public AuthenticationConfiguration create() { String mech = saslMechanism == null ? "SCRAM-SHA-512" : saslMechanism; CallbackHandler cbh = callbackHandler; <START> if (cbh == null) { <END> if ("OAUTHBEARER".equals(mech)) { if (token != null) { cbh = new TokenCallbackHandler(token); } else { throw HOTROD.oauthBearerWithoutToken(); } } else if (username != null) { cbh = new BasicCallbackHandler(username, realm != null ? realm : DEFAULT_REALM, password); } else if ("EXTERNAL".equals(mech) || "GSSAPI".equals(mech) || "GS2-KRB5".equals(mech)) { cbh = new VoidCallbackHandler(); } } return new AuthenticationConfiguration(cbh, clientSubject, enabled, mech, saslProperties, serverName); }</code><technical_language>constant string in a single place</technical_language>

Target:
public AuthenticationConfiguration create() { String mech = saslMechanism == null ? DEFAULT_MECHANISM : saslMechanism; CallbackHandler cbh = callbackHandler; if (cbh == null) { if (OAUTHBEARER_MECH.equals(mech)) { cbh = new TokenCallbackHandler(token); } else if (username != null) { cbh = new BasicCallbackHandler(username, realm != null ? realm : DEFAULT_REALM, password); } else if (EXTERNAL_MECH.equals(mech) || GSSAPI_MECH.equals(mech) || GS2_KRB5_MECH.equals(mech)) { cbh = new VoidCallbackHandler(); } } return new AuthenticationConfiguration(cbh, clientSubject, enabled, mech, saslProperties, serverName != null ? serverName : DEFAULT_SERVER_NAME); }
Source:
<code>public void testIterateRegion() { Vector3i min = new Vector3i(2, 5, 7); Vector3i max = new Vector3i(10, 11, 12); BlockRegion region = new BlockRegion().unionBlock(min).unionBlock(max); Set<Vector3ic> expected = Sets.newHashSet(); for (int x = min.x; x <= max.x; ++x) { for (int y = min.y; y <= max.y; ++y) { for (int z = min.z; z <= max.z; ++z) { expected.add(new Vector3i(x, y, z)); } } } for (Vector3ic pos : BlockRegionIterable.region(region).build()) { assertTrue(expected.contains(pos), "unexpected position: " + pos); expected.remove(pos); } assertEquals(0, expected.size(), "All vectors provided"); <START> } <END></code><technical_language>usage of unionBlock() in intersection tests is absolutely irrelevant. min-max constructor adjust expected values necessary</technical_language>

Target:
public void testIterateRegion() { Vector3i min = new Vector3i(2, 5, 7); Vector3i max = new Vector3i(10, 11, 12); BlockRegion region = new BlockRegion(min,max); Set<Vector3ic> expected = Sets.newHashSet(); for (int x = min.x; x <= max.x; ++x) { for (int y = min.y; y <= max.y; ++y) { for (int z = min.z; z <= max.z; ++z) { expected.add(new Vector3i(x, y, z)); } } } for (Vector3ic pos : BlockRegionIterable.region(region).build()) { assertTrue(expected.contains(pos), "unexpected position: " + pos); expected.remove(pos); } assertEquals(0, expected.size(), "All vectors provided"); }
Source:
<code>public String getDownloadUrl(String repositoryName, String docId, String xpath, String filename, String changeToken) { StringBuilder sb = new StringBuilder(); sb.append(NXFILE); sb.append("/").append(repositoryName); sb.append("/").append(docId); if (xpath != null) { sb.append("/").append(xpath); if (filename != null) { filename = getSanitizedFilenameWithoutPath(filename); sb.append("/").append(URIUtils.quoteURIPathComponent(filename, true)); } } <START> if (StringUtils.isNotBlank(changeToken)) { <END> sb.append("?").append(CoreSession.CHANGE_TOKEN).append("=").append(changeToken); } return sb.toString(); }</code><technical_language>isNotBlank -> isNotEmpty</technical_language>

Target:
public String getDownloadUrl(String repositoryName, String docId, String xpath, String filename, String changeToken) { StringBuilder sb = new StringBuilder(); sb.append(NXFILE); sb.append("/").append(repositoryName); sb.append("/").append(docId); if (xpath != null) { sb.append("/").append(xpath); if (filename != null) { filename = getSanitizedFilenameWithoutPath(filename); sb.append("/").append(URIUtils.quoteURIPathComponent(filename, true)); } } if (StringUtils.isNotEmpty(changeToken)) { try { sb.append("?") .append(CoreSession.CHANGE_TOKEN) .append("=") .append(URLEncoder.encode(changeToken, "UTF-8")); } catch (UnsupportedEncodingException e) { log.error("Cannot append changeToken", e); } } return sb.toString(); }
Source:
<code>protected String[] customCommandLineValidation() { <START> List<String> errors = new ArrayList<>(); <END> if (OUTPUT_BASE == null) { OUTPUT_BASE = INPUT_BASE; } if (PRE_ADAPTER_IN == null) { if (INPUT_BASE == null) { errors.add("Must specify either INPUT_BASE or PRE_ADAPTER_IN"); } PRE_ADAPTER_IN = new File(INPUT_BASE + SequencingArtifactMetrics.PRE_ADAPTER_DETAILS_EXT); } if (BAIT_BIAS_IN == null) { if (INPUT_BASE == null) { errors.add("Must specify either INPUT_BASE or BAIT_BIAS_IN"); } BAIT_BIAS_IN = new File(INPUT_BASE + SequencingArtifactMetrics.BAIT_BIAS_DETAILS_EXT); } if (OXOG_OUT == null) { if (OUTPUT_BASE == null) { errors.add("Must specify either OUTPUT_BASE or OXOG_OUT"); } OXOG_OUT = new File(OUTPUT_BASE + OXOG_METRICS_EXT); } if (errors.isEmpty()) { return null; } return errors.toArray(new String[0]); }</code><technical_language>final</technical_language>

Target:
protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<>(); if (OUTPUT_BASE == null) { OUTPUT_BASE = INPUT_BASE; } if (PRE_ADAPTER_IN == null) { if (INPUT_BASE == null) { errors.add("Must specify either INPUT_BASE or PRE_ADAPTER_IN"); } PRE_ADAPTER_IN = new File(INPUT_BASE + SequencingArtifactMetrics.PRE_ADAPTER_DETAILS_EXT); } if (BAIT_BIAS_IN == null) { if (INPUT_BASE == null) { errors.add("Must specify either INPUT_BASE or BAIT_BIAS_IN"); } BAIT_BIAS_IN = new File(INPUT_BASE + SequencingArtifactMetrics.BAIT_BIAS_DETAILS_EXT); } if (OXOG_OUT == null) { if (OUTPUT_BASE == null) { errors.add("Must specify either OUTPUT_BASE or OXOG_OUT"); } OXOG_OUT = new File(OUTPUT_BASE + OXOG_METRICS_EXT); } if (errors.isEmpty()) { return null; } return errors.toArray(new String[0]); }
Source:
<code>public void test_buildCFG_with_method() { CompilationUnitTree tree = parse("<?php\n" + "class A {\n" + "function foo() {\n" + "echo 'Hello';" + "}" + "abstract function bar();" + "}", PHPLexicalGrammar.COMPILATION_UNIT); ClassDeclarationTree cls = (ClassDeclarationTree) tree.script().statements().get(0); MethodDeclarationTree method = (MethodDeclarationTree) cls.members().get(0); StatementTree echo = ((BlockTree) method.body()).statements().get(0); ControlFlowGraph cfg = ControlFlowGraph.build(method, checkContext); assertThat(cfg.start().elements().get(0)).isEqualTo(echo); MethodDeclarationTree abstractMethod = (MethodDeclarationTree) cls.members().get(1); <START> cfg = ControlFlowGraph.build(abstractMethod.body(), checkContext); <END> assertThat(cfg).isNull(); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Failed to build control flow graph for file [mock.php] at line 4"); assertThat(logTester.logs(LoggerLevel.WARN)).contains("Unexpected tree kind TOKEN"); }</code><technical_language>a weird test, pass method, body return null warning</technical_language>

Target:
public void test_buildCFG_with_method() { CompilationUnitTree tree = parse("<?php " + "class A {" + " function foo() {" + " echo 'Hello';" + " }" + " abstract function bar();" + "}", PHPLexicalGrammar.COMPILATION_UNIT); ClassDeclarationTree cls = (ClassDeclarationTree) tree.script().statements().get(0); MethodDeclarationTree method = (MethodDeclarationTree) cls.members().get(0); StatementTree echo = ((BlockTree) method.body()).statements().get(0); ControlFlowGraph cfg = ControlFlowGraph.build(method, checkContext); assertThat(cfg.start().elements().get(0)).isEqualTo(echo); MethodDeclarationTree abstractMethod = (MethodDeclarationTree) cls.members().get(1); cfg = ControlFlowGraph.build(abstractMethod, checkContext); assertThat(cfg).isNull(); }
Source:
<code>protected CompoundNBT writeProcessToNBT(MultiblockProcess process) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>This changed write ID of recipe, for readRecipeFromNBT</technical_language>

Target:
protected CompoundNBT writeProcessToNBT(MultiblockProcess process) { CompoundNBT tag = new CompoundNBT(); tag.putString("recipe", process.recipe.getId().toString()); tag.putInt("process_processTick", process.processTick); process.writeExtraDataToNBT(tag); return tag; }
Source:
<code>public static boolean equalDate(Date rhs, Date lhs) { <START> return rhs != null && lhs != null && (rhs.getDate() == lhs.getDate()) && (rhs.getMonth() == lhs.getMonth()) && (rhs.getYear() == lhs.getYear()); <END> }</code><technical_language>change this rhs == lhs instead of rhs != && lhs != null run a quick test if works Edit: instead of so: (lhs == rhs) || (rhs != null && lhs != null && (rhs.getDate() == lhs.getDate()) && (rhs.getMonth() == lhs.getMonth()) && (rhs.getYear() == lhs.getYear()))</technical_language>

Target:
public static boolean equalDate(Date rhs, Date lhs) { return (lhs == rhs) || (rhs != null && lhs != null && (rhs.getDate() == lhs.getDate()) && (rhs.getMonth() == lhs.getMonth()) && (rhs.getYear() == lhs.getYear())); }
Source:
<code>private void handleContent(HttpContent httpContent) throws RestServiceException { if (request != null && !requestContentFullyReceived) { long processingStartTime = System.currentTimeMillis(); nettyMetrics.bytesReadRate.mark(httpContent.content().readableBytes()); try { logger.trace("Received content for request - {}", request.getUri()); try { requestContentFullyReceived = httpContent instanceof LastHttpContent; request.addContent(httpContent); } catch (IllegalStateException e) { nettyMetrics.contentAdditionError.inc(); throw new RestServiceException(e, RestServiceErrorCode.InvalidRequestState); } catch (ClosedChannelException e) { nettyMetrics.contentAdditionError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } } finally { long chunkProcessingTime = System.currentTimeMillis() - processingStartTime; nettyMetrics.requestChunkProcessingTimeInMs.update(chunkProcessingTime); request.getMetricsTracker().nioMetricsTracker.addToRequestProcessingTime(chunkProcessingTime); } if (!request.getRestMethod().equals(RestMethod.POST)) { requestHandler.handleRequest(request, responseChannel); } } else { <START> resetState(); <END> logger.warn("Received content without a request on channel {}", ctx.channel()); nettyMetrics.noRequestError.inc(); throw new RestServiceException("Received content without a request", RestServiceErrorCode.InvalidRequestState); } }</code><technical_language>log statement line 296 fixed. w/o a request. w/o a request for a content for processed request</technical_language>

Target:
private void handleContent(HttpContent httpContent) throws RestServiceException { if (request != null && !requestContentFullyReceived) { long processingStartTime = System.currentTimeMillis(); nettyMetrics.bytesReadRate.mark(httpContent.content().readableBytes()); try { logger.trace("Received content for request - {}", request.getUri()); try { requestContentFullyReceived = httpContent instanceof LastHttpContent; request.addContent(httpContent); } catch (IllegalStateException e) { nettyMetrics.contentAdditionError.inc(); throw new RestServiceException(e, RestServiceErrorCode.InvalidRequestState); } catch (ClosedChannelException e) { nettyMetrics.contentAdditionError.inc(); throw new RestServiceException("The request has been closed and is not accepting content", RestServiceErrorCode.RequestChannelClosed); } } finally { long chunkProcessingTime = System.currentTimeMillis() - processingStartTime; nettyMetrics.requestChunkProcessingTimeInMs.update(chunkProcessingTime); request.getMetricsTracker().nioMetricsTracker.addToRequestProcessingTime(chunkProcessingTime); } if (!request.getRestMethod().equals(RestMethod.POST)) { requestHandler.handleRequest(request, responseChannel); } } else { resetState(); logger.warn("Received content when it was not expected on channel {}", ctx.channel()); nettyMetrics.noRequestError.inc(); throw new RestServiceException("Received content without a request", RestServiceErrorCode.InvalidRequestState); } }
Source:
<code>private void touchConfig() { final int dynamicCoreSize = properties.coreSize().get(); final int configuredMaximumSize = properties.maximumSize().get(); int dynamicMaximumSize = properties.actualMaximumSize(); final boolean allowSizesToDiverge = properties.getAllowMaximumSizeToDivergeFromCoreSize().get(); boolean maxTooLow = false; if (allowSizesToDiverge && configuredMaximumSize < dynamicCoreSize) { dynamicMaximumSize = dynamicCoreSize; maxTooLow = true; } if (threadPool.getCorePoolSize() != dynamicCoreSize || (allowSizesToDiverge && threadPool.getMaximumPoolSize() != dynamicMaximumSize)) { if (maxTooLow) { logger.error("Hystrix ThreadPool configuration for : " + metrics.getThreadPoolKey().name() + " is trying to set coreSize = " + dynamicCoreSize + " and maximumSize = " + configuredMaximumSize + ". Maximum size will be set to " + dynamicMaximumSize + ", the coreSize value, since it must be equal to or greater than the coreSize value"); } if (dynamicMaximumSize > dynamicCoreSize) { threadPool.setMaximumPoolSize(dynamicMaximumSize); threadPool.setCorePoolSize(dynamicCoreSize); } else { threadPool.setMaximumPoolSize(dynamicMaximumSize); threadPool.setCorePoolSize(dynamicCoreSize); <START> } <END> } threadPool.setKeepAliveTime(properties.keepAliveTimeMinutes().get(), TimeUnit.MINUTES); }</code><technical_language>difference if else part? me. if this works in cases, change ... threadPool.setMaximumPoolSize(dynamicMaximumSize); threadPool.setCorePoolSize(dynamicCoreSize); :slightly_smiling_face:</technical_language>

Target:
private void touchConfig() { final int dynamicCoreSize = properties.coreSize().get(); final int configuredMaximumSize = properties.maximumSize().get(); int dynamicMaximumSize = properties.actualMaximumSize(); final boolean allowSizesToDiverge = properties.getAllowMaximumSizeToDivergeFromCoreSize().get(); boolean maxTooLow = false; if (allowSizesToDiverge && configuredMaximumSize < dynamicCoreSize) { dynamicMaximumSize = dynamicCoreSize; maxTooLow = true; } if (threadPool.getCorePoolSize() != dynamicCoreSize || (allowSizesToDiverge && threadPool.getMaximumPoolSize() != dynamicMaximumSize)) { if (maxTooLow) { logger.error("Hystrix ThreadPool configuration for : " + metrics.getThreadPoolKey().name() + " is trying to set coreSize = " + dynamicCoreSize + " and maximumSize = " + configuredMaximumSize + ". Maximum size will be set to " + dynamicMaximumSize + ", the coreSize value, since it must be equal to or greater than the coreSize value"); } if (dynamicMaximumSize > dynamicCoreSize) { threadPool.setMaximumPoolSize(dynamicMaximumSize); threadPool.setCorePoolSize(dynamicCoreSize); } else { threadPool.setMaximumPoolSize(dynamicMaximumSize); threadPool.setCorePoolSize(dynamicMaximumSize); } } threadPool.setKeepAliveTime(properties.keepAliveTimeMinutes().get(), TimeUnit.MINUTES); }
Source:
<code>public void deleteAlarm(OnmsAlarm alarm) { LOG.info("Deleting alarm with id: with severity: {}", alarm.getId(), alarm.getSeverity()); final OnmsAlarm alarmInTrans = alarmDao.get(alarm.getId()); if (alarmInTrans == null) { LOG.warn("Alarm disappeared: {}. Skipping delete.", alarm); return; } if (alarmInTrans.isPartOfSituation()) { for (OnmsAlarm situation : alarmInTrans.getRelatedSituations()) { <START> alarmEntityNotifier.didUpdateRelatedAlarms(situation, situation.getRelatedAlarms()); <END> } } alarmDao.delete(alarmInTrans); alarmEntityNotifier.didDeleteAlarm(alarmInTrans); }</code><technical_language>This issued call alarmDao#delete. situation.getRelatedAlarms() alarm deleted</technical_language>

Target:
public void deleteAlarm(OnmsAlarm alarm) { LOG.info("Deleting alarm with id: with severity: {}", alarm.getId(), alarm.getSeverity()); final OnmsAlarm alarmInTrans = alarmDao.get(alarm.getId()); if (alarmInTrans == null) { LOG.warn("Alarm disappeared: {}. Skipping delete.", alarm); return; } Map<OnmsAlarm, Set<OnmsAlarm>> priorRelatedAlarms = new HashMap<>(); if (alarmInTrans.isPartOfSituation()) { for (OnmsAlarm situation : alarmInTrans.getRelatedSituations()) { priorRelatedAlarms.put(situation, new HashSet<OnmsAlarm>(situation.getRelatedAlarms())); } } alarmDao.delete(alarmInTrans); for (Entry<OnmsAlarm, Set<OnmsAlarm>> entry : priorRelatedAlarms.entrySet()) { alarmEntityNotifier.didUpdateRelatedAlarms(entry.getKey(), entry.getValue()); } alarmEntityNotifier.didDeleteAlarm(alarmInTrans); }
Source:
<code>private void updateLabels(IApplicationSource source) { if (source != null) { if (ResourceKind.TEMPLATE.equals(source.getKind())) { ITemplate template = (ITemplate)source.getSource(); setLabels(template.getObjectLabels()); } else { <START> setLabels(Arrays.asList(new Label("app", source.getSource().getName()))); <END> } } }</code><technical_language>please a speaking constant for "app"? expose this hard-coded label in a prominent place right top of class (and a speaking name unveil is for)</technical_language>

Target:
private void updateLabels(IApplicationSource source) { if (source != null) { if (ResourceKind.TEMPLATE.equals(source.getKind())) { ITemplate template = (ITemplate)source.getSource(); setLabels(template.getObjectLabels()); } else { setLabels(Arrays.asList(new Label(APP_LABEL_NAME, source.getSource().getName()))); } } }
Source:
<code>public HqlQueryBuilder whereNotInAny(String propertyName, Collection<?> values) { if (values != null) { if (values.isEmpty()) { <START> where("1=0"); <END> } else { where(propertyName + " not in (:" + nextPositionIndex() + ")").withValue(values); } } return this; }</code><technical_language>If values empty, return true false</technical_language>

Target:
public HqlQueryBuilder whereNotInAny(String propertyName, Collection<?> values) { if (values != null) { if (values.isEmpty()) { where("1=1"); } else { where(propertyName + " not in (:" + nextPositionIndex() + ")").withValue(values); } } return this; }
Source:
<code>public void serializeWithType(PlanNode value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { if (rootLevel) { rootLevel = false; JsonSerializer<Object> subTypeSerializer = provider.findTypedValueSerializer(value.getClass(), true, null); subTypeSerializer.serializeWithType(value, gen, serializers, typeSer); <START> rootLevel = true; <END> return; } superTypeSerializer.serializeWithType(value, gen, serializers, typeSer); }</code><technical_language>a finally</technical_language>

Target:
public void serializeWithType(PlanNode value, JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { if (rootLevel) { rootLevel = false; try { JsonSerializer<Object> subTypeSerializer = provider.findTypedValueSerializer(value.getClass(), true, null); subTypeSerializer.serializeWithType(value, gen, serializers, typeSer); } finally { rootLevel = true; } return; } superTypeSerializer.serializeWithType(value, gen, serializers, typeSer); }
Source:
<code>public void testSuffixRoles() { String[] stringRoles = {"foo", "bar"}; String suffix = "suffix"; Roles roles = createRoles(stringRoles); Roles suffixRoles = roles.addSuffix(suffix); for (String s : stringRoles) { assertTrue(suffixRoles.contains(s + suffix)); } int count = 0; for (Iterator<String> iterator = suffixRoles.iterator(); iterator.hasNext(); ) { iterator.next(); count++; } <START> assertTrue(count == 2); <END> }</code><technical_language>assertEquals ;)</technical_language>

Target:
public void testSuffixRoles() { String[] stringRoles = {"foo", "bar"}; String suffix = "suffix"; Roles roles = createRoles(stringRoles); Roles suffixRoles = roles.addSuffix(suffix); for (String s : stringRoles) { assertTrue(suffixRoles.contains(s + suffix)); } int count = 0; for (Iterator<String> iterator = suffixRoles.iterator(); iterator.hasNext(); ) { iterator.next(); count++; } assertEquals(count, 2); }
Source:
<code>public static String getResponseDataAlways(@Nullable final HttpResponse response) { if (response == null) { return null; } <START> return getResponseDataNoError(response, false); <END> }</code><technical_language>shorter java return response != null ? getResponseDataNoError(response, false) : null;</technical_language>

Target:
public static String getResponseDataAlways(@Nullable final HttpResponse response) { return response != null ? getResponseDataNoError(response, false) : null; }
Source:
<code>private boolean generatesPrivateConstructor(ClassTree classTree) { if (usesAnnotation(classTree, GENERATE_PRIVATE_CONSTRUCTOR)) { return true; } SymbolMetadata metadata = classTree.symbol().metadata(); <START> for (String annotation : GENERATE_CONSTRUCTOR) { <END> if (metadata.isAnnotatedWith(annotation) && generatesPrivateAccess(metadata, annotation)) { return true; } } return false; }</code><technical_language>replace this part : return GENERATE_CONSTRUCTOR.stream().anyMatch(metadata -> metadata.isAnnotatedWith(annotation) && generatesPrivateAccess(metadata, annotation)); I move isAnnotatedWith(annotation)directly in gernatePrivateAccess method, stream simpler</technical_language>

Target:
private static boolean generatesPrivateConstructor(ClassTree classTree) { if (usesAnnotation(classTree, GENERATE_PRIVATE_CONSTRUCTOR)) { return true; } SymbolMetadata metadata = classTree.symbol().metadata(); return GENERATE_CONSTRUCTOR.stream() .map(metadata::valuesForAnnotation) .filter(Objects::nonNull) .anyMatch(LombokFilter::generatesPrivateAccess); }
Source:
<code>public void testLogEntryDoesntLogWhenLogLevelInactive() throws Exception { Log log = mock(Log.class); <START> when(log.isDebugEnabled()).thenReturn(false); <END> LoggedUtils.logEntry(log, "", new LoggedOverridingSubclass()); }</code><technical_language>need mock, this is default value</technical_language>

Target:
public void testLogEntryDoesntLogWhenLogLevelInactive() throws Exception { Log log = mock(Log.class); LoggedUtils.logEntry(log, "", new LoggedOverridingSubclass()); verify(log, never()).traceFormat(any(String.class), any()); verify(log, never()).debugFormat(any(String.class), any()); verify(log, never()).infoFormat(any(String.class), any()); verify(log, never()).warnFormat(any(String.class), any()); verify(log, never()).errorFormat(any(String.class), any()); verify(log, never()).fatalFormat(any(String.class), any()); }
Source:
<code>private <R extends Row, T> ListenableFuture<Result> issueAsyncRowRequest( BulkOperation bulkOperation, Row row, Batch.Callback<T> callback, Object[] results, int index) { <START> LOG.trace("issueRowRequest(Row, Batch.Callback, Object[], index"); <END> SettableFuture<Result> resultFuture = SettableFuture.create(); RpcResultFutureCallback<T> futureCallback = new RpcResultFutureCallback<T>(row, callback, index, results, resultFuture); results[index] = null; if (service.isShutdown()) { ListenableFuture<? extends GeneratedMessage> failFuture = Futures.immediateFailedFuture(new IOException( "Cannot perform batch operations when a connection is closed")); Futures.addCallback(failFuture, futureCallback); } else { ListenableFuture<? extends GeneratedMessage> future = issueAsyncRequest(bulkOperation, row); Futures.addCallback(future, futureCallback, service); } return resultFuture; }</code><technical_language>This traces method signature</technical_language>

Target:
private <R extends Row, T> ListenableFuture<Result> issueAsyncRowRequest( BulkOperation bulkOperation, Row row, Batch.Callback<T> callback, Object[] results, int index) { LOG.trace("issueRowRequest(BulkOperation, Row, Batch.Callback, Object[], index"); SettableFuture<Result> resultFuture = SettableFuture.create(); RpcResultFutureCallback<T> futureCallback = new RpcResultFutureCallback<T>(row, callback, index, results, resultFuture); results[index] = null; if (service.isShutdown()) { ListenableFuture<? extends GeneratedMessage> failFuture = Futures.immediateFailedFuture(new IOException( "Cannot perform batch operations when a connection is closed")); Futures.addCallback(failFuture, futureCallback); } else { ListenableFuture<? extends GeneratedMessage> future = issueAsyncRequest(bulkOperation, row); Futures.addCallback(future, futureCallback, service); } return resultFuture; }
Source:
<code>private Subscription disconnect() { return Subscriptions.create(new Action0() { @Override public void call() { if (subscriptionCount.decrementAndGet() == 0) { <START> baseSubscription.unsubscribe(); <END> baseSubscription = new CompositeSubscription(); } } }); }</code><technical_language>I this disconnect source immediately if thread reaches L125 while another thread reaches L81 (because counter decremented 0 incremented 1 in thread), i.e. prevent reconnect</technical_language>

Target:
private Subscription disconnect() { return Subscriptions.create(new Action0() { @Override public void call() { lock.lock(); try { if (subscriptionCount.decrementAndGet() == 0) { baseSubscription.unsubscribe(); baseSubscription = new CompositeSubscription(); } } finally { lock.unlock(); } } }); }
Source:
<code>protected void setRuleManager(RuleManager ruleManager) { <START> this.callback = ruleManager; <END> }</code><technical_language>worth rename callback ruleManager</technical_language>

Target:
protected void setRuleManager(RuleManager ruleManager) { this.ruleManager = ruleManager; }