auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void loadMetadataDir() throws IOException, AlluxioException { String dirPath = "/testRoot/layer1/layer2/layer3/"; String filePathA = dirPath + "testFileA"; String filePathB = dirPath + "testFileB"; FileSystemTestUtils .createByteFile(sFileSystem, filePathA, WritePType.CACHE_THROUGH, 10); FileSystemTestUtils .createByteFile(sFileSystem, filePathB, WritePType.THROUGH, 30); AlluxioURI uriDir = new AlluxioURI(dirPath); AlluxioURI uriA = new AlluxioURI(filePathA); AlluxioURI uriB = new AlluxioURI(filePathB); URIStatus statusBeforeA = sFileSystem.getStatus(uriA); URIStatus statusBeforeB = sFileSystem.getStatus(uriB); DeletePOptions deletePOptions = DeletePOptions.newBuilder().setAlluxioOnly(true).setRecursive(true).build(); sFileSystem.delete(uriDir, deletePOptions); sFsShell.run("loadMetadata", dirPath); GetStatusPOptions getStatusPOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).build(); URIStatus statusAfterA = sFileSystem.getStatus(uriA, getStatusPOptions); assertEquals(statusBeforeA.getFileInfo().getName(), statusAfterA.getFileInfo().getName()); assertEquals(statusBeforeA.getFileInfo().getLength(), statusAfterA.getFileInfo().getLength()); URIStatus statusAfterB = sFileSystem.getStatus(uriB, getStatusPOptions); assertEquals(statusBeforeB.getFileInfo().getName(), statusAfterB.getFileInfo().getName()); assertEquals(statusBeforeB.getFileInfo().getLength(), statusAfterB.getFileInfo().getLength()); }

Target:
public void loadMetadataDir() throws IOException, AlluxioException { String dirPath = "/testRoot/layer1/layer2/layer3/"; String filePathA = PathUtils.concatPath(dirPath, "testFileA"); String filePathB = PathUtils.concatPath(dirPath, "testFileB"); FileSystemTestUtils .createByteFile(sFileSystem, filePathA, WritePType.CACHE_THROUGH, 10); FileSystemTestUtils .createByteFile(sFileSystem, filePathB, WritePType.CACHE_THROUGH, 30); AlluxioURI uriDir = new AlluxioURI(dirPath); AlluxioURI uriA = new AlluxioURI(filePathA); AlluxioURI uriB = new AlluxioURI(filePathB); URIStatus statusBeforeA = sFileSystem.getStatus(uriA); URIStatus statusBeforeB = sFileSystem.getStatus(uriB); DeletePOptions deletePOptions = DeletePOptions.newBuilder().setAlluxioOnly(true).setRecursive(true).build(); sFileSystem.delete(uriDir, deletePOptions); sFsShell.run("loadMetadata", dirPath); GetStatusPOptions getStatusPOptions = GetStatusPOptions.newBuilder().setLoadMetadataType(LoadMetadataPType.NEVER).build(); URIStatus statusAfterA = sFileSystem.getStatus(uriA, getStatusPOptions); assertEquals(statusBeforeA.getFileInfo().getName(), statusAfterA.getFileInfo().getName()); assertEquals(statusBeforeA.getFileInfo().getLength(), statusAfterA.getFileInfo().getLength()); URIStatus statusAfterB = sFileSystem.getStatus(uriB, getStatusPOptions); assertEquals(statusBeforeB.getFileInfo().getName(), statusAfterB.getFileInfo().getName()); assertEquals(statusBeforeB.getFileInfo().getLength(), statusAfterB.getFileInfo().getLength()); }
Source:
public void readCsvFileThrowsExceptionIfTooManyColumns() throws Exception { String csv = "Site,Longitude,Latitude,Precision,Country,Disease,Occurrence Date,Feed Name,Alert Title,Summary,URL\n" + "My site,10,20,PRECISE,England,Dengue,2012,My feed,My title,My summary,My URL,Extra column\n"; CsvDiseaseOccurrence.readFromCsv(csv); }

