auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onReceive(final Context context, Intent intent) { Log.d(TAG, "Package changed: " + intent); if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) && <START> intent.getBooleanExtra(EXTRA_REPLACING, true)) || <END> ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) || ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) { final GcmDatabase database = new GcmDatabase(context); final String packageName = intent.getData().getSchemeSpecificPart(); Log.d(TAG, "Package removed or data cleared: " + packageName); final GcmDatabase.App app = database.getApp(packageName); if (app != null) { new Thread(new Runnable() { @Override public void run() { List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName); boolean deletedAll = true; for (GcmDatabase.Registration registration : registrations) { deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null; } if (deletedAll) { database.removeApp(packageName); } database.close(); } }).start(); } else { database.close(); } } }</code><technical_language>!intent.getBooleanExtra(EXTRA_REPLACING, false) instead of intent.getBooleanExtra(EXTRA_REPLACING, true)</technical_language>

Target:
public void onReceive(final Context context, Intent intent) { Log.d(TAG, "Package changed: " + intent); if ((ACTION_PACKAGE_REMOVED.contains(intent.getAction()) && intent.getBooleanExtra(EXTRA_DATA_REMOVED, false) && !intent.getBooleanExtra(EXTRA_REPLACING, false)) || ACTION_PACKAGE_FULLY_REMOVED.contains(intent.getAction()) || ACTION_PACKAGE_DATA_CLEARED.contains(intent.getAction())) { final GcmDatabase database = new GcmDatabase(context); final String packageName = intent.getData().getSchemeSpecificPart(); Log.d(TAG, "Package removed or data cleared: " + packageName); final GcmDatabase.App app = database.getApp(packageName); if (app != null) { new Thread(new Runnable() { @Override public void run() { List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName); boolean deletedAll = true; for (GcmDatabase.Registration registration : registrations) { deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null; } if (deletedAll) { database.removeApp(packageName); } database.close(); } }).start(); } else { database.close(); } } }
Source:
<code>public Armcc5CompilerParser() { <START> super(Messages._Warnings_Armcc5_ParserName(), <END> Messages._Warnings_Armcc5_LinkName(), Messages._Warnings_Armcc5_TrendName(), ARMCC5_WARNING_PATTERN); }</code><technical_language>Messages._Warnings_Armcc_ParserName on..</technical_language>

Target:
public Armcc5CompilerParser() { super(Messages._Warnings_Armcc_ParserName(), Messages._Warnings_Armcc_LinkName(), Messages._Warnings_Armcc_TrendName(), ARMCC5_WARNING_PATTERN); }
Source:
<code>public void setVisible (boolean visible) { checkWidget(); Canvas canvas = getParent(); canvas.blink = true; canvas.drawFlag = visible; <START> getDisplay().resetCaretTiming(); <END> if (visible == isVisible) return; isVisible = visible; if (!isFocusCaret ()) return; if (isVisible) { showCaret (); } else { hideCaret (); } }</code><technical_language>display.resetCaretTiming(). need call getDisplay() is a display field in Widget</technical_language>

Target:
public void setVisible (boolean visible) { checkWidget(); Canvas canvas = getParent(); canvas.blink = true; canvas.drawFlag = visible; display.resetCaretTiming(); if (visible == isVisible) return; isVisible = visible; if (!isFocusCaret ()) return; if (isVisible) { showCaret (); } else { hideCaret (); } }
Source:
<code>public void tearDown(final ManagementClient managementClient, final String containerId) { if (elytronDomainSetup != null) { <START> servletElytronDomainSetup.tearDown(managementClient, containerId); <END> ejbElytronDomainSetup.tearDown(managementClient, containerId); elytronDomainSetup.tearDown(managementClient, containerId); } else { super.tearDown(managementClient, containerId); } }</code><technical_language>This multiple tearDown affect another test cases. In case servletElytronDomainSetup.tearDown ejbElytronDomainSetup.tearDown thrown exception tearDown is called ServerSetupTask (ejbElytronDomainSetup elytronDomainSetup)</technical_language>

