auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testAddDependencies() { TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); String[] array = new String[] {"a.b.c.D"}; refColl.addDependencies(array); char[][][] qualifiedNameReferences = refColl.getQualifiedNameReferences(); assertTrue(Arrays.deepEquals(new char[][][] { CharOperation.splitOn('.', "a.b.c.D".toCharArray()), CharOperation.splitOn('.', "a.b.c".toCharArray()), CharOperation.splitOn('.', "a.b".toCharArray()), CharOperation.splitOn('.', "a".toCharArray()) }, qualifiedNameReferences)); char[][] simpleNameReferences = refColl.getSimpleNameReferences(); assertTrue(Arrays.deepEquals(new char[][] { "D".toCharArray(), "a".toCharArray(), "b".toCharArray(), "c".toCharArray() }, simpleNameReferences)); char[][] rootReferences = refColl.getRootReferences(); assertTrue(Arrays.deepEquals(new char[][] { "a".toCharArray() }, rootReferences)); }

Target:
public void testAddDependencies() { TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); String[] array = new String[] {"a.b.c.D"}; refColl.addDependencies(array); char[][][] qualifiedNameReferences = refColl.getQualifiedNameReferences(); String strings = toStringArray(qualifiedNameReferences); assertArrayEquals(new String[] { "a.b.c.D", "a.b.c", "a.b", "a" }, strings); char[][] simpleNameReferences = refColl.getSimpleNameReferences(); assertArrayEquals(new String[] { "D", "a", "b", "c" }, CharOperation.toStrings(simpleNameReferences)); char[][] rootReferences = refColl.getRootReferences(); assertArrayEquals(new String[] { "a" }, CharOperation.toStrings(rootReferences)); }
Source:
private Set<Integer> calcCacheGroupIds() { Set<Integer> grpIds = new HashSet<>(); Set<String> missingCacheGroups = new HashSet<>(); if (!F.isEmpty(grpNames)) { for (String grpName : grpNames) { CacheGroupContext groupContext = ignite.context().cache().cacheGroup(CU.cacheId(grpName)); if (groupContext == null) { missingCacheGroups.add(grpName); continue; } if (groupContext.sharedGroup()) grpIds.add(groupContext.groupId()); else log.warning("Group[name=" + grpName + "] is not shared one, it couldn't contains garbage from destroyed caches."); } if (!missingCacheGroups.isEmpty()) { StringBuilder strBuilder = new StringBuilder("The following cache groups do not exist: "); for (String name : missingCacheGroups) strBuilder.append(name).append(", "); strBuilder.delete(strBuilder.length() - 2, strBuilder.length()); throw new IgniteException(strBuilder.toString()); } } else { Collection<CacheGroupContext> groups = ignite.context().cache().cacheGroups(); for (CacheGroupContext grp : groups) { if (!grp.systemCache() && !grp.isLocal()) grpIds.add(grp.groupId()); } } return grpIds; }

Target:
private Set<Integer> calcCacheGroupIds() { Set<Integer> grpIds = new HashSet<>(); Set<String> missingCacheGroups = new HashSet<>(); if (!F.isEmpty(grpNames)) { for (String grpName : grpNames) { CacheGroupContext groupContext = ignite.context().cache().cacheGroup(CU.cacheId(grpName)); if (groupContext == null) { missingCacheGroups.add(grpName); continue; } if (groupContext.sharedGroup()) grpIds.add(groupContext.groupId()); else log.warning("Group[name=" + grpName + "] is not shared one, it couldn't contain garbage from destroyed caches."); } if (!missingCacheGroups.isEmpty()) { StringBuilder strBuilder = new StringBuilder("The following cache groups do not exist: "); for (String name : missingCacheGroups) strBuilder.append(name).append(", "); strBuilder.delete(strBuilder.length() - 2, strBuilder.length()); throw new IgniteException(strBuilder.toString()); } } else { Collection<CacheGroupContext> groups = ignite.context().cache().cacheGroups(); for (CacheGroupContext grp : groups) { if (!grp.systemCache() && !grp.isLocal()) grpIds.add(grp.groupId()); } } return grpIds; }
Source:
public void onEvent(AppendColumnEvent event) { getCurrentContext().getStatus().setColumnId(String.valueOf(new Date().getTime())); getCurrentContext().getStatus().setColumnGroup(event.getColumnGroup()); commonExecution(getCurrentContext(), new AppendColumnCommand(), true); }

Target:
public void onEvent(AppendColumnEvent event) { ScenarioSimulationContext context = getFocusedContext(); context.getStatus().setColumnId(String.valueOf(new Date().getTime())); context.getStatus().setColumnGroup(event.getColumnGroup()); commonExecution(context, new AppendColumnCommand(), true); }
Source:
public void testCacheMetricsNotRemovedOnStop() throws Exception { String cachePrefix = cacheMetricsRegistryName("other-cache", false); checkMetricsEmpty(cachePrefix); createCache("persisted", "other-cache"); grid("client").cache("other-cache").put(1L, 1L); checkMetricsNotEmpty(cachePrefix); grid("client").cluster().state(ClusterState.INACTIVE); checkMetricsNotEmpty(cachePrefix); grid("client").cluster().state(ClusterState.ACTIVE); assertEquals(1L, grid("client").cache("other-cache").get(1L)); checkMetricsNotEmpty(cachePrefix); destroyCache(); }

