auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init() { LOG.debug("Initialising. Owner is: {}", getConfig(OWNER)); super.init(); }

Target:
public void init() { LOG.debug("Initialising. Owner is: {}", checkNotNull(getConfig(OWNER), OWNER.getName())); super.init(); }
Source:
private static void storeExpressionHistory(String[] expressions, IDialogSettings dialogSettings) { int length = Math.min(expressions.length, MAX_HISTORY_SIZE); int count = 0; outer: for (int i = 0; i < length; i++) { for (int j = 0; j < i; j++) { if (expressions[i].equals(expressions[j])) { break outer; } } dialogSettings.put(DS_KEY_HISTORY_ENTRY_PREFIX + count, expressions[i]); count = count + 1; } dialogSettings.put(DS_KEY_HISTORY_ENTRY_COUNT, count); }

Target:
private static void storeExpressionHistory(String[] expressions, IDialogSettings dialogSettings) { List<String> uniqueExpressions = new ArrayList<>(new LinkedHashSet<>(Arrays.asList(expressions))); final int length = Math.min(uniqueExpressions.size(), MAX_HISTORY_SIZE); int count = 0; for (String expression : uniqueExpressions) { dialogSettings.put(DS_KEY_HISTORY_ENTRY_PREFIX + count, expression); count++; if (count >= length) { break; } } dialogSettings.put(DS_KEY_HISTORY_ENTRY_COUNT, count); }
Source:
public TimeLimiterImpl(String name, TimeLimiterConfig timeLimiterConfig) { this.name = name; this.timeLimiterConfig = timeLimiterConfig; this.successes = new LongAdder(); this.errors = new LongAdder(); this.timeouts = new LongAdder(); this.metrics = new TimeLimiterMetrics(); this.eventProcessor = new TimeLimiterEventProcessor(); }

Target:
public TimeLimiterImpl(String name, TimeLimiterConfig timeLimiterConfig) { this.name = name; this.timeLimiterConfig = timeLimiterConfig; this.eventProcessor = new TimeLimiterEventProcessor(); }
Source:
public void testWithPlaceholdersButNoValues() { attributes.clear(); templateEngine.render("{0} bar", ctx); }

Target:
public void testWithPlaceholdersButNoValues() { attributes.clear(); assertThatThrownBy(() -> templateEngine.render("{0} bar", ctx)).isInstanceOf(IllegalArgumentException.class); }
Source:
public void configure(Map<String, ?> configs) throws KafkaException { if (sslEngineFactory != null) { throw new IllegalStateException("SslFactory was already configured."); } this.endpointIdentification = (String) configs.get(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG); Map<String, Object> nextConfigs = new HashMap<>(); copyAllConfigs(nextConfigs, configs); if (clientAuthConfigOverride != null) { nextConfigs.put(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, clientAuthConfigOverride); } SslEngineFactory builder = instantiateSslEngineFactory(nextConfigs); if (keystoreVerifiableUsingTruststore) { try { SslEngineValidator.validate(builder, builder); } catch (Exception e) { throw new ConfigException("A client SSLEngine created with the provided settings " + "can't connect to a server SSLEngine created with those settings.", e); } } this.sslEngineFactory = builder; }

Target:
public void configure(Map<String, ?> configs) throws KafkaException { if (sslEngineFactory != null) { throw new IllegalStateException("SslFactory was already configured."); } this.endpointIdentification = (String) configs.get(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG); Map<String, Object> nextConfigs = new HashMap<>(configs); if (clientAuthConfigOverride != null) { nextConfigs.put(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, clientAuthConfigOverride); } SslEngineFactory builder = instantiateSslEngineFactory(nextConfigs); if (keystoreVerifiableUsingTruststore) { try { SslEngineValidator.validate(builder, builder); } catch (Exception e) { throw new ConfigException("A client SSLEngine created with the provided settings " + "can't connect to a server SSLEngine created with those settings.", e); } } this.sslEngineFactory = builder; }
Source:
public void testLimit() { ContentResolver cr = getMockContentResolver(); final String stopId = "1_11060-TEST"; ContentValues values = new ContentValues(); values.put(ObaContract.Stops._ID, stopId); values.put(ObaContract.Stops.CODE, "11060"); values.put(ObaContract.Stops.NAME, "Broadway & E Denny Way"); values.put(ObaContract.Stops.DIRECTION, "S"); values.put(ObaContract.Stops.USE_COUNT, 0); values.put(ObaContract.Stops.LATITUDE, 47.617676); values.put(ObaContract.Stops.LONGITUDE, -122.314523); Uri uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); final String stopId2 = "1_1010101"; values.put(ObaContract.Stops._ID, stopId2); uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); Cursor c = cr.query(ObaContract.Stops.CONTENT_URI, new String[]{ObaContract.Stops._COUNT}, null, null, null); assertNotNull(c); assertEquals(1, c.getCount()); c.moveToNext(); assertTrue(c.getInt(0) == 2); c.close(); c = cr.query(ObaContract.Stops.CONTENT_URI .buildUpon() .appendQueryParameter("limit", "1") .build(), new String[]{ObaContract.Stops._ID}, null, null, null ); assertNotNull(c); assertEquals(1, c.getCount()); c.close(); int result = cr.delete(uri, null, null); assertEquals(1, result); result = cr.delete(uri, null, null); assertEquals(0, result); }

