auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
void registerCustomInterceptor(@Observes ProcessAnnotatedType<SimpleBean> pat) { final AnnotatedType<SimpleBean> oldAnnotatedType = pat.getAnnotatedType(); AnnotatedType<SimpleBean> modifiedSimpleAnnotatedType = new ForwardingAnnotatedType<SimpleBean>() { private final AnnotationLiteral<Interceptors> interceptorsAnnotation = new InterceptorsLiteral(); @Override public AnnotatedType<SimpleBean> delegate() { return oldAnnotatedType; } @Override public Set<Annotation> getAnnotations() { Set<Annotation> annotations = new HashSet<Annotation>(); annotations.add(interceptorsAnnotation); return annotations; } @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return Interceptors.class.equals(annotationType); } }; pat.setAnnotatedType(modifiedSimpleAnnotatedType); }

Target:
void registerCustomInterceptor(@Observes ProcessAnnotatedType<SimpleBean> pat) { final AnnotatedType<SimpleBean> oldAnnotatedType = pat.getAnnotatedType(); AnnotatedType<SimpleBean> modifiedSimpleAnnotatedType = new ForwardingAnnotatedType<SimpleBean>() { private final AnnotationLiteral<Interceptors> interceptorsAnnotation = new InterceptorsLiteral(); @Override public AnnotatedType<SimpleBean> delegate() { return oldAnnotatedType; } @Override public Set<Annotation> getAnnotations() { Set<Annotation> annotations = new HashSet<Annotation>(); annotations.add(interceptorsAnnotation); return annotations; } @SuppressWarnings("unchecked") @Override public <T extends Annotation> T getAnnotation(final Class<T> annType) { if (Interceptors.class.equals(annType)) { return (T) interceptorsAnnotation; } return null; } @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return Interceptors.class.equals(annotationType); } }; pat.setAnnotatedType(modifiedSimpleAnnotatedType); }
Source:
public void close() throws IOException { try (Closer closer = Closer.create()) { closer.register(super::close); closer.register(s3::shutdown); if (credentialsProvider instanceof Closeable) { closer.register((Closeable) credentialsProvider); } } }

Target:
public void close() throws IOException { try (Closer closer = Closer.create()) { closer.register(super::close); if (credentialsProvider instanceof Closeable) { closer.register((Closeable) credentialsProvider); } closer.register(s3::shutdown); } }
Source:
private Collection<CHGraphImpl> getAllCHGraphs() { List<CHGraphImpl> result = new ArrayList<>(); result.addAll(nodeBasedCHGraphs); result.addAll(edgeBasedCHGraphs); return result; }

Target:
private Collection<CHGraphImpl> getAllCHGraphs() { List<CHGraphImpl> result = new ArrayList<>(nodeBasedCHGraphs.size() + edgeBasedCHGraphs.size()); result.addAll(nodeBasedCHGraphs); result.addAll(edgeBasedCHGraphs); return result; }
Source:
private void createChildren(CoreSession s, DocumentModel p, int depth) { if (depth > 0) { for (int i = 0; i < SIZE; i++) { DocumentModel child = s.createDocumentModel(p.getPathAsString(), p.getName() + "doc" + i, "ComplexDoc"); child.setProperty("dublincore", "modified", new Date()); child = s.createDocument(child); s.saveDocument(child); s.createProxy(child.getRef(), p.getRef()); s.saveDocument(child); DocumentModel folder = s.createDocumentModel(p.getPathAsString(), p.getName() + "folder" + i, "Folder"); folder = s.createDocument(folder); s.saveDocument(folder); createChildren(s, folder, depth - 1); } } }

Target:
private void createChildren(CoreSession s, DocumentModel p, int depth) { if (depth > 0) { for (int i = 0; i < SIZE; i++) { DocumentModel child = s.createDocumentModel(p.getPathAsString(), p.getName() + "doc" + i, "ComplexDoc"); child.setProperty("dublincore", "modified", new Date()); child = s.createDocument(child); s.createProxy(child.getRef(), p.getRef()); DocumentModel folder = s.createDocumentModel(p.getPathAsString(), p.getName() + "folder" + i, "Folder"); folder = s.createDocument(folder); createChildren(s, folder, depth - 1); } } }
Source:
public void setSubordinateTransactionImporterClassName(String importerClassName) { synchronized(this) { if(importerClassName == null) { this.subordinateTransactionImporter = null; } else if(!importerClassName.equals(this.subordinateTransactionImporterClassName)) { this.subordinateTransactionImporter = null; } this.subordinateTransactionImporterClassName = importerClassName; } }

Target:
public void setSubordinateTransactionImporterClassName(String importerClassName) { synchronized(this) { if (!subordinateTransactionImporterClassName.equals(importerClassName)) { subordinateTransactionImporter = null; } if(importerClassName == null) { subordinateTransactionImporterClassName = defaultSubordinateTransactionImporterClassName; } else { subordinateTransactionImporterClassName = importerClassName; } } }
Source:
public LabelTypes getLabelTypes() { String destBranch = getChange().getDest().get(); List<LabelType> all = getProjectControl().getLabelTypes().getLabelTypes(); List<LabelType> accessSectionsLabels = getRefControl().getLabelTypes().getLabelTypes(); List<LabelType> r = Lists.newArrayListWithCapacity(all.size()); for (LabelType l : all) { List<String> refs = l.getRefPatterns(); boolean branchSameAsAccess = l.branchSameAsAccess(); if (refs == null && !branchSameAsAccess) { r.add(l); } else { if (branchSameAsAccess) { if (accessSectionsLabels.contains(l)) { r.add(l); continue; } } if (refs != null) { for (String refPattern : refs) { if (RefConfigSection.isValid(refPattern) && match(destBranch, refPattern)) { r.add(l); break; } } } } } return new LabelTypes(r); }

