auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void printNetworkParameters(NetworkParams networkParams) { oshi.add("Network parameters:" + networkParams.toString()); }

Target:
private static void printNetworkParameters(NetworkParams networkParams) { oshi.add("Network parameters:\n" + networkParams.toString()); }
Source:
public static OzoneAcl convertOzoneAcl(OzoneAclInfo aclInfo) { ACLIdentityType aclType; switch(aclInfo.getType()) { case USER: aclType = ACLIdentityType.USER; break; case GROUP: aclType = ACLIdentityType.GROUP; break; case WORLD: aclType = ACLIdentityType.WORLD; break; default: throw new IllegalArgumentException("ACL type is not recognized"); } List<IAccessAuthorizer.ACLType> aclRights = new ArrayList<>(); for(OzoneAclRights acl:aclInfo.getRightsList()) { try { aclRights.add(ACLType.valueOf(acl.name())); } catch(IllegalArgumentException iae) { LOG.error("ACL:{} right is not recognized.", acl); } } return new OzoneAcl(aclType, aclInfo.getName(), aclRights); }

Target:
public static OzoneAcl convertOzoneAcl(OzoneAclInfo aclInfo) { ACLIdentityType aclType; switch (aclInfo.getType()) { case USER: aclType = ACLIdentityType.USER; break; case GROUP: aclType = ACLIdentityType.GROUP; break; case WORLD: aclType = ACLIdentityType.WORLD; break; case ANONYMOUS: aclType = ACLIdentityType.ANONYMOUS; break; case CLIENT_IP: aclType = ACLIdentityType.CLIENT_IP; break; default: throw new IllegalArgumentException("ACL type is not recognized"); } List<IAccessAuthorizer.ACLType> aclRights = new ArrayList<>(); for (OzoneAclRights acl : aclInfo.getRightsList()) { aclRights.add(ACLType.valueOf(acl.name())); } return new OzoneAcl(aclType, aclInfo.getName(), aclRights); }
Source:
public void shouldSubstituteHexValuesInReplacementString() { String replacement = "abc\\x01\\xaadef"; ReplacerParamRule nonAsciiRegexRule = new ReplacerParamRule( "", REQ_HEADER_STR, "anyMatchString", true, replacement, null, true); assertThat( nonAsciiRegexRule.getEscapedReplacement(), equalTo(new String(new byte[] {'a', 'b', 'c', 1, (byte) 170, 'd', 'e', 'f'}))); }

Target:
public void shouldSubstituteHexValuesInReplacementString() { String replacement = "abc\\x01\\xaadef"; ReplacerParamRule hexValueRegexRule = new ReplacerParamRule( "", REQ_HEADER_STR, "anyMatchString", true, replacement, null, true); assertThat( hexValueRegexRule.getEscapedReplacement(), equalTo( new String( new byte[] {'a', 'b', 'c', 1, (byte) 170, 'd', 'e', 'f'}, StandardCharsets.US_ASCII))); }
Source:
public Map<String, Discrepancy> getDiscrepanciesList() { Map<String, Discrepancy> toReturn = new HashMap<String, Discrepancy>(); String discrepanciesJson = artifact.getSoleAttributeAsString(DispoConstants.DispoDiscrepanciesJson, "{}"); try { JsonNode node = JsonUtil.getMapper().readTree(discrepanciesJson); Iterator<JsonNode> elements = node.getElements(); while (elements.hasNext()) { Discrepancy discrepancy = JsonUtil.getMapper().readValue(elements.next().toString(), Discrepancy.class); toReturn.put(discrepancy.getId(), discrepancy); } } catch (Exception ex) { throw new OseeCoreException("Could not parse Discrepancies Json", ex); } return toReturn; }

Target:
public Map<String, Discrepancy> getDiscrepanciesList() { String discrepanciesJson = artifact.getSoleAttributeAsString(DispoConstants.DispoDiscrepanciesJson, "{}"); return DispoUtil.jsonStringToDiscrepanciesMap(discrepanciesJson); }
Source:
public void setup() throws IOException, InterruptedException { m_eventdIpcMgr.setEventWriter(m_database); OnmsMonitoringLocation location = new OnmsMonitoringLocation(); location.setLocationName("Default"); m_locationDao.save(location); final OnmsNode node = new OnmsNode(location, "node1"); node.setId(NODE_ID_ONE); m_nodeDao.save(node); Hashtable<String, Object> producerConfig = new Hashtable<String, Object>(); producerConfig.put("group.id", "OpenNMS"); producerConfig.put("bootstrap.servers", kafkaServer.getKafkaConnectString()); ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class, RETURNS_DEEP_STUBS); when(configAdmin.getConfiguration(KAFKA_PRODUCER_CLIENT_PID).getProperties()).thenReturn(producerConfig); ExecutorService executor = Executors.newSingleThreadExecutor(); kafkaConsumer = new KafkaMessageConsumerRunner(kafkaServer.getKafkaConnectString()); executor.execute(kafkaConsumer); kafkaProducer = new OpennmsKafkaProducer(protobufMapper, nodeCache, configAdmin, m_eventdIpcMgr, alarmLifecycleListenerManager); kafkaProducer.setEventTopic("events"); kafkaProducer.setEventFilter("getUei().equals(\"uei.opennms.org/internal/discovery/newSuspect\")"); kafkaProducer.setNodeTopic("nodes"); kafkaProducer.init(); Thread.sleep(2000); }

