auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setupSourceLayers(StatisticalDatasource source) { final DatasourceHelper helper = DatasourceHelper.getInstance(); final DataSource dataSource = helper.getDataSource(helper.getOskariDataSourceName()); final SqlSessionFactory factory = initializeIBatis(dataSource); try (final SqlSession session = factory.openSession()) { final List<DatasourceLayer> layerRows = session.getMapper(DatasourceLayerMapper.class).getLayersForDatasource(source.getId()); Map<Long, List<Permissions>> permissions = ServiceFactory.getPermissionsService() .getPermissionsForLayers(layerRows.stream() .map(DatasourceLayer::getMaplayerId) .collect(Collectors.toList()), Permissions.PERMISSION_TYPE_VIEW_LAYER); layerRows.forEach( layer -> layer.addRoles(getRoleIdsForLayer( permissions.get(layer.getMaplayerId())))); source.setLayers(layerRows); } }

Target:
public void setupSourceLayers(StatisticalDatasource source) { final DatasourceHelper helper = DatasourceHelper.getInstance(); final DataSource dataSource = helper.getDataSource(helper.getOskariDataSourceName()); final SqlSessionFactory factory = initializeIBatis(dataSource); try (final SqlSession session = factory.openSession()) { final List<DatasourceLayer> layerRows = session.getMapper(DatasourceLayerMapper.class).getLayersForDatasource(source.getId()); List<Long> layerIdList = layerRows.stream() .map(DatasourceLayer::getMaplayerId) .collect(Collectors.toList()); Map<Long, List<Permissions>> permissions = ServiceFactory.getPermissionsService() .getPermissionsForLayers(layerIdList, Permissions.PERMISSION_TYPE_VIEW_LAYER); layerRows.forEach(layer -> attachRoles(layer, permissions)); source.setLayers(layerRows); } }
Source:
public List<EncounterTransaction.DrugOrder> mapDrugOrders(Encounter encounter) { List<EncounterTransaction.DrugOrder> orders = new ArrayList<EncounterTransaction.DrugOrder>(); for (Order order : encounter.getOrders()) { if (DrugOrder.class.equals(order.getOrderType().getJavaClass())) { if (order instanceof HibernateProxy) { Hibernate.initialize(order); order = (DrugOrder) ((HibernateProxy) order).getHibernateLazyInitializer().getImplementation(); } orders.add(mapDrugOrder((DrugOrder) order)); } } return orders; }

Target:
public List<EncounterTransaction.DrugOrder> mapDrugOrders(Encounter encounter) { List<EncounterTransaction.DrugOrder> orders = new ArrayList<EncounterTransaction.DrugOrder>(); for (Order order : encounter.getOrders()) { order = HibernateUtil.getRealObjectFromProxy(order); if (DrugOrder.class.equals(order.getClass())) { orders.add(mapDrugOrder((DrugOrder) order)); } } return orders; }
Source:
public Boolean exists(Collection<Object> collection, LambdaValue lambda) { Boolean result = Boolean.FALSE; if (collection != null && lambda == null) { result = Boolean.FALSE; } else { for (Object input : collection) { try { if (Boolean.TRUE.equals(lambda.eval(new Object[] {input }))) { result = Boolean.TRUE; break; } } catch (Exception e) { } } } return result; }

Target:
public Boolean exists(Collection<Object> collection, LambdaValue lambda) { Boolean result = Boolean.FALSE; if (collection != null && lambda != null) { for (Object input : collection) { try { if (Boolean.TRUE.equals(lambda.eval(new Object[] {input }))) { result = Boolean.TRUE; break; } } catch (Exception e) { } } } return result; }
Source:
public int estimatedInMemorySize() { return SIZE_OF_KHYPERLOGLOG + SIZE_OF_RBTREEMAP + minhash.size() * SIZE_OF_LONG + minhash.values().stream().mapToInt(HyperLogLog::estimatedInMemorySize).sum(); }

Target:
public int estimatedInMemorySize() { return SIZE_OF_KHYPERLOGLOG + SIZE_OF_RBTREEMAP + minhash.size() * SIZE_OF_LONG + hllsTotalEstimatedInMemorySize * SIZE_OF_BYTE; }
Source:
public List<RecordedEvent> deserializeRecordedEvents(String filePath) { List<RecordedEvent> events = new ArrayList<>(); try (Reader reader = new FileReader(filePath)) { Gson gson = new GsonBuilder().create(); PersistedData record = gson.fromJson(reader, GsonPersistedData.class); Optional<List<RecordedEvent>> recordedEvents = recordedEventListTypeHandler.deserialize(record); recordedEvents.ifPresent(events::addAll); } catch (IOException e) { logger.error("Error while serializing recorded events", e); } return events; }

Target:
public List<RecordedEvent> deserializeRecordedEvents(String filePath) { List<RecordedEvent> events = new ArrayList<>(); try (Reader reader = new FileReader(filePath)) { Gson gson = new GsonBuilder().create(); JsonElement jsonElement = gson.fromJson(reader, JsonElement.class); PersistedData persistedData = new GsonPersistedData(jsonElement); Optional<List<RecordedEvent>> recordedEvents = recordedEventListTypeHandler.deserialize(persistedData); recordedEvents.ifPresent(events::addAll); if (!recordedEvents.isPresent()) { logger.error("Some problem occurred during deserialization, no recorded events was found"); } } catch (IOException e) { logger.error("Error while serializing recorded events", e); } return events; }
Source:
private static void validateFilterKeys(Set<String> metricsKeys) { String invalidKeys = metricsKeys.stream() .filter(k -> !METRIC_KEYS.contains(k)) .map(k -> '\''+k+'\'') .collect(Collectors.joining(", ")); checkArgument(invalidKeys.isEmpty(), "Following metrics are not supported: %s", invalidKeys); }

Target:
private static void validateFilterKeys(Set<String> metricsKeys) { String invalidKeys = metricsKeys.stream() .filter(metric -> !METRIC_KEYS.contains(metric)) .map(metric -> '\''+metric+'\'') .collect(Collectors.joining(", ")); checkArgument(invalidKeys.isEmpty(), "Following metrics are not supported: %s", invalidKeys); }
Source:
public synchronized void close() { if (mSaslClient != null) { try { mSaslClient.dispose(); mSaslClient = null; } catch (SaslException exc) { LOG.debug("Failed to close SaslClient.", exc); } } }

