auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) { if (!(event instanceof FieldChangedEvent)) { eventBus.post(event); } else { FieldChangedEvent fieldChange = (FieldChangedEvent) event; boolean isEditOnNewField = lastFieldChanged == null || !lastFieldChanged.equals(fieldChange.getField()); boolean isMajorChange = fieldChange.getDelta() >= 1; if (isEditOnNewField) { lastFieldChanged = fieldChange.getField(); eventBus.post(event); } } }

Target:
public synchronized void listen(@SuppressWarnings("unused") BibDatabaseContextChangedEvent event) { Runnable eventPost = () -> { totalDelta = 0; eventBus.post(event); }; if (!(event instanceof FieldChangedEvent)) { eventPost.run(); } else { FieldChangedEvent fieldChange = (FieldChangedEvent) event; totalDelta += fieldChange.getDelta(); boolean isNewEdit = lastFieldChanged.isEmpty(); boolean isEditOnOtherField = !lastFieldChanged.get().equals(fieldChange.getField()); boolean isMajorChange = totalDelta >= 100; if ((isEditOnOtherField && !isNewEdit) || isMajorChange) { eventPost.run(); } else { delayPost.schedule(eventPost); } lastFieldChanged = Optional.of(fieldChange.getField()); } }
Source:
public boolean validate(Process process) { PrefsInterface prefsInterface = serviceManager.getRulesetService().getPreferences(process.getRuleset()); FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(process); } catch (Exception e) { Helper.setFehlerMeldung(Helper.getTranslation("MetadataReadError") + process.getTitle(), e.getMessage()); return false; } return validate(gdzfile, prefsInterface, process); }

Target:
public boolean validate(Process process) { PrefsInterface prefs = serviceManager.getRulesetService().getPreferences(process.getRuleset()); FileformatInterface gdzfile; try { gdzfile = serviceManager.getProcessService().readMetadataFile(process); } catch (Exception e) { Helper.setFehlerMeldung(Helper.getTranslation("MetadataReadError") + process.getTitle(), e.getMessage()); return false; } return validate(gdzfile, prefs, process); }
Source:
public void testSearchByProjectNameBehindAFolder() throws Exception { final String projectName = "testSearchByProjectName"; j.createFreeStyleProject(projectName); j.createFolder("my-folder-1").createProject(FreeStyleProject.class, "my-job-1"); Page result = j.createWebClient().goTo("job/my-folder-1/search?q="+ projectName); assertNotNull(result); j.assertGoodStatus(result); String contents = result.getWebResponse().getContentAsString(); assertTrue(contents.contains(String.format("<title>%s [Jenkins]</title>", projectName))); }

Target:
public void testSearchByProjectNameBehindAFolder() throws Exception { FreeStyleProject myFreeStyleProject = j.createFreeStyleProject("testSearchByProjectName"); MockFolder myMockFolder = j.createFolder("my-folder-1"); Page result = j.createWebClient().goTo(myMockFolder.getUrl() + "search?q="+ myFreeStyleProject.getName()); assertNotNull(result); j.assertGoodStatus(result); URL resultUrl = result.getWebResponse().getUrl(); assertTrue(resultUrl.toString().equals(j.getInstance().getRootUrl() + myFreeStyleProject.getUrl())); }
Source:
private static ImageResource getPoolVmImageResource(VmType vmType, boolean nextRunConfigurationExists) { switch (vmType) { case Desktop: return nextRunConfigurationExists ? resources.manyDesktopsChangesImage() : resources.manyDesktopsImage(); case Server: return nextRunConfigurationExists ? resources.manyServersChangesImage() : resources.manyServersImage(); default: log.severe("Invalid VmType."); return null; } }

Target:
private static ImageResource getPoolVmImageResource(VmType vmType, boolean nextRunConfigurationExists) { switch (vmType) { case Server: return nextRunConfigurationExists ? resources.manyServersChangesImage() : resources.manyServersImage(); case Desktop: default: return nextRunConfigurationExists ? resources.manyDesktopsChangesImage() : resources.manyDesktopsImage(); } }
Source:
private synchronized void tryConnect() { if ( disposed ) { return; } else if ( fChannel != null && !fChannel.isDone() ) { return; } fChannel = bootstrap.connect( destination.socketAddress() ); channel = fChannel.channel(); fChannel.addListener( ( ChannelFuture f ) -> { if ( !f.isSuccess() ) { long millis = connectionBackoff.getMillis(); log.warn( "Failed to connect to: %s. Retrying in %d ms", destination.socketAddress(), millis ); f.channel().eventLoop().schedule( this::tryConnect, millis, MILLISECONDS ); connectionBackoff.increment(); } else { log.info( "Connected: " + f.channel() ); f.channel().closeFuture().addListener( closed -> { log.warn( String.format( "Lost connection to: %s (%s)", destination, channel.remoteAddress() ) ); connectionBackoff = connectionBackoffStrategy.newTimeout(); f.channel().eventLoop().schedule( this::tryConnect, 0, MILLISECONDS ); } ); } } ); }

Target:
private synchronized void tryConnect() { if ( disposed ) { return; } else if ( fChannel != null && !fChannel.isDone() ) { return; } fChannel = bootstrap.connect( destination.socketAddress() ); channel = fChannel.channel(); fChannel.addListener( ( ChannelFuture f ) -> { if ( !f.isSuccess() ) { long millis = connectionBackoff.getMillis(); cappedLogger.warn( "Failed to connect to: " + destination.socketAddress() + ". Retrying in " + millis + " ms" ); f.channel().eventLoop().schedule( this::tryConnect, millis, MILLISECONDS ); connectionBackoff.increment(); } else { log.info( "Connected: " + f.channel() ); f.channel().closeFuture().addListener( closed -> { log.warn( String.format( "Lost connection to: %s (%s)", destination, channel.remoteAddress() ) ); connectionBackoff = connectionBackoffStrategy.newTimeout(); f.channel().eventLoop().schedule( this::tryConnect, 0, MILLISECONDS ); } ); } } ); }
Source:
private void assertMCA(MultiCurrencyAmount actual, CurrencyAmount... expected) { assertEquals(actual.size(), expected.length); assertEquals(actual.getAmounts().size(), expected.length); assertEquals(actual.getAmounts(), ImmutableSet.copyOf(expected)); Set<Currency> currencies = new HashSet<>(); for (CurrencyAmount expectedAmount : expected) { currencies.add(expectedAmount.getCurrency()); assertEquals(actual.contains(expectedAmount.getCurrency()), true); assertEquals(actual.getAmount(expectedAmount.getCurrency()), expectedAmount); } assertEquals(actual.getCurrencies(), currencies); assertEquals(actual.contains(Currency.FRF), false); assertThrows(() -> actual.getAmount(Currency.FRF), IllegalArgumentException.class); }