Target:
public void setup() throws IOException, InterruptedException { m_eventdIpcMgr.setEventWriter(m_database); OnmsMonitoringLocation location = new OnmsMonitoringLocation(); location.setLocationName("Default"); m_locationDao.save(location); final OnmsNode node = new OnmsNode(location, "node1"); node.setId(NODE_ID_ONE); m_nodeDao.save(node); Hashtable<String, Object> producerConfig = new Hashtable<String, Object>(); producerConfig.put("group.id", "OpenNMS"); producerConfig.put("bootstrap.servers", kafkaServer.getKafkaConnectString()); ConfigurationAdmin configAdmin = mock(ConfigurationAdmin.class, RETURNS_DEEP_STUBS); when(configAdmin.getConfiguration(KAFKA_PRODUCER_CLIENT_PID).getProperties()).thenReturn(producerConfig); ExecutorService executor = Executors.newSingleThreadExecutor(); kafkaConsumerRunner = new KafkaMessageConsumerRunner(kafkaServer.getKafkaConnectString()); executor.execute(kafkaConsumerRunner); kafkaProducer = new OpennmsKafkaProducer(protobufMapper, nodeCache, configAdmin, m_eventdIpcMgr, alarmLifecycleListenerManager); kafkaProducer.setEventTopic("events"); kafkaProducer.setEventFilter("getUei().equals(\"uei.opennms.org/internal/discovery/newSuspect\")"); kafkaProducer.setNodeTopic("nodes"); kafkaProducer.init(); waitUntilTopicsAreInitialized(); }
Source:
public long updateHash( HashFunction hashFunction, long hash ) { class CodePointCursor { byte[] values; int i; @SuppressWarnings( "WeakerAccess" ) int codePointCount; @SuppressWarnings( "WeakerAccess" ) long next() { codePointCount++; byte b = values[i]; if ( b >= 0 ) { i++; return b; } int bytesNeeded = 0; while ( b < 0 ) { bytesNeeded++; b = (byte) (b << 1); } int codePoint = codePoint( values, b, i, bytesNeeded ); i += bytesNeeded; return codePoint; } } CodePointCursor cpc = new CodePointCursor(); cpc.values = bytes; cpc.i = offset; int len = offset + byteLength; while ( cpc.i < len ) { long codePointA = cpc.next() << 32; long codePointB = 0L; if ( cpc.i < len ) { codePointB = cpc.next(); } hash = hashFunction.update( hash, codePointA + codePointB ); } return hashFunction.update( hash, cpc.codePointCount ); }

Target:
public long updateHash( HashFunction hashFunction, long hash ) { CodePointCursor cpc = new CodePointCursor(); cpc.values = bytes; cpc.i = offset; int len = offset + byteLength; while ( cpc.i < len ) { long codePointA = cpc.nextCodePoint() << 32; long codePointB = 0L; if ( cpc.i < len ) { codePointB = cpc.nextCodePoint(); } hash = hashFunction.update( hash, codePointA + codePointB ); } return hashFunction.update( hash, cpc.codePointCount ); }
Source:
public void triggerCompleted() { getProcessInstance().removeEventListener(getEventType(), getEventListener(), true); ((org.jbpm.workflow.instance.NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(getLevel()); ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); NodeInstanceContainer container = ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()); NodeInstance instance = container.getNodeInstance(getNode()); triggerNodeInstance((org.jbpm.workflow.instance.NodeInstance) instance, NodeImpl.CONNECTION_DEFAULT_TYPE); }

Target:
public void triggerCompleted() { getProcessInstance().removeEventListener(getEventType(), getEventListener(), true); ((org.jbpm.workflow.instance.NodeInstanceContainer)getNodeInstanceContainer()).setCurrentLevel(getLevel()); ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).removeNodeInstance(this); NodeInstance instance = ((org.jbpm.workflow.instance.NodeInstanceContainer) getNodeInstanceContainer()).getNodeInstance(getNode()); triggerNodeInstance((org.jbpm.workflow.instance.NodeInstance) instance, NodeImpl.CONNECTION_DEFAULT_TYPE); }
Source:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; PlanElement lastSelectedEntry = firstSelectedEntry; ElementAction type = firstSelectedEntry.getPlanElementAction(); unselectAllActionItemsExecpt(getItemFor(type)); if (structured.size() > 1) { for (Iterator iterator = structured.iterator(); iterator .hasNext();) { Object selectedObj = iterator.next(); if (!(selectedObj instanceof PlanElement)) continue; PlanElement entry = lastSelectedEntry = (PlanElement) selectedObj; if (type != entry.getPlanElementAction()) { unselectAllActionItemsExecpt(null); } } } enableMoveButtons(firstSelectedEntry, lastSelectedEntry); } }

Target:
void mapActionItemsToSelection(ISelection selection) { setMoveItemsEnabled(false); if (selection == null || selection.isEmpty()) return; if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Object obj = structured.getFirstElement(); if (!(obj instanceof PlanElement)) return; PlanElement firstSelectedEntry = (PlanElement) obj; PlanElement lastSelectedEntry = firstSelectedEntry; ElementAction type = firstSelectedEntry.getPlanElementAction(); boolean singleTypeSelected = true; if (structured.size() > 1) { for (Iterator iterator = structured.iterator(); iterator .hasNext();) { Object selectedObj = iterator.next(); if (!(selectedObj instanceof PlanElement)) continue; PlanElement entry = lastSelectedEntry = (PlanElement) selectedObj; if (type != entry.getPlanElementAction()) { singleTypeSelected = false; break; } } } if (singleTypeSelected) { unselectAllActionItemsExecpt(getItemFor(type)); } else { unselectAllActionItemsExecpt(null); } enableMoveButtons(firstSelectedEntry, lastSelectedEntry); } }
Source:
public void testToMillisOverflow() throws Exception { Duration duration = Duration.parse("P60000000000000D"); try { context.getTypeConverter().convertTo(long.class, duration); } catch (TypeConversionException e) { assertIsInstanceOf(ArithmeticException.class, e.getCause().getCause()); assertThat(e.getMessage(), is("Error during type conversion from type: java.time.Duration to the required type: " + "long with value PT1440000000000000H due java.lang.ArithmeticException: long overflow")); } }

Target:
public void testToMillisOverflow() throws Exception { Duration duration = Duration.parse("P60000000000000D"); try { context.getTypeConverter().convertTo(long.class, duration); } catch (TypeConversionException e) { assertIsInstanceOf(ArithmeticException.class, e.getCause().getCause()); } }
Source:
private void publishChildren(IModule[] module, ArrayList<IStatus> results, IModule[] children, File parentModule, IProgressMonitor monitor) { if( children == null ) return; monitor.beginTask("Assembling child modules", children.length * 100); for( int i = 0; i < children.length; i++ ) { if( ServerModelUtilities.isBinaryModule(children[i])) results.addAll(Arrays.asList(fullBinaryPublish(module, children[i], ProgressMonitorUtil.submon(monitor, 100)))); else results.addAll(Arrays.asList(fullPublish(combine(module, children[i]), parentModule, ProgressMonitorUtil.submon(monitor, 100)))); } }

