auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean compareAndRemove(Ref oldRef) throws IOException { <START> boolean ret = compareAndRemoveImpl(oldRef); if (ret) { objdb.markDirty(); } return ret; <END> }</code><technical_language>marking dirty deleting a ref? new objects introduced</technical_language>

Target:
protected boolean compareAndRemove(Ref oldRef) throws IOException { try { lock.writeLock().lock(); String name = oldRef.getName(); Ref cur = refs.get(name); if (cur != null && eq(cur, oldRef)) return refs.remove(name, cur); else return false; } finally { lock.writeLock().unlock(); } }
Source:
<code>public void saveParameters(List<ScriptGeneratorAction> scriptGenContent, String scriptDefPath, String absoluteFilePath) throws InterruptedException, ExecutionException { try { String content = new String(Files.readAllBytes(Paths.get(scriptDefPath))); <START> Gson gson = new GsonBuilder().setPrettyPrinting().create(); <END> String jsonContent = gson.toJson(new ParametersConverter(CURRENT_VERSION, convertScriptGenContent(scriptGenContent), content, "", getCurrentDate(), getCurrentTime(), scriptDefPath, "", getCurrentGenieVersionNumber())); writeParametersToJSONFile(jsonContent, absoluteFilePath); } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>create this builder a times, create for class. i.e. put private Gson gson = new GsonBuilder().setPrettyPrinting().create(); top</technical_language>

Target:
public void saveParameters(List<ScriptGeneratorAction> scriptGenContent, String scriptDefPath, String absoluteFilePath) throws InterruptedException, ExecutionException { try { String content = createJsonString(scriptGenContent, readFileContent(scriptDefPath), scriptDefPath); writeParametersToJSONFile(content, absoluteFilePath); } catch (IOException e) { LOG.error(e); } }
Source:
<code>public static boolean isAllowedOrigin(final String requestOrigin, final Set<URI> allowedOrigins) { if (requestOrigin == null) { return false; } URI requestOriginURI; try { requestOriginURI = new URI(requestOrigin.toString()); <START> } catch (Exception e) { <END> return false; } String requestScheme = requestOriginURI.getScheme(); String requestHost = requestOriginURI.getHost(); int requestPort = requestOriginURI.getPort(); if (requestScheme == null || requestHost == null) { return false; } for (URI allowedOrigin : allowedOrigins) { if ((requestHost.equalsIgnoreCase(allowedOrigin.getHost()) || requestHost.toLowerCase().endsWith("." + allowedOrigin.getHost().toLowerCase())) && requestPort == allowedOrigin.getPort() && requestScheme.equalsIgnoreCase(allowedOrigin.getScheme())) { return true; } } return false; }</code><technical_language>catch URISyntaxException only</technical_language>

Target:
public static boolean isAllowedOrigin(final String requestOrigin, final Set<URI> allowedOrigins) { if (requestOrigin == null) { return false; } URI requestOriginURI; try { requestOriginURI = new URI(requestOrigin); } catch (URISyntaxException e) { return false; } String requestScheme = requestOriginURI.getScheme(); String requestHost = requestOriginURI.getHost(); int requestPort = requestOriginURI.getPort(); if (requestScheme == null || requestHost == null) { return false; } for (URI allowedOrigin : allowedOrigins) { if ((requestHost.equalsIgnoreCase(allowedOrigin.getHost()) || requestHost.toLowerCase().endsWith("." + allowedOrigin.getHost().toLowerCase())) && requestPort == allowedOrigin.getPort() && requestScheme.equalsIgnoreCase(allowedOrigin.getScheme())) { return true; } } return false; }
Source:
<code><START> private StorageDomainSharedStatus getStorageDomainSharedStatus() { StorageDomainSharedStatus status = null; if (getStorageDomain() != null) { status = getStorageDomain().getStorageDomainSharedStatus(); } return status; } <END></code><technical_language>consider syntax: return getStorageDomain() == null ? null : getStorageDomain().getStorageDomainSharedStatus()</technical_language>

Target:
private StorageDomainSharedStatus getStorageDomainSharedStatus() { return getStorageDomain() == null ? null : getStorageDomain().getStorageDomainSharedStatus(); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_peripherals); mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus); mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus); mBatteryLevelEditText = (EditText) findViewById(R.id.textView_batteryLevel); mBatteryLevelEditText.setOnEditorActionListener(mOnEditorActionListener); mBatteryLevelSeekBar = (SeekBar) findViewById(R.id.seekBar_batteryLevel); mBatteryLevelSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener); <START> setUpBluetooth(); <END> mAdvSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .build(); mAdvData = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(true) .build(); mBatteryLevelCharacteristic = new BluetoothGattCharacteristic(BATTERY_LEVEL_UUID, BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ); mBatteryService = new BluetoothGattService(BATTERY_SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY); mBatteryService.addCharacteristic(mBatteryLevelCharacteristic); setBatteryLevel(INITIAL_BATTERY_LEVEL, null); }</code><technical_language>Reading this, obvious creating advertisement GATT service count "setting Bluetooth". Is setUpBluetooth() more making platform user-settings support BT all? call ensurePlatformBluetoothAvailable() if purpose</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_peripherals); mAdvStatus = (TextView) findViewById(R.id.textView_advertisingStatus); mConnectionStatus = (TextView) findViewById(R.id.textView_connectionStatus); mBatteryLevelEditText = (EditText) findViewById(R.id.textView_batteryLevel); mBatteryLevelEditText.setOnEditorActionListener(mOnEditorActionListener); mBatteryLevelSeekBar = (SeekBar) findViewById(R.id.seekBar_batteryLevel); mBatteryLevelSeekBar.setOnSeekBarChangeListener(mOnSeekBarChangeListener); ensureBleFeaturesAvailable(); mAdvSettings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM) .setConnectable(true) .build(); mAdvData = new AdvertiseData.Builder() .setIncludeDeviceName(true) .setIncludeTxPowerLevel(true) .build(); mBatteryLevelCharacteristic = new BluetoothGattCharacteristic(BATTERY_LEVEL_UUID, BluetoothGattCharacteristic.PROPERTY_READ | BluetoothGattCharacteristic.PROPERTY_NOTIFY, BluetoothGattCharacteristic.PERMISSION_READ); mBatteryService = new BluetoothGattService(BATTERY_SERVICE_UUID, BluetoothGattService.SERVICE_TYPE_PRIMARY); mBatteryService.addCharacteristic(mBatteryLevelCharacteristic); setBatteryLevel(INITIAL_BATTERY_LEVEL, null); }
Source:
<code><START> public StorageQuotaSource.Listener getQuotaSourceListener() { <END> return new StorageQuotaSource.Listener() { @Override public void onNewContainerStorageQuota(Map<String, Map<String, Long>> containerStorageQuota) { Map<String, Map<String, Long>> newQuota = new HashMap<>(); initMap(containerStorageQuota, newQuota, false); storageQuota = newQuota; } }; }</code><technical_language>this class' responsibility register listener AmbryStorageQuotaService. Instead of returning Listener objects, this class create object AmbryStorageQuotaService.registerListener(listener). This simple, responsibility of AmbryStorageQuotaService called listener registered consumers. AmbryStorageQuotaEnforcer need do if want listen</technical_language>

