auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Slice readOrSkip(boolean skip) throws IOException { if (currentPointer == null) { currentPointer = fileSystemWAL.walStartPointer; } do { if (inputStream == null) { inputStream = getInputStream(currentPointer); } if (inputStream != null && isOpenPathTmp && !fileSystemWAL.tempPartFiles.containsKey(currentPointer.partNum)) { close(); inputStream = getInputStream(currentPointer); } int ch1; if (inputStream != null && (ch1 = inputStream.read()) != -1) { int ch2 = inputStream.read(); int ch3 = inputStream.read(); int ch4 = inputStream.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) { throw new EOFException(); } int len = ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0)); Preconditions.checkState(len >= 0, "negative length"); if (!skip) { byte[] data = new byte[len]; inputStream.readFully(data); currentPointer.offset += len + 4; return new Slice(data); } else { long actualSkipped = inputStream.skip(len); if (actualSkipped != len) { throw new IOException("unable to skip " + len); } currentPointer.offset += len + 4; return null; } } } while (nextSegment()); close(); return null; }

Target:
private Slice readOrSkip(boolean skip) throws IOException { if (currentPointer == null) { currentPointer = fileSystemWAL.walStartPointer; } do { if (inputStream == null) { inputStream = getInputStream(currentPointer); } if (inputStream != null && isOpenPathTmp && !fileSystemWAL.tempPartFiles.containsKey(currentPointer.partNum)) { close(); inputStream = getInputStream(currentPointer); } int len = readLen(inputStream); if (len != -1) { if (!skip) { byte[] data = new byte[len]; inputStream.readFully(data); currentPointer.offset += len + 4; return new Slice(data); } else { long actualSkipped = inputStream.skip(len); if (actualSkipped != len) { throw new IOException("unable to skip " + len); } currentPointer.offset += len + 4; return null; } } } while (nextSegment()); close(); return null; }
Source:
public static synchronized Pkcs1Reader getInstance() { if (reader == null) { Iterator<Pkcs1Reader> iter = PKCS1_READER_LOADER.iterator(); if (!iter.hasNext()) { throw new IllegalStateException( "No Pkcs1Reader services were present. Ensure that a Pkcs1Reader with a properly configured " + "META-INF/services/ entry is present on the classpath."); } reader = iter.next(); } return reader; }

Target:
public static Pkcs1Reader getInstance() { return PKCS1_READER_SUPPLIER.get(); }
Source:
public void requestResults( String query, Searcher searcher ) { String queryNormalized = StringNormalizer.normalize( query ); FuzzyScore fuzzyScore = new FuzzyScore(); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for( AppPojo pojo : pojos ) { pojo.displayName = pojo.name; pojo.displayTags = pojo.tags; boolean match = fuzzyScore.match( queryNormalized, pojo.nameNormalized, matchInfo ); pojo.relevance = matchInfo.score; if ( match ) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setDisplayNameHighlightRegion( positions ); } catch( Exception e ) { StringBuilder sb = new StringBuilder(); for( Pair p : positions ) sb.append( "<" ) .append( p.first ) .append( "," ) .append( p.second ) .append( ">" ); Log.e( "TBog", sb.toString(), e ); pojo.setDisplayNameHighlightRegion( 0, pojo.nameNormalized.length() ); } } if( !pojo.tagsNormalized.isEmpty() ) { if( fuzzyScore.match( queryNormalized, pojo.tagsNormalized, matchInfo ) ) { if( !match || (matchInfo.score > pojo.relevance) ) { match = true; pojo.relevance = matchInfo.score; pojo.setTagHighlight( matchInfo.matchedIndices ); } } } if( match ) { if( !searcher.addResult( pojo ) ) return; } } }

Target:
public void requestResults( String query, Searcher searcher ) { StringNormalizer.Result queryNormalized = StringNormalizer.normalizeWithResult( query, false ); FuzzyScore fuzzyScore = new FuzzyScore( queryNormalized.codePoints ); FuzzyScore.MatchInfo matchInfo = new FuzzyScore.MatchInfo(); for( AppPojo pojo : pojos ) { boolean bDisplayNameSet = false; boolean bDisplayTagsSet = false; boolean match = fuzzyScore.match( pojo.normalizedName.codePoints, matchInfo ); pojo.relevance = matchInfo.score; if ( match ) { List<Pair<Integer, Integer>> positions = matchInfo.getMatchedSequences(); try { pojo.setDisplayNameHighlightRegion( positions ); } catch( Exception e ) { pojo.setDisplayNameHighlightRegion( 0, pojo.normalizedName.length() ); } bDisplayNameSet = true; } if( pojo.normalizedTags != null ) { if( fuzzyScore.match( pojo.normalizedTags.codePoints, matchInfo ) ) { if( !match || (matchInfo.score > pojo.relevance) ) { match = true; pojo.relevance = matchInfo.score; pojo.setTagHighlight( matchInfo.matchedIndices ); bDisplayTagsSet = true; } } } if( match ) { if ( !bDisplayNameSet ) pojo.displayName = pojo.getName(); if ( !bDisplayTagsSet ) pojo.displayTags = pojo.getTags(); if( !searcher.addResult( pojo ) ) return; } } }
Source:
private void chooseDistribution(PartitioningHandle distribution) { checkState(partitioningHandle.isPresent(), "No partitioning to choose from"); if (partitioningHandle.get().equals(distribution) || partitioningHandle.get().isSingleNode()) { return; } if (partitioningHandle.get().equals(SOURCE_DISTRIBUTION)) { partitioningHandle = Optional.of(distribution); return; } checkState(false, "Cannot set distribution to %s. Already set to %s", distribution, partitioningHandle); }