Target:
private void publishChildren(IModule[] module, ArrayList<IStatus> results, IModule[] children, File parentModule, IProgressMonitor monitor) { if( children == null ) return; monitor.beginTask("Assembling child modules", children.length * 100); for( int i = 0; i < children.length && !monitor.isCanceled(); i++ ) { if( ServerModelUtilities.isBinaryModule(children[i])) results.addAll(Arrays.asList(fullBinaryPublish(module, children[i], ProgressMonitorUtil.submon(monitor, 100)))); else results.addAll(Arrays.asList(fullPublish(combine(module, children[i]), parentModule, ProgressMonitorUtil.submon(monitor, 100)))); } }
Source:
public boolean isReady() { return false; }

Target:
public boolean isReady() { return this.isReady(); }
Source:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessageContext> emitter) { synchronized (lock) { final long id = idGenerator.getAndIncrement(); final SynchronousReceiveWork work = new SynchronousReceiveWork(id, maximumMessageCount, maxWaitTime, emitter); final SynchronousMessageSubscriber syncSubscriber = new SynchronousMessageSubscriber(work); EmitterProcessor<SynchronousMessageSubscriber> workProcessor = workQueueProcessor.get(); workProcessor.onNext(syncSubscriber); Disposable thisWorkSubscriber = workSubscriber.get(); if (thisWorkSubscriber != null) { logger.info("[{}]: Receive request is placed in queue to process.", id); return; } EmitterProcessor<ServiceBusReceivedMessageContext> source = messageSource.get(); if (source == null) { source = this.asyncClient.receive(DEFAULT_RECEIVE_OPTIONS) .subscribeWith(EmitterProcessor.create(asyncClient.getReceiverOptions().getPrefetchCount(), false)); messageSource.set(source); logger.info("Created source for receiving messages."); } EmitterProcessor<ServiceBusReceivedMessageContext> finalSource = source; thisWorkSubscriber = workProcessor .subscribe(currentWork -> finalSource.subscribe(currentWork), error -> { logger.error("Error in processing messages [{}]", error); }, () -> { logger.info("Receiving messages completed."); }); workSubscriber.set(thisWorkSubscriber); } }

Target:
private void queueWork(int maximumMessageCount, Duration maxWaitTime, FluxSink<ServiceBusReceivedMessageContext> emitter) { final long id = idGenerator.getAndIncrement(); final SynchronousReceiveWork work = new SynchronousReceiveWork(id, maximumMessageCount, maxWaitTime, emitter); SynchronousMessageSubscriber messageSubscriber = synchronousMessageSubscriber.get(); if (messageSubscriber == null) { long prefetch = asyncClient.getReceiverOptions().getPrefetchCount(); SynchronousMessageSubscriber newSubscriber = new SynchronousMessageSubscriber(prefetch, work); if (!synchronousMessageSubscriber.compareAndSet(null, newSubscriber)) { newSubscriber.dispose(); SynchronousMessageSubscriber existing = synchronousMessageSubscriber.get(); existing.queueWork(work); } else { asyncClient.receive().subscribeWith(newSubscriber); } } else { messageSubscriber.queueWork(work); } logger.verbose("[{}] Receive request queued up.", work.getId()); }
Source:
private static String truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName(String legalLastName, String legalFirstName) { int maxAllowedLengthOfFirstName = VendorConstants.MAX_VENDOR_NAME_LENGTH - VendorConstants.NAME_DELIM.length() - legalLastName.length(); if (legalFirstName.length() <= maxAllowedLengthOfFirstName) { return legalFirstName; } else { String truncatedLegalFirstName = legalFirstName.substring(0, maxAllowedLengthOfFirstName); LOG.info("truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName: Received legalFirstName '" + legalFirstName + "' with length of " + legalFirstName.length() + " and it is being truncated to '" + truncatedLegalFirstName + "' with length of " + truncatedLegalFirstName.length()); return truncatedLegalFirstName; } }

Target:
private static String truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName(String legalLastName, String legalFirstName) { int maxAllowedLengthOfFirstName = VendorConstants.MAX_VENDOR_NAME_LENGTH - VendorConstants.NAME_DELIM.length() - legalLastName.length(); if (maxAllowedLengthOfFirstName <= 0) { LOG.info("truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName: legalLastName is '" + legalLastName + "'. Received legalFirstName '" + legalFirstName + "' with length of " + legalFirstName.length() + " and it is being truncated to '" + KFSConstants.EMPTY_STRING + "' with length of 0."); return KFSConstants.EMPTY_STRING; } else if (legalFirstName.length() <= maxAllowedLengthOfFirstName) { return legalFirstName; } else { String truncatedLegalFirstName = legalFirstName.substring(0, maxAllowedLengthOfFirstName); LOG.info("truncateLegalFirstNameToMaximumAllowedLengthWhenFormattedWithLegalLastName: legalLastName is '" + legalLastName + "Received legalFirstName '" + legalFirstName + "' with length of " + legalFirstName.length() + " and it is being truncated to '" + truncatedLegalFirstName + "' with length of " + truncatedLegalFirstName.length()); return truncatedLegalFirstName; } }
Source:
public void onTimer(String serverId, String volumeId, String snapshotNamePrefix, String description, boolean force) { GlusterVolumeEntity volume = getGlusterVolumeDao().getById(new Guid(volumeId)); GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); snapshot.setClusterId(volume.getClusterId()); snapshot.setVolumeId(new Guid(volumeId)); DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); String snapshotName = snapshotNamePrefix + "-snap-" + df.format(new Date()); snapshot.setSnapshotName(snapshotName); snapshot.setDescription(description); VDSReturnValue returnValue = getBackend().getResourceManager() .RunVdsCommand(VDSCommandType.CreateGlusterVolumeSnapshot, new GlusterVolumeCreateSnapshotVDSParameters(new Guid(serverId), volume.getName(), snapshotName, description, force)); if (returnValue.getSucceeded()) { snapshot.setSnapshotId((Guid) returnValue.getReturnValue()); snapshot.setCreatedAt(new Date()); snapshot.setStatus(GlusterSnapshotStatus.STARTED); getGlusterVolumeSnapshotDao().save(snapshot); } else { log.error("Error while creating snapshot for volume '{}': {}", volume.getName(), returnValue.getVdsError() .getMessage()); log.debug(returnValue.getVdsError().getMessage()); } }