Target:
public void testCacheMetricsNotRemovedOnStop() throws Exception { String cachePrefix = cacheMetricsRegistryName("other-cache", false); checkMetricsEmpty(cachePrefix); createCache("persisted", "other-cache"); grid("client").cache("other-cache").put(1L, 1L); checkMetricsNotEmpty(cachePrefix); grid("client").cluster().state(ClusterState.INACTIVE); checkMetricsNotEmpty(cachePrefix); grid("client").cluster().state(ClusterState.ACTIVE); assertEquals(1L, grid("client").cache("other-cache").get(1L)); checkMetricsNotEmpty(cachePrefix); destroyCache(); checkMetricsEmpty(cachePrefix); }
Source:
protected void deliverInternal(VoltMessage message) { assert(lockingVows()); logRxMessage(message); boolean canDeliver = m_scheduler.sequenceForReplay(message); if (message instanceof Iv2InitiateTaskMessage) { if (checkMisroutedIv2IntiateTaskMessage((Iv2InitiateTaskMessage)message)) { return; } initiateSPIMigrationIfRequested((Iv2InitiateTaskMessage)message); } else if (message instanceof FragmentTaskMessage) { if (checkMisroutedFragmentTaskMessage((FragmentTaskMessage)message)) { return; } } else if (message instanceof DumpMessage) { hostLog.warn("Received DumpMessage at " + CoreUtils.hsIdToString(m_hsId)); try { m_scheduler.dump(); } catch (Throwable ignore) { hostLog.warn("Failed to dump the content of the scheduler", ignore); } } else if (message instanceof Iv2RepairLogRequestMessage) { handleLogRequest(message); return; } else if (message instanceof Iv2RepairLogResponseMessage) { m_algo.deliver(message); return; } else if (message instanceof RejoinMessage) { m_joinProducer.deliver((RejoinMessage) message); return; } else if (message instanceof RepairLogTruncationMessage) { m_repairLog.deliver(message); if (message.m_sourceHSId != m_hsId) { RepairLogTruncationMessage msg = (RepairLogTruncationMessage)message; ((SpScheduler)m_scheduler).updateRepairLogTruncationHandle(msg.getHandle()); } return; } else if (message instanceof MigratePartitionLeaderMessage) { setMigratePartitionLeaderStatus((MigratePartitionLeaderMessage)message); return; } if (canDeliver) { m_scheduler.deliver(message); } else { m_repairLog.deliver(message); } }

Target:
protected void deliverInternal(VoltMessage message) { assert(lockingVows()); logRxMessage(message); boolean canDeliver = m_scheduler.sequenceForReplay(message); if (message instanceof Iv2InitiateTaskMessage) { if (checkMisroutedIv2IntiateTaskMessage((Iv2InitiateTaskMessage)message)) { return; } initiateSPIMigrationIfRequested((Iv2InitiateTaskMessage)message); } else if (message instanceof FragmentTaskMessage) { if (checkMisroutedFragmentTaskMessage((FragmentTaskMessage)message)) { return; } } else if (message instanceof DumpMessage) { hostLog.warn("Received DumpMessage at " + CoreUtils.hsIdToString(m_hsId)); try { m_scheduler.dump(); } catch (Throwable ignore) { hostLog.warn("Failed to dump the content of the scheduler", ignore); } } else if (message instanceof Iv2RepairLogRequestMessage) { handleLogRequest(message); return; } else if (message instanceof Iv2RepairLogResponseMessage) { m_algo.deliver(message); return; } else if (message instanceof RejoinMessage) { m_joinProducer.deliver((RejoinMessage) message); return; } else if (message instanceof RepairLogTruncationMessage) { m_repairLog.deliver(message); return; } else if (message instanceof MigratePartitionLeaderMessage) { setMigratePartitionLeaderStatus((MigratePartitionLeaderMessage)message); return; } if (canDeliver) { m_scheduler.deliver(message); } else { m_repairLog.deliver(message); } }
Source:
public String toHex(DiscreteElement<?> element) { String hexString; long rawData = ((NumericElement<?>)element).getNumericBitValue(); hexString = Long.toHexString(rawData).toUpperCase(); return hexString; }

Target:
public String toHex(DiscreteElement<?> element) { String hexString; long rawData = ((NumericElement<?>)element).getNumericBitValue(); hexString = "0x"; hexString += Long.toHexString(rawData).toUpperCase(); return hexString; }
Source:
private static DeploymentInfoResult callCommand(CLIWrapper cli, String command, String serverGroup) { if (cli == null) { throw new IllegalStateException("Cli is not connected! Call connectCli method first!"); } cli.sendLine(command); log.info("Called command: '" + command + "'"); return new DeploymentInfoResult(command, serverGroup, cli.readOutput()); }

Target:
private static DeploymentInfoResult callCommand(CLIWrapper cli, String command, String serverGroup) { if (cli == null) { throw new IllegalStateException("Cli is not connected! Call connectCli method first!"); } cli.sendLine(command); log.trace("Called command: '" + command + "'"); return new DeploymentInfoResult(command, serverGroup, cli.readOutput()); }
Source:
public void run() { Datastream datastream = _datastreamGroup.getDatastreams().get(0); String bootstrapValue = String.join(KafkaConnectionString.BROKER_LIST_DELIMITER, KafkaConnectionString.valueOf(datastream.getSource().getConnectionString()) .getBrokers().stream().map(KafkaBrokerAddress::toString).collect(Collectors.toList())); _consumer = createConsumer(_consumerProperties, bootstrapValue, _groupIdConstructor.constructGroupId(datastream) + DEST_CONSUMER_GROUP_ID_SUFFIX); LOG.info("Fetch thread for started", datastream.getName()); while (!isInterrupted() && !_shutdown) { try { List<String> newPartitionInfo = getPartitionsInfo(); LOG.debug("Fetch partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); if (!ListUtils.isEqualList(newPartitionInfo, _subscribedPartitions)) { LOG.info("get updated partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); _subscribedPartitions = Collections.synchronizedList(newPartitionInfo); _initialized = true; _partitionChangeCallback.accept(_datastreamGroup); } Thread.sleep(_partitionFetchIntervalMs); } catch (Throwable t) { LOG.error("detect error for thread " + datastream.getName() + ", ex: ", t); } } if (_consumer != null) { _consumer.close(); } _consumer = null; LOG.info("Fetch thread for stopped", datastream.getName()); }

