auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init() throws Exception { initMocks(this); processor = new AddDerivativeProcessor(fileExtension, moveDir.getRoot().getAbsolutePath()); file = tmpDir.newFile(fileName + ".PNG"); file.deleteOnExit(); when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))) .thenReturn("http://fedora/test/original_file"); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("image/png"); try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write("fake image"); } extensionlessPath = file.getAbsolutePath().split("\\.")[0]; when(message.getHeader(eq(CdrBinaryPath))) .thenReturn(extensionlessPath); when(message.getHeader(eq(CdrBinarySubPath))) .thenReturn(derivativeSubPath); extensionlessName = new File(extensionlessPath).getName(); when(result.getStdout()).thenReturn(new ByteArrayInputStream(extensionlessPath.getBytes())); when(message.getBody()).thenReturn(result); }

Target:
public void init() throws Exception { initMocks(this); TestHelper.setContentBase(FEDORA_BASE); finalDir = moveDir.getRoot(); processor = new AddDerivativeProcessor(fileExtension, finalDir.getAbsolutePath()); pathId = PIDs.get(RESC_ID).getId(); file = tmpDir.newFile(pathId + "." + fileExtension); String derivTmpPath = file.getAbsolutePath(); derivTmpPath = derivTmpPath.substring(0, derivTmpPath.length() - fileExtension.length() - 1); when(exchange.getIn()).thenReturn(message); when(message.getHeader(eq(FCREPO_URI))) .thenReturn(RESC_ID); when(message.getHeader(eq(CdrBinaryMimeType))) .thenReturn("image/png"); try (BufferedWriter writeFile = new BufferedWriter(new FileWriter(file))) { writeFile.write("fake image"); } when(result.getStdout()).thenReturn(new ByteArrayInputStream( derivTmpPath.getBytes() )); when(message.getBody()).thenReturn(result); }
Source:
public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { String fid = ""; try { if (!hasNext()) { throw new NoSuchElementException( "No more features in this reader, you should call " + "hasNext() to check for feature availability"); } SolrDocument doc = this.solrDocIterator.next(); fid = featureType.getTypeName() + "." + doc.getFieldValue(pkey.getName()); final int attributeCount = featureType.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { AttributeDescriptor type = featureType.getDescriptor(i); Object value = doc.getFieldValue(type.getLocalName()); if (value instanceof List<?>) { value = StringUtils.join(((List) value).toArray(), ";"); } if (type instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) type; if (value != null) { SolrSpatialStrategy spatialStrategy = SolrSpatialStrategy.createStrategy(gatt); Geometry geometry = spatialStrategy.decode(value.toString()); if (geometry != null && geometry.getUserData() == null) { geometry.setUserData(gatt.getCoordinateReferenceSystem()); } builder.add(geometry); } } else { builder.add(value); } } return builder.buildFeature(fid); } catch (ParseException e) { throw new RuntimeException(e); } finally { if (this.solrDataStore.getLogger().isLoggable(Level.FINE)) { this.solrDataStore.getLogger().log(Level.FINE, "Created " + fid); } next = null; counter++; } }

Target:
public SimpleFeature next() throws IOException, IllegalArgumentException, NoSuchElementException { String fid = ""; try { if (!hasNext()) { throw new NoSuchElementException( "No more features in this reader, you should call " + "hasNext() to check for feature availability"); } SolrDocument doc = this.solrDocIterator.next(); fid = featureType.getTypeName() + "." + doc.getFieldValue(pkey.getName()); final int attributeCount = featureType.getAttributeCount(); for (int i = 0; i < attributeCount; i++) { AttributeDescriptor type = featureType.getDescriptor(i); Object value = doc.getFieldValue(type.getLocalName()); if (value instanceof List<?>) { value = StringUtils.join(((List) value).toArray(), ";"); } if (type instanceof GeometryDescriptor) { GeometryDescriptor gatt = (GeometryDescriptor) type; if (value != null) { SolrSpatialStrategy spatialStrategy = geometryReaders.get(gatt.getName()); if (spatialStrategy == null) { spatialStrategy = SolrSpatialStrategy.DEFAULT; } Geometry geometry = spatialStrategy.decode(value.toString()); if (geometry != null && geometry.getUserData() == null) { geometry.setUserData(gatt.getCoordinateReferenceSystem()); } builder.add(geometry); } } else { builder.add(value); } } return builder.buildFeature(fid); } catch (ParseException e) { throw new RuntimeException(e); } finally { if (this.solrDataStore.getLogger().isLoggable(Level.FINE)) { this.solrDataStore.getLogger().log(Level.FINE, "Created " + fid); } next = null; counter++; } }
Source:
private void _nextCustomizationEntry() throws Exception { try { if (_customizationShouldAbort) { _parser.cliAbort(); } else { _customizationDialog[_customizationIndex++].call(); } } catch (SoftError e) { log.errorFormat( "Soft error during host {0} customization dialog", _vds.gethost_name(), e ); _failException = e; _customizationShouldAbort = true; } }

Target:
private void _nextCustomizationEntry() throws Exception { try { if (_customizationShouldAbort) { _parser.cliAbort(); } else { _customizationDialog[_customizationIndex++].call(); } } catch (ArrayIndexOutOfBoundsException e) { throw new RuntimeException("Protocol violation", e); } catch (SoftError e) { log.errorFormat( "Soft error during host {0} customization dialog", _vds.gethost_name(), e ); _failException = e; _customizationShouldAbort = true; } }
Source:
public static Map<String, IAnalysisModuleHelper> getAnalysisModules() { synchronized (fAnalysisModules) { if (fAnalysisModules.isEmpty()) { for (IAnalysisModuleSource source : fSources) { for (IAnalysisModuleHelper helper : source.getAnalysisModules()) { fAnalysisModules.put(helper.getId(), helper); } } } } return Collections.unmodifiableMap(fAnalysisModules); }

