auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
boolean checkSchemaAgreement() throws ConnectionException, BusyConnectionException, InterruptedException, ExecutionException { Connection connection = connectionRef.get(); if (connection == null || connection.isClosed()) return false; DefaultResultSetFuture peersFuture = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_PEERS)); DefaultResultSetFuture localFuture = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_SCHEMA_LOCAL)); connection.write(peersFuture); connection.write(localFuture); Set<UUID> versions = new HashSet<UUID>(); Row localRow = localFuture.get().one(); if (localRow != null && !localRow.isNull("schema_version")) versions.add(localRow.getUUID("schema_version")); for (Row row : peersFuture.get()) { if (!isValidPeer(row, false)) continue; InetSocketAddress addr = addressToUseForPeerHost(row, connection.address, cluster); if (addr == null || row.isNull("schema_version")) continue; Host peer = cluster.metadata.getHost(addr); if (peer != null && peer.isUp()) versions.add(row.getUUID("schema_version")); } logger.debug("Checking for schema agreement: versions are {}", versions); return versions.size() <= 1; }

Target:
boolean checkSchemaAgreement() throws ConnectionException, BusyConnectionException, InterruptedException, ExecutionException { Connection connection = connectionRef.get(); if (connection == null || connection.isClosed()) return false; DefaultResultSetFuture peersFuture = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_SCHEMA_PEERS)); DefaultResultSetFuture localFuture = new DefaultResultSetFuture(null, cluster.protocolVersion(), new Requests.Query(SELECT_SCHEMA_LOCAL)); connection.write(peersFuture); connection.write(localFuture); Set<UUID> versions = new HashSet<UUID>(); Row localRow = localFuture.get().one(); if (localRow != null && !localRow.isNull("schema_version")) versions.add(localRow.getUUID("schema_version")); for (Row row : peersFuture.get()) { InetSocketAddress addr = addressToUseForPeerHost(row, connection.address, cluster); if (addr == null || row.isNull("schema_version")) continue; Host peer = cluster.metadata.getHost(addr); if (peer != null && peer.isUp()) versions.add(row.getUUID("schema_version")); } logger.debug("Checking for schema agreement: versions are {}", versions); return versions.size() <= 1; }
Source:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_FACILITY_ATTR_DEF); attr.setFriendlyName("uid-namespace"); attr.setDisplayName("UID namespace"); attr.setType(String.class.getName()); attr.setDescription("UID in namespace perun"); return attr; }

Target:
public AttributeDefinition getAttributeDefinition() { AttributeDefinition attr = new AttributeDefinition(); attr.setNamespace(AttributesManager.NS_FACILITY_ATTR_DEF); attr.setFriendlyName("uid-namespace"); attr.setDisplayName("UID namespace"); attr.setType(String.class.getName()); attr.setDescription("Namespace for UIDs which can be used at specific facility."); return attr; }
Source:
public DataSource createDataSource() throws SQLException { final DbInfo db = createNewDatabase(); return createDataSourceFromDBInfo(db); }

Target:
public DataSource createDataSource() throws SQLException { return createDataSourceFromConnectionInfo(createNewDatabase()); }
Source:
private void setLimit(final BooleanImageLabel limit, final Boolean enable) { limit.enable(disableIfNull(enable)); }

Target:
private void setLimit(final BooleanImageLabel limit, final Boolean enable) { limit.setIsEnabled(enable); }
Source:
public static void assertEquals(int value1, int value2, String message, Object... data) { if (data == null) { checkExpressionFailOnTrue(value1 != value2, message + " - Expected %s; Actual %s", value1, value2); } else { checkExpressionFailOnTrue(value1 != value2, message + " - Expected %s; Actual %s", data, value1, value2); } }

Target:
public static void assertEquals(int value1, int value2, String message, Object... data) { if (data == null) { checkExpressionFailOnTrue(value1 != value2, message + " - Expected %s; Actual %s", value1, value2); } else { checkExpressionFailOnTrue(value1 != value2, message + " - Expected %d; Actual %d", data, value1, value2); } }
Source:
public List<EventType> list() { return jdbcTemplate.query( "SELECT et_name, et_event_type_object FROM zn_data.event_type;", new EventTypeMapper()); }

Target:
public List<EventType> list() { return jdbcTemplate.query( "SELECT et_event_type_object FROM zn_data.event_type", new EventTypeMapper()); }
Source:
public Date apply(String retryAfter) { if (retryAfter == null) { return null; } if (retryAfter.matches("^[0-9]+$")) { long deltaMillis = SECONDS.toMillis(Long.parseLong(retryAfter)); return new Date(currentTimeMillis() + deltaMillis); } synchronized (rfc822Format) { try { return rfc822Format.parse(retryAfter); } catch (ParseException ignored) { return null; } } }

Target:
public Date apply(String retryAfter) { if (retryAfter == null) { return null; } if (retryAfter.matches("^[0-9]+$")) { long deltaMillis = TimeUnit.SECONDS.toMillis(Long.parseLong(retryAfter)); return new Date(currentTimeMillis() + deltaMillis); } synchronized (rfc822Format) { try { return rfc822Format.parse(retryAfter); } catch (ParseException ignored) { return null; } } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } List<VmDevice> watchdogs = getVmDeviceDao().getVmDeviceByVmIdAndType(getParameters().getVmId(), VmDeviceType.WATCHDOG.getName()); if (watchdogs.isEmpty()) { return failCanDoAction(VdcBllMessages.WATCHDOG_NOT_FOUND); } return super.canDoAction(); }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } List<VmDevice> watchdogs = getVmDeviceDao().getVmDeviceByVmIdAndType(getParameters().getId(), VmDeviceType.WATCHDOG.getName()); if (watchdogs.isEmpty()) { return failCanDoAction(VdcBllMessages.WATCHDOG_NOT_FOUND); } return true; }
Source:
public void text_encode_opaque_as_base64_string() { byte[] opaqueValue = new byte[] { 1, 2, 3, 4, 5 }; byte[] encoded = encoder.encode(LwM2mSingleResource.newBinaryResource(0, opaqueValue), ContentFormat.TEXT, new LwM2mPath("/5/0/0"), model); Assert.assertEquals("AQIDBAU=", new String(encoded, StandardCharsets.UTF_8)); }

