auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void parsesHttpBody() throws IOException { final String body = "40 N Wolfe Rd, Sunnyvale, CA 94085"; final RqMultipart multi = new RqMultipart.Fake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), contentLengthHeader(body.getBytes().length), contentDispositionHeader( "form-data; name=\"t4\"" ) ), new RqWithHeaders( new RqFake("", "", ""), contentLengthHeader(0), contentDispositionHeader( "form-data; name=\"data\"; filename=\"a.bin\"" ) ) ); try { MatcherAssert.assertThat( new RqHeaders.Base( multi.part("t4").iterator().next() ).header(RqMultipartTest.DISPOSITION), Matchers.hasItem("form-data; name=\"t4\"") ); MatcherAssert.assertThat( new RqPrint( new RqHeaders.Base( multi.part("t4").iterator().next() ) ).printBody(), Matchers.allOf( Matchers.startsWith("40 N"), Matchers.endsWith("CA 94085") ) ); } finally { multi.body().close(); multi.part("t4").iterator().next().body().close(); } }

Target:
public void parsesHttpBody() throws IOException { final String body = "40 N Wolfe Rd, Sunnyvale, CA 94085"; final String part = "t4"; final RqMultipart multi = new RqMultipart.Fake( new RqFake(), new RqWithHeaders( new RqFake("", "", body), contentLengthHeader(body.getBytes().length), contentDispositionHeader( String.format("form-data; name=\"%s\"", part) ) ), new RqWithHeaders( new RqFake("", "", ""), contentLengthHeader(0), contentDispositionHeader( "form-data; name=\"data\"; filename=\"a.bin\"" ) ) ); try { MatcherAssert.assertThat( new RqHeaders.Base( multi.part(part).iterator().next() ).header(RqMultipartTest.DISPOSITION), Matchers.hasItem("form-data; name=\"t4\"") ); MatcherAssert.assertThat( new RqPrint( new RqHeaders.Base( multi.part(part).iterator().next() ) ).printBody(), Matchers.allOf( Matchers.startsWith("40 N"), Matchers.endsWith("CA 94085") ) ); } finally { multi.part(part).iterator().next().body().close(); } }
Source:
private void setAlternate(FileRepository from, FileRepository to) throws IOException { File alt = new File(from.getObjectDatabase().getDirectory(), Constants.INFO_ALTERNATES); alt.getParentFile().mkdirs(); File fromDir = from.getObjectDatabase().getDirectory(); File toDir = to.getObjectDatabase().getDirectory(); Path relative = fromDir.toPath().relativize(toDir.toPath()); write(alt, relative.toString() + "\n"); }

Target:
private void setAlternate(FileRepository from, FileRepository to) throws IOException { File alt = new File(from.getObjectDatabase().getDirectory(), INFO_ALTERNATES); alt.getParentFile().mkdirs(); File fromDir = from.getObjectDatabase().getDirectory(); File toDir = to.getObjectDatabase().getDirectory(); Path relative = fromDir.toPath().relativize(toDir.toPath()); write(alt, relative.toString() + "\n"); }
Source:
void sendMessageList() { final int count = 4; final byte[] contents = TEST_CONTENTS.getBytes(UTF_8); final List<ServiceBusMessage> messageList = new ArrayList<>(); IntStream.range(0, count).forEach(index -> { final ServiceBusMessage message = new ServiceBusMessage(contents); Assertions.assertTrue(messageList.add(message)); }); when(asyncSender.send(messageList)).thenReturn(Mono.empty()); sender.send(messageList); verify(asyncSender, times(1)).send(messageList); verify(asyncSender).send(messageListCaptor.capture()); final List<ServiceBusMessage> sentMessages = messageListCaptor.getValue(); Assertions.assertEquals(count, sentMessages.size()); sentMessages.forEach(sentMessage -> { Assertions.assertArrayEquals(contents, sentMessage.getBody()); }); }