Target:
public static synchronized Map<String, IAnalysisModuleHelper> getAnalysisModules() { if (fAnalysisModules.isEmpty()) { for (IAnalysisModuleSource source : fSources) { for (IAnalysisModuleHelper helper : source.getAnalysisModules()) { fAnalysisModules.put(helper.getId(), helper); } } } return Collections.unmodifiableMap(fAnalysisModules); }
Source:
public CompletableFuture<Void> put(K key, V value) { assertRemoteCacheManagerIsStarted(); if (trace) { log.tracef("About to add (K,V): (%s, %s) lifespan:%d, maxIdle:%d", key, value, defaultLifespan, defaultMaxIdleTime); } K compatKey = hasCompatibility() ? key : null; byte[] marshallKey = MarshallerUtil.obj2bytes(marshaller, key, true, estimateKeySize, estimateValueSize); byte[] marshallValue = MarshallerUtil.obj2bytes(marshaller, value, false, estimateKeySize, estimateValueSize); PutKeyValueMultimapOperation<Void> op = operationsFactory.newPutKeyValueOperation(compatKey, marshallKey, marshallValue, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS); return CompletableFuture.runAsync(() -> op.execute()); }

Target:
public CompletableFuture<Void> put(K key, V value) { if (trace) { log.tracef("About to add (K,V): (%s, %s) lifespan:%d, maxIdle:%d", key, value, defaultLifespan, defaultMaxIdleTime); } assertRemoteCacheManagerIsStarted(); K compatKey = hasCompatibility() ? key : null; byte[] marshallKey = MarshallerUtil.obj2bytes(marshaller, key, true, estimateKeySize, estimateValueSize); byte[] marshallValue = MarshallerUtil.obj2bytes(marshaller, value, false, estimateKeySize, estimateValueSize); PutKeyValueMultimapOperation<Void> op = operationsFactory.newPutKeyValueOperation(compatKey, marshallKey, marshallValue, defaultLifespan, MILLISECONDS, defaultMaxIdleTime, MILLISECONDS); return CompletableFuture.runAsync(() -> op.execute()); }
Source:
public void testOtherAnnotation() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, Opcodes.ACC_SYNTHETIC, "name", "()V", null, null); m.visitInsn(Opcodes.RETURN); AnnotationNode a = new AnnotationNode("Lother/Annotation;"); m.invisibleAnnotations = Arrays.asList(a); filter.filter(m, this); assertNull(fromInclusive); assertNull(toInclusive); }

Target:
public void testOtherAnnotation() { final MethodNode m = new MethodNode(InstrSupport.ASM_API_VERSION, 0, "hashCode", "()I", null, null); m.visitAnnotation("Lother/Annotation;", false); m.visitInsn(Opcodes.ICONST_0); m.visitInsn(Opcodes.IRETURN); filter.filter(m, this); assertNull(fromInclusive); assertNull(toInclusive); }
Source:
protected void openInformationDialogOnUiDesigner() { final String displayDialog = getPreferenceStore().getString(HIDE_UIDESIGNER_INFO_DIALOG); if (!"true".equals(displayDialog)) { MessageDialogWithPrompt .open( MessageDialog.INFORMATION, getShell(), Messages.openUiDesignerInformationWindowTitle, Messages.openUiDesignerInformationMessage, Messages.openUiDesignerInformationToggleMessage, false, getPreferenceStore(), HIDE_UIDESIGNER_INFO_DIALOG, SWT.NONE); } }

Target:
protected void openInformationDialogOnUiDesigner() { if (!getEclipsePreferences().getBoolean(HIDE_UIDESIGNER_INFO_DIALOG, false)) { MessageDialogWithPrompt .open( MessageDialog.INFORMATION, getShell(), Messages.openUiDesignerInformationWindowTitle, Messages.openUiDesignerInformationMessage, Messages.openUiDesignerInformationToggleMessage, false, getPreferenceStore(), HIDE_UIDESIGNER_INFO_DIALOG, SWT.NONE); } }
Source:
public ShaderEffectsDrawable(Bitmap bitmap) { this.bitmap = bitmap; bitmapPaint = new Paint(); bitmapPaint.setAntiAlias(true); int radius = bitmap.getWidth() / 2; RadialGradient vignette = new RadialGradient(radius, radius, radius, new int[] {0, 0, 0x7f000000}, new float[] {0.0f, 0.8f, 1.0f}, Shader.TileMode.CLAMP); Matrix oval = new Matrix(); oval.setScale(1.0f, 0.8f); vignette.setLocalMatrix(oval); bitmapPaint.setShader(new ComposeShader(new BitmapShader(this.bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP), vignette, PorterDuff.Mode.SRC_OVER)); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0.1f); m2.setScale(1f, 0.95f, 0.82f, 1.0f); m1.setConcat(m2, m1); bitmapPaint.setColorFilter(new ColorMatrixColorFilter(m1)); }

Target:
public ShaderEffectsDrawable(Bitmap bitmap) { this.bitmap = bitmap; if (bitmap == null) { throw new NullPointerException("Bitmap cannot be null."); } bitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG); int radius = bitmap.getWidth() / 2; RadialGradient vignette = new RadialGradient(radius, radius, radius, new int[]{0, 0, 0x7f000000}, new float[]{0.0f, 0.8f, 1.0f}, Shader.TileMode.CLAMP); Matrix oval = new Matrix(); oval.setScale(1.0f, 0.8f); vignette.setLocalMatrix(oval); bitmapPaint.setShader(new ComposeShader(new BitmapShader(this.bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP), vignette, PorterDuff.Mode.SRC_OVER)); ColorMatrix m1 = new ColorMatrix(); ColorMatrix m2 = new ColorMatrix(); m1.setSaturation(0.1f); m2.setScale(1f, 0.95f, 0.82f, 1.0f); m1.setConcat(m2, m1); bitmapPaint.setColorFilter(new ColorMatrixColorFilter(m1)); }
Source:
protected @Nonnull String getSuccessfulDestination() { FolderComputation<I> computation = getComputation(); if (computation != null) { return computation.getSearchUrl() + "console"; } return super.getSuccessfulDestination(); }