Target:
public LabelTypes getLabelTypes() { String destBranch = getChange().getDest().get(); List<LabelType> all = getProjectControl().getLabelTypes().getLabelTypes(); List<LabelType> accessSectionsLabels = getRefControl().getLabelTypes().getLabelTypes(); List<LabelType> r = Lists.newArrayListWithCapacity(all.size()); for (LabelType l : all) { List<String> refs = l.getRefPatterns(); boolean branchSameAsAccess = l.branchSameAsAccess(); if (((refs == null || refs.isEmpty()) && !branchSameAsAccess) || (branchSameAsAccess && accessSectionsLabels.contains(l))) { r.add(l); continue; } if (refs != null) { for (String refPattern : refs) { if (RefConfigSection.isValid(refPattern) && match(destBranch, refPattern)) { r.add(l); break; } } } } return new LabelTypes(r); }
Source:
public void rowsCanBeReset() throws IOException { String rowKey = "row-1"; Chunk contentChunk = createContentChunk("Family1", "c1", randomBytes(10), 10L); Chunk contentChunk2 = createContentChunk("Family1", "c2", randomBytes(10), 100L); Chunk rowResetChunk = Chunk.newBuilder().setResetRow(true).build(); Chunk rowCompleteChunk = Chunk.newBuilder().setCommitRow(true).build(); ReadRowsResponse response = createReadRowsResponse(rowKey, contentChunk); ReadRowsResponse response2 = createReadRowsResponse(rowKey, rowResetChunk); ReadRowsResponse response3 = createReadRowsResponse(rowKey, contentChunk2); ReadRowsResponse response4 = createReadRowsResponse(rowKey, rowCompleteChunk); Iterator<ReadRowsResponse> iterator = getIterator(response, response2, response3, response4); Row resultRow = RowMerger.readNextRow(iterator); Assert.assertEquals(1, resultRow.getFamiliesCount()); Family resultFamily = resultRow.getFamilies(0); Assert.assertEquals("Family1", resultFamily.getName()); Assert.assertEquals(1, resultFamily.getColumnsCount()); Column resultColumn = resultFamily.getColumns(0); Assert.assertEquals(ByteString.copyFromUtf8("c2"), resultColumn.getQualifier()); Assert.assertFalse(iterator.hasNext()); }

Target:
public void rowsCanBeReset() throws IOException { String rowKey = "row-1"; ReadRowsResponse response = createReadRowsResponse(rowKey, Family1_c1_CHUNK); ReadRowsResponse response2 = createReadRowsResponse(rowKey, RESET_CHUNK); ReadRowsResponse response3 = createReadRowsResponse(rowKey, Family1_c2_CHUNK); ReadRowsResponse response4 = createReadRowsResponse(rowKey, COMPLETE_CHUNK); Iterator<ReadRowsResponse> iterator = getIterator(response, response2, response3, response4); Row resultRow = RowMerger.readNextRow(iterator); Assert.assertEquals(1, resultRow.getFamiliesCount()); Family resultFamily = resultRow.getFamilies(0); Assert.assertEquals("Family1", resultFamily.getName()); Assert.assertEquals(1, resultFamily.getColumnsCount()); Column resultColumn = resultFamily.getColumns(0); Assert.assertEquals(ByteString.copyFromUtf8("c2"), resultColumn.getQualifier()); Assert.assertFalse(iterator.hasNext()); }
Source:
public boolean addNode(PlatformServer sender, String[] parents, String name, Serializable value) { LOGGER.trace("[{}] addNode({}, {})", consumerId, name, String.valueOf(value)); if (RELIABLE_CHANNEL_KEY.equals(name)) { if (value instanceof ManagementMessage) { fire((ManagementMessage) value); } else if (value != null) { Utils.warnOrAssert(LOGGER, "[0] addNode(from={}) IGNORED: wrong get type: {}", value.getClass().getSimpleName()); } } return false; }

Target:
public boolean addNode(PlatformServer sender, String[] parents, String name, Serializable value) { LOGGER.trace("[{}] addNode({}, {})", consumerId, name, String.valueOf(value)); if (RELIABLE_CHANNEL_KEY.equals(name)) { if (value instanceof ManagementMessage) { fire((ManagementMessage) value); } else if (value != null) { Utils.warnOrAssert(LOGGER, "[0] addNode(from={}) IGNORED: wrong value type: {}", value.getClass().getSimpleName()); } } return false; }
Source:
public void testTlsDefaults() throws Exception { CertStores serverCertStores = new CertStores(true, "server", "localhost"); CertStores clientCertStores = new CertStores(false, "client", "localhost"); Map<String, Object> sslClientConfigs = getTrustingConfig(clientCertStores, serverCertStores, tlsClientProtocols); Map<String, Object> sslServerConfigs = getTrustingConfig(serverCertStores, clientCertStores, tlsServerProtocols); NioEchoServer server = NetworkTestUtils.createEchoServer(ListenerName.forSecurityProtocol(SecurityProtocol.SSL), SecurityProtocol.SSL, new TestSecurityConfig(sslServerConfigs), null, TIME); Selector selector = createSelector(sslClientConfigs); String node = "0"; selector.connect(node, new InetSocketAddress("localhost", server.port()), BUFFER_SIZE, BUFFER_SIZE); if (tlsServerProtocols.contains(tlsClientProtocols.get(0))) { NetworkTestUtils.waitForChannelReady(selector, node); int msgSz = 1024 * 1024; String message = TestUtils.randomString(msgSz); selector.send(new NetworkSend(node, ByteBuffer.wrap(message.getBytes()))); while (selector.completedReceives().isEmpty()) { selector.poll(100L); } int totalBytes = msgSz + 4; server.waitForMetric("incoming-byte", totalBytes); server.waitForMetric("outgoing-byte", totalBytes); server.waitForMetric("request", 1); server.waitForMetric("response", 1); } else { NetworkTestUtils.waitForChannelClose(selector, node, ChannelState.State.AUTHENTICATION_FAILED); } }