Target:
void sendMessageList() { final int count = 4; final byte[] contents = TEST_CONTENTS.getBytes(UTF_8); final List<ServiceBusMessage> messages = TestUtils.getServiceBusMessages(count, UUID.randomUUID().toString(), contents); when(asyncSender.send(messages)).thenReturn(Mono.empty()); sender.send(messages); verify(asyncSender, times(1)).send(messages); verify(asyncSender).send(messageListCaptor.capture()); final List<ServiceBusMessage> sentMessages = messageListCaptor.getValue(); Assertions.assertEquals(count, sentMessages.size()); sentMessages.forEach(serviceBusMessage -> Assertions.assertArrayEquals(contents, serviceBusMessage.getBody())); }
Source:
private void extractDetectors(Set<FractionMetadata> fractions) { Path buildDir = Paths.get(this.project.getBuild().getOutputDirectory()); Set<FractionMetadata> fractionsWithDetectors = fractions.stream() .filter(f -> f.getDetectorClasses().size() > 0) .collect(Collectors.toSet()); fractionsWithDetectors .forEach(f -> { f.getDetectorClasses().forEach((relative, full) -> { try { Path target = buildDir.resolve(relative); File targetFile = target.toFile(); if (!targetFile.exists()) { targetFile.getParentFile().mkdirs(); } copy(full, target, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { getLog().error(e); } }); }); String servicesFile = "META-INF" + File.separator + "services" + File.separator + "org.wildfly.swarm.spi.meta.FractionDetector"; File outFile = new File(this.project.getBuild().getOutputDirectory(), servicesFile); if (!outFile.exists()) { outFile.getParentFile().mkdirs(); } try (FileWriter writer = new FileWriter(outFile)) { fractionsWithDetectors .stream() .flatMap(f -> f.getDetectorClasses().keySet().stream()) .map(p -> p.toString().substring(0, p.toString().lastIndexOf('.'))) .map(s -> s.replace(File.separatorChar, '.')) .forEach(p -> { try { writer.write(p); writer.write("\n"); } catch (IOException e) { getLog().error(e); } }); writer.flush(); writer.close(); } catch (IOException e) { getLog().error(e); } }

Target:
private void extractDetectors(Set<FractionMetadata> fractions) { Path buildDir = Paths.get(this.project.getBuild().getOutputDirectory()); Set<FractionMetadata> fractionsWithDetectors = fractions.stream() .filter(f -> f.getDetectorClasses().size() > 0) .collect(Collectors.toSet()); fractionsWithDetectors .forEach(f -> { f.getDetectorClasses().forEach((relative, full) -> { try { Path target = buildDir.resolve(relative); File targetFile = target.toFile(); if (!targetFile.exists()) { targetFile.getParentFile().mkdirs(); } copy(full, target, StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { getLog().error(e); } }); }); String servicesFile = "META-INF" + File.separator + "services" + File.separator + "org.wildfly.swarm.spi.meta.FractionDetector"; File outFile = new File(this.project.getBuild().getOutputDirectory(), servicesFile); if (!outFile.exists()) { outFile.getParentFile().mkdirs(); } try (FileWriter writer = new FileWriter(outFile)) { fractionsWithDetectors .stream() .flatMap(f -> f.getDetectorClasses().keySet().stream()) .map(p -> p.toString().substring(0, p.toString().lastIndexOf('.'))) .map(s -> s.replace(File.separatorChar, '.')) .forEach(p -> { try { writer.write(p); writer.write("\n"); } catch (IOException e) { getLog().error(e); } }); writer.flush(); } catch (IOException e) { getLog().error(e); } }
Source:
private Object replaceObjects(Environment context) { if(!context.data.isPresent()) { throw new BadRequestException("REPLACE must include data argument"); } if(context.ids.isPresent()) { throw new BadRequestException("REPLACE must not include ids argument"); } Set<PersistentResource> existingObjects = (Set<PersistentResource>) fetchObjects(context); Set<PersistentResource> upsertedObjects = upsertObjects(context); Set<PersistentResource> toDelete = Sets.difference(existingObjects, upsertedObjects); if(!context.isRoot()) { toDelete.forEach(item -> context.parentResource.removeRelation(context.field.getName(), item)); } else { toDelete.forEach(PersistentResource::deleteResource); } return toDelete; }

Target:
private Object replaceObjects(Environment context) { if(!context.data.isPresent()) { throw new BadRequestException("REPLACE must include data argument"); } if(context.ids.isPresent()) { throw new BadRequestException("REPLACE must not include ids argument"); } Set<PersistentResource> existingObjects = (Set<PersistentResource>) fetchObjects(context); Set<PersistentResource> upsertedObjects = upsertObjects(context); Set<PersistentResource> toDelete = Sets.difference(existingObjects, upsertedObjects); if(!context.isRoot()) { toDelete.forEach(item -> context.parentResource.removeRelation(context.field.getName(), item)); } else { toDelete.forEach(PersistentResource::deleteResource); } return upsertedObjects; }
Source:
private String localize(final Node elem) { String ret = null; String localized; if (elem != null) { try { Node contentNode = (Node) XPATH_CHARACTER_STRING.evaluate(elem, XPathConstants.NODE); ret = getText(contentNode); if (pathToLocalizedValue != null){ final Node localeNode = (Node) pathToLocalizedValue.evaluate(contentNode, XPathConstants.NODE); localized = getText(localeNode); if (localized != null && !localized.isEmpty()) { ret = localized; } } } catch (Exception e) { log.warn("Error parsing localized value for:", elem.getLocalName(), ". Message:", e.getMessage()); } } return ret; }

Target:
private String localize(final Node elem) { String ret = null; String localized; if (elem == null) { return null; } try { Node contentNode = (Node) XPATH_CHARACTER_STRING.evaluate(elem, XPathConstants.NODE); ret = getText(contentNode); if (pathToLocalizedValue != null){ final Node localeNode = (Node) pathToLocalizedValue.evaluate(contentNode, XPathConstants.NODE); localized = getText(localeNode); if (localized != null && !localized.isEmpty()) { ret = localized; } } } catch (Exception e) { log.warn("Error parsing localized value for:", elem.getLocalName(), ". Message:", e.getMessage()); } return ret; }
Source:
public XmlStringBuilder toXML() { XmlStringBuilder xml = new XmlStringBuilder(this, getNamespace()); xml.attribute(ID_TAG, getIdInitialMessage()); xml.attribute("xmlns", getNamespace()); xml.append('/'); xml.rightAngleBracket(); return xml; }

Target:
public XmlStringBuilder toXML() { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute(ID_TAG, getIdInitialMessage()); xml.closeEmptyElement(); return xml; }
Source:
public Set<String> getCustomAttributes() { return Collections.emptySet(); }

Target:
public Set<String> getCustomAttributes() { return Collections.<String>emptySet(); }
Source:
public List<String> getDependencies(@NotNull String filePath) { return myPathsToDependenciesMap.get(filePath); }

Target:
public List<String> getDependencies(@NotNull String filePath) { List<String> dependencies = myPathsToDependenciesMap.get(filePath); assert dependencies != null; return dependencies; }
Source:
protected void initialize(Map conf, String localDir) throws Exception { setConfig(conf); setLocalState(new LocalState(localDir)); _allowedHosts = listIntoSet((List<String>)conf.get(CONF_MESOS_ALLOWED_HOSTS)); _disallowedHosts = listIntoSet((List<String>)conf.get(CONF_MESOS_DISALLOWED_HOSTS)); setScheduler(new NimbusScheduler()); createLocalServerPort(); setupHttpServer(); }

Target:
protected void initialize(Map conf, String localDir) throws Exception { _conf = conf; _state = new LocalState(localDir); _allowedHosts = listIntoSet((List<String>)conf.get(CONF_MESOS_ALLOWED_HOSTS)); _disallowedHosts = listIntoSet((List<String>)conf.get(CONF_MESOS_DISALLOWED_HOSTS)); _scheduler = new NimbusScheduler(); createLocalServerPort(); setupHttpServer(); }
Source:
XPathEvaluationException(Throwable cause) { super(cause); }

Target:
public XPathEvaluationException(Throwable cause) { super(cause); }
Source:
public DefaultUrlSanitizer() { this(new ArrayList<String>() {{ add("http"); add("https"); add("mailto"); }}); }

Target:
public DefaultUrlSanitizer() { this(Arrays.asList("http", "https", "mailto")); }
Source:
private static Object readObjectTillTheEnd(final StringTokenizer tokenizer) { final JSONObject result = new JSONObject(); boolean finished = false; boolean allowObjectEnd = true; while (!finished) { final char nameStart = tokenizer.nextUnskippable(); if (nameStart == '}') { if (!allowObjectEnd) { throw syntaxError("Not allowed to finish object with comma", tokenizer); } finished = true; } else { if (nameStart != '"') { throw syntaxError("Unexpected symbol '" + nameStart + "'", tokenizer); } final String name = readStringTillTheEnd(tokenizer); final char separator = tokenizer.nextUnskippable(); if (separator != ':') { throw syntaxError("Waiting for name-value separator : while parsing object", tokenizer); } final Object value = parse(tokenizer); result.putOnce(name, value); final char nextToken = tokenizer.nextUnskippable(); if (nextToken == '}') { finished = true; } else if (nextToken != ',') { throw syntaxError("Unexpected symbol " + nextToken + " while parsing object", tokenizer); } } allowObjectEnd = false; } return result; }

Target:
private static Object readObjectTillTheEnd(final StringTokenizer tokenizer) { final JSONObject result = new JSONObject(); boolean finished = false; boolean allowObjectEnd = true; while (!finished) { final char nameStart = tokenizer.nextUnskippable(); if (nameStart == '}') { if (!allowObjectEnd) { throw syntaxError("Not allowed to finish object with comma", tokenizer); } finished = true; } else { if (nameStart != '"') { throw syntaxError("Unexpected symbol '" + nameStart + "'", tokenizer); } final String name = readStringTillTheEnd(tokenizer); final char separator = tokenizer.nextUnskippable(); if (separator != ':') { throw syntaxError("Waiting for name-value separator : while parsing object", tokenizer); } final Object value = parse(tokenizer); result.putOnce(name, value); final char nextToken = tokenizer.nextUnskippable(); if (nextToken == '}') { finished = true; } else if (nextToken != ',') { throw syntaxError("Unexpected symbol '" + nextToken + "' while parsing object", tokenizer); } } allowObjectEnd = false; } return result; }
Source:
public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) { checkWidget(); if (isListening(ST.LineGetStyle)) return; if (lineIndex < 0 || lineIndex > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } if (verticalLineIndent == renderer.getLineVerticalIndent(lineIndex, 0)) { return; } setVariableLineHeight(); int oldBottom = getLinePixel(lineIndex + 1); renderer.setLineVerticalIndent(lineIndex, verticalLineIndent); resetCache(lineIndex, 1); int newBottom = getLinePixel(lineIndex + 1); redrawLines(lineIndex, 1, oldBottom != newBottom); int caretLine = getCaretLine(); if (lineIndex <= caretLine && caretLine < lineIndex + 1) { setCaretLocation(); } }

Target:
public void setLineVerticalIndent(int lineIndex, int verticalLineIndent) { checkWidget(); if (isListening(ST.LineGetStyle)) return; if (lineIndex < 0 || lineIndex > content.getLineCount()) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } if (verticalLineIndent == renderer.getLineVerticalIndent(lineIndex)) { return; } setVariableLineHeight(); int oldBottom = getLinePixel(lineIndex + 1); renderer.setLineVerticalIndent(lineIndex, verticalLineIndent); resetCache(lineIndex, 1); int newBottom = getLinePixel(lineIndex + 1); redrawLines(lineIndex, 1, oldBottom != newBottom); int caretLine = getCaretLine(); if (lineIndex <= caretLine && caretLine < lineIndex + 1) { setCaretLocation(); } }
Source:
public Attachment getAttachment(AttachmentId attachmentId) throws AttachmentNotFoundException { Preconditions.checkArgument(attachmentId != null); return Optional.ofNullable(getEntityManager().find(JPAAttachment.class, attachmentId.getId())) .orElseThrow(() -> new AttachmentNotFoundException(attachmentId.getId())).toAttachment(); }

Target:
public Attachment getAttachment(AttachmentId attachmentId) throws AttachmentNotFoundException { Preconditions.checkArgument(attachmentId != null, "AttachmentId can't be null when trying to get attachment!"); return Optional.ofNullable(getEntityManager().find(JPAAttachment.class, attachmentId.getId())) .orElseThrow(() -> new AttachmentNotFoundException(attachmentId.getId())).toAttachment(); }
Source:
private void testUUID() { long maxHigh = 0, maxLow = 0, minHigh = -1L, minLow = -1L; for (int i = 0; i < 100; i++) { ValueUuid uuid = ValueUuid.getNewRandom(); maxHigh |= uuid.getHigh(); maxLow |= uuid.getLow(); minHigh &= uuid.getHigh(); minLow &= uuid.getLow(); } ValueUuid max = ValueUuid.get(maxHigh, maxLow); assertEquals("ffffffff-ffff-4fff-bfff-ffffffffffff", max.getString()); ValueUuid min = ValueUuid.get(minHigh, minLow); assertEquals("00000000-0000-4000-8000-000000000000", min.getString()); ValueJavaObject vo_uuid = ValueJavaObject.getNoCopy(UUID.randomUUID(), null, null); assertTrue(vo_uuid.convertTo(Value.UUID) instanceof ValueUuid); ValueJavaObject vo_string = ValueJavaObject.getNoCopy(new String("This is not a ValueUuid object"), null, null); assertThrows(DbException.class, vo_string).convertTo(Value.UUID); }

Target:
private void testUUID() { long maxHigh = 0, maxLow = 0, minHigh = -1L, minLow = -1L; for (int i = 0; i < 100; i++) { ValueUuid uuid = ValueUuid.getNewRandom(); maxHigh |= uuid.getHigh(); maxLow |= uuid.getLow(); minHigh &= uuid.getHigh(); minLow &= uuid.getLow(); } ValueUuid max = ValueUuid.get(maxHigh, maxLow); assertEquals("ffffffff-ffff-4fff-bfff-ffffffffffff", max.getString()); ValueUuid min = ValueUuid.get(minHigh, minLow); assertEquals("00000000-0000-4000-8000-000000000000", min.getString()); String uuidStr = "12345678-1234-4321-8765-123456789012"; UUID origUUID = UUID.fromString(uuidStr); ValueJavaObject valObj = ValueJavaObject.getNoCopy(origUUID, null, null); Value valUUID = valObj.convertTo(Value.UUID); assertTrue(valUUID instanceof ValueUuid); assertTrue((valUUID.getString().equals(uuidStr))); assertTrue(valUUID.getObject().equals(origUUID)); ValueJavaObject vo_string = ValueJavaObject.getNoCopy(new String("This is not a ValueUuid object"), null, null); assertThrows(DbException.class, vo_string).convertTo(Value.UUID); }
Source:
public void execute(FunctionContext<Object[]> context) { RegionFunctionContextImpl regionFunctionContext = (RegionFunctionContextImpl) context; ByteArrayWrapper key = (ByteArrayWrapper) regionFunctionContext.getFilter().iterator().next(); Region<ByteArrayWrapper, RedisSet> localRegion = regionFunctionContext.getLocalDataSet(regionFunctionContext.getDataSet()); Object[] args = context.getArguments(); RedisCommandType command = (RedisCommandType) args[0]; Object result = compute(regionFunctionContext.getDataSet(), key, command, args); context.getResultSender().lastResult(result); }

Target:
public void execute(FunctionContext<Object[]> context) { RegionFunctionContextImpl regionFunctionContext = (RegionFunctionContextImpl) context; ByteArrayWrapper key = (ByteArrayWrapper) regionFunctionContext.getFilter().iterator().next(); Region<ByteArrayWrapper, RedisSet> localRegion = regionFunctionContext.getLocalDataSet(regionFunctionContext.getDataSet()); Object[] args = context.getArguments(); RedisCommandType command = (RedisCommandType) args[0]; Runnable computation = () -> { Object result = compute(localRegion, key, command, args); context.getResultSender().lastResult(result); }; computeWithPrimaryLocked(key, (LocalDataSet) localRegion, computation); }
Source:
public void setStatistic(EntityPlayer player, StatBase statistic, int newValue, CallbackInfo ci, int oldValue) { final Text message = Text.of(defaultAchievementTranslation, player.getDisplayName(), statistic.getStatName()); final MessageChannel targetSink; if (this.mcServer.isAnnouncingPlayerAchievements()) { targetSink = MessageChannel.TO_ALL; } else { targetSink = MessageChannel.TO_NONE; } final MessageEvent.MessageFormatter formatter = new MessageEvent.MessageFormatter(message); final GrantAchievementEvent event = SpongeEventFactory.createGrantAchievementEventTargetPlayer(Cause.of(NamedCause.of(NamedCause.SOURCE,player)), targetSink, Optional.of(targetSink), (Achievement) statistic, formatter, (Player) player, false); SpongeImpl.getGame().getEventManager().post(event); if (event.isCancelled()) { super.unlockAchievement(player, statistic, oldValue); } else { final Optional<MessageChannel> optChannel = event.getChannel(); if (optChannel.isPresent()) { final MessageChannel channel = optChannel.get(); channel.send(event.getMessage()); } } ci.cancel(); }

Target:
private void setStatistic(EntityPlayer player, StatBase statistic, int newValue, CallbackInfo ci, int oldValue) { final Text message = Text.of(defaultAchievementTranslation, player.getDisplayName(), statistic.getStatName()); final MessageChannel targetSink; if (this.mcServer.isAnnouncingPlayerAchievements()) { targetSink = MessageChannel.TO_ALL; } else { targetSink = MessageChannel.TO_NONE; } final MessageEvent.MessageFormatter formatter = new MessageEvent.MessageFormatter(message); final GrantAchievementEvent event = SpongeEventFactory.createGrantAchievementEventTargetPlayer(Cause.of(NamedCause.of(NamedCause.SOURCE,player)), targetSink, Optional.of(targetSink), (Achievement) statistic, formatter, (Player) player, false); SpongeImpl.getGame().getEventManager().post(event); if (event.isCancelled()) { super.unlockAchievement(player, statistic, oldValue); } else { final Optional<MessageChannel> optChannel = event.getChannel(); if (optChannel.isPresent()) { final MessageChannel channel = optChannel.get(); channel.send(event.getMessage()); } } ci.cancel(); }
Source:
public void deleteMetadata(String name, String metadataName) throws EntityNotFoundException { Product product = null; try { product = productManager.load(name); } catch (EntityNotFoundException e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } try { product.deleteMetadata(metadataName); productManager.update(product); } catch (Exception e) { log.warning("Metadata not found : " + metadataName); throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadataName)); } }

