auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void updateLoads() { if (m_cpuContextsCache == null || m_coreContextsCache == null) { return; } if (!m_loadMetersEnabled) { return; } VisualizerModel myModel = fDataModel; DsfExecutor exe = DsfSession.getSession(m_sessionState.getSessionID()).getExecutor(); CountingRequestMonitor crm = new CountingRequestMonitor(exe, null) { @Override protected void handleCompleted() { super.handleCompleted(); if (m_canvas != null) { m_canvas.refreshLoadMeters(); m_canvas.requestUpdate(); } if (m_updateLoadMeterTimer != null) { m_updateLoadMeterTimer.start(); } } }; int count = 0; for (ICPUDMContext cpuCtx : m_cpuContextsCache) { DSFDebugModel.getLoad(m_sessionState, cpuCtx, this, myModel, crm); count++; } for (ICoreDMContext coreCtx : m_coreContextsCache) { DSFDebugModel.getLoad(m_sessionState, coreCtx, this, myModel, crm); count ++; } crm.setDoneCount(count); }

Target:
public void updateLoads() { if (m_cpuContextsCache == null || m_coreContextsCache == null) { return; } if (!m_loadMetersEnabled) { return; } DsfExecutor exe = DsfSession.getSession(m_sessionState.getSessionID()).getExecutor(); CountingRequestMonitor crm = new CountingRequestMonitor(exe, null) { @Override protected void handleCompleted() { super.handleCompleted(); if (m_canvas != null) { m_canvas.refreshLoadMeters(); m_canvas.requestUpdate(); } if (m_updateLoadMeterTimer != null) { m_updateLoadMeterTimer.start(); } } }; int count = 0; for (ICPUDMContext cpuCtx : m_cpuContextsCache) { DSFDebugModel.getLoad(m_sessionState, cpuCtx, this, fDataModel, crm); count++; } for (ICoreDMContext coreCtx : m_coreContextsCache) { DSFDebugModel.getLoad(m_sessionState, coreCtx, this, fDataModel, crm); count ++; } crm.setDoneCount(count); }
Source:
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { SchedulerContext schedulerContext = null; try { schedulerContext = jobExecutionContext.getScheduler().getContext(); } catch (SchedulerException e1) { log.debug("Exception occurred while getting scheduler context"); } if (schedulerContext == null) { log.error("Scheduler context is null"); return; } PollingServerConnector connector = (PollingServerConnector) schedulerContext.get("connector"); log.debug("Executing the polling task for server connector ID: " + connector.getId()); try { connector.poll(); } catch (Exception e) { log.error("Error executing the polling cycle for " + "server connector ID: " + connector.getId(), e); } log.debug("Exit the polling task running loop for server connector ID: " + connector.getId()); }

Target:
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { SchedulerContext schedulerContext = null; try { schedulerContext = jobExecutionContext.getScheduler().getContext(); } catch (SchedulerException e1) { log.debug("Exception occurred while getting scheduler context", e1); } if (schedulerContext == null) { log.error("Scheduler context is null"); return; } PollingServerConnector connector = (PollingServerConnector) schedulerContext.get("connector"); log.debug("Executing the polling task for server connector ID: " + connector.getId()); try { connector.poll(); } catch (Exception e) { log.error("Error executing the polling cycle for server connector ID: " + connector.getId(), e); } log.debug("Exit the polling task running loop for server connector ID: " + connector.getId()); }
Source:
public static void tearDown() throws InterruptedException, TimeoutException, IOException, CommandFailedException { client.apply(snapshotBackup.restore()); administration.reloadIfRequired(); }