Target:
public void testTlsDefaults() throws Exception { CertStores serverCertStores = new CertStores(true, "server", "localhost"); CertStores clientCertStores = new CertStores(false, "client", "localhost"); Map<String, Object> sslClientConfigs = getTrustingConfig(clientCertStores, serverCertStores, clientProtocols); Map<String, Object> sslServerConfigs = getTrustingConfig(serverCertStores, clientCertStores, serverProtocols); NioEchoServer server = NetworkTestUtils.createEchoServer(ListenerName.forSecurityProtocol(SecurityProtocol.SSL), SecurityProtocol.SSL, new TestSecurityConfig(sslServerConfigs), null, TIME); Selector selector = createClientSelector(sslClientConfigs); String node = "0"; selector.connect(node, new InetSocketAddress("localhost", server.port()), BUFFER_SIZE, BUFFER_SIZE); if (isCompatible(serverProtocols, clientProtocols)) { NetworkTestUtils.waitForChannelReady(selector, node); int msgSz = 1024 * 1024; String message = TestUtils.randomString(msgSz); selector.send(new NetworkSend(node, ByteBuffer.wrap(message.getBytes()))); while (selector.completedReceives().isEmpty()) { selector.poll(100L); } int totalBytes = msgSz + 4; server.waitForMetric("incoming-byte", totalBytes); server.waitForMetric("outgoing-byte", totalBytes); server.waitForMetric("request", 1); server.waitForMetric("response", 1); } else { NetworkTestUtils.waitForChannelClose(selector, node, ChannelState.State.AUTHENTICATION_FAILED); server.verifyAuthenticationMetrics(0, 1); } }
Source:
public void onModelBake(ModelBakeEvent event) { for (Entry<String, String[]> e : blockVariants.entrySet()) { for (String variant : e.getValue()) { ModelResourceLocation loc = new ModelResourceLocation(Info.MODID + ":" + e.getKey(), variant); IModel bambooFrame = ModelLoaderRegistry.getModelOrLogError(loc, "Could not load arbitrary block variant " + variant + " for block " + e.getKey()); event.getModelRegistry().putObject(loc, bambooFrame.bake(bambooFrame.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter())); } } }

Target:
public void onModelBake(ModelBakeEvent event) { for (Entry<String, String[]> e : blockVariants.entrySet()) { for (String variant : e.getValue()) { ModelResourceLocation loc = new ModelResourceLocation(Info.MODID + ":" + e.getKey(), variant); IModel model = ModelLoaderRegistry.getModelOrLogError(loc, "Could not load arbitrary block variant " + variant + " for block " + e.getKey()); event.getModelRegistry().putObject(loc, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, ModelLoader.defaultTextureGetter())); } } }
Source:
public Person(String username, String password, String email, int puzzle) { user = new ParseUser(); user.setUsername(username); user.setPassword(password); user.setEmail(email); user.put("points", 0); user.put("levelAt", 1); user.put("stateAt", 0); user.put("puzzleID", puzzle); user.put("currentItem", "coffee"); user.put("currentIngredient", "water"); }

Target:
public Person(String username, String password, String email, int puzzle) { user = new ParseUser(); user.setUsername(username); user.setPassword(password); user.setEmail(email); user.put("points", 0); user.put("levelAt", 1); user.put("stateAt", 0); user.put("puzzleID", puzzle); user.put("currentItem", "coffee"); user.put("currentIngredient", "water"); ParseACL acl = new ParseACL(); acl.setPublicReadAccess(true); user.setACL(acl); }
Source:
public void openSpecialPromoteOnCurrentWiki() { String url = getCurrentUrl(); int indexStart = url.indexOf("wiki/"); url = url.substring(0, indexStart); getUrl(url + URLsContent.specialPromote); PageObjectLogging.log("openSpecialPromote", "special promote page opened", true); }

Target:
public void openSpecialPromoteOnCurrentWiki() { JavascriptExecutor js = (JavascriptExecutor) driver; String url = (String) js.executeScript("return wgServer"); getUrl(url + "/" + URLsContent.specialPromote); PageObjectLogging.log("openSpecialPromote", "special promote page opened", true); }
Source:
public static <E> ListDiff<E> createListDiff( final List<ListDiffEntry<E>> differences) { final ListDiffEntry<?>[] differencesArray = differences .toArray(new ListDiffEntry[differences.size()]); return new ListDiff<E>() { @Override public ListDiffEntry<?>[] getDifferences() { return differencesArray; } }; }

Target:
public static <E> ListDiff<E> createListDiff(final List<ListDiffEntry<E>> differences) { final ListDiffEntry<E>[] differencesArray = differences.toArray(new ListDiffEntry[differences.size()]); return new ListDiff<E>() { @Override public ListDiffEntry<E>[] getDifferences() { return differencesArray; } }; }
Source:
private Address findHostPhysicalAddress(String nodeAddress) { Address result = null; Transport t = cacheManager.getTransport(); if (t == null) { result = cacheManager.getAddress(); } else { for (Address add : t.getPhysicalAddresses()) { if (add.toString().contains(nodeAddress)) { result = add; break; } } } return result; }