Target:
public void text_encode_opaque_as_base64_string() { byte[] opaqueValue = new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 }; byte[] encoded = encoder.encode(LwM2mSingleResource.newBinaryResource(0, opaqueValue), ContentFormat.TEXT, new LwM2mPath("/5/0/0"), model); Assert.assertEquals("AQIDBAU=", new String(encoded, StandardCharsets.UTF_8)); }
Source:
public void testRetryCount() { AtomicInteger scheduleCalls = new AtomicInteger(); AtomicReference<TaskRunner> runner = new AtomicReference<>(); ScheduledExecutorService mockedExecutor = mock(ScheduledExecutorService.class); when(mockedExecutor.schedule(any(TaskRunner.class), anyLong(), eq(TimeUnit.MILLISECONDS))).then(a -> { scheduleCalls.getAndIncrement(); runner.set((TaskRunner) a.getArguments()[0]); return null; }); RetryStrategy retryStrategy = new RetryStrategy(mockedExecutor); long initialDelay = 150L; long retryDelay = 50L; int targetRetryCount = 3; TestCounterTask retryTask = new TestCounterTask( initialDelay, retryDelay, false, targetRetryCount); assertEquals(0, scheduleCalls.get()); retryStrategy.runRetryingTask(retryTask); assertEquals(1, scheduleCalls.get()); assertEquals(0, retryTask.counter); runner.get().run(); assertEquals(1, retryTask.counter); assertEquals(2, scheduleCalls.get()); runner.get().run(); assertEquals(3, scheduleCalls.get()); runner.get().run(); assertEquals(3, retryTask.counter); assertEquals(3, scheduleCalls.get()); assertEquals(3, retryTask.counter); }

Target:
public void testRetryCount() { FakeScheduledExecutorService mockedExecutor = mock( FakeScheduledExecutorService.class, withSettings() .useConstructor() .defaultAnswer(CALLS_REAL_METHODS) ); RetryStrategy retryStrategy = new RetryStrategy(mockedExecutor); long initialDelay = 150L; long retryDelay = 50L; int targetRetryCount = 3; TestCounterTask retryTask = new TestCounterTask( initialDelay, retryDelay, false, targetRetryCount); retryStrategy.runRetryingTask(retryTask); mockedExecutor.run(); assertEquals(0, retryTask.counter); mockedExecutor.getClock().elapse(Duration.ofMillis(initialDelay + 10L)); mockedExecutor.run(); assertEquals(1, retryTask.counter); mockedExecutor.getClock().elapse(Duration.ofMillis(retryDelay + 10L)); mockedExecutor.run(); mockedExecutor.getClock().elapse(Duration.ofMillis(retryDelay + 10L)); mockedExecutor.run(); assertEquals(3, retryTask.counter); mockedExecutor.getClock().elapse(Duration.ofMillis(retryDelay + 10L)); mockedExecutor.run(); assertEquals(3, retryTask.counter); }
Source:
KafkaConsumer<byte[], byte[]> newConsumer() throws IOException { ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); final Map<String, Object> configs = new HashMap<>(); for (Map.Entry<String, Object> entry : ioConfig.getConsumerProperties().entrySet()) { String propertyKey = entry.getKey(); if (propertyKey.equals(KafkaSupervisorIOConfig.TRUST_STORE_PASSWORD_KEY) || propertyKey.equals(KafkaSupervisorIOConfig.KEY_STORE_PASSWORD_KEY) || propertyKey.equals(KafkaSupervisorIOConfig.KEY_PASSWORD_KEY)) { PasswordProvider configPasswordProvider = configMapper.readValue( configMapper.writeValueAsString(entry.getValue()), PasswordProvider.class ); configs.put(propertyKey, (configPasswordProvider.getPassword())); } else { configs.put(propertyKey, entry.getValue()); } } configs.put("enable.auto.commit", "false"); configs.put("auto.offset.reset", "none"); configs.put("key.deserializer", ByteArrayDeserializer.class.getName()); configs.put("value.deserializer", ByteArrayDeserializer.class.getName()); return new KafkaConsumer<>(configs); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }

Target:
KafkaConsumer<byte[], byte[]> newConsumer() { ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); final Properties props = new Properties(); addConsumerPropertiesFromConfig(props, configMapper, ioConfig.getConsumerProperties()); props.setProperty("enable.auto.commit", "false"); props.setProperty("auto.offset.reset", "none"); props.setProperty("key.deserializer", ByteArrayDeserializer.class.getName()); props.setProperty("value.deserializer", ByteArrayDeserializer.class.getName()); return new KafkaConsumer<>(props); } finally { Thread.currentThread().setContextClassLoader(currCtxCl); } }
Source:
public String digestParams(RestInvocation i) { String path = i.getPath(); try { path = URLDecoder.decode(path, "utf8"); } catch (UnsupportedEncodingException ignored) { } Object nonce = i.getParamValue(HeaderParam.class, BitfinexAuthenticated.BFX_NONCE); String body = i.getRequestBody(); if (body == null || body.isEmpty()) { body = "{}"; } String toEncode = "/api/" + path + nonce + body; try { byte[] sig = getMac().doFinal(toEncode.getBytes(UTF_8)); String signature = DigestUtils.bytesToHex(sig); return signature; } catch (IllegalStateException | UnsupportedEncodingException e) { throw new ExchangeException("Could not sign the request", e); } }

