auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private synchronized CompletableFuture<Boolean> addEditableCapabilities(Optional<FileWrapper> sharedDirOpt, NetworkAccess network) { return CapabilityStore.getEditableCapabilityFileSize(sharedDirOpt.get(), network) .thenCompose(editCount -> { <START> if (editCount == byteOffsetWrite) <END> return CompletableFuture.completedFuture(true); return CapabilityStore.loadWriteAccessSharingLinksFromIndex(homeDirSupplier, sharedDirOpt.get(), ownerName, network, random, hasher, byteOffsetWrite, true) .thenApply(newWriteCaps -> { byteOffsetWrite += newWriteCaps.getBytesRead(); root = newWriteCaps.getRetrievedCapabilities().stream() .reduce(root, (root, cap) -> root.put(trimOwner(cap.path), new EntryPoint(cap.cap, ownerName)), (a, b) -> a); return true; }); }); }</code><technical_language>tiny cleaup editCount -> editBytes</technical_language>

Target:
private synchronized CompletableFuture<Boolean> addEditableCapabilities(Optional<FileWrapper> sharedDirOpt, NetworkAccess network) { return CapabilityStore.getEditableCapabilityFileSize(sharedDirOpt.get(), network) .thenCompose(editFilesize -> { if (editFilesize == byteOffsetWrite) return CompletableFuture.completedFuture(true); return CapabilityStore.loadWriteAccessSharingLinksFromIndex(homeDirSupplier, sharedDirOpt.get(), ownerName, network, random, hasher, byteOffsetWrite, true) .thenApply(newWriteCaps -> { byteOffsetWrite += newWriteCaps.getBytesRead(); root = newWriteCaps.getRetrievedCapabilities().stream() .reduce(root, (root, cap) -> root.put(trimOwner(cap.path), new EntryPoint(cap.cap, ownerName)), (a, b) -> a); return true; }); }); }
Source:
<code>private void validateListingForFile(Path f, List<FileStatus> statusList, boolean nextCallAlone) { String msg = String.format("size of file list returned using %s should " + "be 1", nextCallAlone ? "next() calls alone" : "hasNext() and next() calls"); Assertions.assertThat(statusList) .describedAs(msg) .hasSize(1); Assertions.assertThat(statusList.get(0).getPath().toString()) <START> .describedAs("path returned should match with the input path") <END> .isEqualTo(f.toString()); Assertions.assertThat(statusList.get(0).isFile()) .describedAs("path returned should be a file") .isEqualTo(true); }</code><technical_language>reason leave Path Path.equals() do work? compares URIs</technical_language>

Target:
private void validateListingForFile(Path f, List<FileStatus> statusList, boolean nextCallAlone) { String msg = String.format("size of file list returned using %s should " + "be 1", nextCallAlone ? "next() calls alone" : "hasNext() and next() calls"); Assertions.assertThat(statusList) .describedAs(msg) .hasSize(1); Assertions.assertThat(statusList.get(0).getPath()) .describedAs("path returned should match with the input path") .isEqualTo(f); Assertions.assertThat(statusList.get(0).isFile()) .describedAs("path returned should be a file") .isEqualTo(true); }
Source:
<code>public void testControllerCallback_onAllowedCommandChanged() throws Exception { prepareLooper(); final CustomAction testCustomAction1 = new CustomAction.Builder("testCustomAction1", "testName1", 1).build(); final CustomAction testCustomAction2 = new CustomAction.Builder("testCustomAction2", "testName2", 2).build(); final CountDownLatch latch = new CountDownLatch(1); final ControllerCallback callback = new ControllerCallback() { @Override public void onAllowedCommandsChanged(MediaController2 controller, SessionCommandGroup2 commands) { <START> assertFalse(commands.hasCommand(new SessionCommand2( testCustomAction1.getAction(), testCustomAction1.getExtras()))); <END> latch.countDown(); } }; mSession.setPlaybackState(new PlaybackStateCompat.Builder() .addCustomAction(testCustomAction1).build()); mController = createController(mSession.getSessionToken(), true, callback); mSession.setPlaybackState(new PlaybackStateCompat.Builder() .addCustomAction(testCustomAction2).build()); assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); }</code><technical_language>I need check this is command is testCustomAction2</technical_language>

