auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<List<Expression>> analyzeGroupBy(QuerySpecification node, Scope scope, List<Expression> outputExpressions) { List<Set<Expression>> computedGroupingSets = ImmutableList.of(); if (node.getGroupBy().isPresent()) { List<List<Set<Expression>>> enumeratedGroupingSets = node.getGroupBy().get().getGroupingElements().stream() .map(GroupingElement::enumerateGroupingSets) .collect(toImmutableList()); checkGroupingElementCount(node.getGroupBy().get(), enumeratedGroupingSets); computedGroupingSets = computeGroupingSetsCrossProduct(enumeratedGroupingSets, node.getGroupBy().get().isDistinct()); checkState(!computedGroupingSets.isEmpty(), "computed grouping sets cannot be empty"); } else if (hasAggregates(node)) { computedGroupingSets = ImmutableList.of(ImmutableSet.of()); } List<List<Expression>> analyzedGroupingSets = computedGroupingSets.stream() .map(groupingSet -> analyzeGroupingColumns(groupingSet, node, scope, outputExpressions)) .collect(toImmutableList()); analysis.setGroupingSets(node, analyzedGroupingSets); return analyzedGroupingSets; }

Target:
private List<List<Expression>> analyzeGroupBy(QuerySpecification node, Scope scope, List<Expression> outputExpressions) { List<Set<Expression>> computedGroupingSets = ImmutableList.of(); if (node.getGroupBy().isPresent()) { checkGroupingSetsCount(node.getGroupBy().get()); List<List<Set<Expression>>> enumeratedGroupingSets = node.getGroupBy().get().getGroupingElements().stream() .map(GroupingElement::enumerateGroupingSets) .collect(toImmutableList()); computedGroupingSets = computeGroupingSetsCrossProduct(enumeratedGroupingSets, node.getGroupBy().get().isDistinct()); checkState(!computedGroupingSets.isEmpty(), "computed grouping sets cannot be empty"); } else if (hasAggregates(node)) { computedGroupingSets = ImmutableList.of(ImmutableSet.of()); } List<List<Expression>> analyzedGroupingSets = computedGroupingSets.stream() .map(groupingSet -> analyzeGroupingColumns(groupingSet, node, scope, outputExpressions)) .collect(toImmutableList()); analysis.setGroupingSets(node, analyzedGroupingSets); return analyzedGroupingSets; }
Source:
private HashMap<String, String> arrayToMap(String[] input) { if (input == null || input.length == 0) { return new HashMap<String, String>(); } HashMap<String, String> hm = new HashMap<String, String>(); for (int i = 0; i < input.length; i++) { if (!"".equals(input[i].trim())) { hm.put(input[i], input[i]); } } return hm; }

Target:
private HashMap<String, String> arrayToMap(String[] input) { if (input == null || input.length == 0) { return new HashMap<String, String>(); } HashMap<String, String> hm = new HashMap<>(); for (int i = 0; i < input.length; i++) { if (!"".equals(input[i].trim())) { hm.put(input[i], input[i]); } } return hm; }
Source:
public void sendMessage_namedDestination_doesNotSendFirebaseMessage() { Message message = Mockito.mock(Message.class); MessageDestination namedMessageDestination = Mockito.mock(MessageDestination.class); User user = Mockito.mock(User.class); when(user.getNamedMessageDestination()).thenReturn(namedMessageDestination); service.sendNamedMessage(message, user); verify(mockFirebaseService, never()).sendMessage("Firebase-12345", message); }

Target:
public void sendMessage_namedDestination_doesNotSendFirebaseMessage() { Message message = Mockito.mock(Message.class); MessageDestination namedMessageDestination = Mockito.mock(MessageDestination.class); User user = Mockito.mock(User.class); when(user.getNamedMessageDestination()).thenReturn(namedMessageDestination); service.sendDirectMessage(message, user); verify(mockFirebaseService, never()).sendMessage(FIREBASE_REGISTRATION_TOKEN, message); }
Source:
public void setPreferredApiVersion(@Nullable String availableApiVersions) { try { if(availableApiVersions == null) { this.preferredApiVersion = null; return; } JSONArray versionsArray = new JSONArray(availableApiVersions); Collection<ApiVersion> supportedApiVersions = new ArrayList<>(versionsArray.length()); for (int i = 0; i < versionsArray.length(); i++) { ApiVersion parsedApiVersion = ApiVersion.of(versionsArray.getString(i)); for (ApiVersion temp : NotesClient.SUPPORTED_API_VERSIONS) { if (temp.compareTo(parsedApiVersion) == 0) { supportedApiVersions.add(parsedApiVersion); break; } } } this.preferredApiVersion = Collections.max(supportedApiVersions); } catch (JSONException | NoSuchElementException e) { e.printStackTrace(); this.preferredApiVersion = null; } }

Target:
public void setPreferredApiVersion(@Nullable String availableApiVersions) { try { if (availableApiVersions == null) { this.preferredApiVersion = null; return; } JSONArray versionsArray = new JSONArray(availableApiVersions); Collection<ApiVersion> supportedApiVersions = new HashSet<>(versionsArray.length()); for (int i = 0; i < versionsArray.length(); i++) { ApiVersion parsedApiVersion = ApiVersion.of(versionsArray.getString(i)); for (ApiVersion temp : NotesClient.SUPPORTED_API_VERSIONS) { if (temp.compareTo(parsedApiVersion) == 0) { supportedApiVersions.add(parsedApiVersion); break; } } } this.preferredApiVersion = Collections.max(supportedApiVersions); } catch (JSONException | NoSuchElementException e) { e.printStackTrace(); this.preferredApiVersion = null; } }
Source:
protected void scanFile(XmlFile xmlFile) { evaluateAsList(actionsExpression, xmlFile.getNamespaceUnawareDocument()) .forEach(node -> { List<Secondary> secondaries = new ArrayList<>(); evaluateAsList(forwardsFromActionExpression, node).stream().skip(maximumForwards) .forEach(forward -> { Secondary secondary = new Secondary(forward, "Move this forward to another action."); secondaries.add(secondary); }); if (!secondaries.isEmpty()) { int cost = secondaries.size(); int numberForward = maximumForwards + cost; String message = "Reduce the number of forwards in this action from " + numberForward + " to at most " + maximumForwards + "."; reportIssue(XmlFile.nodeLocation(node), message, secondaries); } }); }