Target:
public synchronized void close() { if (mSaslClient != null) { try { mSaslClient.dispose(); } catch (SaslException exc) { LOG.debug("Failed to close SaslClient.", exc); } finally { mSaslClient = null; } } }
Source:
protected void makeInnerQualifyingSet() { if (presentStream == null) { numInnerRows = inputQualifyingSet.getPositionCount(); hasNulls = false; return; } hasNulls = true; boolean nonDeterministic = filter != null && !deterministicFilter; if (innerQualifyingSet == null) { innerQualifyingSet = new QualifyingSet(); } int[] inputRows = inputQualifyingSet.getPositions(); int numActive = inputQualifyingSet.getPositionCount(); innerQualifyingSet.reset(numActive); int prevRow = 0; int prevInner = innerPosInRowGroup; numNullsToAdd = 0; boolean keepNulls = filter == null || (!nonDeterministic && filter.testNull()); for (int activeIdx = 0; activeIdx < numActive; activeIdx++) { int row = inputRows[activeIdx] - posInRowGroup; if (!present[row]) { if (keepNulls) { addNullToKeep(inputRows[activeIdx], activeIdx); } } else { prevInner += countPresent(prevRow, row); prevRow = row; innerQualifyingSet.append(prevInner, activeIdx); } } numInnerRows = innerQualifyingSet.getPositionCount(); int skip = countPresent(prevRow, inputQualifyingSet.getEnd() - posInRowGroup); innerQualifyingSet.setEnd(skip + prevInner); }

Target:
protected void makeInnerQualifyingSet() { if (presentStream == null) { numInnerRows = inputQualifyingSet.getPositionCount(); hasNulls = false; return; } hasNulls = true; if (innerQualifyingSet == null) { innerQualifyingSet = new QualifyingSet(); } int[] inputRows = inputQualifyingSet.getPositions(); int numActive = inputQualifyingSet.getPositionCount(); innerQualifyingSet.reset(numActive); int prevRow = 0; int prevInner = innerPosInRowGroup; numNullsToAdd = 0; boolean keepNulls = filter == null || (deterministicFilter && filter.testNull()); for (int activeIdx = 0; activeIdx < numActive; activeIdx++) { int row = inputRows[activeIdx] - posInRowGroup; if (!present[row]) { if (keepNulls) { addNullToKeep(inputRows[activeIdx], activeIdx); } } else { prevInner += countPresent(prevRow, row); prevRow = row; innerQualifyingSet.append(prevInner, activeIdx); } } numInnerRows = innerQualifyingSet.getPositionCount(); int skip = countPresent(prevRow, inputQualifyingSet.getEnd() - posInRowGroup); innerQualifyingSet.setEnd(skip + prevInner); }
Source:
private void setupEditors() { BooleanFieldEditor invertColors = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, MessagesForPreferences.GdbConsolePreferencePage_INVERT_COLORS, getFieldEditorParent()); IntegerFieldEditor editorBufferSize = new IntegerFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES, MessagesForPreferences.GdbConsolePreferencePage_BUFFERLINES, getFieldEditorParent()); editorBufferSize.setValidRange(MIN_BUFFER_LINES, Integer.MAX_VALUE); addField(invertColors); addField(editorBufferSize); }

Target:
private void setupEditors() { BooleanFieldEditor invertColors = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS, MessagesForPreferences.GdbConsolePreferencePage_InvertColors, getFieldEditorParent()); IntegerFieldEditor editorBufferSize = new IntegerFieldEditor(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES, MessagesForPreferences.GdbConsolePreferencePage_BufferLines, getFieldEditorParent()); editorBufferSize.setValidRange(MIN_BUFFER_LINES, 2000000000); addField(invertColors); addField(editorBufferSize); }
Source:
private JsonObject toJson(Timer timer, TimeUnit rateUnit, TimeUnit durationUnit) { Snapshot snapshot = timer.getSnapshot(); JsonObject json = new JsonObject(); populateMetered(json, timer, rateUnit); double factor = 1.0 / durationUnit.toNanos(1); populateSnapshot(json, snapshot, factor); String duration = durationUnit.toString().toLowerCase(Locale.US); json.putString("durationRate", duration); return json; }

Target:
private JsonObject toJson(Timer timer, TimeUnit rateUnit, TimeUnit durationUnit) { Snapshot snapshot = timer.getSnapshot(); JsonObject json = new JsonObject(); populateMetered(json, timer, rateUnit); double factor = 1.0 / durationUnit.toNanos(1); populateSnapshot(json, snapshot, factor); String duration = durationUnit.toString().toLowerCase(); json.putString("durationRate", duration); return json; }
Source:
public CreateGlusterVolumeSnapshotCommand(CreateGlusterVolumeSnapshotParameters params) { super(params); this.snapshot = params.getSnapshot(); this.force = params.getForce(); if (this.snapshot != null) { setVdsGroupId(this.snapshot.getClusterId()); } volumeId = snapshot.getVolumeId(); }

Target:
public CreateGlusterVolumeSnapshotCommand(CreateGlusterVolumeSnapshotParameters params) { super(params); this.snapshot = params.getSnapshot(); this.force = params.getForce(); if (this.snapshot != null) { setVdsGroupId(this.snapshot.getClusterId()); setGlusterVolumeId(snapshot.getVolumeId()); } }
Source:
OneTimePasswordImpl(final String algorithm, final char[] password, final OneTimePasswordAlgorithmSpec spec) throws SaslException { this(algorithm, generateOTP(algorithm, getNormalizedPasswordBytes(password), new String(spec.getSeed()).toLowerCase(Locale.ENGLISH).getBytes(StandardCharsets.US_ASCII), spec.getSequenceNumber() ), spec.getSeed().clone(), spec.getSequenceNumber()); }

Target:
OneTimePasswordImpl(final String algorithm, final char[] password, final OneTimePasswordAlgorithmSpec spec) throws SaslException { this(algorithm, generateOTP(algorithm, getNormalizedPasswordBytes(password), spec.getSeed().toLowerCase(Locale.ENGLISH), spec.getSequenceNumber() ), spec.getSeed(), spec.getSequenceNumber()); }
Source:
private Mono<RxDocumentServiceResponse> query(RxDocumentServiceRequest request) { if(request.getOperationType() != OperationType.QueryPlan) { request.getHeaders().put(HttpConstants.HttpHeaders.IS_QUERY, "true"); } else { request.getHeaders().remove(HttpConstants.HttpHeaders.SESSION_TOKEN); } switch (this.queryCompatibilityMode) { case SqlQuery: request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.SQL); break; case Default: case Query: default: request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.QUERY_JSON); break; } return this.performRequest(request, HttpMethod.POST); }