Target:
public String digestParams(RestInvocation i) { String path = i.getPath(); try { path = URLDecoder.decode(path, "utf8"); } catch (UnsupportedEncodingException e) { log.warn("Could not url decode the path {}.", path, e); } Object nonce = i.getParamValue(HeaderParam.class, BitfinexAuthenticated.BFX_NONCE); String body = i.getRequestBody(); if (body == null || body.isEmpty()) { body = "{}"; } String toEncode = "/api/" + path + nonce + body; try { byte[] sig = getMac().doFinal(toEncode.getBytes(UTF_8)); String signature = DigestUtils.bytesToHex(sig); return signature; } catch (IllegalStateException | UnsupportedEncodingException e) { throw new ExchangeException("Could not sign the request", e); } }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { Integer methodFirstArgumentAsInteger = LiteralUtils.intLiteralValue(mit.arguments().get(0)); if (methodFirstArgumentAsInteger == null) { return; } boolean isMethodFromJavaSqlResultSet = mit.symbol().owner().type().is(JAVA_SQL_RESULTSET); int methodFirstArgumentValue = methodFirstArgumentAsInteger.intValue(); if (isMethodFromJavaSqlResultSet && methodFirstArgumentValue == 0) { addIssue(mit, "ResultSet indices start at 1."); } else if (!isMethodFromJavaSqlResultSet) { if (methodFirstArgumentValue == 0) { addIssue(mit, "PreparedStatement indices start at 1."); } else { Tree preparedStatementReference = getPreparedStatementReference(mit); Integer numberParameters = getPreparedStatementNumberOfParameters(preparedStatementReference); if (numberParameters != null && methodFirstArgumentValue > numberParameters.intValue()) { addIssue(mit, "This \"PreparedStatement\" " + (numberParameters == 0 ? "has no" : ("only has " + numberParameters)) + " parameters."); } } } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { Integer methodFirstArgumentAsInteger = LiteralUtils.intLiteralValue(mit.arguments().get(0)); if (methodFirstArgumentAsInteger == null) { return; } boolean isMethodFromJavaSqlResultSet = mit.symbol().owner().type().is(JAVA_SQL_RESULTSET); int methodFirstArgumentValue = methodFirstArgumentAsInteger.intValue(); if (isMethodFromJavaSqlResultSet && methodFirstArgumentValue == 0) { addIssue(mit, "ResultSet indices start at 1."); } else if (!isMethodFromJavaSqlResultSet) { if (methodFirstArgumentValue == 0) { addIssue(mit, "PreparedStatement indices start at 1."); } else { Tree preparedStatementReference = getPreparedStatementReference(mit); Integer numberParameters = getPreparedStatementNumberOfParameters(preparedStatementReference); if (numberParameters != null && methodFirstArgumentValue > numberParameters) { addIssue(mit, "This \"PreparedStatement\" " + (numberParameters == 0 ? "has no" : ("only has " + numberParameters)) + " parameters."); } } } }
Source:
protected void populateExtendedInfo(LogEntry entry, DocumentModel source, ExpressionContext context, Collection<ExtendedInfoDescriptor> extInfos) { if (extInfos != null) { Map<String, ExtendedInfo> extendedInfos = entry.getExtendedInfos(); for (ExtendedInfoDescriptor descriptor : extInfos) { String exp = descriptor.getExpression(); Serializable value = null; try { value = expressionEvaluator.evaluateExpression(context, exp, Serializable.class); } catch (PropertyException | UnsupportedOperationException e) { if (source instanceof DeletedDocumentModel) { log.debug("Can not evaluate the expression: " + exp + " on a DeletedDocumentModel, skipping."); } continue; } catch (DocumentNotFoundException e) { if (entry.getEventId() != "documentRemoved") { log.error("Not found: " + e.getMessage() + ", entry: " + entry, e); } continue; } catch (ELException e) { continue; } if (value == null) { continue; } extendedInfos.put(descriptor.getKey(), newExtendedInfo(value)); } } }

Target:
protected void populateExtendedInfo(LogEntry entry, DocumentModel source, ExpressionContext context, Collection<ExtendedInfoDescriptor> extInfos) { if (extInfos != null) { Map<String, ExtendedInfo> extendedInfos = entry.getExtendedInfos(); for (ExtendedInfoDescriptor descriptor : extInfos) { String exp = descriptor.getExpression(); Serializable value = null; try { value = expressionEvaluator.evaluateExpression(context, exp, Serializable.class); } catch (PropertyException | UnsupportedOperationException e) { if (source instanceof DeletedDocumentModel) { log.debug("Can not evaluate the expression: " + exp + " on a DeletedDocumentModel, skipping."); } continue; } catch (DocumentNotFoundException e) { if (! DocumentEventTypes.DOCUMENT_REMOVED.equals(entry.getEventId())) { log.error(String.format("Not found: %s, entry: %s", e.getMessage(), entry, e)); } continue; } catch (ELException e) { continue; } if (value == null) { continue; } extendedInfos.put(descriptor.getKey(), newExtendedInfo(value)); } } }
Source:
public void saveCredentialsOrFinish(FirebaseUser firebaseUser, @Nullable String password, @Nullable IdpResponse response) { mResponse = response; if (!getFlowParams().enableCredentials) { finish(); return; } final Credential credential = CredentialsUtil.buildCredential( firebaseUser.getEmail(), password, firebaseUser.getDisplayName(), firebaseUser.getPhotoUrl() == null ? null : firebaseUser.getPhotoUrl().toString(), mResponse); if (credential == null) { Log.e(TAG, "Unable to save null credential!"); finish(); return; } getLifecycle().addObserver(new LifecycleObserver() { @OnLifecycleEvent(Lifecycle.Event.ON_START) public void save() { getCredentialsClient().save(credential) .addOnCompleteListener(SaveSmartLock.this); } }); }

Target:
public void saveCredentialsOrFinish(FirebaseUser firebaseUser, @Nullable String password, @Nullable IdpResponse response) { mResponse = response; if (!getFlowParams().enableCredentials) { finish(); return; } final Credential credential = CredentialsUtil.buildCredential( firebaseUser.getEmail(), password, firebaseUser.getDisplayName(), firebaseUser.getPhotoUrl() == null ? null : firebaseUser.getPhotoUrl().toString(), mResponse); if (credential == null) { Log.e(TAG, "Unable to save null credential!"); finish(); return; } getLifecycle().addObserver(new LifecycleObserver() { @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) public void save() { getCredentialsClient().save(credential) .addOnCompleteListener(SaveSmartLock.this); } }); }
Source:
public void testSendRegistrationInviteToStudent() throws Exception { ______TS("typical case: send invite to one student"); restoreTypicalDataInDatastore(); dataBundle = getTypicalDataBundle(); StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); String studentEmail = student1InCourse1.email; String courseId = student1InCourse1.course; MimeMessage msgToStudent = studentsLogic.sendRegistrationInviteToStudent(courseId, studentEmail); Emails emailMgr = new Emails(); @SuppressWarnings("static-access") String emailInfo = emailMgr.getEmailInfo(msgToStudent); String expectedEmailInfo = "[Email sent]to=student1InCourse1@gmail.com|from=" + "\"TEAMMATES Admin (noreply)\" <noreply@null.appspotmail.com>|subject=TEAMMATES:" + " Invitation to join course [Typical Course 1 with 2 Evals][Course ID: idOfTypicalCourse1]"; assertEquals(expectedEmailInfo, emailInfo); ______TS("invalid course id"); String invalidCourseId = "invalidCourseId"; try { studentsLogic.sendRegistrationInviteToStudent(invalidCourseId, studentEmail); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { } ______TS("invalid student email"); String invalidStudentEmail = "invalidStudentEmail"; try { studentsLogic.sendRegistrationInviteToStudent(courseId, invalidStudentEmail); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { } }

Target:
public void testSendRegistrationInviteToStudent() throws Exception { ______TS("typical case: send invite to one student"); restoreTypicalDataInDatastore(); StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1"); String studentEmail = student1InCourse1.email; String courseId = student1InCourse1.course; MimeMessage msgToStudent = studentsLogic.sendRegistrationInviteToStudent(courseId, studentEmail); Emails emailMgr = new Emails(); @SuppressWarnings("static-access") String emailInfo = emailMgr.getEmailInfo(msgToStudent); String expectedEmailInfo = "[Email sent]to=student1InCourse1@gmail.com|from=" + "\"TEAMMATES Admin (noreply)\" <noreply@null.appspotmail.com>|subject=TEAMMATES:" + " Invitation to join course [Typical Course 1 with 2 Evals][Course ID: idOfTypicalCourse1]"; assertEquals(expectedEmailInfo, emailInfo); ______TS("invalid course id"); String invalidCourseId = "invalidCourseId"; try { studentsLogic.sendRegistrationInviteToStudent(invalidCourseId, studentEmail); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { ignoreExpectedException(); } ______TS("invalid student email"); String invalidStudentEmail = "invalidStudentEmail"; try { studentsLogic.sendRegistrationInviteToStudent(courseId, invalidStudentEmail); signalFailureToDetectException(); } catch (EntityDoesNotExistException e) { ignoreExpectedException(); } }
Source:
public void setup() throws Exception { final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = CuratorFrameworkFactory.newClient(zk.connectString(), retryPolicy); curator.start(); client = new DefaultZooKeeperClient(curator); client.ensurePath(Paths.configHosts()); client.ensurePath(Paths.configJobs()); client.ensurePath(Paths.configJobRefs()); client.ensurePath(Paths.statusHosts()); client.ensurePath(Paths.statusMasters()); client.ensurePath(Paths.historyJobs()); final ZooKeeperClientProvider zkProvider = new ZooKeeperClientProvider(client, ZooKeeperModelReporter.noop()); final KafkaSender kafkaSender = new KafkaSender(Optional.<KafkaProducer<String, byte[]>>absent()); model = new ZooKeeperMasterModel(zkProvider, getClass().getName(), kafkaSender); }

Target:
public void setup() throws Exception { final RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = CuratorFrameworkFactory.newClient(zk.connectString(), retryPolicy); curator.start(); client = new DefaultZooKeeperClient(curator); client.ensurePath(Paths.configHosts()); client.ensurePath(Paths.configJobs()); client.ensurePath(Paths.configJobRefs()); client.ensurePath(Paths.statusHosts()); client.ensurePath(Paths.statusMasters()); client.ensurePath(Paths.historyJobs()); final ZooKeeperClientProvider zkProvider = new ZooKeeperClientProvider(client, ZooKeeperModelReporter.noop()); final KafkaSender kafkaSender = mock(KafkaSender.class); model = new ZooKeeperMasterModel(zkProvider, getClass().getName(), kafkaSender); }
Source:
public int hashCode() { return Objects.hash(storageFormat, location, bucketProperty, skewed, serdeParameters); }

Target:
public int hashCode() { return Objects.hash(skewed, storageFormat, location, bucketProperty, serdeParameters); }
Source:
public void init() { if (getVm().getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE && getDestinationVds() == null && !getVm().isUseHostCpuFlags() && getVm().getVmType() != VmType.HighPerformance) { isVmNumaNodesExist = !vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId()).isEmpty(); } }

Target:
public void init() { if (getVm() != null && getVm().getMigrationSupport() == MigrationSupport.IMPLICITLY_NON_MIGRATABLE && !getVm().isUseHostCpuFlags() && getVm().getVmType() != VmType.HighPerformance) { isVmNumaNodesExist = !vmNumaNodeDao.getAllVmNumaNodeByVmId(getParameters().getVmId()).isEmpty(); } }
Source:
public void testWriteToFileSystem() { SavedPageSyncService syncService = mock(SavedPageSyncService.class); Page dummyPage = mock(Page.class); ArrayList<ReadingListPageDiskRow> unsyncedPages = removeSynced(pages); LinkedList<ReadingListPageDiskRow> queue = (LinkedList<ReadingListPageDiskRow>) syncService.getQueue(); queue.addAll(unsyncedPages); int pagesSaved = 0; for (ReadingListPageDiskRow row : queue) { when(syncService.save(row, dummyPage)).thenReturn(true); boolean b = syncService.save(row, dummyPage); pagesSaved += b ? 1 : 0; } assertEquals(pagesSaved, 3); }

Target:
public void testWriteToFileSystem() { SavedPageSyncService syncService = mock(SavedPageSyncService.class); List<ReadingListPageDiskRow> queue = syncService.getQueue(); List<ReadingListPageDiskRow> rows = getRows(); queue.addAll(rows); int pagesSaved = saveAndCount(syncService, rows); assertEquals(pagesSaved, 4); }
Source:
protected void reconfigureProcessorByHandler(EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { VmwareStorageSubsystemCommandHandler handler = (VmwareStorageSubsystemCommandHandler) storageHandler; boolean success = handler.reconfigureStorageProcessor(params); if (success){ s_logger.info("VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler successfully reconfigured"); } else { s_logger.error("Error while reconfiguring VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler"); } }

Target:
protected void reconfigureProcessorByHandler(EnumMap<VmwareStorageProcessorConfigurableFields,Object> params) { VmwareStorageSubsystemCommandHandler handler = (VmwareStorageSubsystemCommandHandler) storageHandler; boolean success = handler.reconfigureStorageProcessor(params); if (success){ s_logger.info("VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler successfully reconfigured"); } else { s_logger.error("Error while reconfiguring VmwareStorageProcessor and VmwareStorageSubsystemCommandHandler, params=" + _gson.toJson(params)); } }
Source:
public void setVoiceMailNumber(String alphaTag, String voiceNumber, Message onComplete){ Log.e(LOG_TAG, "method setVoiceMailNumber is not implemented"); }

Target:
public void setVoiceMailNumber(String alphaTag, String voiceNumber, Message onComplete){ AsyncResult.forMessage((onComplete)).exception = new IccException("setVoiceMailNumber not implemented"); onComplete.sendToTarget(); Log.e(LOG_TAG, "method setVoiceMailNumber is not implemented"); }
Source:
private void addResource(final BackendResource resource) { resource.setMessageBundle(messageBundle); resource.setBackend(backend); resource.setSessionHelper(sessionHelper); if (resource instanceof AbstractBackendResource) { ((AbstractBackendResource) resource).setMappingLocator(mappingLocator); } else if (resource instanceof CapabilitiesResource) { ((BackendCapabilitiesResource) resource).setMappingLocator(mappingLocator); } resource.setValidatorLocator(validatorLocator); singletons.add(resource); }

Target:
private void addResource(final BackendResource resource) { resource.setMessageBundle(messageBundle); resource.setBackend(backend); resource.setSessionHelper(sessionHelper); if (resource instanceof AbstractBackendResource) { ((AbstractBackendResource) resource).setMappingLocator(mappingLocator); } else if (resource instanceof CapabilitiesResource) { ((BackendCapabilitiesResource) resource).setMappingLocator(mappingLocator); } singletons.add(resource); }
Source:
private static void browsePostOrPageEx( Context context, SiteModel site, PostModel post, RemotePreviewType remotePreviewType) { if ( site == null || post == null || TextUtils.isEmpty(post.getLink()) || (remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE && TextUtils.isEmpty(post.getAutoSavePreviewUrl())) ) { return; } String url = remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE ? post.getAutoSavePreviewUrl() : UrlUtils.appendUrlParameter(post.getLink(), "preview", "true"); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); boolean startPreviewForResult = remotePreviewType != RemotePreviewType.NOT_A_REMOTE_PREVIEW; if (site.isWPCom()) { WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials( context, url, shareableUrl, shareSubject, startPreviewForResult); } else if (site.isJetpackConnected()) { WPWebViewActivity .openJetpackBlogPostPreview( context, url, shareableUrl, shareSubject, site.getFrameNonce(), startPreviewForResult); } else { WPWebViewActivity.openUrlByUsingBlogCredentials( context, site, post, url, new String[]{post.getLink()}, true, startPreviewForResult); } }

Target:
private static void browsePostOrPageEx( Context context, SiteModel site, PostModel post, RemotePreviewType remotePreviewType) { if (site == null || post == null || TextUtils.isEmpty(post.getLink())) { return; } if (remotePreviewType == RemotePreviewType.REMOTE_PREVIEW_WITH_REMOTE_AUTO_SAVE && TextUtils.isEmpty(post.getAutoSavePreviewUrl())) { return; } String url = PostUtils.getPreviewUrlForPost(remotePreviewType, post); String shareableUrl = post.getLink(); String shareSubject = post.getTitle(); boolean startPreviewForResult = remotePreviewType != RemotePreviewType.NOT_A_REMOTE_PREVIEW; if (site.isWPCom()) { WPWebViewActivity.openPostUrlByUsingGlobalWPCOMCredentials( context, url, shareableUrl, shareSubject, startPreviewForResult); } else if (site.isJetpackConnected()) { WPWebViewActivity .openJetpackBlogPostPreview( context, url, shareableUrl, shareSubject, site.getFrameNonce(), startPreviewForResult); } else { WPWebViewActivity.openUrlByUsingBlogCredentials( context, site, post, url, new String[]{post.getLink()}, true, startPreviewForResult); } }
Source:
public ObjectPool newPool(final ObjectPoolConfig config) { return new BlockingQueueObjectPool(tsdb, config); }

Target:
public ObjectPool newPool(final ObjectPoolConfig config) { return new BlockingQueueArrayObjectPool(tsdb, config); }
Source:
private int getLoginPort(Container container) { if (container.getNetworkSettings() != null) { Map<String, List<Map<String,String>>> ports = container.getNetworkSettings().getPorts(); if(ports != null) { return Integer.parseInt(getOnlyElement(ports.get("22/tcp")).get("HostPort")); } } else if (container.getPorts() != null) { for (Port port : container.getPorts()) { if (port.getPrivatePort() == 22) { return port.getPublicPort(); } } } throw new IllegalStateException("Cannot determine the login port for " + container.getId()); }

Target:
protected static int getLoginPort(Container container) { if (container.getNetworkSettings() != null) { Map<String, List<Map<String, String>>> ports = container.getNetworkSettings().getPorts(); if (ports != null) { return Integer.parseInt(getOnlyElement(ports.get("22/tcp")).get("HostPort")); } } else if (container.getPorts() != null) { for (Port port : container.getPorts()) { if (port.getPrivatePort() == 22) { return port.getPublicPort(); } } } throw new IllegalStateException("Cannot determine the login port for " + container.getId()); }
Source:
public void testHeartbeatMessage() throws InterruptedException { String TOPIC_NAME = "topic2"; Map<String, AgentTopicStats> topicInfoMap = new HashMap<>(); Instant lastProduced = Instant.now().minusMillis(20000); Instant lastConsumed = Instant.now().minusMillis(30000); topicInfoMap.put(TOPIC_NAME, new AgentTopicStats(true, false, lastProduced, lastConsumed)); Payload payload = new Payload.Builder<Object, Object, Object, Map<String, AgentTopicStats>>() .withBody(topicInfoMap) .build(); CountDownLatch heartBeatResponseReceived = new CountDownLatch(1); Callback<AggregatorStats> handler = stats -> { assertTrue(stats.getTopicInfoMap().containsKey(TOPIC_NAME)); assertEquals(1, stats.getTopicInfoMap().get(TOPIC_NAME).getProducers().size()); heartBeatResponseReceived.countDown(); }; ChannelMonitorAggregator channelMonitorAggregator = msbContext.getObjectFactory().createChannelMonitorAggregator(handler); channelMonitorAggregator.start(true, 10000, 1000); Message requestMessage = awaitHeartBeatRequestSent(RequesterResponderIT.MESSAGE_TRANSMISSION_TIME); Message responseMessage = createMsbRequestMessage(requestMessage.getTopics().getResponse(), requestMessage.getCorrelationId(), payload); MockAdapter.pushRequestMessage(requestMessage.getTopics().getResponse(), Utils.toJson(responseMessage, msbContext.getPayloadMapper())); assertTrue("HeartBeat Response was not received", heartBeatResponseReceived.await(RequesterResponderIT.MESSAGE_TRANSMISSION_TIME, TimeUnit.MILLISECONDS)); }

Target:
public void testHeartbeatMessage() throws InterruptedException { String TOPIC_NAME = "topic3"; Map<String, AgentTopicStats> topicInfoMap = new HashMap<>(); topicInfoMap.put(TOPIC_NAME, new AgentTopicStats(true, false, LAST_PRODUCED_TIME, LAST_CONSUMED_TIME)); Payload payload = new Payload.Builder<Object, Object, Object, Map<String, AgentTopicStats>>() .withBody(topicInfoMap) .build(); CountDownLatch heartBeatResponseReceived = new CountDownLatch(1); Callback<AggregatorStats> handler = stats -> { assertTrue(stats.getTopicInfoMap().containsKey(TOPIC_NAME)); assertEquals(1, stats.getTopicInfoMap().get(TOPIC_NAME).getProducers().size()); heartBeatResponseReceived.countDown(); }; channelMonitorAggregator = msbContext.getObjectFactory().createChannelMonitorAggregator(handler); channelMonitorAggregator.start(true, ChannelMonitorAggregator.DEFAULT_HEARTBEAT_INTERVAL_MS, HEARTBEAT_TIMEOUT_MS); Message requestMessage = awaitHeartBeatRequestSent(); Message responseMessage = createMsbRequestMessage(requestMessage.getTopics().getResponse(), requestMessage.getCorrelationId(), payload); MockAdapter.pushRequestMessage(requestMessage.getTopics().getResponse(), Utils.toJson(responseMessage, msbContext.getPayloadMapper())); assertTrue("Heartbeat response was not received", heartBeatResponseReceived.await(HEARTBEAT_TIMEOUT_MS * 2, TimeUnit.MILLISECONDS)); }
Source:
public void write(DataOutput out) throws IOException { super.write(out); if (preKmerLength != null) { out.writeInt(preKmerLength); } if (internalKmer != null) { internalKmer.write(out); } if (pathList != null) { pathList.write(out); } if(edgeTypeList != null){ edgeTypeList.write(out); } if (numBranches != null) { out.writeInt(numBranches); } }

Target:
public void write(DataOutput out) throws IOException { super.write(out); if (preKmerLength != null) { out.writeInt(preKmerLength); } if (internalKmer != null && internalKmer.getKmerLetterLength() > 0) { internalKmer.write(out); } if (pathList != null && pathList.getLength() > 0) { pathList.write(out); } if (edgeTypeList != null && edgeTypeList.size() > 0) { edgeTypeList.write(out); } if (numBranches != null) { out.writeInt(numBranches); } }
Source:
private Constraint shuttleDestinationIsCoachOrHub(ConstraintFactory constraintFactory) { return constraintFactory.from(Shuttle.class) .filter(shuttle -> shuttle.getDestination() != null) .join(StopOrHub.class, equal(Shuttle::getDestination, stopOrHub -> stopOrHub)) .filter((shuttle, stopOrHub) -> !stopOrHub.isVisitedByCoach()) .penalize("shuttleDestinationIsCoachOrHub", HardSoftLongScore.ofUninitialized(0, 1000000000, 0)); }

Target:
private Constraint shuttleDestinationIsCoachOrHub(ConstraintFactory constraintFactory) { return constraintFactory.from(Shuttle.class) .filter(shuttle -> shuttle.getDestination() != null) .join(StopOrHub.class, equal(Shuttle::getDestination, stopOrHub -> stopOrHub)) .filter((shuttle, stopOrHub) -> !stopOrHub.isVisitedByCoach()) .penalize("shuttleDestinationIsCoachOrHub", HardSoftLongScore.ofHard(1000_000_000)); }
Source:
public void testFirstUpstreamBuildFirstProjectHasJustOneUpstreamJob() throws Exception { FreeStyleProject upstream = jenkins.createFreeStyleProject("upstream"); FreeStyleProject build = jenkins.createFreeStyleProject("build"); upstream.getPublishersList().add(new BuildTrigger("build", false)); jenkins.getInstance().rebuildDependencyGraph(); jenkins.buildAndAssertSuccess(upstream); jenkins.waitUntilNoActivity(); assertNotNull(upstream.getLastBuild()); assertNotNull(build.getLastBuild()); assertEquals(build.getLastBuild(), BuildUtil.getFirstUpstreamBuild(build.getLastBuild(), build)); Pipeline pipeline = Pipeline.extractPipeline("Pipeline", build); List<Pipeline> pipelines = pipeline.createPipelineLatest(1, Jenkins.getInstance(), false); assertEquals(1, pipelines.size()); assertEquals(1, pipelines.get(0).getTriggeredBy().size()); assertEquals(TriggerCause.TYPE_UPSTREAM, pipelines.get(0).getTriggeredBy().get(0).getType()); }

Target:
public void testFirstUpstreamBuildFirstProjectHasJustOneUpstreamJob() throws Exception { FreeStyleProject upstream = jenkins.createFreeStyleProject("upstream"); FreeStyleProject build = jenkins.createFreeStyleProject("build"); upstream.getPublishersList().add(new BuildTrigger("build", false)); jenkins.getInstance().rebuildDependencyGraph(); jenkins.buildAndAssertSuccess(upstream); jenkins.waitUntilNoActivity(); assertNotNull(upstream.getLastBuild()); assertNotNull(build.getLastBuild()); assertEquals(build.getLastBuild(), BuildUtil.getFirstUpstreamBuild(build.getLastBuild(), build)); Pipeline pipeline = Pipeline.extractPipeline("Pipeline", build); List<Pipeline> pipelines = pipeline.createPipelineLatest(1, Jenkins.getInstance(), pagingEnabledFalse); assertEquals(1, pipelines.size()); assertEquals(1, pipelines.get(0).getTriggeredBy().size()); assertEquals(TriggerCause.TYPE_UPSTREAM, pipelines.get(0).getTriggeredBy().get(0).getType()); }
Source:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value ) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } else if (value instanceof Boolean) { node.setProperty(propertyName, (Boolean) value); } else if (value instanceof Long) { node.setProperty(propertyName, (Long) value); } else if (value instanceof Integer) { node.setProperty(propertyName, new Long((Integer) value)); } else if (value instanceof Calendar) { Calendar calendarValue = (Calendar) value; if (calendarValue.getTimeZone().getID().toLowerCase().equals("unknown")) { calendarValue.setTimeZone(TimeZone.getDefault()); } node.setProperty(propertyName, calendarValue); } else if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); Binary binaryProperty = node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } else if (value instanceof List) { ValueFactory vf = node.getSession().getValueFactory(); List<Value> values = new ArrayList<Value>(); for (Object val : (List) value) { if (val instanceof String) { values.add(vf.createValue((String) val)); } } if (values.size() > 0) { Value[] valuesArray = new Value[values.size()]; values.toArray(valuesArray); node.setProperty(propertyName, valuesArray); } } else { throw new IllegalArgumentException(String.format("The value of the property %s has unknown type and couldn't be saved.", propertyName)); } } }

