auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Configuration getConfiguration(HdfsContext context, URI uri) { @SuppressWarnings("resource") Configuration config = new CachingJobConf((factoryConfig, factoryUri) -> { try { FileSystem fileSystem = (new Path(factoryUri)).getFileSystem(hiveHdfsConfiguration.getConfiguration(context, factoryUri)); checkState(fileSystem instanceof ExtendedFileSystem); return cacheFactory.createCachingFileSystem(factoryConfig, factoryUri, (ExtendedFileSystem) fileSystem, cacheManager, cacheConfig.getCacheType(), cacheConfig.isValidationEnabled()); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create caching file system", e); } }); Configuration defaultConfig = hiveHdfsConfiguration.getConfiguration(context, uri); copy(defaultConfig, config); return config; }

Target:
public Configuration getConfiguration(HdfsContext context, URI uri) { @SuppressWarnings("resource") Configuration config = new CachingJobConf((factoryConfig, factoryUri) -> { try { FileSystem fileSystem = (new Path(factoryUri)).getFileSystem(hiveHdfsConfiguration.getConfiguration(context, factoryUri)); checkState(fileSystem instanceof ExtendedFileSystem); return cacheFactory.createCachingFileSystem( factoryConfig, factoryUri, (ExtendedFileSystem) fileSystem, cacheManager, cacheConfig.isCachingEnabled(), cacheConfig.getCacheType(), cacheConfig.isValidationEnabled()); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create caching file system", e); } }); Configuration defaultConfig = hiveHdfsConfiguration.getConfiguration(context, uri); copy(defaultConfig, config); return config; }
Source:
public RelDistribution apply(Mappings.TargetMapping mapping) { if (keys.isEmpty()) { return this; } List<Integer> mapList = Mappings.asList(mapping); for (Integer key : keys) { if (mapList.get(key) == null) { return RANDOM_DISTRIBUTED; } } List<Integer> mappedKeys0 = Mappings.apply2((Mapping) mapping, keys); ImmutableIntList mappedKeys = normalizeKeys(mappedKeys0); RelDistribution newDistribution = new RelDistributionImpl(type, mappedKeys); return getTraitDef().canonize(newDistribution); }

Target:
public RelDistribution apply(Mappings.TargetMapping mapping) { if (keys.isEmpty()) { return this; } for (int key : keys) { if (mapping.getTargetOpt(key) == -1) { return ANY; } } List<Integer> mappedKeys0 = Mappings.apply2((Mapping) mapping, keys); ImmutableIntList mappedKeys = normalizeKeys(mappedKeys0); return of(type, mappedKeys); }
Source:
public InMemoryStore getStore(PartitionId partitionId) { return storesByPartition.get(partitionId); }

Target:
InMemoryStore getStore(PartitionId partitionId) { return storesByPartition.get(partitionId); }
Source:
private Organization getOrganization(final MultivaluedMap<String, String> data) { Organization organization = null; Sid organizationSid = null; String organizationId = null; if (data.containsKey("Organization")) { organizationId = data.getFirst("Organization"); } else { return null; } organization = organizationsDao.getOrganizationByDomainName(organizationId); if (organization != null) { return organization; } else { try { organizationSid = new Sid(organizationId); organization = organizationsDao.getOrganization(organizationSid); return organization; } catch (IllegalArgumentException e) { if (logger.isDebugEnabled()) { logger.debug("Exception while tried to match organizationId to organizationSid"); } } } return organization; }

Target:
private Organization getOrganization(final MultivaluedMap<String, String> data) { Organization organization = null; Sid organizationSid = null; String organizationId = null; if (data.containsKey("Organization")) { organizationId = data.getFirst("Organization"); } else { return null; } if (Sid.pattern.matcher(organizationId).matches()) { organization = organizationsDao.getOrganization(new Sid(organizationId)); return organization; } else { organization = organizationsDao.getOrganizationByDomainName(organizationId); return organization; } }
Source:
protected boolean validateImages() { List<DiskImage> imagesToValidate = getDiskImagesToValidate(); DiskImagesValidator diskImagesValidator = new DiskImagesValidator(imagesToValidate); boolean isVmQualifiedForLMOrImagesNotIllegal = getVm().isQualifiedForLiveSnapshotMerge() || validate(diskImagesValidator.diskImagesNotIllegal()); return getParameters().isNeedsLocking() ? isVmQualifiedForLMOrImagesNotIllegal && validate(diskImagesValidator.diskImagesNotLocked()) : isVmQualifiedForLMOrImagesNotIllegal; }

Target:
protected boolean validateImages() { List<DiskImage> imagesToValidate = getDiskImagesToValidate(); DiskImagesValidator diskImagesValidator = new DiskImagesValidator(imagesToValidate); return (!getParameters().isNeedsLocking() || validate(diskImagesValidator.diskImagesNotLocked())) && (getVm().isQualifiedForLiveSnapshotMerge() || validate(diskImagesValidator.diskImagesNotIllegal())); }
Source:
public static <T> com.azure.search.documents.implementation.models.IndexAction map(IndexAction<T> obj) { if (obj == null) { return null; } com.azure.search.documents.implementation.models.IndexAction indexAction = new com.azure.search.documents.implementation.models.IndexAction(); if (obj.getActionType() != null) { com.azure.search.documents.implementation.models.IndexActionType actionType = IndexActionTypeConverter.map(obj.getActionType()); indexAction.setActionType(actionType); } ObjectMapper mapper = new JacksonAdapter().serializer(); SerializationUtil.configureMapper(mapper); Map<String, Object> additionalProperties; if (obj.getParamMap() != null) { Map<String, Object> properties = obj.getParamMap(); additionalProperties = mapper.convertValue(properties, Map.class); } else { T properties = obj.getDocument(); additionalProperties = mapper.convertValue(properties, Map.class); } indexAction.setAdditionalProperties(additionalProperties); return indexAction; }

Target:
public static <T> com.azure.search.documents.implementation.models.IndexAction map(IndexAction<T> obj) { if (obj == null) { return null; } com.azure.search.documents.implementation.models.IndexAction indexAction = new com.azure.search.documents.implementation.models.IndexAction(); if (obj.getActionType() != null) { com.azure.search.documents.implementation.models.IndexActionType actionType = IndexActionTypeConverter.map(obj.getActionType()); indexAction.setActionType(actionType); } ObjectMapper mapper = new JacksonAdapter().serializer(); SerializationUtil.configureMapper(mapper); Map<String, Object> additionalProperties; TypeReference<Map<String, Object>> typeRef = new TypeReference<Map<String, Object>>() {}; if (obj.getParamMap() != null) { Map<String, Object> properties = obj.getParamMap(); mapper.setSerializationInclusion(JsonInclude.Include.ALWAYS); additionalProperties = mapper.convertValue(properties, typeRef); } else { T properties = obj.getDocument(); additionalProperties = mapper.convertValue(properties, typeRef); } indexAction.setAdditionalProperties(additionalProperties); return indexAction; }
Source:
private CipherFactory(String instanceId, byte[] symmetricKeyBytes) throws CryptoException { symmetricKey = new SecretKeySpec(symmetricKeyBytes, "AES/CFB/PKCS5Padding"); try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(instanceId.getBytes("UTF-8")); md.update(symmetricKeyBytes); byte[] messageDigest = md.digest(); ivSeedArray = new byte[IV_BYTE_LENGTH]; for (int i = 0; i < IV_BYTE_LENGTH; ++i) { ivSeedArray[i] = messageDigest[(i % messageDigest.length)]; } } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { String msg = "Error constructing ivSeedArray"; log.error(msg, e); throw new CryptoException(msg + " Cause: " + e); } }

Target:
private CipherFactory(String instanceId, byte[] symmetricKeyBytes) { symmetricKey = new SecretKeySpec(symmetricKeyBytes, "AES/CFB/PKCS5Padding"); try { MessageDigest md = MessageDigest.getInstance("MD5"); md.update(instanceId.getBytes("UTF-8")); md.update(symmetricKeyBytes); byte[] messageDigest = md.digest(); ivSeedArray = new byte[IV_BYTE_LENGTH]; for (int i = 0; i < IV_BYTE_LENGTH; ++i) { ivSeedArray[i] = messageDigest[(i % messageDigest.length)]; } } catch (NoSuchAlgorithmException | UnsupportedEncodingException e) { String msg = "Error constructing ivSeedArray"; log.error(msg, e); throw new CryptoException(msg + " Cause: " + e); } }
Source:
public DependenciesImpl(IAggregator aggregator, long stamp) { Hashtable<String, String> dict = new Hashtable<String, String>(); dict.put("name", aggregator.getName()); this.aggregator = aggregator; this.initStamp = stamp; servletName = aggregator.getName(); initialized = new CountDownLatch(1); shutdownListener = PlatformAggregatorProvider.getPlatformAggregator().registerService(IShutdownListener.class.getName(), this, dict); configUpdateListener= PlatformAggregatorProvider.getPlatformAggregator().registerService(IConfigListener.class.getName(), this, dict); optionsUpdateListener= PlatformAggregatorProvider.getPlatformAggregator().registerService(IOptionsListener.class.getName(), this, dict); if (aggregator.getConfig() != null) { configLoaded(aggregator.getConfig(), 1); } if (aggregator.getOptions() != null) { optionsUpdated(aggregator.getOptions(), 1); } }

Target:
public DependenciesImpl(IAggregator aggregator, long stamp) { Hashtable<String, String> dict; this.aggregator = aggregator; this.initStamp = stamp; servletName = aggregator.getName(); initialized = new CountDownLatch(1); dict = new Hashtable<String, String>(); dict.put("name", aggregator.getName()); shutdownListener = aggregator.getPlatformServices().registerService(IShutdownListener.class.getName(), this, dict); dict = new Hashtable<String, String>(); dict.put("name", aggregator.getName()); configUpdateListener= aggregator.getPlatformServices().registerService(IConfigListener.class.getName(), this, dict); dict = new Hashtable<String, String>(); dict.put("name", aggregator.getName()); optionsUpdateListener= aggregator.getPlatformServices().registerService(IOptionsListener.class.getName(), this, dict); if (aggregator.getConfig() != null) { configLoaded(aggregator.getConfig(), 1); } if (aggregator.getOptions() != null) { optionsUpdated(aggregator.getOptions(), 1); } }
Source:
public ExampleEndpointsProvider() { try { JHttpEndpoint httpEndpoint = new JHttpEndpoint(new URI("<LINK_0>")); endpoints.add(httpEndpoint); } catch (URISyntaxException e) { throw new IllegalStateException(e); } }

Target:
public ExampleEndpointsProvider() { JHttpEndpoint httpEndpoint = new JHttpEndpoint(URI.create("<LINK_0>")); endpoints.add(httpEndpoint); }
Source:
public boolean equals(Object obj) { return (obj != null) && (obj instanceof GlusterGeoRepSessionDetails) && Objects.equals(getSessionId(), ((GlusterGeoRepSessionDetails) obj).getSessionId()) && Objects.equals(getMasterBrickId(), ((GlusterGeoRepSessionDetails) obj).getMasterBrickId()) && Objects.equals(getSlaveNodeUuid(), ((GlusterGeoRepSessionDetails) obj).getSlaveNodeUuid()) && Objects.equals(getSlaveHostName(), ((GlusterGeoRepSessionDetails) obj).getSlaveHostName()) && Objects.equals(getStatus(), ((GlusterGeoRepSessionDetails) obj).getStatus()) && Objects.equals(getCheckPointStatus(), ((GlusterGeoRepSessionDetails) obj).getCheckPointStatus()) && Objects.equals(getCrawlStatus(), ((GlusterGeoRepSessionDetails) obj).getCrawlStatus()) && Objects.equals(getDataOpsPending(), ((GlusterGeoRepSessionDetails) obj).getDataOpsPending()) && Objects.equals(getMetaOpsPending(), ((GlusterGeoRepSessionDetails) obj).getMetaOpsPending()) && Objects.equals(getEntryOpsPending(), ((GlusterGeoRepSessionDetails) obj).getEntryOpsPending()) && Objects.equals(getCheckPointCompletedAt(), ((GlusterGeoRepSessionDetails) obj).getCheckPointCompletedAt()) && Objects.equals(getCheckPointTime(), ((GlusterGeoRepSessionDetails) obj).getCheckPointTime()) && Objects.equals(getLastSyncedAt(), ((GlusterGeoRepSessionDetails) obj).getLastSyncedAt()) && Objects.equals(getUpdatedAt(), ((GlusterGeoRepSessionDetails) obj).getUpdatedAt()) && Objects.equals(getFailures(), ((GlusterGeoRepSessionDetails) obj).getFailures()) && isCheckpointCompleted() == ((GlusterGeoRepSessionDetails) obj).isCheckpointCompleted(); }

Target:
public boolean equals(Object obj) { if (obj == null || !(obj instanceof GlusterGeoRepSessionDetails)) { return false; } GlusterGeoRepSessionDetails geoRep = (GlusterGeoRepSessionDetails) obj; return Objects.equals(getSessionId(), geoRep.getSessionId()) && Objects.equals(getMasterBrickId(), geoRep.getMasterBrickId()) && Objects.equals(getSlaveNodeUuid(), geoRep.getSlaveNodeUuid()) && Objects.equals(getSlaveHostName(), geoRep.getSlaveHostName()) && Objects.equals(getStatus(), geoRep.getStatus()) && Objects.equals(getCheckPointStatus(), geoRep.getCheckPointStatus()) && Objects.equals(getCrawlStatus(), geoRep.getCrawlStatus()) && Objects.equals(getDataOpsPending(), geoRep.getDataOpsPending()) && Objects.equals(getMetaOpsPending(), geoRep.getMetaOpsPending()) && Objects.equals(getEntryOpsPending(), geoRep.getEntryOpsPending()) && Objects.equals(getCheckPointCompletedAt(), geoRep.getCheckPointCompletedAt()) && Objects.equals(getCheckPointTime(), geoRep.getCheckPointTime()) && Objects.equals(getLastSyncedAt(), geoRep.getLastSyncedAt()) && Objects.equals(getUpdatedAt(), geoRep.getUpdatedAt()) && Objects.equals(getFailures(), geoRep.getFailures()) && isCheckpointCompleted() == geoRep.isCheckpointCompleted(); }
Source:
public void execute() throws MojoExecutionException { appendLogs(); try { String archiveDirectory = getArchiveFile("").getAbsolutePath(); boolean createdArchiveDirectory = org.wso2.developerstudio.eclipse.utils.file.FileUtils.createDirectory( archiveDirectory); if (createdArchiveDirectory) { CAppHandler cAppHandler = new CAppHandler(); List<ArtifactDependency> dependencies = new ArrayList<>(); cAppHandler.processConfigArtifactXmlFile(projectBaseDir, archiveDirectory, dependencies); cAppHandler.processRegistryResourceArtifactXmlFile(projectBaseDir, archiveDirectory, dependencies); cAppHandler.createDependencyArtifactsXmlFile(archiveDirectory, dependencies, project); File fileToZip = new File(archiveDirectory); zipFolder(fileToZip.getPath(), getArchiveFile(".car").getPath()); recursiveDelete(fileToZip); } else { getLog().error("Could not create corresponding archive directory."); } } catch (Exception e) { getLog().error(e); } }

Target:
public void execute() throws MojoExecutionException { appendLogs(); try { String archiveDirectory = getArchiveFile(Constants.EMPTY_STRING).getAbsolutePath(); boolean createdArchiveDirectory = org.wso2.developerstudio.eclipse.utils.file.FileUtils.createDirectory( archiveDirectory); if (createdArchiveDirectory) { CAppHandler cAppHandler = new CAppHandler(); List<ArtifactDependency> dependencies = new ArrayList<>(); cAppHandler.processConfigArtifactXmlFile(projectBaseDir, archiveDirectory, dependencies); cAppHandler.processRegistryResourceArtifactXmlFile(projectBaseDir, archiveDirectory, dependencies); cAppHandler.createDependencyArtifactsXmlFile(archiveDirectory, dependencies, project); File fileToZip = new File(archiveDirectory); zipFolder(fileToZip.getPath(), getArchiveFile(".car").getPath()); recursiveDelete(fileToZip); } else { getLog().error("Could not create corresponding archive directory."); } } catch (XMLStreamException | IOException | ArchiveException e) { getLog().error(e); } }
Source:
protected boolean defineNoStrictVerifyBasedOnXcodeVersion() throws XCodeException { boolean strictVerify = false; if (noStrictVerify == null || noStrictVerify.isEmpty()) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); PrintStream out; int exitCode; try { out = new PrintStream(bos, true, Charset.defaultCharset().name()); exitCode = Forker.forkProcess(out, new File("."), new String[] { "xcodebuild", "-version" }); if (exitCode == 0) { String output = bos.toString(Charset.defaultCharset().name()); DefaultArtifactVersion version = getVersion(output); String buildVersion = getBuildVersion(output); strictVerify = checkVersions(version, buildVersion); return strictVerify; } else { throw new XCodeException( "Could not get xcodebuild version (exit code = " + exitCode + ")"); } } catch (Exception e) { throw new XCodeException( "Could not get xcodebuild version"); } } return strictVerify; }

Target:
private boolean defineNoStrictVerifyBasedOnXcodeVersion() throws XCodeException { if (noStrictVerify != null && (noStrictVerify.equalsIgnoreCase("true") || noStrictVerify.equalsIgnoreCase("false"))) { return Boolean.parseBoolean(noStrictVerify); } else { String xCodeVersionString = getXCodeVersionString(); DefaultArtifactVersion version = getVersion(xCodeVersionString); if(checkVersions(version, MIN_XCODE_VERSION_NO_STRICT_VERIFY)) { return DEFAULT_NO_STRICT_VERIFY_FOR_NEW_XCODE; } else { return DEFAULT_NO_STRICT_VERIFY_FOR_OLD_XCODE; } } }
Source:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 3) { throw new IAE("Function[%s] needs 3 arguments", name()); } final String arg = args.get(0).eval(bindings).asString(); final String pattern = args.get(1).eval(bindings).asString(); final String replacement = args.get(2).eval(bindings).asString(); if (arg == null) { return ExprEval.of(null); } return ExprEval.of( arg.replace(Strings.nullToEmpty(pattern), Strings.nullToEmpty(replacement)) ); }

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 3) { throw new IAE("Function[%s] needs 3 arguments", name()); } final String arg = args.get(0).eval(bindings).asString(); final String pattern = args.get(1).eval(bindings).asString(); final String replacement = args.get(2).eval(bindings).asString(); if (arg == null) { return ExprEval.of(NullHandling.defaultStringValue()); } return ExprEval.of( arg.replace(NullHandling.nullToEmptyIfNeeded(pattern), NullHandling.nullToEmptyIfNeeded(replacement)) ); }
Source:
public SoundType getBreakSound() { return (SoundType) this.breakSound; }

Target:
public SoundEvent getBreakSound() { return this.breakSound; }
Source:
protected void sendDmxData() { if (this.thing.getStatus().equals(ThingStatus.ONLINE)) { boolean needsSending = false; long now = System.currentTimeMillis(); universe.calculateBuffer(now); if ((universe.getLastBufferChanged() > lastSend) || refreshAlways) { needsSending = true; repeatCounter = 0; } else if (now - lastSend > 800) { needsSending = true; } else if (repeatCounter < 3) { needsSending = true; repeatCounter++; } if (needsSending) { packetTemplate.setPayload(universe.getBuffer(), universe.getBufferSize()); packetTemplate.setSequence(sequenceNo); DatagramPacket sendPacket = new DatagramPacket(packetTemplate.getRawPacket(), packetTemplate.getPacketLength()); for (IpNode receiverNode : receiverNodes) { sendPacket.setAddress(receiverNode.getAddress()); sendPacket.setPort(receiverNode.getPort()); logger.trace("sending packet with length to {}", packetTemplate.getPacketLength(), receiverNode.toString()); try { socket.send(sendPacket); } catch (IOException e) { logger.warn("Exception in packet sender"); closeConnection(); } } lastSend = now; sequenceNo = (sequenceNo + 1) % 256; } } else { openConnection(); } }

Target:
protected void sendDmxData() { if (this.thing.getStatus().equals(ThingStatus.ONLINE)) { boolean needsSending = false; long now = System.currentTimeMillis(); universe.calculateBuffer(now); if ((universe.getLastBufferChanged() > lastSend) || refreshAlways) { needsSending = true; repeatCounter = 0; } else if (now - lastSend > 800) { needsSending = true; } else if (repeatCounter < 3) { needsSending = true; repeatCounter++; } if (needsSending) { packetTemplate.setPayload(universe.getBuffer(), universe.getBufferSize()); packetTemplate.setSequence(sequenceNo); DatagramPacket sendPacket = new DatagramPacket(packetTemplate.getRawPacket(), packetTemplate.getPacketLength()); for (IpNode receiverNode : receiverNodes) { sendPacket.setAddress(receiverNode.getAddress()); sendPacket.setPort(receiverNode.getPort()); logger.trace("sending packet with length to {}", packetTemplate.getPacketLength(), receiverNode.toString()); try { socket.send(sendPacket); } catch (IOException e) { logger.debug("Could not send to in {}: {}", receiverNode, this.thing.getUID(), e); closeConnection(ThingStatusDetail.COMMUNICATION_ERROR, "could not send DMX data"); } } lastSend = now; sequenceNo = (sequenceNo + 1) % 256; } } else { openConnection(); } }
Source:
public void injectInto(PhoenicisScriptEngine phoenicisScriptEngine) { final Map<String, Object> includedScripts = new HashMap<>(); phoenicisScriptEngine.put("include", (Function<String, Object>) argument -> { if (!includedScripts.containsKey(argument)) { final String script = scriptFetcher.getScript(argument); if (script == null) { throwException(new ScriptException(argument + " is not found")); } includedScripts.put(argument, phoenicisScriptEngine.evalAndReturn(" this::throwException)); } return includedScripts.get(argument); }, this::throwException); }

Target:
public void injectInto(PhoenicisScriptEngine phoenicisScriptEngine) { final Map<String, Object> includedScripts = new HashMap<>(); phoenicisScriptEngine.put("include", (Function<String, Object>) argument -> { if (!includedScripts.containsKey(argument)) { final String script = scriptFetcher.getScript(argument); if (script == null) { throwException(new ScriptException("Script '" + argument + "' is not found")); } includedScripts.put(argument, phoenicisScriptEngine.evalAndReturn(" this::throwException)); } return includedScripts.get(argument); }, this::throwException); }
Source:
public long getTimeBucket(long time) { Preconditions.checkArgument(time < 0, "Time: %s is illegal", time); return time - time % getBucketSpan().getMillis(); }

Target:
public long getTimeBucket(long time) { Preconditions.checkArgument(time >= 0, "Time: %s is illegal", time); return time - time % getBucketSpan().getMillis(); }
Source:
private boolean createProcessFolder(URI userHomeProcess, URI userHome, Project project, String processTitle) throws IOException { String normalizedTitle = Helper.getNormalizedTitle(processTitle); if (!fileService.delete(userHomeProcess)) { Helper.setErrorMessage(Helper.getTranslation(ERROR_EXPORT, Collections.singletonList(processTitle)), Helper.getTranslation(EXPORT_DIR_DELETE, Collections.singletonList("Import"))); return false; } URI successFolder = URI.create(project.getDmsImportRootPath() + "/" + normalizedTitle); if (!fileService.delete(successFolder)) { Helper.setErrorMessage(Helper.getTranslation(ERROR_EXPORT, Collections.singletonList(processTitle)), Helper.getTranslation(EXPORT_DIR_DELETE, Collections.singletonList("Success"))); return false; } if (!fileService.fileExist(userHomeProcess)) { fileService.createDirectory(userHome, normalizedTitle); } return true; }

Target:
private boolean createProcessFolder(URI userHomeProcess, URI userHome, Project project, String processTitle) throws IOException { String normalizedTitle = Helper.getNormalizedTitle(processTitle); if (!fileService.delete(userHomeProcess)) { Helper.setErrorMessage(Helper.getTranslation(ERROR_EXPORT, Collections.singletonList(processTitle)), Helper.getTranslation(EXPORT_DIR_DELETE, Collections.singletonList("Import"))); return false; } if (!fileService.fileExist(userHomeProcess)) { fileService.createDirectory(userHome, normalizedTitle); } return true; }
Source:
public static void tearDownDomain() throws Exception { setOriginMasterManagementNativeInterface(); reloadMaster(); checkHostStatusOnMaster("master"); masterManagementRealmSetup.tearDown(domainMasterLifecycleUtil.getDomainClient()); testSupport.stop(); testSupport = null; domainMasterLifecycleUtil = null; }

Target:
public static void tearDownDomain() throws Exception { masterManagementRealmSetup.tearDown(domainMasterLifecycleUtil.getDomainClient()); testSupport.stop(); testSupport = null; domainMasterLifecycleUtil = null; FileUtils.deleteDirectory(WORK_DIR); }
Source:
private void checkDRRole() { SyncCallback cb = new SyncCallback(); if (getConnectionHadler().callProcedure(getInternalUser(), false, BatchTimeoutOverrideType.NO_TIMEOUT, cb, "@Statistics", "DRROLE",0)) { try { cb.waitForResponse(); } catch (InterruptedException e) { m_logger.error("Interrupted while retrieving cluster for DRROLE STATS", e); return; } ClientResponseImpl r = ClientResponseImpl.class.cast(cb.getResponse()); if (r.getStatus() != ClientResponse.SUCCESS) { m_logger.error("Unable to retrieve DRROLE STATS: " + r.getStatusString()); return; } VoltTable result = r.getResults()[0]; while (result.advanceRow()) { DrRoleType drRole = DrRoleType.fromValue(result.getString(DRRoleStats.CN_ROLE).toLowerCase()); DRRoleStats.State state = DRRoleStats.State.valueOf(result.getString(DRRoleStats.CN_STATE)); byte remoteCluster = (byte) result.getLong(DRRoleStats.CN_REMOTE_CLUSTER_ID); if (m_logger.isDebugEnabled()) { m_logger.debug("DRROLE stats: Role:" + drRole + " State:" + state + " Remote Cluster ID:" + remoteCluster); } if (drRole == DrRoleType.NONE) { continue; } if (DRRoleStats.State.STOPPED == state) { if (!m_snmpDRTrapSent.getOrDefault(remoteCluster, false)) { m_snmpTrapSender.statistics(FaultFacility.DR, String.format("Database Replication ROLE: %s break with Remote Cluster %d.", drRole, remoteCluster)); m_snmpDRTrapSent.put(remoteCluster, true); } } else { if (m_snmpDRTrapSent.getOrDefault(remoteCluster, false)) { m_snmpDRTrapSent.put(remoteCluster, false); } } } } else { m_logger.error("Unable to retrieve DRROLE STATS:: failed to invoke @Statistics DRROLE, 0."); } }

Target:
private void checkDRRole() { SyncCallback cb = new SyncCallback(); if (getConnectionHadler().callProcedure(getInternalUser(), false, BatchTimeoutOverrideType.NO_TIMEOUT, cb, "@Statistics", "DRROLE",0)) { try { cb.waitForResponse(); } catch (InterruptedException e) { m_logger.error("Interrupted while retrieving cluster for DRROLE STATS", e); return; } ClientResponse r = cb.getResponse(); if (r.getStatus() != ClientResponse.SUCCESS) { m_logger.error("Unable to retrieve DRROLE STATS: " + r.getStatusString()); return; } VoltTable result = r.getResults()[0]; while (result.advanceRow()) { DrRoleType drRole = DrRoleType.fromValue(result.getString(DRRoleStats.CN_ROLE).toLowerCase()); DRRoleStats.State state = DRRoleStats.State.valueOf(result.getString(DRRoleStats.CN_STATE)); byte remoteCluster = (byte) result.getLong(DRRoleStats.CN_REMOTE_CLUSTER_ID); if (m_logger.isDebugEnabled()) { m_logger.debug("DRROLE stats: Role:" + drRole + " State:" + state + " Remote Cluster ID:" + remoteCluster); } if (drRole == DrRoleType.NONE) { continue; } if (DRRoleStats.State.STOPPED == state) { if (!m_snmpDRTrapSent.getOrDefault(remoteCluster, false)) { m_snmpTrapSender.statistics(FaultFacility.DR, String.format("Database Replication ROLE: %s break with Remote Cluster %d.", drRole, remoteCluster)); m_snmpDRTrapSent.put(remoteCluster, true); } } else { if (m_snmpDRTrapSent.getOrDefault(remoteCluster, false)) { m_snmpDRTrapSent.put(remoteCluster, false); } } } } else { m_logger.error("Unable to retrieve DRROLE STATS:: failed to invoke @Statistics DRROLE, 0."); } }
Source:
public void changeMessageCommitFormatMultipleParagraph() throws Exception { Change c = newChange(); ChangeUpdate update = newUpdate(c, changeOwner); update.setChangeMessage("Just a little code change.\nTesting new line" + "\n\nTesting multiple paragraphs."); update.commit(); assertEquals("refs/changes/01/1/meta", update.getRefName()); RevWalk walk = new RevWalk(repo); try { RevCommit commit = walk.parseCommit(update.getRevision()); walk.parseBody(commit); assertEquals("Update patch set 1\n" + "\n" + "Just a little code change.\nTesting new line" + "\n\nTesting multiple paragraphs.\n" + "\n" + "Patch-set: 1\n", commit.getFullMessage()); } finally { walk.release(); } }

Target:
public void changeMessageCommitFormatMultipleParagraph() throws Exception { Change c = newChange(); ChangeUpdate update = newUpdate(c, changeOwner); update.setChangeMessage("Just a little code change.\n" + "Testing new line\n" + "\n" + "Testing multiple paragraphs."); update.commit(); assertEquals("refs/changes/01/1/meta", update.getRefName()); RevWalk walk = new RevWalk(repo); try { RevCommit commit = walk.parseCommit(update.getRevision()); walk.parseBody(commit); assertEquals("Update patch set 1\n" + "\n" + "Just a little code change.\nTesting new line\n" + "\n" + "Testing multiple paragraphs.\n" + "\n" + "Patch-set: 1\n", commit.getFullMessage()); } finally { walk.release(); } }
Source:
protected Response instantiateStormAndHandleResponse(String templateId, String childJson, String alias, boolean active, AliasManager aliasMan, ItemManager itemMan){ Response response; if (StringUtils.isEmpty(templateId)) { response = Response.status(500).build(); } else { response = instantiateTemplate(templateId, childJson); if (response.getStatus() == HttpStatus.SC_OK) { if (active) { hoistNewTemplateToTopLevel(templateId, itemMan); } if (!StringUtils.isEmpty(alias)) { String originalTemplateId = updateStormAlias(alias, aliasMan, templateId); orphanOriginalTemplate(originalTemplateId, itemMan); } Map<String, Object> ok = new HashMap<String, Object>() { private static final long serialVersionUID = 2398472L; { put("id", templateId); } }; String responseText = GsonUtil.getDefault().toJson(ok, HashMap.class); response = Response.ok(responseText, MediaType.APPLICATION_JSON_TYPE).build(); } } return response; }

Target:
protected Response instantiateStormAndHandleResponse(String templateId, String childJson, String alias, boolean active, AliasManager aliasMan, ItemManager itemMan){ Response response; if (StringUtils.isEmpty(templateId)) { response = Response.status(500).build(); } else { response = instantiateTemplate(templateId, childJson); if (response.getStatus() == HttpStatus.SC_OK) { if (active) { hoistNewTemplateToTopLevel(templateId, itemMan); } if (!StringUtils.isEmpty(alias)) { String originalTemplateId = updateStormAlias(alias, aliasMan, templateId); if (active) { orphanOriginalStormTemplate(originalTemplateId, itemMan); } } Map<String, Object> ok = new HashMap<String, Object>() { private static final long serialVersionUID = 2398472L; { put("id", templateId); } }; String responseText = GsonUtil.getDefault().toJson(ok, HashMap.class); response = Response.ok(responseText, MediaType.APPLICATION_JSON_TYPE).build(); } } return response; }
Source:
public static SimpleOptionData toOption(final CapFloorIbor caplet, final MulticurveProviderInterface curves) { ArgumentChecker.notNull(caplet, "caplet"); ArgumentChecker.notNull(curves, "null yield curves"); final double fwd = caplet.accept(PRC, curves); final double t = caplet.getFixingTime(); final double df = curves.getDiscountFactor(caplet.getCurrency(), caplet.getPaymentTime()) * caplet.getPaymentYearFraction(); SimpleOptionData options = new SimpleOptionData(fwd, caplet.getStrike(), t, df, caplet.isCap()); return options; }

Target:
public static SimpleOptionData toOption(final CapFloorIbor caplet, final MulticurveProviderInterface curves) { ArgumentChecker.notNull(caplet, "caplet"); ArgumentChecker.notNull(curves, "null yield curves"); double fwd = caplet.accept(PRC, curves); double t = caplet.getFixingTime(); double df = curves.getDiscountFactor(caplet.getCurrency(), caplet.getPaymentTime()) * caplet.getPaymentYearFraction(); SimpleOptionData options = new SimpleOptionData(fwd, caplet.getStrike(), t, df, caplet.isCap()); return options; }
Source:
public int getURLStatus(String URL) { try { purge(URL); HttpURLConnection.setFollowRedirects(false); HttpURLConnection connection = (HttpURLConnection) new URL(URL).openConnection(); connection.disconnect(); connection.setRequestMethod("GET"); connection.setRequestProperty( "User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) " + "Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)" ); int status = connection.getResponseCode(); connection.disconnect(); return status; } catch (IOException e) { e.printStackTrace(); return 1; } catch (Exception e) { e.printStackTrace(); return 2; } }

Target:
public int getURLStatus(String URL) { try { purge(URL); HttpURLConnection.setFollowRedirects(false); HttpURLConnection connection = (HttpURLConnection) new URL(URL).openConnection(); connection.disconnect(); connection.setRequestMethod("GET"); connection.setRequestProperty( "User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) " + "Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)" ); int status = connection.getResponseCode(); connection.disconnect(); return status; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(repository.getId()) == null) { getClient(repository); } try { return configurationCache.get(repository.getId()); } catch (UncheckedExecutionException e) { if (!e.getMessage().startsWith( "com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } else { return null; } } catch (ExecutionException e) { if (!e.getMessage().startsWith("CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } return null; }

Target:
public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(new RepositoryKey(repository)) == null) { getClient(repository); } try { return configurationCache.get(new RepositoryKey(repository)); } catch (UncheckedExecutionException e) { if (!e.getMessage().startsWith( "com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } else { return null; } } catch (ExecutionException e) { if (!e.getMessage().startsWith("CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } return null; }
Source:
private static Object compileExpression(String code, Class<?> implClass, String[] params, String[] defaultImports) { List<String> imports = new LinkedList<>(); if (defaultImports != null && defaultImports.length != 0) { for (String defaultImport : defaultImports) { if (!defaultImport.startsWith("static")) { imports.add("static " + defaultImport); } else { imports.add(defaultImport); } } } IScriptEvaluator se; try { se = CompilerFactoryFactory.getDefaultCompilerFactory().newScriptEvaluator(); se.setDefaultImports(imports.toArray(new String[imports.size()])); } catch (Exception ex) { throw new RuntimeException(ex); } try { logger.debug("code: {}", code); return se.createFastEvaluator(code, implClass, params); } catch (CompileException ex) { throw new RuntimeException(ex); } }

Target:
private static Object compileExpression(String code, Class<?> implClass, String[] params, String[] defaultImports) { List<String> imports = new LinkedList<>(); if (defaultImports != null && defaultImports.length != 0) { for (String defaultImport : defaultImports) { if (defaultImport != null) { if (!defaultImport.startsWith("static")) { imports.add("static " + defaultImport); } else { imports.add(defaultImport); } } } } IScriptEvaluator se; try { se = CompilerFactoryFactory.getDefaultCompilerFactory().newScriptEvaluator(); se.setDefaultImports(imports.toArray(new String[imports.size()])); } catch (Exception ex) { throw new RuntimeException(ex); } try { logger.debug("code: {}", code); return se.createFastEvaluator(code, implClass, params); } catch (CompileException ex) { throw new RuntimeException(ex); } }
Source:
void setEntryId(long entryId) { this.entryId = entryId; lh.distributionSchedule.getWriteSet(entryId, writeSet); }

Target:
void setEntryId(long entryId) { this.entryId = entryId; }
Source:
public T read() { Resource resource; resource = getResource(); if (!resource.exists()) { return null; } try (InputStream inputStream = new BufferedInputStream(resource.getInputStream())) { JavaType type = yamlMapper.getTypeFactory().constructType(myClazz); return yamlMapper.readValue(inputStream, type); } catch (IOException e) { throw new UndeclaredThrowableException(e); } }

Target:
public synchronized T read() { Resource resource = getResource(); if (!resource.exists()) { return null; } try (InputStream inputStream = new BufferedInputStream(resource.getInputStream())) { return yamlMapper.readValue(inputStream, myClazz); } catch (IOException e) { throw new UndeclaredThrowableException(e); } }
Source:
private DirContext bindAsUser(String username, String password) { String bindPrincipal = createBindPrincipal(username); contextSource.setUrl(url); contextSource.setUserDn(bindPrincipal); contextSource.setPassword(password); if(contextEnvironmentProperties != null) { contextSource.setBaseEnvironmentProperties(contextEnvironmentProperties); } contextSource.afterPropertiesSet(); try { return contextSource.getContext(bindPrincipal, password); } catch (org.springframework.ldap.NamingException e) { if ((e.getCause() instanceof AuthenticationException) || (e.getCause() instanceof OperationNotSupportedException)) { handleBindException(bindPrincipal, (NamingException) e.getCause()); throw badCredentials(e); } else { throw e; } } }

Target:
private DirContext bindAsUser(String username, String password) { final String bindUrl = url; Hashtable<String, Object> env = new Hashtable<>(); env.put(Context.SECURITY_AUTHENTICATION, "simple"); String bindPrincipal = createBindPrincipal(username); env.put(Context.SECURITY_PRINCIPAL, bindPrincipal); env.put(Context.PROVIDER_URL, bindUrl); env.put(Context.SECURITY_CREDENTIALS, password); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.OBJECT_FACTORIES, DefaultDirObjectFactory.class.getName()); if(contextEnvironmentProperties != null) { env.putAll(contextEnvironmentProperties); } try { return contextFactory.createContext(env); } catch (NamingException e) { if ((e instanceof AuthenticationException) || (e instanceof OperationNotSupportedException)) { handleBindException(bindPrincipal, e); throw badCredentials(e); } else { throw LdapUtils.convertLdapException(e); } } }
Source:
public void createControl(Composite parent, final FormToolkit toolkit) { if (taskReviewStore != null) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); } if (reviews == null || reviews.size() == 0) { return; } reviewContainers = new ArrayList<TaskReview>(); populateReviews(reviewContainers); selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, true); section.setText(section.getText()); createContents(toolkit, section); section.addExpansionListener(new ExpansionAdapter()); setSection(toolkit, section); }

Target:
public void createControl(Composite parent, final FormToolkit toolkit) { if (taskReviewStore != null) { Collection<String> reviewUrls = taskReviewStore.getReviewUrls(getTaskEditorPage().getTask().getUrl()); getReviewsFromUrls(reviewUrls); } if (reviews == null || reviews.size() == 0) { return; } reviewContainers = new ArrayList<TaskReview>(); populateReviews(reviewContainers); selectionProvider = new SelectionProviderAdapter(); section = createSection(parent, toolkit, true); section.setText(section.getText()); createContents(toolkit, section); setSection(toolkit, section); }
Source:
public String generateModelElementId(EObject eObject, ESObjectContainer<ModelElementId> collection) { if (EGenericType.class.isInstance(eObject)) { final EGenericType eGeneric = EGenericType.class.cast(eObject); if (eGeneric.eContainer() != null && eGeneric.eContainer() != this && collection.contains(eGeneric.eContainer())) { final ModelElementId containerId = collection.getModelElementId(eGeneric.eContainer()); return containerId.getId() + ID_SUFFIX; } } return null; }

Target:
public String generateModelElementId(EObject eObject, ESObjectContainer<ModelElementId> collection) { if (EGenericType.class.isInstance(eObject)) { final EGenericType eGeneric = EGenericType.class.cast(eObject); if (eGeneric.eContainer() != null && eGeneric.eContainer() != collection && collection.contains(eGeneric.eContainer())) { final ModelElementId containerId = collection.getModelElementId(eGeneric.eContainer()); return containerId.getId() + ID_SUFFIX; } } return null; }
Source:
public static void setupSystemProperties() { int freePort = TestUtilGit.findFreePort(); System.setProperty("org.uberfire.nio.git.daemon.port", String.valueOf(freePort)); logger.info("Git port used:{}", freePort); System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); }

Target:
public static void setupSystemProperties() { System.setProperty("org.uberfire.nio.git.daemon.enabled", "false"); System.setProperty("org.uberfire.nio.git.ssh.enabled", "false"); System.setProperty("org.uberfire.sys.repo.monitor.disabled", "true"); }
Source:
<V extends Value<E>, E> Collection<DataProvider<V, E>> getProvidersFor(Key<V> key) throws UnregisteredKeyException; Optional<DataStore> getDataStore(TypeToken<? extends DataHolder> token); Iterable<Key<?>> getKeys(); PluginContainer getPluginContainer(); static <T> DataRegistration of(Key<Value<T>> key, Class<? extends DataHolder>... dataHolders) { final DataStore dataStore = DataStore.of(key, DataQuery.of(key.getKey().getNamespace(), key.getKey().getValue()), dataHolders); return DataRegistration.builder().dataKey(key).store(dataStore).key(key.getKey()).build(); }

Target:
<V extends Value<E>, E> Collection<DataProvider<V, E>> getProvidersFor(Key<V> key) throws UnregisteredKeyException; Optional<DataStore> getDataStore(TypeToken<? extends DataHolder> token); Iterable<Key<?>> getKeys(); PluginContainer getPluginContainer(); static <T> DataRegistration of(Key<Value<T>> key, Class<? extends DataHolder> dataHolder, Class<? extends DataHolder>... dataHolders) { final DataStore dataStore = DataStore.of(key, DataQuery.of(key.getKey().getNamespace(), key.getKey().getValue()), dataHolder, dataHolders); return DataRegistration.builder().dataKey(key).store(dataStore).key(key.getKey()).build(); }
Source:
public boolean remove(String lookupName) { LookupExtractor lookupExtractor = lookupMap.remove(lookupName); if (lookupExtractor != null) { try { LOGGER.debug("Removing lookup [%s]", lookupName); lookupExtractor.close(); } catch (IOException e) { LOGGER.error(e, "Got exception while closing lookup [%s]", lookupName); } return true; } return false; }

Target:
public boolean remove(String lookupName) { final LookupExtractorFactory lookupExtractorFactory = lookupMap.remove(lookupName); if (lookupExtractorFactory != null) { LOGGER.debug("Removing lookup [%s]", lookupName); return lookupExtractorFactory.close(); } return false; }
Source:
private String iso3Code(Country country) { return new Locale("en", country.code()).getISO3Country().toLowerCase(); }

Target:
private String iso3Code(Country country) { return new Locale(Locale.ENGLISH.getLanguage(), country.code()).getISO3Country().toLowerCase(); }
Source:
public int getHostAvailableMemoryLimit(VDS curVds) { if (curVds.getMemCommited() != null && curVds.getPhysicalMemMb() != null && curVds.getReservedMem() != null && curVds.getSwapTotal() != null) { double vdsCurrentMem = getVdsCurrentReservedMemory(curVds); double vdsMemLimit = getVdsMemLimit(curVds); return (int) (vdsMemLimit - vdsCurrentMem); } return 0; }

Target:
public int getHostAvailableMemoryLimit(VDS curVds) { if (curVds.getMemCommited() != null && curVds.getPhysicalMemMb() != null && curVds.getReservedMem() != null) { double vdsCurrentMem = getVdsCurrentMemoryInUse(curVds); double vdsMemLimit = getVdsMemLimit(curVds); return (int) (vdsMemLimit - vdsCurrentMem); } return 0; }
Source:
public SearchResults filterResults(SearchResults searchResults) { List<PageTitle> filteredResults = new ArrayList<>(); List<PageTitle> results = searchResults.getPageTitles(); for (int i = 0, count = 0; i < results.size() && count < maxItems; i++) { final PageTitle res = results.get(i); if (!title.equalsIgnoreCase(res.getPrefixedText()) && (!requireThumbnail || res.getThumbUrl() != null) && !(res.hasProperties() && (res.isMainPage() || res.isDisambiguationPage()))) { filteredResults.add(res); count++; } } return new SearchResults(filteredResults, null, null); }

Target:
public SearchResults filterResults(SearchResults searchResults) { List<PageTitle> filteredResults = new ArrayList<>(); List<PageTitle> results = searchResults.getPageTitles(); for (int i = 0, count = 0; i < results.size() && count < maxItems; i++) { final PageTitle res = results.get(i); if (!title.equalsIgnoreCase(res.getPrefixedText()) && (!requireThumbnail || res.getThumbUrl() != null) && !(res.isMainPage() || res.isDisambiguationPage())) { filteredResults.add(res); count++; } } return new SearchResults(filteredResults, null, null); }
Source:
protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_download_batch_status, this); downloadBatchStatusView = findViewById(R.id.download_batch_status); View pauseDownloadView = findViewById(R.id.button_pause_downloading); View resumeDownloadView = findViewById(R.id.button_resume_downloading); pauseDownloadView.setOnClickListener(view -> { if (downloadBatchStatusListener == null) { return; } downloadBatchStatusListener.onBatchPaused(); }); resumeDownloadView.setOnClickListener(view -> { if (downloadBatchStatusListener == null) { return; } downloadBatchStatusListener.onBatchResumed(); }); }

Target:
protected void onFinishInflate() { super.onFinishInflate(); View.inflate(getContext(), R.layout.merge_download_batch_status, this); statusTextView = findViewById(R.id.download_batch_status); findViewById(R.id.button_pause_downloading).setOnClickListener(view -> downloadBatchStatusListener.onBatchPaused()); findViewById(R.id.button_resume_downloading).setOnClickListener(view -> downloadBatchStatusListener.onBatchResumed()); }
Source:
public MemoryDrain(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); this.getSpellAbility().addEffect(new CounterSourceEffect()); this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addEffect(new ScryEffect(2)); }

Target:
public MemoryDrain(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{U}{U}"); this.getSpellAbility().addEffect(new CounterTargetEffect()); this.getSpellAbility().addTarget(new TargetSpell()); this.getSpellAbility().addEffect(new ScryEffect(2)); }