auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void toJson(JsonWriter writer, T calendar) throws IOException { StringBuilder output = null; if (calendar.isSet(Calendar.YEAR)) { output = new StringBuilder(); output.append(calendar.get(Calendar.YEAR)); if (calendar.isSet(Calendar.MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MONTH) + 1)); if (calendar.isSet(Calendar.DAY_OF_MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.DAY_OF_MONTH))); if (isFilledToTime(calendar)) { output.append('T'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.HOUR_OF_DAY))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MINUTE))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.SECOND))); if (ZULU_TIME_ZONE.equals(calendar.getTimeZone())) { output.append('Z'); } else { TimeZone tz = calendar.getTimeZone(); long offsetInMillis = tz.getOffset(calendar.getTimeInMillis()); String offset = String.format("%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60)); output.append((offsetInMillis >= 0 ? "+" : "-")).append(offset); } } } } } writer.value(output != null ? output.toString() : null); }

Target:
public void toJson(JsonWriter writer, T calendar) throws IOException { StringBuilder output = null; if (calendar.isSet(Calendar.YEAR)) { output = new StringBuilder(); output.append(calendar.get(Calendar.YEAR)); if (calendar.isSet(Calendar.MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MONTH) + 1)); if (calendar.isSet(Calendar.DAY_OF_MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.DAY_OF_MONTH))); if (isFilledToTime(calendar)) { output.append('T'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.HOUR_OF_DAY))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MINUTE))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.SECOND))); if (ZULU_TIME_ZONE.equals(calendar.getTimeZone())) { output.append('Z'); } else { TimeZone timeZone = calendar.getTimeZone(); long millisWithOffset = timeZone.getOffset(calendar.getTimeInMillis()); String offset = String.format("%02d:%02d", Math.abs(millisWithOffset / 3600000), Math.abs((millisWithOffset / 60000) % 60)); output.append((millisWithOffset >= 0 ? "+" : "-")).append(offset); } } } } } writer.value(output != null ? output.toString() : null); }
Source:
public long getBaselineBranchUuid() { return Long.parseLong(artifact.getSoleAttributeAsString(AtsAttributeTypes.BaselineBranchUuid, "0")); }

Target:
public long getBaselineBranchUuid() { return Long.parseLong(artifact.getSoleAttributeAsString(AtsAttributeTypes.BaselineBranchUuid, "-1")); }
Source:
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) { graph.clearTimeZone(); CalendarServiceData calendarServiceData = new CalendarServiceData(); try { for (NetexBundle netexBundle : netexBundles) { OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(graph.deduplicator); calendarServiceData.add(transitBuilder.buildCalendarServiceData()); OtpTransitService otpService = transitBuilder.build(); graph.addNoticAssignments(otpService.getNoticeAssignments()); PatternHopFactory hf = new PatternHopFactory( new GtfsFeedId.Builder() .id(netexFeedId) .build(), otpService, fareServiceFactory, MAX_STOP_TO_SHAPE_SNAP_DISTANCE, subwayAccessTime, maxInterlineDistance ); hf.run(graph); if (linkStopsToParentStations) { hf.linkStopsToParentStations(graph); } if (parentStationTransfers) { hf.createParentStationTransfers(); } } } catch (Exception e) { throw new RuntimeException(e); } graph.putService(CalendarServiceData.class, calendarServiceData); graph.updateTransitFeedValidity(calendarServiceData); graph.hasTransit = true; graph.calculateTransitCenter(); }

Target:
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) { graph.clearTimeZone(); CalendarServiceData calendarServiceData = new CalendarServiceData(); try { for (NetexBundle netexBundle : netexBundles) { netexBundle.checkInputs(); OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(graph.deduplicator); calendarServiceData.add(transitBuilder.buildCalendarServiceData()); OtpTransitService otpService = transitBuilder.build(); graph.addNoticeAssignments(otpService.getNoticeAssignments()); PatternHopFactory hf = new PatternHopFactory( new GtfsFeedId.Builder() .id(netexFeedId) .build(), otpService, fareServiceFactory, MAX_STOP_TO_SHAPE_SNAP_DISTANCE, subwayAccessTime, maxInterlineDistance ); hf.run(graph); if (linkStopsToParentStations) { hf.linkStopsToParentStations(graph); } if (parentStationTransfers) { hf.createParentStationTransfers(); } } } catch (Exception e) { throw new RuntimeException(e); } graph.putService(CalendarServiceData.class, calendarServiceData); graph.updateTransitFeedValidity(calendarServiceData); graph.hasTransit = true; graph.calculateTransitCenter(); }
Source:
public JavaParserTypeSolver(File srcDir) { this.srcDir = srcDir; hasValidSrcDir = srcDir.exists() && srcDir.isDirectory(); }

Target:
public JavaParserTypeSolver(File srcDir) { if (!srcDir.exists() || !srcDir.isDirectory()) { throw new IllegalStateException("SrcDir does not exist or is not a directory: " + srcDir.getAbsolutePath()); } this.srcDir = srcDir; }
Source:
public HBaseDataStore(HbaseTableConnection tableWrapper, ObjectMapper mapper) { this.tableWrapper = tableWrapper; this.mapper = mapper; keyTranslator = new HbaseKeyTranslator(new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(tableWrapper.getHbaseConfig().getNumBuckets()))); }