Target:
public void tearDown(final ManagementClient managementClient, final String containerId) { if (elytronDomainSetup != null) { Exception ex = null; try { servletElytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { ex = e; } try { ejbElytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { if (ex == null) ex = e; } try { elytronDomainSetup.tearDown(managementClient, containerId); } catch (Exception e) { if (ex == null) ex = e; } if (ex != null) throw new RuntimeException(ex); } else { super.tearDown(managementClient, containerId); } }
Source:
<code>private void loadFunctionNamespaceManager(File file) throws Exception { String functionNamespaceManagerId = getNameWithoutExtension(file.getName()); log.info("-- Loading function namespace manager from %s --", file); Map<String, String> properties = new HashMap<>(loadProperties(file)); String functionNamespaceManagerName = properties.remove("function-namespace-manager.name"); checkState(functionNamespaceManagerName != null, "Function namespace configuration %s does not contain function-namespace-manager.name", file.getAbsoluteFile()); <START> String functionNamespaces = properties.get("serving-namespaces"); <END> checkState(functionNamespaces != null, "Function namespace configuration %s does not contain serving-namespaces", file.getAbsoluteFile()); functionManager.loadFunctionNamespaceManager(functionNamespaceManagerName, functionNamespaceManagerId, SPLITTER.splitToList(functionNamespaces), properties); log.info("-- Added function namespaces [%s] using function namespace manager [%s] --", functionNamespaces, functionNamespaceManagerId); }</code><technical_language>Is this necessary? is this other here</technical_language>

Target:
private void loadFunctionNamespaceManager(File file) throws Exception { String catalogName = getNameWithoutExtension(file.getName()); log.info("-- Loading function namespace manager from %s --", file); Map<String, String> properties = new HashMap<>(loadProperties(file)); String functionNamespaceManagerName = properties.remove("function-namespace-manager.name"); checkState(functionNamespaceManagerName != null, "Function namespace configuration %s does not contain function-namespace-manager.name", file.getAbsoluteFile()); functionManager.loadFunctionNamespaceManager(functionNamespaceManagerName, catalogName, properties); log.info("-- Added function namespace manager [%s] --", catalogName); }
Source:
<code>public static void addURL(URL u) throws IOException { if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); <START> for (URL url : urls) { <END> if (StringUtils.equalsIgnoreCase(url.toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[] {u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }</code><technical_language>worth changing a deprecated class</technical_language>

Target:
public static void addURL(URL u) throws IOException { if (!(ClassLoader.getSystemClassLoader() instanceof URLClassLoader)) { return; } URLClassLoader sysLoader = (URLClassLoader) ClassLoader.getSystemClassLoader(); URL[] urls = sysLoader.getURLs(); for (int i = 0; i < urls.length; i++) { if (StringUtils.equalsIgnoreCase(urls[i].toString(), u.toString())) { if (log.isDebugEnabled()) { log.debug("URL " + u + " is already in the CLASSPATH"); } return; } } Class<URLClassLoader> sysclass = URLClassLoader.class; try { Method method = sysclass.getDeclaredMethod("addURL", parameters); method.setAccessible(true); method.invoke(sysLoader, new Object[] {u}); } catch (Throwable t) { t.printStackTrace(); throw new IOException("Error, could not add URL to system classloader"); } }
Source:
<code>public void testGroupByQuery() throws Exception { insertPeopleDocuments(); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); <START> final Query q = new Query(); <END> q.from(table); q.groupBy(table.getColumnByName("gender")); q .select(new SelectItem(table.getColumnByName("gender")), new SelectItem(FunctionType.MAX, table .getColumnByName("age")), new SelectItem(FunctionType.MIN, table.getColumnByName("age")), new SelectItem(FunctionType.COUNT, "*", "total"), new SelectItem(FunctionType.MIN, table .getColumnByName("id")).setAlias("firstId")); q.orderBy("gender"); final DataSet data = dataContext.executeQuery(q); assertEquals("[" + DEFAULT_TABLE_NAME + ".gender, MAX(" + DEFAULT_TABLE_NAME + ".age), MIN(" + DEFAULT_TABLE_NAME + ".age), COUNT(*) AS total, MIN(" + DEFAULT_TABLE_NAME + ".id) AS firstId]", Arrays.toString(data.getSelectItems().toArray())); assertTrue(data.next()); assertEquals("Row[values=[female, 20, 17, 5, 5]]", data.getRow().toString()); assertTrue(data.next()); assertEquals("Row[values=[male, 19, 17, 4, 1]]", data.getRow().toString()); assertFalse(data.next()); }</code><technical_language>"q" => "query"</technical_language>

Target:
public void testGroupByQuery() throws Exception { insertPeopleDocuments(); final Table table = dataContext.getDefaultSchema().getTableByName(DEFAULT_TABLE_NAME); final Query query = new Query(); query.from(table); query.groupBy(table.getColumnByName("gender")); query .select(new SelectItem(table.getColumnByName("gender")), new SelectItem(FunctionType.MAX, table .getColumnByName("age")), new SelectItem(FunctionType.MIN, table.getColumnByName("age")), new SelectItem(FunctionType.COUNT, "*", "total"), new SelectItem(FunctionType.MIN, table .getColumnByName("id")).setAlias("firstId")); query.orderBy("gender"); final DataSet data = dataContext.executeQuery(query); assertEquals("[" + DEFAULT_TABLE_NAME + ".gender, MAX(" + DEFAULT_TABLE_NAME + ".age), MIN(" + DEFAULT_TABLE_NAME + ".age), COUNT(*) AS total, MIN(" + DEFAULT_TABLE_NAME + ".id) AS firstId]", Arrays.toString(data.getSelectItems().toArray())); assertTrue(data.next()); assertEquals("Row[values=[female, 20, 17, 5, 5]]", data.getRow().toString()); assertTrue(data.next()); assertEquals("Row[values=[male, 19, 17, 4, 1]]", data.getRow().toString()); assertFalse(data.next()); }
Source:
<code>public int compareTo(CostBenefitInfo that) { if (costBenefitRatio.compareTo(that.costBenefitRatio) != 0) { <START> return costBenefitRatio.compareTo(that.costBenefitRatio); <END> } if (benefit != that.benefit) { return benefit > that.benefit ? -1 : 1; } return 0; }</code><technical_language>a bit wasteful calculate - prefer calculating returning value</technical_language>

Target:
public int compareTo(CostBenefitInfo that) { int compareToVal = costBenefitRatio.compareTo(that.costBenefitRatio); if (compareToVal != 0) { return compareToVal; } return Integer.compare(that.benefit, benefit); }
Source:
<code>public AllelicCount(final AllelicCount count) { this.interval = count.getInterval(); this.refReadCount = count.getRefReadCount(); this.altReadCount = count.getAltReadCount(); <START> Nucleotide tempNucleotide; <END> try { tempNucleotide = count.getRefNucleotide(); } catch (final IllegalArgumentException e) { tempNucleotide = null; } this.refNucleotide = tempNucleotide; try { tempNucleotide = count.getAltNucleotide(); } catch (final IllegalArgumentException e) { tempNucleotide = null; } this.altNucleotide = tempNucleotide; Integer tempInteger; try { tempInteger = count.getReadDepth(); } catch (final IllegalArgumentException e) { tempInteger = null; } this.readDepth = tempInteger; Double tempDouble; try { tempDouble = count.getHetLogOdds(); } catch (final IllegalArgumentException e) { tempDouble = null; } this.hetLogOdds = tempDouble; }</code><technical_language>this.refNucleotide = count.refNucleotide</technical_language>

Target:
public AllelicCount(final AllelicCount count) { Utils.nonNull(count, "AllelicCount cannot be null."); interval = count.interval; refReadCount = count.refReadCount; altReadCount = count.altReadCount; refNucleotide = count.refNucleotide; altNucleotide = count.altNucleotide; readDepth = count.readDepth; hetLogOdds = count.hetLogOdds; }
Source:
<code>public Set<String> getModelNames() { <START> return this.models.keySet(); <END> }</code><technical_language>a copy of keySet ImmutableSet.copyOf(modes.keySet())</technical_language>

Target:
public ImmutableSet<String> getModelNames() { return ImmutableSet.copyOf(models.keySet()); }
Source:
<code>String validateFoundNode(CuratorFrameworkImpl client, CreateMode createMode, String foundNode) throws Exception { if ( doProtected && createMode.isEphemeral() ) { <START> if ( sessionId != client.getZooKeeper().getSessionId() ) <END> { log.info("Session has changed during protected mode with ephemeral. old: new: {}", sessionId, client.getZooKeeper().getSessionId()); if ( foundNode != null ) { log.info("Deleted old session's found node: {}", foundNode); client.getFailedDeleteManager().executeGuaranteedOperationInBackground(foundNode); foundNode = null; } sessionId = client.getZooKeeper().getSessionId(); } } return foundNode; }</code><technical_language>is hard session changed lines 98, 100 & 108 (and if - correct), is matter of style prefer saving result of getSessionId local variable continue local work variable</technical_language>

Target:
String validateFoundNode(CuratorFrameworkImpl client, CreateMode createMode, String foundNode) throws Exception { if ( doProtected && createMode.isEphemeral() ) { long clientSessionId = client.getZooKeeper().getSessionId(); if ( this.sessionId != clientSessionId ) { log.info("Session has changed during protected mode with ephemeral. old: new: {}", this.sessionId, clientSessionId); if ( foundNode != null ) { log.info("Deleted old session's found node: {}", foundNode); client.getFailedDeleteManager().executeGuaranteedOperationInBackground(foundNode); foundNode = null; } this.sessionId = clientSessionId; } } return foundNode; }
Source:
<code>private String createTopic(Datastream datastream) { Properties datastreamProperties = new Properties(); datastreamProperties.putAll(datastream.getMetadata()); Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties("topic"); <START> return _transportProvider.createTopic(datastream.getName(), DEFAULT_NUMBER_PARTITIONS, topicProperties); <END> }</code><technical_language>This name of datastream misleading for debugging if datastream is deleted is shared Datastreams. do a topicName based source</technical_language>

Target:
private String createTopic(Datastream datastream) { Properties datastreamProperties = new Properties(); datastreamProperties.putAll(datastream.getMetadata()); Properties topicProperties = new VerifiableProperties(datastreamProperties).getDomainProperties("topic"); return _transportProvider.createTopic(getTopicName(datastream), DEFAULT_NUMBER_PARTITIONS, topicProperties); }
Source:
<code>protected void addMouseListener(final Table table, final Shell dialog) { table.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { ok(dialog, table); } @Override public void mouseDown(MouseEvent e) { if (e.button == 3) { } else { ok(dialog, table); } } @Override public void mouseUp(MouseEvent e) { if (e.button == 3) { if (table.equals(e.getSource())) { TableItem ti = table.getItem(new Point(e.x, e.y)); if (ti != null) { Menu menu = new Menu(table); MenuItem mi = new MenuItem(menu, SWT.NONE); mi.setText(WorkbenchMessages.FilteredTableBaseHandler_Close); mi.addListener(SWT.Selection, se -> <START> { <END> close(ti); }); menu.setVisible(true); } } } else { ok(dialog, table); } } }); }</code><technical_language>This is needed</technical_language>

Target:
protected void addMouseListener(final Table table, final Shell dialog) { table.addMouseListener(new MouseListener() { @Override public void mouseDoubleClick(MouseEvent e) { ok(dialog, table); } @Override public void mouseDown(MouseEvent e) { if (e.button == 3) { } else { ok(dialog, table); } } @Override public void mouseUp(MouseEvent e) { if (e.button == 3) { if (table.equals(e.getSource())) { TableItem ti = table.getItem(new Point(e.x, e.y)); if (ti != null && ti.getData() instanceof EditorReference) { Menu menu = new Menu(table); MenuItem mi = new MenuItem(menu, SWT.NONE); mi.setText(WorkbenchMessages.FilteredTableBaseHandler_Close); mi.addListener(SWT.Selection, se -> close(ti)); menu.setVisible(true); } } } else { ok(dialog, table); } } }); }
Source:
<code>private static void loadRulesFromFile(IgnoreNode r, File exclude) throws FileNotFoundException, IOException { <START> try { <END> if (FS.DETECTED.exists(exclude)) { FileInputStream in = new FileInputStream(exclude); try { r.parse(in); } finally { in.close(); } } } catch (AccessControlException ignored) { } }</code><technical_language>is this related ignoring non-accessibility of ~/.gitconfig</technical_language>

Target:
private static void loadRulesFromFile(IgnoreNode r, File exclude) throws FileNotFoundException, IOException { if (FS.DETECTED.exists(exclude)) { FileInputStream in = new FileInputStream(exclude); try { r.parse(in); } finally { in.close(); } } }
Source:
<code>BookieNettyServer(ServerConfiguration conf, RequestProcessor processor) throws IOException, KeeperException, InterruptedException, BookieException { this.conf = conf; this.requestProcessor = processor; ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); String base = "bookie-" + conf.getBookiePort() + "-netty"; serverChannelFactory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(tfb.setNameFormat(base + "-boss-%d").build()), Executors.newCachedThreadPool(tfb.setNameFormat(base + "-worker-%d").build())); if (conf.isEnableLocalTransport()) { jvmServerChannelFactory = new DefaultLocalServerChannelFactory(); } else { jvmServerChannelFactory = null; } bookieAddress = Bookie.getBookieAddress(conf); InetSocketAddress bindAddress; if (conf.getListeningInterface() == null) { bindAddress = new InetSocketAddress(conf.getBookiePort()); } else { bindAddress = bookieAddress.getSocketAddress(); } <START> listenOn(bindAddress,bookieAddress); <END> }</code><technical_language>",bookieAddress" -> ", bookieAddress"</technical_language>

