auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void canCreateAllPopularImageVM() { if (skipInPlayback()) { return; } rgName = generateRandomResourceName("rg", 10); List<Mono<VirtualMachine>> vmFluxes = new ArrayList<>(); for (KnownWindowsVirtualMachineImage image : KnownWindowsVirtualMachineImage.values()) { Mono<VirtualMachine> flux = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularWindowsImage(image) .withAdminUsername("testUser") .withAdminPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmFluxes.add(flux); } for (KnownLinuxVirtualMachineImage image : KnownLinuxVirtualMachineImage.values()) { Mono<VirtualMachine> flux = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularLinuxImage(image) .withRootUsername("testUser") .withRootPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmFluxes.add(flux); } Flux.merge(vmFluxes).blockLast(); }

Target:
public void canCreateAllPopularImageVM() { if (skipInPlayback()) { return; } rgName = generateRandomResourceName("rg", 10); List<Mono<VirtualMachine>> vmMonos = new ArrayList<>(); for (KnownWindowsVirtualMachineImage image : KnownWindowsVirtualMachineImage.values()) { Mono<VirtualMachine> mono = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularWindowsImage(image) .withAdminUsername("testUser") .withAdminPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmMonos.add(mono); } for (KnownLinuxVirtualMachineImage image : KnownLinuxVirtualMachineImage.values()) { Mono<VirtualMachine> mono = computeManager.virtualMachines() .define(generateRandomResourceName("vm", 10)) .withRegion(Region.US_SOUTH_CENTRAL) .withNewResourceGroup(rgName) .withNewPrimaryNetwork("10.0.0.0/24") .withPrimaryPrivateIPAddressDynamic() .withoutPrimaryPublicIPAddress() .withPopularLinuxImage(image) .withRootUsername("testUser") .withRootPassword(password()) .withSize(VirtualMachineSizeTypes.STANDARD_B1S) .createAsync(); vmMonos.add(mono); } Flux.merge(vmMonos).blockLast(); }
Source:
public void testRemoveWithHostName() throws Exception { setUpGetEntityExpectations(); VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), control.createMock(RpmVersion.class), 1); setUpGetEntityExpectations("Hosts: name=" + NAMES[1], SearchType.VDS, host); setUriInfo(setUpActionExpectations(VdcActionType.RemoveStorageDomain, RemoveStorageDomainParameters.class, new String[] { "StorageDomainId", "VdsId", "DoFormat" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }, true, true)); StorageDomain storageDomain = new StorageDomain(); storageDomain.setHost(new Host()); storageDomain.getHost().setName(NAMES[1]); verifyRemove(collection.remove(GUIDS[0].toString(), storageDomain)); }

Target:
public void testRemoveWithHostName() throws Exception { setUpGetEntityExpectations(); VDS host = BackendHostsResourceTest.setUpEntityExpectations(control.createMock(VDS.class), 1); setUpGetEntityExpectations("Hosts: name=" + NAMES[1], SearchType.VDS, host); setUriInfo(setUpActionExpectations(VdcActionType.RemoveStorageDomain, RemoveStorageDomainParameters.class, new String[] { "StorageDomainId", "VdsId", "DoFormat" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }, true, true)); StorageDomain storageDomain = new StorageDomain(); storageDomain.setHost(new Host()); storageDomain.getHost().setName(NAMES[1]); verifyRemove(collection.remove(GUIDS[0].toString(), storageDomain)); }
Source:
private Set<LoadBalancer> createLoadBalancers(StackV4Request source, Stack stack, DetailedEnvironmentResponse environment) { LOGGER.info("Setting up load balancers for stack {}", source.getName()); Set<LoadBalancer> loadBalancers = new HashSet<>(); Optional<TargetGroup> knoxTargetGroup = setupKnoxTargetGroup(stack); if (knoxTargetGroup.isPresent()) { if (shouldCreateInternalKnoxLoadBalancer(source.getType())) { setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.DEFAULT_GATEWAY, stack), knoxTargetGroup.get()); } if (shouldCreateExternalKnoxLoadBalancer(source.getType(), environment.getNetwork())) { setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.ENDPOINT_ACCESS_GATEWAY, stack), knoxTargetGroup.get()); } } return loadBalancers; }