Target:
public void testLimit() { ContentResolver cr = getMockContentResolver(); final String stopId = "1_11060-TEST"; ContentValues values = new ContentValues(); values.put(ObaContract.Stops._ID, stopId); values.put(ObaContract.Stops.CODE, "11060"); values.put(ObaContract.Stops.NAME, "Broadway & E Denny Way"); values.put(ObaContract.Stops.DIRECTION, "S"); values.put(ObaContract.Stops.USE_COUNT, 0); values.put(ObaContract.Stops.LATITUDE, 47.617676); values.put(ObaContract.Stops.LONGITUDE, -122.314523); Uri uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); final String stopId2 = "1_1010101-TEST"; values.put(ObaContract.Stops._ID, stopId2); uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); Cursor c = cr.query(ObaContract.Stops.CONTENT_URI, new String[]{ObaContract.Stops._COUNT}, null, null, null); assertNotNull(c); assertEquals(1, c.getCount()); c.moveToNext(); assertTrue(c.getInt(0) == 2); c.close(); c = cr.query(ObaContract.Stops.CONTENT_URI .buildUpon() .appendQueryParameter("limit", "1") .build(), new String[]{ObaContract.Stops._ID}, null, null, null ); assertNotNull(c); assertEquals(1, c.getCount()); c.close(); }
Source:
public @Nullable TmfResolvedSymbol getSymbol(int pid, long timestamp, long address) { BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); if (bc == null) { return null; } FunctionLocation loc = UstDebugInfoFunctionAspect.getFunctionFromBinaryLocation(bc); if (loc != null) { return new TmfResolvedSymbol(bc.getOffset(), loc.getFunctionName()); } for (org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider provider : fOtherProviders) { TmfResolvedSymbol symbol = provider.getSymbol(pid, timestamp, bc.getOffset()); if (symbol != null) { return symbol; } } return null; }

Target:
public @Nullable TmfResolvedSymbol getSymbol(int pid, long timestamp, long address) { BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); if (bc == null) { return null; } FunctionLocation loc = UstDebugInfoFunctionAspect.getFunctionFromBinaryLocation(bc); if (loc != null) { return new TmfResolvedSymbol(bc.getOffset(), loc.getFunctionName()); } if (!fIsLoaded) { return null; } for (org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider provider : fOtherProviders) { TmfResolvedSymbol symbol = provider.getSymbol(pid, timestamp, bc.getOffset()); if (symbol != null) { return symbol; } } return null; }
Source:
public void bitreserveClientWithTokenShouldReturnTokenAndRestAdapter() { BitreserveClient bitreserveClient = new BitreserveClient("foobar"); Assert.assertEquals(bitreserveClient.getToken().getToken(), "foobar"); Assert.assertTrue(bitreserveClient.getToken().getBitreserveRestAdapter() != null); }

Target:
public void bitreserveClientWithTokenShouldReturnTokenAndRestAdapter() { BitreserveClient bitreserveClient = new BitreserveClient("foobar"); Assert.assertEquals(bitreserveClient.getToken().getBearerToken(), "foobar"); Assert.assertNotNull(bitreserveClient.getToken().getBitreserveRestAdapter()); }
Source:
public void start(Job<?, ?> project, boolean newInstance) { super.start(project, newInstance); String name = project.getFullName(); if (!project.isBuildable()) { logger.log(Level.FINE, "Project is disabled, not starting trigger for job " + name); return; } if (project.getProperty(GithubProjectProperty.class) == null) { logger.log(Level.INFO, "GitHub project property is missing the URL, cannot start ghprb trigger for job " + name); return; } try { initState(); } catch (Exception ex) { logger.log(Level.SEVERE, "Can't start ghprb trigger", ex); return; } logger.log(Level.INFO, "Starting the ghprb trigger for the {0} job; newInstance is {1}", new String[] { name, String.valueOf(newInstance) }); helper = new Ghprb(this); if (getUseGitHubHooks()) { boolean disable_register_on_startup = SystemProperties.getBoolean(getClass().getName() + ".disableRegisterOnStartup", false); logger.log(Level.FINEST, "Disable registering hooks on startup: {0}", new String[] { String.valueOf(disable_register_on_startup) }); if (GhprbTrigger.getDscp().getManageWebhooks() && (newInstance || !disable_register_on_startup)) { logger.log(Level.FINEST, "Registering hook with GitHub. Thread pool size: {0}", new String[] { String.valueOf(SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5)) }); pool.submit(new StartHookRunnable(this.repository)); } DESCRIPTOR.addRepoTrigger(getRepository().getName(), super.job); } }

Target:
public void start(Job<?, ?> project, boolean newInstance) { super.start(project, newInstance); String name = project.getFullName(); if (!project.isBuildable()) { logger.log(Level.FINE, "Project is disabled, not starting trigger for job " + name); return; } if (project.getProperty(GithubProjectProperty.class) == null) { logger.log(Level.INFO, "GitHub project property is missing the URL, cannot start ghprb trigger for job " + name); return; } try { initState(); } catch (Exception ex) { logger.log(Level.SEVERE, "Can't start ghprb trigger", ex); return; } logger.log(Level.INFO, "Starting the ghprb trigger for the {0} job; newInstance is {1}", new String[] { name, String.valueOf(newInstance) }); helper = new Ghprb(this); if (getUseGitHubHooks()) { logger.log(Level.FINEST, "Disable registering hooks on startup: {0}", new String[] { String.valueOf(disableRegisterOnStartup) }); if (GhprbTrigger.getDscp().getManageWebhooks() && (newInstance || !disableRegisterOnStartup)) { logger.log(Level.FINEST, "Registering hook with GitHub. Thread pool size: {0}", new String[] { String.valueOf(SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5)) }); pool.submit(new StartHookRunnable(this.repository)); } DESCRIPTOR.addRepoTrigger(getRepository().getName(), super.job); } }
Source:
protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); } finally { monitor.done(); } return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); } return Status.OK_STATUS; }
Source:
protected void runInContext() { try { final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running, mgmtSrvrId); s_logger.debug("Found " + routers.size() + " running routers. "); for (final DomainRouterVO router : routers) { GetRouterMonitorResultsAnswer answer = fetchAndUpdateRouterHealthChecks(router, false); String checkFailsToRestartVr = RouterHealthChecksFailuresToRestartVr.valueIn(router.getDataCenterId()); if (answer == null) { s_logger.warn("Unable to fetch monitor results for router " + router); updateRouterConnectivityHealthCheck(router.getId(), false, "Communication failed"); } else if (!answer.getResult()) { s_logger.warn("Failed to fetch monitor results from router " + router + " with details: " + answer.getDetails()); updateRouterConnectivityHealthCheck(router.getId(), false, "Failed to fetch results with details: " + answer.getDetails()); } else { updateRouterConnectivityHealthCheck(router.getId(), true, "Successfully fetched data"); parseAndMergeDbHealthChecks(router.getId(), answer.getMonitoringResults()); if (answer.getFailingChecks().size() > 0 && StringUtils.isNotBlank(checkFailsToRestartVr)) { s_logger.info("Checking failed health checks to see if router needs reboot"); for (String failedCheck : answer.getFailingChecks()) { if (checkFailsToRestartVr.contains(failedCheck)) { s_logger.info("Found failing health check " + failedCheck + " so restarting router."); rebootRouter(router.getId(), true); } } } } } } catch (final Exception ex) { s_logger.error("Fail to complete the FetchRouterHealthChecksResultTask! ", ex); ex.printStackTrace(); } }