Target:
public void run() { Datastream datastream = _datastreamGroup.getDatastreams().get(0); String bootstrapValue = KafkaConnectionString.valueOf(datastream.getSource().getConnectionString()) .getBrokers().stream() .map(KafkaBrokerAddress::toString) .collect(Collectors.joining(KafkaConnectionString.BROKER_LIST_DELIMITER)); Consumer<?, ?> consumer = createConsumer(_consumerProperties, bootstrapValue, _groupIdConstructor.constructGroupId(datastream) + DEST_CONSUMER_GROUP_ID_SUFFIX); LOG.info("Fetch thread for started", _datastreamGroup.getName()); while (!isInterrupted() && !_shutdown) { try { List<String> newPartitionInfo = getPartitionsInfo(consumer); LOG.debug("Fetch partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); if (!ListUtils.isEqualList(newPartitionInfo, _subscribedPartitions)) { LOG.info("get updated partition info for {}, oldPartitionInfo: {}, new Partition info: {}" , datastream.getName(), _subscribedPartitions, newPartitionInfo); _subscribedPartitions = Collections.synchronizedList(newPartitionInfo); _initialized = true; _partitionChangeCallback.accept(_datastreamGroup); } Thread.sleep(_partitionFetchIntervalMs); } catch (Throwable t) { LOG.warn("detect error for thread " + _datastreamGroup.getName() + ", ex: ", t); _dynamicMetricsManager.createOrUpdateMeter(MODULE, _datastreamGroup.getName(), NUM_PARTITION_FETCH_ERRORS, 1); } } if (consumer != null) { consumer.close(); } consumer = null; LOG.info("PartitionDiscoveryThread for stopped", _datastreamGroup.getName()); }
Source:
protected void renderTile(Tile tile, Graphics2D g2d, double[] points) { BufferedImage img = getTileImage(tile); if (img == null) { if (LOGGER.isLoggable(Level.INFO)) LOGGER.info("couldn't draw " + tile.getId()); return; } g2d.drawImage( img, (int) Math.round(points[0]), (int) Math.round(points[1]), (int) Math.round(points[2] - points[0]), (int) Math.round(points[3] - points[1]), null); }

Target:
protected void renderTile(Tile tile, Graphics2D g2d, double[] points) { BufferedImage img = getTileImage(tile); if (img == null) { if (LOGGER.isLoggable(Level.INFO)) LOGGER.info("couldn't draw " + tile.getId()); return; } int width = (int) Math.round(points[2] - points[0]); int height = (int) Math.round(points[3] - points[1]); if (width < 1) width = 1; if (height < 1) height = 1; g2d.drawImage( img, (int) Math.round(points[0]), (int) Math.round(points[1]), width, height, null); }
Source:
static public void assertNotEquals(String message, long unexpected, long actual) { if (unexpected == actual) { failEquals(message, actual); } }

Target:
static public void assertNotEquals(String message, long unexpected, long actual) { if (unexpected == actual) { failEquals(message, Long.valueOf(actual)); } }
Source:
public void testServiceDetailsAll() { String serviceDetailsConfigStr = "serviceDetails = {name = \"" + name + "\", version = \"" + version + "\", instanceId = \"" + instanceId + "\"}"; Config config = ConfigFactory.parseString(serviceDetailsConfigStr); ServiceDetails serviceDetails = new ServiceDetails.Builder(config.getConfig("serviceDetails")).build(); assertEquals("expect \"" + name + "\" as a name value", name, serviceDetails.getName()); assertEquals("expect \"" + version + "\" as a vesrion value", version, serviceDetails.getVersion()); assertEquals("expect \"" + instanceId + "\" as an instanceId value", instanceId, serviceDetails.getInstanceId()); assertNotNull("expect Hostname is not null", serviceDetails.getHostname()); assertNotNull("expect Ip is not null", serviceDetails.getIp()); assertNotNull("expect Pid is not null", serviceDetails.getPid()); }

Target:
public void testServiceDetailsAll() { String serviceDetailsConfigStr = String.format("serviceDetails = {name = \"%s\", version = \"%s\", instanceId = \"%s\"}", name, version, instanceId); Config config = ConfigFactory.parseString(serviceDetailsConfigStr); ServiceDetails serviceDetails = new ServiceDetails.Builder(config.getConfig("serviceDetails")).build(); assertEquals("expect \"" + name + "\" as a name value", name, serviceDetails.getName()); assertEquals("expect \"" + version + "\" as a vesrion value", version, serviceDetails.getVersion()); assertEquals("expect \"" + instanceId + "\" as an instanceId value", instanceId, serviceDetails.getInstanceId()); assertNotNull("expect Hostname is not null", serviceDetails.getHostname()); assertNotNull("expect Ip is not null", serviceDetails.getIp()); assertNotNull("expect Pid is not null", serviceDetails.getPid()); }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { final List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); if (!StringUtils.isEmpty(getParameters().getCustomProperties())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } if (getVm() != null) { final Guid destinationVdsId = getParameters().getDestinationVdsId(); if (destinationVdsId != null && !destinationVdsId.equals(getVm().getDedicatedVmForVds())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.EDIT_VM_PROPERTIES)); } } return permissionList; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { final List<PermissionSubject> permissionList = super.getPermissionCheckSubjects(); if (!StringUtils.isEmpty(getParameters().getCustomProperties())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.CHANGE_VM_CUSTOM_PROPERTIES)); } if (getVm() != null) { final Guid destinationVdsId = getParameters().getDestinationVdsId(); if (destinationVdsId != null && !destinationVdsId.equals(getVm().getDedicatedVmForVds())) { permissionList.add(new PermissionSubject(getParameters().getVmId(), VdcObjectType.VM, ActionGroup.EDIT_ADMIN_VM_PROPERTIES)); } } return permissionList; }
Source:
public void setRuleConfigValue(String key, String value) { if (ruleConfigs.containsKey(key)) { ruleConfigs.get(key).setValue(value); this.getConfig().setProperty(key, value); } else { throw new InvalidParameterException("No such key"); } }