Target:
protected void scanFile(XmlFile xmlFile) { evaluateAsList(actionsExpression, xmlFile.getNamespaceUnawareDocument()) .forEach(this::checkAction); }
Source:
public Host addHost(PerunSession sess, Host host, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addHost"); } Utils.notNull(host, "hosts"); List<Facility> facilitiesByHostname = getFacilitiesManagerBl().getFacilitiesByHostName(sess, host.getHostname()); List<Facility> facilitiesByDestination = getFacilitiesByDestination(sess, host.getHostname()); if(facilitiesByHostname.isEmpty() && facilitiesByDestination.isEmpty()) { return getFacilitiesManagerBl().addHost(sess, host, facility); } if(!facilitiesByHostname.isEmpty()) { boolean hasRight = false; for(Facility f: facilitiesByHostname) { if(AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, f)) { hasRight = true; break; } } if(hasRight) return getFacilitiesManagerBl().addHost(sess, host, facility); } if(!facilitiesByDestination.isEmpty()) { boolean hasRight = false; for(Facility f: facilitiesByDestination) { if(AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, f)) { hasRight = true; break; } } if(hasRight) return getFacilitiesManagerBl().addHost(sess, host, facility); } throw new PrivilegeException(sess, "You can't add this host."); }

Target:
public Host addHost(PerunSession sess, Host host, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Utils.checkPerunSession(sess); getFacilitiesManagerBl().checkFacilityExists(sess, facility); if (!AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, facility)) { throw new PrivilegeException(sess, "addHost"); } Utils.notNull(host, "hosts"); List<Facility> facilitiesByHostname = getFacilitiesManagerBl().getFacilitiesByHostName(sess, host.getHostname()); List<Facility> facilitiesByDestination = getFacilitiesByDestination(sess, host.getHostname()); if(facilitiesByHostname.isEmpty() && facilitiesByDestination.isEmpty()) { return getFacilitiesManagerBl().addHost(sess, host, facility); } if(!facilitiesByHostname.isEmpty()) { boolean hasRight = false; for(Facility f: facilitiesByHostname) { if(AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, f)) { hasRight = true; break; } } if(hasRight) return getFacilitiesManagerBl().addHost(sess, host, facility); } if(!facilitiesByDestination.isEmpty()) { boolean hasRight = false; for(Facility f: facilitiesByDestination) { if(AuthzResolver.isAuthorized(sess, Role.FACILITYADMIN, f)) { hasRight = true; break; } } if(hasRight) return getFacilitiesManagerBl().addHost(sess, host, facility); } throw new PrivilegeException(sess, "You can't add host " + host + ", because you don't have privileges to use this hostName"); }
Source:
public void logMessage(Guid clusterId, GlusterVolumeEntity volume, final String action, final String status, AuditLogType logType) { logUtil.logAuditMessage(clusterId, volume, null, logType, new HashMap<String, String>(){ { put("action", action); put("status", status); }}); }

Target:
private void logMessage(Guid clusterId, GlusterVolumeEntity volume, final String action, final String status, AuditLogType logType) { logUtil.logAuditMessage(clusterId, volume, null, logType, new HashMap<String, String>(){ { put("action", action); put("status", status); }}); }
Source:
public void main(Args args) { for (Arg param : params) { param.defaultValue.ifPresent(def -> args.setIfAbsent(param.name, def)); } Optional<String> headOpt = args.head(); if (headOpt.isPresent()) { String head = headOpt.get(); if (head.equals("help")) { LOG.info(helpMessage()); return; } if (subCommands.containsKey(head)) { subCommands.get(head).main(args.tail()); return; } } ensureArgs(args); Runnable runnable = () -> entryPoint.accept(args); runnable.run(); }

Target:
public void main(Args args) { for (Arg param : params) { param.defaultValue.ifPresent(def -> args.setIfAbsent(param.name, def)); } Optional<String> headOpt = args.head(); if (headOpt.isPresent()) { String head = headOpt.get(); if (head.equals("help")) { System.out.println(helpMessage()); return; } if (subCommands.containsKey(head)) { subCommands.get(head).main(args.tail()); return; } } ensureArgs(args); Runnable runnable = () -> entryPoint.accept(args); runnable.run(); }
Source:
public void interleavedOperationsTest() throws Exception { List<OperationChain> opChains = new ArrayList<>(); for (int i = 0; i < 20; i++) { Queue<OperationType> operations = new LinkedList<>(); switch (i % 3) { case 0: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_INFO_NB); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); break; case 1: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); break; case 2: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_INFO_NB); break; } opChains.add(testFramework.startOperationChain(32 * 1024, i, operations)); } testFramework.checkOperationChains(opChains); }

Target:
public void interleavedOperationsTest() throws Exception { List<OperationChain> opChains = new ArrayList<>(); Random random = new Random(); for (int i = 0; i < 20; i++) { Queue<OperationType> operations = new LinkedList<>(); switch (i % 3) { case 0: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_INFO_NB); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); break; case 1: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.DELETE_NB); operations.add(OperationType.AWAIT_DELETION); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); operations.add(OperationType.GET_DELETED_NB); operations.add(OperationType.GET_INFO_DELETED_NB); break; case 2: operations.add(OperationType.PUT_NB); operations.add(OperationType.AWAIT_CREATION); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_NB); operations.add(OperationType.GET_INFO_NB); break; } int blobSize = random.nextInt(100 * 1024); opChains.add(testFramework.startOperationChain(blobSize, i, operations)); } testFramework.checkOperationChains(opChains); }
Source:
public static ItemStack getPreference(String oreName) { if(preferenceCache.containsKey(oreName)) { return preferenceCache.get(oreName).copy(); } List<ItemStack> items = OreDictionary.getOres(oreName, false); if(items.isEmpty()) { return ItemStack.EMPTY; } cachePreference(oreName, items); return preferenceCache.get(oreName).copy(); }

