auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; boolean persistentAuth = "persistent-auth".equals(req.getHeader("Prefer")); if (persistentAuth && req.getHeader("Authorization") != null) { if (req.getSession(false) != null) { req.getSession().setAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY, "false"); } } chain.doFilter(request, response); HttpSession session = req.getSession(false); if (session != null && Boolean.TRUE.equals(session.getAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY))) { String engineSessionId = (String) session.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (!persistentAuth) { try { InitialContext ctx = new InitialContext(); VdcActionParametersBase params = new VdcActionParametersBase(); params.setSessionId(engineSessionId); FiltersHelper.getBackend(ctx).runAction(VdcActionType.LogoutBySession, params); session.invalidate(); } catch (Exception ex) { log.error(String.format("Error in logout. Message is: %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } } else { Cookie cookie = new Cookie("JESSIONID", engineSessionId); resp.addCookie(cookie); } } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; boolean persistentAuth = "persistent-auth".equals(req.getHeader("Prefer")); if (persistentAuth && (req.getHeader("Authorization") != null || !containsJessionId(req))) { if (req.getSession(false) != null) { req.getSession().removeAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY); } } chain.doFilter(request, response); HttpSession session = req.getSession(false); if (session != null && Boolean.TRUE.equals(session.getAttribute(FiltersHelper.Constants.AUTHENTICATED_KEY))) { String engineSessionId = (String) session.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); if (!persistentAuth) { try { InitialContext ctx = new InitialContext(); VdcActionParametersBase params = new VdcActionParametersBase(); params.setSessionId(engineSessionId); FiltersHelper.getBackend(ctx).runAction(VdcActionType.LogoutBySession, params); session.invalidate(); FiltersHelper.closeContext(ctx); } catch (Exception ex) { log.error(String.format("Error in logout. Message is: %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } } } else { Cookie cookie = new Cookie("JESSIONID", engineSessionId); cookie.setPath("/api"); resp.addCookie(cookie); } } }
Source:
private void setRelationships() { if (this.data != null) { this.relationships = new LinkedHashSet<>(); EntityDictionary dictionary = this.requestScope.getDictionary(); this.data.entrySet().stream() .filter(entry -> dictionary.isRelation(this.entityClass, entry.getKey())) .forEach(entry -> { String relationshipName = entry.getKey(); Class<?> relationshipClass = dictionary.getParameterizedType(this.entityClass, relationshipName); EntityProjection relationshipProjection = projection.getRelationship(relationshipName).isPresent() ? projection.getRelationship(relationshipName).get().getProjection() : EntityProjection.builder() .type(relationshipClass) .build(); Set<Entity> relationshipEntities = new LinkedHashSet<>(); if (dictionary.getRelationshipType(this.entityClass, relationshipName).isToOne()) { relationshipEntities.add(new Entity( Optional.of(this), ((Map<String, Object>) entry.getValue()), relationshipProjection, this.requestScope)); } else { for (Map<String, Object> row : (List<Map<String, Object>>) entry.getValue()) { relationshipEntities.add(new Entity( Optional.of(this), row, relationshipProjection, this.requestScope)); } } this.relationships.add(new Relationship(relationshipName, relationshipEntities)); }); } }

Target:
private void setRelationships() { if (this.data != null) { this.relationships = new LinkedHashSet<>(); EntityDictionary dictionary = this.requestScope.getDictionary(); this.data.entrySet().stream() .filter(entry -> dictionary.isRelation(this.entityClass, entry.getKey())) .forEach(entry -> { String relationshipName = entry.getKey(); Class<?> relationshipClass = dictionary.getParameterizedType(this.entityClass, relationshipName); Set<Entity> relationshipEntities = new LinkedHashSet<>(); if (dictionary.getRelationshipType(this.entityClass, relationshipName).isToOne()) { relationshipEntities.add(new Entity( Optional.of(this), ((Map<String, Object>) entry.getValue()), relationshipClass, this.requestScope)); } else { for (Map<String, Object> row : (List<Map<String, Object>>) entry.getValue()) { relationshipEntities.add(new Entity( Optional.of(this), row, relationshipClass, this.requestScope)); } } this.relationships.add(new Relationship(relationshipName, relationshipEntities)); }); } }
Source:
protected static String getPointsInEqualShareFormatAsHtml(int points, boolean inline) { int delta = 0; if (points == Const.POINTS_NOT_SUBMITTED || points == Const.INT_UNINITIALIZED) { return "<span class=\"badge background-color-white color_neutral\">N/A</span>"; } else if (points == Const.POINTS_NOT_SURE) { return "<span class=\"badge background-color-white color-negative\">Not sure</span>"; } else if (points == 0) { return "<span class=\"badge background-color-white color-negative\">0%</span>"; } else if (points > 100) { delta = points - 100; if (inline) { return "<span class=\"badge background-color-white color-positive\"> E +" + delta + "%</span>"; } else { return "Equal Share<br /><span class=\"badge background-color-white color-positive\"> + " + delta + "%</span>"; } } else if (points < 100) { delta = 100 - points; if (inline) { return "<span class=\"badge background-color-white color-negative\"> E -" + delta + "%</span>"; } else { return "Equal Share<br /><span class=\"badge background-color-white color-negative\"> - " + delta + "%</span>"; } } else { return "<span class=\"badge background-color-white color-positive\"> E </span>"; } }