Target:
private Mono<RxDocumentServiceResponse> query(RxDocumentServiceRequest request) { if(request.getOperationType() != OperationType.QueryPlan) { request.getHeaders().put(HttpConstants.HttpHeaders.IS_QUERY, "true"); } switch (this.queryCompatibilityMode) { case SqlQuery: request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.SQL); break; case Default: case Query: default: request.getHeaders().put(HttpConstants.HttpHeaders.CONTENT_TYPE, RuntimeConstants.MediaTypes.QUERY_JSON); break; } return this.performRequest(request, HttpMethod.POST); }
Source:
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { return null; }

Target:
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { throw new UnsupportedOperationException("HPCCResultSet: getPseudoColumns Not supported yet."); }
Source:
private void buildProjectsTree(final List<ProjectData> result) { treeContents = null; treeContents = new ProjectsTreeContents(result, ProjectScreen.INFO); treeContents.addTreeNodeCheckHandler(new CheckBoxSelectionHandler() { @Override public void onValueChange(CheckBoxSelectionEvent checkBoxSelectionEvent) { final boolean isChecked = checkBoxSelectionEvent.isChecked(); final String projectName = checkBoxSelectionEvent.getProjectName(); hideOnSuccessPanel(); setSelectedProjectsTable(isChecked, projectName); } }); treeNodesMap = null; projectNodesMap = null; treeNodesMap = treeContents.getTreeNodesMap(); projectNodesMap = treeContents.getProjectNodesMap(); rootWildProject = treeContents.getRootWildProject(); projectsTree.addItem(rootWildProject); projectsTree.getItem(0).setState(true); }

Target:
private void buildProjectsTree(final List<ProjectData> result) { treeContents = new ProjectsTreeContents(result, ProjectScreen.INFO); treeContents.addTreeNodeCheckHandler(new CheckBoxSelectionHandler() { @Override public void onValueChange(CheckBoxSelectionEvent checkBoxSelectionEvent) { final boolean isChecked = checkBoxSelectionEvent.isChecked(); final String projectName = checkBoxSelectionEvent.getProjectName(); hideOnSuccessPanel(); setSelectedProjectsTable(isChecked, projectName); } }); treeNodesMap = treeContents.getTreeNodesMap(); projectNodesMap = treeContents.getProjectNodesMap(); rootWildProject = treeContents.getRootWildProject(); projectsTree.addItem(rootWildProject); projectsTree.getItem(0).setState(true); }
Source:
protected IStatus run(IProgressMonitor monitor) { String contents = runStap(new String[] {"-v", "-p1", "-e"}, "probe begin{}", false); if (contents == null) { return new Status(IStatus.ERROR, IDEPlugin.PLUGIN_ID, ""); } int firstTagIndex = contents.indexOf(TAG_FILE); if (firstTagIndex != -1) { int beginIndex = contents.indexOf(TAG_FILE, firstTagIndex + 1); if (beginIndex != -1) { tapsetContents = contents.substring(beginIndex); } } return new Status(IStatus.OK, IDEPlugin.PLUGIN_ID, ""); }

Target:
protected IStatus run(IProgressMonitor monitor) { String contents = runStap(STAP_OPTIONS, STAP_DUMMYPROBE, false); if (contents == null) { return new Status(IStatus.ERROR, IDEPlugin.PLUGIN_ID, Messages.SharedParser_NoOutput); } int firstTagIndex = contents.indexOf(TAG_FILE); if (firstTagIndex != -1) { int beginIndex = contents.indexOf(TAG_FILE, firstTagIndex + 1); if (beginIndex != -1) { tapsetContents = contents.substring(beginIndex); } } return new Status(IStatus.OK, IDEPlugin.PLUGIN_ID, ""); }
Source:
public static IndexClient getInstance() { if (INSTANCE == null) { synchronized (IndexClient.class) { INSTANCE = new IndexClient(); } } return INSTANCE; }

Target:
public static IndexClient getInstance() { if (INSTANCE == null) { synchronized (IndexClient.class) { if (INSTANCE == null) { INSTANCE = new IndexClient(); } } } return INSTANCE; }
Source:
public void shouldSetSecretParameter() { Config config = Config.builder() .withSetting( MySettingsWithDefaults.password, "this should not be visible" ) .withSetting( MySettingsWithDefaults.hello, "ABC" ) .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ) .build(); assertTrue( config.getConfigValues().get( MySettingsWithDefaults.password.name() ).isSecret() ); assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).isSecret() ); String configText = config.toString(); assertTrue( configText.contains( Secret.OBSFUCATED ) ); assertFalse( configText.contains( "this should not be visible" ) ); assertFalse( configText.contains( config.get( MySettingsWithDefaults.password ) ) ); }

Target:
public void shouldSetSecretParameter() { Config config = Config.builder() .withSetting( MySettingsWithDefaults.password, "this should not be visible" ) .withSetting( MySettingsWithDefaults.hello, "ABC" ) .withConfigClasses( Arrays.asList( mySettingsWithDefaults, myMigratingSettings ) ) .build(); assertTrue( config.getConfigValues().get( MySettingsWithDefaults.password.name() ).secret() ); assertFalse( config.getConfigValues().get( MySettingsWithDefaults.hello.name() ).secret() ); String configText = config.toString(); assertTrue( configText.contains( Secret.OBSFUCATED ) ); assertFalse( configText.contains( "this should not be visible" ) ); assertFalse( configText.contains( config.get( MySettingsWithDefaults.password ) ) ); }
Source:
private String ingestXmlWithProduct(String filename) throws IOException { Path path = Paths.get(filename); if (Files.exists(path)) { Files.delete(Paths.get(filename)); } Files.createFile(path); Files.write(path, Collections.singleton(SAMPLE_DATA)); String fileLocation = path.toUri().toURL().toString(); LOGGER.debug("File Location: {}", fileLocation); return ingest(getSimpleXml(fileLocation), "text/xml"); }