Target:
public HBaseDataStore(HbaseTableConnection tableWrapper, ObjectMapper mapper) { this.tableWrapper = tableWrapper; this.mapper = mapper; this.translator = new DocumentTranslator(new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(tableWrapper.getHbaseConfig().getNumBuckets()))); }
Source:
private void populatePopupMenu(List<ActionButtonDefinition<?, VmNetworkInterface>> actionButtons) { if (popup.getMenuBar().isEmpty() && actionButtons != null) { actionButtons.forEach(button -> { final MenuItem menuItem = new MenuItem(button.getText(), () -> { popup.asPopupPanel().hide(); button.onClick(null, null); }); List<VmNetworkInterface> selectedItems = Collections.singletonList(getEntity()); menuItem.setEnabled(button.isEnabled(null, null)); button.addInitializeHandler(event -> menuItem.setEnabled(button.isEnabled(null, null))); popup.getMenuBar().addItem(menuItem); }); } }

Target:
private void populatePopupMenu(List<ActionButtonDefinition<?, VmNetworkInterface>> actionButtons) { if (popup.getMenuBar().isEmpty() && actionButtons != null) { actionButtons.forEach(button -> { final MenuItem menuItem = new MenuItem(button.getText(), () -> { popup.asPopupPanel().hide(); button.onClick(null, null); }); menuItem.setEnabled(button.isEnabled(null, null)); button.addInitializeHandler(event -> menuItem.setEnabled(button.isEnabled(null, null))); popup.getMenuBar().addItem(menuItem); }); } }
Source:
public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new HashMap<>(); for (TopicProfileType profile : profiles) { if (profileMap.put(profile.getName(), profile) != null) { errors.addErrorMessage("Profile " + profile.getName() + " is already defined"); } } return Pair.of(defaults, profileMap); }

Target:
public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new HashMap<>(); for (TopicProfileType profile : profiles) { if (profileMap.put(profile.getName(), profile) != null) { errors.addErrorMessage("Profile " + profile.getName() + " is defined multiple times"); } } return Pair.of(defaults, profileMap); }
Source:
public void testMediaDownloading() { Client jersey = Client.create(); WebResource resource = jersey.resource(getResourceUrl("/cache/sample.wav")); ClientResponse response = resource.get(ClientResponse.class); Assert.assertEquals(200, response.getStatus()); }

Target:
public void testMediaDownloading() { Client jersey = Client.create(); WebResource resource = jersey.resource(getResourceUrl("/cache/ACae6e420f425248d6a26948c17a9e2acf/101cc31d1b07e8285c40d13d83f63da9caaaf21155a321f231980601bac555de.wav")); ClientResponse response = resource.get(ClientResponse.class); Assert.assertEquals(200, response.getStatus()); }
Source:
public String addLineageEntry(String lineageEntryId, LineageEntry lineageEntry) { _lineageEntries.put(lineageEntryId, lineageEntry); return lineageEntryId; }

Target:
public void addLineageEntry(String lineageEntryId, LineageEntry lineageEntry) { Preconditions.checkArgument(!_lineageEntries.containsKey(lineageEntryId), String.format("Lineage entry id ('%s') already exists. Please try with the new lineage id", lineageEntryId)); _lineageEntries.put(lineageEntryId, lineageEntry); }
Source:
public List<Group> getMemberGroupsByAttribute(PerunSession sess, Member member, Attribute attribute) throws WrongAttributeAssignmentException, PrivilegeException, IllegalArgumentException,InternalErrorException { if(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, new AttributeDefinition(attribute), null, null)) throw new PrivilegeException(sess); if(!attribute.getEntity().equals("group")) throw new IllegalArgumentException("Attribute: " + attribute + " is not group attribute"); return this.groupsManagerBl.getMemberGroupsByAttribute(sess, member, attribute); }

Target:
public List<Group> getMemberGroupsByAttribute(PerunSession sess, Member member, Attribute attribute) throws WrongAttributeAssignmentException, PrivilegeException,InternalErrorException, VoNotExistsException { Utils.checkPerunSession(sess); for(Group group: this.getAllGroups(sess, this.getPerunBl().getVosManagerBl().getVoById(sess, member.getVoId()))) if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attribute, group, null)) throw new PrivilegeException(sess, "Actor hasn't right to read attribute."); if(!this.getPerunBl().getAttributesManagerBl().isFromNamespace(sess, attribute, AttributesManagerEntry.NS_GROUP_ATTR)) throw new WrongAttributeAssignmentException(attribute); return this.groupsManagerBl.getMemberGroupsByAttribute(sess, member, attribute); }
Source:
protected int getBucketIdx(long bucketId) { return (int)Math.abs((bucketId % numBuckets)); }