Target:
public void deleteMetadata(String name, String metadataName) throws APIException { Product product = null; try { product = productManager.load(name); } catch (EntityNotFoundException e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } try { product.deleteMetadata(metadataName); productManager.update(product); } catch (Exception e) { log.warning("Metadata not found : " + metadataName); throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadataName)); } }
Source:
public void testLostEventsTotalInRange() { long start = 1376592664900000000L; long end = 1376592665000000000L; long realEventsInRange = backend.getEventsInRange(start, end); assertEquals(11209L, realEventsInRange); }

Target:
public void testLostEventsTotalInRange() { long realEventsInRange = backend.getEventsInRange(rangeStart, rangeEnd); assertEquals(11209L, realEventsInRange); }
Source:
public boolean isStethoEnabled() { return isStethoPresent() && mHolder.impl.isStethoActive(); }

Target:
public boolean isStethoEnabled() { return mHolder != null && mHolder.impl.isStethoActive(); }
Source:
public void release(Throwable cause) { for (SlotExecutionVertexAssignment assignment : requestedLogicalSlots.values()) { ExecutionVertexID executionVertexId = assignment.getExecutionVertexId(); LOG.debug("Release {}", getLogicalSlotString(requestedLogicalSlots.getKeyBByKeyA(executionVertexId), executionVertexId)); assignment .getLogicalSlotFuture() .thenAccept(logicalSlot -> ((PhysicalSlot.Payload) logicalSlot).release(cause)); } }