Target:
private Address findHostPhysicalAddress(String nodeAddress) { Address result = null; Transport t = cacheManager.getTransport(); if (t != null) { for (Address add : t.getPhysicalAddresses()) { if (add.toString().contains(nodeAddress)) { result = add; break; } } } return result; }
Source:
public CProfilingTab() { super(); IExtensionPoint extPoint = Platform.getExtensionRegistry() .getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, "profilingProvider"); IConfigurationElement[] configs = extPoint.getConfigurationElements(); for (IConfigurationElement config : configs) { if (config.getName().equals("provider")) { try { Object obj = config .createExecutableExtension("tab"); if (obj instanceof ILaunchConfigurationTab) { tab = (ILaunchConfigurationTab)obj; break; } } catch (CoreException e) { } } } }

Target:
public CProfilingTab() { super(); IExtensionPoint extPoint = Platform.getExtensionRegistry() .getExtensionPoint(LaunchUIPlugin.PLUGIN_ID, "profilingProvider"); IConfigurationElement[] configs = extPoint.getConfigurationElements(); for (IConfigurationElement config : configs) { if (config.getName().equals("provider")) { try { Object obj = config .createExecutableExtension("tabDelegate"); if (obj instanceof AbstractLaunchConfigurationTab) { tabDelegate = (AbstractLaunchConfigurationTab)obj; break; } } catch (CoreException e) { } } } }
Source:
public ZonedDateTime getExceptionTimestamp() { return exceptionMoment.atZone(getConfig(Time.class).getClock().getZone()); }

Target:
public ZonedDateTime getExceptionTimestamp() { return exceptionMoment == null ? null : exceptionMoment.atZone(getConfig(Time.class).getClock().getZone()); }
Source:
protected List<String> listFiles() { GetImagesListParameters queryParams = new GetImagesListParameters(asGuid(storageDomainId), ImageFileType.All); queryParams.setForceRefresh(true); List<RepoImage> files = getBackendCollection(RepoImage.class, VdcQueryType.GetImagesList, queryParams); return files.stream().map(RepoImage::getRepoImageId).collect(Collectors.toList()); }

Target:
protected List<String> listFiles() { GetImagesListParameters queryParams = new GetImagesListParameters(asGuid(storageDomainId), ImageFileType.All); queryParams.setForceRefresh(true); List<RepoImage> files = getBackendCollection(RepoImage.class, VdcQueryType.GetImagesList, queryParams); return files.stream().map(RepoImage::getRepoImageId).collect(toList()); }
Source:
public boolean isVf() { return vf; }

Target:
public boolean isVf() { return physicalFunction != null; }
Source:
public Map<String, String> getEnvironment() { Map<String, String> envs = new HashMap(super.getEnvironment()); if (java != null) { if (envs.containsKey(JAVA_HOME)) { log.warn("Overwriting " + JAVA_HOME + ": " + envs.get(JAVA_HOME) + " with " + java); } envs.put(JAVA_HOME, java); } overwriteJavaOpts(envs, javaOpts); if (flightRecorder.isEnabled()) { List<String> flightRecorderArgs = new ArrayList<>(1); flightRecorder.setArgs(flightRecorderArgs); StringBuilder flightRecorderArgBuilder = new StringBuilder(); flightRecorderArgs.forEach(arg -> { flightRecorderArgBuilder.append(arg).append(" "); }); overwriteJavaOpts(envs, flightRecorderArgBuilder.toString()); } return envs; }

Target:
public Map<String, String> getEnvironment() { Map<String, String> envs = new HashMap(super.getEnvironment()); if (java != null) { if (envs.containsKey(JAVA_HOME)) { log.warn("Overwriting " + JAVA_HOME + ": " + envs.get(JAVA_HOME) + " with " + java); } envs.put(JAVA_HOME, java); } if (javaOpts != null) { if (envs.containsKey(JAVA_OPTS)) { log.warn("Overwriting " + JAVA_OPTS + ": " + envs.get(JAVA_OPTS) + " with " + javaOpts); } envs.put(JAVA_OPTS, javaOpts); } if (flightRecorder.isEnabled()) { List<String> flightRecorderArgs = new ArrayList<>(1); flightRecorder.setArgs(flightRecorderArgs); StringBuilder flightRecorderArgBuilder = new StringBuilder(); flightRecorderArgs.forEach(arg -> flightRecorderArgBuilder.append(arg).append(" ")); appendJavaOpts(envs, flightRecorderArgBuilder); } return envs; }
Source:
public boolean hasEnforcedAppVersion(){ return this.enforcedAppVersion !=0; }

Target:
public boolean hasEnforcedAppVersion() { return this.enforcedAppVersion > 0; }
Source:
public static void set(Header header, String value) { set(header.toString(), value); }

Target:
public static void set(Header header, String value) { set(header.getHeader(), value); }
Source:
private static Object nullSafeGet(Optional<?> optional) { return optional.isPresent() ? optional.orElse(null) : null; }

Target:
private static Object nullSafeGet(Optional<?> optional) { return optional != null ? optional.orElse(null) : null; }
Source:
public List<Kind> nodesToVisit() { return ImmutableList.of(Kind.METHOD); }

Target:
public List<Tree.Kind> nodesToVisit() { return ImmutableList.of(Tree.Kind.METHOD); }
Source:
protected boolean[] getTestedOrder() { return new boolean[] {true, false}; }