Target:
private void chooseDistribution(PartitioningHandle distribution) { checkState(partitioningHandle.isPresent(), "No partitioning to choose from"); if (partitioningHandle.get().equals(distribution) || partitioningHandle.get().isSingleNode() || isCompatibleSystemPartitioning(distribution)) { return; } if (partitioningHandle.get().equals(SOURCE_DISTRIBUTION)) { partitioningHandle = Optional.of(distribution); return; } throw new IllegalStateException(format( "Cannot set distribution to %s. Already set to %s", distribution, partitioningHandle)); }
Source:
private void cleanUpProjectOldInstallations(final Project project) throws ProjectManagerException, ExecutorManagerException { log.info("Cleaning up old install files older than " + (project.getVersion() - this.projectVersionRetention)); Map<Integer, Pair<ExecutionReference, ExecutableFlow>> activeFlows = this.executorLoader .fetchActiveFlows(); final List<Integer> versionsWithRunningExecutions = activeFlows.values() .stream().map(pair -> pair.getSecond()) .filter(exflow -> exflow.getProjectId() == project.getId()) .map(exflow -> exflow.getVersion()) .collect(Collectors.toList()); this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() - this.projectVersionRetention, versionsWithRunningExecutions); this.storageManager.cleanupProjectArtifacts(project.getId()); }

Target:
private void cleanUpProjectOldInstallations(final Project project) throws ProjectManagerException, ExecutorManagerException { log.info("Cleaning up old install files older than " + (project.getVersion() - this.projectVersionRetention)); final Map<Integer, Pair<ExecutionReference, ExecutableFlow>> unfinishedFlows = this.executorLoader .fetchUnfinishedFlowsMetadata(); final List<Integer> versionsWithUnfinishedExecutions = unfinishedFlows.values() .stream().map(pair -> pair.getSecond()) .filter(exflow -> exflow.getProjectId() == project.getId()) .map(exflow -> exflow.getVersion()) .collect(Collectors.toList()); this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() - this.projectVersionRetention, versionsWithUnfinishedExecutions); this.storageManager.cleanupProjectArtifacts(project.getId()); }
Source:
public static TimeSync initializeGPSD(InetSocketAddress gpsd, int timeSyncInterval, int localTimeRenew) { if (theInstance != null) { Logging.logMessage(Logging.LEVEL_WARN, Category.lifecycle, null, "time sync already running", new Object[0]); return theInstance; } TimeSync s = new TimeSync(ExtSyncSource.GPSD, null, gpsd, timeSyncInterval, localTimeRenew); s.start(); try { s.waitForStartup(); } catch (Exception e) { Logging.logError(Logging.LEVEL_ERROR, null, e); } return s; }

Target:
public static TimeSync initializeGPSD(InetSocketAddress gpsd, int timeSyncInterval, int localTimeRenew) throws Exception { if (theInstance != null) { Logging.logMessage(Logging.LEVEL_WARN, Category.lifecycle, null, "time sync already running", new Object[0]); return theInstance; } TimeSync s = new TimeSync(ExtSyncSource.GPSD, null, gpsd, timeSyncInterval, localTimeRenew); s.start(); s.waitForStartup(); return s; }
Source:
public synchronized WrappedChannel reserveChannel() { Channel reserved; boolean returned = false; if (channels.length == 1) { reserved = channels[0]; returned = true; } else { reserved = channels[channels.length - 1]; Channel[] newChannelArray = new Channel[channels.length - 1]; System.arraycopy(channels, 0, newChannelArray, 0, channels.length - 1); channels = newChannelArray; } return new WrappedChannel(reserved, returned); }

Target:
public synchronized PooledChannel reserveChannel() { Channel reserved; boolean returned = false; if (channels.length == 1) { reserved = channels[0]; returned = true; } else { reserved = channels[channels.length - 1]; Channel[] newChannelArray = new Channel[channels.length - 1]; System.arraycopy(channels, 0, newChannelArray, 0, channels.length - 1); channels = newChannelArray; } return new PooledChannel(reserved, returned); }
Source:
public int getCount() throws InterruptedException, KeeperException { ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); return ByteBuffer.wrap(m_zk.getData(m_path, fw, null)).getInt(); }

Target:
public int getCount() throws InterruptedException, KeeperException { return ByteBuffer.wrap(m_zk.getData(m_path, false, null)).getInt(); }
Source:
protected String getActiveMQBroker() { return this.aciveMqBroker; }

Target:
protected String getActiveMQBroker() { return this.activeMqBroker; }
Source:
public Optional<CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>>> get( CorfuTable.IndexName name) { String indexName = (name != null) ? name.get() : null; CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>> index = indices.get(indexName); if (index != null) { return Optional.of(index); } else { return Optional.empty(); } }

Target:
public Optional<CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>>> get( CorfuTable.IndexName name) { String indexName = Optional.ofNullable(name) .map(Supplier::get) .orElse(null); CorfuTable.Index<Message, CorfuRecord<Message, Message>, ? extends Comparable<?>> index = indices.get(indexName); if (index != null) { return Optional.of(index); } else { return Optional.empty(); } }
Source:
public void run() { try { while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.listening = true; RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } try { Thread.sleep(1); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } } } }

Target:
public void run() { try { while (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.listening = true; RedisQueueMessageDrivenEndpoint.this.popMessageAndSend(); } } finally { if (RedisQueueMessageDrivenEndpoint.this.active) { RedisQueueMessageDrivenEndpoint.this.restart(); } else { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.lock(); try { RedisQueueMessageDrivenEndpoint.this.lifecycleCondition.signalAll(); } finally { RedisQueueMessageDrivenEndpoint.this.lifecycleLock.unlock(); } } } }
Source:
public void init() { ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance(); System.setProperty("jsse.enableSNIExtension", "false"); MDKConfigurator mdkConfigurator = new MDKConfigurator(); acm.addContainmentBrowserContextConfigurator(mdkConfigurator); acm.addSearchBrowserContextConfigurator(mdkConfigurator); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator); acm.addMainMenuConfigurator(new MMSConfigurator()); EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader()); SRConfigurator srconfig = new SRConfigurator(); acm.addSearchBrowserContextConfigurator(srconfig); acm.addContainmentBrowserContextConfigurator(srconfig); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, srconfig); acm.addMainToolbarConfigurator(new OutputQueueStatusConfigurator()); acm.addMainToolbarConfigurator(new SyncStatusConfigurator()); getDebugExportImportPlugin().init(); getOclPlugin().init(); getVcPlugin().init(); MMSSyncPlugin.getInstance().init(); (new Thread(new OutputSyncRunner())).start(); loadExtensionJars(); configureEnvironmentOptions(); SpecificationDialogManager.getManager().addConfigurator(Element.class, new SpecificationNodeAspectsConfigurator()); }