Target:
public void setRuleConfigValue(String key, String value) { if (ruleConfigs.containsKey(key)) { ruleConfigs.get(key).setValue(value); this.getConfig().setProperty(key, value); } else { throw new IllegalArgumentException("No such key"); } }
Source:
getXcodeBuildConfigurationsForTargetNode( TargetNode<?> targetNode, ImmutableMap<String, String> appendedConfig) { Optional<ImmutableSortedMap<String, ImmutableMap<String, String>>> configs = Optional.absent(); Optional<TargetNode<AppleNativeTargetDescriptionArg>> appleTargetNode = targetNode.castArg(AppleNativeTargetDescriptionArg.class); Optional<TargetNode<HalideLibraryDescription.Arg>> halideTargetNode = targetNode.castArg(HalideLibraryDescription.Arg.class); if (appleTargetNode.isPresent()) { configs = appleTargetNode.get().getConstructorArg().configs; } else if (halideTargetNode.isPresent()) { configs = halideTargetNode.get().getConstructorArg().configs; } if (!configs.isPresent() || (configs.isPresent() && configs.get().isEmpty()) || targetNode.getType().equals(CxxLibraryDescription.TYPE)) { ImmutableMap<String, ImmutableMap<String, String>> defaultConfig = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform( defaultCxxPlatform, appendedConfig); if (isFrameworkTarget(targetNode)) { ImmutableMap.Builder<String, ImmutableMap<String, String>> configBuilder = ImmutableMap.builder(); for (Map.Entry<String, ImmutableMap<String, String>> entry : defaultConfig.entrySet()) { ImmutableMap.Builder<String, String> frameworkConfigs = ImmutableMap.builder(); frameworkConfigs.putAll(entry.getValue()); frameworkConfigs.put("DYLIB_INSTALL_NAME_BASE", "@rpath"); frameworkConfigs.put("SKIP_INSTALL", "YES"); frameworkConfigs.put( "LD_RUNPATH_SEARCH_PATHS", "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"); frameworkConfigs.put("DEFINES_MODULE", "YES"); configBuilder.put(entry.getKey(), frameworkConfigs.build()); } configs = Optional.of(ImmutableSortedMap.copyOf(configBuilder.build())); } else { configs = Optional.of(ImmutableSortedMap.copyOf(defaultConfig)); } } return configs; }

Target:
getXcodeBuildConfigurationsForTargetNode( TargetNode<?> targetNode, ImmutableMap<String, String> appendedConfig) { Optional<ImmutableSortedMap<String, ImmutableMap<String, String>>> configs = Optional.absent(); Optional<TargetNode<AppleNativeTargetDescriptionArg>> appleTargetNode = targetNode.castArg(AppleNativeTargetDescriptionArg.class); Optional<TargetNode<HalideLibraryDescription.Arg>> halideTargetNode = targetNode.castArg(HalideLibraryDescription.Arg.class); if (appleTargetNode.isPresent()) { configs = appleTargetNode.get().getConstructorArg().configs; if (isFrameworkTarget(targetNode)) { configs = appendFrameworkBuildConfigs(configs); } } else if (halideTargetNode.isPresent()) { configs = halideTargetNode.get().getConstructorArg().configs; } if (!configs.isPresent() || (configs.isPresent() && configs.get().isEmpty()) || targetNode.getType().equals(CxxLibraryDescription.TYPE)) { ImmutableMap<String, ImmutableMap<String, String>> defaultConfig = CxxPlatformXcodeConfigGenerator.getDefaultXcodeBuildConfigurationsFromCxxPlatform( defaultCxxPlatform, appendedConfig); configs = Optional.of(ImmutableSortedMap.copyOf(defaultConfig)); } return configs; }
Source:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration res = super.getConfiguration(igniteInstanceName); res.setConsistentId(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration(); dsCfg.setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setMaxSize(1024 * 1024 * 1024) .setPersistenceEnabled(true) ); res.setDataStorageConfiguration(dsCfg); return res; }

Target:
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); DataStorageConfiguration dsCfg = new DataStorageConfiguration(); dsCfg.setDefaultDataRegionConfiguration( new DataRegionConfiguration() .setPersistenceEnabled(true) ); cfg.setDataStorageConfiguration(dsCfg); cfg.setCacheConfiguration(getCacheConfiguration()); cfg.setClassLoader(withFactory ? getExternalClassLoader() : U.gridClassLoader()); return cfg; }
Source:
public Map getParameterValues() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject[] projects = root.getProjects(); Map<String, String> paramValues = new HashMap<String, String>(); for (IProject project : projects) { final boolean notAlreadyShared = RepositoryProvider .getProvider(project) == null; if (project.isAccessible() && notAlreadyShared) { paramValues.put(project.getName(), project.getName()); } } return paramValues; }

Target:
public Map getParameterValues() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject[] projects = root.getProjects(); Map<String, String> paramValues = new HashMap<String, String>(); for (IProject project : projects) { final boolean notAlreadyShared = RepositoryProvider .getProvider(project) == null; if (project.isAccessible() && notAlreadyShared) paramValues.put(project.getName(), project.getName()); } return paramValues; }
Source:
public void runBeforeAllTests() { test_study1 = new Study(); test_study1.setStudyInstanceUid(null); }

Target:
public void runBeforeAllTests() { when(radiologyProperties.getDicomViewerUrl()).thenReturn("http://localhost:8081/weasis-pacs-connector/viewer?"); }
Source:
public void shouldContainErrorMessageAndContainErrorCode128() throws OpenShiftException { IDomain domain; try { domain = DomainTestUtils.ensureHasDomain(user); ApplicationTestUtils.getOrCreateApplication(domain); assertThat(domain.getApplications()).isNotEmpty(); domain.destroy(); fail("OpenShiftEndpointException did not occur"); } catch (OpenShiftEndpointException e) { assertThat(e.getRestResponseMessages().size()).isEqualTo(1); List<Message> messages = e.getRestResponseMessage(IField.DEFAULT); new MessageAssert(messages.get(0)) .hasExitCode(128) .hasSeverity(ISeverity.ERROR) .hasText(); } }

Target:
public void shouldContainErrorMessageAndContainErrorCode128() throws OpenShiftException { IDomain domain = null; try { domain = DomainTestUtils.ensureHasDomain(user); ApplicationTestUtils.getOrCreateApplication(domain); assertThat(domain.getApplications()).isNotEmpty(); domain.destroy(); fail("OpenShiftEndpointException did not occur"); } catch (OpenShiftEndpointException e) { assertThat(e.getRestResponseMessages().size()).isEqualTo(1); List<Message> messages = e.getRestResponseMessage(IField.DEFAULT); new MessageAssert(messages.get(0)) .hasExitCode(128) .hasSeverity(ISeverity.ERROR) .hasText(); } }
Source:
protected void startCropActivity(Uri uri) { final Context context = new ContextThemeWrapper(getActivity(), R.style.WordPress_NoActionBar); UCrop.Options options = new UCrop.Options(); options.setShowCropGrid(false); options.setStatusBarColor(ContextExtensionsKt.getColorFromAttribute(context, android.R.attr.statusBarColor)); options.setToolbarColor(ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorAppBar)); options.setToolbarWidgetColor(ContextExtensionsKt.getColorFromAttribute(context, R.attr.colorOnPrimarySurface)); options.setAllowedGestures(UCropActivity.SCALE, UCropActivity.NONE, UCropActivity.NONE); options.setHideBottomControls(true); UCrop.of(uri, Uri.fromFile(new File(context.getCacheDir(), "cropped.jpg"))) .withAspectRatio(1, 1) .withOptions(options) .start(context, this); }