Target:
public void readCsvFileThrowsExceptionIfTooManyColumns() throws Exception { String csv = "Site,Longitude,Latitude,Precision,Country,Disease,Occurrence Date,Feed,Alert Title,Summary,URL\n" + "My site,10,20,PRECISE,England,Dengue,2012,My feed,My title,My summary,My URL,Extra column\n"; CsvDiseaseOccurrence.readFromCsv(csv); }
Source:
Boolean equals(int leftMapIndex, int rightMapIndex) throws Throwable; } public static Boolean genericEqual( MethodHandle keyEqualsFunction, MethodHandle keyHashcodeFunction, Type keyType, Block leftMapBlock, Block rightMapBlock, EqualityPredicate predicate) { if (leftMapBlock.getPositionCount() != rightMapBlock.getPositionCount()) { return false; } SingleMapBlock mapLeftBlock = (SingleMapBlock) leftMapBlock; SingleMapBlock mapRightBlock = (SingleMapBlock) rightMapBlock; for (int position = 0; position < leftMapBlock.getPositionCount(); position += 2) { Object key = readNativeValue(keyType, mapLeftBlock, position); int leftPosition = mapLeftBlock.seekKey(key); int rightPosition = mapRightBlock.seekKey(key); if (rightPosition == -1) { return false; } try { Boolean result = predicate.equals(leftPosition, rightPosition); if (result == null) { return null; } else if (!result) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }

Target:
Boolean equals(int leftMapIndex, int rightMapIndex) throws Throwable; } public static Boolean genericEqual( Type keyType, Block leftBlock, Block rightBlock, EqualityPredicate predicate) { if (leftBlock.getPositionCount() != rightBlock.getPositionCount()) { return false; } SingleMapBlock leftSingleMapLeftBlock = (SingleMapBlock) leftBlock; SingleMapBlock rightSingleMapBlock = (SingleMapBlock) rightBlock; for (int position = 0; position < leftSingleMapLeftBlock.getPositionCount(); position += 2) { Object key = readNativeValue(keyType, leftBlock, position); int leftPosition = position + 1; int rightPosition = rightSingleMapBlock.seekKey(key); if (rightPosition == -1) { return false; } try { Boolean result = predicate.equals(leftPosition, rightPosition); if (result == null) { return null; } else if (!result) { return false; } } catch (Throwable t) { throw internalError(t); } } return true; }
Source:
public Iterable<Object> loadObjects(EntityProjection entityProjection, RequestScope scope) { try { log.debug("LoadObjects Sleep for delay test"); if (entityProjection.getType().toString().trim().equals("class example.Book")) { Thread.sleep(5000); } } catch (InterruptedException e) { log.debug("Test delay interrupted"); } return tx.loadObjects(entityProjection, scope); }

Target:
public Iterable<Object> loadObjects(EntityProjection entityProjection, RequestScope scope) { try { log.debug("LoadObjects Sleep for delay test"); if (sleep) { Thread.sleep(testDelay); } } catch (InterruptedException e) { log.debug("Test delay interrupted"); } return super.loadObjects(entityProjection, scope); }
Source:
public String getPropertyString() { return getMythicMob().getMob().getUniqueId().toString(); }

Target:
public String getPropertyString() { return null; }
Source:
private void handleNormalSignInFlow(final FirebaseAuth auth, final HelperActivityBase activity, final OAuthProvider provider) { auth.startActivityForSignInWithProvider(activity, provider) .addOnSuccessListener( new OnSuccessListener<AuthResult>() { @Override public void onSuccess(@NonNull AuthResult authResult) { FirebaseUser user = authResult.getUser(); IdpResponse idpResponse = new IdpResponse.Builder( new User.Builder(provider.getProviderId(), user.getEmail()) .setName(user.getDisplayName()) .setPhotoUri(user.getPhotoUrl()) .build()) .build(); setResult(Resource.<IdpResponse>forSuccess(idpResponse)); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { FirebaseAuthUserCollisionException collisionException = (FirebaseAuthUserCollisionException) e; setResult(Resource.<IdpResponse>forFailure( new FirebaseUiUserCollisionException( ErrorCodes.ERROR_GENERIC_IDP_RECOVERABLE_ERROR, "Recoverable error.", provider.getProviderId(), collisionException.getEmail(), collisionException.getUpdatedCredential()))); } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }

Target:
protected void handleNormalSignInFlow(final FirebaseAuth auth, final HelperActivityBase activity, final OAuthProvider provider) { auth.startActivityForSignInWithProvider(activity, provider) .addOnSuccessListener( new OnSuccessListener<AuthResult>() { @Override public void onSuccess(@NonNull AuthResult authResult) { handleSuccess(provider.getProviderId(), authResult.getUser(), (OAuthCredential) authResult.getCredential()); } }) .addOnFailureListener( new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { if (e instanceof FirebaseAuthUserCollisionException) { FirebaseAuthUserCollisionException collisionException = (FirebaseAuthUserCollisionException) e; setResult(Resource.<IdpResponse>forFailure( new FirebaseUiUserCollisionException( ErrorCodes.ERROR_GENERIC_IDP_RECOVERABLE_ERROR, "Recoverable error.", provider.getProviderId(), collisionException.getEmail(), collisionException.getUpdatedCredential()))); } else { setResult(Resource.<IdpResponse>forFailure(e)); } } }); }
Source:
public static File findSecrets(File xmlFile) throws ParserConfigurationException, SAXException, IOException, XMLStreamException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!tagName.equals("")) { String value = new String(ch, start, length).trim(); if (!value.equals("") && Secret.decrypt(value) != null) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } super.characters(ch, start, length); } }; Source src = new SAXSource(xr, new InputSource(new StringReader(FileUtils.readFileToString(xmlFile)))); File patchedFile = File.createTempFile("patched", ".xml"); Result res = new StreamResult(new FileOutputStream(patchedFile)); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(src, res); return patchedFile; }

Target:
public static File findSecrets(File xmlFile) throws ParserConfigurationException, SAXException, IOException, XMLStreamException, TransformerException { XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) { private String tagName = ""; @Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { tagName = qName; super.startElement(uri, localName, qName, atts); } public void endElement(String uri, String localName, String qName) throws SAXException { tagName = ""; super.endElement(uri, localName, qName); } @Override public void characters(char[] ch, int start, int length) throws SAXException { if (!"".equals(tagName)) { String value = new String(ch, start, length).trim(); if (!"".equals(value)) { if ((Secret.decrypt(value)) != null || SecretBytes.isSecretBytes(value)) { ch = SECRET_MARKER.toCharArray(); start = 0; length = ch.length; } } } super.characters(ch, start, length); } }; Source src = new SAXSource(xr, new InputSource(new StringReader(FileUtils.readFileToString(xmlFile)))); File patchedFile = File.createTempFile("patched", ".xml", SupportPlugin.getRootDirectory()); Result res = new StreamResult(new FileOutputStream(patchedFile)); Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); transformer.transform(src, res); return patchedFile; }
Source:
private Collection<EClass> collectAllFromRegistry() { final Registry registry = EPackage.Registry.INSTANCE; final Set<EClass> result = new LinkedHashSet<EClass>(); for (final String uri : registry.keySet()) { final EPackage ePackage = registry.getEPackage(uri); for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass && !((EClass) eClassifier).isAbstract()) { result.add((EClass) eClassifier); } } } return result; }