Target:
protected void runInContext() { try { final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running, mgmtSrvrId); s_logger.info("Found " + routers.size() + " running routers. Fetching, analysing and updating DB for the health checks."); if (!RouterHealthChecksEnabled.value()) { s_logger.debug("Skipping fetching of router health check results as router.health.checks.enabled is disabled"); return; } for (final DomainRouterVO router : routers) { GetRouterMonitorResultsAnswer answer = fetchAndUpdateRouterHealthChecks(router, false); List<String> failingChecks = getFailingChecks(router, answer); handleFailingChecks(router, failingChecks); } } catch (final Exception ex) { s_logger.error("Fail to complete the FetchRouterHealthChecksResultTask! ", ex); ex.printStackTrace(); } }
Source:
public IValueProperty getValueProperty() { return new WidgetValueProperty() { @Override public Object getValueType() { return String.class; } @Override protected Object doGetValue(Object source) { return null; } @Override protected void doSetValue(Object source, Object value) { } @Override public IObservableValue observe(Object source) { return super.observe(parent); } }; }

Target:
public IValueProperty getValueProperty() { return new WidgetValueProperty() { @Override public Object getValueType() { return String.class; } @Override protected Object doGetValue(Object source) { return getFormatedString(source); } @Override protected void doSetValue(Object source, Object value) { } @Override public IObservableValue observe(Object source) { return super.observe(parent); } }; }
Source:
private void append(StringBuilder buf, ModelNode node, int level) { for (int i = 0; i < level; i++) { buf.append('\t'); } buf.append(node); buf.append('\n'); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childrenNode : childrenNodes) { append(buf, childrenNode, level + 1); } } }

Target:
private void append(StringBuilder buf, ModelNode node, int level) { for (int i = 0; i < level; i++) { buf.append('\t'); } buf.append(node); buf.append('\n'); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childNode : childrenNodes) { append(buf, childNode, level + 1); } } }
Source:
private com.hp.hpl.jena.rdf.model.Bag getFolderBag(com.hp.hpl.jena.rdf.model.Bag top, String basepath, String filepath) { Model model = top.getModel(); String[] pathSegments = filepath.split("/"); if (pathSegments.length <= 2) { return top; } Property labelProp = dprop(model, DepositRelationship.label); Property hasModelProp = model.createProperty(FedoraProperty.hasModel.getURI().toString()); Resource containerResource = model.createResource(CONTAINER.getURI().toString()); com.hp.hpl.jena.rdf.model.Bag currentNode = top; segmentLoop: for (int i = 1; i < pathSegments.length - 1; i++) { String segment = pathSegments[i]; NodeIterator nodeIt = currentNode.iterator(); while (nodeIt.hasNext()) { Resource child = nodeIt.nextNode().asResource(); String label = child.getProperty(labelProp).getString(); if (label.equals(segment) && child.hasProperty(hasModelProp, containerResource)) { currentNode = model.getBag(child); nodeIt.close(); continue segmentLoop; } } nodeIt.close(); PID pid = new PID("uuid:" + UUID.randomUUID().toString()); com.hp.hpl.jena.rdf.model.Bag childBag = model.createBag(pid.getURI()); currentNode.add(childBag); model.add(childBag, labelProp, segment); model.add(childBag, hasModelProp, containerResource); currentNode = childBag; } return currentNode; }

Target:
private com.hp.hpl.jena.rdf.model.Bag getFolderBag(com.hp.hpl.jena.rdf.model.Bag top, String basepath, String filepath) { Model model = top.getModel(); String[] pathSegments = filepath.split("/"); if (pathSegments.length <= 2) { return top; } Property labelProp = dprop(model, DepositRelationship.label); Property hasModelProp = model.createProperty(FedoraProperty.hasModel.getURI().toString()); Resource containerResource = model.createResource(CONTAINER.getURI().toString()); com.hp.hpl.jena.rdf.model.Bag currentNode = top; segmentLoop: for (int i = 1; i < pathSegments.length - 1; i++) { String segment = pathSegments[i]; NodeIterator nodeIt = currentNode.iterator(); while (nodeIt.hasNext()) { Resource child = nodeIt.nextNode().asResource(); String label = child.getProperty(labelProp).getString(); if (label.equals(segment)) { currentNode = model.getBag(child); nodeIt.close(); continue segmentLoop; } } nodeIt.close(); PID pid = new PID("uuid:" + UUID.randomUUID().toString()); com.hp.hpl.jena.rdf.model.Bag childBag = model.createBag(pid.getURI()); currentNode.add(childBag); model.add(childBag, labelProp, segment); model.add(childBag, hasModelProp, containerResource); currentNode = childBag; } return currentNode; }
Source:
protected void preConsumerPollHook() { for (PausedSourcePartitionMetadata metadata : _autoPausedSourcePartitions.values()) { if (metadata.shouldResume()) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); break; } } for (DatastreamConstants.UpdateType updateType : _taskUpdates) { _taskUpdates.remove(updateType); if (updateType != null) { switch (updateType) { case PAUSE_RESUME_PARTITIONS: pausePartitions(); break; default: String msg = String.format("Unknown update type for task {}.", updateType, _taskName); _logger.error(msg); throw new DatastreamRuntimeException(msg); } } } }