Target:
private String ingestXmlWithProduct(String filename) throws IOException { Path path = Paths.get(filename); if (Files.exists(path)) { Files.delete(path); } Files.createFile(path); Files.write(path, Collections.singleton(SAMPLE_DATA)); String fileLocation = path.toUri().toURL().toString(); LOGGER.debug("File Location: {}", fileLocation); return ingest(getSimpleXml(fileLocation), "text/xml"); }
Source:
public static ImageLicense parseImageLicenseMetadata(JSONObject extmetadata) { try { String license = ""; String licenseShortName = ""; String licenseUrl = ""; Iterator<String> keys = extmetadata.keys(); while (keys.hasNext()) { String key = keys.next(); String value = extmetadata.getJSONObject(key).getString("value"); switch (key) { case "License": license = value; break; case "LicenseShortName": licenseShortName = value; break; case "LicenseUrl": licenseUrl = value; break; default: break; } } Log.d(TAG, "Lead image license: " + license); Log.d(TAG, "Lead image license short name: " + licenseShortName); Log.d(TAG, "Lead image license URL: " + licenseUrl); return new ImageLicense(license, licenseShortName, licenseUrl); } catch (Exception e) { Log.d(TAG, "Caught exception: " + e.getMessage()); return null; } }

Target:
public static ImageLicense parseImageLicenseMetadata(JSONObject extmetadata) { Log.d(TAG, "extmetadata: " + extmetadata.toString()); try { String license = ""; String licenseShortName = ""; String licenseUrl = ""; Iterator<String> keys = extmetadata.keys(); while (keys.hasNext()) { String key = keys.next(); String value = extmetadata.getJSONObject(key).getString("value"); switch (key) { case "License": license = value; break; case "LicenseShortName": licenseShortName = value; break; case "LicenseUrl": licenseUrl = value; break; default: break; } } Log.d(TAG, "Found lead image license=" + license + ", short name=" + licenseShortName + ", url=" + licenseUrl); return new ImageLicense(license, licenseShortName, licenseUrl); } catch (JSONException e) { Log.d(TAG, "Caught exception: " + e.getMessage(), e); return null; } }
Source:
List<TopicPartition> closeRevokedStandbyTasks(final Map<TaskId, Set<TopicPartition>> revokedTasks) { log.debug("Closing revoked standby tasks {}", revokedTasks); final List<TopicPartition> revokedChangelogs = new ArrayList<>(); for (final Map.Entry<TaskId, Set<TopicPartition>> entry : revokedTasks.entrySet()) { final TaskId taskId = entry.getKey(); final StandbyTask task; if (running.containsKey(taskId)) { task = running.get(taskId); } else if (created.containsKey(taskId)) { task = created.get(taskId); } else { log.error("Could not find the standby task while closing it", taskId); continue; } try { task.close(true, false); } catch (final RuntimeException e) { log.error("Closing the standby task failed due to the following error:", task.id(), e); } finally { removeTaskFromAllOldMaps(task, null); revokedChangelogs.addAll(task.changelogPartitions()); } } return revokedChangelogs; }

Target:
List<TopicPartition> closeRevokedStandbyTasks(final Map<TaskId, Set<TopicPartition>> revokedTasks) { log.debug("Closing revoked standby tasks {}", revokedTasks); final List<TopicPartition> revokedChangelogs = new ArrayList<>(); for (final Map.Entry<TaskId, Set<TopicPartition>> entry : revokedTasks.entrySet()) { final TaskId taskId = entry.getKey(); final StandbyTask task; if (running.containsKey(taskId)) { task = running.get(taskId); } else if (created.containsKey(taskId)) { task = created.get(taskId); } else { log.error("Could not find the standby task while closing it", taskId); continue; } try { task.close(true, false); } catch (final RuntimeException e) { log.error("Closing the standby task failed due to the following error:", task.id(), e); } finally { removeTaskFromAllStateMaps(task, Collections.emptyMap()); revokedChangelogs.addAll(task.changelogPartitions()); } } return revokedChangelogs; }
Source:
private synchronized void updateTaggedMemoryAllocations(QueryId queryId, String allocationTag, long delta) { Map<String, Long> allocations = taggedMemoryAllocations.computeIfAbsent(queryId, ignored -> new HashMap<>()); Long value = allocations.get(allocationTag); if (value == null) { allocations.put(allocationTag, delta); return; } value = value + delta; if (value <= 0) { allocations.remove(allocationTag); } else { allocations.put(allocationTag, value); } }

Target:
private synchronized void updateTaggedMemoryAllocations(QueryId queryId, String allocationTag, long delta) { Map<String, Long> allocations = taggedMemoryAllocations.computeIfAbsent(queryId, ignored -> new HashMap<>()); allocations.compute(allocationTag, (ignored, oldValue) -> { if (oldValue == null) { return delta; } long newValue = oldValue.longValue() + delta; if (newValue == 0) { return null; } return newValue; }); }
Source:
public void addWorkDefinition(IAtsWorkDefinition workDef) { WorkDefinitionFactory.get(); WorkDefinitionFactory.instance.addWorkDefinition(workDef); }

Target:
public void addWorkDefinition(IAtsWorkDefinition workDef) { factory.addWorkDefinition(workDef); }
Source:
public final int update(final String table, final String key, final HashMap<String, ByteIterator> values) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = BuilderFactory.start().add("_id", key); final DocumentBuilder update = BuilderFactory.start(); final DocumentBuilder fieldsToSet = update.push("$set"); for (final Map.Entry<String, ByteIterator> entry : values.entrySet()) { fieldsToSet.add(entry.getKey(), entry.getValue().toArray()); } final long res = collection.update(query, update, false, false, writeConcern); return res == 1 ? StatusCode.OK : StatusCode.ERROR; } catch (final Exception e) { System.err.println(e.toString()); return StatusCode.ERROR; } }