Target:
BookieNettyServer(ServerConfiguration conf, RequestProcessor processor) throws IOException, KeeperException, InterruptedException, BookieException { this.conf = conf; this.requestProcessor = processor; ExtensionRegistry registry = ExtensionRegistry.newInstance(); authProviderFactory = AuthProviderFactoryFactory.newBookieAuthProviderFactory(conf, registry); responseEncoder = new BookieProtoEncoding.ResponseEncoder(registry); requestDecoder = new BookieProtoEncoding.RequestDecoder(registry); ThreadFactoryBuilder tfb = new ThreadFactoryBuilder(); String base = "bookie-" + conf.getBookiePort() + "-netty"; serverChannelFactory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(tfb.setNameFormat(base + "-boss-%d").build()), Executors.newCachedThreadPool(tfb.setNameFormat(base + "-worker-%d").build())); if (conf.isEnableLocalTransport()) { jvmServerChannelFactory = new DefaultLocalServerChannelFactory(); } else { jvmServerChannelFactory = null; } bookieAddress = Bookie.getBookieAddress(conf); InetSocketAddress bindAddress; if (conf.getListeningInterface() == null) { bindAddress = new InetSocketAddress(conf.getBookiePort()); } else { bindAddress = bookieAddress.getSocketAddress(); } listenOn(bindAddress, bookieAddress); }
Source:
<code>public void sendJSONMessage(String message) { <START> player.spigot().sendMessage(ComponentSerializer.parse(message)); <END> }</code><technical_language>suggestion getPlayer().spigot().sendMessage(ComponentSerializer.parse(message));</technical_language>