Target:
private void assertMCA(MultiCurrencyAmount actual, CurrencyAmount... expected) { assertEquals(actual.size(), expected.length); assertEquals(actual.getAmounts().size(), expected.length); assertEquals(actual.getAmounts(), ImmutableSet.copyOf(expected)); Set<Currency> currencies = new HashSet<>(); for (CurrencyAmount expectedAmount : expected) { currencies.add(expectedAmount.getCurrency()); assertEquals(actual.contains(expectedAmount.getCurrency()), true); assertEquals(actual.getAmount(expectedAmount.getCurrency()), expectedAmount); } assertEquals(actual.getCurrencies(), currencies); Currency nonExisting = Currency.of("FRZ"); assertEquals(actual.contains(nonExisting), false); assertThrows(() -> actual.getAmount(nonExisting), IllegalArgumentException.class); }
Source:
VelocityContext createEnvironmentContext(Stack sharedStackResults, EnvironmentDescriptor environment) { VelocityContext context = new VelocityContext(); String stack = config.getProperty(PROPERTY_KEY_STACK); context.put(STACK, stack); context.put(INSTANCE, config.getProperty(PROPERTY_KEY_INSTANCE)); context.put(VPC_SUBNET_COLOR, config.getProperty(PROPERTY_KEY_VPC_SUBNET_COLOR)); context.put(VPC_EXPORT_PREFIX, Constants.createVpcExportPrefix(stack)); context.put(SHARED_EXPORT_PREFIX, createSharedExportPrefix()); context.put(REPO_BEANSTALK_NUMBER, config.getIntegerProperty(PROPERTY_KEY_BEANSTALK_NUMBER + EnvironmentType.REPOSITORY_SERVICES.getShortName())); context.put(DB_ENDPOINT_SUFFIX, extractDatabaseSuffix(sharedStackResults)); context.put(ENVIRONMENT, environment); context.put(STACK_CMK_ALIAS, secretBuilder.getCMKAlias()); ElasticBeanstalkEncryptedPlatformInfo elasticBeanstalkEncryptedPlatformInfo = elasticBeanstalkDefaultAMIEncrypter.getEncryptedElasticBeanstalkAMI( config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "java"), config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "tomcat"), config.getProperty(PROPERTY_KEY_ELASTICBEANSTALK_IMAGE_VERSION + "amazonlinux")); context.put(SOLUTION_STACK_NAME, elasticBeanstalkEncryptedPlatformInfo.getSolutionStackName()); context.put(ENCRYPTED_AMI_IMAGE_ID, elasticBeanstalkEncryptedPlatformInfo.getEncryptedAmiId()); return context; }

Target:
VelocityContext createEnvironmentContext(Stack sharedStackResults, EnvironmentDescriptor environment) { VelocityContext context = new VelocityContext(); String stack = config.getProperty(PROPERTY_KEY_STACK); context.put(STACK, stack); context.put(INSTANCE, config.getProperty(PROPERTY_KEY_INSTANCE)); context.put(VPC_SUBNET_COLOR, config.getProperty(PROPERTY_KEY_VPC_SUBNET_COLOR)); context.put(VPC_EXPORT_PREFIX, Constants.createVpcExportPrefix(stack)); context.put(SHARED_EXPORT_PREFIX, createSharedExportPrefix()); context.put(REPO_BEANSTALK_NUMBER, config.getIntegerProperty(PROPERTY_KEY_BEANSTALK_NUMBER + EnvironmentType.REPOSITORY_SERVICES.getShortName())); context.put(DB_ENDPOINT_SUFFIX, extractDatabaseSuffix(sharedStackResults)); context.put(ENVIRONMENT, environment); context.put(STACK_CMK_ALIAS, secretBuilder.getCMKAlias()); ElasticBeanstalkEncryptedPlatformInfo elasticBeanstalkEncryptedPlatformInfo = elasticBeanstalkDefaultAMIEncrypter.getEncryptedElasticBeanstalkAMI(); context.put(SOLUTION_STACK_NAME, elasticBeanstalkEncryptedPlatformInfo.getSolutionStackName()); context.put(ENCRYPTED_AMI_IMAGE_ID, elasticBeanstalkEncryptedPlatformInfo.getEncryptedAmiId()); return context; }
Source:
private void doCriticalMemoryHitTest(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) { final VM server = VM.getVM(0); final VM client = VM.getVM(1); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); startClient(client, port); populateData(server); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } client.invoke("Executing query when system is 'Normal'", () -> { try { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); } catch (QueryInvocationTargetException | FunctionDomainException | TypeMismatchException | NameResolutionException e) { fail(""); } }); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } } finally { stopServer(server); } }