Target:
protected @Nonnull String getSuccessfulDestination() { return computation.getSearchUrl() + "console"; }
Source:
public void passesArgumentsToApp() throws Exception { final String[] addArgs = {"works well!"}; new MainRemote(MainRemoteTest.DemoAppArgs.class, addArgs).exec( new MainRemote.Script() { @Override public void exec(final URI home) throws IOException { new JdkRequest(home) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.startsWith("works well")); } } ); }

Target:
public void passesArgumentsToApp() throws Exception { final String[] args = {"works well!"}; new MainRemote(MainRemoteTest.DemoAppArgs.class, args).exec( new MainRemote.Script() { @Override public void exec(final URI home) throws IOException { new JdkRequest(home) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody(Matchers.startsWith("works well")); } } ); }
Source:
private void runWindup(GraphContext context, File baseRuleDirectory, final List<Path> rulePaths, File input, File output) throws IOException { ProjectModel pm = context.getFramed().addVertex(null, ProjectModel.class); pm.setName("Project: " + input.getAbsolutePath()); FileModel inputPath = context.getFramed().addVertex(null, FileModel.class); inputPath.setFilePath(input.getCanonicalPath()); FileUtils.deleteDirectory(output); Files.createDirectories(output.toPath()); inputPath.setProjectModel(pm); pm.setRootFileModel(inputPath); WindupConfiguration windupConfiguration = new WindupConfiguration() .setGraphContext(context); windupConfiguration.setInputPath(Paths.get(inputPath.getFilePath())); windupConfiguration.setOutputDirectory(output.toPath()); windupConfiguration.addDefaultUserRulesDirectory(baseRuleDirectory.toPath()); final String baseRulesPathNormalized = baseRuleDirectory.toPath().normalize().toAbsolutePath().toString(); System.out.println("baseRulesPathNormalized AAA " + baseRulesPathNormalized); windupConfiguration.setRuleProviderFilter(new Predicate<RuleProvider>() { @Override public boolean accept(RuleProvider type) { if (type.getMetadata().getOrigin() == null) return true; if (!type.getMetadata().getOrigin().contains(baseRulesPathNormalized)) return true; for (Path acceptedRulePath : rulePaths) { if (type.getMetadata().getOrigin().contains(acceptedRulePath.toString())) return true; } return false; } }); processor.execute(windupConfiguration); }

Target:
private void runWindup(GraphContext context, File baseRuleDirectory, final List<Path> rulePaths, File input, File output) throws IOException { ProjectModel pm = context.getFramed().addVertex(null, ProjectModel.class); pm.setName("Project: " + input.getAbsolutePath()); FileModel inputPath = context.getFramed().addVertex(null, FileModel.class); inputPath.setFilePath(input.getCanonicalPath()); FileUtils.deleteDirectory(output); Files.createDirectories(output.toPath()); inputPath.setProjectModel(pm); pm.setRootFileModel(inputPath); WindupConfiguration windupConfiguration = new WindupConfiguration() .setGraphContext(context); windupConfiguration.setInputPath(Paths.get(inputPath.getFilePath())); windupConfiguration.setOutputDirectory(output.toPath()); windupConfiguration.addDefaultUserRulesDirectory(baseRuleDirectory.toPath()); final String baseRulesPathNormalized = baseRuleDirectory.toPath().normalize().toAbsolutePath().toString(); LOG.info("Base path for rules is: " + baseRulesPathNormalized); windupConfiguration.setRuleProviderFilter(new Predicate<RuleProvider>() { @Override public boolean accept(RuleProvider type) { if (type.getMetadata().getOrigin() == null) return true; if (!type.getMetadata().getOrigin().contains(baseRulesPathNormalized)) return true; for (Path acceptedRulePath : rulePaths) { if (type.getMetadata().getOrigin().contains(acceptedRulePath.toString())) return true; } return false; } }); processor.execute(windupConfiguration); }
Source:
public void theObjectlistShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetAssociationLnObjectsAsyncRequest asyncRequest = AssociationLnObjectsRequestFactory .fromScenarioContext(); final GetAssociationLnObjectsResponse response = this.responseClient.getResponse(asyncRequest); assertEquals("Response should be OK", OsgpResultType.OK, response.getResult()); assertNotNull("Response should contain an AssociationLnList", response.getAssociationLnList()); assertNotNull("AssociationLnList shoudl have at least one entry", response.getAssociationLnList().getAssociationLnListElement().get(0)); final AssociationLnListElement element = response.getAssociationLnList().getAssociationLnListElement().get(0); assertNotNull("AccessRights should be present", element.getAccessRights()); assertNotNull("ClassId should be present", element.getClassId()); assertNotNull("LogicalName should be present", element.getLogicalName()); assertNotNull("Version should be present", element.getVersion()); }

Target:
public void theObjectlistShouldBeReturned(final Map<String, String> settings) throws Throwable { final GetAssociationLnObjectsAsyncRequest asyncRequest = AssociationLnObjectsRequestFactory .fromScenarioContext(); final GetAssociationLnObjectsResponse response = this.responseClient.getResponse(asyncRequest); assertEquals("Response should be OK", OsgpResultType.OK, response.getResult()); assertNotNull("Response should contain an AssociationLnList", response.getAssociationLnList()); assertNotNull("AssociationLnList shoudl have at least one entry", response.getAssociationLnList().getAssociationLnListElement().get(0)); final AssociationLnListElement element = response.getAssociationLnList().getAssociationLnListElement().get(0); assertNotNull("AccessRights should be present", element.getAccessRights()); assertNotNull("ClassId should be present", element.getClassId()); assertNotNull("LogicalName should be present", element.getLogicalName()); assertNotNull("Version should be present", element.getVersion()); assertNotNull("AttributeId should be present", element.getAccessRights().getAttributeAccess().getAttributeAccessItem().get(0).getAttributeId()); }
Source:
public void optionalActivePublisherTest(long elements, PublisherTestRun<T> body) throws Throwable { if (elements > maxElementsFromPublisher()) { throw new SkipException(String.format("Unable to run this test, as required elements nr: %d is higher than supported by given producer: %d", elements, maxElementsFromPublisher())); } final Publisher<T> pub = createPublisher(elements); final String skipMessage = "Skipped because tested publisher does NOT implement this OPTIONAL requirement."; try { potentiallyPendingTest(pub, body); } catch (Exception ex) { notVerified(skipMessage); } catch (AssertionError ex) { notVerified(skipMessage + " Reason for skipping was: " + ex.getMessage()); } }