Target:
protected Order[] getTestedOrder() { return new Order[] {Order.ASCENDING, Order.DESCENDING}; }
Source:
private String getEntityTypeStringFromMetadata(List<MetadataValue> list) { String entityType = null; for (MetadataValue mdv : list) { if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(), "relationship") && StringUtils.equals(mdv.getMetadataField().getElement(), "type")) { entityType = mdv.getValue(); } } return entityType; }

Target:
private String getEntityTypeStringFromMetadata(List<MetadataValue> list) { for (MetadataValue mdv : list) { if (StringUtils.equals(mdv.getMetadataField().getMetadataSchema().getName(), "relationship") && StringUtils.equals(mdv.getMetadataField().getElement(), "type")) { return mdv.getValue(); } } return null; }
Source:
private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); Bundle arguments = getArguments(); boolean supportStockPhotos = arguments != null && arguments.getBoolean(ARG_SUPPORT_STOCK_PHOTOS); if (supportStockPhotos && activity != null) { String packageName = activity.getApplication().getPackageName(); int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } return otherMediaOptions; }

Target:
private ArrayList<MediaOption> initOtherMediaImageOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); Bundle arguments = getArguments(); boolean supportStockPhotos = arguments != null && arguments.getBoolean(ARG_SUPPORT_STOCK_PHOTOS); if (activity != null) { if (supportStockPhotos) { String packageName = activity.getApplication().getPackageName(); int stockMediaResourceId = getResources().getIdentifier("photo_picker_stock_media", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_STOCK_MEDIA, getString(stockMediaResourceId))); } } else { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity is null"); } return otherMediaOptions; }
Source:
public Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, Context context) { Context updatedContext = context == null ? Context.NONE.addData(CoreConstants.DISABLE_BUFFER_COPY, true) : context.addData("disable-buffer-copy", true); Mono<Response<BlobProperties>> download = client.downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, updatedContext); return blockWithOptionalTimeout(download, timeout); }

Target:
public Response<BlobProperties> downloadToFileWithResponse(String filePath, BlobRange range, ParallelTransferOptions parallelTransferOptions, DownloadRetryOptions downloadRetryOptions, BlobRequestConditions requestConditions, boolean rangeGetContentMd5, Set<OpenOption> openOptions, Duration timeout, Context context) { Mono<Response<BlobProperties>> download = client.downloadToFileWithResponse(filePath, range, parallelTransferOptions, downloadRetryOptions, requestConditions, rangeGetContentMd5, openOptions, context); return blockWithOptionalTimeout(download, timeout); }
Source:
void updateTimeWithValue(ByteBuffer buf, int position, long time) { buf.putLong(position, time); putValue(buf, position); buf.put(position + NULL_OFFSET, RHS_NOT_NULL); }

Target:
void updateTimeWithValue(ByteBuffer buf, int position, long time) { buf.putLong(position, time); buf.put(position + NULL_OFFSET, NullHandling.IS_NOT_NULL_BYTE); putValue(buf, position + VALUE_OFFSET); }
Source:
public static void removeMatchingBuckets(List<Integer> mismatchingBuckets, BlockReport report){ for(int i = 0; i < report.getBuckets().length; i++){ if(!mismatchingBuckets.contains(i)){ report.getBuckets()[i].setBlocks(BlockListAsLongs.EMPTY); report.getBuckets()[i].setSkip(true); } } }

Target:
public static void removeMatchingBuckets(List<Integer> mismatchingBuckets, BlockReport report){ HashSet mismatchingBucketsSet = new HashSet(mismatchingBuckets); for(int i = 0; i < report.getBuckets().length; i++){ if(!mismatchingBucketsSet.contains(i)){ report.getBuckets()[i].setBlocks(BlockListAsLongs.EMPTY); report.getBuckets()[i].setSkip(true); } } }
Source:
@Override protected void beforeTestsStarted() throws Exception { assert testsCfgInjected != null; testsCfg = testsCfgInjected; if (Ignition.allGrids().size() != testsCfg.gridCount()) { info("All nodes will be stopped, new " + testsCfg.gridCount() + " nodes will be started."); Ignition.stopAll(true); FileUtils.deleteDirectory(workDir); info("Ignite's 'work' directory has been cleaned."); startGrids(testsCfg.gridCount()); for (int i = 0; i < testsCfg.gridCount(); i++) info("Grid " + i + ": " + grid(i).localNode().id()); } assert testsCfg.testedNodeIndex() >= 0 : "testedNodeIdx: " + testedNodeIdx; testedNodeIdx = testsCfg.testedNodeIndex(); if (testsCfg.withClients()) { for (int i = 0; i < gridCount(); i++) assertEquals("i: " + i, expectedClient(getTestIgniteInstanceName(i)), (boolean)grid(i).configuration().isClientMode()); } }

Target:
@Override protected void beforeTestsStarted() throws Exception { assert testsCfg != null; if (Ignition.allGrids().size() != testsCfg.gridCount()) { info("All nodes will be stopped, new " + testsCfg.gridCount() + " nodes will be started."); Ignition.stopAll(true); FileUtils.deleteDirectory(workDir); info("Ignite's 'work' directory has been cleaned."); startGrids(testsCfg.gridCount()); for (int i = 0; i < testsCfg.gridCount(); i++) info("Grid " + i + ": " + grid(i).localNode().id()); } assert testsCfg.testedNodeIndex() >= 0 : "testedNodeIdx: " + testedNodeIdx; testedNodeIdx = testsCfg.testedNodeIndex(); if (testsCfg.withClients()) { for (int i = 0; i < gridCount(); i++) assertEquals("i: " + i, expectedClient(getTestIgniteInstanceName(i)), (boolean)grid(i).configuration().isClientMode()); } }
Source:
public void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager) { this.metricsManager .addGauge("EXEC-NumRunningFlows", flowRunnerManager::getNumRunningFlows); this.metricsManager .addGauge("EXEC-NumQueuedFlows", flowRunnerManager::getNumQueuedFlows); this.metricsManager .addGauge("EXEC-ProjectDirCacheHitRatio", flowRunnerManager::getProjectDirHitRatio); }