Target:
public static ItemStack getPreference(String oreName) { return preferenceCache.computeIfAbsent(oreName, RecipeUtil::cachePreference).copy(); }
Source:
public AbstractSSTableWriter build() throws Exception { System.setProperty("cassandra.config", configFilePath); AbstractSSTableWriter result; if (cqlVersion == 3) { CQL3SSTableWriter writer = new CQL3SSTableWriter(); writer.setRowMeta( rowMeta ); result = writer; } else { CQL2SSTableWriter writer = new CQL2SSTableWriter(); writer.setPartitionerClassName( new YamlConfigurationLoader().loadConfig().partitioner ); result = writer; } result.setDirectory( directory ); result.setKeyspace( keyspace ); result.setColumnFamily( columnFamily ); result.setKeyField( keyField ); result.setBufferSize( bufferSize ); return result; }

Target:
public AbstractSSTableWriter build() throws Exception { System.setProperty( "cassandra.config", configFilePath ); AbstractSSTableWriter result; if ( cqlVersion == 3 ) { CQL3SSTableWriter writer = getCql3SSTableWriter(); writer.setRowMeta( rowMeta ); result = writer; } else { CQL2SSTableWriter writer = getCql2SSTableWriter(); writer.setPartitionerClassName( getPartitionerClass() ); result = writer; } result.setDirectory( directory ); result.setKeyspace( keyspace ); result.setColumnFamily( columnFamily ); result.setKeyField( keyField ); result.setBufferSize( bufferSize ); return result; }
Source:
protected void EndVmCommand() { try { if (acquireLock()) { setVm(DbFacade.getInstance().getVmDAO().get(getVmId())); if (getVm() != null) { VmHandler.updateDisksFromDb(getVm()); List<DiskImage> diskImages = ImagesHandler.filterImageDisks(getVm().getDiskMap().values(), false, true); if (diskImages.isEmpty()) { RemoveVmFromDb(); } else { imagesLeftInVm = true; for (DiskImage diskImage : diskImages) { diskImage.setimageStatus(ImageStatus.ILLEGAL); getDbFacade().getImageDao().update(diskImage.getImage()); } VmHandler.UnLockVm(getVm().getId()); } } } setSucceeded(true); } finally { freeLock(); } }

Target:
protected void EndVmCommand() { try { if (acquireLock()) { setVm(DbFacade.getInstance().getVmDAO().get(getVmId())); if (getVm() != null) { updateDisksAfterVmRemoved(); } RemoveVmFromDb(); } setSucceeded(true); } finally { freeLock(); } }
Source:
public void testCastToCharForSbcsData() throws Exception { methodWatcher.executeUpdate("drop table sbcs if exists"); methodWatcher.executeUpdate("create table sbcs(a varchar(30) for bit data, b char(30) for bit data)"); methodWatcher.executeUpdate("insert into sbcs values (cast('a' as varchar(30) for bit data), cast('b' as char(30) for bit data))"); methodWatcher.executeUpdate("insert into sbcs values (case when 1 = 2 then 'dummy' end, case when 1 = 2 then 'dummy' end)"); String sql = "select cast(a as varchar(30)), cast(a as varchar(30) for sbcs data)," + "cast(b as char(30)), cast(b as char(30) for sbcs data) from sbcs --splice-properties useSpark=%s\n order by a"; String expected = "1 | 2 | 3 | 4 |\n" + "--------------------------------------------------\n" + " 61 | a |622020202020202020202020202020 | b |\n" + "NULL |NULL | NULL |NULL |"; try (ResultSet rs = methodWatcher.executeQuery(format(sql, false))) { assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs)); } try (ResultSet rs = methodWatcher.executeQuery(format(sql, true))) { assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs)); } }

Target:
public void testCastToCharForSbcsData() throws Exception { methodWatcher.executeUpdate("drop table sbcs if exists"); methodWatcher.executeUpdate("create table sbcs(a varchar(30) for bit data, b char(30) for bit data)"); methodWatcher.executeUpdate("insert into sbcs values (cast('a' as varchar(30) for bit data), cast('b' as char(30) for bit data))"); methodWatcher.executeUpdate("insert into sbcs values (null, null)"); String sql = "select cast(a as varchar(30)), cast(a as varchar(30) for sbcs data)," + "cast(b as char(30)), cast(b as char(30) for sbcs data) from sbcs --splice-properties useSpark=%s\n order by a"; String expected = "1 | 2 | 3 | 4 |\n" + "--------------------------------------------------\n" + " 61 | a |622020202020202020202020202020 | b |\n" + "NULL |NULL | NULL |NULL |"; try (ResultSet rs = methodWatcher.executeQuery(format(sql, false))) { assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs)); } try (ResultSet rs = methodWatcher.executeQuery(format(sql, true))) { assertEquals(expected, TestUtils.FormattedResult.ResultFactory.toString(rs)); } }
Source:
public void testMiniMRYarnClusterWithoutJHS() throws IOException { MiniMRYarnCluster mr = null; try { final Configuration conf = new Configuration(); conf.setBoolean(MiniMRYarnCluster.MR_HISTORY_MINICLUSTER_ENABLED, false); mr = new MiniMRYarnCluster("testMiniMRYarnClusterWithoutJHS"); mr.init(conf); Assert.assertEquals(null, mr.getHistoryServer()); mr.start(); } finally { if (mr != null) { mr.stop(); } } }