Target:
protected int getBucketIdx(long bucketId) { return (int)Math.abs(bucketId % numBuckets); }
Source:
private DBObject generateUpdate(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { VariantSourceEntry variantSourceEntry = variant.getSourceEntries().iterator().next(); addToSet.put(VariantMongo.FILES_FIELD, convert(variantSourceEntry)); if (includeStats) { BasicDBList basicDBList = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", basicDBList)); } } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } update.append("$setOnInsert", convert(variant)); return update; }

Target:
private DBObject generateUpdate(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { VariantSourceEntry variantSourceEntry = getVariantSourceEntry(variant); addToSet.put(VariantMongo.FILES_FIELD, convertSourceEntry(variantSourceEntry)); if (includeStats) { BasicDBList statistics = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", statistics)); } } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } update.append("$setOnInsert", convertVariant(variant)); return update; }
Source:
public void remove() { if (type == SchemaType.MUTABLE) { realmSchema.remove(AllJavaTypes.CLASS_NAME); assertFalse(realmSchema.contains(AllJavaTypes.CLASS_NAME)); } else { thrown.expect(UnsupportedOperationException.class); realmSchema.remove(AllJavaTypes.CLASS_NAME); } }

Target:
public void remove() { if (type == SchemaType.IMMUTABLE) { thrown.expect(UnsupportedOperationException.class); realmSchema.remove(AllJavaTypes.CLASS_NAME); } else { realmSchema.remove(AllJavaTypes.CLASS_NAME); assertFalse(realmSchema.contains(AllJavaTypes.CLASS_NAME)); } }
Source:
public String acquireLease(int leaseTimeInSec, String leaseId) { try { String id = leaseBlob.acquireLease(leaseTimeInSec, leaseId); LOG.info("Acquired lease with lease id = " + id); return id; } catch (StorageException storageException) { int httpStatusCode = storageException.getHttpStatusCode(); if (httpStatusCode == HttpStatus.CONFLICT_409) { LOG.info("The blob you're trying to acquire is leased already."); } else { LOG.error("Error acquiring lease!", new SamzaException(storageException)); } } return null; }

Target:
public String acquireLease(int leaseTimeInSec, String leaseId) { try { String id = leaseBlob.acquireLease(leaseTimeInSec, leaseId); LOG.info("Acquired lease with lease id = " + id); return id; } catch (StorageException storageException) { int httpStatusCode = storageException.getHttpStatusCode(); if (httpStatusCode == HttpStatus.CONFLICT_409) { LOG.info("The blob you're trying to acquire is leased already.", storageException); } else if (httpStatusCode == HttpStatus.NOT_FOUND_404) { LOG.error("The blob you're trying to lease does not exist.", storageException); throw new AzureException(storageException); } else { LOG.error("Error acquiring lease!", storageException); throw new AzureException(storageException); } } return null; }
Source:
private Injector createSysInjector() { List<Module> modules = Lists.newArrayList(); modules.add(PatchListCacheImpl.module()); modules.add(new LuceneIndexModule(false, threads)); modules.add(new AbstractModule() { @SuppressWarnings("rawtypes") @Override protected void configure() { bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() { @Override public ReviewDb get() { return dbRef.get(); } }); bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {}) .toInstance(DynamicSet.<CacheRemovalListener> emptySet()); install(new DefaultCacheFactory.Module()); } }); return dbInjector.createChildInjector(modules); }

Target:
private Injector createSysInjector() { List<Module> modules = Lists.newArrayList(); modules.add(PatchListCacheImpl.module()); modules.add(new LuceneIndexModule(false, threads)); modules.add(new ReviewDbModule()); modules.add(new AbstractModule() { @SuppressWarnings("rawtypes") @Override protected void configure() { bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {}) .toInstance(DynamicSet.<CacheRemovalListener> emptySet()); install(new DefaultCacheFactory.Module()); } }); return dbInjector.createChildInjector(modules); }
Source:
public synchronized void handlePeerReady(SharingPeer peer) { BitSet interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); interesting.andNot(this.requestedPieces); logger.trace("Peer is ready and has interesting piece(s).", peer, interesting.cardinality()); if (interesting.cardinality() == 0) { interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); if (interesting.cardinality() == 0) { logger.trace("No interesting piece from {}!", peer); return; } if (this.completedPieces.cardinality() < ENG_GAME_COMPLETION_RATIO * this.pieces.length) { logger.trace("Not far along enough to warrant end-game mode."); return; } logger.trace("Possible end-game, we're about to request a piece " + "that was already requested from another peer."); } SortedSet<Piece> rarest = new TreeSet<Piece>(); for (Integer pieceIdx : this.rarest) { rarest.add(this.pieces[pieceIdx]); } Piece chosen = requestStrategy.choosePiece(rarest, interesting, pieces); this.requestedPieces.set(chosen.getIndex()); logger.trace("Requesting from {}, we now have " + "outstanding request(s): {}", new Object[] { chosen, peer, this.requestedPieces.cardinality(), this.requestedPieces }); peer.downloadPiece(chosen); }

Target:
public synchronized void handlePeerReady(SharingPeer peer) { BitSet interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); interesting.andNot(this.requestedPieces); logger.trace("Peer is ready and has interesting piece(s).", peer, interesting.cardinality()); if (interesting.cardinality() == 0) { interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); if (interesting.cardinality() == 0) { logger.trace("No interesting piece from {}!", peer); return; } if (this.completedPieces.cardinality() < ENG_GAME_COMPLETION_RATIO * this.pieces.length) { logger.trace("Not far along enough to warrant end-game mode."); return; } logger.trace("Possible end-game, we're about to request a piece " + "that was already requested from another peer."); } SortedSet<Piece> rarestPieces = new TreeSet<Piece>(); for (Integer pieceIdx : this.rarest) { rarestPieces.add(this.pieces[pieceIdx]); } Piece chosen = requestStrategy.choosePiece(rarestPieces, interesting, pieces); this.requestedPieces.set(chosen.getIndex()); logger.trace("Requesting from {}, we now have " + "outstanding request(s): {}", new Object[] { chosen, peer, this.requestedPieces.cardinality(), this.requestedPieces }); peer.downloadPiece(chosen); }
Source:
public void setVisible(boolean visible) { super.setVisible(visible); if (!visible) { setInput(null); } }