Target:
private Collection<EClass> collectAllFromRegistry() { final Registry registry = EPackage.Registry.INSTANCE; final Set<EClass> result = new LinkedHashSet<EClass>(); for (final String uri : registry.keySet()) { final EPackage ePackage = registry.getEPackage(uri); for (final EClassifier eClassifier : ePackage.getEClassifiers()) { if (eClassifier instanceof EClass && !((EClass) eClassifier).isAbstract() && !((EClass) eClassifier).isInterface()) { result.add((EClass) eClassifier); } } } return result; }
Source:
private void store( AttachmentInfo createInfo, Consumer<String> idConsumer, Consumer<String> errorMessageConsumer) { CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( uuidGenerator, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename())), null); try { CreateResponse createResponse = catalogFramework.create(streamCreateRequest); createResponse.getCreatedMetacards().stream().map(Metacard::getId).forEach(idConsumer); } catch (IngestException e) { String errorMessage = "Error while storing entry in catalog: "; LOGGER.info(errorMessage, e); errorMessageConsumer.accept(errorMessage); } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable: "; LOGGER.info(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } }

Target:
private void store( AttachmentInfo createInfo, Consumer<String> idConsumer, Consumer<String> errorMessageConsumer) { CreateStorageRequest streamCreateRequest = new CreateStorageRequestImpl( Collections.singletonList( new IncomingContentItem( uuidGenerator, createInfo.getStream(), createInfo.getContentType(), createInfo.getFilename())), null); try { CreateResponse createResponse = catalogFramework.create(streamCreateRequest); createResponse.getCreatedMetacards().stream().map(Metacard::getId).forEach(idConsumer); } catch (IngestException e) { String errorMessage = "Error while storing entry in catalog."; LOGGER.info(errorMessage, e); INGEST_LOGGER.warn(errorMessage, e); errorMessageConsumer.accept(errorMessage); } catch (SourceUnavailableException e) { String exceptionMessage = "Cannot create catalog entry because source is unavailable."; LOGGER.info(exceptionMessage, e); INGEST_LOGGER.warn(exceptionMessage, e); throw new InternalServerErrorException(exceptionMessage); } }
Source:
public ComputedStatistics build() { return new ComputedStatistics( unmodifiableList(groupingColumns), unmodifiableList(gropingValues), unmodifiableMap(tableStatistics), unmodifiableMap(columnStatistics)); }

Target:
public ComputedStatistics build() { return new ComputedStatistics(groupingColumns, groupingValues, tableStatistics, columnStatistics); }
Source:
private void updateCommitStatus(@Nonnull Run<?, ?> build, @Nonnull TaskListener listener) throws InterruptedException, IOException { final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build)); StatusResult status = statusFrom(build); String message = defaultIfEmpty(firstNonNull(statusMessage, DEFAULT_MESSAGE) .expandAll(build, listener), status.getMsg()); String contextName = displayNameFor(build.getParent()); for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getParent())) { for (GHRepository repository : name.resolve()) { listener.getLogger().println( GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1) ); try { repository.createCommitStatus( sha1, status.getState(), build.getAbsoluteUrl(), message, contextName ); } catch (FileNotFoundException e) { listener.getLogger().println("Commit doesn't exist in " + repository.getFullName() + ". Status is not set"); } } } }

Target:
private void updateCommitStatus(@Nonnull Run<?, ?> build, @Nonnull TaskListener listener) throws InterruptedException, IOException { final String sha1 = ObjectId.toString(BuildDataHelper.getCommitSHA1(build)); StatusResult status = statusFrom(build); String message = defaultIfEmpty(firstNonNull(statusMessage, DEFAULT_MESSAGE) .expandAll(build, listener), status.getMsg()); String contextName = displayNameFor(build.getParent()); for (GitHubRepositoryName name : GitHubRepositoryNameContributor.parseAssociatedNames(build.getParent())) { for (GHRepository repository : name.resolve()) { listener.getLogger().println( GitHubCommitNotifier_SettingCommitStatus(repository.getHtmlUrl() + "/commit/" + sha1) ); try { repository.createCommitStatus( sha1, status.getState(), build.getAbsoluteUrl(), message, contextName ); } catch (FileNotFoundException e) { LOGGER.debug("Failed to update commit status", e); listener.getLogger() .format("Commit doesn't exist in %s. Status is not set%n", repository.getFullName()); } } } }
Source:
public void adsLeaderboardOnPageWithoutInfobox(String wikiName, String article, String adUnit) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); MobileAdsBaseObject ads = new MobileAdsBaseObject(driver, testedPage); ads.verifyGptIframe(adUnit, MOBILE_TOP_LEADERBOARD, SRC); Point leaderboardLocation = driver.findElement(By.id(MOBILE_TOP_LEADERBOARD)).getLocation(); Point pageHeader = driver.findElement(By.className("wiki-page-header")).getLocation(); Assertion.assertTrue(leaderboardLocation.getY() > pageHeader.getY()); }

Target:
public void adsLeaderboardOnPageWithoutInfobox(String wikiName, String article, String adUnit) { String testedPage = urlBuilder.getUrlForPath(wikiName, article); MobileAdsBaseObject ads = new MobileAdsBaseObject(driver, testedPage); ads.verifyGptIframe(adUnit, MOBILE_TOP_LEADERBOARD, SRC); Assertion.assertTrue( ads.getElementTopPositionByCssSelector(AdsContent.getSlotSelector(AdsContent.MOBILETOP_LB)) >= ads.getElementBottomPositionByCssSelector(ARTICLE_HEADER) ); }
Source:
private VdsNetworkInterface createVlan(String baseIfaceName) { VdsNetworkInterface iface = new Vlan(); int vlanId = RandomUtils.instance().nextInt(100); iface.setBaseInterface(baseIfaceName); iface.setVlanId(vlanId); iface.setName(baseIfaceName + "." + vlanId); return iface; }