Target:
protected static String getPointsInEqualShareFormatAsHtml(int points, boolean inline) { int delta = 0; if (points == Const.POINTS_NOT_SUBMITTED || points == Const.INT_UNINITIALIZED) { return "<span class=\"badge background-color-white color_neutral\">N/A</span>"; } else if (points == Const.POINTS_NOT_SURE) { return "<span class=\"badge background-color-white color-negative\">Not sure</span>"; } else if (points == 0) { return "<span class=\"badge background-color-white color-negative\">0%</span>"; } else if (points > 100) { delta = points - 100; return inline ? "<span class=\"badge background-color-white color-positive\"> E +" + delta + "%</span>" : "Equal Share<br /><span class=\"badge background-color-white color-positive\"> + " + delta + "%</span>"; } else if (points < 100) { delta = 100 - points; return inline ? "<span class=\"badge background-color-white color-negative\"> E -" + delta + "%</span>" : "Equal Share<br /><span class=\"badge background-color-white color-negative\"> - " + delta + "%</span>"; } else { return "<span class=\"badge background-color-white color-positive\"> E </span>"; } }
Source:
public final @Nullable TileMultiBlock getMasterBlock() { if (masterBlock != null && !isStructureValid()) { masterBlock.isMaster = false; masterBlock = null; sendUpdateToClient(); } return masterBlock; }

Target:
public final @Nullable TileMultiBlock getMasterBlock() { if (masterBlock != null && !isStructureValid()) { masterBlock = null; sendUpdateToClient(); } return masterBlock; }
Source:
public FactoryDto createFactoryFromDevfile(String devfileLocation) throws BadRequestException { if (devfileLocation != null) { final String devfileYamlContent = urlFetcher.fetch(devfileLocation); if (!Strings.isNullOrEmpty(devfileYamlContent)) { try { WorkspaceConfigImpl wsConfig = devfileManager.validateAndConvert(devfileYamlContent, false); return newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig)); } catch (DevfileFormatException e) { throw new BadRequestException(e.getMessage()); } catch (IOException x) { throw new IllegalStateException(x.getLocalizedMessage(), x); } } } return null; }

Target:
public Optional<FactoryDto> createFactoryFromDevfile(String devfileLocation) throws BadRequestException, ServerException { if (devfileLocation == null) { return Optional.empty(); } final String devfileYamlContent = urlFetcher.fetch(devfileLocation); if (Strings.isNullOrEmpty(devfileYamlContent)) { return Optional.empty(); } try { Devfile devfile = devfileManager.parse(devfileYamlContent, false); WorkspaceConfigImpl wsConfig = devfileManager.createWorkspaceConfig(devfile); return Optional.of( newDto(FactoryDto.class) .withV(CURRENT_VERSION) .withWorkspace(DtoConverter.asDto(wsConfig))); } catch (DevfileFormatException e) { throw new BadRequestException(e.getMessage()); } catch (IOException x) { throw new ServerException(x.getLocalizedMessage(), x); } }
Source:
public synchronized int delete(Uri uri, String selection, String[] selectionArgs) { SqlArguments args = new SqlArguments(uri, selection, selectionArgs); synchronized (mLock) { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count = db.delete(args.table, args.where, args.args); if (count > 0) sendNotify(uri); return count; } }

Target:
public int delete(Uri uri, String selection, String[] selectionArgs) { SqlArguments args = new SqlArguments(uri, selection, selectionArgs); synchronized (mLock) { SQLiteDatabase db = mOpenHelper.getWritableDatabase(); int count = db.delete(args.table, args.where, args.args); if (count > 0) sendNotify(uri); return count; } }
Source:
SortedMap<String, Long> getUsedCapacityBySegment() { SortedMap<String, Long> usedCapacityBySegments = new TreeMap<>(); LogSegment logSegment = log.getFirstSegment(); while (logSegment != null) { usedCapacityBySegments.put(logSegment.getName(), logSegment.getEndOffset()); logSegment = log.getNextSegment(logSegment); } return usedCapacityBySegments; }

Target:
public SortedMap<String, Long> getUsedCapacityBySegment() { SortedMap<String, Long> usedCapacityBySegments = new TreeMap<>(); LogSegment logSegment = log.getFirstSegment(); while (logSegment != null) { usedCapacityBySegments.put(logSegment.getName(), logSegment.getEndOffset()); logSegment = log.getNextSegment(logSegment); } return usedCapacityBySegments; }
Source:
private CompletableFuture<Channel> bootstrapClient(Address address) { CompletableFuture<Channel> future = new OrderedFuture<>(); final InetAddress resolvedAddress = address.address(true); if (resolvedAddress == null) { final String errorMessage = String.format("Cannot bootstrap client for address %s as it cannot be resolved", address.toString()); future.completeExceptionally(new IllegalStateException(errorMessage)); return future; } Bootstrap bootstrap = new Bootstrap(); bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); bootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(10 * 32 * 1024, 10 * 64 * 1024)); bootstrap.option(ChannelOption.SO_RCVBUF, 1024 * 1024); bootstrap.option(ChannelOption.SO_SNDBUF, 1024 * 1024); bootstrap.option(ChannelOption.SO_KEEPALIVE, true); bootstrap.option(ChannelOption.TCP_NODELAY, true); bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000); bootstrap.group(clientGroup); bootstrap.channel(clientChannelClass); bootstrap.remoteAddress(resolvedAddress, address.port()); if (enableNettyTls) { try { bootstrap.handler(new SslClientChannelInitializer(future, address)); } catch (SSLException e) { return Futures.exceptionalFuture(e); } } else { bootstrap.handler(new BasicClientChannelInitializer(future)); } bootstrap.connect().addListener(f -> { if (!f.isSuccess()) { future.completeExceptionally(f.cause()); } }); return future; }