Target:
public void setVisible(boolean visible) { super.setVisible(visible); if (!visible) setInput(null); }
Source:
static Server makeJettyServer(DruidNode node, ServerConfig config) { log.info("Creating Jetty server listening at port [%s] with config [%s]", node.getPort(), config); final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(config.getNumThreads()); threadPool.setMaxThreads(config.getNumThreads()); threadPool.setDaemon(true); final Server server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true); ServerConnector connector = new ServerConnector(server); connector.setPort(node.getPort()); connector.setIdleTimeout(Ints.checkedCast(config.getMaxIdleTime().toStandardDuration().getMillis())); connector.setAcceptorPriorityDelta(-1); server.setConnectors(new Connector[]{connector}); return server; }

Target:
static Server makeJettyServer(DruidNode node, ServerConfig config) { final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(config.getNumThreads()); threadPool.setMaxThreads(config.getNumThreads()); threadPool.setDaemon(true); final Server server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true); ServerConnector connector = new ServerConnector(server); connector.setPort(node.getPort()); connector.setIdleTimeout(Ints.checkedCast(config.getMaxIdleTime().toStandardDuration().getMillis())); connector.setAcceptorPriorityDelta(-1); server.setConnectors(new Connector[]{connector}); return server; }
Source:
public LogReplicationSourceManager(CorfuRuntime runtime, DataSender dataSender, ReadProcessor readProcessor, LogReplicationRuntimeParameters params, ExecutorService logReplicationFSMWorkers) { this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } this.runtime = CorfuRuntime.fromParameters(runtime.getParameters()); this.runtime.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); this.logReplicationFSM.setSiteConfigID(params.getTopologyConfigId()); }

Target:
public LogReplicationSourceManager(CorfuRuntime runtime, DataSender dataSender, ReadProcessor readProcessor, LogReplicationRuntimeParameters params, ExecutorService logReplicationFSMWorkers) { this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } this.runtime = CorfuRuntime.fromParameters(runtime.getParameters()); this.runtime.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); this.logReplicationFSM.setTopologyConfigId(params.getTopologyConfigId()); }
Source:
public ModelAndView membershipGiveReceiveDetails(@PathVariable long membershipGiveId, @RequestParam(value = "mobile", defaultValue = "") String mobile, @RequestParam(value = "index", defaultValue = "1") int index, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) { ModelAndView modelAndView = new ModelAndView("/membership-give-receive-detail"); List<MembershipGiveReceiveDto> membershipGiveReceiveDtos = membershipGiveService.getMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile, index, pageSize); modelAndView.addObject("membershipGiveReceiveDtos", membershipGiveReceiveDtos); modelAndView.addObject("mobile", mobile); long totalCount = membershipGiveService.getCountMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile); modelAndView.addObject("totalCount", totalCount); modelAndView.addObject("index", index); modelAndView.addObject("pageSize", pageSize); modelAndView.addObject("hasPreviousPage", index > 1); int totalPage = (int) (totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1); modelAndView.addObject("hasNextPage", index < totalPage); modelAndView.addObject("selectMobile", mobile); modelAndView.addObject("selectGiveId", membershipGiveId); return modelAndView; }

Target:
public ModelAndView membershipGiveReceiveDetails(@PathVariable long membershipGiveId, @RequestParam(value = "mobile", defaultValue = "") String mobile, @RequestParam(value = "index", defaultValue = "1") int index, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) { ModelAndView modelAndView = new ModelAndView("/membership-give-receive-detail"); BasePaginationDataDto<MembershipGiveReceiveDto> basePaginationDataDto = membershipGiveService.getMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile, index, pageSize); modelAndView.addObject("dataDto", basePaginationDataDto); modelAndView.addObject("selectMobile", mobile); modelAndView.addObject("selectGiveId", membershipGiveId); return modelAndView; }
Source:
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); this.setThreadFactory(ThreadExecutorMap.apply(getThreadFactory(), this)); }

Target:
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); }
Source:
public UpdateClockTimerTask() { try { update_interval = Integer.parseInt(ScoreBoardManager.getProperty(PROPERTY_INTERVAL_KEY)); } catch ( Exception e ) { } startSystemTime = scoreBoardClock.getCurrentTime(); scoreBoardClock.addScoreBoardListener(this); timer.scheduleAtFixedRate(this, update_interval / 4, update_interval / 4); }

Target:
public UpdateClockTimerTask() { startSystemTime = scoreBoardClock.getCurrentTime(); ScoreBoardClock.getInstance().registerClient(this); }
Source:
private ListenableFuture<T> execute(Supplier<ListenableFuture<T>> supplier, int retriesRemaining) { return Futures.transformAsync(Futures.submitAsync(supplier::get, MoreExecutors.directExecutor()), result -> { int newRetriesRemaining = retriesRemaining - 1; if (predicate.test(result) || newRetriesRemaining == 0) { return Futures.immediateFuture(result); } else { return Futures.transformAsync( schedulingExecutor.schedule( () -> { }, delayBetweenAttempts.toMillis(), TimeUnit.MILLISECONDS), $ -> execute(supplier, newRetriesRemaining), executionExecutor); } }, MoreExecutors.directExecutor()); }

Target:
private ListenableFuture<T> execute(Supplier<ListenableFuture<T>> supplier, int retriesRemaining) { return Futures.transformAsync(executeSupplier(supplier), result -> { int newRetriesRemaining = retriesRemaining - 1; if (predicate.test(result) || newRetriesRemaining == 0) { return Futures.immediateFuture(result); } else { return Futures.transformAsync( schedulingExecutor.schedule( () -> { }, delayBetweenAttempts.toMillis(), TimeUnit.MILLISECONDS), $ -> execute(supplier, newRetriesRemaining), executionExecutor); } }, MoreExecutors.directExecutor()); }
Source:
static void closeReader(BufferedReader in, File inputFile) { try { in.close(); } catch (Exception e) { logger.error("Can't close input file '" + inputFile + "': " + e); System.exit(1); } }