Target:
private void setPropertyIfMetadataPresent( Node node, String propertyName, Object value ) throws RepositoryException { if (value != null) { if (value instanceof String && !StringUtil.isBlank((String) value)) { node.setProperty(propertyName, (String) value); } else if (value instanceof Boolean) { node.setProperty(propertyName, (Boolean) value); } else if (value instanceof Long) { node.setProperty(propertyName, (Long) value); } else if (value instanceof Integer) { node.setProperty(propertyName, new Long((Integer) value)); } else if (value instanceof Calendar) { Calendar calendarValue = (Calendar) value; if (calendarValue.getTimeZone().getID().toLowerCase().equals("unknown")) { calendarValue.setTimeZone(TimeZone.getDefault()); } node.setProperty(propertyName, calendarValue); } else if (value instanceof byte[]) { InputStream is = new ByteArrayInputStream((byte []) value); Binary binaryProperty = node.getSession().getValueFactory().createBinary(is); node.setProperty(propertyName, binaryProperty); } else if (value instanceof List<?>) { ValueFactory vf = node.getSession().getValueFactory(); List<Value> values = new ArrayList<Value>(); for (Object val : (List<?>) value) { if (val instanceof String) { values.add(vf.createValue((String) val)); } } if (values.size() > 0) { Value[] valuesArray = new Value[values.size()]; values.toArray(valuesArray); node.setProperty(propertyName, valuesArray); } } else { throw new IllegalArgumentException(String.format("The value of the property %s has unknown type and couldn't be saved.", propertyName)); } } }
Source:
public int hashCode() { return Objects.hash(bitLengths, values); }