Target:
public static void tearDown() throws InterruptedException, TimeoutException, IOException, CommandFailedException { client.apply(snapshotBackup.restore()); administration.reloadIfRequired(); client.close(); }
Source:
public String view() { try { String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); if (null == config) { logger.warn("Null configuration"); this.setErrorCode(ERROR_NULL_CONFIG); return SUCCESS; } this.setMilestones(this.getCaseManager().getMilestonesList(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }

Target:
public String view() { try { if (!isKieServerConfigurationValid()) { return SUCCESS; } String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); this.setMilestones(this.getCaseManager().getMilestonesList(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }
Source:
public TransportHints() { this.options = Maps.newConcurrentMap(); }

Target:
public TransportHints() { this(false); }
Source:
public void setUp() throws Exception { homeDir = testDirectory.directory( "home-dir" ).toPath(); configDir = testDirectory.directory( "config-dir" ).toPath(); configFile = configDir.resolve( "neo4j.conf" ); Files.createFile( configFile ); System.setProperty( "user.dir", testDirectory.absolutePath().getAbsolutePath() ); }

Target:
public void setUp() throws Exception { homeDir = testDirectory.directory( "home-dir" ).toPath(); configDir = testDirectory.directory( "config-dir" ).toPath(); configFile = configDir.resolve( "neo4j.conf" ); Files.createFile( configFile ); originalUserDir = System.setProperty( "user.dir", testDirectory.absolutePath().getAbsolutePath() ); }
Source:
public void shouldNotAcceptNullMedianLocalDateTime(){ final Arbitrary<LocalDateTime> dates = Arbitrary.localDateTime(null, ChronoUnit.DAYS); }

Target:
public void shouldNotAcceptNullMedianLocalDateTime(){ Arbitrary.localDateTime(null, ChronoUnit.DAYS); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BuildCGroupResources that = (BuildCGroupResources) o; return Double.compare(that.cpus, cpus) == 0 && Double.compare(that.memoryMb, memoryMb) == 0; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } BuildCGroupResources that = (BuildCGroupResources) o; return Objects.equals(that.cpus, cpus) && Objects.equals(that.memoryMb, memoryMb); }
Source:
private SymbolicValue createIdentifierSymbolicValue(IdentifierTree identifier) { if (BOOLEAN_CLASS_VALUES.contains(identifier.name()) && identifier.symbolType() != null && identifier.symbolType().is(BOOLEAN_CLASS)) { return new SymbolicValue.BooleanObjectSymbolicValue(counter, identifier.name()); } return createDefaultSymbolicValue(identifier); }

Target:
private SymbolicValue createIdentifierSymbolicValue(IdentifierTree identifier) { final Type type = identifier.symbol().type(); if (type != null && type.is("java.lang.Boolean")) { return "TRUE".equals(identifier.name()) ? SymbolicValue.TRUE_LITERAL : SymbolicValue.FALSE_LITERAL; } return createDefaultSymbolicValue(identifier); }
Source:
private void initializeCommandLineSuitesParams() { if(null == m_cmdlineSuites) { return; } for (XmlSuite s : m_cmdlineSuites) { if(m_useThreadCount) { s.setThreadCount(m_threadCount); } s.setParallel(m_parallelMode); if(m_configFailurePolicy != null) { s.setConfigFailurePolicy(m_configFailurePolicy.toString()); } } }

Target:
private void initializeCommandLineSuitesParams() { if(null == m_cmdlineSuites) { return; } for (XmlSuite s : m_cmdlineSuites) { if (m_threadCount != -1) { s.setThreadCount(m_threadCount); } if (m_parallelMode != null) { s.setParallel(m_parallelMode); } if(m_configFailurePolicy != null) { s.setConfigFailurePolicy(m_configFailurePolicy.toString()); } } }
Source:
protected void runInContext() { List<DataCenterVO> dcList = serviceImpl.dataCenterDao.listEnabledZones(); for (DataCenterVO vo: dcList) { List<DataStore> storeList = serviceImpl.storeMgr.getImageStoresByScope(new ZoneScope(vo.getId())); for (DataStore store : storeList) { String mountPoint = null; try { mountPoint = serviceImpl.mountManager.getMountPoint(store.getUri(), null); if (StringUtils.isNotBlank(mountPoint)) { File directory = new File(mountPoint + "/" + DIAGNOSTICS_DIRECTORY); if (directory.isDirectory()) { deleteOldDiagnosticsFiles(directory, store.getName()); } } } finally { umountSecondaryStorage(mountPoint); } } } }

Target:
protected void runInContext() { List<DataCenterVO> dcList = serviceImpl.dataCenterDao.listEnabledZones(); for (DataCenterVO vo: dcList) { List<DataStore> storeList = serviceImpl.storeMgr.getImageStoresByScope(new ZoneScope(vo.getId())); for (DataStore store : storeList) { cleanupOldDiagnosticFiles(store); } } }
Source:
protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { setClampHeight(1.0f); if (!Elevator.atBottom.get()) { Elevator.setBottom.event(); waitUntil(Elevator.atBottom); } float currentClampHeight = Clamp.height.get(); boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.closed.set(true); Rollers.direction.set(Rollers.FORWARD); Rollers.running.set(true); waitUntil(BooleanMixing.invert(AutoLoader.crateInPosition)); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); setClampHeight(currentClampHeight); } } finally { running.set(false); } }