Target:
private Set<LoadBalancer> createLoadBalancers(StackV4Request source, Stack stack, DetailedEnvironmentResponse environment) { LOGGER.info("Setting up load balancers for stack {}", source.getName()); Set<LoadBalancer> loadBalancers = new HashSet<>(); Optional<TargetGroup> knoxTargetGroup = setupKnoxTargetGroup(stack); if (knoxTargetGroup.isPresent()) { if (shouldCreateInternalKnoxLoadBalancer(source.getType())) { LOGGER.debug("Found Knox enabled instance groups in stack. Setting up internal Knox load balancer"); setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.DEFAULT_GATEWAY, stack), knoxTargetGroup.get()); } if (shouldCreateExternalKnoxLoadBalancer(source.getType(), environment.getNetwork())) { LOGGER.debug("Public endpoint access gateway is enabled. Setting up public Knox load balancer"); setupKnoxLoadBalancer( createLoadBalancerIfNotExists(loadBalancers, LoadBalancerType.ENDPOINT_ACCESS_GATEWAY, stack), knoxTargetGroup.get()); } } else { LOGGER.debug("No Knox instance groups found. If load balancer creation is enabled, Knox routing in the load balancer will be skipped."); } return loadBalancers; }
Source:
private void postReload(Request req, Response resp) throws IOException { ClassLoader webLoader = req.getContext().getLoader().getClassLoader(); if (webLoader instanceof NuxeoDevWebappClassLoader) { NuxeoDevWebappClassLoader loader = (NuxeoDevWebappClassLoader) webLoader; DevFrameworkBootstrap bootstrap = loader.getBootstrap(); String devBundlesLocation = bootstrap.getDevBundlesLocation(); try { Files.copy(req.getStream(), Paths.get(devBundlesLocation), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { resp.sendError(500, "Unable to write to dev.bundles"); } bootstrap.loadDevBundles(); } resp.setStatus(200); }

Target:
private void postReload(Request req, Response resp) throws IOException { ClassLoader webLoader = req.getContext().getLoader().getClassLoader(); if (webLoader instanceof NuxeoDevWebappClassLoader) { NuxeoDevWebappClassLoader loader = (NuxeoDevWebappClassLoader) webLoader; DevFrameworkBootstrap bootstrap = loader.getBootstrap(); String devBundlesLocation = bootstrap.getDevBundlesLocation(); try { Files.copy(req.getStream(), Paths.get(devBundlesLocation), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { log.error("Unable to write to dev.bundles", e); resp.sendError(500, "Unable to write to dev.bundles"); } bootstrap.loadDevBundles(); } resp.setStatus(200); }
Source:
public void seek(final long pos) throws IOException { if (mFile == null) { throw new IOException("Cannot seek on stream based file " + mFile.getSource()); } final long compressedOffset = BlockCompressedFilePointerUtil.getBlockAddress(pos); final int uncompressedOffset = BlockCompressedFilePointerUtil.getBlockOffset(pos); final int available; if (mBlockAddress == compressedOffset && mCurrentBlock != null) { available = mCurrentBlock.length; } else { mFile.seek(compressedOffset); mBlockAddress = compressedOffset; mLastBlockLength = 0; readBlock(); available = available(); } if (uncompressedOffset > available || (uncompressedOffset == available && !eof())) { throw new IOException("Invalid file pointer: " + pos + " for " + mFile.getSource()); } mCurrentOffset = uncompressedOffset; }

Target:
public void seek(final long pos) throws IOException { if (mFile == null) { throw new IOException(CANNOT_SEEK_STREAM_MSG); } final long compressedOffset = BlockCompressedFilePointerUtil.getBlockAddress(pos); final int uncompressedOffset = BlockCompressedFilePointerUtil.getBlockOffset(pos); final int available; if (mBlockAddress == compressedOffset && mCurrentBlock != null) { available = mCurrentBlock.length; } else { mFile.seek(compressedOffset); mBlockAddress = compressedOffset; mLastBlockLength = 0; readBlock(); available = available(); } if (uncompressedOffset > available || (uncompressedOffset == available && !eof())) { throw new IOException(INVALID_FILE_PTR_MSG + pos + " for " + mFile.getSource()); } mCurrentOffset = uncompressedOffset; }
Source:
public Map<Class<? extends Annotation>, List<FrameworkMethod>> getAnnotationToMethods() { return Collections.unmodifiableMap(fMethodsForAnnotations); }

Target:
public Map<Class<? extends Annotation>, List<FrameworkMethod>> getAnnotationToMethods() { return fMethodsForAnnotations; }
Source:
public String view() { try { String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); if (null == config) { logger.warn("Null configuration"); this.setErrorCode(ERROR_NULL_CONFIG); return SUCCESS; } this.setComments(this.getCaseManager().getCaseComments(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }

Target:
public String view() { try { if (!isKieServerConfigurationValid()) { return SUCCESS; } String frontEndCaseDataIn = extractWidgetConfig("frontEndCaseData"); this.setFrontEndCaseData(frontEndCaseDataIn); String channelIn = extractWidgetConfig("channel"); this.setChannel(channelIn); KieBpmConfig config = formManager.getKieServerConfigurations().get(this.getKnowledgeSourceId()); this.setComments(this.getCaseManager().getCaseComments(config, this.getContainerid(), this.getCasePath()).toString()); } catch (ApsSystemException t) { logger.error("Error getting the configuration parameter", t); return FAILURE; } return SUCCESS; }
Source:
public ResponseEntity undelete(@RepositoryMapping Repository repository, @RequestHeader(HttpHeaders.ACCEPT) String accept) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); try { repositoryManagementService.undeleteTrash(storageId, repositoryId); logger.debug("Undeleted trash for repository {}.", repositoryId); } catch (ArtifactStorageException e) { if (repositoryManagementService.getStorage(storageId) == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(getResponseEntityBody("The specified storageId does not exist!", accept)); } else if (repositoryManagementService.getStorage(storageId) .getRepository(repositoryId) == null) { return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(getResponseEntityBody("The specified repositoryId does not exist!", accept)); } return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(getResponseEntityBody("Could not restore the trash for a specified repository.", accept)); } return ResponseEntity.ok(getResponseEntityBody("The trash in '" + storageId + ":" + repositoryId + "' " + "has been restored successfully.", accept)); }

Target:
public ResponseEntity undelete(@RepositoryMapping Repository repository, @RequestHeader(HttpHeaders.ACCEPT) String accept) throws Exception { final String storageId = repository.getStorage().getId(); final String repositoryId = repository.getId(); try { repositoryManagementService.undeleteTrash(storageId, repositoryId); logger.debug("Undeleted trash for repository {}.", repositoryId); } catch (ArtifactStorageException e) { return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(getResponseEntityBody("Could not restore the trash for a specified repository.", accept)); } return ResponseEntity.ok(getResponseEntityBody("The trash in '" + storageId + ":" + repositoryId + "' " + "has been restored successfully.", accept)); }
Source:
public Parcelable onSaveInstanceState() { if (true) { return super.onSaveInstanceState(); } Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.selectedId = this.checkedId; return ss; }

Target:
public Parcelable onSaveInstanceState() { if (!doesNavigationViewSavedStateExist()) { return super.onSaveInstanceState(); } Parcelable superState = super.onSaveInstanceState(); SavedState ss = new SavedState(superState); ss.selectedId = this.checkedId; return ss; }
Source:
public void uploadFile(String containerName, String fileName, InputStream inputStream) throws BlobStorageException, IOException { try { BlobContainerClient containerClient = getContainer(containerName, true); BlockBlobClient blobClient = containerClient.getBlobClient(fileName).getBlockBlobClient(); blobClient.uploadWithResponse(inputStream, inputStream.available(), null, null, null, null, null, null, Context.NONE); } catch (UncheckedIOException e) { throw e.getCause(); } }

Target:
public void uploadFile(String containerName, String fileName, InputStream inputStream) throws BlobStorageException, IOException { try { BlockBlobClient blobClient = getBlockBlobClient(containerName, fileName, true); blobClient.uploadWithResponse(inputStream, inputStream.available(), null, null, null, null, null, null, Context.NONE); } catch (UncheckedIOException e) { throw e.getCause(); } }
Source:
public Object execute() throws Exception { if(this.agents != null) { boolean single = (agents.size() == 1); for(AgentMessagingInterface agent : this.agents) { out.println("Found agent with appname=" + agent.getApplicationName()); if(single) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Single agent eligible to cancel recipe"); cancelRecipe(agent.getApplicationName(), agent.getScopedInstancePath()); } } else if(agent.getApplicationName().equals(this.applicationName)) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Agent is eligible to cancel recipe"); cancelRecipe(this.applicationName, this.scopedInstancePath); } } } } else { out.println("No agent found, command not applicable"); } return null; }

Target:
public Object execute() throws Exception { if(this.agents != null) { boolean single = (agents.size() == 1); for(AgentMessagingInterface agent : this.agents) { out.println("Found agent with appname=" + agent.getApplicationName()); if(single) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Single agent eligible to cancel recipe"); cancelRecipe(agent.getApplicationName(), agent.getScopedInstancePath()); } } else if(Objects.equals(agent.getApplicationName(), this.applicationName)) { if(this.scopedInstancePath == null || this.scopedInstancePath.equals(agent.getScopedInstancePath())) { out.println("Agent is eligible to cancel recipe"); cancelRecipe(this.applicationName, this.scopedInstancePath); } } } } else { out.println("No agent found, command not applicable"); } return null; }
Source:
public static void main(String[] args) { String rowKey = String.format("rowKey0"); Put put = new Put(Bytes.toBytes(rowKey)); byte[] value = RandomStringUtils.randomAlphanumeric(10000).getBytes(); put.addColumn(Bytes.toBytes("Family1"), Bytes.toBytes("Qaulifier"), value); BigtableOptions options = BigtableOptions.builder() .setInstanceId("instanceId") .setProjectId("projectId") .build(); HBaseRequestAdapter adapter = new HBaseRequestAdapter(options, TableName.valueOf("tableName"), new Configuration()); requestContext = RequestContext.create(adapter.getBigtableTableName().toGcbInstanceName(), ""); for (int i = 0; i < 10; i++) { putAdapterPerf(adapter, put); } }

Target:
public static void main(String[] args) { String rowKey = String.format("rowKey0"); Put put = new Put(Bytes.toBytes(rowKey)); byte[] value = RandomStringUtils.randomAlphanumeric(10000).getBytes(); put.addColumn(Bytes.toBytes("Family1"), Bytes.toBytes("Qaulifier"), value); BigtableOptions options = BigtableOptions.builder() .setInstanceId("instanceId") .setProjectId("projectId") .build(); HBaseRequestAdapter adapter = new HBaseRequestAdapter(options, TableName.valueOf("tableName"), new Configuration()); requestContext = RequestContext.create(options.getInstanceName().toGcbInstanceName(), ""); for (int i = 0; i < 10; i++) { putAdapterPerf(adapter, put); } }
Source:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); try { response = urlopen.open("<LINK_0>"); Matcher matcher; matcher = reBalance.matcher(response); int i = 0; while (matcher.find()) { BigDecimal amount = Helpers.parseBalance(matcher.group(3).replace(",", "")).negate(); Account account = new Account( Html.fromHtml(matcher.group(2)).toString().trim(), amount, matcher.group(1).trim(), Account.LOANS); if (i > 0) { account.setAliasfor("0"); } accounts.add(account); balance = balance.add(amount); i++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } } finally { super.updateComplete(); } }

Target:
public void update() throws BankException, LoginException, BankChoiceException, IOException { super.update(); if (username == null || password == null || username.length() == 0 || password.length() == 0) { throw new LoginException(res.getText(R.string.invalid_username_password).toString()); } urlopen = login(); response = urlopen.open("<LINK_0>"); Matcher matcher; matcher = reBalance.matcher(response); int i = 0; while (matcher.find()) { BigDecimal amount = Helpers.parseBalance(matcher.group(3).replace(",", "")).negate(); Account account = new Account( Html.fromHtml(matcher.group(2)).toString().trim(), amount, matcher.group(1).trim(), Account.LOANS); if (i > 0) { account.setAliasfor("0"); } accounts.add(account); balance = balance.add(amount); i++; } if (accounts.isEmpty()) { throw new BankException(res.getText(R.string.no_accounts_found).toString()); } super.updateComplete(); }
Source:
public int read(byte b[], int off, int len) { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (pos >= count) { return -1; } if (pos + len > count) { len = count - pos; } if (len <= 0) { return 0; } System.arraycopy(buf, pos, b, off, len); pos += len; return len; }

Target:
public int read(byte b[], int off, int len) { if (b == null) { throw new NullPointerException(); } else if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); } if (pos >= count) { return -1; } if (pos + len > count) { len = count - pos; } if (len <= 0) { return 0; } Sys.copyArray(buf, pos, b, off, len); pos += len; return len; }
Source:
protected void disableDiscoveryProtocol(JChannel c) { c.getProtocolStack().getProtocols().stream() .filter(Discovery.class::isInstance) .forEach(p -> { if (!(p instanceof TEST_PING)) throw new IllegalStateException("TEST_PING required for this test."); ((TEST_PING) p).suspend(); }); }