Target:
public void release(Throwable cause) { Preconditions.checkState( slotContextFuture.isDone(), "Releasing of the shared slot is expected only from its successfully allocated physical slot ({})", physicalSlotRequestId); for (ExecutionVertexID executionVertexId : requestedLogicalSlots.keySetA()) { LOG.debug("Release {}", getLogicalSlotString(executionVertexId)); CompletableFuture<SingleLogicalSlot> logicalSlotFuture = requestedLogicalSlots.getValueByKeyA(executionVertexId); Preconditions.checkNotNull(logicalSlotFuture); Preconditions.checkState( logicalSlotFuture.isDone(), "Logical slot future must already done when release call comes from the successfully allocated physical slot ({})", physicalSlotRequestId); logicalSlotFuture.thenAccept(logicalSlot -> logicalSlot.release(cause)); } }
Source:
public void testComputeJointSegmentCost() { DateTime referenceTime = DateTime.now(DateTimeZone.UTC); CostBalancerStrategy strategy = new CostBalancerStrategy(referenceTime, 4); double segmentCost = strategy.computeJointSegmentCosts( getSegment( 100, "DUMMY", new Interval( referenceTime, referenceTime.plusHours(1) ) ), getSegment( 101, "DUMMY", new Interval( referenceTime.minusDays(2), referenceTime.minusDays(2).plusHours(1) ) ) ); Assert.assertEquals(138028.62811791385d, segmentCost, 0); }