Target:
public final Status update(final String table, final String key, final HashMap<String, ByteIterator> values) { try { final MongoCollection collection = database.getCollection(table); final DocumentBuilder query = BuilderFactory.start().add("_id", key); final DocumentBuilder update = BuilderFactory.start(); final DocumentBuilder fieldsToSet = update.push("$set"); for (final Map.Entry<String, ByteIterator> entry : values.entrySet()) { fieldsToSet.add(entry.getKey(), entry.getValue().toArray()); } final long res = collection.update(query, update, false, false, writeConcern); return res == 1 ? Status.OK : Status.NOT_FOUND; } catch (final Exception e) { System.err.println(e.toString()); return Status.ERROR; } }
Source:
public void onRefreshButtonClicked() { JavaFxUtil.assertBackgroundThread(); mapService.evictCache(); switch (state.get()) { case SHOWROOM: displayShowroomMaps(); break; case SEARCH_RESULT: currentPage--; currentSupplier.get() .thenAccept(this::displayMaps) .exceptionally(throwable -> { notificationService.addNotification(new ImmediateErrorNotification( i18n.get("errorTitle"), i18n.get("vault.mods.searchError"), throwable, i18n, reportingService )); enterShowroomState(); return null; }); break; default: } }

Target:
public void onRefreshButtonClicked() { mapService.evictCache(); switch (state.get()) { case SHOWROOM: displayShowroomMaps(); break; case SEARCH_RESULT: currentSupplier.get() .thenAccept(this::displayMaps) .exceptionally(throwable -> { notificationService.addNotification(new ImmediateErrorNotification( i18n.get("errorTitle"), i18n.get("vault.mods.searchError"), throwable, i18n, reportingService )); enterShowroomState(); return null; }); break; default: } }
Source:
void addRamAttributes( Map<String, InternalMachineConfig> machines, Map<String, ComposeService> services) throws InfrastructureException { for (Entry<String, ComposeService> entry : services.entrySet()) { InternalMachineConfig machineConfig; if ((machineConfig = machines.get(entry.getKey())) == null) { machineConfig = new InternalMachineConfig(); machines.put(entry.getKey(), machineConfig); } initIfEmpty( () -> entry.getValue().getMemLimit(), machineConfig, MEMORY_LIMIT_ATTRIBUTE, defaultMachineMaxMemorySizeAttribute); initIfEmpty( () -> entry.getValue().getMemRequest(), machineConfig, MEMORY_REQUEST_ATTRIBUTE, defaultMachineRequestMemorySizeAttribute); } }

Target:
void addRamAttributes( Map<String, InternalMachineConfig> machines, Map<String, ComposeService> services) throws InfrastructureException { for (Entry<String, ComposeService> entry : services.entrySet()) { InternalMachineConfig machineConfig; if ((machineConfig = machines.get(entry.getKey())) == null) { machineConfig = new InternalMachineConfig(); machines.put(entry.getKey(), machineConfig); } memoryProvisioner.provision( machineConfig, entry.getValue().getMemLimit(), entry.getValue().getMemRequest()); } }
Source:
public void testReadFromInserter() throws IOException { ObjectInserter ins = db.newObjectInserter(); ObjectId id1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo")); ObjectId id2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("bar")); assertEquals(0, db.getObjectDatabase().listPacks().size()); ObjectReader reader = ins.newReader(db); assertEquals("foo", readObject(reader.open(id1))); assertEquals("bar", readObject(reader.open(id2))); assertEquals(0, db.getObjectDatabase().listPacks().size()); ins.flush(); assertEquals(1, db.getObjectDatabase().listPacks().size()); }

Target:
public void testReadFromInserter() throws IOException { ObjectInserter ins = db.newObjectInserter(); ObjectId id1 = ins.insert(Constants.OBJ_BLOB, Constants.encode("foo")); ObjectId id2 = ins.insert(Constants.OBJ_BLOB, Constants.encode("bar")); assertEquals(0, db.getObjectDatabase().listPacks().size()); ObjectReader reader = ins.newReader(); assertEquals("foo", readObject(reader.open(id1))); assertEquals("bar", readObject(reader.open(id2))); assertEquals(0, db.getObjectDatabase().listPacks().size()); ins.flush(); assertEquals(1, db.getObjectDatabase().listPacks().size()); }
Source:
private void prefetch() { while (this.inner.hasNext() && !Thread.currentThread().isInterrupted()) { final SAMRecord next = this.inner.peek(); final int bases = next.getReadLength(); try { synchronized (this.basesAllowed) { while (this.basesAllowed.get() < bases && this.basesAllowed.get() < this.basePrefetchLimit) { if (Thread.currentThread().isInterrupted()) { return; } this.basesAllowed.wait(); } this.basesAllowed.addAndGet(-bases); } synchronized (this) { this.inner.next(); this.queue.add(new Either(next)); } } catch (final InterruptedException e) { return; } catch (final Throwable t) { this.queue.add(new Either(t)); } } }

Target:
private void prefetch() { while (this.inner.hasNext() && !Thread.currentThread().isInterrupted()) { final SAMRecord next = this.inner.peek(); final int bases = next.getReadLength(); try { synchronized (this.basesAllowed) { int basesAllowed = this.basesAllowed.get(); while (basesAllowed < bases && basesAllowed < this.basePrefetchLimit) { if (Thread.currentThread().isInterrupted()) { return; } this.basesAllowed.wait(); basesAllowed = this.basesAllowed.get(); } this.basesAllowed.addAndGet(-bases); } synchronized (this) { this.inner.next(); this.queue.add(new Either(next)); } } catch (final InterruptedException e) { return; } catch (final Throwable t) { if (t instanceof Error) { t.printStackTrace(); } this.queue.add(new Either(t)); } } }
Source:
public void testFtpUrlsHandledByFtpUrlConnection() throws Exception { URLConnection connection = fileUrl.openConnection(); assertEquals(FtpURLConnection.class, connection.getClass()); }

Target:
public void testFtpUrlsHandledByFtpUrlConnection() throws Exception { URL fileUrl = addFileEntry(FILE_PATH, fileContents); URLConnection connection = fileUrl.openConnection(); assertEquals("sun.net.www.protocol.ftp.FtpURLConnection", connection.getClass().getName()); }
Source:
public Map<String, Class<?>> getTypeMap() throws SQLException { checkClosed(); return new HashMap<String, Class<?>>(getTypeMapNoCopy()); }

Target:
public Map<String, Class<?>> getTypeMap() throws SQLException { checkClosed(); return new LinkedHashMap<String, Class<?>>(udtMap.getTypeMap()); }
Source:
private void reconstructMasterDomainNotInSync(final Guid storagePoolId, final Guid masterDomainId, final String exceptionMessage, final String logMessage) { ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(_storagePoolId, masterDomainId, null, EventType.RECONSTRUCT), new Callable<EventResult>() { @Override public EventResult call() { EventResult result = null; log.warnFormat(logMessage); AuditLogableBase logable = new AuditLogableBase(mCurrentVdsId); logable.setStorageDomainId(masterDomainId); AuditLogDirector.log(logable, AuditLogType.SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC); result = ResourceManager.getInstance() .getEventListener() .masterDomainNotOperational(masterDomainId, storagePoolId); return result; } }); throw new IRSNoMasterDomainException(exceptionMessage); }