Target:
public void optionalActivePublisherTest(long elements, PublisherTestRun<T> body) throws Throwable { if (elements > maxElementsFromPublisher()) { throw new SkipException( String.format("Unable to run this test, as required elements nr: %d is higher than supported by given producer: %d", elements, maxElementsFromPublisher())); } final Publisher<T> pub = createPublisher(elements); final String skipMessage = "Skipped because tested publisher does NOT implement this OPTIONAL requirement."; try { potentiallyPendingTest(pub, body); } catch (Exception ex) { notVerified(skipMessage); } catch (AssertionError ex) { notVerified(String.format("%s Reason for skipping was: %s", skipMessage, ex.getMessage())); } }
Source:
protected static void printUsage(@Nonnull PrintStream printStream) { CmdLineParser parser = new CmdLineParser(new Options()); printStream.append("Usage: java -jar jack.jar <options> <source files>\n" + "\n" + "Options:\n"); parser.printUsage(printStream); printStream.append("\n" + "@FILE : read command line from file\n"); }

Target:
protected static void printUsage(@Nonnull PrintStream printStream) { CmdLineParser parser = new CmdLineParser(new Options()); printStream.println("Usage: java -jar jack.jar <options> <source files>"); printStream.println(); printStream.println("Options:"); parser.printUsage(printStream); printStream.println(); printStream.println(" @FILE : read command line from file"); }
Source:
public boolean shutdown(long timeout, TimeUnit timeUnit) { log.info("Shutdown WorkManager in " + timeUnit.toMillis(timeout) + " ms"); shutdownInProgress = true; try { boolean ret = streamProcessor.stop(Duration.ofMillis(timeUnit.toMillis(timeout))); long shutDowndelay = Long.parseLong(Framework.getService(ConfigurationService.class) .getProperty(SHUTDOWN_DELAY_MS_KEY, "0")); if (shutDowndelay > 0) { try { Thread.sleep(shutDowndelay); } catch (InterruptedException e) { log.error("Not able to wait for works to stop gracefully."); } } if (!ret) { log.error("Not able to stop worker pool within the timeout."); } return ret; } finally { shutdownInProgress = false; } }

Target:
public boolean shutdown(long timeout, TimeUnit timeUnit) { log.info("Shutdown WorkManager in " + timeUnit.toMillis(timeout) + " ms"); shutdownInProgress = true; try { long shutdownDelay = Long.parseLong(Framework.getService(ConfigurationService.class) .getProperty(SHUTDOWN_DELAY_MS_KEY, "0")); boolean ret = streamProcessor.stop(Duration.ofMillis(Math.max(timeUnit.toMillis(timeout), shutdownDelay))); if (!ret) { log.error("Not able to stop worker pool within the timeout."); } return ret; } finally { shutdownInProgress = false; } }
Source:
List<AttributeStatement> createAttributeStatement(final List<Attribute> attributes) { final List<AttributeStatement> attributeStatements = new ArrayList<>(); if (!attributes.isEmpty()) { final AttributeStatement attributeStatement = attributeStatementBuilder.buildObject(); for (final Attribute attribute : attributes) { attributeStatement.getAttributes().add(attribute); } attributeStatements.add(attributeStatement); } return attributeStatements; }

Target:
List<AttributeStatement> createAttributeStatement(final List<Attribute> attributes) { final List<AttributeStatement> attributeStatements = new ArrayList<>(); if (CollectionUtils.isNotEmpty(attributes)) { final AttributeStatement attributeStatement = attributeStatementBuilder.buildObject(); for (final Attribute attribute : attributes) { attributeStatement.getAttributes().add(attribute); } attributeStatements.add(attributeStatement); } return attributeStatements; }
Source:
boolean isFlaggedAsZipBomb() { return flaggedAsZipBomb; }

Target:
synchronized boolean isFlaggedAsZipBomb() { return flaggedAsZipBomb; }
Source:
public void testGetKeysForContainer() throws Exception { Response response = containerKeyService.getKeysForContainer(1L); Collection<KeyMetadata> keyMetadataList = (Collection<KeyMetadata>) response.getEntity(); assertTrue(keyMetadataList.size() == 2); Iterator<KeyMetadata> iterator = keyMetadataList.iterator(); KeyMetadata keyMetadata = iterator.next(); assertTrue(keyMetadata.getKey().equals("key_one")); assertTrue(keyMetadata.getVersions().size() == 1); assertTrue(keyMetadata.getBlockIds().size() == 1); Map<Long, List<KeyMetadata.ContainerBlockMetadata>> blockIds = keyMetadata.getBlockIds(); assertTrue(blockIds.get(0L).iterator().next().getLocalID() == 101); keyMetadata = iterator.next(); assertTrue(keyMetadata.getKey().equals("key_two")); assertTrue(keyMetadata.getVersions().size() == 2); assertTrue(keyMetadata.getVersions().contains(0L) && keyMetadata .getVersions().contains(1L)); assertTrue(keyMetadata.getBlockIds().size() == 2); blockIds = keyMetadata.getBlockIds(); assertTrue(blockIds.get(0L).iterator().next().getLocalID() == 103); assertTrue(blockIds.get(1L).iterator().next().getLocalID() == 104); response = containerKeyService.getKeysForContainer(3L); keyMetadataList = (Collection<KeyMetadata>) response.getEntity(); assertTrue(keyMetadataList.isEmpty()); }