Target:
StorageQuotaSource.Listener getQuotaSourceListener() { return containerStorageQuota -> { Map<String, Map<String, Long>> newQuota = new HashMap<>(); initMap(containerStorageQuota, newQuota, false); storageQuota = newQuota; }; }
Source:
<code>public SyncUser get(String identity) { String userJson = nativeGetUser(identity); <START> if (userJson != null) { <END> return SyncUser.fromJson(userJson); } return null; }</code><technical_language>a private function fo this? logic in getCurrent</technical_language>

Target:
public SyncUser get(String identity) { String userJson = nativeGetUser(identity); return toSyncUserOrNull(userJson); }
Source:
<code><START> public InternalFunctions getFunctions(RealmUser user) { <END> return new InternalFunctions(user); }</code><technical_language>suggestion public Functions getFunctions(RealmUser user) {</technical_language>

Target:
public Functions getFunctions(RealmUser user) { return new FunctionsImpl(user); }
Source:
<code>private void handleMessageAndSend(Message<?> message) { Object payload = this.messageConverter.fromMessage(message, this.payloadType.get()); SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.wrap(message); SimpMessageType messageType = headerAccessor.getMessageType(); if ((messageType == null || SimpMessageType.MESSAGE.equals(messageType)) && !checkDestinationPrefix(headerAccessor.getDestination())) { headerAccessor.removeHeader(SimpMessageHeaderAccessor.NATIVE_HEADERS); <START> sendMessage(MessageBuilder.withPayload(payload).copyHeaders(headerAccessor.toMap()).build()); <END> } else { if (this.brokerHandler != null) { this.brokerHandler.handleMessage(message); } else if (logger.isDebugEnabled()) { logger.debug("Messages with non 'SimpMessageType.MESSAGE' type are ignored for sending to the " + "'outputChannel'. They have to be emitted as 'ApplicationEvent's " + "from the 'SubProtocolHandler'. Or using 'AbstractBrokerMessageHandler'(useBroker = true) " + "from server side. Received message: " + message); } } }</code><technical_language>getMessageBuilderFactory()</technical_language>

Target:
private void handleMessageAndSend(Message<?> message) { Object payload = this.messageConverter.fromMessage(message, this.payloadType.get()); SimpMessageHeaderAccessor headerAccessor = SimpMessageHeaderAccessor.wrap(message); SimpMessageType messageType = headerAccessor.getMessageType(); if ((messageType == null || SimpMessageType.MESSAGE.equals(messageType)) && !checkDestinationPrefix(headerAccessor.getDestination())) { headerAccessor.removeHeader(SimpMessageHeaderAccessor.NATIVE_HEADERS); sendMessage(getMessageBuilderFactory().withPayload(payload).copyHeaders(headerAccessor.toMap()).build()); } else { if (this.brokerHandler != null) { this.brokerHandler.handleMessage(message); } else if (logger.isDebugEnabled()) { logger.debug("Messages with non 'SimpMessageType.MESSAGE' type are ignored for sending to the " + "'outputChannel'. They have to be emitted as 'ApplicationEvent's " + "from the 'SubProtocolHandler'. Or using 'AbstractBrokerMessageHandler'(useBroker = true) " + "from server side. Received message: " + message); } } }
Source:
<code>public GenomicsRequestInitializer<GenomicsRequest<?>> setFieldsInitializer(final String fields) { return new GenomicsRequestInitializer<GenomicsRequest<?>>() { @Override public void initialize(GenomicsRequest<?> search) { if (null != fields) { <START> for (String requiredField : REQUIRED_STRICT_SHARD_FIELDS.keySet()) { <END> Preconditions .checkArgument( shardBoundary != ShardBoundary.STRICT || fields.matches(REQUIRED_STRICT_SHARD_FIELDS.get(requiredField)), "Required field missing: '%s' Add this field to the list of Read fields to be returned in the partial response.", requiredField); } search.setFields(fields); } } }; }</code><technical_language>this extracted a common utility accepts fields string map of patterns matched</technical_language>

Target:
public GenomicsRequestInitializer<GenomicsRequest<?>> setFieldsInitializer(final String fields) { if(shardBoundary == ShardBoundary.STRICT) { return new GenomicsSearchFieldRequestInitializer(fields, REQUIRED_STRICT_SHARD_FIELDS); } return new GenomicsSearchFieldRequestInitializer(fields, REQUIRED_FIELDS); }
Source:
<code>public void deleteEnvironmentPrerequisites(EnvironmentPrerequisiteDeleteRequest environmentPrerequisiteDeleteRequest) { AzureClient azureClient = azureClientService.getClient(environmentPrerequisiteDeleteRequest.getCloudCredential()); <START> String resourceGroupName = environmentPrerequisiteDeleteRequest.getAzurePrerequisiteDeleteRequest().getResourceGroupName(); <END> try { if (!azureClient.isResourceGroupEmpty(resourceGroupName)) { String message = String.format("Resource group %s is not empty, cannot proceed with deleting the environment. " + "Please check contents on azure portal.", resourceGroupName); LOGGER.warn(message); throw new CloudConnectorException(message); } azureUtils.deleteResourceGroup(azureClient, resourceGroupName, false); } catch (CloudException e) { throw new CloudConnectorException("Could not delete resource group", e); } }</code><technical_language>Is this line safe for NPE</technical_language>

Target:
public void deleteEnvironmentPrerequisites(EnvironmentPrerequisiteDeleteRequest environmentPrerequisiteDeleteRequest) { AzureClient azureClient = azureClientService.getClient(environmentPrerequisiteDeleteRequest.getCloudCredential()); environmentPrerequisiteDeleteRequest.getAzurePrerequisiteDeleteRequest() .map(AzurePrerequisiteDeleteRequest::getResourceGroupName) .ifPresentOrElse( resourceGroupName -> deleteResourceGroup(azureClient, resourceGroupName), () -> LOGGER.debug("No azure resource group was defined, not deleting resource group.") ); }
Source:
<code>public static byte[] compressJSONString(String data) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length()); GZIPOutputStream gzip = new GZIPOutputStream(bos); <START> gzip.write(data.getBytes()); <END> gzip.close(); byte[] compressed = bos.toByteArray(); bos.close(); return compressed; }</code><technical_language>UTF-8</technical_language>