Target:
public void sendJSONMessage(String message) { getPlayer().spigot().sendMessage(ComponentSerializer.parse(message)); }
Source:
<code>protected LogicalProcessor[] initProcessorCounts() { Map<Integer, Integer> numaNodeMap = mapNumaNodes(); List<String> procCpu = FileUtil.readFile("/proc/cpuinfo"); List<LogicalProcessor> logProcs = new ArrayList<>(); int currentProcessor = 0; int currentCore = 0; int currentPackage = 0; boolean first = true; for (String cpu : procCpu) { if (cpu.startsWith("processor")) { if (!first) { logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); } else { first = false; } currentProcessor = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("core id") || cpu.startsWith("cpu number")) { currentCore = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("physical id")) { currentPackage = ParseUtil.parseLastInt(cpu, 0); } } logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); Set<String> physProcPkgs = new HashSet<>(); Set<Integer> physPkgs = new HashSet<>(); for (LogicalProcessor logProc : logProcs) { int pkg = logProc.getPhysicalPackageNumber(); <START> physProcPkgs.add("" + logProc.getPhysicalProcessorNumber() + ":" + pkg); <END> physPkgs.add(pkg); } this.logicalProcessorCount = logProcs.size(); this.physicalProcessorCount = physProcPkgs.size(); this.physicalPackageCount = physPkgs.size(); return logProcs.toArray(new LogicalProcessor[0]); }</code><technical_language>":" is added convert int String, unneeded include empty string start</technical_language>