Target:
private CompletableFuture<Channel> bootstrapClient(Address address) { CompletableFuture<Channel> future = new OrderedFuture<>(); final InetAddress resolvedAddress = address.address(true); if (resolvedAddress == null) { future.completeExceptionally(new IllegalStateException("Failed to bootstrap client (address " + address.toString() + " cannot be resolved)")); return future; } Bootstrap bootstrap = new Bootstrap(); bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); bootstrap.option(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(10 * 32 * 1024, 10 * 64 * 1024)); bootstrap.option(ChannelOption.SO_RCVBUF, 1024 * 1024); bootstrap.option(ChannelOption.SO_SNDBUF, 1024 * 1024); bootstrap.option(ChannelOption.SO_KEEPALIVE, true); bootstrap.option(ChannelOption.TCP_NODELAY, true); bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000); bootstrap.group(clientGroup); bootstrap.channel(clientChannelClass); bootstrap.remoteAddress(resolvedAddress, address.port()); if (enableNettyTls) { try { bootstrap.handler(new SslClientChannelInitializer(future, address)); } catch (SSLException e) { return Futures.exceptionalFuture(e); } } else { bootstrap.handler(new BasicClientChannelInitializer(future)); } bootstrap.connect().addListener(f -> { if (!f.isSuccess()) { future.completeExceptionally(f.cause()); } }); return future; }
Source:
private List<Long> getChromosomesByFittest() { List<Long> orderChromKeysByFittest = new ArrayList(); String orderDirection = "desc"; if (config.isHigherFitnessValueFitter() == false) { orderDirection = "asc"; } String fittestSQL = "select _key from Chromosome order by fitnessScore " + orderDirection; QueryCursor<List<?>> cursor = populationCache.query(new SqlFieldsQuery(fittestSQL)); List<List<?>> res = cursor.getAll(); for (List row : res) { Long key = (Long)row.get(0); orderChromKeysByFittest.add(key); } return orderChromKeysByFittest; }

Target:
private List<Long> getChromosomesByFittest() { List<Long> orderChromKeysByFittest = new ArrayList<Long>(); String orderDirection = "desc"; if (!config.isHigherFitnessValueFitter()) orderDirection = "asc"; String fittestSQL = "select _key from Chromosome order by fitnessScore " + orderDirection; QueryCursor<List<?>> cursor = populationCache.query(new SqlFieldsQuery(fittestSQL)); List<List<?>> res = cursor.getAll(); for (List row : res) { Long key = (Long)row.get(0); orderChromKeysByFittest.add(key); } return orderChromKeysByFittest; }
Source:
public CommitCompareItem createSimpleCompareItem(String projectId, String commitId, String filePath, IProgressMonitor monitor) { GetContentFromCommitCommand getContent = gerrit.getContentFromCommit(projectId, commitId, filePath); String fileContent = ""; try { fileContent = getContent.call(); } catch (ClientProtocolException | EGerritException e) { e.printStackTrace(); } return new CommitCompareItem(commitId, filePath, StringUtils.newStringUtf8(Base64.decodeBase64(fileContent))); }

Target:
public CommitCompareItem createSimpleCompareItem(String projectId, String commitId, String filePath, IProgressMonitor monitor) { GetContentFromCommitCommand getContent = gerrit.getContentFromCommit(projectId, commitId, filePath); String fileContent = ""; try { fileContent = getContent.call(); } catch (ClientProtocolException | EGerritException e) { logger.debug("Exception retrieving commitId", e); } return new CommitCompareItem(commitId, filePath, StringUtils.newStringUtf8(Base64.decodeBase64(fileContent))); }
Source:
private void verifyWriterOutput(File outputFile, ReferenceSource refSource, int nRecs, boolean verifySupplementalFiles) { if (true == verifySupplementalFiles) { final File indexFile = SamFiles.findIndex(outputFile); indexFile.deleteOnExit(); final File md5File = new File(outputFile.getParent(), outputFile.getName() + ".md5"); md5File.deleteOnExit(); Assert.assertTrue(indexFile.length() > 0); Assert.assertTrue(md5File.length() > 0); } SamReaderFactory factory = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.LENIENT); if (refSource != null) { factory.referenceSource(refSource); } SamReader reader = factory.open(outputFile); SAMRecordIterator it = reader.iterator(); int count = 0; for (; it.hasNext(); it.next()) { count++; } Assert.assertTrue(count == nRecs); }

Target:
private void verifyWriterOutput(File outputFile, ReferenceSource refSource, int nRecs, boolean verifySupplementalFiles) { if (verifySupplementalFiles) { final File indexFile = SamFiles.findIndex(outputFile); indexFile.deleteOnExit(); final File md5File = new File(outputFile.getParent(), outputFile.getName() + ".md5"); md5File.deleteOnExit(); Assert.assertTrue(indexFile.length() > 0); Assert.assertTrue(md5File.length() > 0); } SamReaderFactory factory = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.LENIENT); if (refSource != null) { factory.referenceSource(refSource); } SamReader reader = factory.open(outputFile); SAMRecordIterator it = reader.iterator(); int count = 0; for (; it.hasNext(); it.next()) { count++; } Assert.assertTrue(count == nRecs); }
Source:
private void restart() { log.info("Waiting to restart Google Pubsub subscriber"); try { Thread.sleep(1000); } catch (InterruptedException e) { } start(); }

Target:
private void restart() { log.info("Waiting to restart Google Pubsub subscriber for {}", formatSubscriptionName(project, subscriptionName)); try { Thread.sleep(1000); } catch (InterruptedException e) { } start(); }
Source:
public List<ICodeSystemVersion> getCodeSystemVersions(final String shortName) { checkNotNull(shortName, "Short name may not be null."); final ICodeSystem codeSystem = getCodeSystem(shortName); if (codeSystem == null) { throw new CodeSystemNotFoundException(shortName); } final Collection<com.b2international.snowowl.datastore.ICodeSystemVersion> versions = new CodeSystemRequests(codeSystem.getRepositoryUuid()) .prepareSearchCodeSystemVersion() .setCodeSystemShortName(shortName) .build(IBranchPath.MAIN_BRANCH) .executeSync(getEventBus()) .getVersions(); return toSortedCodeSystemVersionList(versions); }

Target:
public List<ICodeSystemVersion> getCodeSystemVersions(final String shortName) { checkNotNull(shortName, "Short name may not be null."); final ICodeSystem codeSystem = getCodeSystem(shortName); if (codeSystem == null) { throw new CodeSystemNotFoundException(shortName); } final Collection<com.b2international.snowowl.datastore.ICodeSystemVersion> versions = getCodeSystemVersions(shortName, codeSystem.getRepositoryUuid()); return toSortedCodeSystemVersionList(versions); }
Source:
public String toString() { return "ClientEvent{" + "uuid='" + uuid + '\'' + ", eventType=" + eventType + ", address=" + address + ", clientType=" + clientType + ", name =" + name + '}'; }