Target:
protected void preConsumerPollHook() { checkForPartitionsToAutoResume(); for (DatastreamConstants.UpdateType updateType : _taskUpdates) { _taskUpdates.remove(updateType); if (updateType != null) { switch (updateType) { case PAUSE_RESUME_PARTITIONS: pausePartitions(); break; default: String msg = String.format("Unknown update type for task {}.", updateType, _taskName); _logger.error(msg); throw new DatastreamRuntimeException(msg); } } else { throw new IllegalStateException("Found null update type in task updates set."); } } }
Source:
private void createDependency(JCas aJCas, Map<Integer, String> tokens, Map<Integer, String> dependencyFunction, Map<Integer, Integer> dependencyDependent, Map<String, Token> tokensStored) { for (int i = 1; i <= tokens.size(); i++) { if (dependencyFunction.get(i) != null) { Dependency outDependency = new Dependency(aJCas); outDependency.setDependencyType(dependencyFunction.get(i)); int begin, end; if (dependencyDependent.get(i) != 0) { begin = tokensStored.get("t_" + i).getBegin() > tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() : tokensStored.get( "t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd() < tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() : tokensStored .get("t_" + i).getEnd(); } else { begin = tokensStored.get("t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd(); } outDependency.setBegin(begin); outDependency.setEnd(end); outDependency.setDependent(tokensStored.get("t_" + i)); if (dependencyDependent.get(i) == 0) { outDependency.setGovernor(tokensStored.get("t_" + i)); } else { outDependency.setGovernor(tokensStored.get("t_" + dependencyDependent.get(i))); } outDependency.addToIndexes(); } } }

Target:
private void createDependency(JCas aJCas, Map<Integer, String> tokens, Map<Integer, String> dependencyFunction, Map<Integer, Integer> dependencyDependent, Map<String, Token> tokensStored) { for (int i = 1; i <= tokens.size(); i++) { if (dependencyFunction.get(i) != null) { Dependency outDependency = new Dependency(aJCas); outDependency.setDependencyType(dependencyFunction.get(i)); int begin = 0, end = 0; if (dependencyDependent.get(i) != 0) { begin = tokensStored.get("t_" + i).getBegin() > tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() : tokensStored.get( "t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd() < tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() : tokensStored .get("t_" + i).getEnd(); } else { begin = tokensStored.get("t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd(); } outDependency.setBegin(begin); outDependency.setEnd(end); outDependency.setDependent(tokensStored.get("t_" + i)); if (dependencyDependent.get(i) == 0) { outDependency.setGovernor(tokensStored.get("t_" + i)); } else { outDependency.setGovernor(tokensStored.get("t_" + dependencyDependent.get(i))); } outDependency.addToIndexes(); } } }
Source:
public final void validateMapElementsNotNull(Supplier<? extends Map<?, ?>> getter1, Supplier<? extends Map<?, ?>> getter2, Supplier<? extends Map<?, ?>> getter3, Supplier<? extends Map<?, ?>>... getters) { validateMapElementsNotNull(getter1, getter2, getter3); for (Supplier<? extends Map<?, ?>> getter : getters) { Map<?, ?> map = getter.get(); if (isMapInvalid(map)) { throw new IllegalArgumentException("map contains null elements"); } } }

Target:
public final void validateMapElementsNotNull(Supplier<? extends Map<?, ?>> getter1, Supplier<? extends Map<?, ?>> getter2, Supplier<? extends Map<?, ?>> getter3, Supplier<? extends Map<?, ?>>... getters) { validateMapElementsNotNull(getter1, getter2, getter3); for (Supplier<? extends Map<?, ?>> getter : getters) { validateMapElementsNotNull(getter); } }
Source:
public void publishSurveyInOtherStudy() { Survey survey = Survey.create(); survey.setStudyIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); try { service.publishSurvey(OTHER_STUDY, survey, true); fail("Should have thrown exception"); } catch(EntityNotFoundException e) { } verify(mockSurveyDao, never()).publishSurvey(any(), any(), anyBoolean()); }

Target:
public void publishSurveyInOtherStudy() { Survey survey = Survey.create(); survey.setStudyIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); when(mockSurveyDao.getSurvey((GuidCreatedOnVersionHolder)survey, true)).thenReturn(survey); try { service.publishSurvey(OTHER_STUDY, survey, true); fail("Should have thrown exception"); } catch(EntityNotFoundException e) { } verify(mockSurveyDao, never()).publishSurvey(any(), any(), anyBoolean()); }
Source:
public CompletionStage<RestResponse> removeLogger(String name) { Request.Builder builder = new Request.Builder(); builder.url(baseLoggingURL + "/" + sanitize(name)).delete(); return client.execute(builder); }