Target:
protected void disableDiscoveryProtocol(JChannel c) { ((TEST_PING)c.getProtocolStack().findProtocol(TEST_PING.class)).suspend(); }
Source:
public void reloadData() { setContentShown(false); Log.d("TEST", "reloadData callleeeed"); loadReadme() .compose(RxTools.handle(getActivity(), RepositoryService.LOAD_README, true)) .subscribe(mReadmeConsumer, e -> { Log.d("TEST-RE", "error readme: " + e); }); loadPullRequestsCount() .compose(RxTools.handle(getActivity(), RepositoryService.LOAD_PULL_REQUESTS_COUNT, true)) .subscribe(mLoadPullRequestsCount, e -> { Log.d("TEST", "load pull request ERROR "); }); }

Target:
private void reloadData() { setContentShown(false); loadReadme(true); loadPullRequestsCount(true); }
Source:
protected void initChannel(SocketChannel ch) throws Exception { if (sslEngine != null) { log.debug("adding ssl handler"); ch.pipeline().addLast("ssl", new SslHandler(this.sslEngine)); } ch.pipeline().addLast("decoder", new HttpResponseDecoder()); ch.pipeline().addLast("encoder", new HttpRequestEncoder()); if (httpTraceLogEnabled) { ch.pipeline().addLast(Constants.HTTP_TRACE_LOG_HANDLER, new HTTPTraceLoggingHandler("tracelog.http.upstream", LogLevel.DEBUG)); } ch.pipeline().addLast(Constants.IDLE_STATE_HANDLER, new IdleStateHandler(socketTimeout, socketTimeout, 0, TimeUnit.MILLISECONDS)); childChannelContext.channel().pipeline().remove(Constants.IDLE_STATE_HANDLER); RedirectHandler redirectHandler = new RedirectHandler(originalChannelContext, sslEngine, httpTraceLogEnabled, maxRedirectCount); ch.pipeline().addLast(Constants.REDIRECT_HANDLER, redirectHandler); }