Target:
protected void autonomousMain() throws AutonomousModeOverException, InterruptedException { try { float currentClampHeight = Clamp.heightReadout.get(); Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(clampHeight.get()); if (!Elevator.atBottom.get()) { Elevator.setBottom.event(); waitUntil(BooleanMixing.andBooleans(Clamp.atDesiredHeight, Elevator.atBottom)); } else { waitUntil(Elevator.atBottom); } boolean running = Rollers.running.get(); boolean direction = Rollers.direction.get(); boolean closed = Rollers.closed.get(); try { Rollers.closed.set(true); Rollers.direction.set(Rollers.FORWARD); Rollers.running.set(true); waitUntil(BooleanMixing.invert(AutoLoader.crateInPosition)); waitForTime(timeout); } finally { Rollers.running.set(running); Rollers.direction.set(direction); Rollers.closed.set(closed); Clamp.mode.set(Clamp.MODE_HEIGHT); Clamp.height.set(currentClampHeight); waitUntil(Clamp.atDesiredHeight); } } finally { running.set(false); } }
Source:
private String doCreatePDFFile( final String spec, final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException, ServletException, InterruptedException, NoSuchAppException, NoSuchReferenceException { LOGGER.info("\nOLD-API:\n{}", spec); PJsonObject specJson = MapPrinterServlet.parseJson(spec, httpServletResponse); String appId; if (specJson.has("app")) { appId = specJson.getString("app"); } else { appId = DEFAULT_CONFIGURATION_FILE_KEY; } MapPrinter mapPrinter = this.printerFactory.create(appId); PJsonObject updatedSpecJson = null; try { updatedSpecJson = OldAPIRequestConverter.convert(specJson, mapPrinter.getConfiguration()); String format = updatedSpecJson.optString(MapPrinterServlet.JSON_OUTPUT_FORMAT, "pdf"); final String jobReferenceId = this.primaryApiServlet.createAndSubmitPrintJob(appId, format, updatedSpecJson.getInternalObj().toString(), httpServletRequest, httpServletResponse); boolean isDone = false; while (!isDone) { Thread.sleep(HALF_SECOND); isDone = this.jobManager.getStatus(jobReferenceId).isDone(); } return jobReferenceId; } catch (JSONException e) { throw ExceptionUtils.getRuntimeException(e); } }

Target:
private String doCreatePDFFile( final String spec, final HttpServletRequest httpServletRequest, final HttpServletResponse httpServletResponse) throws IOException, ServletException, InterruptedException, NoSuchAppException, NoSuchReferenceException { LOGGER.debug("\nOLD-API:\n{}", spec); PJsonObject specJson = MapPrinterServlet.parseJson(spec, httpServletResponse); String appId; if (specJson.has("app")) { appId = specJson.getString("app"); } else { appId = DEFAULT_CONFIGURATION_FILE_KEY; } MapPrinter mapPrinter = this.printerFactory.create(appId); PJsonObject updatedSpecJson = null; try { updatedSpecJson = OldAPIRequestConverter.convert(specJson, mapPrinter.getConfiguration()); String format = updatedSpecJson.optString(MapPrinterServlet.JSON_OUTPUT_FORMAT, "pdf"); final String jobReferenceId = this.primaryApiServlet.createAndSubmitPrintJob(appId, format, updatedSpecJson.getInternalObj().toString(), httpServletRequest, httpServletResponse); boolean isDone = false; while (!isDone) { Thread.sleep(HALF_SECOND); isDone = this.jobManager.getStatus(jobReferenceId).isDone(); } return jobReferenceId; } catch (JSONException e) { throw ExceptionUtils.getRuntimeException(e); } }
Source:
public MetadataResource(SessionFactory sessionFactory, DockstoreWebserviceConfiguration config) { this.toolDAO = new ToolDAO(sessionFactory); this.workflowDAO = new WorkflowDAO(sessionFactory); this.organizationDAO = new OrganizationDAO(sessionFactory); this.collectionDAO = new CollectionDAO(sessionFactory); this.config = config; this.bioWorkflowDAO = new BioWorkflowDAO(sessionFactory); this.serviceDAO = new ServiceDAO(sessionFactory); Optional<StateListenerInterface> first = PublicStateManager.getInstance().getListeners().stream() .filter(l -> l instanceof SitemapListener).findFirst(); sitemapListener = (SitemapListener)first.orElse(null); }

Target:
public MetadataResource(SessionFactory sessionFactory, DockstoreWebserviceConfiguration config) { this.toolDAO = new ToolDAO(sessionFactory); this.workflowDAO = new WorkflowDAO(sessionFactory); this.organizationDAO = new OrganizationDAO(sessionFactory); this.collectionDAO = new CollectionDAO(sessionFactory); this.config = config; this.bioWorkflowDAO = new BioWorkflowDAO(sessionFactory); this.serviceDAO = new ServiceDAO(sessionFactory); this.sitemapListener = PublicStateManager.getInstance().getSitemapListener(); }
Source:
public void testListAddresses() throws Exception { final AddressResponseList addresses = client.getAddresses().get(); assertEquals(200, addresses.getStatusCode()); assertNotNull(addresses.getHeaders()); final AddressResponse response = addresses.get(0); assertTrue(response instanceof AddressResponse); assertThat(addresses.getObject(), is("list")); assertFalse(addresses.isEmpty()); assertFalse(addresses.getData().isEmpty()); assertTrue(addresses.getCount() > 0); assertNotNull(addresses.toString()); assertNotNull(response.toString()); }

Target:
public void testListAddresses() throws Exception { final AddressResponseList addresses = client.getAddresses().get(); assertEquals(200, addresses.getStatusCode()); assertNotNull(addresses.getHeaders()); assertEquals("application/json; charset=utf-8", addresses.getHeaders().getFirstValue("content-type")); final AddressResponse response = addresses.get(0); assertTrue(response instanceof AddressResponse); assertThat(addresses.getObject(), is("list")); assertFalse(addresses.isEmpty()); assertFalse(addresses.getData().isEmpty()); assertTrue(addresses.getCount() > 0); assertNotNull(addresses.toString()); assertNotNull(response.toString()); }
Source:
private static boolean anyMatch(Tree tree) { if (!arguments(tree).findAny().isPresent()) { return false; } if (tree.is(Tree.Kind.NEW_CLASS)) { return SQL_INJECTION_SUSPECTS.anyMatch((NewClassTree) tree); } if (tree.is(Tree.Kind.METHOD_INVOCATION)) { return SQL_INJECTION_SUSPECTS.anyMatch((MethodInvocationTree) tree); } return false; }

Target:
private static boolean anyMatch(Tree tree) { if (!hasArguments(tree)) { return false; } if (tree.is(Tree.Kind.NEW_CLASS)) { return SQL_INJECTION_SUSPECTS.anyMatch((NewClassTree) tree); } if (tree.is(Tree.Kind.METHOD_INVOCATION)) { return SQL_INJECTION_SUSPECTS.anyMatch((MethodInvocationTree) tree); } return false; }
Source:
public boolean equals(Object obj) { return toString().equals(obj.toString()); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } RemoteReplicaInfo info = (RemoteReplicaInfo) obj; if (Objects.equals(port, info.getPort()) && info.getReplicaId().getReplicaPath().equals(replicaId.getMountPath()) && info.getLocalReplicaId().getReplicaPath().equals(localReplicaId.getMountPath())) { return true; } return false; }
Source:
protected boolean doValidate() { String currentValue = getCurrentValue(); currentValue = currentValue.trim(); boolean hasContent = !StringUtil.isNullOrEmpty(currentValue); if (hasContent) { return stringValidation.validate(currentValue); } return !isRequired(); }

Target:
protected boolean doValidate() { String currentValue = getCurrentValue(); if (currentValue != null) { currentValue = currentValue.trim(); if (!currentValue.isEmpty()) { return checkLocalValidation(currentValue); } } return checkIsValid(); }
Source:
public void setUp() throws Exception { assumeFalse("Skipping test: TV does not support provider android.settings.slices", isTv()); assumeFalse("Skipping test: Automotive does not support provider android.settings.slices", isCar()); mWifiSlice = mSliceManager.bindSlice(WIFI_SLICE_URI, Collections.emptySet()); }

Target:
public void setUp() throws Exception { assumeFalse("Skipping test: TV does not support provider android.settings.slices", isTv()); assumeFalse("Skipping test: Auto does not support provider android.settings.slices", isCar()); mWifiSlice = mSliceManager.bindSlice(WIFI_SLICE_URI, Collections.emptySet()); }
Source:
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (isBinary(i)) { int col = i - 1; int oid = fields[col].getOID(); TimeZone tz = cal == null ? null : cal.getTimeZone(); if (oid == Oid.DATE) { return connection.getTimestampUtils().toDateBin(tz, this_row[col]); } else if (oid == Oid.TIMESTAMP || oid == Oid.TIMESTAMPTZ) { return connection.getTimestampUtils().convertToDate(getTimestamp(i, Calendar.getInstance(TimeZone.getTimeZone("UTC"))), tz); } else { throw new PSQLException (GT.tr("Cannot convert the column of type {0} to requested type {1}.", new Object[]{Oid.toString(oid), "date"}), PSQLState.DATA_TYPE_MISMATCH); } } if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toDate(cal, getString(i)); }