Target:
public CompletionStage<RestResponse> removeLogger(String name) { Request.Builder builder = new Request.Builder(); builder.url(baseLoggingURL + "/loggers/" + sanitize(name)).delete(); return client.execute(builder); }
Source:
protected NodeFilter sharedNodesFilter() { return new NodeFilter() { private final Set<NodeKey> shareableNodeKeys = new HashSet<>(); @Override public boolean includeNode( CachedNode node, NodeCache cache ) { if (node.getMixinTypes(cache).contains(JcrMixLexicon.SHAREABLE)) { NodeKey key = node.getKey(); if (shareableNodeKeys.contains(key)) { return false; } shareableNodeKeys.add(key); return true; } else { return true; } } }; }

Target:
protected NodeFilter sharedNodesFilter() { return new NodeFilter() { private final Set<NodeKey> shareableNodeKeys = new HashSet<>(); @Override public boolean includeNode( CachedNode node, NodeCache cache ) { if (isShareable(node, cache)) { NodeKey key = node.getKey(); if (shareableNodeKeys.contains(key)) { return false; } shareableNodeKeys.add(key); return true; } else { return true; } } }; }
Source:
public void execute(OutboundDocSubmissionDeferredRequestOrchestratable message) { LOG.debug("Begin OutboundDocSubmissionOrchestratableImpl_g0.process"); NhinDocSubmissionDeferredRequestProxy nhincDocSubmission = getNhinDocSubmissionDeferredRequestProxy(); XDRAcknowledgementType response = nhincDocSubmission.provideAndRegisterDocumentSetBRequest11( message.getRequest(), message.getAssertion(), message.getTarget()); message.setResponse(response); LOG.debug("End OutboundDocSubmissionDeferredRequestStrategyImpl_g0.process"); }

Target:
public void execute(OutboundDocSubmissionDeferredRequestOrchestratable message) { NhinDocSubmissionDeferredRequestProxy nhincDocSubmission = getNhinDocSubmissionDeferredRequestProxy(); XDRAcknowledgementType response = nhincDocSubmission.provideAndRegisterDocumentSetBRequest11( message.getRequest(), message.getAssertion(), message.getTarget()); message.setResponse(response); }
Source:
protected void doStop() { topicPoller.setRunning(false); try { if (topicPoller.getShutdownLatch().await(30, TimeUnit.SECONDS)) { log.info("Expired waiting on topicPoller to shut down"); } } catch (InterruptedException e) { log.info("Interrupted waiting on latch: {}", e.getMessage()); } executorService.shutdown(); try { consumer.close(); } finally { producer.close(); } }

Target:
protected void doStop() { topicPoller.setRunning(false); try { if (topicPoller.getShutdownLatch().await(30, TimeUnit.SECONDS)) { log.info("Expired waiting on topicPoller to shut down"); } } catch (InterruptedException e) { log.info("Interrupted waiting on latch: {}", e.getMessage()); } camelContext.getExecutorServiceManager().shutdown(executorService); IOHelper.close(consumer, "consumer", log); IOHelper.close(producer, "producer", log); }
Source:
protected RMDBManagerBuffer(RMDBManager rmdbManager) { this.rmdbManager = rmdbManager; delayEqualsToZero = RM_NODES_DB_OPERATIONS_DELAY.getValueAsInt() == 0; databaseTransactionExecutor = Executors.newSingleThreadScheduledExecutor(); pendingNodeSourceUpdates = new HashSet<>(); recentlyRemovedNodeSources = new CopyOnWriteArraySet<>(); pendingNodesOperations = new LinkedList<>(); }

Target:
protected RMDBManagerBuffer(RMDBManager rmdbManager) { this.rmdbManager = rmdbManager; delayEqualsToZero = RM_NODES_DB_OPERATIONS_DELAY.getValueAsInt() == 0; databaseTransactionExecutor = Executors.newSingleThreadScheduledExecutor(); pendingNodeSourceUpdates = new HashMap<>(); pendingNodesOperations = new LinkedList<>(); knownNodeSources = new HashSet<>(); Collection<NodeSourceData> nodeSources = rmdbManager.getNodeSources(); for (NodeSourceData nodeSource : nodeSources) { knownNodeSources.add(nodeSource.getName()); } }
Source:
protected void updateColors() { super.updateColors(); if (contentMergeViewer != null) { contentMergeViewer.refresh(); } }

Target:
protected void updateColors() { Color oldColorRequiredDiffColor = getRequiredDiffColor(); Color oldColorRequiredBoderDiffColor = getUnmergeableDiffBorderColor(); Color oldColorUnmergeableDiffColor = getUnmergeableDiffColor(); Color oldColorUnmergeableBorderDiffColor = getUnmergeableDiffBorderColor(); Color oldColorIncomingChangeColor = getIncomingChangeColor(); Color oldColorOutgoingDiffColor = getOutgoingChangeColor(); Color oldColorConflictingDiffColor = getConflictingChangeColor(); Color oldColorResolvedDiffColor = getResolvedChangeColor(); super.updateColors(); ColorChangeEvent colorEvent = new ColorChangeEvent(); colorEvent.addColorChange(REQUIRED_DIFF_COLOR_THEME_KEY, oldColorRequiredDiffColor, getRequiredDiffColor()); colorEvent.addColorChange(REQUIRED_DIFF_BORDER_COLOR, oldColorRequiredBoderDiffColor, getRequiredChangeBorderColor()); colorEvent.addColorChange(UNMERGEABLE_DIFF_COLOR_THEME_KEY, oldColorUnmergeableDiffColor, getUnmergeableDiffColor()); colorEvent.addColorChange(UNMERGEABLE_DIFF_BORDER_COLOR, oldColorUnmergeableBorderDiffColor, getUnmergeableDiffBorderColor()); colorEvent.addColorChange(INCOMING_CHANGE_COLOR_THEME_KEY, oldColorIncomingChangeColor, getIncomingChangeColor()); colorEvent.addColorChange(OUTGOING_CHANGE_COLOR_THEME_KEY, oldColorOutgoingDiffColor, getOutgoingChangeColor()); colorEvent.addColorChange(CONFLICTING_CHANGE_COLOR_THEME_KEY, oldColorConflictingDiffColor, getConflictingChangeColor()); colorEvent.addColorChange(RESOLVED_CHANGE_COLOR_THEME_KEY, oldColorResolvedDiffColor, getResolvedChangeColor()); if (colorEvent.isAffectingEvent()) { if (eventBus != null) { eventBus.post(colorEvent); } } }
Source:
private Optional<Currency> reportingCurrency() { if (reportingCurrency.getCurrency().isPresent()) { return reportingCurrency.getCurrency(); } return function.naturalCurrency(target); }