Target:
private void doCriticalMemoryHitTest(boolean createPR, final boolean disabledQueryMonitorForLowMem, final int queryTimeout, final boolean hitCriticalThreshold) throws InterruptedException { final VM server = VM.getVM(0); final VM client = VM.getVM(1); final int numObjects = 200; try { final int port = AvailablePortHelper.getRandomAvailableTCPPort(); startCacheServer(server, port, disabledQueryMonitorForLowMem, queryTimeout, createPR); startClient(client, port); populateData(server); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } client.invoke("Executing query when system is 'Normal'", () -> { QueryService qs = getCache().getQueryService(); Query query = qs.newQuery("Select * From /" + "portfolios"); SelectResults results = (SelectResults) query.execute(); assertThat(results.size()).isEqualTo(numObjects); }); doTestCriticalHeapAndQueryTimeout(server, client, disabledQueryMonitorForLowMem, queryTimeout, hitCriticalThreshold); if (hitCriticalThreshold) { vmRecoversFromCriticalHeap(server); await().until(() -> vmCheckCritcalHeap(server) == EVICTION_DISABLED); } } finally { stopServer(server); } }
Source:
private Properties getCredential() throws IOException { Properties properties = new Properties(); try { properties.load(new FileReader( new File(getClass().getClassLoader().getResource("sdk_config.properties").getFile()))); } catch (FileNotFoundException e) { return null; } return properties; }

Target:
public static ClientCredentials getCredential() { ClientCredentials credentials = new ClientCredentials(); Properties configFileProperties = getConfigFileProperties(); mergeProperties(configFileProperties, configurationMap); credentials.setClientID(configurationMap.get(Constants.CLIENT_ID)); credentials.setClientSecret(configurationMap.get(Constants.CLIENT_SECRET)); return credentials; }
Source:
private ProducerRecord<byte[], byte[]> convertToProducerRecord(String topicName, DatastreamProducerRecord record, Object event) throws DatastreamException { Optional<Integer> partition = record.getPartition(); byte[] keyValue = new byte[0]; byte[] payloadValue = new byte[0]; if (event instanceof BrooklinEnvelope) { BrooklinEnvelope envelope = (BrooklinEnvelope) event; if (envelope.key().isPresent() && envelope.key().get() instanceof byte[]) { keyValue = (byte[]) envelope.key().get(); } if (envelope.value().isPresent() && envelope.value().get() instanceof byte[]) { payloadValue = (byte[]) envelope.value().get(); } } else if (event instanceof byte[]) { payloadValue = (byte[]) event; } if (partition.isPresent() && partition.get() >= 0) { return new ProducerRecord<>(topicName, partition.get(), keyValue, payloadValue); } else { ProducerRecord<byte[], byte[]> producerRecord = new ProducerRecord<>(topicName, payloadValue); if (record.getPartitionKey().isPresent()) { keyValue = record.getPartitionKey().get().getBytes(); producerRecord = new ProducerRecord<>(topicName, keyValue, payloadValue); } return producerRecord; } }

Target:
private ProducerRecord<byte[], byte[]> convertToProducerRecord(String topicName, DatastreamProducerRecord record, Object event) { Optional<Integer> partition = record.getPartition(); byte[] keyValue = new byte[0]; byte[] payloadValue = new byte[0]; if (event instanceof BrooklinEnvelope) { BrooklinEnvelope envelope = (BrooklinEnvelope) event; if (envelope.key().isPresent() && envelope.key().get() instanceof byte[]) { keyValue = (byte[]) envelope.key().get(); } if (envelope.value().isPresent() && envelope.value().get() instanceof byte[]) { payloadValue = (byte[]) envelope.value().get(); } } else if (event instanceof byte[]) { payloadValue = (byte[]) event; } if (partition.isPresent() && partition.get() >= 0) { return new ProducerRecord<>(topicName, partition.get(), keyValue, payloadValue); } else { keyValue = record.getPartitionKey().isPresent() ? record.getPartitionKey().get().getBytes(StandardCharsets.UTF_8) : null; return new ProducerRecord<>(topicName, keyValue, payloadValue); } }
Source:
public void init() throws IOException, ProcedureException { String[] properties = config.get( LoadableBloomFulltextConfig.bloom_indexed_properties ).toArray( new String[0] ); Analyzer analyzer; try { Class configuredAnalayzer = Class.forName( config.get( LoadableBloomFulltextConfig.bloom_analyzer ) ); analyzer = (Analyzer) configuredAnalayzer.newInstance(); } catch ( Exception e ) { throw new RuntimeException( "Could not create the configured analyzer", e ); } FulltextProvider provider = FulltextProvider.instance( db ); FulltextFactory fulltextFactory = new FulltextFactory( fileSystemAbstraction, storeDir, analyzer ); String bloomNodes = "bloomNodes"; fulltextFactory.createFulltextIndex( bloomNodes, FulltextProvider.FULLTEXT_INDEX_TYPE.NODES, properties, provider ); String bloomRelationships = "bloomRelationships"; fulltextFactory.createFulltextIndex( bloomRelationships, FulltextProvider.FULLTEXT_INDEX_TYPE.RELATIONSHIPS, properties, provider ); procedures.register( new BloomProcedure( FulltextProvider.FULLTEXT_INDEX_TYPE.NODES, bloomNodes, provider ) ); procedures.register( new BloomProcedure( FulltextProvider.FULLTEXT_INDEX_TYPE.RELATIONSHIPS, bloomRelationships, provider ) ); }