Target:
public String toString() { return "ClientEvent{" + "uuid='" + uuid + '\'' + ", eventType=" + eventType + ", address=" + address + ", clientType=" + clientType + ", name='" + name + '\'' + ", attributes=" + attributes + '}'; }
Source:
public Mono<AmqpSendLink> createProducer( String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retry, boolean idempotentPartitionPublishing, PartitionPublishingState publishingState) { Objects.requireNonNull(linkName, "'linkName' cannot be null."); Objects.requireNonNull(entityPath, "'entityPath' cannot be null."); Objects.requireNonNull(timeout, "'timeout' cannot be null."); Objects.requireNonNull(retry, "'retry' cannot be null."); Symbol[] desiredCapabilities = null; Map<Symbol, Object> properties = null; if (idempotentPartitionPublishing) { desiredCapabilities = new Symbol[]{ENABLE_IDEMPOTENT_PRODUCER}; properties = new HashMap<>(); properties.put(PRODUCER_EPOCH, publishingState.getOwnerLevel()); properties.put(PRODUCER_ID, publishingState.getProducerGroupId()); properties.put(PRODUCER_SEQUENCE_NUMBER, publishingState.getSequenceNumber()); } return createProducer(linkName, entityPath, timeout, retry, properties, desiredCapabilities) .cast(AmqpSendLink.class); }

Target:
public Mono<AmqpSendLink> createProducer(String linkName, String entityPath, Duration timeout, AmqpRetryPolicy retry, boolean idempotentPartitionPublishing, PartitionPublishingState publishingState) { Objects.requireNonNull(linkName, "'linkName' cannot be null."); Objects.requireNonNull(entityPath, "'entityPath' cannot be null."); Objects.requireNonNull(timeout, "'timeout' cannot be null."); Objects.requireNonNull(retry, "'retry' cannot be null."); Symbol[] desiredCapabilities = null; Map<Symbol, Object> properties = null; if (idempotentPartitionPublishing) { desiredCapabilities = new Symbol[]{ClientConstants.ENABLE_IDEMPOTENT_PRODUCER}; properties = new HashMap<>(); properties.put(ClientConstants.PRODUCER_EPOCH, publishingState.getOwnerLevel()); properties.put(ClientConstants.PRODUCER_ID, publishingState.getProducerGroupId()); properties.put(ClientConstants.PRODUCER_SEQUENCE_NUMBER, publishingState.getSequenceNumber()); } return createProducer(linkName, entityPath, timeout, retry, properties, desiredCapabilities) .cast(AmqpSendLink.class); }
Source:
static String parseRegistryUrl(final String url) { if (url.equals("docker.io") || url.equals("index.docker.io")) { return DEFAULT_REGISTRY_URL; } else if (url.matches("(^|(\\w+)\\.)gcr\\.io$") || url.equals("gcr.kubernetes.io")) { return "https://" + url; } else if (url.equals("quay.io")) { return "quay.io"; } else if (!url.contains("http://") && !url.contains("https://")) { return "http://" + url; } else { return url; } }

Target:
static String parseRegistryUrl(final String url) { if (url.equals("docker.io") || url.equals("index.docker.io")) { return DEFAULT_REGISTRY_URL; } else if (url.matches("(^|(\\w+)\\.)gcr\\.io$") || url.equals("gcr.kubernetes.io")) { return "https://" + url; } else if (url.equals("quay.io")) { return "quay.io"; } else if (!url.contains("http://") && !url.contains("https://")) { return "https://" + url; } else { return url; } }
Source:
private Metacard addAttributeValue(Metacard metacard, Map.Entry<String, Object> entry) { final Object value = entry.getValue(); LOGGER.debug( "Adding attribute \"{}\" with value \"{}\" to metacard from map...", entry.getKey(), value); if (value instanceof Serializable) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (Serializable) value)); } else if (value instanceof List) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (List<Serializable>) value)); } return metacard; }

Target:
private void addAttributeValue(Metacard metacard, Map.Entry<String, Object> entry) { final Object value = entry.getValue(); LOGGER.trace( "The map key \"{}\" with value \"{}\" is being added to the metacard.", entry.getKey(), value); if (value instanceof Serializable) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (Serializable) value)); } else if (value instanceof List) { metacard.setAttribute(new AttributeImpl(entry.getKey(), (List<Serializable>) value)); } else { LOGGER.debug("The value was expected to be Serializable or a list of Serializable items."); } }
Source:
private void init(IMultiDiagramEditor editor) { serviceRegistry = editor.getServicesRegistry(); if (serviceRegistry == null) { throw new IllegalArgumentException(Messages.ModelExplorerView_ExceptionMissingServiceRegistry); } try { saveAndDirtyService = serviceRegistry.getService(ISaveAndDirtyService.class); undoContext = serviceRegistry.getService(IUndoContext.class); } catch (ServiceException e) { Activator.log.error(e); } }

Target:
private void init(IMultiDiagramEditor editor) { serviceRegistry = editor.getServicesRegistry(); if (serviceRegistry == null) { throw new IllegalArgumentException("The editor should have a ServiceRegistry."); } try { saveAndDirtyService = serviceRegistry.getService(ISaveAndDirtyService.class); undoContext = serviceRegistry.getService(IUndoContext.class); } catch (ServiceException e) { Activator.log.error(e); } }
Source:
private void buildRoad(UserBean user, GameBean game, String edgeId) throws PlayException, GameException { EdgeBean edgeToBuildOn = (EdgeBean) buildUtil.getValidMapElementByIdToBuildOn(edgeId, new ArrayList<MapElement>(game.getEdges())); buildUtil.validateUserCanBuildRoanOnEdge(user, edgeToBuildOn); buildUtil.buildRoadOnEdge(user, edgeToBuildOn); preparationStageUtil.updateCurrentCycleInitialBuildingNumber(game); }