Target:
private Optional<Currency> reportingCurrency() { if (reportingCurrency.isSpecific()) { return Optional.of(reportingCurrency.getCurrency()); } return function.naturalCurrency(target); }
Source:
public void setExcelFileName(String fileName) { if (StringUtils.endsWith(fileName, ".xls")) { reportFileName = fileName; } else { throw new IllegalArgumentException("Excel file should end with '.xls'."); } }

Target:
public void setExcelFileName(String fileName) { Preconditions.checkArgument(StringUtils.endsWith(fileName, ".xls"), "Excel file name must end with '.xls'."); reportFileName = fileName; }
Source:
public void checkAgainstAccidentalTableAPIChanges() throws IOException { Schema schema = ApiTestSchema.getSchema(); schema.renderTables(testFolder.getRoot()); String generatedTestTableName = "SchemaApiTestTable"; String generatedFilePath = String.format("com/palantir/atlasdb/table/description/generated/%s.java", generatedTestTableName); File expectedFile = new File("src/test/java", generatedFilePath); File actualFile = new File(testFolder.getRoot(), generatedFilePath); assertThat(actualFile).hasSameContentAs(expectedFile); }

Target:
public void checkAgainstAccidentalTableAPIChanges() throws IOException { Schema schema = ApiTestSchema.getSchema(); schema.renderTables(testFolder.getRoot()); String generatedTestTableName = "SchemaApiTestTable"; String generatedFilePath = String.format("com/palantir/atlasdb/table/description/generated/%s.java", generatedTestTableName); File expectedFile = new File("src/integrationInput/java", generatedFilePath); File actualFile = new File(testFolder.getRoot(), generatedFilePath); assertThat(actualFile).hasSameContentAs(expectedFile); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); fProcessor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); fChange= getChange(refactoringWizard); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || isCompositeChange(fChange) || !(fProcessor instanceof RenameResourceProcessor)) { refactoringWizard= newName == null ? new RenameResourceWizard(resource) : new RenameResourceWizard(resource, newName); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { fChange.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); fProcessor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); fChange= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || isCompositeChange(fChange) || !(fProcessor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { fChange.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }
Source:
public void start(final Deployment dep) { final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class); if (unit instanceof WSEndpointDeploymentUnit) return; final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); for (final Endpoint endpoint : dep.getService().getEndpoints()) { ModelNode op = null; try { op = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8"))); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } op.get(ENDPOINT_NAME).set(getName(endpoint)); op.get(ENDPOINT_CONTEXT).set(getContext(endpoint)); op.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName()); op.get(ENDPOINT_TYPE).set(endpoint.getType().toString()); op.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl"); } }

Target:
public void start(final Deployment dep) { final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class); if (unit instanceof WSEndpointDeploymentUnit) return; final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); for (final Endpoint endpoint : dep.getService().getEndpoints()) { final ModelNode endpointModel; try { endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8"))); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } endpointModel.get(ENDPOINT_NAME).set(getName(endpoint)); endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint)); endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName()); endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString()); endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl"); } }
Source:
public static void updateVmGuestAgentVersion(final VM vm) { if (vm.getAppList() != null) { final String[] parts = vm.getAppList().split("[,]", -1); if (parts.length != 0) { final List<String> possibleAgentAppNames = Config.<List<String>> getValue(ConfigValues.AgentAppName); final Map<String, String> spiceDriversInGuest = Config.<Map<String, String>> getValue(ConfigValues.SpiceDriverNameInGuest); final String spiceDriverInGuest = spiceDriversInGuest.get(osRepository.getOsFamily(vm.getOs()).toLowerCase()); for (final String part : parts) { for (String agentName : possibleAgentAppNames) { if (StringUtils.containsIgnoreCase(part, agentName)) { vm.setGuestAgentVersion(getApplicationVersion(part, agentName)); } if (StringUtils.containsIgnoreCase(part, spiceDriverInGuest)) { vm.setSpiceDriverVersion(getApplicationVersion(part, spiceDriverInGuest)); } } } } } }

Target:
public static void updateVmGuestAgentVersion(final VM vm) { if (vm.getAppList() != null) { final String[] parts = vm.getAppList().split("[,]", -1); if (parts != null && parts.length != 0) { final List<String> possibleAgentAppNames = Config.<List<String>> getValue(ConfigValues.AgentAppName); final Map<String, String> spiceDriversInGuest = Config.<Map<String, String>> getValue(ConfigValues.SpiceDriverNameInGuest); final String spiceDriverInGuest = spiceDriversInGuest.get(osRepository.getOsFamily(vm.getOs()).toLowerCase()); for (final String part : parts) { for (String agentName : possibleAgentAppNames) { if (StringUtils.containsIgnoreCase(part, agentName)) { vm.setGuestAgentVersion(getApplicationVersion(part, agentName)); } if (StringUtils.containsIgnoreCase(part, spiceDriverInGuest)) { vm.setSpiceDriverVersion(getApplicationVersion(part, spiceDriverInGuest)); } } } } } }
Source:
public static void install() { final NetRCCredentialsProvider c = new NetRCCredentialsProvider(); CredentialsProvider.setDefault(c); }