Target:
protected LogicalProcessor[] initProcessorCounts() { Map<Integer, Integer> numaNodeMap = mapNumaNodes(); List<String> procCpu = FileUtil.readFile("/proc/cpuinfo"); List<LogicalProcessor> logProcs = new ArrayList<>(); int currentProcessor = 0; int currentCore = 0; int currentPackage = 0; boolean first = true; for (String cpu : procCpu) { if (cpu.startsWith("processor")) { if (!first) { logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); } else { first = false; } currentProcessor = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("core id") || cpu.startsWith("cpu number")) { currentCore = ParseUtil.parseLastInt(cpu, 0); } else if (cpu.startsWith("physical id")) { currentPackage = ParseUtil.parseLastInt(cpu, 0); } } logProcs.add(new LogicalProcessor(currentProcessor, currentCore, currentPackage, numaNodeMap.getOrDefault(currentProcessor, 0))); Set<String> physProcPkgs = new HashSet<>(); Set<Integer> physPkgs = new HashSet<>(); for (LogicalProcessor logProc : logProcs) { int pkg = logProc.getPhysicalPackageNumber(); physProcPkgs.add(logProc.getPhysicalProcessorNumber() + ":" + pkg); physPkgs.add(pkg); } this.logicalProcessorCount = logProcs.size(); this.physicalProcessorCount = physProcPkgs.size(); this.physicalPackageCount = physPkgs.size(); return logProcs.toArray(new LogicalProcessor[0]); }
Source:
<code>public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; assertEquals(response.getVolumes().length, 2); assertEquals(response.getVolumesRW().length, 2); assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); <START> assertEquals(response.getLogPath(), "/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log"); <END> }</code><technical_language>Bad example before... assertThat(response.getLogPath(), is("/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log")</technical_language>

Target:
public void roundTrip_full() throws IOException { InspectContainerResponse[] responses = testRoundTrip(CommandJSONSamples.inspectContainerResponse_full, InspectContainerResponse[].class); assertEquals(1, responses.length); final InspectContainerResponse response = responses[0]; assertEquals(response.getVolumes().length, 2); assertEquals(response.getVolumesRW().length, 2); assertEquals(response.getVolumes()[1].getContainerPath(), "/bar/foo/myvol2"); assertEquals(response.getVolumes()[1].getHostPath(), "/path2"); assertEquals(response.getVolumesRW()[1].getVolume().getPath(), "/bar/foo/myvol2"); assertFalse(response.getVolumesRW()[1].getAccessMode().toBoolean()); assertTrue(response.getVolumesRW()[0].getAccessMode().toBoolean()); assertThat(response.getLogPath(), is("/mnt/sda1/var/lib/docker/containers/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1/469e5edd8d5b33e3c905a7ffc97360ec6ee211d6782815fbcd144568045819e1-json.log")); }
Source:
<code>public void validate(ValidationContext validationContext) { if (!isValidTypeValue()) { errors.add(TYPE, String.format("You have defined approval type as '%s'. Approval can only be of the type '%s' or '%s'.", type, MANUAL, SUCCESS)); } if (validationContext.isWithinPipelines()) { PipelineConfigs group = validationContext.getPipelineGroup(); if (!group.hasOperationPermissionDefined()) { return; } AdminsConfig adminsConfig = group.getAuthorization().getOperationConfig(); for (Admin user : authConfig) { RolesConfig roles = validationContext.getServerSecurityConfig().getRoles(); <START> if (!validationContext.getServerSecurityConfig().isAdmin(user) && !adminsConfig.has(user, roles.memberRoles(user))) { <END> user.addError(String.format("%s \"%s\" who is not authorized to operate pipeline group can not be authorized to approve stage", user.describe(), user)); } } } }</code><technical_language>is validationContext.getServerSecurityConfig() needs pulled out of loop</technical_language>

Target:
public void validate(ValidationContext validationContext) { if (!isValidTypeValue()) { errors.add(TYPE, String.format("You have defined approval type as '%s'. Approval can only be of the type '%s' or '%s'.", type, MANUAL, SUCCESS)); } if (validationContext.isWithinPipelines()) { PipelineConfigs group = validationContext.getPipelineGroup(); if (!group.hasOperationPermissionDefined()) { return; } AdminsConfig adminsConfig = group.getAuthorization().getOperationConfig(); RolesConfig roles = validationContext.getServerSecurityConfig().getRoles(); for (Admin user : authConfig) { if (!validationContext.getServerSecurityConfig().isAdmin(user) && !adminsConfig.has(user, roles.memberRoles(user))) { user.addError(String.format("%s \"%s\" who is not authorized to operate pipeline group can not be authorized to approve stage", user.describe(), user)); } } } }
Source:
<code>@Override public int hashCode() { <START> return new HashCodeBuilder().append(clusterId).toHashCode(); <END> }</code><technical_language>Please java.util.Objects.hash()</technical_language>

Target:
public int hashCode() { return Objects.hashCode(clusterId); }
Source:
<code>public void scanAndApply( final ManipulationSession session ) throws ManipulationException { final List<Project> projects = pomIO.parseProject( session.getPom() ); scan( projects, session ); for ( final Project project : projects ) { logger.debug( "Got " + project + " (POM: " + project.getPom() + ")" ); } Set<Project> changed = applyManipulations( projects, session ); if ( !changed.isEmpty() ) { logger.info( "Maven-Manipulation-Extension: Rewrite changed: " + projects ); pomIO.rewritePOMs( changed ); try { new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_PATH ).mkdirs(); new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_FILE ).createNewFile(); } catch ( IOException e ) { throw new ManipulationException( "Marker file creation failed", e ); } } applyAfterManipulations( projects, session ); try { File resultFile = new File( session.getTargetDir(), ManipulationManager.RESULT_FILE ); boolean recreated = true; resultFile.getParentFile().mkdirs(); if ( resultFile.exists() ) { recreated = recreated && resultFile.delete(); <START> } <END> recreated = recreated && resultFile.createNewFile(); if ( !recreated ) { throw new ManipulationException( "Could not (re)create " + resultFile.getCanonicalPath() ); } try (FileWriter writer = new FileWriter( resultFile )) { writer.write( collectResults( session ) ); } } catch ( IOException e ) { throw new ManipulationException( "Result file creation failed", e ); } for (ExtensionInfrastructure e : infrastructure.values()) { e.finish(); } logger.info( "Maven-Manipulation-Extension: Finished." ); }</code><technical_language>filewriter overwrite making this deletion code redundant. If this code part of marker file block mkdirs redundant</technical_language>

Target:
public void scanAndApply( final ManipulationSession session ) throws ManipulationException { final List<Project> projects = pomIO.parseProject( session.getPom() ); scan( projects, session ); for ( final Project project : projects ) { logger.debug( "Got " + project + " (POM: " + project.getPom() + ")" ); } Set<Project> changed = applyManipulations( projects, session ); if ( !changed.isEmpty() ) { logger.info( "Maven-Manipulation-Extension: Rewrite changed: " + projects ); pomIO.rewritePOMs( changed ); try { new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_PATH ).mkdirs(); new File( session.getTargetDir().getParentFile(), ManipulationManager.MARKER_FILE ).createNewFile(); try (FileWriter writer = new FileWriter( new File ( session.getTargetDir().getParentFile(), RESULT_FILE ) ) ) { writer.write( collectResults( session ) ); } } catch ( IOException e ) { logger.error( "Unable to create marker or result file", e ); throw new ManipulationException( "Marker/result file creation failed", e ); } } for (ExtensionInfrastructure e : infrastructure.values()) { e.finish(); } logger.info( "Maven-Manipulation-Extension: Finished." ); }
Source:
<code>public void testDefaultConfiguration() { <START> ServerConfiguration configuration = new ServerConfiguration(); <END> Assert.assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), true); }</code><technical_language>Add final keyword</technical_language>

Target:
public void testDefaultConfiguration() { final ServerConfiguration configuration = new ServerConfiguration(); Assert.assertEquals(configuration.getBooleanProperty(USE_CROSS_SITE_ORIGIN_FILTER, USE_CROSS_SITE_ORIGIN_FILTER_DEFAULT_VALUE), true); }
Source:
<code>public void testPrivateKeyInRange() { BigInteger primeP = BigInteger.valueOf(23); List<BigInteger> privateKeys = new ArrayList<>(); <START> for (int i = 0; i < 10; i++) privateKeys.add(diffieHellman.privateKey(primeP)); <END> for (BigInteger privateKey : privateKeys) { assertTrue((privateKey.compareTo(BigInteger.ONE) >= 0) && (privateKey.compareTo(primeP) < 0)); } }</code><technical_language>Please curly brackets for this for loop well. more readable modifying code break add a line for loop</technical_language>