Target:
public void testGetKeysForContainer() { Response response = containerKeyService.getKeysForContainer(1L); Collection<KeyMetadata> keyMetadataList = (Collection<KeyMetadata>) response.getEntity(); assertTrue(keyMetadataList.size() == 2); Iterator<KeyMetadata> iterator = keyMetadataList.iterator(); KeyMetadata keyMetadata = iterator.next(); assertTrue(keyMetadata.getKey().equals("key_one")); assertTrue(keyMetadata.getVersions().size() == 1); assertTrue(keyMetadata.getBlockIds().size() == 1); Map<Long, List<KeyMetadata.ContainerBlockMetadata>> blockIds = keyMetadata.getBlockIds(); assertTrue(blockIds.get(0L).iterator().next().getLocalID() == 101); keyMetadata = iterator.next(); assertTrue(keyMetadata.getKey().equals("key_two")); assertTrue(keyMetadata.getVersions().size() == 2); assertTrue(keyMetadata.getVersions().contains(0L) && keyMetadata .getVersions().contains(1L)); assertTrue(keyMetadata.getBlockIds().size() == 2); blockIds = keyMetadata.getBlockIds(); assertTrue(blockIds.get(0L).iterator().next().getLocalID() == 103); assertTrue(blockIds.get(1L).iterator().next().getLocalID() == 104); response = containerKeyService.getKeysForContainer(3L); keyMetadataList = (Collection<KeyMetadata>) response.getEntity(); assertTrue(keyMetadataList.isEmpty()); }
Source:
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockRayTraceResult hit) { FluidUtil.interactWithFluidHandler(playerIn, hand, worldIn, pos, hit.getFace()); ItemStack stack = playerIn.getHeldItem(hand); if (!stack.isEmpty() && FluidLib.getFluidItemCap(stack).isPresent()) { BloodContainerTileEntity bloodContainer = (BloodContainerTileEntity) worldIn.getTileEntity(pos); IFluidHandler source = bloodContainer.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).orElseThrow(() -> new IllegalStateException("Cannot get IFluidHandler from bloodContainer")); if (playerIn.isSneaking()) { FluidActionResult result = FluidUtil.tryFillContainer(stack, source, Integer.MAX_VALUE, playerIn, true); if (result.isSuccess()) { playerIn.setHeldItem(hand, result.getResult()); } } else { FluidActionResult result = tryEmptyContainer(stack, source, Integer.MAX_VALUE, playerIn, true); if (result.isSuccess()) { playerIn.setHeldItem(hand, result.getResult()); } } return true; } return true; }

Target:
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, BlockRayTraceResult hit) { if (!FluidUtil.interactWithFluidHandler(playerIn, hand, worldIn, pos, hit.getFace()) && playerIn.getHeldItem(hand).getItem().equals(Items.GLASS_BOTTLE) && VampirismConfig.SERVER.autoConvertGlassBottles.get()) { FluidUtil.getFluidHandler(worldIn, pos, hit.getFace()).ifPresent((fluidHandler -> { if (fluidHandler.getFluidInTank(0).getFluid().equals(ModFluids.blood)) { ItemStack glass = playerIn.getHeldItem(hand); ItemStack bloodBottle = new ItemStack(ModItems.blood_bottle, 1); playerIn.setHeldItem(hand, bloodBottle); bloodBottle = FluidUtil.tryFillContainer(bloodBottle, fluidHandler, Integer.MAX_VALUE, playerIn, true).getResult(); if (glass.getCount() > 1) { glass.shrink(1); playerIn.setHeldItem(hand, glass); playerIn.addItemStackToInventory(bloodBottle); } else { playerIn.setHeldItem(hand, bloodBottle); } } })); } return true; }
Source:
public void canFetchRelease() throws Exception { final Repo repo = RtReleasesITCase.repo(); try { final Releases releases = repo.releases(); final String tag = "v1.0"; final Release release = releases.create(tag); MatcherAssert.assertThat( releases.get(release.number()).number(), Matchers.equalTo(release.number()) ); MatcherAssert.assertThat( releases.get(release.number()).json().getString("tag_name"), Matchers.equalTo(tag) ); releases.remove(release.number()); } finally { RtReleasesITCase.remove(repo); } }

Target:
public void canFetchRelease() throws Exception { final Repo repo = RtReleasesITCase.repo(); try { final Releases releases = repo.releases(); final String tag = "v1.0"; final Release release = releases.create(tag); MatcherAssert.assertThat( releases.get(release.number()).number(), Matchers.equalTo(release.number()) ); MatcherAssert.assertThat( new Release.Smart(releases.get(release.number())).tag(), Matchers.equalTo(tag) ); releases.remove(release.number()); } finally { RtReleasesITCase.remove(repo); } }
Source:
public void shouldExecuteTransactions() { try ( final MongoDBContainer mongoDBContainer = new MongoDBContainer(MONGO_IMAGE) ) { mongoDBContainer.start(); final String mongoRsUrl = mongoDBContainer.getReplicaSetUrl(); assertNotNull(mongoRsUrl); final MongoClient mongoSyncClient = MongoClients.create(mongoRsUrl); mongoSyncClient.getDatabase("mydb1").getCollection("foo") .withWriteConcern(WriteConcern.MAJORITY).insertOne(new Document("abc", 0)); mongoSyncClient.getDatabase("mydb2").getCollection("bar") .withWriteConcern(WriteConcern.MAJORITY).insertOne(new Document("xyz", 0)); final ClientSession clientSession = mongoSyncClient.startSession(); final TransactionOptions txnOptions = TransactionOptions.builder() .readPreference(ReadPreference.primary()) .readConcern(ReadConcern.LOCAL) .writeConcern(WriteConcern.MAJORITY) .build(); final String trxResult = "Inserted into collections in different databases"; TransactionBody<String> txnBody = () -> { final MongoCollection<Document> coll1 = mongoSyncClient.getDatabase("mydb1").getCollection("foo"); final MongoCollection<Document> coll2 = mongoSyncClient.getDatabase("mydb2").getCollection("bar"); coll1.insertOne(clientSession, new Document("abc", 1)); coll2.insertOne(clientSession, new Document("xyz", 999)); return trxResult; }; try { final String trxResultActual = clientSession.withTransaction(txnBody, txnOptions); assertEquals(trxResult, trxResultActual); } catch (RuntimeException re) { throw new IllegalStateException(re.getMessage(), re); } finally { clientSession.close(); mongoSyncClient.close(); } } }