Target:
public void init() throws IOException, KernelException { List<String> properties = config.get( LoadableBloomFulltextConfig.bloom_indexed_properties ); Analyzer analyzer = getAnalyzer(); provider = new FulltextProvider( db, logService.getInternalLog( FulltextProvider.class ) ); FulltextFactory fulltextFactory = new FulltextFactory( fileSystemAbstraction, storeDir, analyzer ); fulltextFactory.createFulltextIndex( BLOOM_NODES, FulltextProvider.FulltextIndexType.NODES, properties, provider ); fulltextFactory.createFulltextIndex( BLOOM_RELATIONSHIPS, FulltextProvider.FulltextIndexType.RELATIONSHIPS, properties, provider ); procedures.registerComponent( FulltextProvider.class, context -> provider, true ); procedures.registerProcedure( BloomProcedures.class ); }
Source:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { int numaCount = vmNumaNodes.size(); int index = 0; for (VmNumaNode vmNode : vmNumaNodes) { index += vmNode.getCpuIds().size(); } if (onlineCpus != index) { offlineCpus = vcpus - index; } if (offlineCpus > 0) { numaCount = vmNumaNodes.size(); for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }

Target:
public List<VmNumaNode> getVmNumaNodes(VM vm) { int onlineCpus = vm.getNumOfCpus(); int vcpus = FeatureSupported.supportedInConfig(ConfigValues.HotPlugCpuSupported, vm.getCompatibilityVersion(), vm.getClusterArch()) ? VmCpuCountHelper.calcMaxVCpu(vm, vm.getClusterCompatibilityVersion()) : onlineCpus; int offlineCpus = vcpus - onlineCpus; List<VmNumaNode> vmNumaNodes = vmNumaNodeDao.getAllVmNumaNodeByVmId(vm.getId()); if (!vmNumaNodes.isEmpty()) { int index = 0; for (VmNumaNode vmNode : vmNumaNodes) { index += vmNode.getCpuIds().size(); } if (onlineCpus != index) { offlineCpus = vcpus - index; } if (offlineCpus > 0) { int numaCount = vmNumaNodes.size(); for (VmNumaNode vmNode : vmNumaNodes) { if (numaCount <= 0) { break; } for (int i = vmNode.getCpuIds().size(); i < vcpus / numaCount; i++) { vmNode.getCpuIds().add(index++); } vcpus -= vcpus / numaCount; --numaCount; } } return vmNumaNodes; } if (offlineCpus > 0) { VmNumaNode vmNode = new VmNumaNode(); vmNode.setIndex(0); vmNode.setMemTotal(vm.getMemSizeMb()); for (int i = 0; i < vcpus; i++) { vmNode.getCpuIds().add(i); } return Collections.singletonList(vmNode); } return Collections.emptyList(); }
Source:
public Boolean call(String[] tokens) throws Exception { try { Boolean keep = true; for (Integer index : indices) { if (index >= tokens.length || MLConstants.EMPTY.equals(tokens[index]) || MLConstants.NA.equals(tokens[index]) || MLConstants.QUESTION.equals(tokens[index])) { keep = false; break; } } MLConstants.SUPERVISED_ALGORITHM.values(); return keep; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while removing discarded rows: " + e.getMessage(), e); } }

Target:
public Boolean call(String[] tokens) throws Exception { try { Boolean keep = true; for (Integer index : indices) { if (index >= tokens.length || MLConstants.MISSING_VALUES.contains(tokens[index])) { keep = false; break; } } MLConstants.SUPERVISED_ALGORITHM.values(); return keep; } catch (Exception e) { throw new MLModelBuilderException("An error occurred while removing discarded rows: " + e.getMessage(), e); } }
Source:
public void run(Blob blob) throws OperationException, IOException { if (blob == null) { throw new OperationException("there is no file content available"); } final DownloadService downloads = Framework.getService(DownloadService.class); String key = downloads.store(Collections.singletonList(blob)); String url = BaseURL.getBaseURL() + "/" + downloads.getDownloadUrl(key); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); try { request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, new Boolean(true)); externalContext.redirect(url); response.flushBuffer(); FacesContext.getCurrentInstance().responseComplete(); ctx.getVars().put("Outcome", null); } catch (IOException e) { log.error("Error while redirecting for big blob downloader", e); } }

Target:
public void run(Blob blob) throws OperationException, IOException { if (blob == null) { throw new OperationException("there is no file content available"); } DownloadService downloadService = Framework.getService(DownloadService.class); String key = downloadService.storeBlobs(Collections.singletonList(blob)); String url = BaseURL.getBaseURL() + "/" + downloadService.getDownloadUrl(key); ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext(); HttpServletRequest request = (HttpServletRequest) externalContext.getRequest(); HttpServletResponse response = (HttpServletResponse) externalContext.getResponse(); try { request.setAttribute(NXAuthConstants.DISABLE_REDIRECT_REQUEST_KEY, new Boolean(true)); externalContext.redirect(url); response.flushBuffer(); FacesContext.getCurrentInstance().responseComplete(); ctx.getVars().put("Outcome", null); } catch (IOException e) { log.error("Error while redirecting for big blob downloader", e); } }
Source:
public List<AdditionalCredentials> getAdditionalCredentials() { return(additionalCredentials); }

Target:
public List<AdditionalCredentials> getAdditionalCredentials() { if(additionalCredentials==null) { return Collections.emptyList(); } return Collections.unmodifiableList(additionalCredentials); }
Source:
public void apply(Project project) { project.getTasks().withType(JavaCompile.class).configureEach(t -> { t.getOptions().setEncoding("UTF-8"); }); }

Target:
public void apply(Project project) { project.getTasks().withType(JavaCompile.class).configureEach(javaCompileTask -> { javaCompileTask.getOptions().setEncoding("UTF-8"); }); }
Source:
public OAuth2AccessToken readAccessToken(String accessToken) { if (isApiKey(accessToken)) { return remoteTokenServices.readAccessToken(accessToken); } return jwtTokenService.readAccessToken(accessToken); }

Target:
public OAuth2AccessToken readAccessToken(String accessToken) { if (isApiKey(accessToken)) { return retryTemplate.execute(x ->remoteTokenServices.readAccessToken(accessToken)); } return jwtTokenService.readAccessToken(accessToken); }
Source:
private void configureTimeouts(DefaultHttpClient httpClient) { int socketTimeOut = Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderTimeout) * 1000; int connectionTimeOut = Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderConnectionTimeout) * 1000; HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, connectionTimeOut); HttpConnectionParams.setSoTimeout(params, socketTimeOut); }