Target:
public void testComputeJointSegmentCost() { DateTime referenceTime = new DateTime("2014-01-01T00:00:00"); CostBalancerStrategy strategy = new CostBalancerStrategy(referenceTime, 4); double segmentCost = strategy.computeJointSegmentCosts( getSegment( 100, "DUMMY", new Interval( referenceTime, referenceTime.plusHours(1) ) ), getSegment( 101, "DUMMY", new Interval( referenceTime.minusDays(2), referenceTime.minusDays(2).plusHours(1) ) ) ); Assert.assertEquals(138028.62811791385d, segmentCost, 0); }
Source:
public CacheGroupPageScanner(GridKernalContext ctx) { this.ctx = ctx; log = ctx.log(getClass()); encrCfg = ctx.config().getDataStorageConfiguration().getEncryptionConfiguration(); execSvc = new IgniteThreadPoolExecutor(REENCRYPT_THREAD_PREFIX, ctx.igniteInstanceName(), encrCfg.getReencryptionThreadCnt(), encrCfg.getReencryptionThreadCnt(), IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME, new LinkedBlockingQueue<>(), GridIoPolicy.SYSTEM_POOL, new OomExceptionHandler(ctx)); execSvc.allowCoreThreadTimeOut(true); DataStorageConfiguration dsCfg = ctx.config().getDataStorageConfiguration(); limiter = CU.isPersistenceEnabled(dsCfg) && encrCfg.getReencryptionRateLimit() > 0 ? new BasicRateLimiter(encrCfg.getReencryptionRateLimit() * MB / dsCfg.getPageSize()) : null; }

Target:
public CacheGroupPageScanner(GridKernalContext ctx) { this.ctx = ctx; log = ctx.log(getClass()); DataStorageConfiguration dsCfg = ctx.config().getDataStorageConfiguration(); if (ctx.clientNode() || !CU.isPersistenceEnabled(dsCfg)) { batchSize = -1; limiter = null; singleExecSvc = null; return; } double rateLimit = dsCfg.getEncryptionConfiguration().getReencryptionRateLimit(); limiter = rateLimit > 0 ? new BasicRateLimiter(rateLimit * MB / (dsCfg.getPageSize() == 0 ? DataStorageConfiguration.DFLT_PAGE_SIZE : dsCfg.getPageSize())) : null; batchSize = dsCfg.getEncryptionConfiguration().getReencryptionBatchSize(); singleExecSvc = new IgniteThreadPoolExecutor(REENCRYPT_THREAD_PREFIX, ctx.igniteInstanceName(), 1, 1, IgniteConfiguration.DFLT_THREAD_KEEP_ALIVE_TIME, new LinkedBlockingQueue<>(), GridIoPolicy.SYSTEM_POOL, new OomExceptionHandler(ctx)); singleExecSvc.allowCoreThreadTimeOut(true); }
Source:
public void saveBootstrapConfig(BootstrapConfig bootstrapConfig) { configLocationFileStore.add(bootstrapConfig.getMotechDir()); File defaultBootstrapFile = ConfigPropertiesUtils.getDefaultPropertiesFile(ConfigLocation.FileAccessType.WRITABLE, configLocationFileStore.getAll(true), BOOTSTRAP_PROPERTIES); ConfigPropertiesUtils.saveConfig(defaultBootstrapFile, BootstrapConfigPropertyMapper.toProperties(bootstrapConfig)); }

Target:
public void saveBootstrapConfig(BootstrapConfig bootstrapConfig) { configLocationFileStore.add(new File(bootstrapConfig.getMotechDir(), "config").getAbsolutePath()); File defaultBootstrapFile = ConfigPropertiesUtils.getDefaultPropertiesFile(ConfigLocation.FileAccessType.WRITABLE, configLocationFileStore.getAll(), BOOTSTRAP_PROPERTIES); ConfigPropertiesUtils.saveConfig(defaultBootstrapFile, BootstrapConfigPropertyMapper.toProperties(bootstrapConfig)); }
Source:
private static void usage(PrintStream writer) { final String cmdName = "dumpapp " + NAME; final String usagePrefix = "Usage: " + cmdName + " "; writer.println(usagePrefix + "<command> [command-options]"); writer.print(usagePrefix + CMD_LIST); writer.println(); writer.print(usagePrefix + CMD_CLEAR); writer.println(); writer.print(usagePrefix + CMD_REMOVE_ROW + " <row id>"); writer.println(); writer.print(usagePrefix + CMD_REFRESH); writer.println(); }

Target:
private static void usage(PrintStream writer) { final String cmdName = "dumpapp " + NAME; final String usagePrefix = "Usage: " + cmdName + " "; writer.println(usagePrefix + "<command> [command-options]"); writer.print(usagePrefix + CMD_LIST); writer.println(); writer.print(usagePrefix + CMD_CLEAR); writer.println(); writer.print(usagePrefix + CMD_DELETE + " <rowId>"); writer.println(); writer.print(usagePrefix + CMD_REFRESH); writer.println(); }
Source:
public void reconcileTrackedClients(Set<UUID> trackedClients) { messageTrackers.entrySet().removeIf(x -> !trackedClients.contains(x)); }