Target:
public void addFlowRunnerManagerMetrics(final FlowRunnerManager flowRunnerManager) { this.metricsManager .addGauge("EXEC-NumRunningFlows", flowRunnerManager::getNumRunningFlows); this.metricsManager .addGauge("EXEC-NumQueuedFlows", flowRunnerManager::getNumQueuedFlows); this.metricsManager .addGauge("EXEC-ProjectDirCacheHitRatio", flowRunnerManager::getProjectDirCacheHitRatio); }
Source:
private void checkIconNodeInvalidate(final SWTBotVSMEditor odesignEditor, SWTBotTree tree) { SWTBotUtils.waitAllUiEvents(); final SWTBotTreeItem node1treeItem = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node1").select(); bot.waitUntil(new TreeItemWithImageCondition(node1treeItem, getNodeMappingWithInfoImage(), "An info must appear on overlay of the node mapping image.")); final SWTBotTreeItem node2TreeItem = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node2").select(); bot.waitUntil(new TreeItemWithImageCondition(node2TreeItem, getNodeMappingWithWarningImage(), "A warning must appear on overlay of the node mapping image.")); final SWTBotTreeItem node3TreeItem = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default").getNode("node3").select(); bot.waitUntil(new TreeItemWithImageCondition(node3TreeItem, getNodeMappingWithErrorImage(), "A red cross must appear on overlay of the node mapping image.")); }

Target:
private void checkIconNodeInvalidate(final SWTBotVSMEditor odesignEditor, SWTBotTree tree) { SWTBotUtils.waitAllUiEvents(); SWTBotTreeItem defaultNode = tree.getTreeItem(ODESIGN).getNode("Group").getNode("2475").getNode("Diagram").getNode("Default"); final SWTBotTreeItem node1treeItem = defaultNode.getNode("node1").select(); bot.waitUntil(new TreeItemWithImageCondition(node1treeItem, getNodeMappingWithInfoImage(), "An info must appear on overlay of the node mapping image.")); final SWTBotTreeItem node2TreeItem = defaultNode.getNode("node2").select(); bot.waitUntil(new TreeItemWithImageCondition(node2TreeItem, getNodeMappingWithWarningImage(), "A warning must appear on overlay of the node mapping image.")); final SWTBotTreeItem node3TreeItem = defaultNode.getNode("node3").select(); bot.waitUntil(new TreeItemWithImageCondition(node3TreeItem, getNodeMappingWithErrorImage(), "A red cross must appear on overlay of the node mapping image.")); }
Source:
public String type() { return "AzureBlobContainer"; }

Target:
public String type() { return AZURE_FILE_STORE_TYPE; }
Source:
public void startNativeTransport() { validateTransportsCanStart(); if (nativeServer == null) throw new IllegalStateException("setup() must be called first for CassandraDaemon"); else nativeServer.start(); }

Target:
public void startNativeTransport() { validateTransportsCanStart(); if (nativeServer == null) throw new IllegalStateException("native transport should be set up before it can be started"); nativeServer.start(); }
Source:
public URI getServerKey() { URI uri = this.physicalUri.getURI(); try { return new URI( uri.getScheme(), null, uri.getHost(), uri.getPort(), null, null, null); } catch (URISyntaxException error) { throw new IllegalArgumentException( lenientFormat("physicalAddress %s cannot be parsed as a server-based authority", uri), error); } }

Target:
public URI getServerKey() { return RntbdUtils.getServerKey(this.physicalUri.getURI()); }
Source:
private void updateResult(JobInstance job) { latestCompletedCache.flush(); getSqlMapClientTemplate().update("updateResult", job); }

Target:
private void updateResult(JobInstance job) { latestCompletedCache.flushOnCommit(); getSqlMapClientTemplate().update("updateResult", job); }
Source:
public void open() throws EDBException { if (dbname == null) { throw new EDBException( "There is no database name defined. Unable to connect to unknown database"); } if (type == null) { throw new EDBException("The database type have to be set for a jpa connection"); } Properties props = null; try { props = type.getPropertiesForDatabaseType(); String connectionUrl = type.getConnectionPrefix() + dbname; props.setProperty("openjpa.ConnectionURL", connectionUrl); } catch (NotImplementedException ex) { throw new EDBException("this type of jpa connection isn't implemented", ex); } emf = Persistence.createEntityManagerFactory("openjpa", props); em = emf.createEntityManager(); utx = em.getTransaction(); Query q = em.createQuery("SELECT max(h.timestamp) FROM JPAHead h"); Number max = (Number) q.getSingleResult(); if (max != null && max.longValue() > 0) { head = loadHead(max.longValue()); } }

Target:
public void open() throws EDBException { LOGGER.debug("starting to open EDB for testing via JPA"); Properties props = new Properties(); emf = Persistence.createEntityManagerFactory("edb-test", props); entityManager = emf.createEntityManager(); utx = entityManager.getTransaction(); dao = new DefaultJPADao(entityManager); LOGGER.debug("starting of EDB successful"); Number max = dao.getNewestJPAHeadNumber(); if (max != null && max.longValue() > 0) { LOGGER.debug("loading JPA Head with timestamp " + max.longValue()); head = loadHead(max.longValue()); } }
Source:
public void whenConnectionIsClosedByClientNakadiRecognizesIt() throws Exception { final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); client.start(); waitFor(() -> assertThat(client.getBatches(), hasSize(1))); client.close(); Thread.sleep(10000); final TestStreamingClient anotherClient = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); anotherClient.start(); waitFor(() -> assertThat(anotherClient.getBatches(), hasSize(1))); }