Target:
public void testMiniMRYarnClusterWithoutJHS() throws IOException { MiniMRYarnCluster mr = null; try { final Configuration conf = new Configuration(); conf.setBoolean(MiniMRYarnCluster.MR_HISTORY_MINICLUSTER_ENABLED, false); mr = new MiniMRYarnCluster("testMiniMRYarnClusterWithoutJHS"); mr.init(conf); mr.start(); Assert.assertEquals(null, mr.getHistoryServer()); } finally { if (mr != null) { mr.stop(); } } }
Source:
public void onMapLargePreview(Event event) { if (currentGameInfoBean == null) { return; } if (mapService.isOfficialMap(currentGameInfoBean.getMapName())) { return; } mapDetailPopup = getMapDetailPopup(); MapPreviewLargeController mapPreviewLargeController = applicationContext.getBean(MapPreviewLargeController.class); MapInfoBean mapInfoBean = mapService.getMapInfoBeanFromVaultFromName(currentGameInfoBean.getMapName()); if (mapInfoBean.getTechnicalName() == null) { return; } mapPreviewLargeController.createPreview(mapInfoBean); sceneFactory.createScene(mapDetailPopup, mapPreviewLargeController.getRoot(), false, WindowDecorator.WindowButtonType.CLOSE); mapDetailPopup.show(); mapDetailPopup.toFront(); }

Target:
void onMapLargePreview(Event event) { if (currentGameInfoBean == null) { return; } mapDetailPopup = getMapDetailPopup(); MapPreviewLargeController mapPreviewLargeController = applicationContext.getBean(MapPreviewLargeController.class); MapInfoBean mapInfoBean = mapService.getMapInfoBeanFromVaultFromName(currentGameInfoBean.getTechnicalName()); if (mapInfoBean == null) { String title = i18n.get("mapPreview.loadFailure.title"); String message = i18n.get("mapPreview.loadFailure.message"); notificationService.addNotification(new ImmediateNotification(title, message, Severity.ERROR)); } mapPreviewLargeController.createPreview(mapInfoBean); sceneFactory.createScene(mapDetailPopup, mapPreviewLargeController.getRoot(), false, WindowDecorator.WindowButtonType.CLOSE); mapDetailPopup.show(); }
Source:
public boolean isDeletable() { return getId() != RunQC.UNSAVED_ID; }

Target:
public boolean isDeletable() { return getId() != Run.UNSAVED_ID; }
Source:
ManagedChannel create() throws IOException; } private final AtomicReference<ImmutableList<ManagedChannel>> channels = new AtomicReference<>(); private final AtomicInteger requestCount = new AtomicInteger(); private final ImmutableList<HeaderInterceptor> headerInterceptors; private final AtomicInteger totalSize; private final ChannelFactory factory; private final String authority; private boolean shutdown = false; public ChannelPool(List<HeaderInterceptor> headerInterceptors, ChannelFactory factory) throws IOException { ManagedChannel channel = factory.create(); this.channels.set(ImmutableList.of(channel)); authority = channel.authority(); totalSize = new AtomicInteger(1); this.factory = factory; if (headerInterceptors == null) { this.headerInterceptors = ImmutableList.of(); } else { this.headerInterceptors = ImmutableList.copyOf(headerInterceptors); } }

Target:
ManagedChannel create() throws IOException; } private final AtomicReference<ImmutableList<ManagedChannel>> channels = new AtomicReference<>(); private final AtomicInteger requestCount = new AtomicInteger(); private final ImmutableList<HeaderInterceptor> headerInterceptors; private final ChannelFactory factory; private final String authority; private boolean shutdown = false; public ChannelPool(List<HeaderInterceptor> headerInterceptors, ChannelFactory factory) throws IOException { ManagedChannel channel = factory.create(); this.channels.set(ImmutableList.of(channel)); authority = channel.authority(); this.factory = factory; if (headerInterceptors == null) { this.headerInterceptors = ImmutableList.of(); } else { this.headerInterceptors = ImmutableList.copyOf(headerInterceptors); } }
Source:
public List<Metric> filter(Map<Metric, String> extendedSortedMap, String limit) { SystemAssert.requireArgument(extendedSortedMap != null && !extendedSortedMap.isEmpty(), "New map is not constructed successfully!"); SystemAssert.requireArgument(limit != null && !limit.equals(""), "Limit must be provided!"); List<Metric> result = new ArrayList<Metric>(); for (Map.Entry<Metric, String> entry : extendedSortedMap.entrySet()) { Number lim; try { lim = Long.parseLong(limit); } catch (NumberFormatException nfe) { try { lim = Double.parseDouble(limit); } catch (NumberFormatException nfe2) { throw new IllegalArgumentException("The limit " + limit + " is not a valid number."); } } Number val; try { val = Long.parseLong(entry.getValue()); } catch (NumberFormatException nfe) { try { val = Double.parseDouble(entry.getValue()); } catch (NumberFormatException nfe2) { throw new IllegalArgumentException("The limit " + limit + " is not a valid number."); } } if (NumberOperations.isGreaterThan(lim, val)) { result.add(entry.getKey()); } } return result; }

Target:
public List<Metric> filter(Map<Metric, String> extendedSortedMap, String limit) { SystemAssert.requireArgument(extendedSortedMap != null && !extendedSortedMap.isEmpty(), "New map is not constructed successfully!"); SystemAssert.requireArgument(limit != null && !limit.equals(""), "Limit must be provided!"); List<Metric> result = new ArrayList<Metric>(); Number lim = NumberOperations.parseConstant(limit); for (Map.Entry<Metric, String> entry : extendedSortedMap.entrySet()) { Number val = NumberOperations.parseConstant(entry.getValue()); if (NumberOperations.isGreaterThan(lim, val)) { result.add(entry.getKey()); } } return result; }
Source:
private RelayStatus convertRelayStatus(final com.alliander.osgp.domain.core.entities.RelayStatus status) { RelayStatus output = null; if (status != null) { output = new RelayStatus(); output.setIndex(status.getIndex()); output.setLastKnownState(status.isLastKnownState()); final GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(status.getLastKnowSwitchingTime()); try { output.setLastKnowSwitchingTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar)); } catch (final DatatypeConfigurationException e) { LOGGER.info(e.getMessage()); } } return output; }