Target:
private void configureTimeouts(DefaultHttpClient httpClient) { long socketTimeOut = TimeUnit.SECONDS.toMillis( Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderTimeout)); long connectionTimeOut = TimeUnit.SECONDS.toMillis( Config.<Integer> getValue(ConfigValues.ExternalNetworkProviderConnectionTimeout)); HttpParams params = httpClient.getParams(); HttpConnectionParams.setConnectionTimeout(params, toIntExact(connectionTimeOut)); HttpConnectionParams.setSoTimeout(params, toIntExact(socketTimeOut)); }
Source:
public void closeOperationShouldWaitUntilAllCurrentOperationsWillBeFinished() throws Exception { final String message1 = "Message 1"; final String message2 = "Message 2"; WaitingAnswer<Void> waitingAnswer1 = waitOnWrite(lineConsumer2, message1); WaitingAnswer<Void> waitingAnswer2 = waitOnWrite(lineConsumer2, message2); executor.execute(concurrentCompositeLineConsumer::close); waitingAnswer1.completeAnswer(); waitingAnswer2.completeAnswer(); awaitFinalization(); assertFalse(concurrentCompositeLineConsumer.isOpen()); for (LineConsumer consumer : subConsumers) { verify(consumer).writeLine(eq(message1)); verify(consumer).writeLine(eq(message2)); } }

Target:
public void closeOperationShouldWaitUntilAllCurrentOperationsWillBeFinished() throws Exception { final String message1 = "Message 1"; final String message2 = "Message 2"; WaitingAnswer<Void> waitingAnswer1 = waitOnWrite(lineConsumer2, message1); WaitingAnswer<Void> waitingAnswer2 = waitOnWrite(lineConsumer2, message2); executor.execute(concurrentCompositeLineConsumer::close); waitingAnswer1.completeAnswer(); waitingAnswer2.completeAnswer(); awaitFinalization(); assertFalse(concurrentCompositeLineConsumer.isOpen()); for (LineConsumer consumer : subConsumers) { verify(consumer).writeLine(eq(message1)); verify(consumer).writeLine(eq(message2)); verify(consumer, last()).close(); } }
Source:
private static void parseJson( HttpMessage message, Value value, boolean strictEncoding, String charset ) throws IOException { try { JsUtils.parseJsonIntoValue( new InputStreamReader( new ByteArrayInputStream( message.content() ), charset ), value, strictEncoding ); } catch ( IOException e ) { value.setValue( new String( message.content() )); } }

Target:
private static void parseJson( HttpMessage message, Value value, boolean strictEncoding, String charset ) throws IOException { JsUtils.parseJsonIntoValue( new InputStreamReader( new ByteArrayInputStream( message.content() ), charset ), value, strictEncoding ); }
Source:
public void authenticate(Request request) throws RequestAuthenticationException { if (clientCredentials != null && clientCredentials.getCredentials() != null) { OAuth2AccessToken oAuth2AccessToken = clientCredentials.getCredentials(); if (oAuth2AccessToken != null) { if (oAuth2AccessToken.hasExpired()) { log.debug("OAuth2 access token expiry detected. Will fetch a new token from Authorization server"); try { OAuth2ClientCredentials oAuth2ClientCredentials = (OAuth2ClientCredentials) clientCredentials; oAuth2ClientCredentials.reset(); oAuth2AccessToken = oAuth2ClientCredentials.getAccessTokenRetrieverService().getOAuth2AccessToken(); oAuth2ClientCredentials.setCredentials(oAuth2AccessToken); } catch (IOException | InvalidKeyException e) { log.error("Exception occurred", e); throw new RuntimeException(e); } } request.getHeaders() .set(AUTHORIZATION_HEADER, "Bearer " + oAuth2AccessToken.getAccessToken()); } } }

Target:
public void authenticate(Request request) throws RequestAuthenticationException { OAuth2AccessToken oAuth2AccessToken = clientCredentials.getCredentials(); if (oAuth2AccessToken.hasExpired()) { log.debug("OAuth2 access token expiry detected. Will fetch a new token from Authorization server"); synchronized (this) { if (oAuth2AccessToken.hasExpired()) { try { OAuth2ClientCredentials oAuth2ClientCredentials = (OAuth2ClientCredentials) clientCredentials; oAuth2AccessToken = oAuth2ClientCredentials.getAccessTokenRetrieverService().getOAuth2AccessToken(); oAuth2ClientCredentials.setCredentials(oAuth2AccessToken); } catch (IOException | InvalidKeyException e) { throw new OAuth2TokenRetrieverException("Failed to renew expired OAuth2 access token", e); } } } } request.getHeaders().set(AUTHORIZATION_HEADER, "Bearer " + oAuth2AccessToken.getAccessToken()); }
Source:
public void modifyTable(TableName tableName, TableDescriptor tableDescriptor) throws IOException { if(isTableAvailable(tableName)) { modifyFamilies(tableName,tableDescriptor); deleteFamilies(tableName,tableDescriptor); }else { throw new TableNotFoundException(tableName); } }

Target:
public void modifyTable(TableName tableName, TableDescriptor tableDescriptor) throws IOException { if (isTableAvailable(tableName)) { TableDescriptor currentTableDescriptor = getTableDescriptor(tableName); List<Modification> modifications = new ArrayList<>(); List<HColumnDescriptor> columnDescriptors = tableAdapter2x.toHColumnDescriptors(tableDescriptor); List<HColumnDescriptor> currentColumnDescriptors = tableAdapter2x.toHColumnDescriptors(currentTableDescriptor); modifications.addAll(tableModificationAdapter.buildModifications(columnDescriptors, currentColumnDescriptors)); modifyColumn(tableName, "modifyTable", "update", (Modification[]) modifications.toArray()); } else { throw new TableNotFoundException(tableName); } }
Source:
void withDisabledEnrichment() { final Event event = createEvent(toMessage(newUuid())); final EventEnvelope notEnrichableEvent = EventEnvelope.of( event.toBuilder() .setContext(event.getContext() .toBuilder() .setEnrichment(event.getContext() .getEnrichment() .toBuilder() .setDoNotEnrich(true))) .build() ); assertFalse(enricher.canBeEnriched(notEnrichableEvent)); }