Target:
public void reconcileTrackedClients(Set<UUID> trackedClients) { messageTrackers.keySet().retainAll(trackedClients); }
Source:
public String getName() { return "Echo Off"; }

Target:
public String getName() { return "Headers disabled"; }
Source:
public MethodHandle getMethod() { if (currentMethod.get() == null) return super.getMethod(); else return currentMethod.get(); }

Target:
public MethodHandle getMethod() { if (currentMethod.get() == null) { return super.getMethod(); } else { return currentMethod.get(); } }
Source:
public void testListEmptyPrefixDelimiter() throws Exception { final String container = getContainerName(); BlobStore blobStore = view.getBlobStore(); try { blobStore.createContainerInLocation(null, container); ImmutableList<String> blobs = ImmutableList.of("a", "b", "c"); for (String blob : blobs) { blobStore.putBlob(container, blobStore.blobBuilder(blob).payload("").build()); } ListContainerOptions options = ListContainerOptions.Builder.delimiter("") .prefix("").afterMarker(""); PageSet<? extends StorageMetadata> rs = blobStore.list(container, options); assertEquals(rs.size(), 3); ImmutableList.Builder<String> builder = ImmutableList.builder(); for (StorageMetadata sm : rs) { builder.add(sm.getName()); } assertThat(builder.build()).containsExactlyElementsOf(blobs); } finally { returnContainer(container); } }

Target:
public void testListEmptyPrefixDelimiter() throws Exception { final String container = getContainerName(); BlobStore blobStore = view.getBlobStore(); blobStore.createContainerInLocation(null, container); try { ImmutableList<String> blobs = ImmutableList.of("a", "b", "c"); for (String blob : blobs) { blobStore.putBlob(container, blobStore.blobBuilder(blob).payload("").build()); } ListContainerOptions options = ListContainerOptions.Builder.delimiter("") .prefix("").afterMarker(""); PageSet<? extends StorageMetadata> rs = blobStore.list(container, options); ImmutableList.Builder<String> builder = ImmutableList.builder(); for (StorageMetadata sm : rs) { builder.add(sm.getName()); } assertThat(builder.build()).containsExactlyElementsOf(blobs); } finally { returnContainer(container); } }
Source:
protected boolean verifyAddVM() { final MacPoolManagerStrategy macPool = getMacPoolForVm(); final List<String> reasons = getReturnValue().getCanDoActionMessages(); final int nicsCount = getParameters().getVmsCount() * getVmNicDao().getAllForTemplate(getVmTemplateId()).size(); final int priority = getParameters().getVmStaticData().getPriority(); return VmHandler.verifyAddVm(reasons, nicsCount, priority, macPool); }

Target:
protected boolean verifyAddVM() { final List<String> reasons = getReturnValue().getCanDoActionMessages(); final int nicsCount = getParameters().getVmsCount() * getVmNicDao().getAllForTemplate(getVmTemplateId()).size(); final int priority = getParameters().getVmStaticData().getPriority(); return VmHandler.verifyAddVm(reasons, nicsCount, priority, getMacPool()); }
Source:
public void testDNRestart() throws Exception { BlockReaderTestUtil.enableShortCircuitShmTracing(); TemporarySocketDirectory sockDir = new TemporarySocketDirectory(); Configuration conf = createShortCircuitConf("testDNRestart", sockDir); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); cluster.waitActive(); DistributedFileSystem fs = cluster.getFileSystem(); final ShortCircuitCache cache = fs.getClient().getClientContext().getShortCircuitCache(); DomainPeer peer = getDomainPeerToDn(conf); MutableBoolean usedPeer = new MutableBoolean(false); ExtendedBlockId blockId = new ExtendedBlockId(123, "xyz"); final DatanodeInfo datanode = new DatanodeInfo.DatanodeInfoBuilder() .setNodeID(cluster.getDataNodes().get(0).getDatanodeId()).build(); Slot slot1 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot1.getSlotId(), false); cluster.restartDataNode(0); Thread.sleep(1000); cache.scheduleSlotReleaser(slot1); Slot slot2 = null; try { slot2 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); } catch (ClosedChannelException ce) { } cache.scheduleSlotReleaser(slot2); Thread.sleep(2000); Assert.assertTrue(cluster.getDataNodes().get(0).getShortCircuitRegistry() .getShmNum() == 0); Assert.assertTrue(cache.getDfsClientShmManager().getShmNum() == 0); cluster.shutdown(); }