Target:
private RelayStatus convertRelayStatus(final com.alliander.osgp.domain.core.entities.RelayStatus status) { RelayStatus output = null; if (status != null) { output = new RelayStatus(); output.setIndex(status.getIndex()); output.setLastKnownState(status.isLastKnownState()); final GregorianCalendar gCalendar = new GregorianCalendar(); gCalendar.setTime(status.getLastKnowSwitchingTime()); try { output.setLastKnowSwitchingTime(DatatypeFactory.newInstance().newXMLGregorianCalendar(gCalendar)); } catch (final DatatypeConfigurationException e) { LOGGER.error("Bad date format in one of theRelay Status dates", e); } } return output; }
Source:
public void close() { if (isClosed()) { return; } try { H5.H5Fclose(fileId); fileId = -1; } catch (final HDF5LibraryException e) { throw new GATKException( String.format("failure when closing '%s' from read-only access: %s",file.getAbsolutePath(),e.getMessage()),e); } }

Target:
public void close() { if (isClosed()) { return; } try { H5.H5Fclose(fileId); fileId = FILE_ID_WHEN_CLOSED; } catch (final HDF5LibraryException e) { throw new GATKException( String.format("failure when closing '%s' from read-only access: %s",file.getAbsolutePath(),e.getMessage()),e); } }
Source:
protected void updateStorageDomainFromIrs() { final StorageDomain sdFromIrs = executeGetStorageDomainStats(); final StorageDomainStatic sdStaticFromIrs = executeHSMGetStorageDomainInfo().getFirst(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntity(getStorageDomain().getStorageDynamicData()); storageDomainDynamicDao.update(sdFromIrs.getStorageDynamicData()); StorageDomainStatic sdStatic = storageDomainStaticDao.get(getStorageDomain().getId()); sdStatic.setBlockSize(sdStaticFromIrs.getBlockSize()); storageDomainStaticDao.update(sdStatic); getCompensationContext().stateChanged(); return null; }); }

Target:
protected void updateStorageDomainFromIrs() { final StorageDomainDynamic sdDynamicFromIrs = executeGetStorageDomainStats(); final StorageDomainStatic sdStaticFromIrs = executeHSMGetStorageDomainInfo(); TransactionSupport.executeInNewTransaction(() -> { getCompensationContext().snapshotEntity(getStorageDomain().getStorageDynamicData()); storageDomainDynamicDao.update(sdDynamicFromIrs); StorageDomainStatic sdStatic = storageDomainStaticDao.get(getStorageDomain().getId()); sdStatic.setBlockSize(sdStaticFromIrs.getBlockSize()); storageDomainStaticDao.update(sdStatic); getCompensationContext().stateChanged(); return null; }); }
Source:
private boolean canAdd(IFeatureModel candidate) { ISiteFeature[] features = fModel.getSite().getFeatures(); IFeature cfeature = candidate.getFeature(); for (ISiteFeature bfeature : features) { if (bfeature.getId() != null && bfeature.getId().equals(cfeature.getId()) && bfeature.getVersion() != null && bfeature.getVersion().equals(cfeature.getVersion())) return false; } return true; }

Target:
private boolean canAdd(IFeatureModel candidate) { ISiteFeature[] features = fModel.getSite().getFeatures(); IFeature cfeature = candidate.getFeature(); String id = cfeature.getId(); String version = cfeature.getVersion(); for (ISiteFeature bfeature : features) { boolean idEquals = Objects.equals(bfeature.getId(), id); if (idEquals && (version == null || version.equals(bfeature.getVersion()))) { return false; } } return true; }
Source:
public ExtensionMailboxInfo(@Nonnull final IMAPResponse[] resps) throws ParsingException { super(resps); for (int i = 0; i < resps.length; i++) { if (resps[i] == null) { continue; } final IMAPResponse ir = resps[i]; ir.skipSpaces(); if (ir.readByte() != '[') { ir.reset(); continue; } String key = ir.readAtom(); if (key == null) { ir.reset(); continue; } key = key.toUpperCase(); boolean handled = false; if (key.equals(MAILBOX_ID)) { final String[] values = ir.readSimpleList(); if (values != null && values.length >= 1) { mailboxId = Integer.valueOf(values[0]); handled = true; } } if (handled) { resps[i] = null; } else { ir.reset(); } } }

Target:
public ExtensionMailboxInfo(@Nonnull final IMAPResponse[] resps) throws ParsingException { super(resps); for (int i = 0; i < resps.length; i++) { if (resps[i] == null) { continue; } final IMAPResponse ir = resps[i]; ir.skipSpaces(); if (ir.readByte() != '[') { ir.reset(); continue; } String key = ir.readAtom(); if (key == null) { ir.reset(); continue; } key = key.toUpperCase(); if (key.equals(MAILBOX_ID)) { final String[] values = ir.readSimpleList(); if (values != null && values.length >= 1) { mailboxId = Integer.valueOf(values[0]); resps[i] = null; break; } } ir.reset(); } }
Source:
public LineTcpServer( CairoConfiguration cairoConfiguration, LineTcpReceiverConfiguration lineConfiguration, CairoEngine engine, WorkerPool workerPool, MessageBus messageBus ) { this.contextFactory = new LineTcpConnectionContextFactory(engine, lineConfiguration, messageBus, workerPool.getWorkerCount()); this.dispatcher = IODispatchers.create( lineConfiguration .getNetDispatcherConfiguration(), contextFactory); workerPool.assign(dispatcher); scheduler = new LineTcpMeasurementScheduler(cairoConfiguration, lineConfiguration, engine, workerPool); final IORequestProcessor<LineTcpConnectionContext> processor = (operation, context) -> { if (context.handleIO()) { busyContexts.add(context); } }; workerPool.assign(new SynchronizedJob() { @Override protected boolean runSerially() { int n = busyContexts.size(); while (n > 0) { n--; if (!busyContexts.getQuick(n).handleIO()) { busyContexts.remove(n); } } return dispatcher.processIOQueue(processor); } }); for (int i = 0, n = workerPool.getWorkerCount(); i < n; i++) { workerPool.assign(i, () -> { contextFactory.closeContextPool(); }); } }