Target:
void withDisabledEnrichment() { final Event event = createEvent(toMessage(newUuid())); final Enrichment.Builder enrichment = event.getContext() .getEnrichment() .toBuilder() .setDoNotEnrich(true); final EventContext.Builder context = event.getContext() .toBuilder() .setEnrichment(enrichment); final EventEnvelope notEnrichableEvent = EventEnvelope.of( event.toBuilder() .setContext(context) .build() ); assertFalse(enricher.canBeEnriched(notEnrichableEvent)); }
Source:
public static String sortOrderSpeaker() { switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, 0)) { case SORT_TYPE_FIRST: return Speaker.Companion.getNAME(); case SORT_TYPE_SECOND: return Speaker.Companion.getORGANISATION(); case SORT_TYPE_THIRD: return Speaker.Companion.getCOUNTRY(); default: return Speaker.Companion.getNAME(); } }

Target:
public static String sortOrderSpeaker() { switch (SharedPreferencesUtil.getInt(ConstantStrings.PREF_SORT_SPEAKER, 0)) { case SORT_TYPE_FIRST: return Speaker.NAME; case SORT_TYPE_SECOND: return Speaker.ORGANISATION; case SORT_TYPE_THIRD: return Speaker.COUNTRY; default: return Speaker.NAME; } }
Source:
private boolean isInside(Object element) { if (element instanceof ASTNode) { return isInsideNode((ASTNode) element); } else if (element instanceof NodeProperty) { NodeProperty property= (NodeProperty) element; Object object= property.getNode(); if (object instanceof ASTNode) { return isInsideNode((ASTNode) object); } else if (object instanceof List) { for (Object child : ((List<?>) object)) { if (isInside(child)) { return true; } } } } return false; }

Target:
private boolean isInside(Object element) { if (element instanceof ASTNode) { return isInsideNode((ASTNode) element); } else if (element instanceof NodeProperty) { NodeProperty property= (NodeProperty) element; Object object= property.getNode(); if (object instanceof ASTNode) { return isInsideNode((ASTNode) object); } else if (object instanceof List) { for (Object child : (List<?>) object) { if (isInside(child)) { return true; } } } } return false; }
Source:
public static HazelcastOperation getHazelcastOperation(String name) { if (name == null) { return null; } for (HazelcastOperation hazelcastOperation : values()) { if (hazelcastOperation.toString().equalsIgnoreCase(name)) { return hazelcastOperation; } } throw new IllegalArgumentException(String.format("Operation '%s' is not supported by this component.", name)); }

Target:
public static HazelcastOperation getHazelcastOperation(String name) { if (name == null) { return null; } for (HazelcastOperation hazelcastOperation : values) { if (hazelcastOperation.toString().equalsIgnoreCase(name) || hazelcastOperation.name().equalsIgnoreCase(name)) { return hazelcastOperation; } } throw new IllegalArgumentException(String.format("Operation '%s' is not supported by this component.", name)); }
Source:
protected void init() throws IOException { boolean bindWildcard = !StackProperties.getBoolean( StackProperties.BIND_WILDCARD, false); Set<InetSocketAddress> addressesToBind = new HashSet<>(); for (TransportAddress transportAddress : localAddresses) { addressesToBind.add( new InetSocketAddress( bindWildcard ? null : transportAddress.getAddress(), transportAddress.getPort() ) ); } for (InetSocketAddress addressToBind : addressesToBind ) { addSocketChannel( addressToBind ); } acceptThread = new AcceptThread(); acceptThread.start(); readThread = new ReadThread(); readThread.start(); }

Target:
protected void init() throws IOException { boolean bindWildcard = StackProperties.getBoolean( StackProperties.BIND_WILDCARD, false); Set<InetSocketAddress> addressesToBind = new HashSet<>(); for (TransportAddress transportAddress : localAddresses) { addressesToBind.add( new InetSocketAddress( bindWildcard ? null : transportAddress.getAddress(), transportAddress.getPort() ) ); } for (InetSocketAddress addressToBind : addressesToBind ) { addSocketChannel( addressToBind ); } acceptThread = new AcceptThread(); acceptThread.start(); readThread = new ReadThread(); readThread.start(); }
Source:
public BuildContextImpl(BuildContextImpl buildContext) { this.context = buildContext.getContext(); this.dockerfile = buildContext.getDockerfile(); }