Target:
protected void startCropActivity(Uri uri) { final Context baseContext = getActivity(); if (baseContext != null) { final Context context = new ContextThemeWrapper(baseContext, R.style.WordPress_NoActionBar); UCrop.Options options = new UCrop.Options(); options.setShowCropGrid(false); options.setStatusBarColor(ContextExtensionsKt.getColorFromAttribute( context, android.R.attr.statusBarColor )); options.setToolbarColor(ContextExtensionsKt.getColorFromAttribute(context, R.attr.wpColorAppBar)); options.setToolbarWidgetColor(ContextExtensionsKt.getColorFromAttribute( context, R.attr.colorOnPrimarySurface )); options.setAllowedGestures(UCropActivity.SCALE, UCropActivity.NONE, UCropActivity.NONE); options.setHideBottomControls(true); UCrop.of(uri, Uri.fromFile(new File(context.getCacheDir(), "cropped.jpg"))) .withAspectRatio(1, 1) .withOptions(options) .start(context, this); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof ModemInterfaceAddressConfigImpl)) { return false; } ModemInterfaceAddressConfigImpl other = (ModemInterfaceAddressConfigImpl) obj; if (m_configs == null) { if (other.m_configs != null) { return false; } } else if (!m_configs.equals(other.m_configs)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ModemInterfaceAddressConfigImpl)) { return false; } if (!super.equals(obj)) { return false; } ModemInterfaceAddressConfigImpl other = (ModemInterfaceAddressConfigImpl) obj; if (m_configs == null) { if (other.m_configs != null) { return false; } } else if (!m_configs.equals(other.m_configs)) { return false; } return true; }
Source:
public boolean addPotionEffect(PotionEffect effect, boolean force) { if (potionEffects.containsKey(effect.getType())) { if (force) { removePotionEffect(effect.getType()); } else { return false; } } potionEffects.put(effect.getType(), effect); updatePotionEffectsMetadata(); EntityEffectMessage msg = new EntityEffectMessage(getEntityId(), effect.getType().getId(), effect.getAmplifier(), effect.getDuration(), effect.hasParticles(), effect.isAmbient()); for (GlowPlayer player : world.getRawPlayers()) { if (player.canSeeEntity(this) || player == this) { player.getSession().send(msg); } } return true; }

Target:
public boolean addPotionEffect(PotionEffect effect, boolean force) { if (potionEffects.containsKey(effect.getType())) { if (force) { removePotionEffect(effect.getType()); } else { return false; } } potionEffects.put(effect.getType(), effect); potionEffectsChanged = true; EntityEffectMessage msg = new EntityEffectMessage(getEntityId(), effect.getType().getId(), effect.getAmplifier(), effect.getDuration(), effect.hasParticles(), effect.isAmbient()); for (GlowPlayer player : world.getRawPlayers()) { if (player.canSeeEntity(this) || player == this) { player.getSession().send(msg); } } return true; }
Source:
public void insertLine(final int line, final String text) { log.info("Insert text to editor at line " + line); try { String delimiter = TextEditorHandler.getInstance() .getDocument((ITextEditor)getEditorPart()).getLineDelimiter(line); delimiter = delimiter == null ? "" : delimiter; insertText(line, 0, text + delimiter); } catch (BadLocationException e) { throw new WorkbenchLayerException("Line provided is invalid for this editor", e); } }

Target:
public void insertLine(final int line, final String text) { log.info("Insert text to editor at line " + line); try { String delimiter = TextEditorHandler.getInstance() .getDocument((ITextEditor)getEditorPart()).getLineDelimiter(line); delimiter = delimiter == null ? System.lineSeparator() : delimiter; insertText(line, 0, text + delimiter); } catch (BadLocationException e) { throw new WorkbenchLayerException("Line provided is invalid for this editor", e); } }
Source:
protected void getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { List<ProjectDetailX> projectDetails = restClient.execute(monitor, new Operation<List<ProjectDetailX>>(client) { @Override public void execute(IProgressMonitor monitor) throws GerritException { getProjectAdminService(monitor).visibleProjectDetails(this); } }); for (ProjectDetailX projectDetail : projectDetails) { if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) { result.add(projectDetail.project); } } }

Target:
protected List<ProjectDetailX> getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { List<ProjectDetailX> projectDetails = restClient.execute(monitor, new Operation<List<ProjectDetailX>>(client) { @Override public void execute(IProgressMonitor monitor) throws GerritException { getProjectAdminService(monitor).visibleProjectDetails(this); } }); return projectDetails; }
Source:
public Field extract(Element element) throws InvalidElementException { DataField fieldInfo = element.getAnnotation(DataField.class); if (fieldInfo == null) { throw new InvalidElementException( "DataField annotation not found on element." ); } return Field.builder() .name(extractFieldName(element)) .type(extractFieldType(element)) .defaultValue(extractDefaultValue(element)) .docString(extractDocComment(element)) .annotations(extractAnnotations(element)) .modifiersToString(extractModifiers(element)) .getter(fieldInfo.getter()) .setter(fieldInfo.setter()) .match(fieldInfo.match()) .unique(fieldInfo.unique()) .searchable(fieldInfo.searchable()) .nullable(fieldInfo.nullable()) .build(); }