Target:
private VdsNetworkInterface createVlan(String baseIfaceName) { VdsNetworkInterface iface = new Vlan(RandomUtils.instance().nextInt(100), baseIfaceName); return iface; }
Source:
public static void visitControllerActions(@NotNull final Project project, @NotNull ControllerActionVisitor visitor, @Nullable String prefix) { Collection<PhpClass> allSubclasses = new HashSet<PhpClass>() {{ addAll(PhpIndex.getInstance(project).getAllSubclasses("\\Illuminate\\Routing\\Controller")); addAll(PhpIndex.getInstance(project).getAllSubclasses("\\App\\Http\\Controllers\\Controller")); }}; HashSet<String> commonTraits = new HashSet<String>(); commonTraits.add("ValidatesRequests"); commonTraits.add("DispatchesCommands"); commonTraits.add("AuthorizesRequests"); commonTraits.add("Controller"); String ns = getDefaultNamespace(project) + "\\"; String prefixedNs = ns + (prefix != null && !prefix.equals("") ? prefix + "\\":""); for(PhpClass phpClass: allSubclasses) { if(!phpClass.isAbstract()) { for(Method method: phpClass.getMethods()) { String className = phpClass.getPresentableFQN(); String methodName = method.getName(); if(!method.isStatic() && method.getAccess().isPublic() && !methodName.startsWith("__")) { PhpClass phpTrait = method.getContainingClass(); if(phpTrait == null || !commonTraits.contains(phpTrait.getName())) { boolean prioritised = false; if(prefix != null && className.startsWith(prefixedNs)) { className = className.substring(prefixedNs.length()); prioritised = true; } else if(className.startsWith(ns)) { className = className.substring(ns.length()); } if(StringUtils.isNotBlank(className)) { visitor.visit(phpClass, method, className + "@" + methodName, prioritised); } } } } } } }

Target:
public static void visitControllerActions(@NotNull final Project project, @NotNull ControllerActionVisitor visitor, @Nullable String prefix) { Collection<PhpClass> allSubclasses = new HashSet<PhpClass>() {{ addAll(PhpIndex.getInstance(project).getAllSubclasses("\\Illuminate\\Routing\\Controller")); addAll(PhpIndex.getInstance(project).getAllSubclasses("\\App\\Http\\Controllers\\Controller")); }}; String ns = getDefaultNamespace(project) + "\\"; String prefixedNs = ns + (prefix != null && !prefix.equals("") ? prefix + "\\":""); for(PhpClass phpClass: allSubclasses) { if(!phpClass.isAbstract()) { for(Method method: phpClass.getMethods()) { String className = phpClass.getPresentableFQN(); String methodName = method.getName(); if(!method.isStatic() && method.getAccess().isPublic() && !methodName.startsWith("__")) { PhpClass phpTrait = method.getContainingClass(); if(phpTrait == null || !commonControllerTraits.contains(phpTrait.getName())) { boolean prioritised = false; if(prefix != null && className.startsWith(prefixedNs)) { className = className.substring(prefixedNs.length()); prioritised = true; } else if(className.startsWith(ns)) { className = className.substring(ns.length()); } if(StringUtils.isNotBlank(className)) { visitor.visit(phpClass, method, className + "@" + methodName, prioritised); } } } } } } }
Source:
private Set<ValueExtractorDescriptor> getRuntimeCompliantValueExtractors(Class<?> runtimeType, Set<ValueExtractorDescriptor> potentialValueExtractorDescriptors) { if ( nonContainerTypes.contains( runtimeType ) ) { return Collections.emptySet(); } Set<ValueExtractorDescriptor> valueExtractorDescriptors = possibleValueExtractorsByRuntimeType.get( runtimeType ); if ( valueExtractorDescriptors != null ) { return valueExtractorDescriptors; } Set<ValueExtractorDescriptor> possibleValueExtractors = potentialValueExtractorDescriptors .stream() .filter( e -> TypeHelper.isAssignable( e.getContainerType(), runtimeType ) ) .collect( Collectors.toSet() ); valueExtractorDescriptors = getMaximallySpecificValueExtractors( possibleValueExtractors ); if ( valueExtractorDescriptors.isEmpty() ) { nonContainerTypes.put( runtimeType, NON_CONTAINER_VALUE ); return Collections.emptySet(); } Set<ValueExtractorDescriptor> valueExtractorDescriptorsToCache = CollectionHelper.toImmutableSet( valueExtractorDescriptors ); Set<ValueExtractorDescriptor> cachedValueExtractorDescriptors = possibleValueExtractorsByRuntimeType.putIfAbsent( runtimeType, valueExtractorDescriptorsToCache ); return cachedValueExtractorDescriptors != null ? cachedValueExtractorDescriptors : valueExtractorDescriptorsToCache; }