Target:
public static byte[] compressJSONString(String data) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(data.length()); try (GZIPOutputStream gzip = new GZIPOutputStream(bos)) { gzip.write(data.getBytes(StandardCharsets.UTF_8)); } catch (IOException e) { throw e; } return bos.toByteArray(); }
Source:
<code>private void populateAutoComplete() { AccountManager am = AccountManager.get(this); Account[] accounts = am.getAccounts(); List<String> emails = Observable.from(accounts) .map(new MapAccountToName()) .filter(new FilterEmail()) .distinct() .toList() <START> .toBlocking() <END> .single(); ArrayAdapter<String> adapter = new ArrayAdapter<>( LoginActivity.this, android.R.layout.simple_dropdown_item_1line, emails ); mEmailView.setAdapter(adapter); }</code><technical_language>is this blocking? serve results asynchronously them</technical_language>

Target:
private void populateAutoComplete() { List<String> emails = LoginPackage.getDeviceUserEmails(this); ArrayAdapter<String> adapter = new ArrayAdapter<>( LoginActivity.this, android.R.layout.simple_dropdown_item_1line, emails ); emailView.setAdapter(adapter); }
Source:
<code>public void testIncompleteParameters() { ______TS("Missing course, session name and question number"); InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); verifyAssumptionFailure(); <START> FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); <END> ______TS("Missing question number"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; InstructorFeedbackTemplateQuestionAddAction action = getAction(params); RedirectResult result = getRedirectResult(action); assertEquals( getPageResultDestination( Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams()); assertEquals("No template questions are indicated to be added", result.getStatusMessage()); String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackTemplateQuestionAdd|||" + "instructorFeedbackTemplateQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "|||/page/instructorFeedbackTemplateQuestionAdd"; AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage()); }</code><technical_language>This line put ______TS("Missing question number");</technical_language>

Target:
public void testIncompleteParameters() { ______TS("Missing course, session name and question number"); InstructorAttributes instructor1ofCourse1 = typicalBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId); verifyAssumptionFailure(); ______TS("Missing question number"); FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1"); String[] params = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; InstructorFeedbackTemplateQuestionAddAction action = getAction(params); RedirectResult result = getRedirectResult(action); assertEquals( getPageResultDestination( Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, instructor1ofCourse1.courseId, "First+feedback+session", instructor1ofCourse1.googleId, true), result.getDestinationWithParams()); assertEquals("No template questions are indicated to be added", result.getStatusMessage()); String expectedLogMessage = "TEAMMATESLOG|||instructorFeedbackTemplateQuestionAdd|||" + "instructorFeedbackTemplateQuestionAdd|||true|||" + "Instructor|||Instructor 1 of Course 1|||" + "idOfInstructor1OfCourse1|||instr1@course1.tmt|||" + "|||/page/instructorFeedbackTemplateQuestionAdd"; AssertHelper.assertLogMessageEquals(expectedLogMessage, action.getLogMessage()); }
Source:
<code>public void setDRM(final ReactExoplayerView videoView, @Nullable ReadableMap drm) { <START> Log.d("SetDRM", "Set DRM config"); <END> if (drm != null && drm.hasKey(PROP_DRM_TYPE)) { String drmType = drm.hasKey(PROP_DRM_TYPE) ? drm.getString(PROP_DRM_TYPE) : null; String drmLicenseServer = drm.hasKey(PROP_DRM_LICENSESERVER) ? drm.getString(PROP_DRM_LICENSESERVER) : null; ReadableMap drmHeaders = drm.hasKey(PROP_DRM_HEADERS) ? drm.getMap(PROP_DRM_HEADERS) : null; if (drmType != null && drmLicenseServer != null && Util.getDrmUuid(drmType) != null) { Log.d("setDrmType", drmType); UUID drmUUID = Util.getDrmUuid(drmType); videoView.setDrmType(drmUUID); videoView.setDrmLicenseUrl(drmLicenseServer); if (drmHeaders != null) { ArrayList<String> drmKeyRequestPropertiesList = new ArrayList<>(); ReadableMapKeySetIterator itr = drmHeaders.keySetIterator(); while (itr.hasNextKey()) { String key = itr.nextKey(); drmKeyRequestPropertiesList.add(key); drmKeyRequestPropertiesList.add(drmHeaders.getString(key)); } videoView.setDrmLicenseHeader(drmKeyRequestPropertiesList.toArray(new String[0])); } Log.d("setDrm", "Disabling TextureView (needed for DRM)"); videoView.setUseTextureView(false); } } }</code><technical_language>Debug logging</technical_language>