Target:
protected void initChannel(SocketChannel ch) throws Exception { if (sslEngine != null) { if (log.isDebugEnabled()) { log.debug("adding ssl handler"); } ch.pipeline().addLast("ssl", new SslHandler(this.sslEngine)); } ch.pipeline().addLast("compressor", new HttpContentCompressor()); ch.pipeline().addLast("decoder", new HttpResponseDecoder()); ch.pipeline().addLast("encoder", new HttpRequestEncoder()); if (httpTraceLogEnabled) { ch.pipeline().addLast(Constants.HTTP_TRACE_LOG_HANDLER, new HTTPTraceLoggingHandler("tracelog.http.upstream", LogLevel.DEBUG)); } RedirectHandler redirectHandler = new RedirectHandler(sslEngine, httpTraceLogEnabled, maxRedirectCount, originalChannelContext, isIdleHandlerOfTargetChannelRemoved); ch.pipeline().addLast(Constants.REDIRECT_HANDLER, redirectHandler); }
Source:
public void changeEmailAddress() { EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); String newEmailAddress = MailFunctions.getEmail(editPrefPage.getEmailAdress()); MailFunctions.deleteAllEmails(USERNAME, PASSWORD); Assertion.assertNotEquals(newEmailAddress, editPrefPage.getEmailAdress(), "New email and old email SHOULD NOT be the same"); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); editPrefPage.enterEmailChangeLink(USERNAME, PASSWORD); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress, "Email address doesn't equal to new email address"); }

Target:
public void changeEmailAddress() { EditPreferencesPage editPrefPage = new EditPreferencesPage(driver).openEmailSection(); String newEmailAddress = EmailUtils.getEmail(editPrefPage.getEmailAdress()); EmailUtils.deleteAllEmails(USERNAME, PASSWORD); Assertion.assertNotEquals(newEmailAddress, editPrefPage.getEmailAdress(), "New email and old email SHOULD NOT be the same"); editPrefPage.changeEmail(newEmailAddress); PreferencesPageObject prefPage = editPrefPage.clickSaveButton(); Assertion.assertTrue(prefPage.getBannerNotifications().isNotificationMessageVisible(), "Notification message is not visible"); editPrefPage.enterEmailChangeLink(USERNAME, PASSWORD); editPrefPage.openEmailSection(); Assertion.assertEquals(editPrefPage.getEmailAdress(), newEmailAddress, "Email address doesn't equal to new email address"); }
Source:
protected AuthenticationRequest createAuthenticationRequest(Authentication authentication) { String username = (String) authentication.getPrincipal(); String password = (String) authentication.getCredentials(); if (!Strings.hasText(username)){ throw new AuthenticationServiceException("must have username and password"); } return UsernamePasswordRequest.builder().setUsernameOrEmail(username).setPassword(password).build(); }

Target:
protected AuthenticationRequest createAuthenticationRequest(Authentication authentication) { String username = (String) authentication.getPrincipal(); String password = (String) authentication.getCredentials(); if (!Strings.hasText(username)){ throw new AuthenticationServiceException("Login and password required"); } return UsernamePasswordRequest.builder().setUsernameOrEmail(username).setPassword(password).build(); }
Source:
public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException, ServerException { requiredNotNull(parameters, "Factory build parameters"); FactoryParametersResolver resolver = factoryParametersResolverHolder.getFactoryParametersResolver(parameters); if (resolver == null) { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } FactoryDto resolvedFactory = resolver.createFactory(parameters); if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); }