Target:
public LineTcpServer( CairoConfiguration cairoConfiguration, LineTcpReceiverConfiguration lineConfiguration, CairoEngine engine, WorkerPool workerPool, MessageBus messageBus ) { this.contextFactory = new LineTcpConnectionContextFactory(engine, lineConfiguration, messageBus); this.dispatcher = IODispatchers.create( lineConfiguration .getNetDispatcherConfiguration(), contextFactory); workerPool.assign(dispatcher); scheduler = new LineTcpMeasurementScheduler(cairoConfiguration, lineConfiguration, engine, workerPool); final IORequestProcessor<LineTcpConnectionContext> processor = (operation, context) -> { if (context.handleIO()) { busyContexts.add(context); } }; workerPool.assign(new SynchronizedJob() { @Override protected boolean runSerially() { int n = busyContexts.size(); while (n > 0) { n--; if (!busyContexts.getQuick(n).handleIO()) { busyContexts.remove(n); } else { n++; break; } } if (n == 0) { return dispatcher.processIOQueue(processor); } return true; } }); final Closeable cleaner = contextFactory::closeContextPool; for (int i = 0, n = workerPool.getWorkerCount(); i < n; i++) { workerPool.assign(i, cleaner); } }
Source:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof EntityWolf || dataHolder instanceof EntitySheep || dataHolder instanceof ItemStack && isDyeable(((ItemStack) dataHolder).getItem()) || dataHolder instanceof TileEntityShulkerBox; }

Target:
public boolean supports(DataHolder dataHolder) { return dataHolder instanceof EntityWolf || dataHolder instanceof EntitySheep || dataHolder instanceof ItemStack && isDyeable(((ItemStack) dataHolder).getItem()); }
Source:
public void testUnordered() throws Exception { dao.unordered(); List<String> invocations = TestSqlMethodDecoratingAnnotations.invocations.get(); assertTrue(invocations.contains("foo")); assertTrue(invocations.indexOf("foo") < 2); assertTrue(invocations.contains("bar")); assertTrue(invocations.indexOf("bar") < 2); assertTrue(invocations.indexOf("method") == 2); }

Target:
public void testUnordered() throws Exception { Dao dao = handle.attach(Dao.class); dao.unordered(); assertThat(invocations.get(), anyOf( equalTo(asList("foo", "bar", "method")), equalTo(asList("bar", "foo", "method")))); }
Source:
public void setUp() { initMocks(this); when(mockMetacard.getId()).thenReturn(MOCK_METACARD_ID); when(subjectIdentity.getUniqueIdentifier(subject)).thenReturn(MOCK_IDENTITY_ATTR); when(mockMetacard.getAttribute(Security.ACCESS_ADMINISTRATORS)).thenReturn(mockAttribute); when(mockAttribute.getValues()).thenReturn(Collections.singletonList(MOCK_IDENTITY_ATTR)); ThreadContext.bind(subject); accessPlugin = new AccessControlAccessPlugin(subjectIdentity) { public boolean isAccessControlUpdated(Metacard prev, Metacard updated) { return true; } public Subject getSubject() { return subject; } }; }

Target:
public void setUp() { initMocks(this); when(mockMetacard.getId()).thenReturn(MOCK_METACARD_ID); when(subjectIdentity.getUniqueIdentifier(subject)).thenReturn(MOCK_IDENTITY_ATTR); when(mockMetacard.getAttribute(Security.ACCESS_ADMINISTRATORS)).thenReturn(mockAttribute); when(mockAttribute.getValues()).thenReturn(Collections.singletonList(MOCK_IDENTITY_ATTR)); ThreadContext.bind(subject); accessPlugin = new AccessControlAccessPlugin(subjectIdentity); }
Source:
public List<FeedbackResponseAttributes> getValidResponses(List<FeedbackResponseAttributes> responses, String courseId) { List<InstructorAttributes> instructors = instructorLogic.getInstructorsForCourse(courseId); ArrayList<String> instructorEmails = new ArrayList<String>(); for (int i = 0; i < instructors.size(); i++) { instructorEmails.add(instructors.get(i).email); } List<StudentAttributes> students = studentsLogic.getStudentsForCourse(courseId); List<TeamDetailsBundle> teams; try { teams = coursesLogic.getTeamsForCourse(courseId); } catch (EntityDoesNotExistException e) { log.severe(e.toString()); teams = new ArrayList<TeamDetailsBundle>(); } ArrayList<String> teamNames = new ArrayList<String>(); for (int i = 0; i < teams.size(); i++) { teamNames.add(teams.get(i).name); } ArrayList<FeedbackResponseAttributes> validResponses = new ArrayList<FeedbackResponseAttributes>(); for(FeedbackResponseAttributes response: responses) { if (isResponseValid(response, courseId, instructorEmails, students, teamNames)) { validResponses.add(response); } } return validResponses; }

Target:
public List<FeedbackResponseAttributes> getValidResponses(List<FeedbackResponseAttributes> responses, String courseId) { List<InstructorAttributes> instructors = instructorLogic.getInstructorsForCourse(courseId); List<String> instructorEmails = new ArrayList<String>(); for (InstructorAttributes instructor: instructors) { instructorEmails.add(instructor.email); } List<StudentAttributes> students = studentsLogic.getStudentsForCourse(courseId); List<TeamDetailsBundle> teams; try { teams = coursesLogic.getTeamsForCourse(courseId); } catch (EntityDoesNotExistException e) { log.severe(e.toString()); teams = new ArrayList<TeamDetailsBundle>(); } List<String> teamNames = new ArrayList<String>(); for (TeamDetailsBundle team: teams) { teamNames.add(team.name); } List<FeedbackResponseAttributes> validResponses = new ArrayList<FeedbackResponseAttributes>(); for(FeedbackResponseAttributes response: responses) { if (isResponseValid(response, courseId, instructorEmails, students, teamNames)) { validResponses.add(response); } } return validResponses; }
Source:
public Response create(@Valid ApplicationSpec applicationSpec) { if (anyEntityIsNotAvailable(applicationSpec) || anyLocationIsNotValid(applicationSpec)) { return Response.status(Response.Status.NOT_FOUND).build(); } manager.startInBackground(applicationSpec); URI ref = URI.create(applicationSpec.getName()); return Response.created(ref).build(); }