Target:
public void testDNRestart() throws Exception { TemporarySocketDirectory sockDir = new TemporarySocketDirectory(); Configuration conf = createShortCircuitConf("testDNRestart", sockDir); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); try { cluster.waitActive(); DistributedFileSystem fs = cluster.getFileSystem(); final ShortCircuitCache cache = fs.getClient().getClientContext().getShortCircuitCache(); DomainPeer peer = getDomainPeerToDn(conf); MutableBoolean usedPeer = new MutableBoolean(false); ExtendedBlockId blockId = new ExtendedBlockId(123, "xyz"); final DatanodeInfo datanode = new DatanodeInfo.DatanodeInfoBuilder() .setNodeID(cluster.getDataNodes().get(0).getDatanodeId()).build(); Slot slot1 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); cluster.getDataNodes().get(0).getShortCircuitRegistry() .registerSlot(blockId, slot1.getSlotId(), false); cluster.restartDataNode(0); Thread.sleep(1000); cache.scheduleSlotReleaser(slot1); Slot slot2 = null; try { slot2 = cache.allocShmSlot(datanode, peer, usedPeer, blockId, "testReleaseSlotReuseDomainSocket_client"); } catch (ClosedChannelException ce) { } cache.scheduleSlotReleaser(slot2); Thread.sleep(2000); Assert.assertEquals(0, cluster.getDataNodes().get(0).getShortCircuitRegistry().getShmNum()); Assert.assertEquals(0, cache.getDfsClientShmManager().getShmNum()); } finally { cluster.shutdown(); } }
Source:
public void onStart() { super.onStart(); if (getActivity().getClass() == PreferenceActivity.class) { ((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.statistics_label); } refreshStatistics(); }

Target:
public void onStart() { super.onStart(); refreshStatistics(); }
Source:
public void adsVuapTimeProgressingFandom(String pageType, String pageName, String slotName) throws InterruptedException { AdsFandomObject fandomPage = loadPage(pageName, pageType); AutoplayVuap videoFanTakeover = prepareSlot(slotName, fandomPage); networkTrafficInterceptor.startIntercepting(); videoFanTakeover.playVideoFor(Duration.ofSeconds(1)); double firstPause = videoFanTakeover.getCurrentTime(); videoFanTakeover.playVideoFor(Duration.ofSeconds(1)); double currentTime = videoFanTakeover.getCurrentTime(); Assert.assertTrue( firstPause < currentTime, String.format( "Video time is not progressing, first pause time %s is not smaller than current %s", firstPause, currentTime) ); }

Target:
public void adsVuapTimeProgressingFandom(String pageType, String pageName, String slotName) throws InterruptedException { AdsFandomObject fandomPage = loadPage(pageName, pageType); AutoplayVuap vuap = prepareSlot(slotName, fandomPage); playVideoAndCheckTimeProgressing(vuap, DESKTOP_VIDEO_TRIGGER_AREA); }
Source:
public static List<IAnalysisParameterProvider> getParameterProviders(IAnalysisModule module, ITmfTrace trace) { List<IAnalysisParameterProvider> providerList = new ArrayList<IAnalysisParameterProvider>(); if (!fParameterProviders.containsKey(module.getId())) { return providerList; } for (Class<? extends IAnalysisParameterProvider> providerClass : fParameterProviders.get(module.getId())) { try { IAnalysisParameterProvider provider = providerClass.newInstance(); if (provider.appliesToTrace(trace)) { providerList.add(provider); } } catch (IllegalArgumentException e) { Activator.logError("Error instantiating parameter provider", e); } catch (SecurityException e) { Activator.logError("Error instantiating parameter provider", e); } catch (InstantiationException e) { Activator.logError("Error instantiating parameter provider", e); } catch (IllegalAccessException e) { Activator.logError("Error instantiating parameter provider", e); } } return providerList; }

Target:
public static List<IAnalysisParameterProvider> getParameterProviders(IAnalysisModule module, ITmfTrace trace) { List<IAnalysisParameterProvider> providerList = new ArrayList<IAnalysisParameterProvider>(); synchronized (fParameterProviders) { if (!fParameterProviders.containsKey(module.getId())) { return providerList; } for (Class<? extends IAnalysisParameterProvider> providerClass : fParameterProviders.get(module.getId())) { try { IAnalysisParameterProvider provider = providerClass.newInstance(); if (provider.appliesToTrace(trace)) { providerList.add(provider); } } catch (IllegalArgumentException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } catch (SecurityException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } catch (InstantiationException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } catch (IllegalAccessException e) { Activator.logError(Messages.TmfAnalysisManager_ErrorParameterProvider, e); } } } return providerList; }
Source:
private void addIssueIfNotCaught(Type thrown, Tree node) { if (isNotCaught(thrown)) { String message = "Handle the " + "\"" + thrown + "\"" + " thrown here in a \"try/catch\" block."; reportIssue(node, message); } }

Target:
private void addIssueIfNotCaught(Type thrown, Tree node) { if (isNotCaught(thrown)) { String message = "Handle the " + "\"" + thrown.name() + "\"" + " thrown here in a \"try/catch\" block."; reportIssue(node, message); } }
Source:
private static TestResult findPreviousTestResult(Run<?, ?> originalBuild, TaskListener listener, String alternateJob) { Run<?,?> b = originalBuild.getPreviousBuild(); if (alternateJob != null && !alternateJob.equals("")) { TopLevelItem item = Jenkins.getInstance().getItem(alternateJob); if (item != null) { if (item instanceof Job) { Job j = (Job) item; if (!j.getBuilds().isEmpty()) { b = j.getLastBuild(); } else { listener.getLogger().printf("Job named %s does not have any existing builds, falling back to current job", alternateJob); } } else { listener.getLogger().printf("Item named %s is not a job, falling back to current job.", alternateJob); } } else { listener.getLogger().printf("Could not find job named %s, falling back to current job.", alternateJob); } } for (int i = 0; i < NUMBER_OF_BUILDS_TO_SEARCH - 1; i++) { if (b == null) break; if(!RESULTS_OF_BUILDS_TO_CONSIDER.contains(b.getResult())) continue; AbstractTestResultAction tra = b.getAction(AbstractTestResultAction.class); if (tra == null) continue; Object o = tra.getResult(); if (o instanceof TestResult) { listener.getLogger().printf("Using build #%d as reference\n", b.getNumber()); return (TestResult) o; } b = b.getPreviousBuild(); } return null; }

Target:
private static TestResult findPreviousTestResult(Run<?, ?> originalBuild, TaskListener listener, String alternateJob) { Run<?,?> b = originalBuild.getPreviousBuild(); if (alternateJob != null && !alternateJob.equals("")) { Job j = Jenkins.getInstance().getItem(alternateJob, originalBuild.getParent(), Job.class); if (j != null) { if (!j.getBuilds().isEmpty()) { b = j.getLastBuild(); } else { listener.getLogger().printf("Job named %s does not have any existing builds, falling back to current job", alternateJob); } } else { listener.getLogger().printf("Could not find job named %s, falling back to current job.", alternateJob); } } for (int i = 0; i < NUMBER_OF_BUILDS_TO_SEARCH - 1; i++) { if (b == null) break; if(!RESULTS_OF_BUILDS_TO_CONSIDER.contains(b.getResult())) continue; AbstractTestResultAction tra = b.getAction(AbstractTestResultAction.class); if (tra == null) continue; Object o = tra.getResult(); if (o instanceof TestResult) { listener.getLogger().printf("Using build #%d as reference\n", b.getNumber()); return (TestResult) o; } b = b.getPreviousBuild(); } return null; }
Source:
public <V> DataSet<V> readParquetFile(int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; try { table = SpliceSpark.getSession().read().parquet(location); } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); if (useSample) { return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context, execRow)).sample(false, sampleFraction)); } else { return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context, execRow))); } } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }

Target:
public <V> DataSet<V> readParquetFile(int[] baseColumnMap, int[] partitionColumnMap, String location, OperationContext context, Qualifier[][] qualifiers, DataValueDescriptor probeValue, ExecRow execRow, boolean useSample, double sampleFraction) throws StandardException { try { Dataset<Row> table = null; try { table = SpliceSpark.getSession().read().parquet(location); } catch (Exception e) { return handleExceptionInCaseOfEmptySet(e,location); } table = processExternalDataset(table,baseColumnMap,qualifiers,probeValue); if (useSample) { return new SparkDataSet(table .rdd().toJavaRDD() .sample(false, sampleFraction) .map(new RowToLocatedRowFunction(context, execRow))); } else { return new SparkDataSet(table .rdd().toJavaRDD() .map(new RowToLocatedRowFunction(context, execRow))); } } catch (Exception e) { throw StandardException.newException( SQLState.EXTERNAL_TABLES_READ_FAILURE,e.getMessage()); } }
Source:
public ThingBuilder withChannels(Channel... channels) { List<Channel> newChannels = Arrays.asList(channels); validateChannelUIDs(newChannels); ThingHelper.ensureUniqueChannels(newChannels); this.thing.setChannels(new ArrayList<>(newChannels)); return this; }

Target:
public ThingBuilder withChannels(Channel... channels) { return withChannels(Arrays.asList(channels)); }
Source:
protected void processPacket(QuorumPacket qp) throws IOException{ switch (qp.getType()) { case Leader.PING: ping(qp); break; case Leader.PROPOSAL: LOG.warn("Ignoring proposal"); break; case Leader.COMMIT: LOG.warn("Ignoring commit"); break; case Leader.UPTODATE: LOG.error("Received an UPTODATE message after Observer started"); break; case Leader.REVALIDATE: revalidate(qp); break; case Leader.SYNC: ((ObserverZooKeeperServer)zk).sync(); break; case Leader.INFORM: TxnHeader hdr = new TxnHeader(); Record txn = SerializeUtils.deserializeTxn(qp.getData(), hdr); Request request = new Request (null, hdr.getClientId(), hdr.getCxid(), hdr.getType(), null, null); request.txn = txn; request.hdr = hdr; ObserverZooKeeperServer obs = (ObserverZooKeeperServer)zk; obs.commitRequest(request); break; default: LOG.error("Invalid packet type received by Observer: " + qp.getType()); } }

Target:
protected void processPacket(QuorumPacket qp) throws IOException{ switch (qp.getType()) { case Leader.PING: ping(qp); break; case Leader.PROPOSAL: LOG.warn("Ignoring proposal"); break; case Leader.COMMIT: LOG.warn("Ignoring commit"); break; case Leader.UPTODATE: LOG.error("Received an UPTODATE message after Observer started"); break; case Leader.REVALIDATE: revalidate(qp); break; case Leader.SYNC: ((ObserverZooKeeperServer)zk).sync(); break; case Leader.INFORM: TxnHeader hdr = new TxnHeader(); Record txn = SerializeUtils.deserializeTxn(qp.getData(), hdr); Request request = new Request (null, hdr.getClientId(), hdr.getCxid(), hdr.getType(), null, null); request.txn = txn; request.hdr = hdr; ObserverZooKeeperServer obs = (ObserverZooKeeperServer)zk; obs.commitRequest(request); break; default: LOG.error("Invalid packet type: received by Observer", qp.getType()); } }
Source:
private static Configuration createClusteredLockCacheConfiguration(ClusteredLockManagerConfiguration config) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); if (config.consistency() == Consistency.LOW) { builder.clustering() .cacheMode(CacheMode.DIST_SYNC).hash().numOwners(config.numOwners()); } else { builder.clustering().cacheMode(CacheMode.REPL_SYNC); } if (config.reliability() == Reliability.CONSISTENT) { builder.clustering() .partitionHandling().whenSplit(PartitionHandling.DENY_READ_WRITES); } else { builder.clustering().partitionHandling().whenSplit(PartitionHandling.ALLOW_READ_WRITES); } return builder.build(); }

Target:
private static Configuration createClusteredLockCacheConfiguration(ClusteredLockManagerConfiguration config) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.transaction().transactionMode(TransactionMode.NON_TRANSACTIONAL); if (config.numOwners() > 0) { builder.clustering().cacheMode(CacheMode.DIST_SYNC) .hash().numOwners(config.numOwners()); } else { builder.clustering().cacheMode(CacheMode.REPL_SYNC); } if (config.reliability() == Reliability.CONSISTENT) { builder.clustering() .partitionHandling().whenSplit(PartitionHandling.DENY_READ_WRITES); } else { builder.clustering().partitionHandling().whenSplit(PartitionHandling.ALLOW_READ_WRITES); } return builder.build(); }
Source:
public Collection getApplicableContributors(IStructuredSelection selection) { boolean isMultiSelection = selection.size() > 1; Iterator it = selection.iterator(); Collection result = null; while (it.hasNext()) { Object element = it.next(); Collection collection = getApplicableContributors(element); if (isMultiSelection) { it = collection.iterator(); while (it.hasNext()) { RegistryPageContributor contrib = (RegistryPageContributor) it.next(); if (!contrib.supportsMultipleSelection()) { it.remove(); } } } if (result == null) result = new LinkedHashSet(collection); else result.retainAll(collection); if (result.isEmpty()) { return Collections.emptyList(); } } return result; }

Target:
public Collection getApplicableContributors(IStructuredSelection selection) { boolean isMultiSelection = selection.size() > 1; Iterator<Object> selIter = selection.iterator(); Collection<RegistryPageContributor> result = null; while (selIter.hasNext()) { Object selectionElement = selIter.next(); Collection<RegistryPageContributor> collection = getApplicableContributors(selectionElement); if (isMultiSelection) { Iterator<RegistryPageContributor> resIter = collection.iterator(); while (resIter.hasNext()) { RegistryPageContributor contrib = resIter.next(); if (!contrib.supportsMultipleSelection()) { resIter.remove(); } } } if (result == null) { result = new LinkedHashSet<>(collection); } else { result.retainAll(collection); } if (result.isEmpty()) { return Collections.emptyList(); } } return result; }
Source:
public AdUser() { mUserId = Guid.Empty; mGroups = new HashMap<String, AdGroups>(); }

Target:
public AdUser() { mUserId = Guid.Empty; mGroups = new HashMap<String, LdapGroup>(); }