Target:
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (isBinary(i)) { int col = i - 1; int oid = fields[col].getOID(); TimeZone tz = cal == null ? null : cal.getTimeZone(); if (oid == Oid.DATE) { return connection.getTimestampUtils().toDateBin(tz, this_row[col]); } else if (oid == Oid.TIMESTAMP || oid == Oid.TIMESTAMPTZ) { return connection.getTimestampUtils().convertToDate(getTimestamp(i, UTC), tz); } else { throw new PSQLException (GT.tr("Cannot convert the column of type {0} to requested type {1}.", new Object[]{Oid.toString(oid), "date"}), PSQLState.DATA_TYPE_MISMATCH); } } if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toDate(cal, getString(i)); }
Source:
protected void sharedPeriodic() { xScheduler.run(); this.updatePeriodicDataSources(); brownoutLatch.setValue(DriverStation.getInstance().isBrownedOut()); loopCycleCounter++; double timeSinceLastLog = Timer.getFPGATimestamp() - lastFreqCounterResetTime; if(lastFreqCounterResetTime <= 0) { lastFreqCounterResetTime = Timer.getFPGATimestamp(); log.info("Total Current:" + pdp.getTotalCurrent()); } else if(timeSinceLastLog >= frequencyReportInterval.get()) { double loopsPerSecond = loopCycleCounter / timeSinceLastLog; double loopDuration = pdp.getTotalCurrent() / loopCycleCounter; loopCycleCounter = 0; lastFreqCounterResetTime = Timer.getFPGATimestamp(); log.info("Robot loops per second: " + loopsPerSecond); log.info("Loop Duration:" + loopDuration); } }

Target:
protected void sharedPeriodic() { double loopBegin = Timer.getFPGATimestamp(); xScheduler.run(); this.updatePeriodicDataSources(); brownoutLatch.setValue(DriverStation.getInstance().isBrownedOut()); loopDuration += Timer.getFPGATimestamp() - loopBegin; loopCycleCounter++; double timeSinceLastLog = Timer.getFPGATimestamp() - lastFreqCounterResetTime; if(lastFreqCounterResetTime <= 0) { lastFreqCounterResetTime = Timer.getFPGATimestamp(); } else if(timeSinceLastLog >= frequencyReportInterval.get()) { double loopsPerSecond = loopCycleCounter / timeSinceLastLog; double averageLoopDuration = 0; if(loopCycleCounter != 0){ averageLoopDuration = loopDuration / loopCycleCounter; } else{ log.info("Cannot have loopCycleCounter as 0"); } loopDuration = 0; loopCycleCounter = 0; lastFreqCounterResetTime = Timer.getFPGATimestamp(); log.info("Robot loops per second: " + loopsPerSecond); log.info("Total Current: " + pdp.getTotalCurrent()); log.info("Average Loop Duration:" + averageLoopDuration); } }
Source:
public ConnectivityProvider providesConnectivityProvider() { return new ConnectivityProvider(); }

Target:
public NetworkStateProvider providesConnectivityProvider() { return new ConnectivityProvider(); }
Source:
public Object combine(@Nullable Object lhs, @Nullable Object rhs) { if (lhs instanceof DoubleMeanHolder && rhs instanceof DoubleMeanHolder) { return ((DoubleMeanHolder) lhs).update((DoubleMeanHolder) rhs); } else { throw new IAE( "lhs[%s] or rhs[%s] not of type [%s]", lhs.getClass().getName(), rhs.getClass().getName(), DoubleMeanHolder.class.getName() ); } }

Target:
public Object combine(@Nullable Object lhs, @Nullable Object rhs) { if (lhs instanceof DoubleMeanHolder && rhs instanceof DoubleMeanHolder) { return ((DoubleMeanHolder) lhs).update((DoubleMeanHolder) rhs); } else { throw new IAE( "lhs[%s] or rhs[%s] not of type [%s]", Utils.safeObjectClassGetName(lhs), Utils.safeObjectClassGetName(rhs), DoubleMeanHolder.class.getName() ); } }
Source:
protected void executeCommand() { int replicaCount = (getGlusterVolume().getVolumeType() == GlusterVolumeType.REPLICATE || getGlusterVolume().getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) ? getParameters().getReplicaCount() : 0; startSubStep(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), bricks, replicaCount, false)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED, returnValue.getVdsError() .getMessage()); return; } GlusterAsyncTask glusterTask = (GlusterAsyncTask) returnValue.getReturnValue(); handleTaskReturn(glusterTask); updateBricksWithTaskID(glusterTask); getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }

Target:
protected void executeCommand() { int replicaCount = getGlusterVolume().getVolumeType().isReplicatedType() ? getParameters().getReplicaCount() : 0; startSubStep(); VDSReturnValue returnValue = runVdsCommand( VDSCommandType.StartRemoveGlusterVolumeBricks, new GlusterVolumeRemoveBricksVDSParameters(upServer.getId(), getGlusterVolumeName(), bricks, replicaCount, false)); setSucceeded(returnValue.getSucceeded()); if (!getSucceeded()) { handleVdsError(AuditLogType.START_REMOVING_GLUSTER_VOLUME_BRICKS_FAILED, returnValue.getVdsError() .getMessage()); return; } GlusterAsyncTask glusterTask = (GlusterAsyncTask) returnValue.getReturnValue(); handleTaskReturn(glusterTask); updateBricksWithTaskID(glusterTask); getReturnValue().setActionReturnValue(returnValue.getReturnValue()); }
Source:
private static Optional<MethodDeclaration> addNumericPredictor(final NumericPredictor numericPredictor, final ClassOrInterfaceDeclaration tableTemplate, int predictorArity) { try { templateEvaluate = StaticJavaParser.parseResource(KIE_PMML_EVALUATE_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_EVALUATE_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); MethodDeclaration methodTemplate; if (Objects.equals(1, numericPredictor.getExponent())) { methodTemplate = getNumericPredictorWithoutExponentTemplate(numericPredictor, evaluateTemplateClass); } else { methodTemplate = getNumericPredictorWithExponentTemplate(numericPredictor, evaluateTemplateClass); } return addMethod(methodTemplate, tableTemplate, "evaluateNumericPredictor" + predictorArity); } catch (Exception e) { return Optional.empty(); } }