Target:
public void shouldExecuteTransactions() { try ( final MongoDBContainer mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:4.0.10")) ) { mongoDBContainer.start(); final String mongoRsUrl = mongoDBContainer.getReplicaSetUrl(); assertNotNull(mongoRsUrl); final MongoClient mongoSyncClient = MongoClients.create(mongoRsUrl); mongoSyncClient.getDatabase("mydb1").getCollection("foo") .withWriteConcern(WriteConcern.MAJORITY).insertOne(new Document("abc", 0)); mongoSyncClient.getDatabase("mydb2").getCollection("bar") .withWriteConcern(WriteConcern.MAJORITY).insertOne(new Document("xyz", 0)); final ClientSession clientSession = mongoSyncClient.startSession(); final TransactionOptions txnOptions = TransactionOptions.builder() .readPreference(ReadPreference.primary()) .readConcern(ReadConcern.LOCAL) .writeConcern(WriteConcern.MAJORITY) .build(); final String trxResult = "Inserted into collections in different databases"; TransactionBody<String> txnBody = () -> { final MongoCollection<Document> coll1 = mongoSyncClient.getDatabase("mydb1").getCollection("foo"); final MongoCollection<Document> coll2 = mongoSyncClient.getDatabase("mydb2").getCollection("bar"); coll1.insertOne(clientSession, new Document("abc", 1)); coll2.insertOne(clientSession, new Document("xyz", 999)); return trxResult; }; try { final String trxResultActual = clientSession.withTransaction(txnBody, txnOptions); assertEquals(trxResult, trxResultActual); } catch (RuntimeException re) { throw new IllegalStateException(re.getMessage(), re); } finally { clientSession.close(); mongoSyncClient.close(); } } }
Source:
public void cancel() { stmts.forEach(stmt -> { try { if (stmt != null && !stmt.isClosed()) { stmt.cancel(); } } catch (SQLException e) { throw new IllegalStateException(e); } }); }

Target:
public void cancel() { stmts.forEach(stmt -> cancelSoftly(stmt)); }
Source:
public static void main(String[] args) throws Exception { File persistenceFile = new File("/Users/akrai/persistence-local.yml"); if (!persistenceFile.exists()) { System.err.println("Missing file:" + persistenceFile); System.exit(1); } RunAdhocDatabaseQueriesTool dq = new RunAdhocDatabaseQueriesTool(persistenceFile); dq.disableAllActiveDetections(Collections.singleton(160640739L)); LOG.info("DONE"); }

Target:
public static void main(String[] args) throws Exception { File persistenceFile = new File("/path/to/persistence.yml"); if (!persistenceFile.exists()) { System.err.println("Missing file:" + persistenceFile); System.exit(1); } RunAdhocDatabaseQueriesTool dq = new RunAdhocDatabaseQueriesTool(persistenceFile); dq.disableAllActiveDetections(Collections.singleton(160640739L)); LOG.info("DONE"); }
Source:
private String getInvalidTypeNameFromTypeArgument(DetailAST typeArgumentToken) { if (typeArgumentToken == null) { return null; } final DetailAST identToken = typeArgumentToken.findFirstToken(TokenTypes.IDENT); if (identToken != null) { final String typeName = identToken.getText(); if (classPathMap.containsKey(typeName) && !isValidLibrary(classPathMap.get(typeName))) { return typeName; } } return null; }

Target:
private String getInvalidTypeNameFromTypeArgument(DetailAST typeArgumentToken) { final DetailAST identToken = typeArgumentToken.findFirstToken(TokenTypes.IDENT); if (identToken == null) { return null; } final String typeName = identToken.getText(); return isValidClassDependency(typeName) ? null : typeName; }
Source:
public List<String> getResourceCrnListByResourceNameList(List<String> resourceNames) { return repository.findByNameIn(resourceNames).stream() .map(dbServer -> dbServer.getResourceCrn().toString()).collect(Collectors.toList()); }

Target:
public List<String> getResourceCrnListByResourceNameList(List<String> resourceNames) { return repository.findResourceCrnsByNames(resourceNames) .stream().map(Crn::toString).collect(Collectors.toList()); }
Source:
public static boolean validateURL(String targetURL) { return targetURL.contains("http"); }

Target:
public static boolean validateURL(String targetURL) { return StringUtils.isNotBlank(targetURL) && targetURL.contains("http"); }
Source:
protected void init(Repository repository, String gitDir) { Charset outputEncoding = UTF_8; if (repository != null) { String encoding = repository.getConfig().getString("i18n", null, "logOutputEncoding"); if (encoding != null) { try { outputEncoding = Charset.forName(encoding); } catch (IllegalArgumentException e) { throw die(CLIText.get().cannotCreateOutputStream); } } } if (ins == null) ins = new FileInputStream(FileDescriptor.in); if (outs == null) outs = new FileOutputStream(FileDescriptor.out); if (errs == null) errs = new FileOutputStream(FileDescriptor.err); outw = new ThrowingPrintWriter(new BufferedWriter( new OutputStreamWriter(outs, outputEncoding))); errw = new ThrowingPrintWriter(new BufferedWriter( new OutputStreamWriter(errs, outputEncoding))); if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }

Target:
protected void init(Repository repository, String gitDir) { Charset charset = UTF_8; if (repository != null) { String logOutputEncoding = repository.getConfig().getString("i18n", null, "logOutputEncoding"); if (logOutputEncoding != null) { try { charset = Charset.forName(logOutputEncoding); } catch (IllegalArgumentException e) { throw die(CLIText.get().cannotCreateOutputStream); } } } if (ins == null) ins = new FileInputStream(FileDescriptor.in); if (outs == null) outs = new FileOutputStream(FileDescriptor.out); if (errs == null) errs = new FileOutputStream(FileDescriptor.err); outw = new ThrowingPrintWriter(new BufferedWriter( new OutputStreamWriter(outs, charset))); errw = new ThrowingPrintWriter(new BufferedWriter( new OutputStreamWriter(errs, charset))); if (repository != null && repository.getDirectory() != null) { db = repository; gitdir = repository.getDirectory().getAbsolutePath(); } else { db = repository; gitdir = gitDir; } }
Source:
private View getPortView(Port port) { View portView = null; Iterator<?> iterator = hostView.getChildren().iterator(); while (iterator.hasNext() && null == portView) { Object child = iterator.next(); if ((child instanceof Node) && ((Node) child).getElement().equals(port)) { portView = (Node) child; } } return portView; }

Target:
private View getPortView(Port port) { View portView = null; Iterator<?> iterator = hostView.getChildren().iterator(); while (null == portView && iterator.hasNext()) { Object child = iterator.next(); if ((child instanceof Node) && ((Node) child).getElement().equals(port)) { portView = (Node) child; } } return portView; }
Source:
private List<Sample> adjustTimeSeries (final List<Sample> samples, final String sensor, final String senseId) { if (sensor.toUpperCase().equals(Sensor.PARTICULATES.name()) && this.hasDustSmoothEnabled(senseId)) { return SmoothSample.convert(samples); } return samples; }

Target:
private List<Sample> adjustTimeSeries (final List<Sample> samples, final String sensor, final String senseId) { if (Sensor.PARTICULATES.name().equalsIgnoreCase(sensor) && this.hasDustSmoothEnabled(senseId)) { return SmoothSample.convert(samples); } return samples; }
Source:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); context.record( TransformLineageRecorderUtils.oneToOneIn(new ArrayList<>(decryptFields), "decrypt", "Decrypt the requested fields.")); }