Target:
private Set<ValueExtractorDescriptor> getRuntimeCompliantValueExtractors(Class<?> runtimeType, Set<ValueExtractorDescriptor> potentialValueExtractorDescriptors) { if ( nonContainerTypes.contains( runtimeType ) ) { return Collections.emptySet(); } Set<ValueExtractorDescriptor> valueExtractorDescriptors = possibleValueExtractorsByRuntimeType.get( runtimeType ); if ( valueExtractorDescriptors != null ) { return valueExtractorDescriptors; } Set<ValueExtractorDescriptor> possibleValueExtractors = potentialValueExtractorDescriptors .stream() .filter( e -> TypeHelper.isAssignable( e.getContainerType(), runtimeType ) ) .collect( Collectors.toSet() ); valueExtractorDescriptors = getMaximallySpecificValueExtractors( possibleValueExtractors ); if ( valueExtractorDescriptors.isEmpty() ) { nonContainerTypes.add( runtimeType ); return Collections.emptySet(); } Set<ValueExtractorDescriptor> valueExtractorDescriptorsToCache = CollectionHelper.toImmutableSet( valueExtractorDescriptors ); Set<ValueExtractorDescriptor> cachedValueExtractorDescriptors = possibleValueExtractorsByRuntimeType.putIfAbsent( runtimeType, valueExtractorDescriptorsToCache ); return cachedValueExtractorDescriptors != null ? cachedValueExtractorDescriptors : valueExtractorDescriptorsToCache; }
Source:
private void writePOMModelOnFS(org.uberfire.java.nio.file.Path filePath, Model model) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writer.write(baos, model); Files.delete(filePath); Files.write(filePath, baos.toByteArray(), StandardOpenOption.CREATE_NEW); }

Target:
private void writePOMModelOnFS(org.uberfire.java.nio.file.Path filePath, Model model) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writer.write(baos, model); Files.write(filePath, baos.toByteArray(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); }
Source:
private String createDisplayedRef() { String refToCheckOut = ""; if (refName != null) refToCheckOut = refName; else if (commitId != null) { if (commitId != null) refToCheckOut = commitId.getName().substring(0, 7)+ "... "; } else throw new IllegalStateException( "Both refName and commitId must not be null"); return refToCheckOut; }

Target:
private String createDisplayedRef() { String refToCheckOut = ""; if (refName != null) refToCheckOut = refName; else if (commitId != null) refToCheckOut = commitId.getName().substring(0, 7)+ "... "; else throw new IllegalStateException( "Either refName or commitId must be non-null"); return refToCheckOut; }
Source:
public UserAgentPolicy(HttpLogOptions httpLogOptions, Configuration configuration) { if (httpLogOptions == null) { this.httpLogOptions = new HttpLogOptions(); } else { this.httpLogOptions = httpLogOptions; } if (configuration == null) { this.configuration = Configuration.getGlobalConfiguration().clone(); } else { this.configuration = configuration; } }

Target:
public UserAgentPolicy(HttpLogOptions httpLogOptions, Configuration configuration) { if (httpLogOptions == null) { this.httpLogOptions = new HttpLogOptions(); } else { this.httpLogOptions = httpLogOptions; } if (configuration == null) { this.configuration = Configuration.getGlobalConfiguration(); } else { this.configuration = configuration; } }
Source:
protected void removeProvider(Provider<Rule> provider) { LOGGER.info("Rule provider: is removed.", provider); if (provider instanceof ManagedRuleProvider) { if (ruleRegistryReg != null) { ruleRegistryReg.unregister(); } } else { super.removeProvider(provider); } }

Target:
protected void removeProvider(Provider<Rule> provider) { logger.info("Rule provider: is removed.", provider); super.removeProvider(provider); }
Source:
public void operationConst() { TemplateFactory factory = new TemplateFactory('\\'); match("[0 ADD 1]", factory.create("{0+'1'}")); match("[0 DIV 1.0]", factory.create("{0/'1.0'}")); }