Target:
public int hashCode() { int result = Arrays.hashCode(bitLengths); result = 31 * result + Arrays.hashCode(values); return result; }
Source:
protected void cleanPayeeACHAccountExtractDetail(PayeeACHAccountExtractDetail detail) { if (StringUtils.isNotBlank(detail.getBankAccountNumber()) && !StringUtils.isNumeric(detail.getBankAccountNumber())) { String logMessageStarter = "cleanPayeeACHAccountExtractDetail, the bank account for " + detail.getNetID(); if (StringUtils.contains(detail.getBankAccountNumber(), KFSConstants.DASH)) { LOG.error(logMessageStarter + " contains dashes, so removing them"); String cleanedBankAccount = StringUtils.remove(detail.getBankAccountNumber(), KFSConstants.DASH); detail.setBankAccountNumber(cleanedBankAccount); } else { LOG.error(logMessageStarter + " is not numberic but does NOT contains dashes, no automatic cleaning available"); } } }

Target:
protected void cleanPayeeACHAccountExtractDetail(PayeeACHAccountExtractDetail detail) { if (StringUtils.isNotBlank(detail.getBankAccountNumber()) && !StringUtils.isNumeric(detail.getBankAccountNumber())) { String logMessageStarter = "cleanPayeeACHAccountExtractDetail, the bank account for " + detail.getNetID(); if (StringUtils.contains(detail.getBankAccountNumber(), KFSConstants.DASH)) { LOG.error(logMessageStarter + " contains dashes, so removing them"); String cleanedBankAccount = StringUtils.remove(detail.getBankAccountNumber(), KFSConstants.DASH); detail.setBankAccountNumber(cleanedBankAccount); } else { LOG.error(logMessageStarter + " is not numeric but does NOT contains dashes, no automatic cleaning available"); } } }
Source:
public CassandraTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName) { requireNonNull(tableName, "tableName is null"); try { cassandraSession.getTable(tableName); return cassandraSession.getTableHandle(tableName); } catch (NotFoundException e) { return null; } }