Target:
private static MethodDeclaration addNumericPredictor(final NumericPredictor numericPredictor, final ClassOrInterfaceDeclaration tableTemplate, int predictorArity) { try { templateEvaluate = StaticJavaParser.parseResource(KIE_PMML_EVALUATE_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_EVALUATE_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); MethodDeclaration methodTemplate; if (Objects.equals(1, numericPredictor.getExponent())) { methodTemplate = getNumericPredictorWithoutExponentTemplate(numericPredictor, evaluateTemplateClass); } else { methodTemplate = getNumericPredictorWithExponentTemplate(numericPredictor, evaluateTemplateClass); } return addMethod(methodTemplate, tableTemplate, "evaluateNumericPredictor" + predictorArity); } catch (Exception e) { throw new KiePMMLInternalException(String.format("Failed to add NumericPredictor %s", numericPredictor.getName()), e); } }
Source:
public void testDataProviderswithDP(@NoInjection final Method method, final Class clazz) throws IllegalAccessException, InstantiationException, InvocationTargetException { System.err.println("Method: " + method + " Class: " + clazz.getName()); Object instance = clazz.newInstance(); for (final Method otherMethod : clazz.getMethods()) { if (otherMethod.isAnnotationPresent(BeforeSuite.class)) { otherMethod.invoke(instance); } } method.invoke(instance); }

Target:
public void testDataProviderswithDP(@NoInjection final Method method, final Class clazz) throws IllegalAccessException, InstantiationException { Object instance = clazz.newInstance(); Assert.assertTrue(HtsjdkTest.class.isAssignableFrom(clazz), "Test Classes must extend HtsJdkTest: " + clazz.getName()); Set<Method> methodSet = Sets.newHashSet(); methodSet.addAll(Arrays.asList(clazz.getDeclaredMethods())); methodSet.addAll(Arrays.asList(clazz.getMethods())); for (final Method otherMethod : methodSet) { if (otherMethod.isAnnotationPresent(BeforeSuite.class)) { try { otherMethod.setAccessible(true); otherMethod.invoke(instance); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(String.format("@BeforeClass threw an exception (%s::%s). Dependent tests will be skipped. Please fix.", clazz.getName(), method.getName()), e); } } if (otherMethod.isAnnotationPresent(BeforeClass.class)) { try { otherMethod.setAccessible(true); otherMethod.invoke(instance); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(String.format("@BeforeSuite threw an exception (%s::%s). Dependent tests will be skipped. Please fix.", clazz.getName(), method.getName()), e); } } } try { method.setAccessible(true); method.invoke(instance); } catch (IllegalAccessException | InvocationTargetException e) { throw new IllegalStateException(String.format("@DataProvider threw an exception (%s::%s). Dependent tests will be skipped. Please fix.", clazz.getName(), method.getName()), e); } }
Source:
public void vuapCheckTopAreasMercury(Page page, String slot) { AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl()); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, ads.findFirstIframeWithAd(slot), true ); ads.scrollToSlot(slot); vuap.clickOnArea(1); vuap.clickOnArea(2); List<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Assert.assertTrue( tabs.size() == 3, "There should be three tabs opened after two clicks." ); final String actual = ads.switchToNewBrowserTab(); Assert.assertTrue( actual.equals("<LINK_0>"), "Top part of creative should point to FANDOM page but it points to " + actual ); }

Target:
public void vuapCheckTopAreasMercury(Page page, String slot) { AdsBaseObject ads = new AdsBaseObject(driver, page.getUrl()); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, ads.findFirstIframeWithAd(slot), true ); ads.scrollToSlot(slot); vuap.clickOnArea(1); vuap.clickOnArea(2); List<String> tabs = new ArrayList<String>(driver.getWindowHandles()); Assert.assertEquals( tabs.size(), 3, "There should be three tabs opened after two clicks." ); final String actual = ads.switchToNewBrowserTab(); Assert.assertEquals( actual, AD_REDIRECT_URL, "Top part of creative should point to FANDOM page but it points to " + actual ); }
Source:
public static SequencerDto asDto(SequencerReference from) { SequencerDto dto = new SequencerDto(); dto.setId(from.getId()); dto.setDateCommissioned(getDateString(from.getDateCommissioned())); dto.setDateDecommissioned(getDateString(from.getDateDecommissioned())); dto.setName(from.getName()); dto.setPlatform(asDto(from.getPlatform())); dto.setSerialNumber(from.getSerialNumber()); return dto; }

Target:
public static SequencerDto asDto(SequencerReference from) { SequencerDto dto = new SequencerDto(); dto.setId(from.getId()); dto.setDateCommissioned(getDateString(from.getDateCommissioned())); dto.setDateDecommissioned(getDateString(from.getDateDecommissioned())); dto.setIp(from.getIpAddress()); dto.setName(from.getName()); dto.setPlatform(asDto(from.getPlatform())); dto.setSerialNumber(from.getSerialNumber()); return dto; }
Source:
@Override public void write(JsonWriter out, Date value) throws IOException { if (value == null) out.nullValue(); else { String formatted = ISO8601Utils.format(value); out.value(formatted.replace('T', ' ').substring(0, formatted.length() - 1)); } }

Target:
@Override public void write(JsonWriter out, Date value) throws IOException { if (value == null) { out.nullValue(); } else { String formatted = ISO8601Utils.format(value); out.value(formatted.replace('T', ' ').substring(0, formatted.length() - 1)); } }
Source:
private static void asyncRemoveFromBatchlog(Collection<InetAddressAndPort> endpoints, UUID uuid) { MessageOut<UUID> message = new MessageOut<>(MessagingService.Verb.BATCH_REMOVE, uuid, UUIDSerializer.serializer); for (InetAddressAndPort target : endpoints) { if (logger.isTraceEnabled()) logger.trace("Sending batchlog remove request to {}", uuid, target); if (canDoLocalRequest(target)) performLocally(Stage.MUTATION, Replica.fullStandin(target), () -> BatchlogManager.remove(uuid)); else MessagingService.instance().sendOneWay(message, target); } }