Target:
public void init() { ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance(); System.setProperty("jsse.enableSNIExtension", "false"); MDKConfigurator mdkConfigurator = new MDKConfigurator(); acm.addContainmentBrowserContextConfigurator(mdkConfigurator); acm.addSearchBrowserContextConfigurator(mdkConfigurator); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator); acm.addMainMenuConfigurator(new MMSConfigurator()); EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader()); SRConfigurator srconfig = new SRConfigurator(); acm.addSearchBrowserContextConfigurator(srconfig); acm.addContainmentBrowserContextConfigurator(srconfig); acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, srconfig); acm.addMainToolbarConfigurator(new OutputQueueStatusConfigurator()); acm.addMainToolbarConfigurator(new SyncStatusConfigurator()); getDebugExportImportPlugin().init(); getOclPlugin().init(); getVcPlugin().init(); MMSSyncPlugin.getInstance().init(); (new Thread(new OutputSyncRunner())).start(); loadExtensionJars(); configureEnvironmentOptions(); }
Source:
private void checkNoResultView(EmptyQueryResultsFor query) { Activity activity = getActivity(); if (activity instanceof TaskProcessCallback) { if (discussionPostsAdapter.getCount() == 0) { String resultsText = ""; switch (query) { case FOLLOWING: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_following); break; case CATEGORY: resultsText = getActivity().getResources().getString(R.string.forum_no_results_in_category); break; case COURSE: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_all_posts); break; } if (postsFilter != DiscussionPostsFilter.ALL) { resultsText += " " + getActivity().getResources().getString(R.string.forum_no_results_with_filter); } ((TaskProcessCallback) activity).onMessage(MessageType.ERROR, resultsText); } else { ((TaskProcessCallback) activity).onMessage(MessageType.EMPTY, ""); } } }

Target:
private void checkNoResultView(EmptyQueryResultsFor query) { Activity activity = getActivity(); if (activity instanceof TaskProcessCallback) { if (discussionPostsAdapter.getCount() == 0) { String resultsText = ""; switch (query) { case FOLLOWING: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_following); break; case CATEGORY: resultsText = getActivity().getResources().getString(R.string.forum_no_results_in_category); break; case COURSE: resultsText = getActivity().getResources().getString(R.string.forum_no_results_for_all_posts); break; } if (postsFilter != DiscussionPostsFilter.ALL) { resultsText += "\n" + getActivity().getResources().getString(R.string.forum_no_results_with_filter); } ((TaskProcessCallback) activity).onMessage(MessageType.ERROR, resultsText); } else { ((TaskProcessCallback) activity).onMessage(MessageType.EMPTY, ""); } } }
Source:
public void testPartitionedSourceAndTargetWritingToTopLevel() throws IOException { PartitionStrategy partitionStrategy = new PartitionStrategy.Builder().hash( "username", 2).build(); Dataset<Record> inputDataset = repo.create("in", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); Dataset<Record> outputDataset = repo.create("out", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); writeTestUsers(inputDataset, 10); PartitionKey key = partitionStrategy.partitionKey(0); Dataset<Record> inputPart0 = inputDataset.getPartition(key, false); Pipeline pipeline = new MRPipeline(TestCrunchDatasets.class); PCollection<GenericData.Record> data = pipeline.read( CrunchDatasets.asSource(inputPart0, GenericData.Record.class)); pipeline.write(data, CrunchDatasets.asTarget(outputDataset), Target.WriteMode.APPEND); pipeline.run(); Assert.assertEquals(5, datasetSize(outputDataset)); }

Target:
public void testPartitionedSourceAndTargetWritingToTopLevel() throws IOException { PartitionStrategy partitionStrategy = new PartitionStrategy.Builder().hash( "username", 2).build(); Dataset<Record> inputDataset = repo.create("in", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); Dataset<Record> outputDataset = repo.create("out", new DatasetDescriptor.Builder() .schema(USER_SCHEMA).partitionStrategy(partitionStrategy).build()); writeTestUsers(inputDataset, 10); PartitionKey key = partitionStrategy.partitionKey(0); Dataset<Record> inputPart0 = inputDataset.getPartition(key, false); Pipeline pipeline = new MRPipeline(TestCrunchDatasets.class); PCollection<GenericData.Record> data = pipeline.read( CrunchDatasets.asSource(inputPart0, GenericData.Record.class)); pipeline.write(data, CrunchDatasets.asTarget(outputDataset), Target.WriteMode.APPEND); pipeline.run(); Assert.assertEquals(5, datasetSize(outputDataset)); Dataset<Record> outputPart0 = outputDataset.getPartition(key, false); Assert.assertNotNull(outputPart0); Assert.assertEquals(5, datasetSize(outputPart0)); }
Source:
void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } String viewRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); }