Target:
public Field extract(Element element) throws InvalidElementException { DataField fieldInfo = element.getAnnotation(DataField.class); if (fieldInfo == null) { throw new InvalidElementException( "DataField annotation not found on element." ); } Field field = Field.builder() .name(extractFieldName(element)) .type(extractFieldType(element)) .defaultValue(extractDefaultValue(element)) .docString(extractDocComment(element)) .annotations(extractAnnotations(element)) .modifiersToString(extractModifiers(element)) .getter(fieldInfo.getter()) .setter(fieldInfo.setter()) .match(fieldInfo.match()) .unique(fieldInfo.unique()) .searchable(fieldInfo.searchable()) .nullable(fieldInfo.nullable()) .build(); return field; }
Source:
public void updateCapability(Capability capability) { synchronized (expectedCapabilityList) { if (capability.getState() == Capability.CapabilityState.EXPECTED) { Optional<Capability> optCapability = expectedCapabilityList.stream() .filter(cap -> cap.getName().equals(capability.getName())) .filter(cap -> cap.getState() == Capability.CapabilityState.AVAILABLE) .filter(cap -> !cap.isSecondCheck()) .findFirst(); if (optCapability.isPresent()) { optCapability.get().setSecondCheck(true); } else { expectedCapabilityList.add(capability); } } else { Optional<Capability> optCapability = expectedCapabilityList.stream() .filter(cap -> cap.getName().equals(capability.getName())) .filter(cap -> cap.getState() == Capability.CapabilityState.EXPECTED) .findFirst(); if (optCapability.isPresent()) { optCapability.get().setState(Capability.CapabilityState.AVAILABLE); optCapability.get().setSecondCheck(true); } else { expectedCapabilityList.add(capability); } } } }

Target:
public void updateCapability(Capability capability) { synchronized (expectedCapabilityList) { if (capability.getState() == Capability.CapabilityState.EXPECTED) { Optional<Capability> optCapability = expectedCapabilityList.stream() .filter(expCapability -> expCapability.getName().equals(capability.getName())) .filter(expCapability -> expCapability.getState() == Capability.CapabilityState.AVAILABLE) .filter(expCapability -> !expCapability.isSecondCheck()) .findFirst(); if (optCapability.isPresent()) { optCapability.get().setSecondCheck(true); } else { expectedCapabilityList.add(capability); } } else { Optional<Capability> optCapability = expectedCapabilityList.stream() .filter(expCapability -> expCapability.getName().equals(capability.getName())) .filter(expCapability -> expCapability.getState() == Capability.CapabilityState.EXPECTED) .findFirst(); if (optCapability.isPresent()) { optCapability.get().setState(Capability.CapabilityState.AVAILABLE); optCapability.get().setSecondCheck(true); } else { expectedCapabilityList.add(capability); } } } }
Source:
public void addLink(String patientId) { int maxExistingPedigreeID = 0; JSONArray members = (JSONArray) this.data.opt(PEDIGREE_JSON_MEMBERS_KEY); for (Object nodeObj : members) { JSONObject node = (JSONObject) nodeObj; maxExistingPedigreeID = Math.max(maxExistingPedigreeID, node.optInt(PATIENT_NODEID_JSON_KEY, 0) + 1); JSONObject properties = (JSONObject) node.opt(PATIENT_DATA_JSON_KEY); if (properties == null || properties.length() == 0) { continue; } Object id = properties.opt(DefaultPedigree.PATIENT_DATA_PHENOTIPSID_KEY); if (id == null || StringUtils.isBlank(id.toString())) { continue; } if (patientId.equals(id.toString())) { return; } } JSONObject ptProperties = new JSONObject(); ptProperties.put(PATIENT_DATA_PHENOTIPSID_KEY, patientId); JSONObject patientData = new JSONObject(); patientData.put(PATIENT_NODEID_JSON_KEY, maxExistingPedigreeID); patientData.put(PATIENT_DATA_JSON_KEY, ptProperties); patientData.put(PATIENT_NOTINPEDIGREE_KEY, true); members.put(patientData); this.data.put(PEDIGREE_JSON_MEMBERS_KEY, members); }

Target:
public void addLink(String patientId) { int maxExistingPedigreeID = 0; JSONArray members = this.data.optJSONArray(PEDIGREE_JSON_MEMBERS_KEY); if (members == null) { return; } for (Object nodeObj : members) { JSONObject node = (JSONObject) nodeObj; maxExistingPedigreeID = Math.max(maxExistingPedigreeID, node.optInt(PATIENT_NODEID_JSON_KEY, 0)); JSONObject properties = node.optJSONObject(PATIENT_DATA_JSON_KEY); if (properties == null || properties.length() == 0) { continue; } String id = properties.optString(DefaultPedigree.PATIENT_DATA_PHENOTIPSID_KEY); if (StringUtils.isBlank(id)) { continue; } if (patientId.equals(id)) { return; } } JSONObject ptProperties = new JSONObject(); ptProperties.put(PATIENT_DATA_PHENOTIPSID_KEY, patientId); JSONObject patientData = new JSONObject(); patientData.put(PATIENT_NODEID_JSON_KEY, maxExistingPedigreeID + 1); patientData.put(PATIENT_DATA_JSON_KEY, ptProperties); patientData.put(PATIENT_NOTINPEDIGREE_KEY, true); members.put(patientData); this.data.put(PEDIGREE_JSON_MEMBERS_KEY, members); }
Source:
public PageCursor openArrayPageCursor( long reference ) { return propertyStore.getArrayStore().openPageCursorForReading( reference ); }

Target:
public PageCursor openArrayPageCursor( long reference ) { return propertyArrayStore.openPageCursorForReading( reference ); }
Source:
protected void addHeaders(HttpURLConnection connection, String tenantId) { if (tenantId == null) { tenantId = PropertyUtil.getProperty(PropertyUtil.HAWKULAR_TENANT); } if (tenantId != null) { connection.setRequestProperty(HAWKULAR_TENANT, tenantId); } if (authorization == null && username != null) { String authString = username + ":" + password; String encoded = Base64.getEncoder().encodeToString(authString.getBytes()); authorization = "Basic " + encoded; } if (authorization != null) { connection.setRequestProperty("Authorization", authorization); } }