Target:
public void testPrivateKeyInRange() { BigInteger prime = BigInteger.valueOf(23); List<BigInteger> privateKeys = new ArrayList<>(); for (int i = 0; i < 10; i++) { privateKeys.add(diffieHellman.privateKey(prime)); } for (BigInteger privateKey : privateKeys) { assertTrue(privateKey.compareTo(BigInteger.ONE) >= 0); assertTrue(privateKey.compareTo(prime) < 0); } }
Source:
<code>public void deleteElement(IInteractionElement element) { <START> deleteElement(element, getActiveContext()); <END> notifyElementsDeleted(getActiveContext(), Arrays.asList(new IInteractionElement[] { element }), false); }</code><technical_language>This invoke deleteElements() methods executes deletion</technical_language>

Target:
public void deleteElement(IInteractionElement element) { deleteElements(Arrays.asList(new IInteractionElement[] { element }), getActiveContext(), false, true); }
Source:
<code>private String echo(final String uid, final String summary) { final String xembly = new XemblyLine( new Directives() .xpath(this.xpath(uid)) .add("summary") <START> .set(Terminal.escape(summary)) <END> ).toString(); return String.format( "echo -e '%s'", xembly.replace("'", "\\x27").replace( XemblyLine.MARK, IncrementalBash.ESCAPED_MARK ) ); }</code><technical_language>I this is wrong. tests failed of that.</technical_language>

Target:
private String echo(final String uid, final String summary) { final String xembly = new XemblyLine( new Directives() .xpath(this.xpath(uid)) .add("summary") .set(summary.replaceAll("([_*`\\\\])", "\\\\$1")) ).toString(); return String.format( "echo -e '%s'", xembly.replace("'", "\\x27").replace( XemblyLine.MARK, IncrementalBash.ESCAPED_MARK ) ); }
Source:
<code>private List<Pair<Integer, String>> getContacts(@NonNull final String searchName, final Uri uri, @NonNull final String idColumnName, @NonNull final String selectionColumnName, final boolean like) { final String[] projection = { idColumnName, selectionColumnName, ContactsContract.Contacts.DISPLAY_NAME }; final String selection = selectionColumnName + (like ? " LIKE" : " =") + " ? COLLATE NOCASE"; final String[] selectionArgs = { like ? "%" + searchName + "%" : searchName }; final List<Pair<Integer, String>> result = new ArrayList<>(); <START> try (Cursor cursor = getContentResolver().query(uri, projection, selection, selectionArgs, null)) { <END> while (cursor != null && cursor.moveToNext()) { final int foundId = cursor.getInt(0); final String foundName = cursor.getString(1); final String displayName = cursor.getString(2); result.add(new Pair<>(foundId, StringUtils.isNotEmpty(displayName) && !StringUtils.equalsIgnoreCase(foundName, displayName) ? foundName + " (" + displayName + ")" : foundName)); } } catch (final Exception e) { Log.e(LOG_TAG, "ContactsActivity.getContactId", e); } return result; }</code><technical_language>reverted try-with, requires minsdk 19</technical_language>

Target:
private List<Pair<Integer, String>> getContacts(@NonNull final String searchName, final Uri uri, @NonNull final String idColumnName, @NonNull final String selectionColumnName, final boolean like) { final String[] projection = { idColumnName, selectionColumnName, ContactsContract.Contacts.DISPLAY_NAME }; final String selection = selectionColumnName + (like ? " LIKE" : " =") + " ? COLLATE NOCASE"; final String[] selectionArgs = { like ? "%" + searchName + "%" : searchName }; Cursor cursor = null; final List<Pair<Integer, String>> result = new ArrayList<>(); try { cursor = getContentResolver().query(uri, projection, selection, selectionArgs, null); while (cursor != null && cursor.moveToNext()) { final int foundId = cursor.getInt(0); final String foundName = cursor.getString(1); final String displayName = cursor.getString(2); result.add(new Pair<>(foundId, StringUtils.isNotEmpty(displayName) && !StringUtils.equalsIgnoreCase(foundName, displayName) ? foundName + " (" + displayName + ")" : foundName)); } } catch (final Exception e) { Log.e(LOG_TAG, "ContactsActivity.getContactId", e); } finally { if (cursor != null) { cursor.close(); } } return result; }
Source:
<code>public Map<String, String> getSegmentsMetadata(String tableNameWithType, int timeoutMs) throws InvalidConfigException, IOException { final Map<String, List<String>> serversToSegmentsMap = pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType); BiMap<String, String> endpoints = pinotHelixResourceManager.getDataInstanceAdminEndpoints(serversToSegmentsMap.keySet()); ServerSegmentMetadataReader serverSegmentMetadataReader = new ServerSegmentMetadataReader(executor, connectionManager); List<String> segmentsMetadata = serverSegmentMetadataReader.getSegmentMetadataFromServer(tableNameWithType, serversToSegmentsMap, endpoints, timeoutMs); Map<String, String> response = new HashMap<>(); for (String segmentMetadata : segmentsMetadata) { JsonNode responseJson = JsonUtils.stringToJsonNode(segmentMetadata); <START> ObjectNode objectNode = responseJson.deepCopy(); <END> response.put(objectNode.get("segmentName").asText(), segmentMetadata); } return response; }</code><technical_language>didnt understand this needs copied another ObjectNode. get JsonNode</technical_language>

Target:
public JsonNode getSegmentsMetadata(String tableNameWithType, int timeoutMs) throws InvalidConfigException, IOException { final Map<String, List<String>> serverToSegments = _pinotHelixResourceManager.getServerToSegmentsMap(tableNameWithType); BiMap<String, String> endpoints = _pinotHelixResourceManager.getDataInstanceAdminEndpoints(serverToSegments.keySet()); ServerSegmentMetadataReader serverSegmentMetadataReader = new ServerSegmentMetadataReader(_executor, _connectionManager); List<String> segmentsMetadata = serverSegmentMetadataReader.getSegmentMetadataFromServer(tableNameWithType, serverToSegments, endpoints, timeoutMs); Map<String, JsonNode> response = new HashMap<>(); for (String segmentMetadata : segmentsMetadata) { JsonNode responseJson = JsonUtils.stringToJsonNode(segmentMetadata); response.put(responseJson.get("segmentName").asText(), responseJson); } return JsonUtils.objectToJsonNode(response); }
Source:
<code>protected String getQuery(VitroRequest vreq) { Locale locale = SelectedLocale.getCurrentLocale(vreq); ParameterizedSparqlString queryPstr = new ParameterizedSparqlString( WEBPAGE_QUERY); queryPstr.setLiteral("locale", locale.toString().replace("_", "-")); <START> queryPstr.setLiteral("language", locale.getLanguage().toString()); <END> return queryPstr.toString(); }</code><technical_language>toString() is redundant here</technical_language>