Target:
public void prepareRun(StageSubmitterContext context) throws Exception { super.prepareRun(context); decryptFields = conf.getDecryptFields(); if (context.getInputSchema() == null || context.getInputSchema().getFields() == null) { return; } List<String> decryptedFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()).stream() .filter(decryptFields::contains) .collect(Collectors.toList()); List<String> identityFields = TransformLineageRecorderUtils.getFields(context.getInputSchema()); identityFields.removeAll(decryptedFields); List<FieldOperation> output = new ArrayList<>(); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(decryptedFields, "decrypt", "Decrypted the requested fields.")); output.addAll(TransformLineageRecorderUtils.generateOneToOnes(identityFields, "identity", TransformLineageRecorderUtils.IDENTITY_TRANSFORM_DESCRIPTION)); context.record(output); }
Source:
public long deleteHorizonMs() { if (isDeleteHorizonSet()) { return firstTimestamp(); } return RecordBatch.NO_TIMESTAMP; }

Target:
public long deleteHorizonMs() { if (deleteHorizonSet()) return firstTimestamp(); return RecordBatch.NO_TIMESTAMP; }
Source:
void onServerClose(final String reason) { executor.executeIncoming(new Runnable() { @Override public String toString() { return "Server Closed EOF. " + MockedClientConnection.this; } @Override public void run() { MockedClientConnection.this.close(reason, new TargetDisconnectedException("Mocked Remote socket closed")); } }); executor.shutdownOutgoing(); System.out.println("<<<< <<<<"); }

Target:
void onServerClose(final String reason) { executor.executeIncoming(new Runnable() { @Override public String toString() { return "Server Closed EOF. " + MockedClientConnection.this; } @Override public void run() { MockedClientConnection.this.close(reason, new TargetDisconnectedException("Mocked Remote socket closed")); } }); executor.shutdownOutgoing(); }
Source:
private void loadPerspectiveAndCheckLoadingTime(String perspectiveID, boolean headerIncluded) { String standalonePerspectiveURL = getStandalonePerspectiveURL(perspectiveID, headerIncluded); driver.get(standalonePerspectiveURL); BusyPopup.waitForDisappearance(); ApplicationLoadingPopup.waitForDisappearance(PERSPECTIVE_LOADING_TIMEOUT); }

Target:
private void loadPerspectiveAndCheckLoadingTime(String perspectiveID, boolean headerIncluded) { String standalonePerspectiveURL = getStandalonePerspectiveURL(perspectiveID, headerIncluded); driver.get(standalonePerspectiveURL); ApplicationLoadingPopup.waitForDisappearance(PERSPECTIVE_LOADING_TIMEOUT); BusyPopup.waitForDisappearance(); }
Source:
private void statusToAll(String status, String text) { JSONObject controlMessage = new JSONObject(); JSONObject controlBody = new JSONObject(); controlBody.put("status", status); controlBody.put("text", text); controlMessage.put("control", controlBody); trace.log(TraceLevel.INFO,"statusToAll() : " + controlMessage.toString()); sendToAll(controlMessage.toString()); }

Target:
private void statusToAll(String status, String text) { JSONObject controlMessage = new JSONObject(); JSONObject controlBody = new JSONObject(); controlBody.put("status", status); controlBody.put("value", text); controlMessage.put("control", controlBody); sendToAll(controlMessage); }
Source:
public void testDefaultLogEvent() { String logmsg = "simple log message"; this.loggerLogback.info(logmsg); verify(this.mockAppender).doAppend(this.captorLoggingEvent.capture()); final LoggingEvent loggingEvent = this.captorLoggingEvent.getValue(); assertThat(loggingEvent.getLevel()).isEqualTo(Level.INFO); String layoutMessage = this.encoder.getLayout().doLayout(loggingEvent); assertFalse("formatted log message must not be empty.", layoutMessage.isEmpty()); assertTrue("formatted log message must contain the original message.", layoutMessage.contains(logmsg)); }