Target:
public Response create(@Valid ApplicationSpec applicationSpec) { checkAllEntityTypesAreValid(applicationSpec); checkAllLocationsAreValid(applicationSpec); manager.startInBackground(applicationSpec); URI ref = URI.create(applicationSpec.getName()); return Response.created(ref).build(); }
Source:
private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace( "Received estimated bitrate (bps): " + remb.getBitrate() + ", dest: " + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } else if (rtcp instanceof FIRPacket) { streamStats.firReceived((FIRPacket) rtcp); } break; case RTCPPacket.RR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.SR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }

Target:
private void updateReceivedMediaStreamStats( RTCPPacket[] in) { MediaStreamStatsImpl streamStats = mediaStream.getMediaStreamStats(); for (RTCPPacket rtcp : in) { switch (rtcp.type) { case RTCPFBPacket.PSFB: if (rtcp instanceof RTCPREMBPacket) { RTCPREMBPacket remb = (RTCPREMBPacket) rtcp; if (logger.isTraceEnabled()) { logger.trace( "Received estimated bitrate (bps): " + remb.getBitrate() + ", dest: " + Arrays.toString(remb.getDest())); } streamStats.rembReceived(remb); } else if (rtcp instanceof FIRPacket) { streamStats.firReceived((FIRPacket) rtcp); } break; case RTCPPacket.SR: if (rtcp instanceof RTCPSRPacket) { streamStats.srReceived((RTCPSRPacket) rtcp); } case RTCPPacket.RR: { RTCPReport report; try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); rtcp.assemble(new DataOutputStream(baos)); byte[] buf = baos.toByteArray(); report = parseRTCPReport(rtcp.type, buf, 0, buf.length); } catch (IOException ioe) { logger.error("Failed to assemble an RTCP report: " + ioe); report = null; } if (report != null) { streamStats.getRTCPReports().rtcpReportReceived(report); } } break; case RTCPFBPacket.RTPFB: if (rtcp instanceof NACKPacket) { NACKPacket nack = (NACKPacket) rtcp; streamStats.nackReceived(nack); } break; case RTCPExtendedReport.XR: if (rtcp instanceof RTCPExtendedReport) { streamStats.getRTCPReports().rtcpExtendedReportReceived( (RTCPExtendedReport) rtcp); } break; default: break; } } }
Source:
public void shouldChangeJavaHomeFromJvm() throws Exception { AbstractSurefireMojoTest.Mojo mojo = new AbstractSurefireMojoTest.Mojo(); String fakeJava = "/some/path/to/jdk/bin/java"; mojo.setJvm( fakeJava ); File mockedFile = mock( File.class ); when( mockedFile.getAbsoluteFile() ).thenReturn( mockedFile ); when( mockedFile.getPath() ).thenReturn( fakeJava ); when( mockedFile.getName() ).thenReturn( "java" ); when( mockedFile.isFile() ).thenReturn( true ); whenNew( File.class ). withParameterTypes( String.class ). withArguments( anyString() ). thenReturn( mockedFile ); assertThat( mojo.getEnvironmentVariables() ).isEmpty(); invokeMethod( mojo, "getEffectiveJvm" ); assertThat( mojo.getEnvironmentVariables() ).includes( MapAssert.entry( "JAVA_HOME", "/some/path/to/jdk" ) ); }

Target:
public void shouldChangeJavaHomeFromJvm() throws Exception { AbstractSurefireMojoTest.Mojo mojo = new AbstractSurefireMojoTest.Mojo(); File currentJdkHome = toJdkHomeFromJre(); String javaExecutablePath = FilenameUtils.concat( currentJdkHome.getAbsolutePath(), "bin/java" ); mojo.setJvm( javaExecutablePath ); assertThat( mojo.getEnvironmentVariables() ).isEmpty(); JdkAttributes effectiveJvm = invokeMethod( mojo, "getEffectiveJvm" ); assertThat( mojo.getEnvironmentVariables() ). includes( MapAssert.entry( "JAVA_HOME", currentJdkHome.getAbsolutePath() ) ); assertThat( effectiveJvm.getJvmExecutable() ).contains( javaExecutablePath ); }
Source:
private void populateReviews(List<TaskReview> reviewContainers) { for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); if (connector == null) { continue; } String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); String reviewId = connector.getTaskIdFromTaskUrl(reviewUrl); if (repositoryUrl == null || reviewId == null) { continue; } ITask task = taskList.getTask(repositoryUrl, reviewId); TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl) .getTaskIdFromTaskUrl(reviewUrl); if (task.getSynchronizationState().isIncoming()) { task.getSynchronizationState(); } try { reviewContainers .add(new TaskReview(task.getSummary(), Integer.parseInt(task.getAttribute("CODE_REVIEW")), Integer.parseInt(task.getAttribute("VERIFIED")), "")); } catch (Exception e) { } } }

Target:
private void populateReviews(List<TaskReview> reviewContainers) { for (String reviewUrl : reviewUrls) { AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl); if (connector == null) { continue; } String repositoryUrl = connector.getRepositoryUrlFromTaskUrl(reviewUrl); String reviewId = connector.getTaskIdFromTaskUrl(reviewUrl); if (repositoryUrl == null || reviewId == null) { continue; } ITask task = taskList.getTask(repositoryUrl, reviewId); TasksUiPlugin.getRepositoryManager() .getConnectorForRepositoryTaskUrl(reviewUrl) .getTaskIdFromTaskUrl(reviewUrl); if (task.getSynchronizationState().isIncoming()) { task.getSynchronizationState(); } try { int codeReviewVal = Integer.parseInt(task.getAttribute("CODE_REVIEW")); int verifiedVal = Integer.parseInt(task.getAttribute("VERIFIED")); reviewContainers.add(new TaskReview(task.getSummary(), codeReviewVal, verifiedVal, "")); } catch (NumberFormatException e) { } } }
Source:
private void resolve() { List<Endpoint> endpoints; synchronized (instanceLock) { try { endpoints = zkResolver.resolve(parameters.getExpression()); } catch (CloudnameException e) { log.warning("Exception from cloudname: " + e.toString()); return; } } Map<String, TrackedCoordinate> tempStatusAndEndpointsMap = new HashMap<String, TrackedCoordinate>(); for (Endpoint endpoint : endpoints) { String statusPath = ZkCoordinatePath.getStatusPath(endpoint.getCoordinate()); TrackedCoordinate trackedCoordinate = new TrackedCoordinate(this, statusPath, zkClient); trackedCoordinate.start(); try { trackedCoordinate.waitForFirstData(); } catch (InterruptedException e) { log.severe("Got interrupt while waiting for data." + e.getMessage()); return; } tempStatusAndEndpointsMap.put(statusPath, trackedCoordinate); } synchronized (instanceLock) { for (TrackedCoordinate trackedCoordinate : coordinateByPath.values()) { trackedCoordinate.stop(); } coordinateByPath.clear(); coordinateByPath.putAll(tempStatusAndEndpointsMap); } }