Target:
static void closeReader(BufferedReader in, File inputFile) { try { in.close(); } catch (Exception e) { System.err.println("Can't close input file '" + inputFile + "': " + e); System.exit(1); } }
Source:
String exec() { final Planner planner = getPlanner(null, SqlParser.Config.DEFAULT, schemaSpec, config); try { SqlNode parse = planner.parse(sql); SqlNode validate = planner.validate(parse); RelNode rel = planner.rel(validate).rel; for (Function<RelNode, RelNode> transform : transforms) { rel = transform.apply(rel); } System.out.println(RelOptUtil.toString(rel)); final RelToSqlConverter converter = new RelToSqlConverter(dialect); final SqlNode sqlNode = converter.visitChild(0, rel).asStatement(); return sqlNode.toSqlString(dialect).getSql(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }

Target:
String exec() { final Planner planner = getPlanner(null, SqlParser.Config.DEFAULT, schema, config); try { SqlNode parse = planner.parse(sql); SqlNode validate = planner.validate(parse); RelNode rel = planner.rel(validate).rel; for (Function<RelNode, RelNode> transform : transforms) { rel = transform.apply(rel); } final RelToSqlConverter converter = new RelToSqlConverter(dialect); final SqlNode sqlNode = converter.visitChild(0, rel).asStatement(); return sqlNode.toSqlString(dialect).getSql(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
public Set<String> getFreeVariables() { Set<String> freeVars = matchExpr.getFreeVariables(); for (Case c : cases) { freeVars.addAll(c.getBody().getFreeVariables()); } freeVars.addAll(elseExpr.getFreeVariables()); return freeVars; }

Target:
public Set<String> getFreeVariables() { Set<String> freeVars = matchExpr.getFreeVariables(); for (Case c : cases) { freeVars.addAll(c.getBody().getFreeVariables()); freeVars.remove(c.getVarName()); } freeVars.addAll(elseExpr.getFreeVariables()); return freeVars; }
Source:
private void removeBricksFromVolumeInDb(List<GlusterBrickEntity> brickList) { GlusterVolumeEntity volume = getGlusterVolume(); for (GlusterBrickEntity brick : brickList) { getGlusterBrickDao().removeBrick(brick.getId()); } if (volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE && volume.getReplicaCount() == (volume.getBricks().size() - brickList.size())) { volume.setVolumeType(GlusterVolumeType.REPLICATE); } if (volume.getVolumeType() == GlusterVolumeType.REPLICATE || volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) { int replicaCount = (getParameters().getReplicaCount() == 0 || getParameters().getReplicaCount() == volume.getReplicaCount()) ? volume.getReplicaCount() : getParameters().getReplicaCount(); volume.setReplicaCount(replicaCount); getGlusterVolumeDao().updateGlusterVolume(volume); } if (volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_STRIPE && volume.getStripeCount() == (volume.getBricks().size() - brickList.size())) { volume.setVolumeType(GlusterVolumeType.STRIPE); getGlusterVolumeDao().updateGlusterVolume(volume); } }

Target:
private void removeBricksFromVolumeInDb(List<GlusterBrickEntity> brickList) { GlusterVolumeEntity volume = getGlusterVolume(); for (GlusterBrickEntity brick : brickList) { getGlusterBrickDao().removeBrick(brick.getId()); } if (volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE && volume.getReplicaCount() == (volume.getBricks().size() - brickList.size())) { volume.setVolumeType(GlusterVolumeType.REPLICATE); } if (volume.getVolumeType() == GlusterVolumeType.REPLICATE || volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) { int replicaCount = (getParameters().getReplicaCount() == 0) ? volume.getReplicaCount() : getParameters().getReplicaCount(); volume.setReplicaCount(replicaCount); getGlusterVolumeDao().updateGlusterVolume(volume); } if (volume.getVolumeType() == GlusterVolumeType.DISTRIBUTED_STRIPE && volume.getStripeCount() == (volume.getBricks().size() - brickList.size())) { volume.setVolumeType(GlusterVolumeType.STRIPE); getGlusterVolumeDao().updateGlusterVolume(volume); } }
Source:
public void startHA() throws Exception { JChannel ch=new JChannel(jgroupsConf); RaftHandle handle=new RaftHandle(ch, null); if ( raftMemberID != null ) handle.raftId(raftMemberID); else LOGGER.warn("--raft_member_id not specified, using values from " + jgroupsConf); handle.addRoleListener(role -> { if(role == Role.Leader) { LOGGER.info("won HA election, starting maxwell"); isRaftLeader.set(true); if ( hasRun ) maxwell.restart(); else { maxwell.run(); hasRun = true; } isRaftLeader.set(false); } else if ( this.isRaftLeader.get() ) { LOGGER.info("Unable to find consensus, stepping down HA leadership"); maxwell.terminate(); isRaftLeader.set(false); } else { LOGGER.info("lost HA election, current leader: " + handle.leader()); } }); ch.connect(this.clientID); LOGGER.info("enter HA group, current leader: " + handle.leader()); Thread.sleep(Long.MAX_VALUE); }

Target:
public void startHA() throws Exception { JChannel ch=new JChannel(jgroupsConf); RaftHandle handle=new RaftHandle(ch, null); if ( raftMemberID != null ) handle.raftId(raftMemberID); else LOGGER.warn("--raft_member_id not specified, using values from " + jgroupsConf); handle.addRoleListener(role -> { if(role == Role.Leader) { LOGGER.info("won HA election, starting maxwell"); isRaftLeader.set(true); run(); isRaftLeader.set(false); } else if ( this.isRaftLeader.get() ) { LOGGER.info("Unable to find consensus, stepping down HA leadership"); maxwell.terminate(); isRaftLeader.set(false); } else { LOGGER.info("lost HA election, current leader: " + handle.leader()); } }); ch.connect(this.clientID); LOGGER.info("enter HA group, current leader: " + handle.leader()); Thread.sleep(Long.MAX_VALUE); }
Source:
final CompletableFuture<Response> invokeCommand(CacheRpcCommand cmd) throws Throwable { try { if (isTraceEnabled()) { getLog().tracef("Calling perform() on %s", cmd); } if (cmd instanceof CancellableCommand) { cancellationService.register(Thread.currentThread(), ((CancellableCommand) cmd).getUUID()); } CompletableFuture<Object> future = cmd.invokeAsync(); if (CompletionStages.isComplete(future)) { Object obj = future.join(); if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } Response response = responseGenerator.getResponse(cmd, obj); if (response == null) { return CompletableFutures.completedNull(); } return CompletableFuture.completedFuture(response); } return future.handle((rv, throwable) -> { if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } CompletableFutures.rethrowException(throwable); return responseGenerator.getResponse(cmd, rv); }); } catch (Throwable throwable) { if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } throw throwable; } }

Target:
final CompletableFuture<Response> invokeCommand(CacheRpcCommand cmd) throws Throwable { try { if (isTraceEnabled()) { getLog().tracef("Calling perform() on %s", cmd); } if (cmd instanceof CancellableCommand) { cancellationService.register(Thread.currentThread(), ((CancellableCommand) cmd).getUUID()); } CompletableFuture<Object> future = cmd.invokeAsync(); if (CompletionStages.isCompletedSuccessfully(future)) { Object obj = future.join(); if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } Response response = responseGenerator.getResponse(cmd, obj); if (response == null) { return CompletableFutures.completedNull(); } return CompletableFuture.completedFuture(response); } return future.handle((rv, throwable) -> { if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } CompletableFutures.rethrowException(throwable); return responseGenerator.getResponse(cmd, rv); }); } catch (Throwable throwable) { if (cmd instanceof CancellableCommand) { cancellationService.unregister(((CancellableCommand) cmd).getUUID()); } throw throwable; } }
Source:
protected final void bindConsumerAndProducers(final Module module) { String xdHistory = module.getDeploymentProperties() != null ? module.getDeploymentProperties().get(BusProperties.TRACK_HISTORY) : null; boolean trackHistory = Boolean.valueOf(xdHistory); Properties[] properties = extractConsumerProducerProperties(module); Map<String, Object> historyProperties = extractHistoryProperties(module); addHistoryTag(module, historyProperties); MessageChannel outputChannel = module.getComponent(MODULE_OUTPUT_CHANNEL, MessageChannel.class); if (outputChannel != null) { bindMessageProducer(outputChannel, getOutputChannelName(module), properties[1]); String tapChannelName = buildTapChannelName(module); tappableChannels.put(tapChannelName, outputChannel); if (isTapActive(tapChannelName)) { createAndBindTapChannel(tapChannelName, outputChannel); } if (trackHistory) { track(module, outputChannel, historyProperties); } } MessageChannel inputChannel = module.getComponent(MODULE_INPUT_CHANNEL, MessageChannel.class); if (inputChannel != null) { bindMessageConsumer(inputChannel, getInputChannelName(module), properties[0]); if (trackHistory && module.getType().equals(ModuleType.sink)) { track(module, inputChannel, historyProperties); } } }