Target:
public CassandraTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName) { requireNonNull(tableName, "tableName is null"); try { return cassandraSession.getTable(tableName).getTableHandle(); } catch (TableNotFoundException | SchemaNotFoundException e) { return null; } }
Source:
public BooleanExpr getQuery() { assert children.size() >= 1; BooleanExpr firstChild = children.get(0).getQuery(); if (children.size() == 1) { return firstChild; } AndExpr andExpr = new AndExpr(firstChild); for (int i = 1; i < children.size(); i++) { BooleanExpr child = children.get(i).getQuery(); andExpr.getChildren().add(child); } return andExpr; }

Target:
public BooleanExpr getQuery() { if (children.isEmpty()) { throw new IllegalStateException("A conjunction must have at least one child"); } BooleanExpr firstChild = children.get(0).getQuery(); if (children.size() == 1) { return firstChild; } AndExpr andExpr = new AndExpr(firstChild); for (int i = 1; i < children.size(); i++) { BooleanExpr child = children.get(i).getQuery(); andExpr.getChildren().add(child); } return andExpr; }
Source:
public void setAngleArc(double angleArc) { if (angleArc > 360 || angleArc < 0) { throw new WrongValueException("The value of angleArc should be between 0 between 360 degree"); } else if (_angleArc != angleArc) { _angleArc = angleArc; smartUpdate("angleArc", _angleArc); } }