Target:
private void buildRoad(UserBean user, GameBean game, String edgeId) throws PlayException, GameException { EdgeBean edgeToBuildOn = (EdgeBean) buildUtil.getValidMapElementByIdToBuildOn(edgeId, new ArrayList<MapElement>(game.getEdges())); buildUtil.validateUserCanBuildRoadOnEdge(user, edgeToBuildOn); buildUtil.buildRoadOnEdge(user, edgeToBuildOn); preparationStageUtil.updateCurrentCycleInitialBuildingNumber(game); }
Source:
public void testCreateWithoutWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password"); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); configuration.set("fs.ftp.impl.disable.cache", "true"); FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); try (FSDataOutputStream outputStream = fs.create(new Path("test1.txt"))) { outputStream.write(bytesExpected); } catch (IOException ioException) { assertThat( ioException.getMessage(), is("Unable to create file: test1.txt, Aborting") ); } }

Target:
public void testCreateWithoutWritePermissions() throws Exception { BaseUser user = server.addUser("test", "password"); Configuration configuration = new Configuration(); configuration.set("fs.defaultFS", "ftp:/ configuration.set("fs.ftp.host", "localhost"); configuration.setInt("fs.ftp.host.port", server.getPort()); configuration.set("fs.ftp.user.localhost", user.getName()); configuration.set("fs.ftp.password.localhost", user.getPassword()); configuration.setBoolean("fs.ftp.impl.disable.cache", true); FileSystem fs = FileSystem.get(configuration); byte[] bytesExpected = "hello world".getBytes(StandardCharsets.UTF_8); LambdaTestUtils.intercept( IOException.class, "Unable to create file: test1.txt, Aborting", () -> { try (FSDataOutputStream out = fs.create(new Path("test1.txt"))) { out.write(bytesExpected); } } ); }
Source:
public void deleteObsThatReference(Order order) { int orderId; if (order != null) { orderId = order.getOrderId(); Criteria crit = sessionFactory.getCurrentSession().createCriteria(Obs.class); crit.add(Restrictions.eq("order", order)); sessionFactory.getCurrentSession().createQuery("delete Obs where order = :orderId").setInteger("orderId", order.getOrderId()).executeUpdate(); } }

Target:
public void deleteObsThatReference(Order order) { if (order != null) { sessionFactory.getCurrentSession().createQuery("delete Obs where order = :order").setInteger("order", order.getOrderId()).executeUpdate(); } }
Source:
public DataSet next(int num) { INDArray features = Nd4j.create(new int[]{num, 10, 16}, 'f'); INDArray labels = Nd4j.create(new int[]{num, 10, 16}, 'f'); INDArray featuresMask = null; INDArray labelsMask = null; for (int i =0; i < num && iter.hasNext(); i ++) { String featureStr = iter.next(); currentCursor ++; featureStr = featureStr.replaceAll(",", ""); String[] featureAry = featureStr.split(""); for (int j = 0; j < featureAry.length - 1; j ++) { int feature = Integer.parseInt(featureAry[j]); int label = Integer.parseInt(featureAry[j + 1]); features.putScalar(new int[]{i, feature, j}, 1.0); labels.putScalar(new int[]{i, label, j}, 1.0); } } DataSet result = new DataSet(features, labels, featuresMask, labelsMask); return result; }

Target:
public DataSet next(int num) { INDArray features = Nd4j.create(new int[]{num, 10, 16}, 'f'); INDArray labels = Nd4j.create(new int[]{num, 10, 16}, 'f'); INDArray featuresMask = null; INDArray labelsMask = null; for (int i =0; i < num && iter.hasNext(); i ++) { String featureStr = iter.next(); currentCursor ++; featureStr = featureStr.replaceAll(",", ""); String[] featureAry = featureStr.split(""); for (int j = 0; j < featureAry.length - 1; j ++) { int feature = Integer.parseInt(featureAry[j]); int label = Integer.parseInt(featureAry[j + 1]); features.putScalar(new int[]{i, feature, j}, 1.0); labels.putScalar(new int[]{i, label, j}, 1.0); } } return new DataSet(features, labels, featuresMask, labelsMask); }
Source:
public SphereApiConfig getConfig() { return null; }

Target:
public SphereApiConfig getConfig() { return this.delegate.getConfig(); }
Source:
private static void doBindChildrenInFilter(Component[] shadows) { for (Component shadow : shadows) { if (shadow instanceof ShadowElement) { ShadowElement se = (ShadowElement) shadow; if (!se.getDistributedChildren().isEmpty() || !((ShadowElementCtrl) se).isDynamicValue()) continue; List<Component> children = shadow.getChildren(); if (shadow.getChildren().size() == 0) { Events.sendEvent(new Event("onBindInit", (Component) se)); Events.sendEvent(new Event("onBindingReady", (Component) se)); children = shadow.getChildren(); } if (children.size() > 0) doBindChildrenInFilter(children.toArray(new Component[children.size()])); } } }

Target:
private static void doBindChildrenInFilter(Component[] shadows) { for (Component shadow : shadows) { if (shadow instanceof ShadowElement) { ShadowElement se = (ShadowElement) shadow; if (!se.getDistributedChildren().isEmpty() || !((ShadowElementCtrl) se).isDynamicValue()) continue; List<Component> children = shadow.getChildren(); if (children.size() == 0) { Events.sendEvent(new Event("onBindInit", (Component) se)); Events.sendEvent(new Event("onBindingReady", (Component) se)); children = shadow.getChildren(); } if (children.size() > 0) doBindChildrenInFilter(children.toArray(new Component[children.size()])); } } }
Source:
public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException { if (!(outDir.exists() && outDir.isDirectory())) { throw new ISE("outDir[%s] must exist and be a directory", outDir); } log.info("Unzipping file[%s] to [%s]", pulledFile, outDir); final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult(); try (final ZipFile zipFile = new ZipFile(pulledFile)) { final Enumeration<? extends ZipEntry> enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { final ZipEntry entry = enumeration.nextElement(); File outFile = new File(outDir, entry.getName()); result.addFiles( FileUtils.retryCopy( new ByteSource() { @Override public InputStream openStream() throws IOException { return new BufferedInputStream(zipFile.getInputStream(entry)); } }, outFile, FileUtils.IS_EXCEPTION, DEFAULT_RETRY_COUNT ).getFiles() ); } } return result; }

Target:
public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException { if (!(outDir.exists() && outDir.isDirectory())) { throw new ISE("outDir[%s] must exist and be a directory", outDir); } log.info("Unzipping file[%s] to [%s]", pulledFile, outDir); final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult(); try (final ZipFile zipFile = new ZipFile(pulledFile)) { final Enumeration<? extends ZipEntry> enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { final ZipEntry entry = enumeration.nextElement(); final File outFile = new File(outDir, entry.getName()); result.addFiles( FileUtils.retryCopy( new ByteSource() { @Override public InputStream openStream() throws IOException { return new BufferedInputStream(zipFile.getInputStream(entry)); } }, outFile, FileUtils.IS_EXCEPTION, DEFAULT_RETRY_COUNT ).getFiles() ); } } return result; }
Source:
public void checkVertxHttpBoosterProjectCommands() { consoles.executeCommandFromProjectExplorer( VERTX_HTTP_BOOSTER, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( VERTX_HTTP_BOOSTER, RUN_GOAL, RUN_COMMAND, "[INFO] INFO: Succeeded in deploying verticle"); consoles.checkWebElementVisibilityAtPreviewPage(By.id("_vert_x_health_check_booster")); consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, "[INFO] Listening for transport dt_socket at address: 5005"); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }

Target:
public void checkVertxHttpBoosterProjectCommands() { By textOnPreviewPage = By.id("_http_booster"); consoles.executeCommandFromProjectExplorer( HEALTH_HTTP_BOOSTER_PROJECT, BUILD_GOAL, BUILD_COMMAND, BUILD_SUCCESS); consoles.executeCommandFromProjectExplorer( HEALTH_HTTP_BOOSTER_PROJECT, RUN_GOAL, RUN_COMMAND, "[INFO] INFO: Succeeded in deploying verticle"); checkApplicationPage(textOnPreviewPage); consoles.closeProcessTabWithAskDialog(RUN_COMMAND); consoles.executeCommandFromProcessesArea( "dev-machine", DEBUG_GOAL, DEBUG_COMMAND, "[INFO] Listening for transport dt_socket at address: 5005"); consoles.closeProcessTabWithAskDialog(DEBUG_COMMAND); }
Source:
protected void executeCommand() { int selectedId = 1; List<Integer> map = LinqUtils.foreach(vds_spm_id_mapList, new Function<vds_spm_id_map, Integer>() { @Override public Integer eval(vds_spm_id_map vds_spm_id_map) { return vds_spm_id_map.getvds_spm_id(); } }); Collections.sort(map); ListIterator<Integer> iterator = map.listIterator(); for (VdsStatic vds : getParameters().getVdss()) { while (iterator.hasNext()) { if (selectedId == iterator.next()) { selectedId++; iterator.remove(); } else { iterator.previous(); break; } } vds_spm_id_map newMap = new vds_spm_id_map(getParameters().getStoragePoolId(), vds.getId(), selectedId); DbFacade.getInstance().getVdsSpmIdMapDao().save(newMap); if (getParameters().isCompensationEnabled()) { getCompensationContext().snapshotNewEntity(newMap); getCompensationContext().stateChanged(); } selectedId++; } setSucceeded(true); }

Target:
protected void executeCommand() { List<Integer> vdsSpmIds = LinqUtils.foreach(vds_spm_id_mapList, new Function<vds_spm_id_map, Integer>() { @Override public Integer eval(vds_spm_id_map vds_spm_id_map) { return vds_spm_id_map.getvds_spm_id(); } }); IntRange intRange = new IntRange(1, Config.<Integer> GetValue(ConfigValues.MaxNumberOfHostsInStoragePool).intValue()); List<Integer> idsForUse = Arrays.asList(ArrayUtils.toObject(intRange.toArray())); idsForUse.removeAll(vdsSpmIds); int selectedId = 0; for (VdsStatic vds : getParameters().getVdss()) { vds_spm_id_map newMap = new vds_spm_id_map(getParameters().getStoragePoolId(), vds.getId(), idsForUse.get(selectedId)); DbFacade.getInstance().getVdsSpmIdMapDao().save(newMap); if (getParameters().isCompensationEnabled()) { getCompensationContext().snapshotNewEntity(newMap); getCompensationContext().stateChanged(); } selectedId++; } setSucceeded(true); }
Source:
public boolean removeGameRule(String gameRule) { if (DEFAULT.contains(gameRule)) { return false; } return this.theGameRules.remove(gameRule) != null; }

Target:
public boolean removeGameRule(String gameRule) { if (DEFAULT_GAME_RULES.hasRule(gameRule)) { this.setOrCreateGameRule(gameRule, DEFAULT_GAME_RULES.getString(gameRule)); return true; } return this.theGameRules.remove(gameRule) != null; }
Source:
public List<Project.NameKey> getParents(final Project.NameKey allProjectsName) { if (name.equals(allProjectsName)) { return null; } if (parents == null || parents.size() == 0) { List<Project.NameKey> r = new ArrayList<Project.NameKey>(); r.add(allProjectsName); return r; } return parents; }

Target:
public List<Project.NameKey> getParents(final Project.NameKey allProjectsName) { if (name.equals(allProjectsName)) { return Collections.emptyList(); } if (parents == null || parents.size() == 0) { List<Project.NameKey> r = new ArrayList<Project.NameKey>(1); r.add(allProjectsName); return r; } return parents; }
Source:
public void fullConstructorShouldPreserveAllValues() { ApiException error = new ApiException(anyMessage, anyErrorCode, anyMoreInfo, anyHttpStatus, details, anyCause); assertEquals("Message", anyMessage, error.getMessage()); assertSame("Cause", anyCause, error.getCause()); assertEquals("More info", anyMoreInfo, error.getMoreInfo()); assertEquals("Error code", anyErrorCode, error.getCode().intValue()); assertEquals("Status code", anyHttpStatus, error.getStatusCode().intValue()); assertEquals("Details", error.getDetails(), details); }

Target:
public void fullConstructorShouldPreserveAllValues() { ApiException error = new ApiException(anyMessage, anyErrorCode, anyMoreInfo, anyHttpStatus, anyCause); assertEquals("Message", anyMessage, error.getMessage()); assertSame("Cause", anyCause, error.getCause()); assertEquals("More info", anyMoreInfo, error.getMoreInfo()); assertEquals("Error code", anyErrorCode, error.getCode().intValue()); assertEquals("Status code", anyHttpStatus, error.getStatusCode().intValue()); }
Source:
public void onPostUploaded(OnPostUploaded event) { if (event.isError()) { if (event.error != null && event.error != null) { FailReason reason = new FailReason(event.error); addFailedReasonToFailedPosts(event.post, reason); } } else { removeFailedReasonForPost(event.post); } stopServiceIfUploadsComplete(); }

Target:
public void onPostUploaded(OnPostUploaded event) { if (event.isError()) { UploadError reason = new UploadError(event.error); addUploadErrorToFailedPosts(event.post, reason); } else { removeUploadErrorForPost(event.post); } stopServiceIfUploadsComplete(); }
Source:
public List<SearchSuggestion> getSuggestions(String namespace, String input) { List<SearchSuggestion> suggestions = new ArrayList<>(); for(SearchProvider provider : graphSearchProviders){ if (provider.canSuggest(graphService, namespace)){ suggestions.addAll(provider.getSuggestions(graphService, namespace, input)); } } suggestions.sort(Comparator.naturalOrder()); return suggestions; }

Target:
public List<SearchSuggestion> getSuggestions(String namespace, String input) { if(input == null || input.length() < MIN_CHAR_FOR_SEARCH) { return Collections.emptyList(); } SearchContext context = SearchContext.builder() .graphService(graphService) .suggestionsLimit(10) .build(); Set<SearchSuggestion> suggestions = new TreeSet<>(Comparator.comparing(SearchSuggestion::getLabel) .thenComparing(SearchSuggestion::getContext)); for(SearchProvider provider : graphSearchProviders.values()){ if (provider.canSuggest(graphService, namespace)){ List<SearchSuggestion> suggestionsOfProvider = provider.getSuggestions(context, namespace, input); if(suggestionsOfProvider == null) { LOG.warn("Provider does not work properly, received null suggestion list.", provider.getProviderId()); } else { suggestions.addAll(suggestionsOfProvider); } } } return new ArrayList<>(suggestions); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GenericMapData that = (GenericMapData) o; return Arrays.deepEquals(map.keySet().toArray(), that.map.keySet().toArray()) && Arrays.deepEquals(map.values().toArray(), that.map.values().toArray()); }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof GenericMapData)) { return false; } return deepEquals(map, ((GenericMapData) o).map); }
Source:
public Parser getParser() { return inputStream -> { JSONObject response = JsonReader.toJsonObject(inputStream); List<BibEntry> entries = new ArrayList<>(); BibEntry entry = jsonItemToBibEntry(response); entries.add(entry); return entries; }; }