Target:
protected final void bindConsumerAndProducers(final Module module) { boolean trackHistory = module.getDeploymentProperties() != null ? module.getDeploymentProperties().getTrackHistory() : false; Properties[] properties = extractConsumerProducerProperties(module); Map<String, Object> historyProperties = null; if (trackHistory) { historyProperties = extractHistoryProperties(module); addHistoryTag(module, historyProperties); } MessageChannel outputChannel = module.getComponent(MODULE_OUTPUT_CHANNEL, MessageChannel.class); if (outputChannel != null) { bindMessageProducer(outputChannel, getOutputChannelName(module), properties[1]); String tapChannelName = buildTapChannelName(module); tappableChannels.put(tapChannelName, outputChannel); if (isTapActive(tapChannelName)) { createAndBindTapChannel(tapChannelName, outputChannel); } if (trackHistory) { track(module, outputChannel, historyProperties); } } MessageChannel inputChannel = module.getComponent(MODULE_INPUT_CHANNEL, MessageChannel.class); if (inputChannel != null) { bindMessageConsumer(inputChannel, getInputChannelName(module), properties[0]); if (trackHistory && module.getType().equals(ModuleType.sink)) { track(module, inputChannel, historyProperties); } } }
Source:
public void testFilterWithEmptyString() { mockFilterObserver.setName(""); assert mockFilterObserver.getFilteredInstalledApplications().size() == 1; }

Target:
public void testFilterWithEmptyString() { mockFilterObserver.setName(""); assertEquals(1, mockFilterObserver.getFilteredInstalledApplications().size()); }
Source:
public void setUserInfo() { AQuery aq = new AQuery(this, infoView); ImageView avatarImage = (ImageView) infoView.findViewById(R.id.avatar); AvatarLoader avatarLoader = new AvatarLoader(this); String email = PreferenceUtils.getValue(this, PreferenceUtils.KEY_USER_ACCOUNT); avatarLoader.load(email, avatarImage); aq.id(R.id.user_name).text(Utils.getNameFromEmail(this, email)); }