Target:
public void setDRM(final ReactExoplayerView videoView, @Nullable ReadableMap drm) { if (drm != null && drm.hasKey(PROP_DRM_TYPE)) { String drmType = drm.hasKey(PROP_DRM_TYPE) ? drm.getString(PROP_DRM_TYPE) : null; String drmLicenseServer = drm.hasKey(PROP_DRM_LICENSESERVER) ? drm.getString(PROP_DRM_LICENSESERVER) : null; ReadableMap drmHeaders = drm.hasKey(PROP_DRM_HEADERS) ? drm.getMap(PROP_DRM_HEADERS) : null; if (drmType != null && drmLicenseServer != null && Util.getDrmUuid(drmType) != null) { UUID drmUUID = Util.getDrmUuid(drmType); videoView.setDrmType(drmUUID); videoView.setDrmLicenseUrl(drmLicenseServer); if (drmHeaders != null) { ArrayList<String> drmKeyRequestPropertiesList = new ArrayList<>(); ReadableMapKeySetIterator itr = drmHeaders.keySetIterator(); while (itr.hasNextKey()) { String key = itr.nextKey(); drmKeyRequestPropertiesList.add(key); drmKeyRequestPropertiesList.add(drmHeaders.getString(key)); } videoView.setDrmLicenseHeader(drmKeyRequestPropertiesList.toArray(new String[0])); } videoView.setUseTextureView(false); } } }
Source:
<code>public void start(String[] filename) { Log.togglePrinting(); addToLog("[LAUNCHER]\tLoading file: " + filename + "."); try { addToLog("[LAUNCHER]\tLoading file: " + filename + " succeeded."); MapParser mp = new MapParser(); ArrayList<Level> levelList = new ArrayList<>(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = mp.parseMap(map); levelList.add(level); } Game game = new Game(levelList, levelList.get(0).getPlayers()); Map<Integer, Action> keyMappings = createSinglePlayerKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); <START> Level go = mp.parseMap(map); <END> game.setGameOver(go); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + filename + " failed."); new DumpLog(); throw new RuntimeException(); } }</code><technical_language>abreviations, refactor like: gameOverLevel <naming</technical_language>

Target:
public void start(String[] filename) { Log.togglePrinting(); addToLog("[LAUNCHER]\tLoading file: " + filename + "."); try { addToLog("[LAUNCHER]\tLoading file: " + filename + " succeeded."); MapParser mp = new MapParser(); ArrayList<Level> levelList = new ArrayList<>(); for(String levelFileName : filename) { InputStream map = getClass().getResourceAsStream(levelFileName); Level level = mp.parseMap(map); levelList.add(level); } Game game = new Game(levelList, levelList.get(0).getPlayers()); Map<Integer, Action> keyMappings = createSinglePlayerKeyMappings(game); JBubbleBobbleUI ui = new JBubbleBobbleUI(game, keyMappings); InputStream map = getClass().getResourceAsStream("/game_over.txt"); Level gameOverLevel = mp.parseMap(map); game.setGameOver(gameOverLevel); game.setKeyListener(ui.getKeyListener()); ui.start(); startScheduler(game); } catch (IOException e) { addToLog("[ERROR]\tLoading file: " + filename + " failed."); new DumpLog(); throw new RuntimeException(); } }
Source:
<code>public MesosCluster createMesosCluster(String path) { try (InputStream is = new FileInputStream(path)) { return createMesosCluster(is); <START> } catch (IOException e) { <END> throw new MinimesosException("Could not read minimesos config: " + e.getMessage()); } }</code><technical_language>![CRITICAL](<LINK_1> log rethrow this exception. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public MesosCluster createMesosCluster(String path) { try (InputStream is = new FileInputStream(path)) { return createMesosCluster(is); } catch (IOException e) { LOGGER.debug("Could not read minimesos config: ", e.getMessage()); throw new MinimesosException("Could not read minimesos config: " + e.getMessage()); } }
Source:
<code>private static boolean differentAnnotations(List<JavaSymbol> methodParamSymbols, List<JavaSymbol> overrideeParamSymbols) { for (int i = 0; i < methodParamSymbols.size(); i++) { SymbolMetadataResolve overrideeParamMetadata = overrideeParamSymbols.get(i).metadata(); SymbolMetadataResolve methodParamMetadata = methodParamSymbols.get(i).metadata(); <START> for (AnnotationInstance annotation : methodParamMetadata.annotations()) { <END> if (!overrideeParamMetadata.isAnnotatedWith(annotation.symbol().type().fullyQualifiedName())) { return true; } } } return false; }</code><technical_language>This factorized</technical_language>

Target:
private static boolean differentAnnotations(List<JavaSymbol> methodParamSymbols, List<JavaSymbol> overrideeParamSymbols) { for (int i = 0; i < methodParamSymbols.size(); i++) { if (differentAnnotations(methodParamSymbols.get(i).metadata(), overrideeParamSymbols.get(i).metadata())) { return true; } } return false; }
Source:
<code>public void shouldFindSwappedNodeInRangeSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); try ( org.neo4j.internal.kernel.api.Transaction tx = session.beginTransaction(); NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() ) { tx.dataWrite().nodeRemoveLabel( strOne, label ); tx.dataWrite().nodeAddLabel( strOneNoLabel, label ); tx.dataRead().nodeIndexSeek( index, node, IndexOrder.NONE, <START> IndexQuery.range( prop, "ett", true, "tre", true ) ); <END> assertTrue( node.next() ); assertEquals( strOneNoLabel, node.nodeReference() ); } }</code><technical_language>This test working accident... strOneNoLabel prop = "one", this test is scanning [ett,tre]. I strThree1, strThree2 strThree1 in range, if change order of returned results, this test start failing</technical_language>