Target:
public Parser getParser() { return inputStream -> { JSONObject response = JsonReader.toJsonObject(inputStream); if (response.isEmpty()) { return Collections.emptyList(); } return Collections.singletonList(jsonItemToBibEntry(response)); }; }
Source:
private void handleSubmitError(SubmitJob job) { if (form != null && !form.isDisposed()) { final IStatus status = job.getStatus(); if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status); AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT); if (newCommentPart != null) { newCommentPart.setFocus(); } } else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) { if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) { submitEnabled = true; doSubmit(); } else { String message; if (status.getMessage().length() > 0) { if (status.getMessage().length() < 100) { message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage(); } else { message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage().substring(0, 100) + "..."; } } else { message = Messages.AbstractTaskEditorPage_Submit_failed; } message = message.replaceAll("\n", " "); getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status); } }); } } else { String message; if (status.getCode() == RepositoryStatus.ERROR_IO) { message = ERROR_NOCONNECTIVITY; } else if (status.getMessage().length() > 0) { if (status.getMessage().length() < 100) { message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage(); } else { message = Messages.AbstractTaskEditorPage_Submit_failed_ + status.getMessage().substring(0, 100) + "..."; } } else { message = Messages.AbstractTaskEditorPage_Submit_failed; } getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status); } }); } } }