Target:
private void resolve() { List<Endpoint> endpoints; synchronized (instanceLock) { try { endpoints = zkResolver.resolve(parameters.getExpression()); } catch (CloudnameException e) { log.warning("Exception from cloudname: " + e.toString()); return; } } Map<String, TrackedCoordinate> tempStatusAndEndpointsMap = new HashMap<String, TrackedCoordinate>(); for (Endpoint endpoint : endpoints) { String statusPath = ZkCoordinatePath.getStatusPath(endpoint.getCoordinate()); TrackedCoordinate trackedCoordinate = new TrackedCoordinate(this, statusPath, zkClient); trackedCoordinate.start(); try { trackedCoordinate.waitForFirstData(); } catch (InterruptedException e) { log.log(Level.SEVERE, "Got interrupt while waiting for data.", e); return; } tempStatusAndEndpointsMap.put(statusPath, trackedCoordinate); } synchronized (instanceLock) { for (TrackedCoordinate trackedCoordinate : coordinateByPath.values()) { trackedCoordinate.stop(); } coordinateByPath.clear(); coordinateByPath.putAll(tempStatusAndEndpointsMap); } }
Source:
public boolean hasMetaConstraintBeenProcessed(Object bean, Path path, MetaConstraint<?> metaConstraint) { if ( metaConstraint.getGroupList().size() <= 1 ) { return false; } return processedPathUnits.contains( new BeanPathMetaConstraintProcessedUnit( bean, path, metaConstraint ) ); }

Target:
public boolean hasMetaConstraintBeenProcessed(Object bean, Path path, MetaConstraint<?> metaConstraint) { if ( metaConstraint.isDefinedForOneGroupOnly() ) { return false; } return processedPathUnits.contains( new BeanPathMetaConstraintProcessedUnit( bean, path, metaConstraint ) ); }
Source:
public static int hexDigitToInt(final char hexDigit) { final int digit = Character.digit(hexDigit, 16); if (digit < 0) { throw IllegalArgumentExceptions.format("Cannot interpret '%s' as a hexadecimal digit", hexDigit); } return digit; }

Target:
public static int hexDigitToInt(final char hexDigit) { final int digit = Character.digit(hexDigit, 16); if (digit < 0) { throw IllegalArgumentExceptions.format("Cannot interpret '%d' as a hexadecimal digit", hexDigit); } return digit; }
Source:
Path generateArtifact(T artifactGenerator, String id, String version, long size, Map<String, Object> attributesMap) throws IOException; default void setLicenses(ArtifactGenerator artifactGenerator, Map<String, Object> attributesMap) { Object licenses = attributesMap.get("licenses"); if (licenses instanceof LicenseConfiguration[]) { artifactGenerator.setLicenses((LicenseConfiguration[]) licenses); } }

Target:
Path generateArtifact(T artifactGenerator, String id, String version, long size, Map<String, Object> attributesMap) throws IOException; default void setLicenses(ArtifactGenerator artifactGenerator, Map<String, Object> attributesMap) throws IOException { Object licenses = attributesMap.get("licenses"); if (licenses instanceof LicenseConfiguration[]) { artifactGenerator.setLicenses((LicenseConfiguration[]) licenses); } }
Source:
private void activateMember(StatefulMember member) { StatefulMember existingMember = members.get(member.id()); if (existingMember == null) { member.setState(State.ACTIVE); LOGGER.info("{} - Member activated: {}", localMember.id(), member); members.put(member.id(), member); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_ADDED, member)); sendHeartbeat(member.address(), SERIALIZER.encode(new ClusterHeartbeat( localMember.id(), localMember.zone(), localMember.rack(), localMember.host(), localMember.metadata()))); } else if (!existingMember.id().equals(localMember.id()) && existingMember.getState() == State.INACTIVE) { LOGGER.info("{} - Member activated: {}", localMember.id(), existingMember); existingMember.setState(State.ACTIVE); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_ADDED, existingMember)); } else if (!existingMember.id().equals(localMember.id()) && !existingMember.metadata().equals(member.metadata())) { member.setState(State.ACTIVE); LOGGER.info("{} - Member updated: {}", localMember.id(), member); members.put(member.id(), member); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_UPDATED, member)); } }

Target:
private synchronized void activateMember(StatefulMember member) { StatefulMember existingMember = members.get(member.id()); if (existingMember == null) { member.setState(State.ACTIVE); LOGGER.info("{} - Member activated: {}", localMember.id(), member); members.put(member.id(), member); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_ADDED, member)); sendHeartbeat(member.address(), SERIALIZER.encode(new ClusterHeartbeat( localMember.id(), localMember.zone(), localMember.rack(), localMember.host(), localMember.metadata()))); } else if (existingMember.getState() == State.INACTIVE) { LOGGER.info("{} - Member activated: {}", localMember.id(), existingMember); existingMember.setState(State.ACTIVE); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_ADDED, existingMember)); } else if (!existingMember.metadata().equals(member.metadata())) { member.setState(State.ACTIVE); LOGGER.info("{} - Member updated: {}", localMember.id(), member); members.put(member.id(), member); post(new ClusterMembershipEvent(ClusterMembershipEvent.Type.MEMBER_UPDATED, member)); } }