Target:
public BuildContextImpl(BuildContextImpl buildContext) { this(buildContext.getContext(),buildContext.getDockerfile(), buildContext.getArgs()); }
Source:
private boolean checkDwhConfigInEngine() { boolean isOk = true; String hostname = null; String uuid = null; try (Connection c = engineDataSource.getConnection(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM dwh_history_timekeeping WHERE var_name IN ('dwhHostname', 'dwhUuid')")) { while (rs.next()) { String varName = StringUtils.trimToNull(rs.getString("var_name")); String varValue = StringUtils.trimToNull(rs.getString("var_value")); switch (varName) { case "dwhHostname": hostname = varValue; break; case "dwhUuid": uuid = varValue; break; } } } catch (SQLException e) { log.error("Could not access dwh_history_timekeeping", e); } if (StringUtils.isEmpty(hostname) && StringUtils.isEmpty(uuid)) { log.warn("No valid DWH configurations were found, assuming DWH database isn't setup."); isOk = false; } return isOk; }

Target:
private boolean checkDwhConfigInEngine() { boolean isOk = true; String hostname = null; String uuid = null; try (Connection c = engineDataSource.getConnection(); Statement s = c.createStatement(); ResultSet rs = s.executeQuery("SELECT * FROM dwh_history_timekeeping WHERE var_name IN ('dwhHostname', 'dwhUuid')")) { while (rs.next()) { String varName = StringUtils.trimToNull(rs.getString("var_name")); String varValue = StringUtils.trimToNull(rs.getString("var_value")); switch (varName) { case "dwhHostname": hostname = varValue; break; case "dwhUuid": uuid = varValue; break; } } } catch (SQLException e) { log.error("Could not access engine's DWH configuration table", e); } if (StringUtils.isEmpty(hostname) || StringUtils.isEmpty(uuid)) { log.warn("No valid DWH configurations were found, assuming DWH database isn't setup."); isOk = false; } return isOk; }
Source:
private static PipelineStatus getPipelineStatus(List<DriverContext> driverContexts) { int queuedDrivers = 0; int runningDrivers = 0; int blockedDrivers = 0; int queuedPartitionedDrivers = 0; int runningPartitionedDrivers = 0; for (DriverContext driverContext : driverContexts) { if (!driverContext.isExecutionStarted()) { queuedDrivers++; if (driverContext.isPartitioned()) { queuedPartitionedDrivers++; } } else if (driverContext.isFullyBlocked()) { blockedDrivers++; } else { runningDrivers++; if (driverContext.isPartitioned()) { runningPartitionedDrivers++; } } } return new PipelineStatus(queuedDrivers, runningDrivers, blockedDrivers, queuedPartitionedDrivers, runningPartitionedDrivers); }

Target:
private PipelineStatus getPipelineStatus(List<DriverContext> driverContexts) { int queuedDrivers = 0; int runningDrivers = 0; int blockedDrivers = 0; int queuedPartitionedDrivers = 0; int runningPartitionedDrivers = 0; for (DriverContext driverContext : driverContexts) { if (!driverContext.isExecutionStarted()) { queuedDrivers++; if (driverContext.isPartitioned()) { queuedPartitionedDrivers++; } } else if (driverContext.isFullyBlocked()) { blockedDrivers++; } else { runningDrivers++; if (driverContext.isPartitioned()) { runningPartitionedDrivers++; } } } return new PipelineStatus(queuedDrivers, runningDrivers, blockedDrivers, queuedPartitionedDrivers, runningPartitionedDrivers); }
Source:
public RedisTestMessageBus(RedisConnectionFactory connectionFactory, MultiTypeCodec<Object> codec) { RedisMessageBus messageBus = new RedisMessageBus(connectionFactory, codec); this.setMessageBus(messageBus); GenericApplicationContext context = new GenericApplicationContext(); context.refresh(); messageBus.setApplicationContext(context); this.setMessageBus(messageBus); template = new StringRedisTemplate(connectionFactory); }

Target:
public RedisTestMessageBus(RedisConnectionFactory connectionFactory, MultiTypeCodec<Object> codec) { RedisMessageBus messageBus = new RedisMessageBus(connectionFactory, codec); GenericApplicationContext context = new GenericApplicationContext(); context.refresh(); messageBus.setApplicationContext(context); setMessageBus(messageBus); template = new StringRedisTemplate(connectionFactory); }
Source:
protected void aeadOutgoingBuffer(Buffer buf, int offset, int len) throws Exception { if (outCipher instanceof BaseGCMCipher) { BaseGCMCipher cipher = (BaseGCMCipher) outCipher; buf.wpos(offset + Integer.BYTES + len + cipher.getAuthenticationTagSize()); byte[] data = buf.array(); cipher.incrementIV(); cipher.updateAAD(data, offset, Integer.BYTES); cipher.update(data, offset + Integer.BYTES, len); cipher.doFinal(data, offset + Integer.BYTES + len); int blocksCount = len / outCipherSize; outBlocksCount.addAndGet(Math.max(1, blocksCount)); } }

Target:
protected void aeadOutgoingBuffer(Buffer buf, int offset, int len) throws Exception { if (outCipher == null || outCipher.getAuthenticationTagSize() == 0) { throw new IllegalArgumentException("AEAD mode requires an AEAD cipher"); } byte[] data = buf.array(); outCipher.updateWithAAD(data, offset, Integer.BYTES, len); int blocksCount = len / outCipherSize; outBlocksCount.addAndGet(Math.max(1, blocksCount)); }
Source:
public void verifyPhoneNumber(final String number, boolean force) { setResult(Resource.<Pair<String, PhoneAuthCredential>>forLoading()); getPhoneAuth().verifyPhoneNumber( number, AUTO_RETRIEVAL_TIMEOUT_SECONDS, TimeUnit.SECONDS, TaskExecutors.MAIN_THREAD, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { @Override public void onVerificationCompleted(@NonNull PhoneAuthCredential credential) { setResult(Resource.forSuccess(Pair.create(number, credential))); } @Override public void onVerificationFailed(FirebaseException e) { setResult(Resource.<Pair<String, PhoneAuthCredential>>forFailure(e)); } @Override public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider.ForceResendingToken token) { mVerificationId = verificationId; mForceResendingToken = token; setResult(Resource.<Pair<String, PhoneAuthCredential>>forFailure( new PhoneNumberVerificationRequiredException(number))); } }, force ? mForceResendingToken : null); }

Target:
public void verifyPhoneNumber(final String number, boolean force) { setResult(Resource.<PhoneVerification>forLoading()); getPhoneAuth().verifyPhoneNumber( number, AUTO_RETRIEVAL_TIMEOUT_SECONDS, TimeUnit.SECONDS, TaskExecutors.MAIN_THREAD, new PhoneAuthProvider.OnVerificationStateChangedCallbacks() { @Override public void onVerificationCompleted(@NonNull PhoneAuthCredential credential) { setResult(Resource.forSuccess(new PhoneVerification( number, credential, true))); } @Override public void onVerificationFailed(FirebaseException e) { setResult(Resource.<PhoneVerification>forFailure(e)); } @Override public void onCodeSent(@NonNull String verificationId, @NonNull PhoneAuthProvider.ForceResendingToken token) { mVerificationId = verificationId; mForceResendingToken = token; setResult(Resource.<PhoneVerification>forFailure( new PhoneNumberVerificationRequiredException(number))); } }, force ? mForceResendingToken : null); }
Source:
HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, ServiceRequestContext ctx, HttpRequest req) { CompletableCallback result = new CompletableCallback(); CompletableFuture<AggregatedHttpRequest> requestFuture = ctx.makeContextAware( req.aggregateWithPooledObjects(ctx.eventLoop(), ctx.alloc()) ); requestFuture.handle((msg, t) -> { if (t != null) { result.onError(t); return null; } final HttpData content; try { content = UnzippingBytesRequestConverter.convertRequest(ctx, msg); } catch (IllegalArgumentException e) { result.onError(e); return null; } try { if (content.isEmpty()) { result.onSuccess(null); return null; } final ByteBuffer nioBuffer; if (content instanceof ByteBufHolder) { nioBuffer = ((ByteBufHolder) content).content().nioBuffer(); } else { nioBuffer = ByteBuffer.wrap(content.array()); } try { SpanBytesDecoderDetector.decoderForListMessage(nioBuffer); } catch (IllegalArgumentException e) { result.onError(new IllegalArgumentException("Expected a " + decoder + " encoded list\n")); return null; } SpanBytesDecoder unexpectedDecoder = testForUnexpectedFormat(decoder, nioBuffer); if (unexpectedDecoder != null) { result.onError(new IllegalArgumentException( "Expected a " + decoder + " encoded list, but received: " + unexpectedDecoder + "\n")); return null; } List<Span> spans = new ArrayList<>(); if (!decoder.decodeList(nioBuffer, spans)) { result.onError(new IllegalArgumentException("Empty " + decoder.name() + " message")); return null; } collector.accept(spans, result); } finally { ReferenceCountUtil.release(content); } return null; }); return HttpResponse.from(result); }

Target:
HttpResponse validateAndStoreSpans(SpanBytesDecoder decoder, ServiceRequestContext ctx, HttpRequest req) { CompletableCallback result = new CompletableCallback(); req.aggregateWithPooledObjects(ctx.eventLoop(), ctx.alloc()).handleAsync((msg, t) -> { if (t != null) { result.onError(t); return null; } final HttpData content; try { content = UnzippingBytesRequestConverter.convertRequest(ctx, msg); } catch (IllegalArgumentException e) { result.onError(e); return null; } try { if (content.isEmpty()) { result.onSuccess(null); return null; } final ByteBuffer nioBuffer; if (content instanceof ByteBufHolder) { nioBuffer = ((ByteBufHolder) content).content().nioBuffer(); } else { nioBuffer = ByteBuffer.wrap(content.array()); } try { SpanBytesDecoderDetector.decoderForListMessage(nioBuffer); } catch (IllegalArgumentException e) { result.onError(new IllegalArgumentException("Expected a " + decoder + " encoded list\n")); return null; } SpanBytesDecoder unexpectedDecoder = testForUnexpectedFormat(decoder, nioBuffer); if (unexpectedDecoder != null) { result.onError(new IllegalArgumentException( "Expected a " + decoder + " encoded list, but received: " + unexpectedDecoder + "\n")); return null; } List<Span> spans = new ArrayList<>(); if (!decoder.decodeList(nioBuffer, spans)) { result.onError(new IllegalArgumentException("Empty " + decoder.name() + " message")); return null; } collector.accept(spans, result); } finally { ReferenceCountUtil.release(content); } return null; }, ctx.contextAwareExecutor()); return HttpResponse.from(result); }
Source:
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, byte[] rowData) throws IOException { ByteBuffer bb = ByteBuffer.wrap(rowData); bb.order(ByteOrder.LITTLE_ENDIAN); final long generation = bb.getLong(); final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); final byte hasSchema = bb.get(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); List<String> colNames = new ArrayList<>(); List<Integer> colLengths = new ArrayList<>(); List<VoltType> colTypes = new ArrayList<>(); String tableName = null; if (hasSchema == 1) { tableName = decodeString(bb); colNames = new ArrayList<>(); colLengths = new ArrayList<>(); colTypes = new ArrayList<>(); for (int i = 0; i < columnCount; i++) { colNames.add(decodeString(bb)); colTypes.add(VoltType.get(bb.get())); colLengths.add(bb.getInt()); } } else { assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } tableName = previous.tableName; colNames = previous.names; colTypes = previous.types; colLengths = previous.lengths; } Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, pval, partitionColIndex, partition, generation, (hasSchema == 1)); }