Target:
public void setUserInfo() { AQuery aq = new AQuery(this, infoView); ImageView avatarImage = (ImageView) infoView.findViewById(R.id.avatar); AvatarLoader avatarLoader = new AvatarLoader(this); String email = PreferenceUtils.getString(this, PreferenceUtils.KEY_USER_ACCOUNT); avatarLoader.load(email, avatarImage); aq.id(R.id.user_name).text(Utils.getNameFromEmail(this, email)); }
Source:
public void testLoadList() { storage.reloadTemplateMaps();; List<ServerTemplate> templates = storage.load(); assertEquals("Mismatched number of server templates",templateMap.values().size(),templates.size()); templateMap.values().forEach(value -> { assertTrue("Server template not found",templates.contains(value)); }); }

Target:
public void testLoadList() { storage.reloadTemplateMaps(); List<ServerTemplate> templates = storage.load(); assertEquals("Mismatched number of server templates",templateMap.values().size(),templates.size()); templateMap.values().forEach(value -> { assertTrue("Server template not found",templates.contains(value)); }); }
Source:
private Map<Integer, SumCountData> getSumCountMapFromDDBItem(final Map<String, AttributeValue> item) { if (item.containsKey(this.name)) { final ObjectMapper mapper = new ObjectMapper(); final TypeFactory typeFactory = mapper.getTypeFactory(); final MapType mapType = typeFactory.constructMapType(Map.class, Integer.class, SumCountData.class); try { final String stringToProcess = getAttributeFromDDBItem(item).getS(); return mapper.readValue(stringToProcess, mapType); } catch (JsonMappingException e) { LOGGER.warn("exception={} action=received-malformed-attribute item={}", e.getMessage(), item.toString()); } catch (IOException e) { LOGGER.warn("exception={} action=received-io-exception item={}", e.getMessage(), item.toString()); } } return Maps.newHashMap(); }

Target:
private Map<Integer, SumCountData> getSumCountMapFromDDBItem(final Map<String, AttributeValue> item) { if (item.containsKey(this.name)) { final ObjectMapper mapper = new ObjectMapper(); final TypeFactory typeFactory = mapper.getTypeFactory(); final MapType mapType = typeFactory.constructMapType(Map.class, Integer.class, SumCountData.class); try { final String stringToProcess = getAttributeFromDDBItem(item).getS(); return mapper.readValue(stringToProcess, mapType); } catch (JsonMappingException e) { LOGGER.error("exception={} action=received-malformed-attribute item={}", e.getMessage(), item.toString()); } catch (IOException e) { LOGGER.error("exception={} action=received-io-exception item={}", e.getMessage(), item.toString()); } } return Maps.newHashMap(); }
Source:
public void onEvent(Event event, Object source, Object data) { CancelableEvent cancelableEvent = (CancelableEvent) event; if (cancelableEvent.isCanceled()) { logger.warn("Skipping " + this.getName() + " as the event is already cancelled."); return; } if (this.configuration.getDocumentProtection() == DocumentProtection.NONE) { return; } Job job = (Job) source; if (!job.getRequest().isInteractive()) { logger .warn("XAR Extension Documents Deleting Listener will not check the document in non-interactive mode."); return; } Map<EntityReference, EntitySelection> concernedEntities = (Map<EntityReference, EntitySelection>) data; ExtensionBreakingQuestion question = new ExtensionBreakingQuestion(concernedEntities); for (EntitySelection entitySelection : concernedEntities.values()) { if (entitySelection.getEntityReference() instanceof DocumentReference) { checkIfDeleteIsAllowed(entitySelection, question); } } if (!question.getExtensions().isEmpty()) { try { boolean ack = job.getStatus().ask(question, 5, TimeUnit.MINUTES); if (!ack) { String message = "The question has been asked, however no answer has been received."; this.logger.warn(message); cancelableEvent.cancel(message); } } catch (InterruptedException e) { this.logger.warn("Confirm question has been interrupted."); cancelableEvent.cancel("Question has been interrupted."); } } }

Target:
public void onEvent(Event event, Object source, Object data) { Job job = (Job) source; CancelableEvent cancelableEvent = (CancelableEvent) event; if (!this.shouldListenerBeTriggered(job, cancelableEvent)) { return; } Map<EntityReference, EntitySelection> concernedEntities = (Map<EntityReference, EntitySelection>) data; ExtensionBreakingQuestion question = new ExtensionBreakingQuestion(concernedEntities); for (EntitySelection entitySelection : concernedEntities.values()) { if (entitySelection.getEntityReference() instanceof DocumentReference) { checkIfDeleteIsAllowed(entitySelection, question); } } JobStatus jobStatus = job.getStatus(); if (!question.getExtensions().isEmpty()) { question.unselectAll(); try { boolean ack = jobStatus.ask(question, 5, TimeUnit.MINUTES); if (!ack) { String message = "The question has been asked, however no answer has been received."; this.logger.warn(message); cancelableEvent.cancel(message); } } catch (InterruptedException e) { this.logger.warn("Confirm question has been interrupted."); cancelableEvent.cancel("Question has been interrupted."); } if (jobStatus instanceof CancelableJobStatus) { CancelableJobStatus cancelableJobStatus = (CancelableJobStatus) jobStatus; if (cancelableJobStatus.isCanceled()) { cancelableEvent.cancel(); } if (cancelableEvent.isCanceled()) { cancelableJobStatus.cancel(); } } } }
Source:
public void populateListItem() { Context appContext = context.getApplicationContext(); BookmarksDBAdapter a = new BookmarksDBAdapter(appContext); List<Bookmark> bookmarksList = a.getBookmarks(0); listItemList = new ArrayList(); for (int i = 0; i < bookmarksList.size(); i++) { Bookmark bm = bookmarksList.get(i); ItemList item = new ItemList(); item.sura = QuranInfo.getSuraNameFromPage(appContext, bm.page); item.page = bm.page; listItemList.add(item); } }