Target:
public void testDefaultLogEvent() { String logmsg = "simple log message"; LOG.info(logmsg); final LoggingEvent loggingEvent = getLastLogEvent(); assertThat(loggingEvent.getLevel()).isEqualTo(Level.INFO); String layoutMessage = this.encoder.getLayout().doLayout(loggingEvent); assertThat(layoutMessage.isEmpty()).as("formatted log message is empty.").isFalse(); assertThat(layoutMessage.contains(logmsg)).as("formatted log message contains original message.").isTrue(); }
Source:
public EncryptedBlobClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString, "'connectionString' cannot be null."); Map<String, String> connectionStringPieces = Utility.parseConnectionString(connectionString); String accountName = connectionStringPieces.get(Constants.ConnectionStringConstants.ACCOUNT_NAME_NAME); String accountKey = connectionStringPieces.get(Constants.ConnectionStringConstants.ACCOUNT_KEY_NAME); if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { throw logger.logExceptionAsError( new IllegalArgumentException("'connectionString' must contain 'AccountName' and 'AccountKey'.")); } String endpointProtocol = connectionStringPieces.get(Constants.ConnectionStringConstants.DEFAULT_ENDPOINTS_PROTOCOL_NAME); String endpointSuffix = connectionStringPieces.get(Constants.ConnectionStringConstants.ENDPOINT_SUFFIX_NAME); if (!ImplUtils.isNullOrEmpty(endpointProtocol) && !ImplUtils.isNullOrEmpty(endpointSuffix)) { endpoint(String.format("%s://%s.blob.%s", endpointProtocol, accountName, endpointSuffix.replaceFirst("^\\.", ""))); } this.accountName = accountName; return credential(new StorageSharedKeyCredential(accountName, accountKey)); }

Target:
public EncryptedBlobClientBuilder connectionString(String connectionString) { StorageConnectionString storageConnectionString = StorageConnectionString.create(connectionString, logger); StorageEndpoint endpoint = storageConnectionString.getBlobEndpoint(); if (endpoint == null || endpoint.getPrimaryUri() == null) { throw logger .logExceptionAsError(new IllegalArgumentException( "connectionString missing required settings to derive blob service endpoint.")); } this.endpoint(endpoint.getPrimaryUri()); if (storageConnectionString.getAccountName() != null) { this.accountName = storageConnectionString.getAccountName(); } StorageAuthenticationSettings authSettings = storageConnectionString.getStorageAuthSettings(); if (authSettings.getType() == StorageAuthenticationSettings.Type.ACCOUNT_NAME_KEY) { this.credential(new StorageSharedKeyCredential(authSettings.getAccount().getName(), authSettings.getAccount().getAccessKey())); } else if (authSettings.getType() == StorageAuthenticationSettings.Type.SAS_TOKEN) { this.sasToken(authSettings.getSasToken()); } return this; }
Source:
private void createImageForVmMetaData() { VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, vmConfImageGroupId, MemoryUtils.METADATA_SIZE_IN_BYTES, VolumeType.Sparse, VolumeFormat.RAW, vmConfVolumeId, "")); if (!retVal.getSucceeded()) { throw new EngineException(EngineError.VolumeCreationError, "Failed to create image for vm configuration!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_VM_TASK_KEY); Guid guid = enclosingCommand.createTask( taskId, retVal.getCreationInfo(), enclosingCommand.getActionType()); enclosingCommand.getTaskIdList().add(guid); }

Target:
private void createImageForVmMetaData() { VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, vmConfImageGroupId, MemoryUtils.METADATA_SIZE_IN_BYTES, getVolumeTypeForDomain(), VolumeFormat.RAW, vmConfVolumeId, "")); if (!retVal.getSucceeded()) { throw new EngineException(EngineError.VolumeCreationError, "Failed to create image for vm configuration!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_VM_TASK_KEY); Guid guid = enclosingCommand.createTask( taskId, retVal.getCreationInfo(), enclosingCommand.getActionType()); enclosingCommand.getTaskIdList().add(guid); }
Source:
private void parseIndexing(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case INDEX: Index index = Index.valueOf(value); builder.indexing().index(index); break; case AUTO_CONFIG: builder.indexing().autoConfig(Boolean.valueOf(value)); break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } Properties indexingProperties = new Properties(); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case INDEXED_ENTITY: { if (reader.getAttributeCount() > 0) { throw ParseUtils.unexpectedAttribute(reader, 0); } String className = reader.getElementText(); Class<?> indexedEntity = Util.loadClass(className, holder.getClassLoader()); builder.indexing().addIndexedEntity(indexedEntity); break; } case PROPERTY: { parseProperty(reader, indexingProperties); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } builder.indexing().withProperties(indexingProperties); }

Target:
private void parseIndexing(final XMLExtendedStreamReader reader, final ConfigurationBuilderHolder holder) throws XMLStreamException { ConfigurationBuilder builder = holder.getCurrentConfigurationBuilder(); for (int i = 0; i < reader.getAttributeCount(); i++) { ParseUtils.requireNoNamespaceAttribute(reader, i); String value = replaceProperties(reader.getAttributeValue(i)); Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case INDEX: Index index = Index.valueOf(value); builder.indexing().index(index); break; case AUTO_CONFIG: builder.indexing().autoConfig(Boolean.valueOf(value)); break; default: throw ParseUtils.unexpectedAttribute(reader, i); } } Properties indexingProperties = new Properties(); while (reader.hasNext() && (reader.nextTag() != XMLStreamConstants.END_ELEMENT)) { Element element = Element.forName(reader.getLocalName()); switch (element) { case INDEXED_ENTITIES: { parseIndexedEntities(reader, holder, builder); break; } case PROPERTY: { parseProperty(reader, indexingProperties); break; } default: { throw ParseUtils.unexpectedElement(reader); } } } builder.indexing().withProperties(indexingProperties); }
Source:
public static boolean isWikimediaHost(String host) { if (host.length() > MAX_ADDRESS_LENGTH) return false; return ( Utilities.patternIsFound(URI_HOST_WIKIMEDIA_DOMAIN_PATTERN, host) || Utilities.patternIsFound(URI_HOST_OTHER_PROJECTS_PATTERN, host) || Utilities.patternIsFound(URI_HOST_PROJECT_DOMAIN_PATTERN, host) ); }

Target:
public static boolean isWikimediaHost(String host) { host = host.toLowerCase(); if (host.length() > MAX_ADDRESS_LENGTH) return false; return ( Utilities.patternIsFound(URI_HOST_WIKIMEDIA_DOMAIN_PATTERN, host) || Utilities.patternIsFound(URI_HOST_OTHER_PROJECTS_PATTERN, host) || Utilities.patternIsFound(URI_HOST_PROJECT_DOMAIN_PATTERN, host) ); }