Target:
public void shouldFindSwappedNodeInRangeSearch() throws Exception { int label = token.nodeLabel( "Node" ); int prop = token.propertyKey( "prop" ); CapableIndexReference index = schemaRead.index( label, prop ); try ( org.neo4j.internal.kernel.api.Transaction tx = session.beginTransaction(); NodeValueIndexCursor node = cursors.allocateNodeValueIndexCursor() ) { tx.dataWrite().nodeRemoveLabel( strOne, label ); tx.dataWrite().nodeAddLabel( strOneNoLabel, label ); tx.dataRead().nodeIndexSeek( index, node, IndexOrder.NONE, IndexQuery.range( prop, "one", true, "ones", true ) ); assertTrue( node.next() ); assertEquals( strOneNoLabel, node.nodeReference() ); assertFalse( node.next() ); } }
Source:
<code>public boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = <START> queryFactory.fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrNull(); ArtifactReadable baselineArtifact = queryFactory.fromBranch(branchId).fromTransaction(txId).andUuid(artId).getResults().getOneOrNull(); if (userReadable != null && baselineArtifact != null) { <END> TransactionBuilder tx = createTransaction(branchId, userReadable, comment); ArtifactReadable destination = queryFactory.fromBranch(branchId).includeDeletedArtifacts().andUuid(artId).getResults().getOneOrNull(); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } else { throw new OseeCoreException("%s Error - The user and baseline artifact were not found.", comment); } return introduced; }</code><technical_language>merged a commit check for SENTINEL Id in instances. Needs getOneOrDefault(ArtifactReadable.SENTINEL). Need do a rebase</technical_language>

Target:
public boolean replaceWithBaselineTxVersion(String userId, BranchId branchId, TransactionId txId, int artId, String comment) { boolean introduced = false; ArtifactReadable userReadable = queryFactory.fromBranch(CoreBranches.COMMON).andGuid(userId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); ArtifactReadable baselineArtifact = queryFactory.fromBranch(branchId).fromTransaction(txId).andUuid(artId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); if ((!userReadable.getId().equals(ArtifactReadable.SENTINEL.getId())) && (!baselineArtifact.getId().equals( ArtifactReadable.SENTINEL.getId()))) { TransactionBuilder tx = createTransaction(branchId, userReadable, comment); ArtifactReadable destination = queryFactory.fromBranch(branchId).includeDeletedArtifacts().andUuid(artId).getResults().getOneOrDefault( ArtifactReadable.SENTINEL); tx.replaceWithVersion(baselineArtifact, destination); tx.commit(); introduced = true; } else { throw new OseeCoreException("%s Error - The user and baseline artifact were not found.", comment); } return introduced; }
Source:
<code>public void unregisterDevice( final List<String> channels, final AsyncCallback<Void> callback ) { new AsyncTask<Void, Void, RuntimeException>() { @Override protected RuntimeException doInBackground( Void... params ) { try { Context context = ContextHandler.getAppContext(); <START> if ( BackendlessPushService.isFCM( context ) ) <END> FCMRegistration.unregisterDevice( context, channels ); else { if( !GCMRegistrar.isRegistered( context ) ) return new IllegalArgumentException( ExceptionMessage.DEVICE_NOT_REGISTERED ); GCMRegistrar.unregister( context ); } return null; } catch( RuntimeException t ) { return t; } } @Override protected void onPostExecute( RuntimeException result ) { if( result != null ) { if( callback == null ) throw result; callback.handleFault( new BackendlessFault( result ) ); } else { if( callback != null ) callback.handleResponse( null ); } } }.execute(); }</code><technical_language>add curly brackets</technical_language>

Target:
public void unregisterDevice( final List<String> channels, final AsyncCallback<Void> callback ) { new AsyncTask<Void, Void, RuntimeException>() { @Override protected RuntimeException doInBackground( Void... params ) { try { Context context = ContextHandler.getAppContext(); if ( BackendlessPushService.isFCM( context ) ) { FCMRegistration.unregisterDevice( context, channels ); } else { if( !GCMRegistrar.isRegistered( context ) ) return new IllegalArgumentException( ExceptionMessage.DEVICE_NOT_REGISTERED ); GCMRegistrar.unregister( context ); } return null; } catch( RuntimeException t ) { return t; } } @Override protected void onPostExecute( RuntimeException result ) { if( result != null ) { if( callback == null ) throw result; callback.handleFault( new BackendlessFault( result ) ); } else { if( callback != null ) callback.handleResponse( null ); } } }.execute(); }
Source:
<code>private void printGroupRecord(ExtMap extMap) { if (extMap != null) { do { logger.info( "GroupRecord: ID '{}', name: '{}', namespace: '{}', display name: '{}'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") ); <START> } while((extMap = extMap.get(Authz.GroupRecord.GROUPS)) != null); <END> } }</code><technical_language>this recursive</technical_language>