Target:
void prepare() throws InfrastructureException { KubernetesClient k8sClient = clientFactory.create(workspaceId); if (k8sClient.serviceAccounts().inNamespace(namespace).withName(serviceAccountName).get() == null) { createWorkspaceServiceAccount(k8sClient); } String execRoleName = "exec"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(execRoleName).get() == null) { createExecRole(k8sClient, execRoleName); } String viewRoleName = "workspace-view"; if (k8sClient.rbac().kubernetesRoles().inNamespace(namespace).withName(viewRoleName).get() == null) { createViewRole(k8sClient, viewRoleName); } k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createExecRoleBinding()); k8sClient .rbac() .kubernetesRoleBindings() .inNamespace(namespace) .createOrReplace(createViewRoleBinding()); }
Source:
void createsMessageBatchWithSize() { int maxLinkSize = 10000; int batchSize = 1024; int eventOverhead = 46; int maxEventPayload = batchSize - eventOverhead; final ServiceBusMessage message = new ServiceBusMessage(new byte[maxEventPayload]); final ServiceBusMessage tooLargeMessage = new ServiceBusMessage(new byte[maxEventPayload + 1]); final CreateBatchOptions options = new CreateBatchOptions().setMaximumSizeInBytes(batchSize); ServiceBusMessageBatch batch = new ServiceBusMessageBatch(batchSize, null, tracerProvider, messageSerializer); when(asyncSender.createBatch(options)).thenReturn(Mono.just(batch)); ServiceBusMessageBatch messageBatch = sender.createBatch(options); Assertions.assertEquals(batchSize, messageBatch.getMaxSizeInBytes()); Assertions.assertTrue(messageBatch.tryAdd(message)); Assertions.assertFalse(messageBatch.tryAdd(tooLargeMessage)); }

Target:
void createsMessageBatchWithSize() { int batchSize = 1024; final CreateBatchOptions options = new CreateBatchOptions().setMaximumSizeInBytes(batchSize); final ServiceBusMessageBatch batch = new ServiceBusMessageBatch(batchSize, null, null, null); when(asyncSender.createBatch(options)).thenReturn(Mono.just(batch)); ServiceBusMessageBatch messageBatch = sender.createBatch(options); Assertions.assertEquals(batch, messageBatch); }
Source:
public MavenRepositoryConfigurationDto convert(MavenRepositoryConfigurationForm mavenRepositoryConfigurationForm) { MavenRepositoryConfigurationDto configuration = new MavenRepositoryConfigurationDto(); configuration.setIndexingClassNamesEnabled(mavenRepositoryConfigurationForm.isIndexingClassNamesEnabled()); configuration.setIndexingEnabled(mavenRepositoryConfigurationForm.isIndexingEnabled()); configuration.setDownloadRemoteMavenIndexCronExpression( mavenRepositoryConfigurationForm.getDownloadRemoteMavenIndexCronExpression()); configuration.setRebuildMavenIndexesCronExpression( mavenRepositoryConfigurationForm.getRebuildMavenIndexesCronExpression()); return configuration; }

Target:
public MavenRepositoryConfigurationDto convert(MavenRepositoryConfigurationForm mavenRepositoryConfigurationForm) { MavenRepositoryConfigurationDto configuration = new MavenRepositoryConfigurationDto(); configuration.setIndexingClassNamesEnabled(mavenRepositoryConfigurationForm.isIndexingClassNamesEnabled()); configuration.setIndexingEnabled(mavenRepositoryConfigurationForm.isIndexingEnabled()); configuration.setCronExpression(mavenRepositoryConfigurationForm.getCronExpression()); return configuration; }
Source:
private PropertyAdapter createPropertyAdapter(final Method mutator, final Method accessor, final String name, final TypeToken<Object> propertyType) { final Annotation[] propertyAnnotations; if (mutator == null) { propertyAnnotations = accessor.getAnnotations(); } else { propertyAnnotations = ObjectArrays.concat(mutator.getAnnotations(), accessor.getAnnotations(), Annotation.class); } final BeanProperty property = new BeanProperty(name, accessor.getDeclaringClass(), propertyAnnotations, propertyType); final boolean handleName; final TypeAdapter<Object> delegateAdapter; @SuppressWarnings("unchecked") BeanAdapter<Object> beanAdapter = (BeanAdapter<Object>) beanAdapters.get(property .getTypeToken().getType()); if (null == beanAdapter) { TypeToken propertyTypeToken = property.getTypeToken(); for (Type knownType : beanAdapters.keySet()) { if (TypeToken.of(knownType).isAssignableFrom(propertyTypeToken)) { beanAdapter = beanAdapters.get(knownType); beanAdapters.put(propertyTypeToken.getType(), beanAdapter); break ; } } } if (null == beanAdapter) { handleName = true; delegateAdapter = create(propertyType); } else { handleName = false; delegateAdapter = new NullSafeTypeAdapter<Object>( new DecoratedBeanAdapter<Object>(property, beanAdapter)); } if (null != delegateAdapter) { return new PropertyAdapter(property, accessor, mutator, delegateAdapter, handleName); } else { throw new KasperQueryAdapterException("Complex Queries are not supported! " + "Please flatten your Pojo in order to contain only java literal " + "properties or register custom a TypeAdapter."); } }