Target:
public FactoryDto resolveFactory( @ApiParam(value = "Parameters provided to create factories") Map<String, String> parameters, @ApiParam( value = "Whether or not to validate values like it is done when accepting a Factory", allowableValues = "true,false", defaultValue = "false") @DefaultValue("false") @QueryParam(VALIDATE_QUERY_PARAMETER) Boolean validate) throws BadRequestException, ServerException { requiredNotNull(parameters, "Factory build parameters"); FactoryDto resolvedFactory = factoryParametersResolverHolder .getFactoryParametersResolver(parameters) .createFactory(parameters); if (resolvedFactory == null) { throw new BadRequestException(FACTORY_NOT_RESOLVABLE); } if (validate) { acceptValidator.validateOnAccept(resolvedFactory); } return injectLinks(resolvedFactory); }
Source:
public Set<String> getTestAnnotationProcessors() { ExperimentalExtension experimentalExtension = getOkbuck().getExperimentalExtension(); if (experimentalExtension.useAnnotationProcessorPlugin) { return getTestApts() .stream() .filter(i -> !i.getAnnotationProcessors().isEmpty()) .map(Scope::getAnnotationProcessorRulePath) .collect(Collectors.toSet()); } else { return getTestApt().getAnnotationProcessors(); } }

Target:
public Set<String> getTestAnnotationProcessors() { ExperimentalExtension experimentalExtension = getOkbuck().getExperimentalExtension(); if (experimentalExtension.useAnnotationProcessorPlugin) { return getTestAptScopes() .stream() .filter(scope -> !scope.getAnnotationProcessors().isEmpty()) .map(Scope::getAnnotationProcessorsUID) .collect(Collectors.toSet()); } else { return getTestApt().getAnnotationProcessors(); } }
Source:
public static StatisticsData getStatistics() { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); long totalTime = 0; ArrayList<StatisticsItem> feedTime = new ArrayList<>(); List<Feed> feeds = getFeedList(); for (Feed feed : feeds) { long feedPlayedTime = 0; long feedTotalTime = 0; long episodes = 0; long episodesStarted = 0; List<FeedItem> items = getFeed(feed.getId()).getItems(); for(FeedItem item : items) { FeedMedia media = item.getMedia(); if(item.isPlayed()) { feedPlayedTime += media.getDuration() / 1000; } else { feedPlayedTime += media.getPosition() / 1000; } if(item.isPlayed() || media.getPosition() != 0) { episodesStarted++; } feedTotalTime += media.getDuration() / 1000; episodes++; } feedTime.add(new StatisticsItem( feed, feedTotalTime, feedPlayedTime, episodes, episodesStarted)); totalTime += feedPlayedTime; } Collections.sort(feedTime, (item1, item2) -> { if(item1.timePlayed > item2.timePlayed) { return -1; } else if(item1.timePlayed < item2.timePlayed) { return 1; } else { return 0; } }); adapter.close(); return new StatisticsData(totalTime, feedTime); }

Target:
public static StatisticsData getStatistics() { PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); long totalTime = 0; List<StatisticsItem> feedTime = new ArrayList<>(); List<Feed> feeds = getFeedList(); for (Feed feed : feeds) { long feedPlayedTime = 0; long feedTotalTime = 0; long episodes = 0; long episodesStarted = 0; List<FeedItem> items = getFeed(feed.getId()).getItems(); for(FeedItem item : items) { FeedMedia media = item.getMedia(); if(media == null) { continue; } if(item.isPlayed()) { feedPlayedTime += media.getDuration() / 1000; } else { feedPlayedTime += media.getPosition() / 1000; } if(item.isPlayed() || media.getPosition() != 0) { episodesStarted++; } feedTotalTime += media.getDuration() / 1000; episodes++; } feedTime.add(new StatisticsItem( feed, feedTotalTime, feedPlayedTime, episodes, episodesStarted)); totalTime += feedPlayedTime; } Collections.sort(feedTime, (item1, item2) -> { if(item1.timePlayed > item2.timePlayed) { return -1; } else if(item1.timePlayed < item2.timePlayed) { return 1; } else { return 0; } }); adapter.close(); return new StatisticsData(totalTime, feedTime); }
Source:
public boolean editIssueState(String repoId, int issueId, boolean isOpen) throws IOException { Issue updatedIssue = issueService.editIssueState( RepositoryId.createFromId(repoId), issueId, isOpen ); if (isOpen) { return updatedIssue.getState().equals(IssueService.STATE_OPEN); } else { return updatedIssue.getState().equals(IssueService.STATE_CLOSED); } }

Target:
public boolean editIssueState(String repoId, int issueId, boolean isOpen) throws IOException { Issue updatedIssue = issueService.editIssueState( RepositoryId.createFromId(repoId), issueId, isOpen ); return updatedIssue.getState().equals(isOpen ? IssueService.STATE_OPEN : IssueService.STATE_CLOSED); }
Source:
public void connect(final long maxMsToWaitUntilConnected, Watcher watcher) throws ZkInterruptedException, ZkTimeoutException, IllegalStateException { if (isClosed()) { throw new IllegalStateException("ZkClient already closed!"); } boolean started = false; acquireEventLock(); try { setShutdownTrigger(false); IZkConnection zkConnection = getConnection(); _eventThread = new ZkEventThread(zkConnection.getServers()); _eventThread.start(); LOG.debug("ZkClient created with _uid {}, _eventThread {}", _uid, _eventThread.getId()); try { if (_monitorKey != null && !_monitorKey.isEmpty() && _monitorType != null && !_monitorType .isEmpty()) { _monitor = new ZkClientMonitor(_monitorType, _monitorKey, _monitorInstanceName, _monitorRootPathOnly, _eventThread); _monitor.register(); } else { LOG.info("ZkClient monitor key or type is not provided. Skip monitoring."); } } catch (JMException e) { LOG.error("Error in creating ZkClientMonitor", e); } if (isManagingZkConnection()) { zkConnection.connect(watcher); LOG.debug("Awaiting connection to Zookeeper server"); if (!waitUntilConnected(maxMsToWaitUntilConnected, TimeUnit.MILLISECONDS)) { throw new ZkTimeoutException( "Unable to connect to zookeeper server within timeout: " + maxMsToWaitUntilConnected); } } else { if (isConnectionClosed()) { throw new ZkClientException( "Unable to connect to zookeeper server with the specified ZkConnection"); } setCurrentState(KeeperState.SyncConnected); } started = true; } finally { getEventLock().unlock(); if (!started) { close(); } } }