Target:
private void handleSubmitError(SubmitJob job) { if (form != null && !form.isDisposed()) { final IStatus status = job.getStatus(); String message = null; if (status.getCode() == RepositoryStatus.REPOSITORY_COMMENT_REQUIRED) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Comment_required, status); AbstractTaskEditorPart newCommentPart = getPart(ID_PART_NEW_COMMENT); if (newCommentPart != null) { newCommentPart.setFocus(); } } else if (status.getCode() == RepositoryStatus.ERROR_REPOSITORY_LOGIN) { if (TasksUiUtil.openEditRepositoryWizard(getTaskRepository()) == Window.OK) { submitEnabled = true; doSubmit(); return; } else { message = getMessageFromStatus(status); } } else { if (status.getCode() == RepositoryStatus.ERROR_IO) { message = ERROR_NOCONNECTIVITY; } else { message = getMessageFromStatus(status); if (message == null) { message = Messages.AbstractTaskEditorPage_Submit_failed; } } } if (message != null) { getTaskEditor().setMessage(message, IMessageProvider.ERROR, new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { TasksUiInternal.displayStatus(Messages.AbstractTaskEditorPage_Submit_failed, status); } }); } } }
Source:
public List<String> getRecommendationsForUser(String user) throws IOException, TasteException { DataModel model = new FileDataModel(new File("Result.csv")); UserSimilarity similarity = new PearsonCorrelationSimilarity(model); UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model); UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity); int userValue = HashUser.get(user); List RecommendedProducts = new ArrayList<String>(); List<RecommendedItem> recommendations = recommender.recommend(userValue,3); for (RecommendedItem recommendation : recommendations) { RecommendedProducts.add(InvertedHashProduct.get((int)recommendation.getItemID())); } return RecommendedProducts; }