Target:
private void printGroupRecord(ExtMap extMap) { if (extMap != null) { log.info( "GroupRecord: ID '{}', name: '{}', namespace: '{}', display name: '{}'", extMap.get(Authz.GroupRecord.ID, ""), extMap.get(Authz.GroupRecord.NAME, ""), extMap.get(Authz.GroupRecord.NAMESPACE, ""), extMap.get(Authz.GroupRecord.DISPLAY_NAME, "") ); } }
Source:
<code>public void addResourceHandlers(ResourceHandlerRegistry registry) { String staticPathPatterns[] = new String[] {" *.js" , " *.png" , " *.jpg" , " *.swf" , " *.csv" , " *.css" , " *.html" , " *.gif" , " *.ico" , " *.woff2" , " *.woff" , " *.ttf"}; <START> registry.addResourceHandler(staticPathPatterns).addResourceLocations(this.resourceProperties.getStaticLocations()); <END> }</code><technical_language>cache period</technical_language>

Target:
public void addResourceHandlers(ResourceHandlerRegistry registry) { String staticPathPatterns[] = new String[] {" *.js" , " *.png" , " *.jpg" , " *.swf" , " *.csv" , " *.css" , " *.html" , " *.gif" , " *.ico" , " *.woff2" , " *.woff" , " *.ttf"}; registry.addResourceHandler(staticPathPatterns).addResourceLocations(this.resourceProperties.getStaticLocations()).setCachePeriod(3600); }
Source:
<code>protected GraphDatabaseBuilder.DatabaseCreator createDatabaseCreator( final File storeDir, final GraphDatabaseFactoryState state ) { return new GraphDatabaseBuilder.DatabaseCreator() { @Override public GraphDatabaseService newDatabase( Map<String,String> config ) { return newDatabase( Config.defaults( config ) ); } @Override public GraphDatabaseService newDatabase( Config config ) { <START> config.augment( "unsupported.dbms.ephemeral", FALSE ); <END> return new EnterpriseGraphDatabase( storeDir, config, state.databaseDependencies() ); } }; }</code><technical_language>update code reference setting instead of string here</technical_language>

Target:
protected GraphDatabaseBuilder.DatabaseCreator createDatabaseCreator( final File storeDir, final GraphDatabaseFactoryState state ) { return new GraphDatabaseBuilder.DatabaseCreator() { @Override public GraphDatabaseService newDatabase( Map<String,String> config ) { return newDatabase( Config.defaults( config ) ); } @Override public GraphDatabaseService newDatabase( Config config ) { config.augment( GraphDatabaseFacadeFactory.Configuration.ephemeral, FALSE ); return new EnterpriseGraphDatabase( storeDir, config, state.databaseDependencies() ); } }; }
Source:
<code><START> public void handleGetFirmwareVersionResponse(final List<FirmwareVersionDto> firmwareVersions, <END> final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while getting device firmware version", e); } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject((Serializable) firmwareVersions).build()); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Method 7 parameters, is greater 6 authorized. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
public void handleGetFirmwareVersionResponse(final List<FirmwareVersionDto> firmwareVersions, final String deviceIdentification, final String organisationIdentification, final String correlationUid, final String messageType, final ResponseMessageResultType deviceResult, final OsgpException exception) { LOGGER.info("handleResponse for MessageType: {}", messageType); ResponseMessageResultType result = ResponseMessageResultType.OK; OsgpException osgpException = exception; try { if (deviceResult == ResponseMessageResultType.NOT_OK || osgpException != null) { LOGGER.error("Device Response not ok.", osgpException); throw osgpException; } } catch (final Exception e) { LOGGER.error("Unexpected Exception", e); result = ResponseMessageResultType.NOT_OK; osgpException = new TechnicalException(ComponentType.UNKNOWN, "Exception occurred while getting device firmware version", e); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(result).withOsgpException(osgpException) .withDataObject((Serializable) firmwareVersions).build(); this.webServiceResponseMessageSender.send(responseMessage); }
Source:
<code>public void findMultipleWithQueryShouldSupportRealAndAliasedPropertyNamesForFieldExclusions() { <START> ObjectWith3AliasedFields obj0 = new ObjectWith3AliasedFields().withId("4711").withProperty1("P10") <END> .withProperty1("P20").withProperty1("P30"); ObjectWith3AliasedFields obj1 = new ObjectWith3AliasedFields().withId("4712").withProperty1("P11") .withProperty1("P21").withProperty1("P31"); template.insert(obj0); template.insert(obj1); Query query = new Query(Criteria.where("id").in(obj0.id, obj1.id)); query.fields() .exclude("property2") .exclude("prop3"); List<ObjectWith3AliasedFields> results = template.find(query, ObjectWith3AliasedFields.class); assertThat(results, is(notNullValue())); assertThat(results.size(), is(2)); ObjectWith3AliasedFields result0 = results.get(0); assertThat(result0, is(notNullValue())); assertThat(result0.id, is(obj0.id)); assertThat(result0.property1, is(obj0.property1)); assertThat(result0.property2, is(nullValue())); assertThat(result0.property3, is(nullValue())); ObjectWith3AliasedFields result1 = results.get(1); assertThat(result1, is(notNullValue())); assertThat(result1.id, is(obj1.id)); assertThat(result1.property1, is(obj1.property1)); assertThat(result1.property2, is(nullValue())); assertThat(result1.property3, is(nullValue())); }</code><technical_language>get rid ( ) methods set fields directly</technical_language>

Target:
public void findMultipleWithQueryShouldSupportRealAndAliasedPropertyNamesForFieldExclusions() { ObjectWith3AliasedFields obj0 = new ObjectWith3AliasedFields(); obj0.id = "4711"; obj0.property1 = "P10"; obj0.property2 = "P20"; obj0.property3 = "P30"; ObjectWith3AliasedFields obj1 = new ObjectWith3AliasedFields(); obj1.id = "4712"; obj1.property1 = "P11"; obj1.property2 = "P21"; obj1.property3 = "P31"; template.insert(obj0); template.insert(obj1); Query query = new Query(Criteria.where("id").in(obj0.id, obj1.id)); query.fields() .exclude("property2") .exclude("prop3"); List<ObjectWith3AliasedFields> results = template.find(query, ObjectWith3AliasedFields.class); assertThat(results, is(notNullValue())); assertThat(results.size(), is(2)); ObjectWith3AliasedFields result0 = results.get(0); assertThat(result0, is(notNullValue())); assertThat(result0.id, is(obj0.id)); assertThat(result0.property1, is(obj0.property1)); assertThat(result0.property2, is(nullValue())); assertThat(result0.property3, is(nullValue())); ObjectWith3AliasedFields result1 = results.get(1); assertThat(result1, is(notNullValue())); assertThat(result1.id, is(obj1.id)); assertThat(result1.property1, is(obj1.property1)); assertThat(result1.property2, is(nullValue())); assertThat(result1.property3, is(nullValue())); }
Source:
<code>private String getLastSuccessfulRun(OrcsApi orcsApi) { String toReturn = "Last run time not set"; ArtifactReadable webGroup = <START> orcsApi.getQueryFactory(null).fromBranch(CoreBranches.COMMON).andIsOfType(CoreArtifactTypes.UniversalGroup).andNameEquals( <END> "Web Programs").getResults().getOneOrNull(); if (webGroup != null) { List<String> staticIds = webGroup.getAttributeValues(CoreAttributeTypes.StaticId); for (String staticId : staticIds) { if (staticId.startsWith(LAST_SUCCESSFUL_RUN)) { String[] tokens = staticId.split("="); if (tokens.length == 2) { Date date = new Date(Long.parseLong(tokens[1])); SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); toReturn = String.format("Last successful synchronization:\n%s", dateFormat.format(date)); break; } } } } return toReturn; }</code><technical_language>instead of this artifact name, create a token instead? i this artifact is referenced elsewhere</technical_language>

Target:
private String getLastSuccessfulRun(OrcsApi orcsApi) { String toReturn = "Last run time not set"; ArtifactReadable webGroup = orcsApi.getQueryFactory(null).fromBranch(CoreBranches.COMMON).andIds(AtsArtifactToken.WebPrograms).getResults().getExactlyOne(); if (webGroup != null) { List<String> staticIds = webGroup.getAttributeValues(CoreAttributeTypes.StaticId); for (String staticId : staticIds) { if (staticId.startsWith(LAST_SUCCESSFUL_RUN)) { String[] tokens = staticId.split("="); if (tokens.length == 2) { Date date = new Date(Long.parseLong(tokens[1])); SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); toReturn = String.format("Last successful synchronization:\n%s", dateFormat.format(date)); break; } } } } return toReturn; }
Source:
<code>UserDTO getBlockedUser(ProcessDTO process) { UserDTO result = null; if (MetadatenSperrung.isLocked(process.getId())) { String userID = this.msp.getLockBenutzer(process.getId()); try { result = serviceManager.getUserService().findById(Integer.valueOf(userID)); } catch (Exception e) { <START> logger.error(e.getMessage(), e); <END> Helper.setFehlerMeldung(Helper.getTranslation("userNotFound"), e); } } return result; }</code><technical_language>setErrorMessage</technical_language>