Target:
public void connect(final long maxMsToWaitUntilConnected, Watcher watcher) throws ZkInterruptedException, ZkTimeoutException, IllegalStateException { if (isClosed()) { throw new IllegalStateException("ZkClient already closed!"); } boolean started = false; acquireEventLock(); try { setShutdownTrigger(false); IZkConnection zkConnection = getConnection(); _eventThread = new ZkEventThread(zkConnection.getServers()); if (_monitor != null) { boolean result = _monitor.setAndInitZkEventThreadMonitor(_eventThread); if (!result) { LOG.error("register _eventThread monitor failed due to an existing one"); } } _eventThread.start(); LOG.debug("ZkClient created with _uid {}, _eventThread {}", _uid, _eventThread.getId()); if (isManagingZkConnection()) { zkConnection.connect(watcher); LOG.debug("Awaiting connection to Zookeeper server"); if (!waitUntilConnected(maxMsToWaitUntilConnected, TimeUnit.MILLISECONDS)) { throw new ZkTimeoutException( "Unable to connect to zookeeper server within timeout: " + maxMsToWaitUntilConnected); } } else { if (isConnectionClosed()) { throw new ZkClientException( "Unable to connect to zookeeper server with the specified ZkConnection"); } setCurrentState(KeeperState.SyncConnected); } started = true; } finally { getEventLock().unlock(); if (!started) { close(); } } }
Source:
private void cleanUpSuperfluousComputer(Map<String, Node> nodeMap, ContainerNodeNameMap csmMerged, Instant snapshotInstant) { for (Node node : nodeMap.values()) { if (! (node instanceof DockerTransientNode)) { continue; } this.checkForTimeout(snapshotInstant); DockerTransientNode dtn = (DockerTransientNode) node; boolean seenOnDockerInstance = csmMerged.isContainerIdRegistered(dtn.getContainerId()); if (seenOnDockerInstance) { continue; } SlaveComputer computer = dtn.getComputer(); if (computer == null) { continue; } if (!computer.isOffline()) { continue; } LOGGER.info("{} has container ID {}, but the container does not exist in any docker cloud. Will remove node.", dtn, dtn.getContainerId()); try { removeNode(dtn); executionStatistics.nodesRemoved++; } catch (IOException e) { LOGGER.warn(String.format("Failed to remove orphaned %s.", dtn), e); executionStatistics.nodesRemovedFailed++; } } }

Target:
private void cleanUpSuperfluousComputer(Map<String, Node> nodeMap, ContainerNodeNameMap csmMerged, Instant snapshotInstant) { for (Node node : nodeMap.values()) { if (! (node instanceof DockerTransientNode)) { continue; } checkForTimeout(snapshotInstant); DockerTransientNode dtn = (DockerTransientNode) node; boolean seenOnDockerInstance = csmMerged.isContainerIdRegistered(dtn.getContainerId()); if (seenOnDockerInstance) { continue; } SlaveComputer computer = dtn.getComputer(); if (computer == null) { continue; } if (!computer.isOffline()) { continue; } LOGGER.info("{} has container ID {}, but the container does not exist in any docker cloud. Will remove node.", dtn, dtn.getContainerId()); try { removeNode(dtn); executionStatistics.addNodeRemoved(); } catch (IOException e) { LOGGER.warn("Failed to remove orphaned node {}", dtn.toString(), e); executionStatistics.addNodeRemovedFailed(); } } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_history, container, false); rootView.setPadding(0, getContentTopOffsetPx(getActivity()), 0, 0); historyEntryList = (ListView) rootView.findViewById(R.id.history_entry_list); historyEmptyContainer = rootView.findViewById(R.id.history_empty_container); historyEmptyTitle = (TextView) rootView.findViewById(R.id.history_empty_title); historyEmptyMessage = (TextView) rootView.findViewById(R.id.history_empty_message); entryFilter = (EditText) rootView.findViewById(R.id.history_search_list); app.adjustDrawableToTheme(((ImageView) rootView.findViewById(R.id.history_empty_image)).getDrawable()); adapter = new HistoryEntryAdapter(getContext(), null, true); entryFilter.addTextChangedListener(textWatcher); historyEntryList.setAdapter(adapter); historyEntryList.setOnItemClickListener(itemClickListener); historyEntryList.setOnItemLongClickListener(itemLongClickListener); return rootView; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_history, container, false); rootView.setPadding(0, getContentTopOffsetPx(getActivity()), 0, 0); historyEntryList = (ListView) rootView.findViewById(R.id.history_entry_list); historyEmptyContainer = rootView.findViewById(R.id.history_empty_container); historyEmptyTitle = (TextView) rootView.findViewById(R.id.history_empty_title); historyEmptyMessage = (TextView) rootView.findViewById(R.id.history_empty_message); entryFilter = (EditText) rootView.findViewById(R.id.history_search_list); app.adjustDrawableToTheme(((ImageView) rootView.findViewById(R.id.history_empty_image)).getDrawable()); entryFilter.addTextChangedListener(textWatcher); historyEntryList.setAdapter(adapter); historyEntryList.setOnItemClickListener(itemClickListener); historyEntryList.setOnItemLongClickListener(itemLongClickListener); return rootView; }
Source:
public void test() throws IOException { clickOn(stage, MouseButton.PRIMARY); sleep(SHORT); goThroughSettings(); goThroughShop(); mainMenu(MAIN_START); assertNull(AbstractScene.getPopup()); mainMenu(MAIN_TEXTFIELD); typeFaultyName(); mainMenu(MAIN_START); clickPopup(WARNING_OK); mainMenu(MAIN_TEXTFIELD); keyboard(KeyCode.BACK_SPACE); typeName(); goThroughGamePlay(); mainMenu(MAIN_LOADGAME); loadMenu(LOAD_BACK); mainMenu(MAIN_LOADGAME); loadMenu(LOAD_START); sleep(COUNTDOWN); playerDies(); sleep(SHORT); clickPopup(DEATH_RETRY); sleep(COUNTDOWN); playerDies(); clickPopup(DEATH_TOMAIN); Platform.runLater(stage::close); outputEventLog(); }