Target:
protected String getQuery(VitroRequest vreq) { Locale locale = SelectedLocale.getCurrentLocale(vreq); ParameterizedSparqlString queryPstr = new ParameterizedSparqlString( WEBPAGE_QUERY); queryPstr.setLiteral("locale", locale.replace("_", "-")); queryPstr.setLiteral("language", locale.getLanguage()); return queryPstr.toString(); }
Source:
<code>remoteApiDomain.contains(":") ? Integer.parseInt(remoteApiDomain.split(":")[1]) : 443; TEAMMATES_VERSION = extractVersionNumber(FileHelper.readFile("src/main/webapp/WEB-INF/appengine-web.xml")); TEST_ADMIN_ACCOUNT = prop.getProperty("test.admin.account"); TEST_ADMIN_PASSWORD = prop.getProperty("test.admin.password"); TEST_INSTRUCTOR_ACCOUNT = prop.getProperty("test.instructor.account"); TEST_INSTRUCTOR_PASSWORD = prop.getProperty("test.instructor.password"); TEST_STUDENT1_ACCOUNT = prop.getProperty("test.student1.account"); TEST_STUDENT1_PASSWORD = prop.getProperty("test.student1.password"); TEST_STUDENT2_ACCOUNT = prop.getProperty("test.student2.account"); TEST_STUDENT2_PASSWORD = prop.getProperty("test.student2.password"); TEST_UNREG_ACCOUNT = prop.getProperty("test.unreg.account"); TEST_UNREG_PASSWORD = prop.getProperty("test.unreg.password"); BACKDOOR_KEY = prop.getProperty("test.backdoor.key"); BROWSER = prop.getProperty("test.selenium.browser"); FIREFOX_PATH = prop.getProperty("test.firefox.path"); IS_HEADLESS_FIREFOX = Boolean.parseBoolean(prop.getProperty("test.is_headless_firefox")); XVFB_PORT = prop.getProperty("test.xvfb_port"); <START> <END> TEST_TIMEOUT = Integer.parseInt(prop.getProperty("test.timeout")); } catch (IOException | NumberFormatException e) { throw new RuntimeException(e); }</code><technical_language>if changes needed</technical_language>

Target:
remoteApiDomain.contains(":") ? Integer.parseInt(remoteApiDomain.split(":")[1]) : 443; TEAMMATES_VERSION = extractVersionNumber(FileHelper.readFile("src/main/webapp/WEB-INF/appengine-web.xml")); TEST_ADMIN_ACCOUNT = prop.getProperty("test.admin.account"); TEST_ADMIN_PASSWORD = prop.getProperty("test.admin.password"); TEST_INSTRUCTOR_ACCOUNT = prop.getProperty("test.instructor.account"); TEST_INSTRUCTOR_PASSWORD = prop.getProperty("test.instructor.password"); TEST_STUDENT1_ACCOUNT = prop.getProperty("test.student1.account"); TEST_STUDENT1_PASSWORD = prop.getProperty("test.student1.password"); TEST_STUDENT2_ACCOUNT = prop.getProperty("test.student2.account"); TEST_STUDENT2_PASSWORD = prop.getProperty("test.student2.password"); TEST_UNREG_ACCOUNT = prop.getProperty("test.unreg.account"); TEST_UNREG_PASSWORD = prop.getProperty("test.unreg.password"); BACKDOOR_KEY = prop.getProperty("test.backdoor.key"); BROWSER = prop.getProperty("test.selenium.browser"); FIREFOX_PATH = prop.getProperty("test.firefox.path"); TEST_TIMEOUT = Integer.parseInt(prop.getProperty("test.timeout")); } catch (IOException | NumberFormatException e) { throw new RuntimeException(e); }
Source:
<code>public NettyAsyncHttpClient build() { HttpClient nettyHttpClient = HttpClient.create() .port(port) .wiretap(enableWiretap) .tcpConfiguration(tcpConfig -> { if (nioEventLoopGroup != null) { tcpConfig = tcpConfig.runOn(nioEventLoopGroup); } if (proxyOptions != null) { ProxyProvider.Proxy nettyProxy; switch (proxyOptions.getType()) { case HTTP: nettyProxy = ProxyProvider.Proxy.HTTP; break; case SOCKS4: nettyProxy = ProxyProvider.Proxy.SOCKS4; break; case SOCKS5: nettyProxy = ProxyProvider.Proxy.SOCKS5; break; default: <START> throw logger.logExceptionAsWarning(new IllegalStateException( <END> String.format("Unknown Proxy type '%s' in use. Not configuring Netty proxy.", proxyOptions.getType()))); } return tcpConfig.proxy(ts -> ts.type(nettyProxy).address(proxyOptions.getAddress())); } return tcpConfig; }); return new NettyAsyncHttpClient(nettyHttpClient); }</code><technical_language>Is this Proxy this result in failing create a HttpClient? If fail create HttpClient, logged error. If create a client proxy, warning is fine</technical_language>