Target:
UserDTO getBlockedUser(ProcessDTO process) { UserDTO result = null; if (MetadatenSperrung.isLocked(process.getId())) { String userID = this.msp.getLockBenutzer(process.getId()); try { result = serviceManager.getUserService().findById(Integer.valueOf(userID)); } catch (DataException | RuntimeException e) { Helper.setErrorMessage(Helper.getTranslation("userNotFound"), logger, e); } } return result; }
Source:
<code>private void validate(ValidationContext vCxt, Graph data, Shape shape, Node focusNode) { if ( ! active ) return; Set<Node> actual = properties(data, focusNode); <START> boolean conforms = true; <END> for ( Node p : actual ) { if ( ! expected.contains(p) && ! ignoredProperties.contains(p) ) { Path path = PathFactory.pathLink(p); G.listSP(data, focusNode, p).forEach(o-> { String msg = toString()+" Property = "+displayStr(p)+" : Object = "+displayStr(o); vCxt.builder().addReportEntry(msg, shape, focusNode, path, o, this); }); } } }</code><technical_language>used</technical_language>

Target:
private void validate(ValidationContext vCxt, Graph data, Shape shape, Node focusNode) { if ( ! active ) return; Set<Node> actual = properties(data, focusNode); for ( Node p : actual ) { if ( ! expected.contains(p) && ! ignoredProperties.contains(p) ) { Path path = PathFactory.pathLink(p); G.listSP(data, focusNode, p).forEach(o-> { String msg = toString()+" Property = "+displayStr(p)+" : Object = "+displayStr(o); vCxt.reportEntry(msg, shape, focusNode, path, o, this); }); } } }
Source:
<code>public Number getValue(int pollerIdx) { AtomicLong n = getNumber(); <START> return n == null ? Double.NaN : n.get(); <END> }</code><technical_language>do return number.get();</technical_language>

Target:
public Number getValue(int pollerIdx) { return number.get(); }
Source:
<code>public void setIsVolumeTypeChangable(boolean isVolumeTypeChangable) { if (this.isVolumeTypeChangable != isVolumeTypeChangable) { this.isVolumeTypeChangable = isVolumeTypeChangable; <START> onPropertyChanged(new PropertyChangedEventArgs("VolumeFormat")); END> } }</code><technical_language>If want do correctly property name changed VolumeFormat VolumeType</technical_language>