Target:
public void test() throws IOException { clickOn(stage, MouseButton.PRIMARY); sleep(SHORT); goThroughSettings(); goThroughShop(); goThroughNameTyping(); goThroughGamePlay(); mainMenu(MAIN_LOADGAME); loadMenu(LOAD_BACK); mainMenu(MAIN_LOADGAME); loadMenu(LOAD_START); sleep(COUNTDOWN); playerDies(); sleep(SHORT); clickPopup(DEATH_RETRY); sleep(COUNTDOWN); playerDies(); clickPopup(DEATH_TOMAIN); Platform.runLater(stage::close); outputEventLog(); }
Source:
public void setUp() throws Exception { actionFactory = new ActionFactory(); project = new Project(MockUtil.mockContextForProject(), "testProject"); ProjectManager.getInstance().setCurrentProject(project); userList = new UserList(TEST_USER_LIST_NAME, INITIALIZED_LIST_VALUES); project.addUserList(userList); INITIALIZED_LIST_VALUES.clear(); INITIALIZED_LIST_VALUES.add(1.0); INITIALIZED_LIST_VALUES.add(2.0); INITIALIZED_LIST_VALUES.add(3.0); }

Target:
public void setUp() throws Exception { userList = new UserList(TEST_USER_LIST_NAME, INITIALIZED_LIST_VALUES); action = new ClearUserListAction(); INITIALIZED_LIST_VALUES.clear(); }
Source:
public Block copyRegion(int position, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, position, length); int startValueOffset = getOffset(position); int endValueOffset = getOffset(position + length); Block newValues = getRawElementBlock().copyRegion(startValueOffset, endValueOffset - startValueOffset); int[] newOffsets = compactOffsets(getOffsets(), position + getOffsetBase(), length); boolean[] newValueIsNull = getValueIsNull() == null ? null : compactArray(getValueIsNull(), position + getOffsetBase(), length); if (newValues == getRawElementBlock() && newOffsets == getOffsets() && newValueIsNull == getValueIsNull()) { return this; } return createArrayBlockInternal(0, length, newValueIsNull, newOffsets, newValues); }

Target:
public Block copyRegion(int position, int length) { int positionCount = getPositionCount(); checkValidRegion(positionCount, position, length); int startValueOffset = getOffset(position); int endValueOffset = getOffset(position + length); Block newValues = getRawElementBlock().copyRegion(startValueOffset, endValueOffset - startValueOffset); int[] newOffsets = compactOffsets(getOffsets(), position + getOffsetBase(), length); boolean[] valueIsNull = getValueIsNull(); boolean[] newValueIsNull = valueIsNull == null ? null : compactArray(valueIsNull, position + getOffsetBase(), length); if (newValues == getRawElementBlock() && newOffsets == getOffsets() && newValueIsNull == valueIsNull) { return this; } return createArrayBlockInternal(0, length, newValueIsNull, newOffsets, newValues); }
Source:
public void testDeleteFile() throws Exception { File d = tmp.getRoot(); File f = new File(d, "f"); try { mkfiles(f); Util.deleteFile(f); assertFalse("f exists after calling Util.deleteFile", f.exists()); } finally { Util.deleteRecursive(d); } }

Target:
public void testDeleteFile() throws Exception { File f = tmp.newFile(); mkfiles(f); Util.deleteFile(f); assertFalse("f exists after calling Util.deleteFile", f.exists()); }
Source:
public void RTEDisabledEditorEntryAnonTests_009_actionEdit() { SourceEditModePageObject src = base.navigateToArticleEditPageSrc(wikiURL, PageContent.articleNamePrefix + base.getTimeStamp()); src.verifySourceOnlyMode(); }

Target:
public void RTEDisabledEditorEntryAnonTests_009_actionEdit() { SourceEditModePageObject src = base.navigateToArticleEditPageSrc(wikiURL, base.getNameForArticle()); src.verifySourceOnlyMode(); }
Source:
public void lockReadyDelayedAttempts(Instant currentTime, DelayedAttemptAction func) { List<RuntimeException> exceptions = transaction((handle, dao) -> { List<StoredDelayedSessionAttempt> locked = handle.createQuery( "select da.* from delayed_session_attempts da" + " where not exists (" + " select * from session_attempts sa" + " where sa.session_id = da.dependent_session_id" + " and " + bitAnd("sa.state_flags", Integer.toString(AttemptStateFlags.DONE_CODE)) + " = 0" + ")" + " and next_run_time <= :currentTime" + " limit :limit" + " for update" ) .bind("limit", 10) .bind("currentTime", currentTime.getEpochSecond()) .mapTo(StoredDelayedSessionAttempt.class) .list(); return locked.stream() .map(delayedAttempt -> { try { func.submit(new DatabaseDelayedAttemptControlStore(handle), delayedAttempt); return null; } catch (RuntimeException ex) { return ex; } }) .filter(exception -> exception != null) .collect(Collectors.toList()); }); if (!exceptions.isEmpty()) { RuntimeException first = exceptions.get(0); for (RuntimeException ex : exceptions.subList(1, exceptions.size())) { first.addSuppressed(ex); } throw first; } }