Target:
private void reconstructMasterDomainNotInSync(final Guid storagePoolId, final Guid masterDomainId, final String exceptionMessage, final String logMessage) { ((EventQueue) EjbUtils.findBean(BeanType.EVENTQUEUE_MANAGER, BeanProxyType.LOCAL)).submitEventSync(new Event(_storagePoolId, masterDomainId, null, EventType.RECONSTRUCT), new Callable<EventResult>() { @Override public EventResult call() { log.warnFormat(logMessage); AuditLogableBase logable = new AuditLogableBase(mCurrentVdsId); logable.setStorageDomainId(masterDomainId); AuditLogDirector.log(logable, AuditLogType.SYSTEM_MASTER_DOMAIN_NOT_IN_SYNC); return ResourceManager.getInstance() .getEventListener() .masterDomainNotOperational(masterDomainId, storagePoolId); } }); throw new IRSNoMasterDomainException(exceptionMessage); }
Source:
private String getImportText(DetailAST ast) { final FullIdent imp; if (ast.getType() == TokenTypes.IMPORT) { imp = FullIdent.createFullIdentBelow(ast); } else { imp = FullIdent.createFullIdent(ast .getFirstChild().getNextSibling()); } return imp.getText(); }

Target:
private static String getImportText(DetailAST ast) { final FullIdent imp; if (ast.getType() == TokenTypes.IMPORT) { imp = FullIdent.createFullIdentBelow(ast); } else { imp = FullIdent.createFullIdent(ast .getFirstChild().getNextSibling()); } return imp.getText(); }
Source:
private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { gmfDiagram.removeEdge(connector); } if (noteAttachmentsToRemove.length > 0) { StringBuilder sb = new StringBuilder(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_title); sb.append(MessageFormat.format(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_edgesRemoved, noteAttachmentsToRemove.length)); DiagramPlugin.getDefault().logInfo(sb.toString()); } }

Target:
private void deleteNoteAttachmentWithoutSourceOrTarget(Diagram gmfDiagram) { Iterable<Connector> noteAttachmentsToRemoveIter = Iterables.filter(Iterables.filter(gmfDiagram.getEdges(), Connector.class), new Predicate<Connector>() { @Override public boolean apply(Connector connector) { if (ViewType.NOTEATTACHMENT.equals(connector.getType())) { if (connector.getSource() == null || connector.getTarget() == null) { return true; } } return false; } }); Connector[] noteAttachmentsToRemove = Iterables.toArray(noteAttachmentsToRemoveIter, Connector.class); for (Connector connector : noteAttachmentsToRemove) { gmfDiagram.removeEdge(connector); } if (noteAttachmentsToRemove.length > 0) { sb.append(MessageFormat.format(Messages.NoteAttachmentWithoutSourceOrTargetMigrationParticipant_edgesRemoved, gmfDiagram.getName(), noteAttachmentsToRemove.length)); } }
Source:
protected boolean mustBeRemoved(@Nonnull JDefinedClassOrInterface type) { if (type == stringDef || type == intDef) { return true; } if (type instanceof JDefinedAnnotationType) { if ((!type.getAnnotations(stringDef).isEmpty()) || !type.getAnnotations(intDef).isEmpty()) { JDefinedAnnotationType typeDef = (JDefinedAnnotationType) type; if (typeDef.getRetentionPolicy() != JRetentionPolicy.SOURCE) { type.getSession().getReporter().report(Severity.NON_FATAL, new InvalidRetentionForTypeDef(typeDef)); } return true; } } return false; }

Target:
protected boolean mustBeRemoved(@Nonnull JDefinedClassOrInterface type) { if (type == stringDef || type == intDef) { return true; } if (type instanceof JDefinedAnnotationType) { if ((!type.getAnnotations(stringDef).isEmpty()) || !type.getAnnotations(intDef).isEmpty()) { JDefinedAnnotationType typeDef = (JDefinedAnnotationType) type; if (typeDef.getRetentionPolicy() != JRetentionPolicy.SOURCE) { type.getSession().getReporter().report(Severity.NON_FATAL, new InvalidRetentionForTypeDef(typeDef)); } return true; } } else if ((!type.getAnnotations(stringDef).isEmpty()) || !type.getAnnotations(intDef).isEmpty()) { Jack.getSession().getReporter().report(Severity.NON_FATAL, new InvalidTypeDefTarget(type)); } return false; }
Source:
private GoogleClientSecrets loadClientSecretFromJson() throws IOException { InputStream in; try { in = new FileInputStream(new File(TestProperties.TEST_GMAIL_API_FOLDER, "client_secret.json")); } catch (FileNotFoundException e) { throw new RuntimeException("You need to setup your client_secret.json." + System.lineSeparator() + "See <LINK_0>", e); } return GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); }

Target:
private GoogleClientSecrets loadClientSecretFromJson() throws IOException { InputStream in; try { in = new FileInputStream(new File(TestProperties.TEST_GMAIL_API_FOLDER, "client_secret.json")); } catch (FileNotFoundException e) { throw new RuntimeException("You need to set up your Gmail API credentials." + Const.EOL + "See docs/development.md section \"Deploying to a staging server\".", e); } return GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); }
Source:
public void testSliceSamplingOfNormalDistribution() { final double mean = 5.; final double standardDeviation = 0.75; final NormalDistribution normalDistribution = new NormalDistribution(mean, standardDeviation); final Function<Double, Double> normalLogPDF = x -> normalDistribution.logDensity(x); final double xInitial = 4.5; final double xMin = Double.NEGATIVE_INFINITY; final double xMax = Double.POSITIVE_INFINITY; final double width = 0.5; final int numSamples = 20000; final SliceSampler normalSampler = new SliceSampler(rng, normalLogPDF, xInitial, xMin, xMax, width); final List<Double> samples = normalSampler.sample(numSamples); final double sampleMean = new Mean().evaluate(Doubles.toArray(samples)); final double sampleStandardDeviation = new StandardDeviation().evaluate(Doubles.toArray(samples)); Assert.assertEquals(relativeError(sampleMean, mean), 0., 0.0005); Assert.assertEquals(relativeError(sampleStandardDeviation, standardDeviation), 0., 0.02); }