Target:
protected void addHeaders(HttpURLConnection connection, String tenantId) { if (tenantId == null) { tenantId = PropertyUtil.getProperty(PropertyUtil.HAWKULAR_TENANT); } if (tenantId != null) { connection.setRequestProperty(HAWKULAR_TENANT, tenantId); } if (authorization == null && username != null) { String authString = username + ":" + password; String encoded = encoder.encodeToString(authString.getBytes()); authorization = "Basic " + encoded; } if (authorization != null) { connection.setRequestProperty("Authorization", authorization); } }
Source:
public void testGetBrowsableStudiesBySpecies() throws URISyntaxException { String url = "/v1/meta/studies/list?species=hsapiens_grch37"; ResponseEntity<QueryResponse<QueryResult<VariantStudySummary>>> response = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse<QueryResult<VariantStudySummary>>>() {}); assertEquals(HttpStatus.OK, response.getStatusCode()); QueryResponse<QueryResult<VariantStudySummary>> queryResponse = response.getBody(); assertEquals(1, queryResponse.getResponse().size()); List<VariantStudySummary> results = queryResponse.getResponse().get(0).getResult(); System.out.println(results); assertEquals(3, results.size()); for (VariantStudySummary variantStudySummary : results) { assertTrue(variantStudySummary.getFilesCount() > 0); assertNotNull(variantStudySummary.getStudyName()); assertNotNull(variantStudySummary.getStudyId()); } }

Target:
public void testGetBrowsableStudiesBySpecies() throws URISyntaxException { String url = "/v1/meta/studies/list?species=hsapiens_grch37"; ResponseEntity<QueryResponse<QueryResult<VariantStudySummary>>> response = restTemplate.exchange( url, HttpMethod.GET, null, new ParameterizedTypeReference<QueryResponse<QueryResult<VariantStudySummary>>>() {}); assertEquals(HttpStatus.OK, response.getStatusCode()); QueryResponse<QueryResult<VariantStudySummary>> queryResponse = response.getBody(); assertEquals(1, queryResponse.getResponse().size()); List<VariantStudySummary> results = queryResponse.getResponse().get(0).getResult(); assertEquals(3, results.size()); for (VariantStudySummary variantStudySummary : results) { assertTrue(variantStudySummary.getFilesCount() > 0); assertNotNull(variantStudySummary.getStudyName()); assertNotNull(variantStudySummary.getStudyId()); } }
Source:
public void before() { when(timelockRpcClient.getLeaderTime()).thenReturn(LeaderTime.of(LeadershipId.random(), NanoTime.now())); timelockService = LeasingTimelockClient.create(timelockRpcClient, SERVICE_ID); }

Target:
public void before() { when(timelockRpcClient.getLeaderTime()).thenAnswer(inv -> LeaderTime.of(LEADER_ID, time.get())); timelockService = new LeasingTimelockClient(timelockRpcClient, SERVICE_ID); }
Source:
private void initListeners() { this.restoreToSavePointListener = new RestoreToLastSavePointListener(session); this.restoreToSavePointListener.register(); this.saveSessionListener = new SaveSessionWhenNoDialectEditorsListener(session); this.saveSessionListener.register(); }