Target:
public List<String> getRecommendationsForUser(String user) throws IOException, TasteException { DataModel model = new FileDataModel(new File("Result.csv")); UserSimilarity similarity = new PearsonCorrelationSimilarity(model); UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.1, similarity, model); UserBasedRecommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity); int userValue = HashUser.get(user); List RecommendedProducts = new ArrayList<String>(3); List<RecommendedItem> recommendations = recommender.recommend(userValue,3); for (RecommendedItem recommendation : recommendations) { RecommendedProducts.add(InvertedHashProduct.get((int)recommendation.getItemID())); } return RecommendedProducts; }
Source:
public String toString() { return String.format("%s @ partitionKey=%s partition=%d", _events, _partitionKey.orElse(""), _partition.orElse(-1)); }

Target:
public String toString() { return String.format("%s @ partitionKey=%s partition=%d", _events, _partitionKey.orElse(null), _partition.orElse(-1)); }
Source:
public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T> type, final String value, ItemGroup container) { final AutoCompletionCandidates candidates = new AutoCompletionCandidates(); class Visitor extends ItemVisitor { String prefix; Visitor(String prefix) { this.prefix = prefix; } @Override public void onItem(Item i) { String n = contextualNameOf(i); boolean caseInsensitive = UserSearchProperty.isCaseInsensitive(); String hay = n; String needle = value; if(caseInsensitive) { hay = hay.toLowerCase(); needle = needle.toLowerCase(); } if ((hay.startsWith(needle) || needle.startsWith(hay)) && (needle.length()>hay.length() || !hay.substring(needle.length()).contains("/")) && i.hasPermission(Item.READ) ) { if (type.isInstance(i) && hay.startsWith(needle)) candidates.add(n); String oldPrefix = prefix; prefix = n; super.onItem(i); prefix = oldPrefix; } } private String contextualNameOf(Item i) { if (prefix.endsWith("/") || prefix.length()==0) return prefix+i.getName(); else return prefix+'/'+i.getName(); } } if (container==null || container==Jenkins.getInstance()) { new Visitor("").onItemGroup(Jenkins.getInstance()); } else { new Visitor("").onItemGroup(container); if (value.startsWith("/")) new Visitor("/").onItemGroup(Jenkins.getInstance()); for ( String p="../"; value.startsWith(p); p+="../") { container = ((Item)container).getParent(); new Visitor(p).onItemGroup(container); } } return candidates; }

Target:
public static <T extends Item> AutoCompletionCandidates ofJobNames(final Class<T> type, final String value, ItemGroup container) { final AutoCompletionCandidates candidates = new AutoCompletionCandidates(); class Visitor extends ItemVisitor { String prefix; Visitor(String prefix) { this.prefix = prefix; } @Override public void onItem(Item i) { String n = contextualNameOf(i); if ((n.startsWith(value) || value.startsWith(n)) && (value.length()>n.length() || !n.substring(value.length()).contains("/")) && i.hasPermission(Item.READ) ) { if (type.isInstance(i) && n.startsWith(value)) candidates.add(n); String oldPrefix = prefix; prefix = n; super.onItem(i); prefix = oldPrefix; } } private String contextualNameOf(Item i) { if (prefix.endsWith("/") || prefix.length()==0) return prefix+i.getName(); else return prefix+'/'+i.getName(); } } if (container==null || container==Jenkins.getInstance()) { new Visitor("").onItemGroup(Jenkins.getInstance()); } else { new Visitor("").onItemGroup(container); if (value.startsWith("/")) new Visitor("/").onItemGroup(Jenkins.getInstance()); for ( String p="../"; value.startsWith(p); p+="../") { container = ((Item)container).getParent(); new Visitor(p).onItemGroup(container); } } return candidates; }
Source:
public void updateRequiredBundleVersions(Map<String, String> versionsToUpdate) { List<MutableManifestElement> requireBundleElements = parseHeaderForMutation(Constants.REQUIRE_BUNDLE); if (requireBundleElements == null || requireBundleElements.isEmpty()) { return; } boolean somethingChanged = false; for (MutableManifestElement mutableManifestElement : requireBundleElements) { String packageName = mutableManifestElement.getValue(); if (versionsToUpdate.containsKey(packageName)) { somethingChanged |= mutableManifestElement.setAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE, versionsToUpdate.get(packageName)); } } if (somethingChanged) { getAttribute(Constants.REQUIRE_BUNDLE).set(Constants.REQUIRE_BUNDLE, requireBundleElements); } }

Target:
public void updateRequiredBundleVersions(Map<String, String> versionsToUpdate) { List<MutableManifestElement> requireBundleElements = parseHeaderForMutation(Constants.REQUIRE_BUNDLE); if (requireBundleElements == null || requireBundleElements.isEmpty()) { return; } boolean somethingChanged = false; for (MutableManifestElement mutableManifestElement : requireBundleElements) { String bundleSymbolicName = mutableManifestElement.getValue(); if (versionsToUpdate.containsKey(bundleSymbolicName)) { somethingChanged |= mutableManifestElement.setAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE, versionsToUpdate.get(bundleSymbolicName)); } } if (somethingChanged) { getAttribute(Constants.REQUIRE_BUNDLE).set(Constants.REQUIRE_BUNDLE, requireBundleElements); } }