Target:
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, byte[] rowData) throws IOException { ByteBuffer bb = ByteBuffer.wrap(rowData); bb.order(ByteOrder.LITTLE_ENDIAN); final long generation = bb.getLong(); final int partitionColIndex = bb.getInt(); final int columnCount = bb.getInt(); final byte hasSchema = bb.get(); assert(columnCount <= DDLCompiler.MAX_COLUMNS); boolean[] is_null = extractNullFlags(bb, columnCount); List<String> colNames = new ArrayList<>(); List<Integer> colLengths = new ArrayList<>(); List<VoltType> colTypes = new ArrayList<>(); String tableName = null; if (hasSchema == 1) { tableName = decodeString(bb); for (int i = 0; i < columnCount; i++) { colNames.add(decodeString(bb)); colTypes.add(VoltType.get(bb.get())); colLengths.add(bb.getInt()); } } else { assert(previous != null); if (previous == null) { throw new IOException("Export block with no schema found without prior block with schema."); } tableName = previous.tableName; colNames = previous.names; colTypes = previous.types; colLengths = previous.lengths; } Object[] retval = new Object[colNames.size()]; Object pval = null; for (int i = 0; i < colNames.size(); ++i) { if (is_null[i]) { retval[i] = null; } else { retval[i] = decodeNextColumn(bb, colTypes.get(i)); } if (i == partitionColIndex) { pval = retval[i]; } } return new ExportRow(tableName, colNames, colTypes, colLengths, retval, (pval == null ? partition : pval), partitionColIndex, partition, generation); }
Source:
public void testGetNetworkFiltersByVersion() { final Version version = new Version("3.6"); final List<NetworkFilter> allNetworkFilter = dao.getNetworkFiltersByVersion(version); assertNotNull(allNetworkFilter); assertEquals(1, allNetworkFilter.size()); }

Target:
public void testGetNetworkFiltersByVersion() { final Version version = new Version("4.0"); final List<NetworkFilter> allNetworkFilter = dao.getNetworkFiltersByVersion(version); assertNotNull(allNetworkFilter); assertEquals(1, allNetworkFilter.size()); final NetworkFilter expectedNetworkFilter = expectedNetworkFilter(); assertEquals(expectedNetworkFilter, allNetworkFilter.get(0)); }