Target:
public void onTimer(String serverId, String volumeId, String snapshotNamePrefix, String description, boolean force) { GlusterVolumeEntity volume = getGlusterVolumeDao().getById(new Guid(volumeId)); GlusterVolumeSnapshotEntity snapshot = new GlusterVolumeSnapshotEntity(); snapshot.setClusterId(volume.getClusterId()); snapshot.setVolumeId(new Guid(volumeId)); DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); String snapshotName = snapshotNamePrefix + "-snap-" + df.format(new Date()); snapshot.setSnapshotName(snapshotName); snapshot.setDescription(description); VdcReturnValueBase returnValue = getBackend().runInternalAction(VdcActionType.CreateGlusterVolumeSnapshot, new CreateGlusterVolumeSnapshotParameters(snapshot, force)); if (!returnValue.getSucceeded()) { log.error("Error while creating snapshot for volume '{}': {}", volume.getName(), returnValue.getExecuteFailedMessages().toString()); log.debug(returnValue.getExecuteFailedMessages().toString()); } }
Source:
public boolean removeFileEntry(String index, TransientStore ts) { BatchFileEntry fileEntry = getFileEntry(index, false); if (fileEntry != null) { if (fileEntry.isChunked()) { for (String chunkEntryKey : fileEntry.getChunkEntryKeys()) { List<Blob> chunkBlobs = ts.getBlobs(chunkEntryKey); if (chunkBlobs != null) { for (Blob blob : chunkBlobs) { try { FileUtils.deleteDirectory(blob.getFile().getParentFile()); } catch (IOException e) { log.error("Error while deleting chunk parent directory", e); } } } ts.remove(chunkEntryKey); } fileEntry.beforeRemove(); } String fileEntryKey = fileEntry.getKey(); List<Blob> fileBlobs = ts.getBlobs(fileEntryKey); if (fileBlobs != null) { for (Blob blob : fileBlobs) { try { FileUtils.deleteDirectory(blob.getFile().getParentFile()); } catch (IOException e) { log.error("Error while deleting file parent directory", e); } } } ts.remove(fileEntryKey); return true; } else { return false; } }

Target:
public boolean removeFileEntry(String index, TransientStore ts) { BatchFileEntry fileEntry = getFileEntry(index, false); if (fileEntry == null) { return false; } if (fileEntry.isChunked()) { for (String chunkEntryKey : fileEntry.getChunkEntryKeys()) { List<Blob> chunkBlobs = ts.getBlobs(chunkEntryKey); if (chunkBlobs != null) { for (Blob blob : chunkBlobs) { try { FileUtils.deleteDirectory(blob.getFile().getParentFile()); } catch (IOException e) { log.error("Error while deleting chunk parent directory", e); } } } ts.remove(chunkEntryKey); } fileEntry.beforeRemove(); } String fileEntryKey = fileEntry.getKey(); List<Blob> fileBlobs = ts.getBlobs(fileEntryKey); if (fileBlobs != null) { for (Blob blob : fileBlobs) { try { FileUtils.deleteDirectory(blob.getFile().getParentFile()); } catch (IOException e) { log.error("Error while deleting file parent directory", e); } } } ts.remove(fileEntryKey); return true; }
Source:
public CertificationRequest(CertificationRequestInfo certificationRequestInfo, SignatureAlgorithmIdentifier signatureAlgorithmIdentifier, byte[] signature) { this.certificationRequestInfo = requireNonNull(certificationRequestInfo, "certificationRequestInfo is null"); this.signatureAlgorithmIdentifier = requireNonNull(signatureAlgorithmIdentifier, "signatureAlgorithmIdentifier is null"); this.signature = signature; this.encoded = encodeSequence( certificationRequestInfo.getEncoded(), encodeSequence(signatureAlgorithmIdentifier.getEncoded()), encodeBitString(0, signature)); }

Target:
public CertificationRequest(CertificationRequestInfo certificationRequestInfo, SignatureAlgorithmIdentifier signatureAlgorithmIdentifier, byte[] signature) { this.certificationRequestInfo = requireNonNull(certificationRequestInfo, "certificationRequestInfo is null"); this.signatureAlgorithmIdentifier = requireNonNull(signatureAlgorithmIdentifier, "signatureAlgorithmIdentifier is null"); this.signature = requireNonNull(signature, "signature is null").clone(); this.encoded = encodeSequence( certificationRequestInfo.getEncoded(), encodeSequence(signatureAlgorithmIdentifier.getEncoded()), encodeBitString(0, signature)); }
Source:
public void load() { IEclipsePreferences prefs = EclipsePreferencesUtils.getInstanceScope().getNode(UiPlugin.PLUGIN_ID); this.projectTasksVisible = prefs.getBoolean(PREF_PROJECT_TASKS_VISIBLE, false); this.taskSelectorsVisible = prefs.getBoolean(PREF_TASK_SELECTORS_VISIBLE, true); this.privateTasksVisible = prefs.getBoolean(PREF_PRIVATE_TASKS_VISIBLE, false); this.sortByType = prefs.getBoolean(PREF_SORT_BY_TYPE, true); this.sortByVisibility = prefs.getBoolean(PREF_SORT_BY_VISIBILITY, true); this.linkToSelection = prefs.getBoolean(PREF_LINK_TO_SELECTION, false); this.headerNameColumnWidth = prefs.getInt(PREF_HEADER_NAME_COLUMN_WIDTH, 200); this.headerDescriptionColumnWidth = prefs.getInt(PREF_HEADER_DESCRIPTION_COLUMN_WIDTH, 400); this.groupProjects = prefs.getBoolean(PREF_GROUP_PROJECTS_BY_HIERARCHY, true); this.groupTasks = prefs.getBoolean(PREF_GROUP_TASKS, true); }