Target:
private static void asyncRemoveFromBatchlog(Collection<InetAddressAndPort> endpoints, UUID uuid) { MessageOut<UUID> message = new MessageOut<>(MessagingService.Verb.BATCH_REMOVE, uuid, UUIDSerializer.serializer); for (InetAddressAndPort target : endpoints) { if (logger.isTraceEnabled()) logger.trace("Sending batchlog remove request to {}", uuid, target); if (canDoLocalRequest(target)) performLocally(Stage.MUTATION, SystemReplicas.getSystemReplica(target), () -> BatchlogManager.remove(uuid)); else MessagingService.instance().sendOneWay(message, target); } }
Source:
public Object invoke(Object target, Object[] args, HandleSupplier handle) { try { return methodHandle.bindTo(target).invokeWithArguments(args); } catch (Throwable t) { throw Throwables.uncheck(t); } }

Target:
public Object invoke(Object target, Object[] args, HandleSupplier handle) { try { return methodHandle.bindTo(target).invokeWithArguments(args); } catch (Throwable t) { throw Throwables.sneakyThrow(t); } }
Source:
String getPathOfBatchDir(String prefix) { assert(m_batched); String hostId = ""; if(m_uniquenames) { hostId = "-("+VoltDB.instance().getHostMessenger().getHostId()+")"; } return m_outDir.getPath() + File.separator + prefix + m_nonce + "-" + m_dateformat.get().format(start) + hostId; }

Target:
String getPathOfBatchDir(String prefix) { assert(m_batched); return m_outDir.getPath() + File.separator + prefix + m_nonce + "-" + m_dateformat.get().format(start); }
Source:
public StandaloneDeployer addLibraries(List<File> libs) { for (File file : libs) { mule.addLibrary(file); log.debug(String.format("Adding library %s...", file)); } return this; }

Target:
public StandaloneDeployer addLibraries(List<File> libs) { checkNotNull(libs, "Libraries cannot be null"); for (File file : libs) { mule.addLibrary(file); log.debug(String.format("Adding library %s...", file)); } return this; }
Source:
public void subscribe(final String contactIdentifier) throws IllegalArgumentException, IllegalStateException, OperationFailedException { System.out.println("subscribe(\"" + contactIdentifier + "\") called"); }

Target:
public void subscribe(final String contactIdentifier) throws IllegalArgumentException, IllegalStateException, OperationFailedException { LOGGER.trace("subscribe(\"" + contactIdentifier + "\") called"); throw new OperationFailedException("Not implemented.", OperationFailedException.NOT_SUPPORTED_OPERATION); }
Source:
public LicensedVideoSwapHistoryPageObject(WebDriver driver) { super(driver); PageFactory.initElements(driver, this); }

Target:
public LicensedVideoSwapHistoryPageObject(WebDriver driver) { super(driver); }
Source:
static public void playSound(@ParamDoc(name = "filename", text = "the filename with extension") String filename) { try { AudioActionService.audioManager.playFile(filename); } catch (AudioException e) { logger.warn("Failed playing audio file: {}", e.getMessage()); } }

Target:
public static void playSound(@ParamDoc(name = "filename", text = "the filename with extension") String filename) { try { AudioActionService.audioManager.playFile(filename); } catch (AudioException e) { logger.warn("Failed playing audio file: {}", e.getMessage()); } }
Source:
public void referenceInsert_shouldNotEscapeWithSpecialTag(){ String html = "<b>a bold statement</b>"; assertThat(insertionEventHandler.referenceInsert("$_noescape_" + SOME_REFERENCE, html)).isEqualTo(html); }