Target:
public NettyAsyncHttpClient build() { HttpClient nettyHttpClient = HttpClient.create() .port(port) .wiretap(enableWiretap) .tcpConfiguration(tcpConfig -> { if (nioEventLoopGroup != null) { tcpConfig = tcpConfig.runOn(nioEventLoopGroup); } if (proxyOptions != null) { ProxyProvider.Proxy nettyProxy; switch (proxyOptions.getType()) { case HTTP: nettyProxy = ProxyProvider.Proxy.HTTP; break; case SOCKS4: nettyProxy = ProxyProvider.Proxy.SOCKS4; break; case SOCKS5: nettyProxy = ProxyProvider.Proxy.SOCKS5; break; default: throw logger.logExceptionAsError(new IllegalStateException( String.format("Unknown Proxy type '%s' in use. Not configuring Netty proxy.", proxyOptions.getType()))); } return tcpConfig.proxy(ts -> ts.type(nettyProxy).address(proxyOptions.getAddress())); } return tcpConfig; }); return new NettyAsyncHttpClient(nettyHttpClient); }
Source:
<code>public Client findClient(String clientUUID, Integer profileId) throws Exception { <START> logger.info("HELLOOOOOOOOOOOOOOOOOOOOooooooš", "TIFFANY"); <END> Client client = null; if (clientUUID.compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) != 0 && !clientUUID.matches("[\\w]{8}-[\\w]{4}-[\\w]{4}-[\\w]{4}-[\\w]{12}")) { Client tmpClient = this.findClientFromFriendlyName(profileId, clientUUID); if (tmpClient == null) { clientUUID = Constants.PROFILE_CLIENT_DEFAULT_ID; } else { return tmpClient; } } PreparedStatement statement = null; ResultSet results = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "SELECT * FROM " + Constants.DB_TABLE_CLIENT + " WHERE " + Constants.CLIENT_CLIENT_UUID + " = ?"; if (profileId != null) { queryString += " AND " + Constants.GENERIC_PROFILE_ID + "=?"; } statement = sqlConnection.prepareStatement(queryString); statement.setString(1, clientUUID); if (profileId != null) { statement.setInt(2, profileId); } results = statement.executeQuery(); if (results.next()) { client = this.getClientFromResultSet(results); } } catch (Exception e) { throw e; } finally { try { if (results != null) { results.close(); } } catch (Exception e) { } try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return client; }</code><technical_language>remove debug</technical_language>

Target:
public Client findClient(String clientUUID, Integer profileId) throws Exception { Client client = null; if (clientUUID.compareTo(Constants.PROFILE_CLIENT_DEFAULT_ID) != 0 && !clientUUID.matches("[\\w]{8}-[\\w]{4}-[\\w]{4}-[\\w]{4}-[\\w]{12}")) { Client tmpClient = this.findClientFromFriendlyName(profileId, clientUUID); if (tmpClient == null) { clientUUID = Constants.PROFILE_CLIENT_DEFAULT_ID; } else { return tmpClient; } } PreparedStatement statement = null; ResultSet results = null; try (Connection sqlConnection = sqlService.getConnection()) { String queryString = "SELECT * FROM " + Constants.DB_TABLE_CLIENT + " WHERE " + Constants.CLIENT_CLIENT_UUID + " = ?"; if (profileId != null) { queryString += " AND " + Constants.GENERIC_PROFILE_ID + "=?"; } statement = sqlConnection.prepareStatement(queryString); statement.setString(1, clientUUID); if (profileId != null) { statement.setInt(2, profileId); } results = statement.executeQuery(); if (results.next()) { client = this.getClientFromResultSet(results); } } catch (Exception e) { throw e; } finally { try { if (results != null) { results.close(); } } catch (Exception e) { } try { if (statement != null) { statement.close(); } } catch (Exception e) { } } return client; }
Source:
<code>void removeAndValidateIntegerLiteralUnderscore() { if ( PTRN_FAULTY_UNDERSCORE_INT.matcher( val ).find() ) { <START> throw new NumberFormatException(); <END> } else { val = val.replace( "_", "" ); } }</code><technical_language>a message in NumberFormatException (it helps reading code)</technical_language>

Target:
void removeAndValidateIntegerLiteralUnderscore() { if ( PTRN_FAULTY_UNDERSCORE_INT.matcher( val ).find() ) { throw new NumberFormatException("Improperly placed underscores"); } else { val = val.replace( "_", "" ); } }
Source:
<code>public double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new double[DocIdSetPlanNode.MAX_DOC_PER_CALL]; } byte[][] firstValues = _firstArgument.transformToBytesValuesSV(projectionBlock); byte[][] secondValues = _secondArgument.transformToBytesValuesSV(projectionBlock); for (int i = 0; i < projectionBlock.getNumDocs(); i++) { Geometry firstGeometry = GeometrySerializer.deserialize(firstValues[i]); Geometry secondGeometry = GeometrySerializer.deserialize(secondValues[i]); if (GeometryUtils.isGeography(firstGeometry) != GeometryUtils.isGeography(secondGeometry)) { throw new RuntimeException( String.format("The first and second arguments shall either all be geometry" + " or all geography")); } if (GeometryUtils.isGeography(firstGeometry)) { _results[i] = sphericalDistance(firstGeometry, secondGeometry); } else { _results[i] = <START> firstGeometry.isEmpty() || secondGeometry.isEmpty() ? null : firstGeometry.distance(secondGeometry); <END> } } return _results; }</code><technical_language>null added double[] Check empty point calculating distance (for geometry geography)</technical_language>

Target:
public double[] transformToDoubleValuesSV(ProjectionBlock projectionBlock) { if (_results == null) { _results = new double[DocIdSetPlanNode.MAX_DOC_PER_CALL]; } byte[][] firstValues = _firstArgument.transformToBytesValuesSV(projectionBlock); byte[][] secondValues = _secondArgument.transformToBytesValuesSV(projectionBlock); for (int i = 0; i < projectionBlock.getNumDocs(); i++) { Geometry firstGeometry = GeometrySerializer.deserialize(firstValues[i]); Geometry secondGeometry = GeometrySerializer.deserialize(secondValues[i]); if (GeometryUtils.isGeography(firstGeometry) != GeometryUtils.isGeography(secondGeometry)) { throw new RuntimeException("The first and second arguments shall either all be geometry or all geography"); } if (GeometryUtils.isGeography(firstGeometry)) { _results[i] = sphericalDistance(firstGeometry, secondGeometry); } else { _results[i] = firstGeometry.isEmpty() || secondGeometry.isEmpty() ? Double.NaN : firstGeometry.distance(secondGeometry); } } return _results; }