Target:
public void load() { IEclipsePreferences prefs = EclipsePreferencesUtils.getInstanceScope().getNode(UiPlugin.PLUGIN_ID); this.projectTasksVisible = prefs.getBoolean(PREF_PROJECT_TASKS_VISIBLE, false); this.taskSelectorsVisible = prefs.getBoolean(PREF_TASK_SELECTORS_VISIBLE, true); this.privateTasksVisible = prefs.getBoolean(PREF_PRIVATE_TASKS_VISIBLE, false); this.sortByType = prefs.getBoolean(PREF_SORT_BY_TYPE, true); this.sortByVisibility = prefs.getBoolean(PREF_SORT_BY_VISIBILITY, true); this.linkToSelection = prefs.getBoolean(PREF_LINK_TO_SELECTION, false); this.headerNameColumnWidth = prefs.getInt(PREF_HEADER_NAME_COLUMN_WIDTH, 200); this.headerDescriptionColumnWidth = prefs.getInt(PREF_HEADER_DESCRIPTION_COLUMN_WIDTH, 400); this.groupTasks = prefs.getBoolean(PREF_GROUP_TASKS, true); this.projectHierarchyFlattened = prefs.getBoolean(PREF_FLATTEN_PROJECT_HIERARCHY, false); }
Source:
public boolean canExecute(@NonNull ITmfTrace trace) { for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) { if (!requirement.fulfill(trace)) { return false; } } return true; }

Target:
public boolean canExecute(@NonNull ITmfTrace trace) { for (TmfAnalysisRequirement requirement : getAnalysisRequirements()) { if (!requirement.isFulfilled(trace)) { return false; } } return true; }
Source:
void setPluginName(String name) { if (!name.isEmpty()) { this.pluginName = name; } }

Target:
void setPluginName(String name) { if (!Strings.isNullOrEmpty(name)) { this.pluginName = name; } }
Source:
public void should_compute_annotations_on_workflow() { MavenInstallation.installMaven(jenkins, "M3", "3.3.3"); WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set( "node {\n" + " git '<LINK_0>'\n" + " def mvnHome = tool 'M3'\n" + " sh \"${mvnHome}/bin/mvn -B -Dmaven.test.failure.ignore verify\"\n" + " step([$class: 'FindBugsPublisher', pattern: '**/findbugsXml.xml'])\n" + " step([$class: 'CheckStylePublisher'])\n" + " step([$class: 'AnalysisPublisher'])\n" + "}"); job.sandbox.check(); job.save(); final Build build = job.startBuild(); build.shouldSucceed(); assertThat(build, hasAction("Static Analysis Warnings")); AnalysisCollectorAction action = new AnalysisCollectorAction(build); action.open(); assertThat(action.getNumberOfWarnings(), is(17)); assertThat(action.getNumberOfNewWarnings(), is(17)); }

Target:
public void should_compute_annotations_on_workflow() { WorkflowJob job = jenkins.jobs.create(WorkflowJob.class); job.script.set( "node {\n" + job.copyResourceStep(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES + "/checkstyle-result.xml") + job.copyResourceStep(ANALYSIS_COLLECTOR_PLUGIN_RESOURCES +"/findbugs.xml") + " step([$class: 'FindBugsPublisher', pattern: '**/findbugs.xml'])\n" + " step([$class: 'CheckStylePublisher'])\n" + " step([$class: 'AnalysisPublisher'])\n" + "}"); job.sandbox.check(); job.save(); final Build build = job.startBuild(); build.shouldSucceed(); assertThat(build, hasAction("Static Analysis Warnings")); AnalysisCollectorAction action = new AnalysisCollectorAction(build); action.open(); assertThat(action.getNumberOfWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL)); assertThat(action.getNumberOfNewWarnings(), is(FINDBUGS_ALL + CHECKSTYLE_ALL)); }
Source:
public void canConvertToStringWithBothMethodAndClassName() { AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .build(); assertThat(element.toString()) .contains(CLASS_NAME) .contains(METHOD_NAME); }

Target:
public void canConvertToStringWithBothMethodAndClassName() { AtlasDbStackTraceElement element = ImmutableAtlasDbStackTraceElement.builder() .className(CLASS_NAME) .methodName(METHOD_NAME) .build(); assertClassAndMethodName(element, CLASS_NAME, METHOD_NAME); }
Source:
@Override public void unparseSqlIntervalLiteral( SqlWriter writer, SqlIntervalLiteral literal, int leftPrec, int rightPrec) { SqlIntervalLiteral.IntervalValue interval = (SqlIntervalLiteral.IntervalValue) literal.getValue(); writer.keyword("INTERVAL"); if (interval.getSign() == -1) { writer.print("-"); } writer.literal(literal.getValue().toString()); unparseSqlIntervalQualifier(writer, interval.getIntervalQualifier(), RelDataTypeSystem.DEFAULT); }

Target:
@Override public void unparseSqlIntervalLiteral( SqlWriter writer, SqlIntervalLiteral literal, int leftPrec, int rightPrec) { SqlIntervalLiteral.IntervalValue interval = (SqlIntervalLiteral.IntervalValue) literal.getValue(); writer.keyword("INTERVAL"); if (interval.getSign() == -1) { writer.print("-"); } Long intervalValueInLong; try { intervalValueInLong = Long.parseLong(literal.getValue().toString()); } catch (NumberFormatException e) { throw new RuntimeException("Only INT64 is supported as the interval value for BigQuery."); } writer.literal(intervalValueInLong.toString()); unparseSqlIntervalQualifier(writer, interval.getIntervalQualifier(), RelDataTypeSystem.DEFAULT); }
Source:
protected ServerImpl updateServer(ServerImpl server) { super.updateServer(server); if (!Strings.isNullOrEmpty(cheDockerCustomExternalProtocol)) { ServerPropertiesImpl properties = (ServerPropertiesImpl) server.getProperties(); String url = properties.getInternalUrl(); if(url != null && url.startsWith("http:")) { int length = "http".length(); properties.setInternalUrl(cheDockerCustomExternalProtocol.concat(url.substring(length))); } } return server; }