Target:
public static void install() { CredentialsProvider.setDefault(new NetRCCredentialsProvider()); }
Source:
public String getModelPluginId(EPackage ePackage, ResourceSet set) { if (getProvidedMetamodels().contains(ePackage.getNsURI())) { GenPackage genPackage = getGenmodelRegistry().findGenPackage(ePackage.getNsURI(), set); getModelPluginId(genPackage); } return null; }

Target:
public String getModelPluginId(EPackage ePackage, ResourceSet set) { if (getProvidedMetamodels().contains(ePackage.getNsURI())) { GenPackage genPackage = getGenmodelRegistry().findGenPackage(ePackage.getNsURI(), set); return getModelPluginId(genPackage); } return null; }
Source:
private void addAllToCommentList(JsArray<CommentInfo> in, boolean toDrafts) { if (toDrafts && drafts == null) { drafts = in; } else if (published == null) { published = in; } else { JsArray<CommentInfo> dest = toDrafts ? drafts : published; for (int i = 0; i < in.length(); i++) { dest.push(in.get(i)); } } }

Target:
private void addAllToCommentList(JsArray<CommentInfo> in, boolean toDrafts) { if (toDrafts && drafts == null) { drafts = in; } else if (!toDrafts && published == null) { published = in; } else { JsArray<CommentInfo> dest = toDrafts ? drafts : published; for (int i = 0; i < in.length(); i++) { dest.push(in.get(i)); } } }
Source:
private void assertRuntimeConfiguredAccordingToRuntime() { jbossWsRuntimeDialog.finish(); new WaitWhile(new ShellIsActive( NEW_JBOSS_WS_RUNTIME_DIALOG_TITLE)); assertThat(jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().size(), Is.is(1)); JBossWSRuntimeItem item = jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().iterator().next(); assertRuntimeName(item, runtimeName); assertRuntimeVersion(item, runtimeVersion); assertRuntimePath(item, runtimePath); }

Target:
private void assertRuntimeConfiguredAccordingToRuntime() { jbossWsRuntimeDialog.finish(); new WaitWhile(new ShellIsAvailable( NEW_JBOSS_WS_RUNTIME_DIALOG_TITLE)); assertThat(jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().size(), Is.is(1)); JBossWSRuntimeItem item = jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().iterator().next(); assertRuntimeName(item, runtimeName); assertRuntimeVersion(item, runtimeVersion); assertRuntimePath(item, runtimePath); }
Source:
public void createsMkCommit() throws Exception { final JsonObject author = Json.createObjectBuilder() .add("name", "Scott").add("email", "Scott@gmail.com") .add("date", "2008-07-09T16:13:30+12:00").build(); final JsonArray tree = Json.createArrayBuilder().add("xyzsha12").build(); MatcherAssert.assertThat( this.repo().git().commits().create( Json.createObjectBuilder().add("message", "my commit message") .add("tree", "abcsha12") .add("parents", tree) .add("author", author).build() ), Matchers.notNullValue() ); }

Target:
public final void createsMkCommit() throws Exception { final JsonObject author = Json.createObjectBuilder() .add("name", "Scott").add("email", "Scott@gmail.com") .add("date", "2008-07-09T16:13:30+12:00").build(); final JsonArray tree = Json.createArrayBuilder() .add("xyzsha12").build(); final Commit newCommit = this.repo().git().commits().create( Json.createObjectBuilder().add("message", "my commit message") .add("sha", "12ahscba") .add("tree", "abcsha12") .add("parents", tree) .add("author", author).build() ); MatcherAssert.assertThat( newCommit, Matchers.notNullValue() ); MatcherAssert.assertThat( newCommit.sha(), Matchers.equalTo("12ahscba") ); }
Source:
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) { return; } if (methodNode.name.startsWith("lambda$")) { return; } if (KotlinGeneratedFilter.isKotlinClass(context)) { if (KotlinDefaultArgumentsFilter .isDefaultArgumentsMethodName(methodNode.name)) { return; } if (KotlinDefaultArgumentsFilter .isDefaultArgumentsConstructor(methodNode)) { return; } if (KotlinCoroutineFilter.isLastArgumentContinuation(methodNode)) { return; } } output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); }

Target:
public void filter(final MethodNode methodNode, final IFilterContext context, final IFilterOutput output) { if ((methodNode.access & Opcodes.ACC_SYNTHETIC) == 0) { return; } if (methodNode.name.startsWith("lambda$")) { return; } if (KotlinGeneratedFilter.isKotlinClass(context)) { if (KotlinDefaultArgumentsFilter .isDefaultArgumentsMethod(methodNode)) { return; } if (KotlinDefaultArgumentsFilter .isDefaultArgumentsConstructor(methodNode)) { return; } if (KotlinCoroutineFilter.isLastArgumentContinuation(methodNode)) { return; } } output.ignore(methodNode.instructions.getFirst(), methodNode.instructions.getLast()); }
Source:
private static boolean posixSystemIs64() throws IOException, InterruptedException { Process unameProc = new ProcessBuilder("uname", "-m").start(); BufferedReader unameStdout = new BufferedReader(new InputStreamReader(unameProc.getInputStream())); unameProc.waitFor(); boolean result = unameStdout.readLine().endsWith("64"); unameStdout.close(); return result; }

Target:
private static boolean posixSystemIs64() throws IOException, InterruptedException { Process unameProc = new ProcessBuilder("uname", "-m").start(); unameProc.waitFor(); try (BufferedReader unameStdout = new BufferedReader(new InputStreamReader(unameProc.getInputStream()))) { return unameStdout.readLine().endsWith("64"); } }
Source:
public TraceEventWrapper get(TraceEventType eventType, long endTime, String eventId) { final Pair<TraceEventWrapper, Long> p; if (TraceEventType.DURATION_END.equals(eventType)) { assert eventId == null; p = m_durationEvents.pollLast(); } else if (TraceEventType.ASYNC_END.equals(eventType)) { p = m_asyncEvents.remove(eventId); } else { p = null; } if (p != null) { double diff = (double)(endTime - p.getValue()) / 1000 - m_filterTime; if (diff >= 0) { return p.getKey(); } } return null; }