Target:
public void setIsVolumeTypeChangable(boolean isVolumeTypeChangable) { if (this.isVolumeTypeChangable != isVolumeTypeChangable) { this.isVolumeTypeChangable = isVolumeTypeChangable; onPropertyChanged(new PropertyChangedEventArgs(VOLUME_TYPE)); } }
Source:
<code>public long throttleTime( final ThrottleInfo info ) { if ( adjustmentNeeded() ) { calculateStats( info ); if ( lastSliceTps > limiterTps ) { <START> if ( currentSleepTime.peek() <= 0 ) <END> { currentSleepTime.reset(); } else { currentSleepTime.next(); } } else { if ( currentSleepTime.peek() > 0 ) { currentSleepTime.prev(); } } if ( callback != null ) { callback.onAdjustment( this ); } } return currentSleepTime.peek(); }</code><technical_language>If this correctly, a starting delay (NumberSequence) of 0, slow -- i.e. end calling currentSleepTime.next(). If so, handle differently</technical_language>

Target:
public long throttleTime( final ThrottleInfo info ) { if ( adjustmentNeeded() ) { calculateStats( info ); if ( lastSliceTps > limiterTps ) { if ( currentSleepTime.peek() < 0 ) { currentSleepTime.reset(); } else { currentSleepTime.next(); } } else { if ( currentSleepTime.peek() > 0 ) { currentSleepTime.prev(); } } if ( callback != null ) { callback.onAdjustment( this ); } } return currentSleepTime.peek(); }
Source:
<code>private void setupPipeline(SocketChannel channel, RouteMatcher router) { final ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("decoder", new HttpRequestDecoder() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable thr) throws Exception { try { if (ctx.channel().isWritable()) { log.debug("request decoder error " + thr.getCause().toString() + " on channel " + ctx.channel().toString()); ctx.channel().write( new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.BAD_REQUEST)) .addListener(ChannelFutureListener.CLOSE); } else { log.debug("channel " + ctx.channel().toString() + " is no longer writeable, not sending 400 response back to client"); } } catch (Exception ex) { log.debug("Can't write to channel " + ctx.channel().toString(), ex); } } }); pipeline.addLast("inflater", new HttpContentDecompressor()); pipeline.addLast("chunkaggregator", new HttpObjectAggregator(Constants.MAX_CONTENT_LENGTH)); <START> pipeline.addLast("encoder2", new HttpResponseDecoder()); <END> pipeline.addLast("handler", new QueryStringDecoderAndRouter(router)); }</code><technical_language>change this "encoder"</technical_language>

Target:
private void setupPipeline(SocketChannel channel, RouteMatcher router) { final ChannelPipeline pipeline = channel.pipeline(); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("decoder", new HttpRequestDecoder() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable thr) throws Exception { try { if (ctx.channel().isWritable()) { log.debug("request decoder error " + thr.getCause().toString() + " on channel " + ctx.channel().toString()); ctx.channel().write( new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.BAD_REQUEST)) .addListener(ChannelFutureListener.CLOSE); } else { log.debug("channel " + ctx.channel().toString() + " is no longer writeable, not sending 400 response back to client"); } } catch (Exception ex) { log.debug("Can't write to channel " + ctx.channel().toString(), ex); } } }); pipeline.addLast("inflater", new HttpContentDecompressor()); pipeline.addLast("chunkaggregator", new HttpObjectAggregator(httpMaxContentLength)); pipeline.addLast("respdecoder", new HttpResponseDecoder()); pipeline.addLast("handler", new QueryStringDecoderAndRouter(router)); }
Source:
<code>public Block bigintDistinct(@SqlType("array(bigint)") Block array) { if (array.getPositionCount() == 0) { return array; } boolean containsNull = false; <START> TypedSet typedSet = new TypedSet(BIGINT, array.getPositionCount(), "array_distinct"); <END> int distinctCount = 0; if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder distinctElementBlockBuilder = pageBuilder.getBlockBuilder(0); for (int i = 0; i < array.getPositionCount(); i++) { if (array.isNull(i)) { if (!containsNull) { containsNull = true; distinctElementBlockBuilder.appendNull(); distinctCount++; } continue; } if (!typedSet.contains(array, i)) { typedSet.add(array, i); distinctCount++; BIGINT.appendTo(array, i, distinctElementBlockBuilder); } } pageBuilder.declarePositions(distinctCount); return distinctElementBlockBuilder.getRegion(distinctElementBlockBuilder.getPositionCount() - distinctCount, distinctCount); }</code><technical_language>#10794, this specialization type long native container type . TypedSet here. for confusion</technical_language>

Target:
public Block bigintDistinct(@SqlType("array(bigint)") Block array) { if (array.getPositionCount() == 0) { return array; } boolean containsNull = false; LongSet set = new LongOpenHashSet(array.getPositionCount()); int distinctCount = 0; if (pageBuilder.isFull()) { pageBuilder.reset(); } BlockBuilder distinctElementBlockBuilder = pageBuilder.getBlockBuilder(0); for (int i = 0; i < array.getPositionCount(); i++) { if (array.isNull(i)) { if (!containsNull) { containsNull = true; distinctElementBlockBuilder.appendNull(); distinctCount++; } continue; } long value = BIGINT.getLong(array, i); if (!set.contains(value)) { set.add(value); distinctCount++; BIGINT.appendTo(array, i, distinctElementBlockBuilder); } } pageBuilder.declarePositions(distinctCount); return distinctElementBlockBuilder.getRegion(distinctElementBlockBuilder.getPositionCount() - distinctCount, distinctCount); }