Target:
protected ServerImpl updateServer(ServerImpl server) { super.updateServer(server); setExternalProtocolForInternalUrl(server); return server; }
Source:
public TransactionParser getParser(KXmlParser parser) { String namespace = parser.getNamespace(); String name = parser.getName(); TransactionParser superParser = super.getParser(parser); if(superParser != null){ return superParser; } if("message".equalsIgnoreCase(name)) { return new TransactionParser<String>(parser) { String nature = parser.getAttributeValue(null, "nature"); public void commit(String parsed) throws IOException { } public String parse() throws InvalidStructureException,IOException, XmlPullParserException, UnfullfilledRequirementsException { message = parser.nextText(); if(nature != null) { if(message != null) { messages.put(nature, message); } } return message; } }; } return null; }

Target:
public TransactionParser getParser(KXmlParser parser) { String namespace = parser.getNamespace(); String name = parser.getName(); if("message".equalsIgnoreCase(name)) { return new TransactionParser<String>(parser) { String nature = parser.getAttributeValue(null, "nature"); public void commit(String parsed) throws IOException { } public String parse() throws InvalidStructureException,IOException, XmlPullParserException, UnfullfilledRequirementsException { message = parser.nextText(); if(nature != null) { if(message != null) { messages.put(nature, message); } } return message; } }; } TransactionParser superParser = super.getParser(parser); if(superParser != null){ return superParser; } return null; }
Source:
private int convertToDate(Object object) { final long millis; if (object instanceof Integer) { final Integer value = (Integer) object; millis = (long) value * MILLIS_PER_DAY; } else { final LocalDate value = (LocalDate) object; millis = value.toDate().getTime(); } return (int) (millis / MILLIS_PER_DAY); }

Target:
private int convertToDate(Object object) { if (object instanceof Integer) { return (Integer) object; } else { final LocalDate value = (LocalDate) object; return (int) (toTimestampData(value.toDate().getTime()).getMillisecond() / MILLIS_PER_DAY); } }
Source:
String translate(RexNode e, boolean set, boolean formatDateString) { int index = -1; switch (e.getKind()) { case INPUT_REF: final RexInputRef ref = (RexInputRef) e; index = ref.getIndex(); break; case CAST: return tr(e, 0, set, formatDateString); case LITERAL: if (!formatDateString) { return ((RexLiteral) e).getValue3().toString(); } else { switch (((RexLiteral) e).getTypeName()) { case TIMESTAMP_WITH_LOCAL_TIME_ZONE: case TIMESTAMP: case DATE: Long val = ((RexLiteral) e).getValueAs(Long.class); return dateFormatter.format(val); default: return ((RexLiteral) e).getValue3().toString(); } } case FLOOR: case EXTRACT: final RexCall call = (RexCall) e; assert DruidDateTimeUtils.extractGranularity(call) != null; index = RelOptUtil.InputFinder.bits(e).asList().get(0); break; case IS_TRUE: return ""; } if (index == -1) { throw new AssertionError("invalid expression " + e); } final String fieldName = rowType.getFieldList().get(index).getName(); if (set) { if (druidTable.metricFieldNames.contains(fieldName)) { metrics.add(fieldName); } else if (!druidTable.timestampFieldName.equals(fieldName) && !DruidTable.DEFAULT_TIMESTAMP_COLUMN.equals(fieldName)) { dimensions.add(fieldName); } } return fieldName; }

Target:
String translate(RexNode e, boolean set, boolean formatDateString) { int index = -1; switch (e.getKind()) { case INPUT_REF: final RexInputRef ref = (RexInputRef) e; index = ref.getIndex(); break; case CAST: return tr(e, 0, set, formatDateString); case LITERAL: final RexLiteral rexLiteral = (RexLiteral) e; if (!formatDateString) { return Objects.toString(rexLiteral.getValue3()); } else { TimestampString timestampString = DruidDateTimeUtils .literalValue(e, TimeZone.getTimeZone(timeZone)); if (timestampString == null) { throw new AssertionError( "Cannot translate Literal" + e + " of type " + rexLiteral.getTypeName() + " to TimestampString"); } return dateFormatter.format(timestampString.getMillisSinceEpoch()); } case FLOOR: case EXTRACT: final RexCall call = (RexCall) e; assert DruidDateTimeUtils.extractGranularity(call) != null; index = RelOptUtil.InputFinder.bits(e).asList().get(0); break; case IS_TRUE: return ""; } if (index == -1) { throw new AssertionError("invalid expression " + e); } final String fieldName = rowType.getFieldList().get(index).getName(); if (set) { if (druidTable.metricFieldNames.contains(fieldName)) { metrics.add(fieldName); } else if (!druidTable.timestampFieldName.equals(fieldName) && !DruidTable.DEFAULT_TIMESTAMP_COLUMN.equals(fieldName)) { dimensions.add(fieldName); } } return fieldName; }
Source:
public DataSource call() throws Exception { try { Class.forName(CONNECTION_POOL_DRIVER); } catch (Exception ex) { throw new OseeDataStoreException(ex, "Error loading connectino pool driver [%s]", CONNECTION_POOL_DRIVER); } ConnectionFactory connectionFactory = createConnectionFactory(dbInfo); ObjectPool<Connection> connectionPool = new GenericObjectPool<Connection>(); @SuppressWarnings({"rawtypes", "unchecked"}) KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory(null); new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, null, false, true); DataSource dataSource = new PoolingDataSource(connectionPool); String poolId = dbInfo.getId(); PoolingDriver driver = poolingDriver.get(); driver.registerPool(poolId, connectionPool); return dataSource; }