Target:
public void testSliceSamplingOfNormalDistribution() { final double mean = 5.; final double standardDeviation = 0.75; final NormalDistribution normalDistribution = new NormalDistribution(mean, standardDeviation); final Function<Double, Double> normalLogPDF = normalDistribution::logDensity; final double xInitial = 1.; final double xMin = Double.NEGATIVE_INFINITY; final double xMax = Double.POSITIVE_INFINITY; final double width = 0.5; final int numSamples = 20000; final SliceSampler normalSampler = new SliceSampler(rng, normalLogPDF, xInitial, xMin, xMax, width); final List<Double> samples = normalSampler.sample(numSamples); final double sampleMean = new Mean().evaluate(Doubles.toArray(samples)); final double sampleStandardDeviation = new StandardDeviation().evaluate(Doubles.toArray(samples)); Assert.assertEquals(relativeError(sampleMean, mean), 0., 0.0005); Assert.assertEquals(relativeError(sampleStandardDeviation, standardDeviation), 0., 0.02); }
Source:
private boolean addCertificateToTrustStore(Certificate cert) throws CertificateManagerException, Exception { ImportCertificateRequestMessageType requestMessage = createImportCertRequest(cert); ImportCertificateResponseMessageType response = (ImportCertificateResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, "importCertificate", requestMessage); return response.isStatus(); }

Target:
private boolean addCertificateToTrustStore(Certificate cert) throws CertificateManagerException { try { ImportCertificateRequestMessageType requestMessage = createImportCertRequest(cert); ImportCertificateResponseMessageType response = (ImportCertificateResponseMessageType) getClient().invokePort(EntityConfigAdminPortType.class, "importCertificate", requestMessage); return response.isStatus(); } catch (Exception ex) { throw new CertificateManagerException("Error sending import request message.", ex); } }
Source:
public PlanNode visitSemiJoin(SemiJoinNode node, RewriteContext<Void> context) { PlanNode sourceRewritten = context.rewrite(node.getSource(), context.get()); PlanNode filteringSourceRewritten = context.rewrite(node.getFilteringSource(), context.get()); SemiJoinNode rewrittenNode = new SemiJoinNode( node.getId(), sourceRewritten, filteringSourceRewritten, node.getSourceJoinSymbol(), node.getFilteringSourceJoinSymbol(), node.getSemiJoinOutput(), node.getSourceHashSymbol(), node.getFilteringSourceHashSymbol(), Optional.empty()); if (isDeleteQuery) { return rewrittenNode.withDistributionType(REPLICATED); } return rewrittenNode; }

Target:
public PlanNode visitSemiJoin(SemiJoinNode node, RewriteContext<Void> context) { PlanNode sourceRewritten = context.rewrite(node.getSource(), context.get()); PlanNode filteringSourceRewritten = context.rewrite(node.getFilteringSource(), context.get()); SemiJoinNode rewrittenNode = new SemiJoinNode( node.getId(), sourceRewritten, filteringSourceRewritten, node.getSourceJoinSymbol(), node.getFilteringSourceJoinSymbol(), node.getSemiJoinOutput(), node.getSourceHashSymbol(), node.getFilteringSourceHashSymbol(), node.getDistributionType()); if (isDeleteQuery) { return rewrittenNode.withDistributionType(REPLICATED); } return rewrittenNode; }
Source:
public void rendersPage() throws Exception { final Base base = new MkBase(); final String alias = "test"; final String urn = "urn:test:1"; base.user(URN.create(urn)).aliases().add(alias); MatcherAssert.assertThat( new RsPrint( new TkIndex(base).act( new RqWithHeader( new RqWithAuth(urn), "Accept", "text/xml" ) )).printBody(), XhtmlMatchers.hasXPaths( "/page/alias/email", "/page/links/link[@rel='save-email']/@href" ) ); }

Target:
public void rendersPage() throws Exception { final Base base = new MkBase(); final String alias = "test"; final String urn = "urn:test:1"; base.user(URN.create(urn)).aliases().add(alias); MatcherAssert.assertThat( new RsPrint( new TkIndex(base).act(new RqWithAuth(urn)) ).printBody(), XhtmlMatchers.hasXPaths( "/page/alias/email", "/page/links/link[@rel='save-email']/@href" ) ); }
Source:
public boolean matches(ITmfEvent event) { for (ITmfFilterTreeNode node : getChildren()) { if (! node.matches(event)) { return false ^ fNot; } } return false ^ fNot; }

Target:
public boolean matches(ITmfEvent event) { if (getChildren().length == 0) { return false ^ fNot; } for (ITmfFilterTreeNode node : getChildren()) { if (! node.matches(event)) { return false ^ fNot; } } return true ^ fNot; }
Source:
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled) { if (jandexStrategyDisabled) { CommonLogger.LOG.jandexDiscoveryStrategyDisabled(); } else { if (Jandex.isJandexAvailable(resourceLoader)) { CommonLogger.LOG.usingJandex(); try { return Jandex.createJandexDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } } return new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); }