Target:
private PropertyAdapter createPropertyAdapter(final Method mutator, final Method accessor, final String name, final TypeToken<Object> propertyType) { final Annotation[] propertyAnnotations; if (mutator == null) { propertyAnnotations = accessor.getAnnotations(); } else { propertyAnnotations = ObjectArrays.concat(mutator.getAnnotations(), accessor.getAnnotations(), Annotation.class); } final BeanProperty property = new BeanProperty(name, accessor.getDeclaringClass(), propertyAnnotations, propertyType); final boolean handleName; final TypeAdapter<Object> delegateAdapter; @SuppressWarnings("unchecked") BeanAdapter<Object> beanAdapter = (BeanAdapter<Object>) beanAdapters.get( property.getTypeToken().getType() ); if (null == beanAdapter) { final TypeToken propertyTypeToken = property.getTypeToken(); for (final Type knownType : beanAdapters.keySet()) { if (TypeToken.of(knownType).isAssignableFrom(propertyTypeToken)) { beanAdapter = beanAdapters.get(knownType); beanAdapters.put(propertyTypeToken.getType(), beanAdapter); break; } } } if (null == beanAdapter) { handleName = true; delegateAdapter = create(propertyType); } else { handleName = false; delegateAdapter = new NullSafeTypeAdapter<Object>( new DecoratedBeanAdapter<Object>(property, beanAdapter)); } if (null != delegateAdapter) { return new PropertyAdapter(property, accessor, mutator, delegateAdapter, handleName); } else { throw new KasperQueryAdapterException("Complex Queries are not supported! " + "Please flatten your Pojo in order to contain only java literal " + "properties or register custom a TypeAdapter."); } }
Source:
public TSVFlatDataParser( @JsonProperty("columns") List<String> columns, @JsonProperty("delimiter") String delimiter, @JsonProperty("listDelimiter") String listDelimiter, @JsonProperty("keyColumn") final String keyColumn, @JsonProperty("valueColumn") final String valueColumn ) { Preconditions.checkArgument( Preconditions.checkNotNull(columns, "`columns` list required").size() > 1, "Must specify more than one column to have a key value pair" ); final DelimitedParser delegate = new DelimitedParser( Optional.fromNullable(Strings.isNullOrEmpty(delimiter) ? null : delimiter), Optional.fromNullable(Strings.isNullOrEmpty(listDelimiter) ? null : listDelimiter) ); Preconditions.checkArgument( !(Strings.isNullOrEmpty(keyColumn) ^ Strings.isNullOrEmpty(valueColumn)), "Must specify both `keyColumn` and `valueColumn` or neither `keyColumn` nor `valueColumn`" ); delegate.setFieldNames(columns); this.columns = columns; this.delimiter = delimiter; this.listDelimiter = listDelimiter; this.keyColumn = Strings.isNullOrEmpty(keyColumn) ? columns.get(0) : keyColumn; this.valueColumn = Strings.isNullOrEmpty(valueColumn) ? columns.get(1) : valueColumn; Preconditions.checkArgument( columns.contains(this.keyColumn), "Column [%s] not found int columns: %s", this.keyColumn, Arrays.toString(columns.toArray()) ); Preconditions.checkArgument( columns.contains(this.valueColumn), "Column [%s] not found int columns: %s", this.valueColumn, Arrays.toString(columns.toArray()) ); this.parser = new DelegateParser(delegate, this.keyColumn, this.valueColumn); }

Target:
public TSVFlatDataParser( @JsonProperty("columns") List<String> columns, @JsonProperty("delimiter") String delimiter, @JsonProperty("listDelimiter") String listDelimiter, @JsonProperty("keyColumn") final String keyColumn, @JsonProperty("valueColumn") final String valueColumn ) { Preconditions.checkArgument( Preconditions.checkNotNull(columns, "`columns` list required").size() > 1, "Must specify more than one column to have a key value pair" ); final DelimitedParser delegate = new DelimitedParser( Optional.fromNullable(Strings.emptyToNull(delimiter)), Optional.fromNullable(Strings.emptyToNull(listDelimiter)) ); Preconditions.checkArgument( !(Strings.isNullOrEmpty(keyColumn) ^ Strings.isNullOrEmpty(valueColumn)), "Must specify both `keyColumn` and `valueColumn` or neither `keyColumn` nor `valueColumn`" ); delegate.setFieldNames(columns); this.columns = columns; this.delimiter = delimiter; this.listDelimiter = listDelimiter; this.keyColumn = Strings.isNullOrEmpty(keyColumn) ? columns.get(0) : keyColumn; this.valueColumn = Strings.isNullOrEmpty(valueColumn) ? columns.get(1) : valueColumn; Preconditions.checkArgument( columns.contains(this.keyColumn), "Column [%s] not found int columns: %s", this.keyColumn, Arrays.toString(columns.toArray()) ); Preconditions.checkArgument( columns.contains(this.valueColumn), "Column [%s] not found int columns: %s", this.valueColumn, Arrays.toString(columns.toArray()) ); this.parser = new DelegateParser(delegate, this.keyColumn, this.valueColumn); }
Source:
public static ExtensionProfile create(final List<Extension> extensions) { return new AutoValue_ExtensionProfile(extensions); }

Target:
public static ExtensionProfile create(final List<Extension> extensions) { return new AutoValue_ExtensionProfile(extensions == null ? ImmutableList.<Extension>of() : ImmutableList.copyOf(extensions)); }
Source:
public boolean autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) { if (!file.getViewProvider().getLanguages().contains(GoLanguage.INSTANCE) || !GoCodeInsightSettings.getInstance().ADD_UNAMBIGUOUS_IMPORTS_ON_THE_FLY) { return false; } int caretOffset = editor.getCaretModel().getOffset(); Document document = editor.getDocument(); int lineNumber = document.getLineNumber(caretOffset); int startOffset = document.getLineStartOffset(lineNumber); int endOffset = document.getLineEndOffset(lineNumber); List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffset); for (PsiElement element : elements) { if (element instanceof GoElement) { for (PsiReference reference : element.getReferences()) { if (reference instanceof GoReference) { GoImportPackageQuickFix fix = new GoImportPackageQuickFix(reference); if (fix.isAvailable(file.getProject(), editor, file)) { new GoImportPackageQuickFix(reference).applyFix(); return true; } } } } } return false; }

Target:
public boolean autoImportReferenceAtCursor(@NotNull Editor editor, @NotNull PsiFile file) { if (!file.getViewProvider().getLanguages().contains(GoLanguage.INSTANCE)) { return false; } int caretOffset = editor.getCaretModel().getOffset(); Document document = editor.getDocument(); int lineNumber = document.getLineNumber(caretOffset); int startOffset = document.getLineStartOffset(lineNumber); int endOffset = document.getLineEndOffset(lineNumber); List<PsiElement> elements = CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffset); for (PsiElement element : elements) { if (element instanceof GoCompositeElement) { for (PsiReference reference : element.getReferences()) { if (reference instanceof GoReference) { GoImportPackageQuickFix fix = new GoImportPackageQuickFix(reference); if (fix.isAvailable(file.getProject(), editor, file)) { fix.applyFix(); return true; } } } } } return false; }
Source:
HttpClient getHttpClient() { return null == httpClient ? new DefaultHttpClient() : httpClient; }