Target:
public DataSource call() throws Exception { try { Class.forName(CONNECTION_POOL_DRIVER); } catch (Exception ex) { throw new OseeDataStoreException(ex, "Error loading connection pool driver [%s]", CONNECTION_POOL_DRIVER); } ConnectionFactory connectionFactory = createConnectionFactory(dbInfo); ObjectPool<Connection> connectionPool = new GenericObjectPool<Connection>(); @SuppressWarnings({"rawtypes", "unchecked"}) KeyedObjectPoolFactory statementPool = new GenericKeyedObjectPoolFactory(null); new PoolableConnectionFactory(connectionFactory, connectionPool, statementPool, null, false, true); DataSource dataSource = new PoolingDataSource(connectionPool); String poolId = dbInfo.getId(); PoolingDriver driver = poolingDriver.get(); driver.registerPool(poolId, connectionPool); return dataSource; }
Source:
static URI relativize(URI current, URI target) { if ((current.getHost() == null) != (target.getHost() == null)) { return target; } if (current.getHost() != null && !current.getHost().equals(target.getHost())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }

Target:
static URI relativize(URI current, URI target) { if (!Objects.equals(current.getHost(), target.getHost())) { return target; } String cur = current.normalize().getPath(); String dest = target.normalize().getPath(); if (cur.startsWith(SLASH) != dest.startsWith(SLASH)) { return target; } while (cur.startsWith(SLASH)) { cur = cur.substring(1); } while (dest.startsWith(SLASH)) { dest = dest.substring(1); } if (cur.indexOf('/') == -1 || dest.indexOf('/') == -1) { String prefix = "prefix/"; cur = prefix + cur; dest = prefix + dest; } if (!cur.endsWith(SLASH)) { int lastSlash = cur.lastIndexOf('/'); cur = cur.substring(0, lastSlash); } String destFile = ""; if (!dest.endsWith(SLASH)) { int lastSlash = dest.lastIndexOf('/'); destFile = dest.substring(lastSlash + 1, dest.length()); dest = dest.substring(0, dest.lastIndexOf('/')); } String[] cs = cur.split(SLASH); String[] ds = dest.split(SLASH); int common = 0; while (common < cs.length && common < ds.length && cs[common].equals(ds[common])) { common++; } StringJoiner j = new StringJoiner(SLASH); for (int i = common; i < cs.length; i++) { j.add(".."); } for (int i = common; i < ds.length; i++) { j.add(ds[i]); } j.add(destFile); return URI.create(j.toString()); }
Source:
public void doSelectRow() { initRowHighlighting(); if (TeclaApp.persistence.isSelfScanningEnabled()) { delaySelfScanning(); } }

Target:
public void doSelectRow() { initRowHighlighting(); if (TeclaApp.persistence.isSelfScanningEnabled()) { pauseSelfScanning(); mHandler.postDelayed(mScanRunnable, mScanDelay); } }
Source:
public void binaryType(BinaryType binaryType) { webSocket.binaryType(binaryType.name()); }

Target:
public void binaryType(BinaryType binaryType) { webSocket.setBinaryType(JSString.valueOf(binaryType.name())); }
Source:
public BulkMutation(String tableName) { this.builder = MutateRowsRequest.newBuilder().setTableName(tableName); size = MutateRowsRequest.newBuilder().setTableName(tableName).build().getSerializedSize(); }

Target:
public BulkMutation(String tableName) { this.builder = MutateRowsRequest.newBuilder().setTableName(tableName); this.size = MutateRowsRequest.newBuilder().setTableName(tableName).build().getSerializedSize(); }
Source:
private String getLaserLimits(Observation observation, ClearanceWindow clearance) { String fmt = "HH:mm:ss"; LaserTarget scienceTarget = observation.getScienceTarget().getLaserTarget(); for (Visibility.Interval visibility : scienceTarget.getVisibility().getAboveLaserLimit()) { long vStart = visibility.getStart().getTime() / DateTimeUtils.MillisecondsPerSecond(); long vEnd = visibility.getEnd().getTime() / DateTimeUtils.MillisecondsPerSecond(); long cStart = clearance.getStart().getTime() / DateTimeUtils.MillisecondsPerSecond(); long cEnd = clearance.getEnd().getTime() / DateTimeUtils.MillisecondsPerSecond(); if (vStart > cStart && vStart < cEnd) { return "(rises above " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getStart().getTime()) + ")"; } if (vEnd > cStart && vEnd < cEnd) { return "(sets below " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getEnd().getTime()) + ")"; } } return ""; }

Target:
private String getLaserLimits(Observation observation, ClearanceWindow clearance) { String fmt = "HH:mm:ss"; LaserTarget scienceTarget = observation.getScienceTarget().getLaserTarget(); final long msPerSecs = TimeUnit.SECONDS.toMillis(1); for (Visibility.Interval visibility : scienceTarget.getVisibility().getAboveLaserLimit()) { long vStart = visibility.getStart().getTime() / msPerSecs; long vEnd = visibility.getEnd().getTime() / msPerSecs; long cStart = clearance.getStart().getTime() / msPerSecs; long cEnd = clearance.getEnd().getTime() / msPerSecs; if (vStart > cStart && vStart < cEnd) { return "(rises above " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getStart().getTime()) + ")"; } if (vEnd > cStart && vEnd < cEnd) { return "(sets below " + LimitsListener.MIN_ELEVATION_ERROR_LIMIT + "&deg; at " + formatDate(fmt, visibility.getEnd().getTime()) + ")"; } } return ""; }
Source:
private Option<? extends Command> getRefreshOpenedRepresentationsCommand(boolean isChanged) { Option<? extends Command> result = Options.newNone(); Collection<DRepresentation> representationsToRefresh = new LinkedHashSet<DRepresentation>(); if (isChanged && (!isForceRefresh() || isAutoRefresh())) { representationsToRefresh.addAll(RefreshFilterManager.INSTANCE.getOpenedRepresantationsToRefresh()); } representationsToRefresh.addAll(representationsToForceRefresh); restrictRepresentationWithinCurrentEditingDomain(representationsToRefresh); if (!representationsToRefresh.isEmpty()) { CompoundCommand cc = new CompoundCommand(); cc.append(new RefreshRepresentationsCommand(transactionalEditingDomain, new NullProgressMonitor(), representationsToRefresh)); for (PostRefreshCommandFactory listener : postRefreshCommandFactories) { cc.appendIfCanExecute(listener.getPostCommandToExecute(transactionalEditingDomain, representationsToRefresh)); } postRefreshCommandFactories.clear(); result = Options.newSome(cc); } return result; }