Target:
public void operationConst() { TemplateFactory factory = new TemplateFactory('\\'); match("[0 ADD 1]", factory.create("{0+'1'}")); match("[0 DIV 1.0]", factory.create("{0/'1.0'}")); match("[0 MULT 3.141592653589793, ' / 180.0)']", factory.create("{0*'3.141592653589793'} / 180.0)")); }
Source:
public void doRun() throws Exception { long iteration = 0; while (!context.isStopped()) { int partitionId = nextPartitionId(); ICompletableFuture<Object> future = invoke(partitionId); latency.started(); if (syncInvocation) { if (syncFrequency == 1) { future.get(); } else { if (iteration > 0 && iteration % syncFrequency == 0) { for (ICompletableFuture innerFuture : futureList) { innerFuture.get(); } futureList.clear(); } else { futureList.add(future); } } } else { future.andThen(this); } latency.done(); iteration++; if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " At iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { if (syncInvocation) { operations.addAndGet(performanceUpdateFrequency); } } } operations.addAndGet(iteration % performanceUpdateFrequency); }

Target:
private void doRun() throws Exception { long iteration = 0; while (!testContext.isStopped()) { int partitionId = nextPartitionId(); ICompletableFuture<Object> future = invoke(partitionId); if (syncInvocation) { if (syncFrequency == 1) { future.get(); } else { if (iteration > 0 && iteration % syncFrequency == 0) { for (ICompletableFuture innerFuture : futureList) { innerFuture.get(); } futureList.clear(); } else { futureList.add(future); } } } else { future.andThen(this); } iteration++; if (iteration % logFrequency == 0) { log.info(Thread.currentThread().getName() + " at iteration: " + iteration); } if (iteration % performanceUpdateFrequency == 0) { if (syncInvocation) { operations.addAndGet(performanceUpdateFrequency); } } } operations.addAndGet(iteration % performanceUpdateFrequency); }
Source:
private static Boolean isPartTextualBody(Part part) throws MessagingException { String disposition = part.getDisposition(); String dispositionType = null; String dispositionFilename = null; if (disposition != null) { dispositionType = MimeUtility.getHeaderParameter(disposition, null); dispositionFilename = MimeUtility.getHeaderParameter(disposition, "filename"); } if ("attachment".equalsIgnoreCase(dispositionType) || dispositionFilename != null) { return false; } return part.isMimeType("text/html") || part.isMimeType("text/plain") || part.isMimeType("application/pgp"); }

Target:
private static Boolean isPartTextualBody(Part part) throws MessagingException { String disposition = part.getDisposition(); String dispositionType = null; String dispositionFilename = null; if (disposition != null) { dispositionType = MimeUtility.getHeaderParameter(disposition, null); dispositionFilename = MimeUtility.getHeaderParameter(disposition, "filename"); } boolean isAttachmentDisposition = "attachment".equalsIgnoreCase(dispositionType) || dispositionFilename != null; if (isAttachmentDisposition) { return false; } return part.isMimeType("text/html") || part.isMimeType("text/plain") || part.isMimeType("application/pgp"); }
Source:
private MachineStateDescriptor toDescriptor(MachineImpl machineState) throws ServerException { final List<ProjectBindingDescriptor> projectDescriptors = new ArrayList<>(); for (ProjectBinding project : machineState.getProjects()) { projectDescriptors.add(dtoFactory.createDto(ProjectBindingDescriptor.class) .withPath(project.getPath()) .withLinks(null)); } MachineRecipe machineRecipe = dtoFactory.createDto(MachineRecipe.class) .withType(machineState.getRecipe().getType()) .withScript(machineState.getRecipe().getScript()); final MachineStateDescriptor machineDescriptor = dtoFactory.createDto(MachineStateDescriptor.class) .withId(machineState.getId()) .withType(machineState.getType()) .withRecipe(machineRecipe) .withStatus(machineState.getStatus()) .withOwner(machineState.getOwner()) .withWorkspaceId(machineState.getWorkspaceId()) .withWorkspaceBound(machineState.isWorkspaceBound()) .withProjects(projectDescriptors) .withDisplayName(machineState.getDisplayName()) .withMemorySize(machineState.getMemorySize()); machineDescriptor.setLinks(null); return machineDescriptor; }

Target:
private MachineStateDescriptor toDescriptor(MachineImpl machineState) throws ServerException { final List<ProjectBindingDescriptor> projectDescriptors = new ArrayList<>(); for (ProjectBinding project : machineState.getProjects()) { projectDescriptors.add(dtoFactory.createDto(ProjectBindingDescriptor.class) .withPath(project.getPath()) .withLinks(null)); } MachineRecipe machineRecipe = DtoFactory.newDto(MachineRecipe.class) .withType(machineState.getRecipe().getType()) .withScript(machineState.getRecipe().getScript()); final MachineStateDescriptor machineDescriptor = dtoFactory.createDto(MachineStateDescriptor.class) .withId(machineState.getId()) .withType(machineState.getType()) .withRecipe(machineRecipe) .withStatus(machineState.getStatus()) .withOwner(machineState.getOwner()) .withWorkspaceId(machineState.getWorkspaceId()) .withWorkspaceBound(machineState.isWorkspaceBound()) .withProjects(projectDescriptors) .withDisplayName(machineState.getDisplayName()) .withMemorySize(machineState.getMemorySize()); machineDescriptor.setLinks(null); return machineDescriptor; }
Source:
private void sleep(final long sleepTime) { try { Thread.sleep(sleepTime); } catch (final InterruptedException e) { LOGGER.error("thread sleep was interrupted", e); } }

Target:
private void sleep(final long sleepTime) { try { Thread.sleep(sleepTime); } catch (final InterruptedException e) { LOGGER.error("Thread sleep was interrupted", e); } }
Source:
private void setVmToNonHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getParameters().getDev().getVmId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() == DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.qxl); resourceManager.getVmManager(getParameters().getDev().getVmId()).update(vmStatic); } if (getVmDeviceUtils().getVideoDevices(getParameters().getDev().getVmId()).isEmpty()) { getVmDeviceUtils().addVideoDevices(vmStatic, getVmDeviceUtils().getNeededNumberOfVideoDevices(vmStatic)); } }

Target:
private void setVmToNonHeadlessMode() { VmStatic vmStatic = vmStaticDao.get(getVmBaseId()); if (vmStatic != null && vmStatic.getDefaultDisplayType() == DisplayType.none) { vmStatic.setDefaultDisplayType(DisplayType.qxl); resourceManager.getVmManager(getVmBaseId()).update(vmStatic); } vmDeviceUtils.addVideoDevicesOnlyIfNoVideoDeviceExists(vmStatic); }
Source:
public SupremeCourtChamberDivision getOrCreateScChamberDivision(String chamberDivisionFullName) { Preconditions.checkArgument(!StringUtils.isBlank(chamberDivisionFullName)); SupremeCourtChamberDivision scChamberDivision = scChamberDivisionRepository.findOneByFullName(chamberDivisionFullName); if (scChamberDivision == null) { SupremeCourtChamber scChamber = findScChamber(chamberDivisionFullName); scChamberDivision = createAndSaveScChamberDivision(scChamber, chamberDivisionFullName); } return scChamberDivision; }

Target:
public SupremeCourtChamberDivision getOrCreateScChamberDivision(String chamberDivisionFullName) { Preconditions.checkArgument(StringUtils.isNotBlank(chamberDivisionFullName)); SupremeCourtChamberDivision scChamberDivision = scChamberDivisionRepository.findOneByFullName(chamberDivisionFullName); if (scChamberDivision == null) { SupremeCourtChamber scChamber = findScChamber(chamberDivisionFullName); scChamberDivision = createAndSaveScChamberDivision(scChamber, chamberDivisionFullName); } return scChamberDivision; }
Source:
@Test public void compileFilesWithImportFromParentFileTest() throws IOException { Path source = Paths.get("src","test","resources","solidity","foo","file3.sol"); SolidityCompiler.Option allowPathsOption = new SolidityCompiler.Options.AllowPaths(Collections.singletonList(source.getParent().getParent().toFile())); SolidityCompiler.Result res = SolidityCompiler.compile(source.toFile(), true, ABI, BIN, INTERFACE, METADATA, allowPathsOption); System.out.println("Out: '" + res.output + "'"); System.out.println("Err: '" + res.errors + "'"); CompilationResult result = CompilationResult.parse(res.output); CompilationResult.ContractMetadata a = result.getContract(source, "test3"); CallTransaction.Contract contract = new CallTransaction.Contract(a.abi); System.out.print(contract.functions[0].toString()); }