Target:
public void testControllerCallback_onAllowedCommandChanged() throws Exception { prepareLooper(); final CustomAction testCustomAction1 = new CustomAction.Builder("testCustomAction1", "testName1", 1).build(); final CustomAction testCustomAction2 = new CustomAction.Builder("testCustomAction2", "testName2", 2).build(); final CountDownLatch latch = new CountDownLatch(1); final ControllerCallback callback = new ControllerCallback() { @Override public void onAllowedCommandsChanged(MediaController2 controller, SessionCommandGroup2 commands) { assertFalse(commands.hasCommand(new SessionCommand2( testCustomAction1.getAction(), testCustomAction1.getExtras()))); assertTrue(commands.hasCommand(new SessionCommand2( testCustomAction2.getAction(), testCustomAction2.getExtras()))); latch.countDown(); } }; mSession.setPlaybackState(new PlaybackStateCompat.Builder() .addCustomAction(testCustomAction1).build()); mController = createController(mSession.getSessionToken(), true, callback); mSession.setPlaybackState(new PlaybackStateCompat.Builder() .addCustomAction(testCustomAction2).build()); assertTrue(latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)); }
Source:
<code>public void testGetAccount() throws Exception { MockWebServer server = new MockWebServer(); server.play(); URL url = server.getUrl(""); server.setDispatcher(getURLReplacingQueueDispatcher(url)); server.enqueue(new MockResponse().setResponseCode(200).setBody(access)); server.enqueue(defaultAccountMockResponse()); SwiftApi api = mockSwiftApi(server.getUrl("/").toString()); try { AccountApi accountApi = api.getAccountApiForRegion("DFW"); assertEquals(accountApi.get(), mockAccount()); assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1"); assertEquals(server.takeRequest().getRequestLine(), "HEAD /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/ HTTP/1.1"); <START> } finally { <END> server.shutdown(); } }</code><technical_language>this apply more code above? (the try block) bad java 7 constructs</technical_language>

Target:
public void testGetAccount() throws Exception { MockWebServer server = new MockWebServer(); server.play(); try { URL url = server.getUrl(""); server.setDispatcher(getURLReplacingQueueDispatcher(url)); server.enqueue(new MockResponse().setResponseCode(200).setBody(access)); server.enqueue(defaultAccountMockResponse()); SwiftApi api = mockSwiftApi(server.getUrl("/").toString()); AccountApi accountApi = api.getAccountApiForRegion("DFW"); assertEquals(accountApi.get(), mockAccount()); assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1"); assertEquals(server.takeRequest().getRequestLine(), "HEAD /v1/MossoCloudFS_5bcf396e-39dd-45ff-93a1-712b9aba90a9/ HTTP/1.1"); } finally { server.shutdown(); } }
Source:
<code><START> public void skipsOnStream() throws IOException { <END> final byte[] bytes = "skipsOnStream".getBytes(); final CapInputStream input = new CapInputStream( new ByteArrayInputStream(bytes), bytes.length ); final long skipped = input.skip(2); MatcherAssert.assertThat(skipped, Matchers.equalTo(2L)); }</code><technical_language>@rui-castro skipsOnStream was</technical_language>

Target:
public void skipsOnStream() throws Exception { final long skip = 25L; final InputStream stream = Mockito.mock(InputStream.class); final CapInputStream wrapper = new CapInputStream(stream, 50L); wrapper.skip(skip); Mockito.verify(stream, Mockito.times(1)).skip(skip); }
Source:
<code>public AbstractLayoutProvider() { <START> this.viewsToChangeBoundsRequest = new WeakHashMap<View, List<Request>>(); <END> }</code><technical_language>This field is exposed client code getViewsToChangeBoundsRequest(). Changing a WeakHashMap is a transparent operation, changes contract. Extract Javaodc "this class behaves differently other Map implementations.[...] familiar (though required) Map invariants do hold for this class. garbage collector discard keys time, a WeakHashMap behave unknown thread is silently removing entries". checked client code of data in this map is ready deal missing entries, handle correctly (not throwing NPE)</technical_language>

Target:
public AbstractLayoutProvider() { this.viewsToChangeBoundsRequest = new HashMap<View, List<Request>>(); }
Source:
<code>public SimplePagesHashStrategy( List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, List<Integer> hashChannels, OptionalInt precomputedHashChannel, Optional<Integer> sortChannel, FunctionRegistry functionRegistry, boolean groupByUsesEqualTo) { this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); this.channels = ImmutableList.copyOf(requireNonNull(channels, "channels is null")); checkArgument(types.size() == channels.size(), "Expected types and channels to be the same length"); this.hashChannels = ImmutableList.copyOf(requireNonNull(hashChannels, "hashChannels is null")); if (precomputedHashChannel.isPresent()) { this.precomputedHashChannel = channels.get(precomputedHashChannel.getAsInt()); } else { this.precomputedHashChannel = null; } this.sortChannel = requireNonNull(sortChannel, "sortChannel is null"); <START> this.functionRegistry = requireNonNull(functionRegistry, "functionRegistry is null"); <END> this.groupByUsesEqualTo = groupByUsesEqualTo; ImmutableMap.Builder<Type, MethodHandle> builder = ImmutableMap.builder(); for (Type type : new HashSet<>(types)) { Signature signature = functionRegistry.resolveOperator(OperatorType.IS_DISTINCT_FROM, ImmutableList.of(type, type)); MethodHandle methodHandle = functionRegistry.getScalarFunctionImplementation(signature).getMethodHandle(); builder.put(type, methodHandle); } methodHandles = builder.build(); }</code><technical_language>If I understand correctly, functionRegistry is in constructor need store a field member</technical_language>

Target:
public SimplePagesHashStrategy( List<Type> types, List<Integer> outputChannels, List<List<Block>> channels, List<Integer> hashChannels, OptionalInt precomputedHashChannel, Optional<Integer> sortChannel, FunctionRegistry functionRegistry, boolean groupByUsesEqualTo) { this.types = ImmutableList.copyOf(requireNonNull(types, "types is null")); this.outputChannels = ImmutableList.copyOf(requireNonNull(outputChannels, "outputChannels is null")); this.channels = ImmutableList.copyOf(requireNonNull(channels, "channels is null")); checkArgument(types.size() == channels.size(), "Expected types and channels to be the same length"); this.hashChannels = ImmutableList.copyOf(requireNonNull(hashChannels, "hashChannels is null")); if (precomputedHashChannel.isPresent()) { this.precomputedHashChannel = channels.get(precomputedHashChannel.getAsInt()); } else { this.precomputedHashChannel = null; } this.sortChannel = requireNonNull(sortChannel, "sortChannel is null"); requireNonNull(functionRegistry, "functionRegistry is null"); this.groupByUsesEqualTo = groupByUsesEqualTo; ImmutableList.Builder<MethodHandle> distinctFromMethodHandlesBuilder = ImmutableList.builder(); for (Type type : types) { distinctFromMethodHandlesBuilder.add( functionRegistry.getScalarFunctionImplementation(functionRegistry.resolveOperator(IS_DISTINCT_FROM, ImmutableList.of(type, type))).getMethodHandle()); } distinctFromMethodHandles = distinctFromMethodHandlesBuilder.build(); }
Source:
<code><START> private PortletDefinitionForm createNewPortletDefinitionForm() { <END> PortletDefinitionForm form = new PortletDefinitionForm(); final IEntityGroup portletCategoriesGroup = GroupService.getDistinguishedGroup(GroupService.PORTLET_CATEGORIES); form.addCategory(new JsonEntityBean(portletCategoriesGroup, groupListHelper.getEntityType(portletCategoriesGroup))); final IEntityGroup everyoneGroup = GroupService.getDistinguishedGroup(GroupService.EVERYONE); form.addGroup(new JsonEntityBean(everyoneGroup, groupListHelper.getEntityType(everyoneGroup))); form.addPermission(everyoneGroup.getName() + "_" + IPermission.PORTLET_SUBSCRIBER_ACTIVITY); form.addPermission(everyoneGroup.getName() + "_" + IPermission.PORTLET_BROWSE_ACTIVITY); return form; }</code><technical_language>this behavior pulled existing code refactored this method (good idea). existing interface behaves... it? Categories & groups empty, correct? (Just verified.)</technical_language>

Target:
private PortletDefinitionForm createNewPortletDefinitionForm() { PortletDefinitionForm form = new PortletDefinitionForm(); final IEntityGroup portletCategoriesGroup = GroupService.getDistinguishedGroup(GroupService.PORTLET_CATEGORIES); form.addCategory(new JsonEntityBean(portletCategoriesGroup, groupListHelper.getEntityType(portletCategoriesGroup))); final IEntityGroup everyoneGroup = GroupService.getDistinguishedGroup(GroupService.EVERYONE); JsonEntityBean everyoneBean = new JsonEntityBean(everyoneGroup, groupListHelper.getEntityType(everyoneGroup)); form.addPrincipal(everyoneBean); for (String activity : PORTLET_SUBSCRIBE_ACTIVITIES) { form.addPermission(everyoneBean.getTypeAndIdHash() + "_" + activity); } return form; }
Source:
<code>public ScriptHelper failOnNonZeroResultCode(boolean val) { <START> Predicate<Integer> onTrue = new Predicate<Integer>() { <END> @Override public boolean apply(Integer input) { return input == 0; } }; Predicate<Integer> onFalse = new Predicate<Integer>() { @Override public boolean apply(Integer input) { return true; } }; requireResultCode(val ? onTrue : onFalse); return this; }</code><technical_language>Predicates.equalTo(0)</technical_language>

Target:
public ScriptHelper failOnNonZeroResultCode(boolean val) { Predicate<Integer> onTrue = Predicates.equalTo(0); Predicate<Integer> onFalse = Predicates.alwaysTrue(); requireResultCode(val ? onTrue : onFalse); return this; }
Source:
<code>private static void ingest(String pid, Path payload) throws IOException { <START> if (!checkObjecsExist(pid)) { <END> String ingestURI = FEDORA_URI + "/objects/" + pid + "?format=info:fedora/fedora-system:FOXML-1.1&ignoreMime=true"; logger.debug("INGEST URI = {}", ingestURI); HttpPost ingest = new HttpPost(ingestURI); ingest.setEntity(new ByteArrayEntity(Files.readAllBytes(payload))); ingest.setHeader("Content-type", MediaType.TEXT_XML); try (CloseableHttpResponse pidRes = httpClient.execute(ingest)) { assertEquals("Failed to ingest " + pid + "!", SC_CREATED, pidRes.getStatusLine().getStatusCode()); logger.info("Ingested test object {}", EntityUtils.toString(pidRes.getEntity())); } } }</code><technical_language>This is a huge thing, want JUnit's Assume feature this check read a bit better</technical_language>

Target:
private static void ingest(String pid, Path payload) throws IOException { if (!checkObjectExist(pid)) { String ingestURI = FEDORA_URI + "/objects/" + pid + "?format=info:fedora/fedora-system:FOXML-1.1&ignoreMime=true"; logger.debug("INGEST URI = {}", ingestURI); HttpPost ingest = new HttpPost(ingestURI); ingest.setEntity(new ByteArrayEntity(Files.readAllBytes(payload))); ingest.setHeader("Content-type", MediaType.TEXT_XML); try (CloseableHttpResponse pidRes = httpClient.execute(ingest)) { assertEquals("Failed to ingest " + pid + "!", SC_CREATED, pidRes.getStatusLine().getStatusCode()); logger.info("Ingested test object {}", EntityUtils.toString(pidRes.getEntity())); } } }
Source:
<code>public void testSelectBestPoolsShouldSelectBothPoolsInStackWhenOneOfThemProvidesTheSpecifiedAddon() { Product product69 = new Product(); product69.setId("compliant-69"); Set<String> addons = new HashSet<>(); addons.add("One Addon"); consumer.setAddOns(addons); ConsumerInstalledProduct consumerInstalledProduct = new ConsumerInstalledProduct(product69); consumer.addInstalledProduct(consumerInstalledProduct); Product prodMCT1650 = createSysPurposeProduct(null, null, "One Addon,Other Addon", null, null); prodMCT1650.setAttribute(Product.Attributes.STACKING_ID, "bob"); prodMCT1650.setAttribute("multi-entitlement", "yes"); Pool MCT1650 = TestUtil.createPool(owner, prodMCT1650); MCT1650.setId("MCT1650"); MCT1650.setQuantity(1L); Product prodMCT80 = createSysPurposeProduct(null, null, null, null, null); prodMCT80.setAttribute(Product.Attributes.STACKING_ID, "bob"); prodMCT80.setAttribute("multi-entitlement", "yes"); Pool MCT80 = TestUtil.createPool(owner, prodMCT80); MCT80.setId("MCT80"); MCT80.setQuantity(1L); <START> MCT80.getProduct().addProvidedProduct(product69); <END> List<Pool> pools = new ArrayList<>(); pools.add(MCT1650); pools.add(MCT80); List<PoolQuantity> bestPools = autobindRules.selectBestPools(consumer, new String[]{"compliant-69"}, pools, compliance, null, new HashSet<>(), false); assertEquals(2, bestPools.size()); assertTrue(bestPools.contains(new PoolQuantity(MCT1650, 1))); assertTrue(bestPools.contains(new PoolQuantity(MCT80, 1))); }</code><technical_language>Add provided product product line 2208</technical_language>

Target:
public void testSelectBestPoolsShouldSelectBothPoolsInStackWhenOneOfThemProvidesTheSpecifiedAddon() { Product product69 = new Product(); product69.setId("compliant-69"); Set<String> addons = new HashSet<>(); addons.add("One Addon"); consumer.setAddOns(addons); ConsumerInstalledProduct consumerInstalledProduct = new ConsumerInstalledProduct(product69); consumer.addInstalledProduct(consumerInstalledProduct); Product prodMCT1650 = createSysPurposeProduct(null, null, "One Addon,Other Addon", null, null); prodMCT1650.setAttribute(Product.Attributes.STACKING_ID, "bob"); prodMCT1650.setAttribute("multi-entitlement", "yes"); Pool MCT1650 = TestUtil.createPool(owner, prodMCT1650); MCT1650.setId("MCT1650"); MCT1650.setQuantity(1L); Product prodMCT80 = createSysPurposeProduct(null, null, null, null, null); prodMCT80.setAttribute(Product.Attributes.STACKING_ID, "bob"); prodMCT80.setAttribute("multi-entitlement", "yes"); prodMCT80.addProvidedProduct(product69); Pool MCT80 = TestUtil.createPool(owner, prodMCT80); MCT80.setId("MCT80"); MCT80.setQuantity(1L); List<Pool> pools = new ArrayList<>(); pools.add(MCT1650); pools.add(MCT80); List<PoolQuantity> bestPools = autobindRules.selectBestPools(consumer, new String[]{"compliant-69"}, pools, compliance, null, new HashSet<>(), false); assertEquals(2, bestPools.size()); assertTrue(bestPools.contains(new PoolQuantity(MCT1650, 1))); assertTrue(bestPools.contains(new PoolQuantity(MCT80, 1))); }
Source:
<code>public static String getMatrixConstraint(UriInfo uriInfo, String constraint) { return getMatrixConstraints(uriInfo, constraint).containsKey(constraint) ? <START> getMatrixConstraints(uriInfo, constraint).get(constraint) : null; <END> }</code><technical_language>need fetch param</technical_language>

Target:
public static String getMatrixConstraint(UriInfo uriInfo, String constraint) { HashMap<String, String> constraints = getMatrixConstraints(uriInfo, constraint); return constraints.containsKey(constraint) ? constraints.get(constraint) : null; }
Source:
<code>public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (!(message instanceof EventMessage)) { String exceptionMessage = String.format( "Something else than an EventMessage was scheduled for Saga of type [%s], whilst Sagas can only handle EventMessages.", getSagaType() ); throw new IllegalArgumentException(exceptionMessage); } if (scopeDescription instanceof SagaDescriptor) { <START> sagaRepository.load(((SagaDescriptor) scopeDescription).getIdentifier().toString()) <END> .handle((EventMessage) message); } }</code><technical_language>note sagaRepository.load() return null, for example a Saga ended deadline occurred. In case, silently continue (and write a debug level log entry)</technical_language>

Target:
public void send(Message<?> message, ScopeDescriptor scopeDescription) throws Exception { if (!(message instanceof EventMessage)) { String exceptionMessage = String.format( "Something else than an EventMessage was scheduled for Saga of type [%s], whilst Sagas can only handle EventMessages.", getSagaType() ); throw new IllegalArgumentException(exceptionMessage); } if (canResolve(scopeDescription)) { String sagaIdentifier = ((SagaScopeDescriptor) scopeDescription).getIdentifier().toString(); Saga<T> saga = sagaRepository.load(sagaIdentifier); if (saga != null) { saga.handle((EventMessage) message); } else { logger.debug("Saga (with id: [{}]) cannot be loaded, as it most likely already ended." + " Hence, message cannot be handled.", sagaIdentifier, message); } } }
Source:
<code>public void onCreate() { super.onCreate(); this.wifiBroadcastReceiver = new WifiBroadcastReceiver(this); com.alive_n_clickin.waft.application.NearbyBusScanner nearbyBusScanner = new com.alive_n_clickin.waft.application.NearbyBusScanner(wifiBroadcastReceiver, this.getApplicationContext()); <START> this.manager = new com.alive_n_clickin.waft.application.Manager(nearbyBusScanner); <END> }</code><technical_language>Full name</technical_language>

Target:
public void onCreate() { super.onCreate(); this.wifiBroadcastReceiver = new WifiBroadcastReceiver(this); NearbyBusScanner nearbyBusScanner = new NearbyBusScanner(wifiBroadcastReceiver, this.getApplicationContext()); this.manager = new Manager(nearbyBusScanner); }
Source:
<code>public TcpCommunicationMetricsListener(GridMetricManager mmgr) { this.mmgr = mmgr; mreg = mmgr.registry(COMMUNICATION_METRICS_GROUP_NAME); sentMsgsCntByTypeMetricFactory = directType -> mreg.longAdderMetric( sentMessagesByTypeMetricName(directType), SENT_MESSAGES_BY_TYPE_METRIC_DESC ); rcvdMsgsCntByTypeMetricFactory = directType -> mreg.longAdderMetric( receivedMessagesByTypeMetricName(directType), RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC ); <START> sentMsgsCntByNodeIdMetricFactory = nodeId -> mmgr.registry(COMMUNICATION_METRICS_GROUP_NAME + "." + nodeId) <END> .longAdderMetric( SENT_MESSAGES_BY_NODE_ID_METRIC_NAME, SENT_MESSAGES_BY_NODE_ID_METRIC_DESC ); rcvdMsgsCntByNodeIdMetricFactory = nodeId -> mmgr.registry(COMMUNICATION_METRICS_GROUP_NAME + "." + nodeId) .longAdderMetric( RECEIVED_MESSAGES_BY_NODE_ID_METRIC_NAME, RECEIVED_MESSAGES_BY_NODE_ID_METRIC_DESC ); sentBytesMetric = mreg.longAdderMetric(SENT_BYTES_METRIC_NAME, SENT_BYTES_METRIC_DESC); rcvdBytesMetric = mreg.longAdderMetric(RECEIVED_BYTES_METRIC_NAME, RECEIVED_BYTES_METRIC_DESC); sentMsgsMetric = mreg.longAdderMetric(SENT_MESSAGES_METRIC_NAME, SENT_MESSAGES_METRIC_DESC); rcvdMsgsMetric = mreg.longAdderMetric(RECEIVED_MESSAGES_METRIC_NAME, RECEIVED_MESSAGES_METRIC_DESC); }</code><technical_language>MetricUtils#metricName instead of COMMUNICATION_METRICS_GROUP_NAME + "." + nodeId</technical_language>

Target:
public TcpCommunicationMetricsListener(GridMetricManager mmgr) { this.mmgr = mmgr; mreg = mmgr.registry(COMMUNICATION_METRICS_GROUP_NAME); sentMsgsCntByTypeMetricFactory = directType -> mreg.longAdderMetric( sentMessagesByTypeMetricName(directType), SENT_MESSAGES_BY_TYPE_METRIC_DESC ); rcvdMsgsCntByTypeMetricFactory = directType -> mreg.longAdderMetric( receivedMessagesByTypeMetricName(directType), RECEIVED_MESSAGES_BY_TYPE_METRIC_DESC ); sentMsgsCntByNodeIdMetricFactory = nodeId -> mmgr.registry(metricName(COMMUNICATION_METRICS_GROUP_NAME, nodeId.toString())) .findMetric(SENT_MESSAGES_BY_NODE_ID_METRIC_NAME); rcvdMsgsCntByNodeIdMetricFactory = nodeId -> mmgr.registry(metricName(COMMUNICATION_METRICS_GROUP_NAME, nodeId.toString())) .findMetric(RECEIVED_MESSAGES_BY_NODE_ID_METRIC_NAME); sentBytesMetric = mreg.longAdderMetric(SENT_BYTES_METRIC_NAME, SENT_BYTES_METRIC_DESC); rcvdBytesMetric = mreg.longAdderMetric(RECEIVED_BYTES_METRIC_NAME, RECEIVED_BYTES_METRIC_DESC); sentMsgsMetric = mreg.longAdderMetric(SENT_MESSAGES_METRIC_NAME, SENT_MESSAGES_METRIC_DESC); rcvdMsgsMetric = mreg.longAdderMetric(RECEIVED_MESSAGES_METRIC_NAME, RECEIVED_MESSAGES_METRIC_DESC); mmgr.addMetricRegistryCreationListener(mreg -> { if (!mreg.name().startsWith(COMMUNICATION_METRICS_GROUP_NAME + SEPARATOR)) return; mreg.longAdderMetric(SENT_MESSAGES_BY_NODE_ID_METRIC_NAME, SENT_MESSAGES_BY_NODE_ID_METRIC_DESC); mreg.longAdderMetric(RECEIVED_MESSAGES_BY_NODE_ID_METRIC_NAME, RECEIVED_MESSAGES_BY_NODE_ID_METRIC_DESC); }); }
Source:
<code>public void compensate() { RemoveImageParameters removeImageParams = new RemoveImageParameters(enclosingCommand.getParameters().getImageGroupID()); removeImageParams.setStorageDomainId(enclosingCommand.getParameters().getStorageDomainId()); removeImageParams.setParentCommand(VdcActionType.RemoveImage); removeImageParams.setDbOperationScope(ImageDbOperationScope.NONE); removeImageParams.setShouldLockImage(false); removeImageParams.setEntityInfo(new EntityInfo(VdcObjectType.Disk, Guid.newGuid())); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction( VdcActionType.RemoveImage, removeImageParams, ExecutionHandler.createInternalJobContext()); ExecutionHandler.setAsyncJob(enclosingCommand.getExecutionContext(), true); <START> enclosingCommand.getReturnValue().setSucceeded(true); <END> }</code><technical_language>reminder: DeleteImageGroup extract revertTask</technical_language>

Target:
public void compensate() { revertTask(); }
Source:
<code>public void testTriggerGCService() throws Exception { baseConf.setMetadataServiceUri(zkUtil.getMetadataServiceUri()); BookKeeper.DigestType digestType = BookKeeper.DigestType.CRC32; int numLedgers = 4; int numMsgs = 100; LedgerHandle[] lh = new LedgerHandle[numLedgers]; for (int i = 0; i < numLedgers; i++) { lh[i] = bkc.createLedger(digestType, "".getBytes()); } String content = "Apache BookKeeper is cool!"; for (int i = 0; i < numMsgs; i++) { for (int j = 0; j < numLedgers; j++) { lh[j].addEntry(content.getBytes()); } } for (int i = 0; i < numLedgers; i++) { lh[i].close(); } HttpEndpointService triggerGCService = bkHttpServiceProvider .provideHttpEndpointService(HttpServer.ApiType.GC); HttpServiceRequest request1 = new HttpServiceRequest(null, HttpServer.Method.GET, null); HttpServiceResponse response1 = triggerGCService.handle(request1); <START> assertEquals(HttpServer.StatusCode.OK.getValue(), response1.getStatusCode()); <END> assertTrue(response1.getBody().contains("false")); HttpServiceRequest request2 = new HttpServiceRequest(null, HttpServer.Method.PUT, null); HttpServiceResponse response2 = triggerGCService.handle(request2); assertEquals(HttpServer.StatusCode.OK.getValue(), response2.getStatusCode()); }</code><technical_language>"equals" instead of "contains" assertion more explicit</technical_language>

Target:
public void testTriggerGCService() throws Exception { baseConf.setMetadataServiceUri(zkUtil.getMetadataServiceUri()); BookKeeper.DigestType digestType = BookKeeper.DigestType.CRC32; int numLedgers = 4; int numMsgs = 100; LedgerHandle[] lh = new LedgerHandle[numLedgers]; for (int i = 0; i < numLedgers; i++) { lh[i] = bkc.createLedger(digestType, "".getBytes()); } String content = "Apache BookKeeper is cool!"; for (int i = 0; i < numMsgs; i++) { for (int j = 0; j < numLedgers; j++) { lh[j].addEntry(content.getBytes()); } } for (int i = 0; i < numLedgers; i++) { lh[i].close(); } HttpEndpointService triggerGCService = bkHttpServiceProvider .provideHttpEndpointService(HttpServer.ApiType.GC); HttpServiceRequest request1 = new HttpServiceRequest(null, HttpServer.Method.GET, null); HttpServiceResponse response1 = triggerGCService.handle(request1); assertEquals(HttpServer.StatusCode.OK.getValue(), response1.getStatusCode()); assertTrue(response1.getBody().contains("\"is_in_force_gc\" : \"false\"")); HttpServiceRequest request2 = new HttpServiceRequest(null, HttpServer.Method.PUT, null); HttpServiceResponse response2 = triggerGCService.handle(request2); assertEquals(HttpServer.StatusCode.OK.getValue(), response2.getStatusCode()); }
Source:
<code>public String getString (String name, String def) { String value = (String)_data.get(name); <START> return StringUtil.isBlank(value) ? def : value; <END> }</code><technical_language>This is another behavioral change I want in unrelated PR</technical_language>

Target:
public String getString (String name, String def) { String value = (String)_data.get(name); return value == null ? def : value; }
Source:
<code>public void processWorkbenchLog(String config, String className, String logDescription) { File logFile = Platform.getWorkbenchLog(); if(logFile != null && logFile.exists()){ <START> try (BufferedReader br = new BufferedReader(new FileReader(Platform.getWorkbenchLog())); <END> BufferedWriter bw = new BufferedWriter(new FileWriter(getLogFile(config, className), true))) { String line = br.readLine(); if (line != null) { bw.write(logDescription + "\n\n"); bw.write(line + "\n"); while ((line = br.readLine()) != null) { bw.write(line + "\n"); } bw.write("\n\n"); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } else { log.debug("Log file does not exist"); } }</code><technical_language>reuse logFile in FileReader</technical_language>

Target:
public void processWorkbenchLog(String config, String className, String logDescription) { if(eclipseLogFileExists()){ try (BufferedReader br = new BufferedReader(new FileReader(Platform.getWorkbenchLog())); BufferedWriter bw = new BufferedWriter(new FileWriter(getLogFile(config, className), true))) { String line = br.readLine(); if (line != null) { bw.write(logDescription + "\n\n"); bw.write(line + "\n"); while ((line = br.readLine()) != null) { bw.write(line + "\n"); } bw.write("\n\n"); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } else { log.debug("Log file does not exist"); } }
Source:
<code>public void testDefaults() { assertRecordedDefaults(ConfigAssertions.recordDefaults(DbResourceGroupConfig.class) .setConfigDbUrl(null) .setMaxRefreshInterval(new Duration(1, HOURS)) <START> .setReloadRefreshInterval(new Duration(1, SECONDS)) <END> .setExactMatchSelectorEnabled(false)); }</code><technical_language>this compile</technical_language>

Target:
public void testDefaults() { assertRecordedDefaults(ConfigAssertions.recordDefaults(DbResourceGroupConfig.class) .setConfigDbUrl(null) .setMaxRefreshInterval(new Duration(1, HOURS)) .setExactMatchSelectorEnabled(false)); }
Source:
<code>public int getEurekaServiceUrlPollIntervalSeconds() { return configInstance.getIntProperty( <START> namespace + "serviceUrlPollIntervalSeconds", 5 * 60).get(); <END> }</code><technical_language>I this property name convert seconds</technical_language>

Target:
public int getEurekaServiceUrlPollIntervalSeconds() { return configInstance.getIntProperty( namespace + "serviceUrlPollIntervalMs", 5 * 60 * 1000).get() / 1000; }
Source:
<code>protected void fetchGitHubRepository(@NonNull Integer repositoryId) { Preconditions.checkNotNull(repositoryId, "Repository Id cannot be null."); Intent intent = new Intent(); intent.putExtra("serviceUriString", GitHubService.REPOSITORY.toString()); intent.putExtra("id", repositoryId); <START> fetcherManager.findFetcher(GitHubService.REPOSITORY).fetch(intent); <END> }</code><technical_language>findFetcher return null. Do want add some assertions here</technical_language>

Target:
protected void fetchGitHubRepository(@NonNull Integer repositoryId) { Preconditions.checkNotNull(repositoryId, "Repository Id cannot be null."); Intent intent = new Intent(); intent.putExtra("serviceUriString", GitHubService.REPOSITORY.toString()); intent.putExtra("id", repositoryId); Fetcher<Uri> fetcher = fetcherManager.findFetcher(GitHubService.REPOSITORY); if (fetcher != null) { fetcher.fetch(intent); } }
Source:
<code>private static void doDropdownMenu(String redir, String page, String tableName, StringBuilder sb, SortedMap<String,String> namespaces, String namespace) { String namespaceUrl = String.format("/op?action=namespace&redir=%s&page=%s&table=%s&selected=", redir, page, tableName); sb.append("<ul id=\"namespaces\">\n"); <START> sb.append("<li><a ").append(namespace.equals("*") ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl).append("*\">*</a></li>"); <END> for (String key : namespaces.keySet()) { if (key.equals("")) { sb.append("<li><a ").append(namespace.equals("-") ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl).append("-\">-</a></li>"); } else { sb.append("<li><a ").append(namespace.equals(key) ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl).append(key).append("\">") .append(key).append("</a></li>"); } } sb.append("</ul>\n"); }</code><technical_language>* is a confusing own. add this tables</technical_language>

Target:
private static void doDropdownMenu(String redir, String page, String tableName, StringBuilder sb, SortedMap<String,String> namespaces, String namespace) { String namespaceUrl = String.format("/op?action=namespace&redir=%s&page=%s&table=%s&selected=", redir, page, tableName); sb.append("<ul id=\"namespaces\">\n"); sb.append("<li><a ").append(namespace.equals("*") ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl) .append("*\">*&nbsp;(All&nbsp;Tables)</a></li>"); for (String key : namespaces.keySet()) { if (key.equals("")) { sb.append("<li><a ").append(namespace.equals("-") ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl) .append("-\">-&nbsp;(DEFAULT)</a></li>"); } else { sb.append("<li><a ").append(namespace.equals(key) ? "class=\"active\" " : "").append("href=\"").append(namespaceUrl).append(key).append("\">") .append(key).append("</a></li>"); } } sb.append("</ul>\n"); }
Source:
<code>public void testAddPackagesToWhiteList() throws Exception { final WhiteList whiteList = new WhiteList(); grid.setDependencies( new POM(), whiteList ); final HashSet<String> packages = new HashSet<String>(); packages.add( "org.drools" ); packages.add( "org.guvnor" ); assertEquals( 0, whiteList.size() ); <START> grid.onAddAll( packages ); <END> }</code><technical_language>a missing assert here</technical_language>

Target:
public void testAddPackagesToWhiteList() throws Exception { final WhiteList whiteList = new WhiteList(); grid.setDependencies( new POM(), whiteList ); final HashSet<String> packages = new HashSet<String>(); packages.add( "org.drools" ); packages.add( "org.guvnor" ); assertEquals( 0, whiteList.size() ); grid.onAddAll( packages ); assertEquals( 2, whiteList.size() ); }
Source:
<code>final <T> CompletableFuture<T> checkInvocationAllowedFuture() { ComponentStatus status = cache.getStatus(); if (!status.allowInvocations()) { return completedExceptionFuture(new CacheException("Cache is stopping or terminated: " + status)); <START> } <END> return null; }</code><technical_language>IllegalLifecycleStateException logged error</technical_language>

Target:
final <T> CompletableFuture<T> checkInvocationAllowedFuture() { ComponentStatus status = cache.getStatus(); if (!status.allowInvocations()) { return completedExceptionFuture(new IllegalLifecycleStateException("Cache is stopping or terminated: " + status)); } return null; }
Source:
<code>private void broadcast(String noteId, Message m) { <START> List<NotebookSocket> socketsToBroadcast; <END> synchronized (noteSocketMap) { broadcastToWatchers(noteId, StringUtils.EMPTY, m); List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } socketsToBroadcast = new ArrayList<>(socketLists); } LOG.debug("SEND >> " + m); for (NotebookSocket conn : socketsToBroadcast) { try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } }</code><technical_language>this initialized empty list, I think</technical_language>

Target:
private void broadcast(String noteId, Message m) { List<NotebookSocket> socketsToBroadcast = Collections.emptyList(); synchronized (noteSocketMap) { broadcastToWatchers(noteId, StringUtils.EMPTY, m); List<NotebookSocket> socketLists = noteSocketMap.get(noteId); if (socketLists == null || socketLists.size() == 0) { return; } socketsToBroadcast = new ArrayList<>(socketLists); } LOG.debug("SEND >> " + m); for (NotebookSocket conn : socketsToBroadcast) { try { conn.send(serializeMessage(m)); } catch (IOException e) { LOG.error("socket error", e); } } }
Source:
<code>public List<HistoryMessage> getMessage(String text) { if (text == null || "".equals(text)) { for (HistoryMessage message : messages) { message.setBody(message.getBody().toLowerCase().replaceAll("#ffff00","#ffffff")); } return messages; } else { List<HistoryMessage> searchResult = new ArrayList<>(); int iter = 0; HistoryMessage previous = null; for(HistoryMessage message : messages) { iter++; if (message.getBody().toLowerCase().contains(text.toLowerCase())) { message.setBody(message.getBody().toLowerCase().replaceAll(text.toLowerCase(), "<span style=\"background-color: #ffff00\">" + text.toLowerCase() + "</span>")); <START> if (previous != null) searchResult.add(previous); <END> searchResult.add(message); if (iter + 1 != messages.size()) { searchResult.add(messages.get(iter + 1)); } } previous = message; } return searchResult; } }</code><technical_language>Please wrap if-statements, if line. wrapping for easy mistakes</technical_language>

Target:
public List<HistoryMessage> getMessage(String text) { if (text == null || "".equals(text)) { return messages; } else { List<HistoryMessage> searchResult = new ArrayList<>(); int iter = 0; HistoryMessage previous = null; for(HistoryMessage message : messages) { iter++; if (message.getBody().toLowerCase().contains(text.toLowerCase())) { if (previous != null) { searchResult.add(previous); } searchResult.add(message); if (iter + 1 != messages.size()) { searchResult.add(messages.get(iter + 1)); } } previous = message; } return searchResult; } }
Source:
<code><START> public void requestHandleWithGoodInputTestWithKeepAlive() throws Exception { <END> doRequestHandleWithKeepAliveTest(HttpMethod.POST, "POST"); doRequestHandleWithKeepAliveTest(HttpMethod.GET, "GET"); doRequestHandleWithKeepAliveTest(HttpMethod.DELETE, "DELETE"); }</code><technical_language>test method for plainText SSL</technical_language>

Target:
public void requestHandleWithGoodInputTestWithKeepAlive() throws Exception { doRequestHandleWithKeepAliveTest(HttpMethod.POST, "POST", false); doRequestHandleWithKeepAliveTest(HttpMethod.GET, "GET", false); doRequestHandleWithKeepAliveTest(HttpMethod.DELETE, "DELETE", false); doRequestHandleWithKeepAliveTest(HttpMethod.POST, "POST", true); doRequestHandleWithKeepAliveTest(HttpMethod.GET, "GET", true); doRequestHandleWithKeepAliveTest(HttpMethod.DELETE, "DELETE", true); }
Source:
<code>public WordEmbeddingDictionary(String indexPath) throws Exception { <START> this.indexPath = Paths.get(indexPath); <END> if (!Files.exists(this.indexPath)) { Files.createDirectories(this.indexPath); } this.directory = FSDirectory.open(this.indexPath); this.reader = DirectoryReader.open(directory); }</code><technical_language>more specific Exception - IOException</technical_language>

Target:
public WordEmbeddingDictionary(String indexPath) throws IOException { this.indexPath = Paths.get(indexPath); this.directory = FSDirectory.open(this.indexPath); this.reader = DirectoryReader.open(directory); this.searcher = new IndexSearcher(reader); this.analyzer = new WhitespaceAnalyzer(); }
Source:
<code>public Relationship(final Structure parentStructure, final Structure childStructure, final String parentRelationName, final String childRelationName, final int cardinality, final boolean parentRequired, final boolean childRequired) { super(); this.setType("relationship"); final boolean isManyToOne = cardinality == MANY_TO_ONE.ordinal(); <START> if (isManyToOne){ <END> this.parentStructureInode = childStructure.getInode(); this.childStructureInode = parentStructure.getInode(); this.parentRelationName = childRelationName; this.childRelationName = parentRelationName; this.cardinality = ONE_TO_MANY.ordinal(); this.parentRequired = childRequired; this.childRequired = parentRequired; } else{ this.parentStructureInode = parentStructure.getInode(); this.childStructureInode = childStructure.getInode(); this.parentRelationName = isManyToOne ? childRelationName: parentRelationName; this.childRelationName = isManyToOne ? parentRelationName: childRelationName; this.cardinality = isManyToOne ? ONE_TO_MANY.ordinal() : cardinality; this.parentRequired = parentRequired; this.childRequired = childRequired; } this.relationTypeValue = parentRelationName.replaceAll(" ", "_") + "-" + childRelationName .replaceAll(" ", "_"); }</code><technical_language>this is a good place for a strategy</technical_language>

Target:
public Relationship(final Structure parentStructure, final Structure childStructure, final String parentRelationName, final String childRelationName, final int cardinality, final boolean parentRequired, final boolean childRequired) { super(); this.setType("relationship"); this.parentStructureInode = parentStructure.getInode(); this.childStructureInode = childStructure.getInode(); this.parentRelationName = parentRelationName; this.childRelationName = childRelationName; this.cardinality = cardinality; this.parentRequired = parentRequired; this.childRequired = childRequired; this.relationTypeValue = parentRelationName.replaceAll(" ", "_") + "-" + childRelationName .replaceAll(" ", "_"); final RelationshipConstructionStrategy strategy = new RelationshipStrategyFactory() .getRelationshipConstructionStrategy(cardinality == MANY_TO_ONE.ordinal()); strategy.apply(this); }
Source:
<code>public static String readResourceFully(@Nonnull String fileName, @Nonnull String encoding) throws IOException { InputStream smaliStream = <START> LambdaTest.class.getClassLoader(). <END> getResourceAsStream(fileName); if (smaliStream == null) { Assert.fail("Could not load " + fileName); } return new String(ByteStreams.toByteArray(smaliStream), encoding); }</code><technical_language>if wanted leave this hardcoded</technical_language>

Target:
public static String readResourceFully(@Nonnull String fileName, @Nonnull String encoding) throws IOException { InputStream smaliStream = RoundtripTest.class.getClassLoader(). getResourceAsStream(fileName); if (smaliStream == null) { Assert.fail("Could not load " + fileName); } return new String(ByteStreams.toByteArray(smaliStream), encoding); }
Source:
<code><START> public boolean equals(Object o) { <END> if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SyncNuageVspCmsIdAnswer that = (SyncNuageVspCmsIdAnswer) o; if (_success != that._success) return false; if (_nuageVspCmsId != null ? !_nuageVspCmsId.equals(that._nuageVspCmsId) : that._nuageVspCmsId != null) return false; if (_syncType != that._syncType) return false; return true; }</code><technical_language>This equals implementation include attributes Answer super class</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SyncNuageVspCmsIdAnswer)) return false; if (!super.equals(o)) return false; SyncNuageVspCmsIdAnswer that = (SyncNuageVspCmsIdAnswer) o; if (_success != that._success) return false; if (_nuageVspCmsId != null ? !_nuageVspCmsId.equals(that._nuageVspCmsId) : that._nuageVspCmsId != null) return false; if (_syncType != that._syncType) return false; return true; }
Source:
<code>public void testLiteralIf() throws Exception { final DefaultConfiguration configurationTestLiteralIf = createCheckConfig(WhitespaceAfterCheck.class); configurationTestLiteralIf.addAttribute("tokens", "LITERAL_IF"); final String[] expected = { "18:11: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "if"), }; <START> verify(configurationTestLiteralIf, getPath("InputWhitespaceAfterConditions.java"), <END> expected); }</code><technical_language>Please separate input file for test</technical_language>

Target:
public void testLiteralIf() throws Exception { final DefaultConfiguration configurationTestLiteralIf = createCheckConfig(WhitespaceAfterCheck.class); configurationTestLiteralIf.addAttribute("tokens", "LITERAL_IF"); final String[] expected = { "18:11: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "if"), }; verify(configurationTestLiteralIf, getPath("InputWhitespaceAfterLiteralIf.java"), expected); }
Source:
<code>public List<DocumentRevision> getDocumentsWithIds(final List<String> docIds) throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); Misc.checkNotNull(docIds, "Input document id list"); try { return get (queue.submit(new GetDocumentsWithIdsCallable(docIds, attachmentsDir, attachmentStreamFactory))); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to get documents with ids", e); <START> throw new DocumentStoreException("Failed to get documents with ids", e); <END> } }</code><technical_language>nice style other cases put message in a local variable for log message exception message</technical_language>

Target:
public List<DocumentRevision> getDocumentsWithIds(final List<String> docIds) throws DocumentStoreException { Misc.checkState(this.isOpen(), "Database is closed"); Misc.checkNotNull(docIds, "Input document id list"); try { return get (queue.submit(new GetDocumentsWithIdsCallable(docIds, attachmentsDir, attachmentStreamFactory))); } catch (ExecutionException e) { String message = "Failed to get documents with ids"; logger.log(Level.SEVERE, message, e); throw new DocumentStoreException(message, e); } }
Source:
<code>public static SpecificationCollection create(List<File> specificationFiles) { if (specificationFiles == null) { return null; } MultiMap<OperationSignature, Method> signatureMap = new MultiMap<>(); Map<AccessibleObject, OperationSpecification> specificationMap = new LinkedHashMap<>(); for (File specificationFile : specificationFiles) { List<OperationSpecification> specificationList; try { specificationList = readSpecifications(specificationFile); } catch (IOException e) { String msg = "Unable to read specifications from file"; if (Log.isLoggingOn()) { Log.logLine(msg + ": " + specificationFile); } throw new RandoopConditionError(msg, e); } catch (Throwable e) { throw new RandoopConditionError("Bad input", e); } for (OperationSpecification specification : specificationList) { OperationSignature operation = specification.getOperation(); if (operation == null) { continue; } if (specification.getIdentifiers().hasDuplicatedName()) { String msg = String.format( <START> "Ignoring specification with identifier name conflict: %s", <END> specification.getOperation().toString()); System.out.println(msg); if (Log.isLoggingOn()) { Log.logLine(msg); } continue; } AccessibleObject accessibleObject = getAccessibleObject(operation); specificationMap.put(accessibleObject, specification); if (accessibleObject instanceof Method) { OperationSignature signature = OperationSignature.of(accessibleObject); signatureMap.add(signature, (Method) accessibleObject); } } } Map<AccessibleObject, Set<Method>> parentMap = buildParentMap(signatureMap); return new SpecificationCollection(specificationMap, signatureMap, parentMap); }</code><technical_language>this is illegal user input, I halt Randoop leaving a user a spec (if, likely, user notice this in Randoop output</technical_language>

Target:
public static SpecificationCollection create(List<File> specificationFiles) { if (specificationFiles == null) { return null; } MultiMap<OperationSignature, Method> signatureToMethods = new MultiMap<>(); Map<AccessibleObject, OperationSpecification> specificationMap = new LinkedHashMap<>(); for (File specificationFile : specificationFiles) { List<OperationSpecification> specificationList = readSpecificationFile(specificationFile); try { for (OperationSpecification specification : specificationList) { OperationSignature operation = specification.getOperation(); if (operation == null) { throw new Error("operation is null for specification " + specification); } if (specification.getIdentifiers().hasDuplicatedName()) { throw new RandoopConditionError( "Duplicate name in specification: " + specification.getOperation()); } AccessibleObject accessibleObject = getAccessibleObject(operation); specificationMap.put(accessibleObject, specification); if (accessibleObject instanceof Method) { OperationSignature signature = OperationSignature.of(accessibleObject); signatureToMethods.add(signature, (Method) accessibleObject); } } } catch (RandoopConditionError e) { e.setFile(specificationFile); throw e; } } Map<AccessibleObject, Set<Method>> overridden = buildOverridingMap(signatureToMethods); return new SpecificationCollection(specificationMap, signatureToMethods, overridden); }