Target:
private void initListeners() { this.restoreToSavePointListener = new RestoreToLastSavePointListener(session); this.saveSessionListener = new SaveSessionWhenNoDialectEditorsListener(session); this.saveSessionListener.register(); }
Source:
public static void update(IProject project, Optional<List<OmniEclipseProjectNature>> projectNatures, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { PersistentModel previousPersistentModel = persistentModel.getPrevious(); Set<String> managedNatures = previousPersistentModel.isPresent() ? Sets.newLinkedHashSet(previousPersistentModel.getManagedNatures()) : Sets.<String>newLinkedHashSet(); Set<String> modelNatures = toNatures(projectNatures); IProjectDescription description = project.getDescription(); Set<String> existingNatures = Sets.newLinkedHashSet(Arrays.asList(description.getNatureIds())); Result<String> result = ManagedModelMergingStrategy.calculate(existingNatures, modelNatures, managedNatures); String[] natureIds = FluentIterable.from(result.getNextElements()).filter(new Predicate<String>() { @Override public boolean apply(String natureId) { return ResourcesPlugin.getWorkspace().getNatureDescriptor(natureId) != null; } }).toArray(String.class); description.setNatureIds(natureIds); project.setDescription(description, monitor); persistentModel.managedNatures(result.getNextManaged()); }

Target:
public static void update(IProject project, Optional<List<OmniEclipseProjectNature>> projectNatures, PersistentModelBuilder persistentModel, IProgressMonitor monitor) throws CoreException { PersistentModel previousPersistentModel = persistentModel.getPrevious(); Set<String> managedNatures = previousPersistentModel.isPresent() ? Sets.newLinkedHashSet(previousPersistentModel.getManagedNatures()) : Sets.<String>newLinkedHashSet(); Set<String> modelNatures = toNatures(projectNatures); IProjectDescription description = project.getDescription(); Set<String> existingNatures = Sets.newLinkedHashSet(Arrays.asList(description.getNatureIds())); Result<String> result = ManagedModelMergingStrategy.calculate(existingNatures, modelNatures, managedNatures); description.setNatureIds(result.getNextElements().toArray(new String[0])); project.setDescription(description, monitor); persistentModel.managedNatures(result.getNextManaged()); }
Source:
private void deleteFeedbackQuestionCascade( String feedbackSessionName, String courseId, int questionNumber) { FeedbackQuestionAttributes questionToDelete = getFeedbackQuestion(feedbackSessionName, courseId, questionNumber); if (questionToDelete == null) { return; } frLogic.deleteFeedbackResponsesForQuestionAndCascade(questionToDelete.getId(), true); List<FeedbackQuestionAttributes> questionsToShiftQnNumber = getFeedbackQuestionsForSession(feedbackSessionName, courseId); if (fsLogic.getFeedbackSession(feedbackSessionName, courseId) == null) { Assumption.fail("Session disappeared."); } fqDb.deleteEntity(questionToDelete); if (questionToDelete.questionNumber < questionsToShiftQnNumber.size()) { shiftQuestionNumbersDown(questionToDelete.questionNumber, questionsToShiftQnNumber); } }

Target:
private void deleteFeedbackQuestionCascade( String feedbackSessionName, String courseId, int questionNumber) { FeedbackQuestionAttributes questionToDelete = getFeedbackQuestion(feedbackSessionName, courseId, questionNumber); if (questionToDelete == null) { return; } frLogic.deleteFeedbackResponsesForQuestionAndCascade(questionToDelete.getId(), true); if (fsLogic.getFeedbackSession(feedbackSessionName, courseId) == null) { Assumption.fail("Session disappeared."); } List<FeedbackQuestionAttributes> questionsToShiftQnNumber = getFeedbackQuestionsForSession(feedbackSessionName, courseId); fqDb.deleteEntity(questionToDelete); if (questionToDelete.questionNumber < questionsToShiftQnNumber.size()) { shiftQuestionNumbersDown(questionToDelete.questionNumber, questionsToShiftQnNumber); } }
Source:
private Map<String, String> buildResultTagMap(Result result) throws Exception { Map<String, String> resultTagMap = new TreeMap<>(); for (ResultAttribute resultAttribute : resultAttributesToWriteAsTags) { resultAttribute.addTo(resultTagMap, result); } if (typeNamesAsTags) { log.debug("adding typeNames as tags"); Map<String, String> typeNameValueMap = TypeNameValue.extractMap(resultTagMap.get("typeName")); log.debug("this is typeNameValueMap ==== ", typeNameValueMap, this.typeNames); for (String typeToTag : this.typeNames) { if (typeNameValueMap.containsKey(typeToTag)) { resultTagMap.put(typeToTag, typeNameValueMap.get(typeToTag)); } } } return resultTagMap; }

Target:
private Map<String, String> buildResultTagMap(Result result) throws Exception { Map<String, String> resultTagMap = new TreeMap<>(); for (ResultAttribute resultAttribute : resultAttributesToWriteAsTags) { resultAttribute.addTo(resultTagMap, result); } if (typeNamesAsTags) { log.debug("adding typeNames as tags"); Map<String, String> typeNameValueMap = TypeNameValue.extractMap(resultTagMap.get("typeName")); log.debug("this is typeNameValueMap ==== ", typeNameValueMap, this.typeNames); for (String typeToTag : this.typeNames) { if (typeNameValueMap.get(typeToTag) != null) { resultTagMap.put(typeToTag, typeNameValueMap.get(typeToTag)); } } } return resultTagMap; }
Source:
public void notifyTransactionDataReceived(int topologyId) { if (topologyId < transactionDataTopologyId) { throw new IllegalStateException("Cannot set a topology id (" + topologyId + ") that is lower than the current one (" + transactionDataTopologyId + ")"); } if (trace) { log.tracef("Signalling transaction data received for topology %d", topologyId); } transactionDataTopologyId = topologyId; transactionDataLock.lock(); CompletableFuture<Void> oldFuture = transactionDataFuture; try { transactionDataFuture = new CompletableFuture<>(); } finally { transactionDataLock.unlock(); remoteExecutor.execute(() -> oldFuture.complete(null)); } }

Target:
public void notifyTransactionDataReceived(int topologyId) { if (topologyId < transactionDataTopologyId) { throw new IllegalStateException("Cannot set a topology id (" + topologyId + ") that is lower than the current one (" + transactionDataTopologyId + ")"); } if (trace) { log.tracef("Signalling transaction data received for topology %d", topologyId); } transactionDataTopologyId = topologyId; CompletableFuture<Void> oldFuture = null; try { synchronized (this) { oldFuture = transactionDataFuture; transactionDataFuture = new CompletableFuture<>(); } } finally { if (oldFuture != null) { oldFuture.complete(null); } } }
Source:
protected static byte[] encryptAndEncode(Encrypt0Message enc, OSCoreCtx ctx, Message mess, boolean newPartialIV) throws OSException { boolean isRequest = mess instanceof Request; try { byte[] key = ctx.getSenderKey(); byte[] partialIV = null; byte[] nonce = null; if (isRequest) { partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getSenderId(), ctx.getCommonIV(), ctx.getIVLength()); enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(ctx.getSenderId()), Attribute.UNPROTECTED); } else { if(!newPartialIV){ partialIV = OSSerializer.processPartialIV(ctx.getReceiverSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getRecipientId(), ctx.getCommonIV(), ctx.getIVLength()); }else{ partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getRecipientId(), ctx.getCommonIV(), ctx.getIVLength()); } } enc.addAttribute(HeaderKeys.IV, CBORObject.FromObject(nonce), Attribute.DO_NOT_SEND); enc.addAttribute(HeaderKeys.Algorithm, ctx.getAlg().AsCBOR(), Attribute.DO_NOT_SEND); enc.encrypt(key); return enc.getEncryptedContent(); } catch (CoseException e) { LOGGER.severe("COSE/Crypto exception: " + e.getMessage()); throw new OSException(e.getMessage()); } }

Target:
protected static byte[] encryptAndEncode(Encrypt0Message enc, OSCoreCtx ctx, Message mess, boolean newPartialIV) throws OSException { boolean isRequest = mess instanceof Request; try { byte[] key = ctx.getSenderKey(); byte[] partialIV = null; byte[] nonce = null; if (isRequest) { partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getSenderId(), ctx.getCommonIV(), ctx.getIVLength()); enc.addAttribute(HeaderKeys.PARTIAL_IV, CBORObject.FromObject(partialIV), Attribute.UNPROTECTED); enc.addAttribute(HeaderKeys.KID, CBORObject.FromObject(ctx.getSenderId()), Attribute.UNPROTECTED); } else { if (!newPartialIV) { partialIV = OSSerializer.processPartialIV(ctx.getReceiverSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getRecipientId(), ctx.getCommonIV(), ctx.getIVLength()); } else { partialIV = OSSerializer.processPartialIV(ctx.getSenderSeq()); nonce = OSSerializer.nonceGeneration(partialIV, ctx.getRecipientId(), ctx.getCommonIV(), ctx.getIVLength()); } } enc.addAttribute(HeaderKeys.IV, CBORObject.FromObject(nonce), Attribute.DO_NOT_SEND); enc.addAttribute(HeaderKeys.Algorithm, ctx.getAlg().AsCBOR(), Attribute.DO_NOT_SEND); enc.encrypt(key); return enc.getEncryptedContent(); } catch (CoseException e) { LOGGER.error("COSE/Crypto exception: " + e.getMessage()); throw new OSException(e.getMessage()); } }
Source:
public static AbstractFactory getInstance() { if (_abstractFactory == null) { synchronized ("factory") { _abstractFactory = createFactory(); } } return _abstractFactory; }

Target:
public static AbstractFactory getInstance() { if (_abstractFactory == null) { synchronized (AbstractFactory.class) { _abstractFactory = createFactory(); } } return _abstractFactory; }