Target:
public void setAngleArc(double angleArc) { if (angleArc > 360 || angleArc < 0) { throw new WrongValueException("The value of angleArc should be between 0 and 360 degree"); } else if (_angleArc != angleArc) { _angleArc = angleArc; smartUpdate("angleArc", _angleArc); } }
Source:
private boolean hasUnsupportedExtensionType(CombinedPluginInfo pluginInfo) { List<String> extensionTypes = Arrays.stream(ExtensionType.values()).map(ExtensionType::getExtensionType).collect(toList()); List<String> invalidExtensions = pluginInfo.extensionNames().stream().filter(extensionName -> !extensionTypes.contains(extensionName)).collect(toList()); return !invalidExtensions.isEmpty(); }

Target:
private boolean hasUnsupportedExtensionType(CombinedPluginInfo pluginInfo) { Set<String> extensionTypes = extensionsRegistry.allRegisteredExtensions(); List<String> invalidExtensions = pluginInfo.extensionNames().stream().filter(extensionName -> !extensionTypes.contains(extensionName)).collect(toList()); return !invalidExtensions.isEmpty(); }
Source:
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(ObjectUtils.toString(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(OsRepositoryImpl.INSTANCE.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:
protected void doWork(IProgressMonitor monitor) throws Exception { requirementData.initialize(monitor); requirementToTestUnitsMap = new HashCollectionSet<>(HashSet::new); Set<ArtifactId> excludedArtifactIdMap = ViewIdUtility.findExcludedArtifactsByView(viewId, branch); List<Artifact> unitsOnBranch = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.TestCase, branch); if (unitsOnBranch != null) { ViewIdUtility.removeExcludedArtifacts(unitsOnBranch.iterator(), excludedArtifactIdMap); } testUnits = new HashMap<>(); if (unitsOnBranch != null) { for (Artifact unit : unitsOnBranch) { testUnits.put(convertToJavaFileName(unit.getName()), unit); } } List<Artifact> reqs = new ArrayList<>(); for (IArtifactType type : types) { if (withInheritance) { reqs.addAll( ArtifactQuery.getArtifactListFromTypeWithInheritence(type, branch, DeletionFlag.EXCLUDE_DELETED)); } else { reqs.addAll(ArtifactQuery.getArtifactListFromType(type, branch)); } } ViewIdUtility.removeExcludedArtifacts(reqs.iterator(), excludedArtifactIdMap); for (Artifact req : reqs) { List<Artifact> verifiers = req.getRelatedArtifacts(CoreRelationTypes.Verification__Verifier); ViewIdUtility.removeExcludedArtifacts(verifiers.iterator(), excludedArtifactIdMap); Set<String> verifierNames = new HashSet<>(); String inspection = getInspectionQual(req); if (Strings.isValid(inspection)) { verifierNames.add(inspection); } for (Artifact verifier : verifiers) { verifierNames.add(convertToJavaFileName(verifier.getName())); } requirementToTestUnitsMap.put(req, verifierNames); } }

Target:
protected void doWork(IProgressMonitor monitor) throws Exception { requirementData.initialize(monitor); requirementToTestUnitsMap = new HashCollectionSet<>(HashSet::new); testUnits = new HashMap<>(); Set<ArtifactId> excludedArtifactIdMap = ViewIdUtility.findExcludedArtifactsByView(viewId, branch); List<Artifact> unitsOnBranch = ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.TestCase, branch); if (unitsOnBranch != null) { ViewIdUtility.removeExcludedArtifacts(unitsOnBranch.iterator(), excludedArtifactIdMap); for (Artifact unit : unitsOnBranch) { testUnits.put(convertToJavaFileName(unit.getName()), unit); } } List<Artifact> reqs = new ArrayList<>(); for (IArtifactType type : types) { if (withInheritance) { reqs.addAll( ArtifactQuery.getArtifactListFromTypeWithInheritence(type, branch, DeletionFlag.EXCLUDE_DELETED)); } else { reqs.addAll(ArtifactQuery.getArtifactListFromType(type, branch)); } } ViewIdUtility.removeExcludedArtifacts(reqs.iterator(), excludedArtifactIdMap); for (Artifact req : reqs) { List<Artifact> verifiers = req.getRelatedArtifacts(CoreRelationTypes.Verification__Verifier); ViewIdUtility.removeExcludedArtifacts(verifiers.iterator(), excludedArtifactIdMap); Set<String> verifierNames = new HashSet<>(); String inspection = getInspectionQual(req); if (Strings.isValid(inspection)) { verifierNames.add(inspection); } for (Artifact verifier : verifiers) { verifierNames.add(convertToJavaFileName(verifier.getName())); } requirementToTestUnitsMap.put(req, verifierNames); } }