Target:
public void referenceInsert_shouldNotEscapeWithSpecialTag(){ String html = "<b>a bold statement</b>"; Object result = insertionEventHandler.referenceInsert("$_noescape_" + SOME_REFERENCE, html); assertThat(result).isEqualTo(html); }
Source:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.service(request, response); StringBuilder sb = new StringBuilder(); sb.append(System.getenv("JUMBUNE_HOME")) .append(WebConstants.TMP_DIR_PATH) .append(WebConstants.JUMBUNE_STATE_FILE); File file = new File(sb.toString()); if (file.exists()) { file.delete(); } String jHome = System.getenv("JUMBUNE_HOME"); ObjectInputStream objectinputstream = null; InputStream streamIn = null; try { File jHomeYamlFile = new File(jHome+YAML_FILE); if(jHomeYamlFile.exists()){ streamIn = new FileInputStream(jHomeYamlFile); objectinputstream= new ObjectInputStream(streamIn); BasicYamlConfig config = (BasicYamlConfig) objectinputstream.readObject(); cleanUpJumbuneAgentCurrentJobFolder(config); } }catch(IOException e){ LOGGER.error(e.getMessage(), e); } catch (ClassNotFoundException e) { LOGGER.error(e.getMessage(), e); }finally{ try { if(objectinputstream != null){ objectinputstream .close(); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } try { if(streamIn!= null){ streamIn.close(); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } } HttpSession session = request.getSession(); session.removeAttribute("ExecutorServReference"); session.removeAttribute("ReportsBean"); session.removeAttribute("loader"); final RequestDispatcher rd = getServletContext().getRequestDispatcher( WebConstants.HOME_URL); rd.forward(request, response); }

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { super.service(request, response); StringBuilder sb = new StringBuilder(); sb.append(System.getenv("JUMBUNE_HOME")) .append(WebConstants.TMP_DIR_PATH) .append(WebConstants.JUMBUNE_STATE_FILE); File file = new File(sb.toString()); if (file.exists()) { file.delete(); } String jHome = System.getenv("JUMBUNE_HOME"); ObjectInputStream objectinputstream = null; InputStream streamIn = null; try { String yamlFile = jHome+YAML_FILE; File jHomeYamlFile = new File(yamlFile); if(jHomeYamlFile.exists()){ streamIn = new FileInputStream(jHomeYamlFile); objectinputstream= new ObjectInputStream(streamIn); BasicYamlConfig config = (BasicYamlConfig) objectinputstream.readObject(); cleanUpJumbuneAgentCurrentJobFolder(config); } }catch(IOException e){ LOGGER.error(e.getMessage(), e); } catch (ClassNotFoundException e) { LOGGER.error(e.getMessage(), e); }finally{ try { if(objectinputstream != null){ objectinputstream .close(); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } try { if(streamIn!= null){ streamIn.close(); } } catch (IOException e) { LOGGER.error(e.getMessage(), e); } } HttpSession session = request.getSession(); session.removeAttribute("ExecutorServReference"); session.removeAttribute("ReportsBean"); session.removeAttribute("loader"); final RequestDispatcher rd = getServletContext().getRequestDispatcher( WebConstants.HOME_URL); rd.forward(request, response); }
Source:
protected void doShutdown() throws IOException { if (this.disruptor != null) { long timeoutms = conf.getLong("hbase.wal.disruptor.shutdown.timeout.ms", 60000); try { this.disruptor.shutdown(timeoutms, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { LOG.warn("Timed out bringing down disruptor after " + timeoutms + "ms; forcing halt " + "(It is a problem if this is NOT an ABORT! -- DATALOSS!!!!)"); this.disruptor.halt(); this.disruptor.shutdown(); } } if (LOG.isDebugEnabled()) { LOG.debug("Closing WAL writer in " + CommonFSUtils.getPath(walDir)); } if (this.writer != null) { this.writer.close(); this.writer = null; } closeExecutor.shutdown(); try { if (!closeExecutor.awaitTermination(waitOnShutdownInSeconds, TimeUnit.SECONDS)) { LOG.error("We have waited " + waitOnShutdownInSeconds + " seconds but" + " the close of writer(s) doesn't complete." + "Please check the status of underlying filesystem" + " or increase the wait time by the config \"" + FSHLOG_WAIT_ON_SHUTDOWN_IN_SECONDS + "\""); } } catch (InterruptedException e) { LOG.error("The wait for termination of FSHLog writer(s) is interrupted"); Thread.currentThread().interrupt(); } }

Target:
protected void doShutdown() throws IOException { if (this.disruptor != null) { long timeoutms = conf.getLong("hbase.wal.disruptor.shutdown.timeout.ms", 60000); try { this.disruptor.shutdown(timeoutms, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { LOG.warn("Timed out bringing down disruptor after " + timeoutms + "ms; forcing halt " + "(It is a problem if this is NOT an ABORT! -- DATALOSS!!!!)"); this.disruptor.halt(); this.disruptor.shutdown(); } } if (LOG.isDebugEnabled()) { LOG.debug("Closing WAL writer in " + CommonFSUtils.getPath(walDir)); } if (this.writer != null) { this.writer.close(); this.writer = null; } closeExecutor.shutdown(); try { if (!closeExecutor.awaitTermination(waitOnShutdownInSeconds, TimeUnit.SECONDS)) { LOG.error("We have waited seconds but the close of writer(s) doesn't complete." + "Please check the status of underlying filesystem" + " or increase the wait time by the config \"{}\"", this.waitOnShutdownInSeconds, FSHLOG_WAIT_ON_SHUTDOWN_IN_SECONDS); } } catch (InterruptedException e) { LOG.error("The wait for termination of FSHLog writer(s) is interrupted"); Thread.currentThread().interrupt(); } }
Source:
private long insertRevision(long docNumericId, String revId, long parentSequence, boolean deleted, boolean current, byte[] data, boolean available) { ContentValues args = new ContentValues(); args.put("doc_id", docNumericId); args.put("revid", revId); if (parentSequence > 0) { args.put("parent", parentSequence); } args.put("current", current); args.put("deleted", deleted); args.put("available", available); args.put("json", data); Log.d(LOG_TAG, "New revision inserted: " + docNumericId + ", " + revId); long newSequence = this.getSQLDatabase().insert("revs", args); if (newSequence < 0) { throw new IllegalStateException("Unknown error inserting new updated doc, please checking log"); } String attsSql = "INSERT INTO attachments "+ "(sequence, filename, key, type, length, revpos) "+ "SELECT "+newSequence+", filename, key, type, length, revpos "+ "FROM attachments WHERE sequence="+parentSequence; try { this.getSQLDatabase().execSQL(attsSql); } catch (SQLException e) { throw new IllegalStateException("Error copying attachments to new revision "+e); } return newSequence; }

Target:
private long insertRevision(long docNumericId, String revId, long parentSequence, boolean deleted, boolean current, byte[] data, boolean available) { this.getSQLDatabase().beginTransaction(); long newSequence; try { ContentValues args = new ContentValues(); args.put("doc_id", docNumericId); args.put("revid", revId); if (parentSequence > 0) { args.put("parent", parentSequence); } args.put("current", current); args.put("deleted", deleted); args.put("available", available); args.put("json", data); Log.d(LOG_TAG, "New revision inserted: " + docNumericId + ", " + revId); newSequence = this.getSQLDatabase().insert("revs", args); if (newSequence < 0) { throw new IllegalStateException("Unknown error inserting new updated doc, please checking log"); } String attsSql = "INSERT INTO attachments " + "(sequence, filename, key, type, length, revpos) " + "SELECT " + newSequence + ", filename, key, type, length, revpos " + "FROM attachments WHERE sequence=" + parentSequence; try { this.getSQLDatabase().execSQL(attsSql); } catch (SQLException e) { throw new IllegalStateException("Error copying attachments to new revision " + e); } this.getSQLDatabase().setTransactionSuccessful(); } finally { this.getSQLDatabase().endTransaction(); } return newSequence; }
Source:
public void testWriteBytes() throws Exception { int length = 65536; byte[] inputArray = new byte[length]; for (int i = 0; i < length; i++) { inputArray[i] = (byte) (i % 128); } int[] offsets = {0, 100, 545, 1024, 2049, 2050, 2051, 2151, 10480, 20042, 20100, 40001, 65536}; for (int bufferSize : new int[] {4096, 4345, 65535, 65536, 65537, 100000}) { ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(length); BufferedOutputStreamSliceOutput output = new BufferedOutputStreamSliceOutput(byteOutputStream, bufferSize); for (int i = 0; i < offsets.length - 1; i++) { output.writeBytes(inputArray, offsets[i], offsets[i + 1] - offsets[i]); } output.flush(); assertEquals(byteOutputStream.toByteArray(), inputArray); byteOutputStream.close(); byteOutputStream = new ByteArrayOutputStream(length); Slice inputSlice = Slices.wrappedBuffer(inputArray); output = new BufferedOutputStreamSliceOutput(byteOutputStream, bufferSize); for (int i = 0; i < offsets.length - 1; i++) { output.writeBytes(inputSlice, offsets[i], offsets[i + 1] - offsets[i]); } output.flush(); assertEquals(byteOutputStream.toByteArray(), inputArray); byteOutputStream.close(); } }

Target:
public void testWriteBytes() throws Exception { int length = 65536; byte[] inputArray = new byte[length]; for (int i = 0; i < length; i++) { inputArray[i] = (byte) (i % 128); } int[] offsets = {0, 100, 545, 1024, 2049, 2050, 2051, 2151, 10480, 20042, 20100, 40001, 65536}; MockOutputStream byteOutputStream = new MockOutputStream(length); BufferedOutputStreamSliceOutput output = new BufferedOutputStreamSliceOutput(byteOutputStream); for (int i = 0; i < offsets.length - 1; i++) { output.writeBytes(inputArray, offsets[i], offsets[i + 1] - offsets[i]); } output.flush(); assertEquals(byteOutputStream.toByteArray(), inputArray); byteOutputStream.close(); byteOutputStream = new MockOutputStream(length); Slice inputSlice = Slices.wrappedBuffer(inputArray); output = new BufferedOutputStreamSliceOutput(byteOutputStream); for (int i = 0; i < offsets.length - 1; i++) { output.writeBytes(inputSlice, offsets[i], offsets[i + 1] - offsets[i]); } output.flush(); assertEquals(byteOutputStream.toByteArray(), inputArray); byteOutputStream.close(); }
Source:
public Response getClusterTopologyMap(@PathParam("clusterId") String clusterId) { if (!doesClusterExist(clusterId)) { return notFound(String.format("Cluster %s does not exist", clusterId)); } HelixAdmin admin = getHelixAdmin(); Map<String, List<String>> topologyMap = admin.getClusterTopology(clusterId).getTopologyMap(); return JSONRepresentation(topologyMap); }

Target:
public Response getClusterTopologyMap(@PathParam("clusterId") String clusterId) { HelixAdmin admin = getHelixAdmin(); Map<String, List<String>> topologyMap; try { topologyMap = admin.getClusterTopology(clusterId).getTopologyMap(); } catch (HelixException ex) { return badRequest(ex.getMessage()); } return JSONRepresentation(topologyMap); }
Source:
private eu.dnetlib.iis.citationmatching.direct.schemas.ReferenceMetadata convertReference(eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata refMetadata) { if (refMetadata.getBasicMetadata().getExternalIds() == null) { return null; } if (refMetadata.getBasicMetadata().getExternalIds().isEmpty()) { return null; } return new eu.dnetlib.iis.citationmatching.direct.schemas.ReferenceMetadata( refMetadata.getPosition(), refMetadata.getBasicMetadata().getExternalIds()); }

Target:
private ReferenceMetadata convertReference(eu.dnetlib.iis.metadataextraction.schemas.ReferenceMetadata refMetadata) { if (MapUtils.isEmpty(refMetadata.getBasicMetadata().getExternalIds())) { return null; } return new eu.dnetlib.iis.citationmatching.direct.schemas.ReferenceMetadata( refMetadata.getPosition(), refMetadata.getBasicMetadata().getExternalIds()); }
Source:
protected final boolean isAuthorized() { if (!(goConfigService.isUserAdmin(currentUser) || goConfigService.isGroupAdministrator(currentUser.getUsername()))) { result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_EDIT"), HealthStateType.unauthorised()); return false; } return true; }

Target:
protected final boolean isAuthorized() { if (goConfigService.isUserAdmin(currentUser)) { return true; } result.unauthorized(LocalizedMessage.string("UNAUTHORIZED_TO_EDIT"), HealthStateType.unauthorised()); return false; }
Source:
public void getOnceAndStream_WithInitialValue_WithDelayedSubscription_ReturnsFirstValue_AndDoesNotComplete() throws InterruptedException { final GitHubRepository value1 = create(100, "repository1"); final GitHubRepository value2 = create(100, "repository1"); gitHubRepositoryStore.put(value1); Thread.sleep(PROVIDER_WAIT_TIME); Observable<GitHubRepository> stream = gitHubRepositoryStore.getOnceAndStream(100); gitHubRepositoryStore.put(value2); stream.subscribeWith(testObserver); testObserver.awaitDone(PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS) .assertNotComplete() .assertNoErrors() .assertValues(value1); }

Target:
public void getOnceAndStream_WithInitialValue_WithDelayedSubscription_ReturnsFirstValue_AndDoesNotComplete() throws InterruptedException { final GitHubRepository value1 = create(100, "repository1"); final GitHubRepository value2 = create(100, "repository1"); gitHubRepositoryStore.put(value1); Thread.sleep(PROVIDER_WAIT_TIME); Observable<GitHubRepository> stream = gitHubRepositoryStore.getOnceAndStream(100); gitHubRepositoryStore.put(value2); stream.test() .awaitDone(PROVIDER_WAIT_TIME, TimeUnit.MILLISECONDS) .assertNotComplete() .assertNoErrors() .assertValues(value1); }