Target:
@Test public void compileFilesWithImportFromParentFileTest() throws IOException { Path source = Paths.get("src","test","resources","solidity","foo","file3.sol"); SolidityCompiler.Option allowPathsOption = new SolidityCompiler.Options.AllowPaths(Collections.singletonList(source.getParent().getParent().toFile())); SolidityCompiler.Result res = SolidityCompiler.compile(source.toFile(), true, ABI, BIN, INTERFACE, METADATA, allowPathsOption); System.out.println("Out: '" + res.output + "'"); System.out.println("Err: '" + res.errors + "'"); CompilationResult result = CompilationResult.parse(res.output); Assert.assertEquals(2, result.getContractKeys().size()); Assert.assertEquals(result.getContract("test3"), result.getContract(source,"test3")); Assert.assertNotNull(result.getContract("test1")); CompilationResult.ContractMetadata a = result.getContract(source, "test3"); CallTransaction.Contract contract = new CallTransaction.Contract(a.abi); System.out.print(contract.functions[0].toString()); }
Source:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { return cachingFs.open(path); }

Target:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { if (hiveFileContext.isCacheable()) { return cachingFileSystem.openFile(path, hiveFileContext); } return dataTier.openFile(path, hiveFileContext); }
Source:
public void launch(ISelection selection, String mode) { if (selection instanceof IStructuredSelection) { Object element = ((IStructuredSelection)selection).getFirstElement(); if (element != null && element instanceof IResource) { IResource selectedResource = (IResource) element; launch(selectedResource, mode); } } }

Target:
public void launch(ISelection selection, String mode) { if (!selection.isEmpty() && selection instanceof IStructuredSelection) { Object element = ((IStructuredSelection)selection).getFirstElement(); if (element instanceof IResource) { IResource selectedResource = (IResource) element; launch(selectedResource, mode); } } }
Source:
public Question(long id, String code, String name, String uid, PhoneFormat phoneFormat, Type type, boolean compulsory, List<Option> options, Header header, int index, Visibility visibility, List<Rule> rules) { setId(required(id, "id is required")); setCode(required(code, "code is required")); setName(required(name, "name is required")); setUid(required(uid, "uid is required")); setPhoneFormat(phoneFormat); setType(required(type, "type is required")); setCompulsory(compulsory); setOptions(options); setHeader(header); setIndex(index); setVisibility(visibility); setRules(rules); }

Target:
public Question(long id, String code, String name, String uid, PhoneFormat phoneFormat, Type type, boolean compulsory, List<Option> options, Header header, int index, Visibility visibility, List<Rule> rules) { this.id = required(id, "id is required"); this.code = required(code, "code is required"); this.name = required(name, "name is required"); this.uid = required(uid, "uid is required"); this.phoneFormat = phoneFormat; this.type = required(type, "type is required"); this.compulsory = compulsory; this.options = options; this.header = header; this.index = index; this.visibility = visibility; this.rules = rules; }
Source:
protected NeedsPaging<OrderFrequency> doGetAll(RequestContext context) { return new NeedsPaging<OrderFrequency>(Context.getOrderService().getOrderFrequencies(), context); }

Target:
protected NeedsPaging<OrderFrequency> doGetAll(RequestContext context) { return new NeedsPaging<OrderFrequency>(Context.getOrderService().getOrderFrequencies(context.getIncludeAll()), context); }
Source:
public MergeViewerSide getOriginSide() { EObject origin = getEObject(MergeViewerSide.ANCESTOR); if (origin == null) { List<MergeViewerSide> ret = getOtherSides(fSide); ret.remove(MergeViewerSide.ANCESTOR); return ret.get(0); } else { return MergeViewerSide.ANCESTOR; } }

Target:
public MergeViewerSide getOriginSide() { EObject origin = getEObject(MergeViewerSide.ANCESTOR); if (origin == null) { return fSide.opposite(); } else { return MergeViewerSide.ANCESTOR; } }
Source:
public boolean checkFileExistsInGlobalSpace(String pathname) { try { return this.globalSpace.resolveFile(pathname).exists(); } catch (FileSystemException e) { return false; } }