Target:
public void lockReadyDelayedAttempts(Instant currentTime, DelayedAttemptAction func) { List<RuntimeException> exceptions = transaction((handle, dao) -> { List<StoredDelayedSessionAttempt> locked = handle.createQuery( "select da.* from delayed_session_attempts da" + " where not exists (" + " select * from session_attempts sa" + " where sa.session_id = da.dependent_session_id" + " and " + bitAnd("sa.state_flags", Integer.toString(AttemptStateFlags.DONE_CODE)) + " = 0" + ")" + " and next_run_time <= :currentTime" + " order by next_run_time" + " limit :limit" + " for update" ) .bind("limit", 10) .bind("currentTime", currentTime.getEpochSecond()) .mapTo(StoredDelayedSessionAttempt.class) .list(); return locked.stream() .map(delayedAttempt -> { try { func.submit(new DatabaseDelayedAttemptControlStore(handle), delayedAttempt); return null; } catch (RuntimeException ex) { return ex; } }) .filter(exception -> exception != null) .collect(Collectors.toList()); }); if (!exceptions.isEmpty()) { RuntimeException first = exceptions.get(0); for (RuntimeException ex : exceptions.subList(1, exceptions.size())) { first.addSuppressed(ex); } throw first; } }
Source:
public void testAggregatingMembersEnricher() throws Exception { origCluster.resize(2); origApp.addEnricher(Enrichers.builder() .aggregating(METRIC1) .from(origCluster) .fromMembers() .computing(StringFunctions.joiner(",")) .publishing(METRIC2) .build()); TestApplication newApp = rebind(); DynamicCluster newCluster = (DynamicCluster) Iterables.find(newApp.getChildren(), Predicates.instanceOf(DynamicCluster.class)); int i = 0; for (Entity member : newCluster.getMembers()) { ((EntityInternal)member).setAttribute(METRIC1, "myval"+(i++)); } EntityTestUtils.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval1,myval2"), Predicates.equalTo("myval2,myval1"))); }

Target:
public void testAggregatingMembersEnricher() throws Exception { origCluster.resize(2); origApp.addEnricher(Enrichers.builder() .aggregating(METRIC1) .from(origCluster) .fromMembers() .computing(StringFunctions.joiner(",")) .publishing(METRIC2) .build()); TestApplication newApp = rebind(); DynamicCluster newCluster = (DynamicCluster) Iterables.find(newApp.getChildren(), Predicates.instanceOf(DynamicCluster.class)); int i = 1; for (Entity member : newCluster.getMembers()) { ((EntityInternal)member).setAttribute(METRIC1, "myval"+(i++)); } EntityTestUtils.assertAttributeEventually(newApp, METRIC2, Predicates.or(Predicates.equalTo("myval1,myval2"), Predicates.equalTo("myval2,myval1"))); }
Source:
public List<String> getEditorText() { final int editorLinesCount = seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(EDITOR_LINE_XPATH)).size(); List<Integer> linesCoordinates = getEditorLinesPixelCoordinates(editorLinesCount); linesCoordinates.sort((first, second) -> first - second); List<String> linesText = linesCoordinates .stream() .map( linePixelCoordinate -> { String lineByPixelCoordinatesXpath = getEditorLineByPixelCoordinateXpath(linePixelCoordinate); return seleniumWebDriverHelper.waitVisibilityAndGetText( By.xpath(lineByPixelCoordinatesXpath)); }) .collect(Collectors.toList()); return linesText; }

Target:
public List<String> getEditorText() { final int editorLinesCount = seleniumWebDriverHelper.waitVisibilityOfAllElements(By.xpath(EDITOR_LINE_XPATH)).size(); List<Integer> linePixelCoordinates = getEditorLinePixelCoordinates(editorLinesCount); List<String> linesText = linePixelCoordinates .stream() .map( linePixelCoordinate -> { String lineByPixelCoordinatesXpath = getEditorLineByPixelCoordinateXpath(linePixelCoordinate); return seleniumWebDriverHelper.waitVisibilityAndGetText( By.xpath(lineByPixelCoordinatesXpath)); }) .collect(Collectors.toList()); return linesText; }
Source:
public Map<Integer, Object> validate(Object item) { try { NavigableMap<Integer, Object> objects = (NavigableMap<Integer, Object>) item; for (Map.Entry<Integer, Object> entry : objects.entrySet()) { Integer tag = entry.getKey(); Field field = fields.get(tag); if (field == null) { if (!(entry.getValue() instanceof RawTaggedField)) { throw new SchemaException("The value associated with tag " + tag + " must be a RawTaggedField in this version of the software."); } } else { field.type.validate(entry.getValue()); } } return objects; } catch (ClassCastException e) { throw new SchemaException("Not a Map."); } }

Target:
public Map<Integer, Object> validate(Object item) { try { NavigableMap<Integer, Object> objects = (NavigableMap<Integer, Object>) item; for (Map.Entry<Integer, Object> entry : objects.entrySet()) { Integer tag = entry.getKey(); Field field = fields.get(tag); if (field == null) { if (!(entry.getValue() instanceof RawTaggedField)) { throw new SchemaException("The value associated with tag " + tag + " must be a RawTaggedField in this version of the software."); } } else { field.type.validate(entry.getValue()); } } return objects; } catch (ClassCastException e) { throw new SchemaException("Not a NavigableMap."); } }