Target:
HttpClient getHttpClient() { return (null == httpClient) ? new DefaultHttpClient() : httpClient; }
Source:
public String getTargetTypeName(ILaunchTarget target) { return getContribution(target) == null ? null : getContribution(target).name; }

Target:
public String getTargetTypeName(ILaunchTarget target) { return getContribution(target).name; }
Source:
private final void throwIfInfeasibleTypeConversion(SQLStmt stmt, Class <?> argClass, int argInd, VoltType expectedType) { if (argClass.isArray()) { if (expectedType.acceptsArray(argClass)) { return; } } else { VoltType argType = VoltType.typeFromClass(argClass); if (argType == expectedType) { return; } if (argType == VoltType.STRING) { if (expectedType.isNumber() || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isNumber()) { if (expectedType.isNumber() || expectedType == VoltType.STRING || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isBackendIntegerType()) { if ((expectedType.isNumber() && argType != VoltType.DECIMAL) || expectedType == VoltType.STRING) { return; } } } String argTypeName = argClass.getSimpleName(); String preferredType = expectedType.getMostCompatibleJavaTypeName(); throw new VoltTypeException("Procedure " + m_procedureName + ": Incompatible parameter type: can not convert type '"+ argTypeName + "' to '"+ expectedType.getName() + "' for arg " + argInd + " for SQL stmt: " + stmt.getText() + "." + " Try explicitly using a " + preferredType + " parameter."); }

Target:
private final void throwIfInfeasibleTypeConversion(SQLStmt stmt, Class <?> argClass, int argInd, VoltType expectedType) { if (argClass.isArray()) { if (expectedType.acceptsArray(argClass)) { return; } } else { VoltType argType = VoltType.typeFromClass(argClass); if (argType == expectedType) { return; } if (argType == VoltType.STRING) { if (expectedType.isNumber() || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isNumber()) { if (expectedType.isNumber() || expectedType == VoltType.STRING || expectedType == VoltType.TIMESTAMP) { return; } } else if (argType.isBackendIntegerType()) { if (expectedType.isNumber() || expectedType == VoltType.STRING) { return; } } } String argTypeName = argClass.getSimpleName(); String preferredType = expectedType.getMostCompatibleJavaTypeName(); throw new VoltTypeException("Procedure " + m_procedureName + ": Incompatible parameter type: can not convert type '"+ argTypeName + "' to '"+ expectedType.getName() + "' for arg " + argInd + " for SQL stmt: " + stmt.getText() + "." + " Try explicitly using a " + preferredType + " parameter."); }
Source:
public final void processAsync(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator, TaskCallback callback) { SystemStream systemStream = ime.getSystemStreamPartition().getSystemStream(); InputOperatorImpl inputOpImpl = operatorImplGraph.getInputOperator(systemStream); if (inputOpImpl != null) { CompletionStage<Void> processFuture; MessageType messageType = MessageType.of(ime.getMessage()); switch (messageType) { case USER_MESSAGE: processFuture = inputOpImpl.onAsyncMessage(ime, collector, coordinator); break; case END_OF_STREAM: EndOfStreamMessage eosMessage = (EndOfStreamMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateEndOfStream(eosMessage, ime.getSystemStreamPartition(), collector, coordinator); break; case WATERMARK: WatermarkMessage watermarkMessage = (WatermarkMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateWatermark(watermarkMessage, ime.getSystemStreamPartition(), collector, coordinator); break; default: processFuture = failedFuture(new SamzaException("Unknown message type " + messageType + " encountered.")); break; } processFuture.whenComplete((val, ex) -> { if (ex != null) { callback.failure(ex); } else { callback.complete(); } }); } }

Target:
public final void processAsync(IncomingMessageEnvelope ime, MessageCollector collector, TaskCoordinator coordinator, TaskCallback callback) { SystemStream systemStream = ime.getSystemStreamPartition().getSystemStream(); InputOperatorImpl inputOpImpl = operatorImplGraph.getInputOperator(systemStream); if (inputOpImpl != null) { CompletionStage<Void> processFuture; MessageType messageType = MessageType.of(ime.getMessage()); switch (messageType) { case USER_MESSAGE: processFuture = inputOpImpl.onMessageAsync(ime, collector, coordinator); break; case END_OF_STREAM: EndOfStreamMessage eosMessage = (EndOfStreamMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateEndOfStream(eosMessage, ime.getSystemStreamPartition(), collector, coordinator); break; case WATERMARK: WatermarkMessage watermarkMessage = (WatermarkMessage) ime.getMessage(); processFuture = inputOpImpl.aggregateWatermark(watermarkMessage, ime.getSystemStreamPartition(), collector, coordinator); break; default: processFuture = failedFuture(new SamzaException("Unknown message type " + messageType + " encountered.")); break; } processFuture.whenComplete((val, ex) -> { if (ex != null) { callback.failure(ex); } else { callback.complete(); } }); } }
Source:
public void testAtsProgramInsertionFeatureNegativeInsertionRestCall() throws Exception { String result = doRequestString( "/ats/program/" + getSawProgram().getArtId() + "/insertion/" + Integer.toString(-5) + "/feature", HttpMethod.GET, null, javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Assert.assertTrue(result.contains("SERVER_ERROR")); }

Target:
public void testAtsProgramInsertionFeatureNegativeInsertionRestCall() throws Exception { String result = doRequestString( "/ats/program/" + getSawProgram().getUuid() + "/insertion/" + Integer.toString(-5) + "/feature", HttpMethod.GET, null, javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()); Assert.assertTrue(result.contains("SERVER_ERROR")); }
Source:
public IDMContext[] getFocus() { return new IDMContext[] { fCurrentThreadCtx, fCurrentStackFrameCtx }; }

Target:
public IDMContext[] getFocus() { return new IDMContext[] { fCurrentGDBFocus }; }
Source:
private String checkFormat(String format) throws GitLabApiException { if(format == null) throw new GitLabApiException("format should not be null"); if(validFormat.contains(format)) return ".".concat(format); else return ".tar.gz"; }

Target:
private String checkFormat(String format) throws GitLabApiException { if(format == null || format.isEmpty()) return "tar.gz"; if(!validFormat.contains(format)) throw new GitLabApiException("Invalid format! Options are tar.gz, tar.bz2, tbz, tbz2, tb2, bz2, tar, zip."); return format; }
Source:
private static boolean isMinMaxStatsSupported(PrimitiveType type) { return type != null && type.getPrimitiveTypeName() != PrimitiveTypeName.INT96 && type.getOriginalType() != OriginalType.INTERVAL; }

Target:
private static boolean isMinMaxStatsSupported(PrimitiveType type) { return type.columnOrder().getColumnOrderName() == ColumnOrderName.TYPE_DEFINED_ORDER; }
Source:
private void collectFiles(boolean isRoots, List<List<?>> fileList) { for (List<?> rootDescriptor : fileList) { String fileName = (String) rootDescriptor.get(0); if (fileName.endsWith("-bootstrap.js")) { continue; } @SuppressWarnings("unchecked") List<List<?>> fileProperties = (List<List<?>>) rootDescriptor.get(1); boolean isExterns = false; boolean isGoogModule = false; List<String> provides = new ArrayList<>(); for (List<?> tuple : fileProperties) { String key = (String) tuple.get(0); if ("is_externs".equals(key) && Boolean.TRUE.equals(tuple.get(1))) { isExterns = true; break; } if ("load_flags".equals(key)) { List<List<String>> loadFlags = (List<List<String>>) tuple.get(1); if (loadFlags.contains(ImmutableList.of("module", "goog"))) { isGoogModule = true; } } if ("provides".equals(key)) { List<String> provideList = (List<String>) tuple.get(1); if (provideList.size() > 1) { provides.addAll(provideList.subList(1, provideList.size())); } } } fileName = GENERATED_FILE.matcher(fileName).replaceAll("$1"); if (isExterns && isRoots) { rootExterns.add(fileName); } else if (isExterns && !isRoots) { nonrootExterns.add(fileName); } else if (isRoots) { roots.add(fileName); } else { nonroots.add(fileName); } if (!isGoogModule) { knownGoogProvides.addAll(provides); } } }

Target:
private void collectFiles(boolean isRoots, List<List<?>> fileList) { for (List<?> rootDescriptor : fileList) { String fileName = (String) rootDescriptor.get(0); if (fileName.endsWith("-bootstrap.js")) { continue; } @SuppressWarnings("unchecked") List<List<?>> fileProperties = (List<List<?>>) rootDescriptor.get(1); boolean isExterns = false; boolean isGoogProvide = true; List<String> provides = new ArrayList<>(); for (List<?> tuple : fileProperties) { String key = (String) tuple.get(0); if ("is_externs".equals(key) && Boolean.TRUE.equals(tuple.get(1))) { isExterns = true; break; } if ("load_flags".equals(key)) { List<List<String>> loadFlags = (List<List<String>>) tuple.get(1); if (loadFlags.contains(ImmutableList.of("module", "goog"))) { isGoogProvide = false; } } if ("provides".equals(key)) { List<String> provideList = (List<String>) tuple.get(1); if (provideList.size() > 1) { provides.addAll(provideList.subList(1, provideList.size())); } } } fileName = GENERATED_FILE.matcher(fileName).replaceAll("$1"); if (isExterns && isRoots) { rootExterns.add(fileName); } else if (isExterns && !isRoots) { nonrootExterns.add(fileName); } else if (isRoots) { roots.add(fileName); } else { nonroots.add(fileName); } if (isGoogProvide) { googProvides.addAll(provides); } } }
Source:
public void writeTo(OutputStream out) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; FileInputStream in = new FileInputStream(file()); float written = 0; try { int read; while ((read = in.read(buffer)) != -1 && !Thread.interrupted()) { out.write(buffer, 0, read); written += read; mListener.onProgress(written / length()); } } finally { in.close(); } }

Target:
public void writeTo(OutputStream out) throws IOException { byte[] buffer = new byte[BUFFER_SIZE]; FileInputStream in = new FileInputStream(file()); float written = 0; try { int read; long length = length(); while ((read = in.read(buffer)) != -1 && !Thread.interrupted()) { out.write(buffer, 0, read); written += read; mListener.onProgress(written / length); } } finally { in.close(); } }
Source:
protected ExecutionResult joinAllOf(List<CompletableFuture<ExecutionResult>> completableFutures) throws CompletionException { CompletableFuture[] stages = completableFutures.toArray(new CompletableFuture[completableFutures.size()]); CompletableFuture.allOf(stages).join(); List<Object> completedResults = new ArrayList<>(); completableFutures.forEach(future -> { ExecutionResult completedValue = future.getNow(null); completedResults.add(completedValue != null ? completedValue.getData() : null); }); return new ExecutionResultImpl(completedResults, null); }

Target:
protected ExecutionResult joinAllOf(List<CompletableFuture<ExecutionResult>> completableFutures) throws CompletionException { CompletableFuture[] stages = completableFutures.toArray(new CompletableFuture[completableFutures.size()]); CompletableFuture.allOf(stages).join(); List<Object> completedResults = new ArrayList<>(); completableFutures.forEach(future -> { ExecutionResult completedValue = future.getNow(null); Assert.assertNotNull(completedValue, "A null execution result value is not allowed"); completedResults.add(completedValue.getData()); }); return new ExecutionResultImpl(completedResults, null); }
Source:
protected String normalizeSQLName(String name) { if (name != null) { return name.replaceAll("ŗ", "").replaceAll("ņ", " "); } else { return null; } }

Target:
protected String normalizeSQLName(String name) { if (name != null) { return name.replaceAll("\r", "").replaceAll("\n", " "); } else { return null; } }
Source:
public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_residence")) { org.bukkit.Location loc = new org.bukkit.Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw(), location.getPitch()); ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); return new Element(res != null).getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("residence")) { org.bukkit.Location loc = new org.bukkit.Location(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getYaw(), location.getPitch()); ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); if (res != null) { return new dResidence(res).getAttribute(attribute.fulfill(1)); } return null; } return null; }

Target:
public String getAttribute(Attribute attribute) { if (attribute.startsWith("has_residence")) { ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(location); return new Element(res != null).getAttribute(attribute.fulfill(1)); } if (attribute.startsWith("residence")) { ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(location); if (res != null) { return new dResidence(res).getAttribute(attribute.fulfill(1)); } return null; } return null; }
Source:
public static WeightInit mapWeightInitialization(String kerasInit) { WeightInit init = WeightInit.XAVIER; if (kerasInit != null) { switch (kerasInit) { case "uniform": init = WeightInit.UNIFORM; break; case "zero": init = WeightInit.ZERO; break; case "lecun_uniform": case "normal": case "identity": case "orthogonal": case "glorot_normal": case "glorot_uniform": case "he_normal": case "he_uniform": default: log.warn("Unknown keras weight distribution " + init); break; } } return init; }

Target:
public static WeightInit mapWeightInitialization(String kerasInit) { WeightInit init = WeightInit.XAVIER; if (kerasInit != null) { switch (kerasInit) { case KERAS_INIT_UNIFORM: init = WeightInit.UNIFORM; break; case KERAS_INIT_ZERO: init = WeightInit.ZERO; break; case KERAS_INIT_GLOROT_NORMAL: init = WeightInit.XAVIER; break; case KERAS_INIT_GLOROT_UNIFORM: init = WeightInit.XAVIER_UNIFORM; break; case KERAS_INIT_HE_NORMAL: init = WeightInit.RELU; break; case KERAS_INIT_HE_UNIFORM: init = WeightInit.RELU_UNIFORM; break; case KERAS_INIT_LECUN_UNIFORM: case KERAS_INIT_NORMAL: case KERAS_INIT_IDENTITY: case KERAS_INIT_ORTHOGONAL: default: log.warn("Unknown keras weight distribution " + init); break; } } return init; }
Source:
private static boolean isEvenlyDiversableByKnownPrimes(int previousPrime, int val) { return knownPrimes.takeWhile((p) -> p < previousPrime).append(previousPrime) .exists((p) -> val % p == 0); }

Target:
private static boolean isEvenlyDiversableByKnownPrimes(int previousPrime, int val) { return knownPrimes.takeWhile(p -> p < previousPrime).append(previousPrime) .exists(p -> val % p == 0); }
Source:
public static List<Path> split(Path walRootDir, Path walsDir, Path archiveDir, FileSystem walFS, Configuration conf, final WALFactory factory) throws IOException { Path rootDir = CommonFSUtils.getRootDir(conf); FileSystem rootFS = rootDir.getFileSystem(conf); WALSplitter splitter = new WALSplitter(factory, conf, walRootDir, walFS, rootDir, rootFS); final List<FileStatus> wals = SplitLogManager.getFileList(conf, Collections.singletonList(walsDir), null); List<Path> splits = new ArrayList<>(); if (CollectionUtils.isNotEmpty(wals)) { for (FileStatus wal: wals) { SplitWALResult splitWALResult = splitter.splitWAL(wal, null); if (splitWALResult.isFinished()) { WALSplitUtil.archive(wal.getPath(), splitWALResult.isCorrupt(), archiveDir, walFS, conf); splits.addAll(splitter.outputSink.splits); } } } if (!walFS.delete(walsDir, true)) { throw new IOException("Unable to delete src dir " + walsDir); } return splits; }

Target:
public static List<Path> split(Path walRootDir, Path walsDir, Path archiveDir, FileSystem walFS, Configuration conf, final WALFactory factory) throws IOException { Path rootDir = CommonFSUtils.getRootDir(conf); FileSystem rootFS = rootDir.getFileSystem(conf); WALSplitter splitter = new WALSplitter(factory, conf, walRootDir, walFS, rootDir, rootFS); final List<FileStatus> wals = SplitLogManager.getFileList(conf, Collections.singletonList(walsDir), null); List<Path> splits = new ArrayList<>(); if (!wals.isEmpty()) { for (FileStatus wal: wals) { SplitWALResult splitWALResult = splitter.splitWAL(wal, null); if (splitWALResult.isFinished()) { WALSplitUtil.archive(wal.getPath(), splitWALResult.isCorrupt(), archiveDir, walFS, conf); splits.addAll(splitter.outputSink.splits); } } } if (!walFS.delete(walsDir, true)) { throw new IOException("Unable to delete src dir " + walsDir); } return splits; }
Source:
public Response saveResourcesWithId(String[] resources) { if (m_jsonStore == null) { throw getException(Status.NOT_FOUND, "No JsonStore registered."); } String resourcesInJson = new Gson().toJson(resources); String key = UUID.nameUUIDFromBytes(resourcesInJson.getBytes()).toString(); m_jsonStore.put(key, resourcesInJson, RESOURCE_IDS_CONTEXT); String jsonKey = new Gson().toJson(key); return Response.ok(jsonKey).build(); }

Target:
public Response saveResourcesWithId(String[] resources) { String resourcesInJson = m_gson.toJson(resources); String key = UUID.nameUUIDFromBytes(resourcesInJson.getBytes()).toString(); m_jsonStore.put(key, resourcesInJson, RESOURCE_IDS_CONTEXT); String jsonKey = m_gson.toJson(key); return Response.ok(jsonKey).build(); }