Target:
public void whenConnectionIsClosedByClientNakadiRecognizesIt() throws Exception { final TestStreamingClient client = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); client.start(); waitFor(() -> assertThat(client.getBatches(), hasSize(1))); client.close(); Thread.sleep(2000); final TestStreamingClient anotherClient = TestStreamingClient .create(URL, subscription.getId(), "batch_flush_timeout=1"); anotherClient.start(); waitFor(() -> assertThat(anotherClient.getBatches(), hasSize(1))); }
Source:
protected void ensureValuesCapacity(int numAdded) { int newSize = numValues + numAdded * 2; if (presentStream != null && valueIsNull == null) { valueIsNull = new boolean[newSize]; } if (valueIsNull != null && valueIsNull.length < numValues + numAdded) { valueIsNull = Arrays.copyOf(valueIsNull, newSize); } if (elementOffset == null) { elementOffset = new int[newSize]; } else if (elementOffset.length < numValues + numAdded + 1) { elementOffset = Arrays.copyOf(elementOffset, newSize); } }

Target:
protected void ensureValuesCapacity(int numAdded) { if (valueIsNull == null || valueIsNull.length < numValues + numAdded) { valueIsNull = resize(valueIsNull, numValues + numAdded); } if (elementOffset == null || elementOffset.length < numValues + numAdded + 1) { elementOffset = resize(elementOffset, numValues + numAdded + 1); } }
Source:
public AttachmentInfo generateAttachmentInfo( InputStream inputStream, String contentType, String submittedFilename) { String filename; try { if (inputStream != null && inputStream.available() == 0) { inputStream.reset(); } } catch (IOException e) { LOGGER.info("IOException reading stream from file attachment in multipart body", e); } filename = submittedFilename; if (StringUtils.isEmpty(filename)) { LOGGER.debug("No filename parameter provided - generating default filename"); String fileExtension = DEFAULT_FILE_EXTENSION; try { fileExtension = mimeTypeMapper.getFileExtensionForMimeType(contentType); if (StringUtils.isEmpty(fileExtension)) { fileExtension = DEFAULT_FILE_EXTENSION; } } catch (MimeTypeResolutionException e) { LOGGER.debug("Exception getting file extension for contentType = {}", contentType); } filename = DEFAULT_FILE_NAME + "." + fileExtension; LOGGER.debug("No filename parameter provided - default to {}", filename); } else { filename = FilenameUtils.getName(filename); if (StringUtils.isEmpty(contentType) || REFINEABLE_MIME_TYPES.contains(contentType)) { contentType = contentTypeFromFilename(filename); } } return new AttachmentInfoImpl(inputStream, filename, contentType); }

Target:
public AttachmentInfo generateAttachmentInfo( InputStream inputStream, String contentType, String submittedFilename) { try { if (inputStream != null && inputStream.available() == 0) { inputStream.reset(); } } catch (IOException e) { LOGGER.debug("IOException reading stream from file attachment in multipart body", e); } String filename = submittedFilename; if (StringUtils.isEmpty(filename)) { LOGGER.debug( "No filename parameter provided - generating default filename: fileExtension={}", DEFAULT_FILE_EXTENSION); String fileExtension = DEFAULT_FILE_EXTENSION; try { fileExtension = mimeTypeMapper.getFileExtensionForMimeType(contentType); if (StringUtils.isEmpty(fileExtension)) { fileExtension = DEFAULT_FILE_EXTENSION; } } catch (MimeTypeResolutionException e) { LOGGER.debug("Exception getting file extension for contentType = {}", contentType); } filename = DEFAULT_FILE_NAME + "." + fileExtension; LOGGER.debug("No filename parameter provided - default to {}", filename); } else { filename = FilenameUtils.getName(filename); if (StringUtils.isEmpty(contentType) || REFINEABLE_MIME_TYPES.contains(contentType)) { contentType = contentTypeFromFilename(filename); } } return new AttachmentInfoImpl(inputStream, filename, contentType); }
Source:
static void validateOwnLabelAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] of entity type [%s] is not a non-nillable attribute", ownLabelAttr.getName(), entityType.getId()))); } } }