Target:
public static DiscoveryStrategy create(ResourceLoader resourceLoader, Bootstrap bootstrap, Set<Class<? extends Annotation>> initialBeanDefiningAnnotations, boolean jandexStrategyDisabled) { if (Jandex.isJandexAvailable(resourceLoader)) { if (jandexStrategyDisabled) { CommonLogger.LOG.jandexDiscoveryStrategyDisabled(); } else { CommonLogger.LOG.usingJandex(); try { return Jandex.createJandexDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); } catch (Exception e) { throw CommonLogger.LOG.unableToInstantiate(Jandex.JANDEX_DISCOVERY_STRATEGY_CLASS_NAME, Arrays.toString(new Object[] { resourceLoader, bootstrap, initialBeanDefiningAnnotations }), e); } } } return new ReflectionDiscoveryStrategy(resourceLoader, bootstrap, initialBeanDefiningAnnotations); }
Source:
public void addTo(DSeries series) { final HistogramStatistics statistics = histogram.getStatistics(); series.add(new StaticDMetric(statistics.getMean(), withMetricNameSuffix(metaData, "avg"))); series.add(new StaticDMetric(histogram.getCount(), withMetricNameSuffix(metaData, "count"))); series.add(new StaticDMetric(statistics.getQuantile(.5), withMetricNameSuffix(metaData, "median"))); series.add(new StaticDMetric(statistics.getQuantile(.95), withMetricNameSuffix(metaData, "95percentile"))); series.add(new StaticDMetric(statistics.getMin(), withMetricNameSuffix(metaData, "min"))); series.add(new StaticDMetric(statistics.getMax(), withMetricNameSuffix(metaData, "max"))); }

Target:
public void addTo(DSeries series) { final HistogramStatistics statistics = histogram.getStatistics(); series.add(new StaticDMetric(statistics.getMean(), metaDataAvg)); series.add(new StaticDMetric(histogram.getCount(), metaDataCount)); series.add(new StaticDMetric(statistics.getQuantile(.5), metaDataMedian)); series.add(new StaticDMetric(statistics.getQuantile(.95), metaData95Percentile)); series.add(new StaticDMetric(statistics.getMin(), metaDataMin)); series.add(new StaticDMetric(statistics.getMax(), metaDataMax)); }
Source:
public OutputStream openOutputStream(String filePath) throws IOException { try { DistributedLogManager dlm = namespace.openLog( filePath); LedgerMetadata metadata = new LedgerMetadata(); metadata.setApplication(Constants.LEDGER_METADATA_APPLICATION_STREAM_STORAGE); metadata.setComponent("checkpoint-store"); AsyncLogWriter writer = Utils.ioResult(dlm.openAsyncLogWriter()); return new BufferedOutputStream( new DLOutputStream(dlm, writer), 128 * 1024); } catch (LogNotFoundException le) { throw new FileNotFoundException(filePath); } }

Target:
public OutputStream openOutputStream(String filePath) throws IOException { try { DistributedLogManager dlm = namespace.openLog( filePath); LedgerMetadata metadata = new LedgerMetadata(); metadata.setApplication(Constants.LEDGER_METADATA_APPLICATION_STREAM_STORAGE); metadata.setComponent("checkpoint-store"); AsyncLogWriter writer = Utils.ioResult(dlm.openAsyncLogWriter(metadata)); return new BufferedOutputStream( new DLOutputStream(dlm, writer), 128 * 1024); } catch (LogNotFoundException le) { throw new FileNotFoundException(filePath); } }
Source:
public Optional<String> getGroupId() { return Optional.of("org.junit.platform.suite"); }

Target:
public Optional<String> getGroupId() { return Optional.of("org.junit.platform"); }
Source:
@Test public void testBitOrFunc() { tester.setFor(SqlStdOperatorTable.BIT_OR, VM_FENNEL, VM_JAVA); tester.checkFails("bit_or(^*^)", "Unknown identifier '\\*'", false); tester.checkType("bit_or(1)", "INTEGER"); tester.checkType("bit_or(CAST(2 AS TINYINT))", "TINYINT"); tester.checkType("bit_or(CAST(2 AS SMALLINT))", "SMALLINT"); tester.checkType("bit_or(distinct CAST(2 AS BIGINT))", "BIGINT"); tester.checkType("bit_or(CAST(x'02' AS BINARY(1)))", "BINARY(1)"); tester.checkFails("^bit_or(1.2)^", "Cannot apply 'BIT_OR' to arguments of type 'BIT_OR\\(<DECIMAL\\(2, 1\\)>\\)'\\. Supported form\\(s\\): 'BIT_OR\\(<INTEGER>\\)'\n" + "'BIT_OR\\(<BINARY>\\)'", false); tester.checkFails( "^bit_or()^", "Invalid number of arguments to function 'BIT_OR'. Was expecting 1 arguments", false); tester.checkFails( "^bit_or(1, 2)^", "Invalid number of arguments to function 'BIT_OR'. Was expecting 1 arguments", false); final String[] values = {"1", "2", "2"}; tester.checkAgg("bit_or(x)", values, 3, 0); final String[] binaryValues = { "CAST(x'01' AS BINARY)", "cast(x'02' as BINARY)", "cast(x'02' AS BINARY)"}; tester.checkAgg("bit_or(x)", binaryValues, "03", 0); }

Target:
@Test void testBitOrFunc() { tester.setFor(SqlStdOperatorTable.BIT_OR, VM_FENNEL, VM_JAVA); tester.checkFails("bit_or(^*^)", "Unknown identifier '\\*'", false); tester.checkType("bit_or(1)", "INTEGER"); tester.checkType("bit_or(CAST(2 AS TINYINT))", "TINYINT"); tester.checkType("bit_or(CAST(2 AS SMALLINT))", "SMALLINT"); tester.checkType("bit_or(distinct CAST(2 AS BIGINT))", "BIGINT"); tester.checkType("bit_or(CAST(x'02' AS BINARY(1)))", "BINARY(1)"); tester.checkFails("^bit_or(1.2)^", "Cannot apply 'BIT_OR' to arguments of type 'BIT_OR\\(<DECIMAL\\(2, 1\\)>\\)'\\. Supported form\\(s\\): 'BIT_OR\\(<INTEGER>\\)'\n" + "'BIT_OR\\(<BINARY>\\)'", false); tester.checkFails( "^bit_or()^", "Invalid number of arguments to function 'BIT_OR'. Was expecting 1 arguments", false); tester.checkFails( "^bit_or(1, 2)^", "Invalid number of arguments to function 'BIT_OR'. Was expecting 1 arguments", false); final String[] values = {"1", "2", "2"}; tester.checkAgg("bit_or(x)", values, 3, 0); final String[] binaryValues = { "CAST(x'01' AS BINARY)", "cast(x'02' as BINARY)", "cast(x'02' AS BINARY)", "cast(null AS BINARY)"}; tester.checkAgg("bit_or(x)", binaryValues, "03", 0); tester.checkAgg("bit_or(x)", new String[]{"CAST(x'02' AS BINARY)"}, "02", 0); }