Target:
private Option<? extends Command> getRefreshOpenedRepresentationsCommand(boolean isChanged) { Option<? extends Command> result = Options.newNone(); Collection<DRepresentation> representationsToRefresh = new LinkedHashSet<DRepresentation>(); if (isChanged && isAutoRefresh()) { representationsToRefresh.addAll(RefreshFilterManager.INSTANCE.getOpenedRepresantationsToRefresh()); } representationsToRefresh.addAll(representationsToForceRefresh); restrictRepresentationWithinCurrentEditingDomain(representationsToRefresh); if (!representationsToRefresh.isEmpty()) { CompoundCommand cc = new CompoundCommand(); cc.append(new RefreshRepresentationsCommand(transactionalEditingDomain, new NullProgressMonitor(), representationsToRefresh)); for (PostRefreshCommandFactory listener : postRefreshCommandFactories) { cc.appendIfCanExecute(listener.getPostCommandToExecute(transactionalEditingDomain, representationsToRefresh)); } postRefreshCommandFactories.clear(); result = Options.newSome(cc); } return result; }
Source:
public void testBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); assertEquals(XBEE_16BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }

Target:
public void testBroadcastSerialDataReceiveSubscribedRx16() throws Exception { Mockito.when(rx16Packet.getReceiveOptions()).thenReturn(RECEIVE_OPTIONS_BROADCAST); dataReader.addSerialDatatReceiveListener(receiveSerialDataListener); Whitebox.invokeMethod(dataReader, PACKET_RECEIVED_METHOD, rx16Packet); PowerMockito.verifyPrivate(dataReader, Mockito.times(1)).invoke(NOTIFY_SERIAL_DATA_RECEIVED_METHOD, XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES, IS_BROADCAST_DATA); Mockito.verify(receiveSerialDataListener, Mockito.times(1)).broadcastSerialDataReceived(XBEE_16BIT_ADDRESS.toString(), RECEIVED_DATA_BYTES); Mockito.verify(receiveSerialDataListener, Mockito.never()).serialDataReceived(Mockito.anyString(), (byte[])Mockito.any()); assertEquals(XBEE_16BIT_ADDRESS.toString(), receiveSerialDataListener.getAddress()); assertArrayEquals(RECEIVED_DATA_BYTES, receiveSerialDataListener.getSerialData()); }
Source:
public OracleReturning(RowMapper<ResultType> mapper) { this.mapper = mapper; try { this.oraclePS = Class.forName("oracle.jdbc.OraclePreparedStatement"); this.registerReturnParameter = oraclePS.getMethod("registerReturnParameter", new Class[]{int.class, int.class}); this.getReturnResultSet = oraclePS.getMethod("getReturnResultSet"); } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public OracleReturning(RowMapper<ResultType> mapper) { this.mapper = mapper; }
Source:
public void testJavascriptFunctionInvocation() { deployProcess(JAVASCRIPT, "function sum(a,b){" + " return a+b;" + "};" + "var result = sum(1,2);" + "execution.setVariable('foo', result);" ); ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); Object variable = runtimeService.getVariable(pi.getId(), "foo"); if (variable instanceof Integer) { assertEquals(3.0, variable); } else assertEquals(3, variable); }

Target:
public void testJavascriptFunctionInvocation() { deployProcess(JAVASCRIPT, "function sum(a,b){" + " return a+b;" + "};" + "var result = sum(1,2);" + "execution.setVariable('foo', result);" ); ProcessInstance pi = runtimeService.startProcessInstanceByKey("testProcess"); Object variable = runtimeService.getVariable(pi.getId(), "foo"); assertThat(variable).isIn(3, 3.0); }
Source:
CompletableFuture<Void> getFailureOp(CommitData cd) { return CompletableFuture.supplyAsync(() -> { try { rollbackLocks(cd); } catch (Exception e) { throw new CompletionException(e); } return null; }, env.getSharedResources().getSyncCommitExecutor()); }

Target:
CompletableFuture<Void> getFailureOp(CommitData cd) { return rollbackLocks(cd); }
Source:
default Stream<T> leftPadTo(int length, T element) { if (length <= 1) { return this; } else if (isEmpty()) { return Stream.ofAll(Iterator.continually(element).take(length)); } else { return cons(element, () -> this.leftPadTo(length - 1, element)); } }

Target:
default Stream<T> leftPadTo(int length, T element) { final int actualLength = length(); if (length <= actualLength) { return this; } else { return Stream.continually(element).take(length - actualLength).appendAll(this); } }
Source:
public InterceptedMessageHandlingMember(MessageHandlingMember<T> original) { super(original); Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( "The @MessageHandlerInterceptor must be on method.")); shouldInvokeInterceptorChain = Arrays.stream(method.getParameters()) .noneMatch(p -> p.getType().equals(InterceptorChain.class)); if (shouldInvokeInterceptorChain && !Void.TYPE.equals(method.getReturnType())) { throw new AxonConfigurationException("@MessageHandlerInterceptor must return void or declare " + "InterceptorChain parameter."); } }

Target:
public InterceptedMessageHandlingMember(MessageHandlingMember<T> original) { super(original); Method method = original.unwrap(Method.class).orElseThrow(() -> new AxonConfigurationException( "Only methods can be marked as MessageHandlerInterceptor. Violating handler: " + original.signature())); shouldInvokeInterceptorChain = Arrays.stream(method.getParameters()) .noneMatch(p -> p.getType().equals(InterceptorChain.class)); if (shouldInvokeInterceptorChain && !Void.TYPE.equals(method.getReturnType())) { throw new AxonConfigurationException("A MessageHandlerInterceptor must either return null or declare a parameter of type InterceptorChain. Violating handler: " + original.signature()); } }