Target:
public TraceEventWrapper get(TraceEventType eventType, long endTime, String eventId) { final Pair<TraceEventWrapper, Long> p; if (TraceEventType.DURATION_END.equals(eventType)) { assert eventId == null; p = m_durationEvents.pollLast(); } else if (TraceEventType.ASYNC_END.equals(eventType)) { p = m_asyncEvents.remove(eventId); } else { p = null; } if (p != null) { double diff = (double)(endTime - p.getSecond()) / 1000 - m_filterTime; if (diff >= 0) { return p.getFirst(); } } return null; }
Source:
public static Double toNumeric(Object o) { Double val = null; o = unpack(o); if (o instanceof Boolean) { val = new Double(((Boolean)o).booleanValue() ? 1 : 0); } else if (o instanceof Double) { val = (Double)o; } else if (o instanceof String) { String s = ((String)o).trim(); double d; try { checkForInvalidNumericCharacters(s); try { val = attemptDateConversion(s); } catch (XPathTypeMismatchException e) { d = Double.parseDouble(s); val = new Double(d); } } catch (NumberFormatException nfe) { val = new Double(Double.NaN); } } else if (o instanceof Date) { val = new Double(DateUtils.daysSinceEpoch((Date)o)); } else if (o instanceof IExprDataType) { val = ((IExprDataType)o).toNumeric(); } if (val != null) { return val; } else { throw new XPathTypeMismatchException("converting '" + (o == null ? "null" : o.toString()) + "' to numeric"); } }

Target:
public static Double toNumeric(Object o) { Double val = null; o = unpack(o); if (o instanceof Boolean) { val = new Double(((Boolean)o).booleanValue() ? 1 : 0); } else if (o instanceof Double) { val = (Double)o; } else if (o instanceof String) { String s = ((String)o).trim(); if (checkForInvalidNumericOrDatestringCharacters(s)) { return new Double(Double.NaN); } try { val = new Double(Double.parseDouble(s)); } catch (NumberFormatException nfe) { try { val = attemptDateConversion(s); } catch (XPathTypeMismatchException e) { val = new Double(Double.NaN); } } } else if (o instanceof Date) { val = new Double(DateUtils.daysSinceEpoch((Date)o)); } else if (o instanceof IExprDataType) { val = ((IExprDataType)o).toNumeric(); } if (val != null) { return val; } else { throw new XPathTypeMismatchException("converting '" + (o == null ? "null" : o.toString()) + "' to numeric"); } }
Source:
public void updateModel(final OperationContext context, ModelNode model, ListAttributeDefinition attributeDefinition, ModelNode listAttribute) throws OperationFailedException { int index = INDEX.resolveModelAttribute(context, model).asInt(); context.getResult().set(listAttribute.get(index)); }

Target:
void updateModel(final OperationContext context, ModelNode model, ListAttributeDefinition attributeDefinition, ModelNode listAttribute) throws OperationFailedException { int index = INDEX.resolveModelAttribute(context, model).asInt(); context.getResult().set(listAttribute.get(index)); }
Source:
public ChangePreview getChangePreview(RefactoringChange change) throws RefactoringException, CoreException { return manager.getChangePreview(change); }

Target:
public ChangePreview getChangePreview(RefactoringChange change) throws RefactoringException { return manager.getChangePreview(change); }
Source:
public ByteBufList computeDigestAndPackageForSending(long entryId, long lastAddConfirmed, long length, ByteBuf data) { ByteBuf sendBuffer = byteBufAllocator.buffer(METADATA_LENGTH + macCodeLength + data.readableBytes()); sendBuffer.writeLong(ledgerId); sendBuffer.writeLong(entryId); sendBuffer.writeLong(lastAddConfirmed); sendBuffer.writeLong(length); update(sendBuffer); update(data); populateValueAndReset(sendBuffer); if (data.hasArray()) { sendBuffer.writeBytes(data.array(), data.arrayOffset(), data.readableBytes()); } else { byte[] sendArray = new byte[sendBuffer.readableBytes()]; sendBuffer.getBytes(sendBuffer.readerIndex(), sendArray); sendBuffer.writeBytes(sendArray); } return ByteBufList.get(sendBuffer); }

Target:
public ByteBufList computeDigestAndPackageForSending(long entryId, long lastAddConfirmed, long length, ByteBuf data) { if (this.useV2Protocol) { ByteBuf headersBuffer = PooledByteBufAllocator.DEFAULT.buffer(METADATA_LENGTH + macCodeLength); headersBuffer.writeLong(ledgerId); headersBuffer.writeLong(entryId); headersBuffer.writeLong(lastAddConfirmed); headersBuffer.writeLong(length); update(headersBuffer); update(data); populateValueAndReset(headersBuffer); return ByteBufList.get(headersBuffer, data); } else { ByteBuf sendBuffer = Unpooled.buffer(METADATA_LENGTH + macCodeLength + data.readableBytes()); sendBuffer.writeLong(ledgerId); sendBuffer.writeLong(entryId); sendBuffer.writeLong(lastAddConfirmed); sendBuffer.writeLong(length); update(sendBuffer); update(data); populateValueAndReset(sendBuffer); sendBuffer.writeBytes(data, data.readerIndex(), data.readableBytes()); return ByteBufList.get(sendBuffer); } }
Source:
public void sputnikTest(){ int x= 2+1; return; }

Target:
public void sputnikTest() { return; }