Target:
public boolean checkFileExistsInGlobalSpace(String pathname) { try { return this.globalSpace.resolveFile(pathname).exists(); } catch (FileSystemException e) { logger.debug(String.format("Can't parse the file name [%s] in the global space.", pathname), e); return false; } }
Source:
public Group updateGroup(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group.getName(), "group.getName()"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if (!dbGroup.getShortName().equals(group.getShortName())) { dbGroup.setShortName(group.getShortName()); try { jdbc.update("update groups set name=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getName(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } if (group.getDescription() != null && !group.getDescription().equals(dbGroup.getDescription())) { try { jdbc.update("update groups set dsc=?, modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", group.getDescription(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), group.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } dbGroup.setDescription(group.getDescription()); } if (group.getParentGroupId() != null && !group.getParentGroupId().equals(dbGroup.getParentGroupId())) { dbGroup.setParentGroupId(group.getParentGroupId()); try { jdbc.update("update groups set parent_group_id=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getParentGroupId(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } return dbGroup; }

Target:
public Group updateGroup(PerunSession sess, Group group) throws InternalErrorException { Utils.notNull(group.getName(), "group.getName()"); Group dbGroup; try { dbGroup = this.getGroupById(sess, group.getId()); } catch (GroupNotExistsException e) { throw new InternalErrorException("Group existence was checked at the higher level",e); } if (!dbGroup.getShortName().equals(group.getShortName())) { dbGroup.setShortName(group.getShortName()); try { jdbc.update("update groups set name=?,modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", dbGroup.getName(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), dbGroup.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } } if (group.getDescription() != null && !group.getDescription().equals(dbGroup.getDescription())) { try { jdbc.update("update groups set dsc=?, modified_by=?, modified_by_uid=?, modified_at=" + Compatibility.getSysdate() + " where id=?", group.getDescription(), sess.getPerunPrincipal().getActor(), sess.getPerunPrincipal().getUserId(), group.getId()); } catch (RuntimeException e) { throw new InternalErrorException(e); } dbGroup.setDescription(group.getDescription()); } return dbGroup; }
Source:
public void getServiceStatsReturnsRequestId() { SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient(); UUID expectedUuid = UUID.randomUUID(); RequestOptions requestOptions = new RequestOptions().setClientRequestId(expectedUuid); Response<ServiceStatistics> response = serviceClient.getServiceStatisticsWithResponse(requestOptions, Context.NONE); assertEquals(expectedUuid.toString(), response.getHeaders().getValue("client-request-id")); assertReflectionEquals(response.getValue(), getExpectedServiceStatistics(), IGNORE_DEFAULTS); }

Target:
public void getServiceStatsReturnsRequestId() { SearchServiceClient serviceClient = getSearchServiceClientBuilder().buildClient(); RequestOptions requestOptions = new RequestOptions().setClientRequestId(UUID.randomUUID()); Response<ServiceStatistics> response = serviceClient.getServiceStatisticsWithResponse(requestOptions, Context.NONE); String actualRequestId = response.getHeaders().getValue("request-id"); String actualClientRequestId = response.getHeaders().getValue("client-request-id"); Assertions.assertNotNull(actualClientRequestId); Assertions.assertEquals(actualClientRequestId, actualRequestId); assertReflectionEquals(response.getValue(), getExpectedServiceStatistics(), IGNORE_DEFAULTS); }
Source:
public void testNewTriggeredBuild() { Item item = Hudson.getInstance().getItem("freestyleJob"); assertThat("Item is not a FreeStyleProject", item, instanceOf(FreeStyleProject.class)); FreeStyleProject project = (FreeStyleProject)item; int number = project.getLastBuild().getNumber() + 1; server.waitForCommand(GERRIT_STREAM_EVENTS, 2000); PluginImpl.getInstance().getServer(PluginImpl.DEFAULT_SERVER_NAME).triggerEvent(Setup.createPatchsetCreated()); DuplicatesUtil.waitForBuilds(project, number, DuplicatesUtil.DEFAULT_WAIT_BUILD_MS); assertEquals(number, project.getLastCompletedBuild().getNumber()); assertSame(Result.SUCCESS, project.getLastCompletedBuild().getResult()); }

Target:
public void testNewTriggeredBuild() { Item item = Hudson.getInstance().getItem("freestyleJob"); assertThat("Item is not a FreeStyleProject", item, instanceOf(FreeStyleProject.class)); FreeStyleProject project = (FreeStyleProject)item; int number = project.getLastBuild().getNumber() + 1; server.waitForCommand(GERRIT_STREAM_EVENTS, 2000); PluginImpl.getInstance().getServer(PluginImpl.DEFAULT_SERVER_NAME).triggerEvent(Setup.createPatchsetCreated()); TestUtils.waitForBuilds(project, number); assertEquals(number, project.getLastCompletedBuild().getNumber()); assertSame(Result.SUCCESS, project.getLastCompletedBuild().getResult()); }
Source:
public DockerTransientNode(@Nonnull String uniqueName, String workdir, ComputerLauncher launcher) throws Descriptor.FormException, IOException { super("docker-" + uniqueName, workdir, launcher); setNumExecutors(1); setMode(Mode.EXCLUSIVE); setRetentionStrategy(new DockerOnceRetentionStrategy(10)); }

Target:
public DockerTransientNode(@Nonnull String uniqueName, String workdir, ComputerLauncher launcher) throws Descriptor.FormException, IOException { super("docker-" + uniqueName, workdir, launcher); this.containerUniqueName = uniqueName; setNumExecutors(1); setMode(Mode.EXCLUSIVE); setRetentionStrategy(new DockerOnceRetentionStrategy(10)); }
Source:
public List<SimpleDivision> findCcDivisions(int courtId) { List<CommonCourtDivision> courtDivisions = ccDivisionRepository.findAllByCourtId(courtId); CcDivisionComparator ccDivisionComparator = new CcDivisionComparator(); Collections.sort(courtDivisions, ccDivisionComparator); simpleDivisionConverter.getClass(); return simpleDivisionConverter.convertCcDivisions(courtDivisions); }

Target:
public List<SimpleDivision> findCcDivisions(int courtId) { List<CommonCourtDivision> courtDivisions = ccDivisionRepository.findAllByCourtId(courtId); Collections.sort(courtDivisions, new CcDivisionComparator()); return simpleDivisionConverter.convertCcDivisions(courtDivisions); }
Source:
public void doubleTap(WebElement webElement) { logger.entering(webElement); new TouchAction(this) .tap(webElement).release() .waitAction(100) .tap(webElement).release() .perform(); logger.exiting(); }

Target:
public void doubleTap(WebElement webElement) { logger.entering(webElement); new TouchAction(this) .tap(webElement).release() .waitAction(DOUBLE_TAP_WAIT_TIME) .tap(webElement).release() .perform(); logger.exiting(); }