Target:
public void populateListItem() { int dateAdded = 0; Context appContext = context.getApplicationContext(); BookmarksDBAdapter mBookmarksDBAdapter = new BookmarksDBAdapter(appContext); List<Bookmark> bookmarksList = mBookmarksDBAdapter.getBookmarks(dateAdded); suraPageItemList = new ArrayList(); for (int i = 0; i < bookmarksList.size(); i++) { Bookmark bm = bookmarksList.get(i); SuraPageItem item = new SuraPageItem(); item.sura = QuranInfo.getSuraNameFromPage(appContext, bm.page); item.page = bm.page; suraPageItemList.add(item); } }
Source:
private LifecycleMessageHandler<ReceivedInstantClusterIdAwareMessage> createMessageHandlerChain( CoreServerModule coreServerModule ) { RaftMessageApplier messageApplier = new RaftMessageApplier( localDatabase, logProvider, consensusModule.raftMachine(), coreServerModule.downloadService(), coreServerModule.commandApplicationProcess() ); ComposableMessageHandler monitoringHandler = RaftMessageMonitoringHandler.composable( platformModule.clock, platformModule.monitors ); int queueSize = platformModule.config.get( CausalClusteringSettings.raft_in_queue_size ); int maxBatch = platformModule.config.get( CausalClusteringSettings.raft_in_queue_max_batch ); Function<Runnable, ContinuousJob> jobFactory = ( Runnable runnable ) -> new ContinuousJob( platformModule.jobScheduler, new JobScheduler.Group( "raft-batch-handler", NEW_THREAD ), runnable, logProvider ); ComposableMessageHandler batchingMessageHandler = BatchingMessageHandler.composable( queueSize, maxBatch, jobFactory, logProvider ); ComposableMessageHandler leaderAvailabilityHandler = LeaderAvailabilityHandler.composable( consensusModule.getLeaderAvailabilityTimers(), consensusModule.raftMachine()::term ); ComposableMessageHandler clusterBindingHandler = ClusterBindingHandler.composable( logProvider ); return clusterBindingHandler .compose( leaderAvailabilityHandler ) .compose( batchingMessageHandler ) .compose( clusterBindingHandler ) .compose( monitoringHandler ) .apply( messageApplier ); }

Target:
private LifecycleMessageHandler<ReceivedInstantClusterIdAwareMessage> createMessageHandlerChain( CoreServerModule coreServerModule ) { RaftMessageApplier messageApplier = new RaftMessageApplier( localDatabase, logProvider, consensusModule.raftMachine(), coreServerModule.downloadService(), coreServerModule.commandApplicationProcess() ); ComposableMessageHandler monitoringHandler = RaftMessageMonitoringHandler.composable( platformModule.clock, platformModule.monitors ); int queueSize = platformModule.config.get( CausalClusteringSettings.raft_in_queue_size ); int maxBatch = platformModule.config.get( CausalClusteringSettings.raft_in_queue_max_batch ); Function<Runnable, ContinuousJob> jobFactory = ( Runnable runnable ) -> new ContinuousJob( platformModule.jobScheduler, new JobScheduler.Group( "raft-batch-handler", NEW_THREAD ), runnable, logProvider ); ComposableMessageHandler batchingMessageHandler = BatchingMessageHandler.composable( queueSize, maxBatch, jobFactory, logProvider ); ComposableMessageHandler leaderAvailabilityHandler = LeaderAvailabilityHandler.composable( consensusModule.getLeaderAvailabilityTimers(), consensusModule.raftMachine()::term ); ComposableMessageHandler clusterBindingHandler = ClusterBindingHandler.composable( logProvider ); return clusterBindingHandler .compose( leaderAvailabilityHandler ) .compose( batchingMessageHandler ) .compose( monitoringHandler ) .apply( messageApplier ); }
Source:
public void testErrorSameAttrMultipleTypes() { LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(new Configuration()); @SuppressWarnings("MismatchedReadAndWriteOfArray") Exception ex = null; try { ContextUtils.buildAttributeMaps(Sets.newHashSet(MockContext1.class, MockContext2.class)); } catch (ValidationException e) { ex = e; } Assert.assertNotNull(ex); ContextUtils.initialize(); }

Target:
public void testErrorSameAttrMultipleTypes() { LogicalPlanConfiguration lpc = new LogicalPlanConfiguration(new Configuration()); Exception ex = null; try { ContextUtils.buildAttributeMaps(Sets.newHashSet(MockContext1.class, MockContext2.class)); } catch (ValidationException e) { ex = e; } Assert.assertNotNull(ex); Assert.assertTrue(ex.getMessage().contains("is defined with two different types in two different context classes:")); ContextUtils.initialize(); }
Source:
public CurrentProductImpl( PlaceManager placeManager) { this.placeManager = placeManager; }

Target:
CurrentProductImpl( PlaceManager placeManager) { this.placeManager = placeManager; }