Target:
static void validateOwnLabelAttribute(EntityType entityType, Map<String, Attribute> ownAllAttrMap) { Attribute ownLabelAttr = entityType.getOwnLabelAttribute(); if (ownLabelAttr != null) { Attribute ownAttr = ownAllAttrMap.get(ownLabelAttr.getIdentifier()); if (ownAttr == null) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] is not one of the attributes of entity [%s]", ownLabelAttr.getName(), entityType.getId()))); } if (ownAttr.isNillable()) { throw new MolgenisValidationException(new ConstraintViolation( format("Label attribute [%s] of entity type [%s] cannot be nillable", ownLabelAttr.getName(), entityType.getId()))); } } }
Source:
private static int timeSearch( final NumericColumn timeColumn, final long timestamp, final int startIndex, final int endIndex ) { final long prevTimestamp = timestamp - 1; int minIndex = startIndex; int maxIndex = endIndex - 1; while (minIndex <= maxIndex) { if (maxIndex - minIndex < TOO_CLOSE_FOR_MISSILES) { break; } final int currIndex = (minIndex + maxIndex) >>> 1; final long currValue = timeColumn.getLongSingleValueRow(currIndex); if (currValue < prevTimestamp) { minIndex = currIndex + 1; } else if (currValue > prevTimestamp) { maxIndex = currIndex - 1; } else { minIndex = currIndex; break; } } for (; minIndex < endIndex; minIndex++) { final long currValue = timeColumn.getLongSingleValueRow(minIndex); if (currValue == timestamp) { return minIndex; } else if (currValue > timestamp) { return -(minIndex + 1); } } return -(endIndex + 1); }

Target:
static int timeSearch( final NumericColumn timeColumn, final long timestamp, final int startIndex, final int endIndex ) { final long prevTimestamp = timestamp - 1; int minIndex = startIndex; int maxIndex = endIndex - 1; while (minIndex <= maxIndex) { final int currIndex = (minIndex + maxIndex) >>> 1; final long currValue = timeColumn.getLongSingleValueRow(currIndex); if (currValue < prevTimestamp) { minIndex = currIndex + 1; } else if (currValue > prevTimestamp) { maxIndex = currIndex - 1; } else { minIndex = currIndex; break; } } for (; minIndex < endIndex; minIndex++) { final long currValue = timeColumn.getLongSingleValueRow(minIndex); if (currValue >= timestamp) { return minIndex; } } return endIndex; }
Source:
@Test public void missingNamedArgument() { try { Map<String, Object> map = new HashMap<>(); CodeBlock block = CodeBlock.builder().addNamed("$text:S", map).build(); fail(); } catch(IllegalArgumentException expected) { assertThat(expected).hasMessage("Missing named argument for $text"); } }

Target:
@Test public void missingNamedArgument() { try { Map<String, Object> map = new LinkedHashMap<>(); CodeBlock.builder().addNamed("$text:S", map).build(); fail(); } catch(IllegalArgumentException expected) { assertThat(expected).hasMessage("Missing named argument for $text"); } }
Source:
private String getMouseButtonName() { return button.getName(); }

Target:
public String getMouseButtonName() { return button.getName(); }
Source:
public void testIterator() { CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(fTrace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = fTrace.getUUID(); assertNotNull(uuid); ITmfCallsiteIterator iter = module.iterator(uuid.toString(), "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for(int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), "elephant", 42); evaluateEmptyIterator(iter); }

Target:
public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); ITmfCallsiteIterator iter = module.iterator(uuid.toString(), "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for(int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), "elephant", 42); evaluateEmptyIterator(iter); }
Source:
public void reset() { if (isBreakRequest()) { toggleBreakRequest(); } if (isBreakResponse()) { toggleBreakResponse(); } if (isBreakAll()) { toggleBreakAll(); } setBreakOnJavaScript(isBreakOnJavaScript); setBreakOnCSSAndFonts(isBreakOnCSSAndFonts); setBreakOnMultimedia(isBreakOnMultimedia); setOnlyBreakOnScope(isOnlyBreakOnScope); setContinue(true); }

Target:
public void reset() { if (isBreakRequest()) { toggleBreakRequest(); } if (isBreakResponse()) { toggleBreakResponse(); } if (isBreakAll()) { toggleBreakAll(); } setContinue(true); }
Source:
private ChunkCache newChunkCacheToPosRedirect(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn, BlockPos target) { int x1 = (int) entity.posX; int y1 = (int) entity.posY; int z1 = (int) entity.posZ; int x2 = target.getX(); int y2 = target.getY(); int z2 = target.getZ(); return new ChunkCache(worldIn, new BlockPos(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2)), new BlockPos(Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2)), 1); }

Target:
private ChunkCache newChunkCacheToPosRedirect(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn, BlockPos target) { int x1 = (int) entity.posX; int y1 = (int) entity.posY; int z1 = (int) entity.posZ; int x2 = target.getX(); int y2 = target.getY(); int z2 = target.getZ(); return new ChunkCache(worldIn, new BlockPos(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2)), new BlockPos(Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2)), 4); }
Source:
public String toString() { int pos = -1; for (int i = 0; i < fContent.length; i++) { if (fContent[i] == 0) { pos = i; break; } } return new String((pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent); }

Target:
public String toString() { int pos = -1; for (int i = 0; i < fContent.length; i++) { if (fContent[i] == 0) { pos = i; break; } } byte[] bytes = (pos != -1) ? (Arrays.copyOf(fContent, pos)) : fContent; return new String(bytes); }
Source:
public Subscription anonymize() { if (endpoint != null && getEndpoint().containsCredentials() || hasOAuthPolicy()) { return new Subscription( topicName, name, endpoint.anonymize(), state, description, deliveryType == DeliveryType.BATCH ? batchSubscriptionPolicy : serialSubscriptionPolicy, trackingEnabled, trackingMode, owner, supportTeam, monitoringDetails, contentType, deliveryType, filters, mode, headers, endpointAddressResolverMetadata, oAuthPolicy != null ? oAuthPolicy.anonymize() : null, http2Enabled, subscriptionIdentityHeadersEnabled ); } return this; }

Target:
public Subscription anonymize() { if (getEndpoint() != null && getEndpoint().containsCredentials() || hasOAuthPolicy()) { return new Subscription( topicName, name, endpoint.anonymize(), state, description, deliveryType == DeliveryType.BATCH ? batchSubscriptionPolicy : serialSubscriptionPolicy, trackingEnabled, trackingMode, owner, supportTeam, monitoringDetails, contentType, deliveryType, filters, mode, headers, endpointAddressResolverMetadata, oAuthPolicy != null ? oAuthPolicy.anonymize() : null, http2Enabled, subscriptionIdentityHeadersEnabled ); } return this; }