auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static HeldLocksToken acquireLock(LockService lockService, LockRequest lockRequest) { int failureCount = 0; while (true) { HeldLocksToken response; try { response = lockService.lockAndGetHeldLocks(LockClient.ANONYMOUS.getClientId(), lockRequest); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } if (response == null) { RuntimeException ex = new LockAcquisitionException( "Failed to lock using the provided lock request: " + lockRequest); log.warn("Count not lock successfully", ex); ++failureCount; if (failureCount >= NUM_RETRIES) { log.warn("Failing after tries", failureCount, ex); throw ex; } AbstractTransactionManager.sleepForBackoff(failureCount); continue; } else { return response; } } }

Target:
private static HeldLocksToken acquireLock(LockService lockService, LockRequest lockRequest) { int failureCount = 0; while (true) { HeldLocksToken response; try { response = lockService.lockAndGetHeldLocks(LockClient.ANONYMOUS.getClientId(), lockRequest); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(e); } if (response == null) { RuntimeException ex = new LockAcquisitionException( "Failed to lock using the provided lock request: " + lockRequest); log.warn("Count not lock successfully", ex); ++failureCount; if (failureCount >= NUM_RETRIES) { log.warn("Failing after tries", failureCount, ex); throw ex; } AbstractTransactionManager.sleepForBackoff(failureCount); } else { return response; } } }
Source:
public HashSet<String> getNoStatsColumns() throws StandardException { if (costEstimate == null) throw new RuntimeException("Should not be null"); HashSet<String> noStatsColumns = new HashSet<>(); CollectNodesVisitor cnv = new CollectNodesVisitor(ColumnReference.class); for (OrderedColumn oc : groupingList) { oc.accept(cnv); } for (AggregateNode an : aggregateVector) { an.accept(cnv); } List<ColumnReference> columnRefNodes = cnv.getList(); for (ColumnReference cr : columnRefNodes) { if (!cr.useRealColumnStatistics()) noStatsColumns.add(cr.getSource().getSchemaName() + "." + cr.getSource().getFullName()); } return noStatsColumns; }

Target:
public HashSet<String> getNoStatsColumns() throws StandardException { assert costEstimate != null : "Trying to get columns missing statistic but there is no cost estimation."; HashSet<String> noStatsColumns = new HashSet<>(); CollectNodesVisitor cnv = new CollectNodesVisitor(ColumnReference.class); for (OrderedColumn oc : groupingList) { oc.accept(cnv); } List<ColumnReference> columnRefNodes = cnv.getList(); for (ColumnReference cr : columnRefNodes) { if (!cr.useRealColumnStatistics()) noStatsColumns.add(cr.getSource().getSchemaName() + "." + cr.getSource().getFullName()); } return noStatsColumns; }
Source:
public void experimentSelected(TmfExperimentSelectedSignal signal) { if (signal != null) { if (fExperiment == null || signal.getExperiment().toString().compareTo(fExperiment.toString()) != 0) { fStatsViewers.clear(); fExperiment = signal.getExperiment(); createStatisticsViewers(); fStatsViewers.layout(); TmfStatisticsViewer statViewer; for (ITmfViewer viewer : fStatsViewers.getViewers()) { statViewer = (TmfStatisticsViewer) viewer; setInput(statViewer, fExperiment.getTraces()); } if (fRequestData) { TmfExperimentRangeUpdatedSignal updateSignal = new TmfExperimentRangeUpdatedSignal(null, fExperiment, fExperiment.getTimeRange()); TmfStatisticsViewer statsViewer; for (ITmfViewer viewer : fStatsViewers.getViewers()) { statsViewer = (TmfStatisticsViewer) viewer; statsViewer.experimentRangeUpdated(updateSignal); } fRequestData = false; } } } }

Target:
public void experimentSelected(TmfExperimentSelectedSignal signal) { if (signal != null) { if (fExperiment == null || signal.getExperiment().toString().compareTo(fExperiment.toString()) != 0) { fStatsViewers.clear(); fExperiment = signal.getExperiment(); createStatisticsViewers(); fStatsViewers.layout(); TmfStatisticsViewer statViewer; for (ITmfViewer viewer : fStatsViewers.getViewers()) { if (!(viewer instanceof TmfStatisticsViewer)) { Activator.getDefault().logError("Error - cannot cast viewer to a statistics viewer"); continue; } statViewer = (TmfStatisticsViewer) viewer; setInput(statViewer, fExperiment.getTraces()); } if (fRequestData) { TmfExperimentRangeUpdatedSignal updateSignal = new TmfExperimentRangeUpdatedSignal(null, fExperiment, fExperiment.getTimeRange()); TmfStatisticsViewer statsViewer; fExperiment.startSynch(new TmfStartSynchSignal(0)); for (ITmfViewer viewer : fStatsViewers.getViewers()) { if (!(viewer instanceof TmfStatisticsViewer)) { Activator.getDefault().logError("Error - cannot cast viewer to a statistics viewer"); continue; } statsViewer = (TmfStatisticsViewer) viewer; statsViewer.experimentRangeUpdated(updateSignal); } fExperiment.endSynch(new TmfEndSynchSignal(0)); fRequestData = false; } } } }
Source:
public void test() throws Exception { Verifier verifier = getVerifier("/368985_licenseFeature", false); verifier.getCliOptions().add("-DnewVersion=" + NEW_MAVEN_VERSION); verifier.getCliOptions().add("-Dartifacts=licenseFeature"); verifier.executeGoal("org.eclipse.tycho:tycho-versions-plugin:" + TychoVersion.getTychoVersion() + ":set-version"); verifier.verifyErrorFreeLog(); File licenseFeatureDir = new File(verifier.getBasedir(), "feature.license"); Feature licenseFeature = Feature.read(new File(licenseFeatureDir, "feature.xml")); assertEquals(NEW_OSGI_VERSION, licenseFeature.getVersion()); File otherFeatureDir = new File(verifier.getBasedir(), "feature"); Feature otherFeature = Feature.read(new File(otherFeatureDir, "feature.xml")); assertEquals(NEW_OSGI_VERSION, otherFeature.getLicenseFeatureVersion()); assertNotEquals(NEW_OSGI_VERSION, otherFeature.getVersion()); }

Target:
public void test() throws Exception { Verifier verifier = getVerifier("/424945_setLicenseFeatureVersion", false); verifier.getCliOptions().add("-DnewVersion=" + NEW_MAVEN_VERSION); verifier.executeGoal("org.eclipse.tycho:tycho-versions-plugin:" + TychoVersion.getTychoVersion() + ":set-version"); verifier.verifyErrorFreeLog(); File licenseFeatureDir = new File(verifier.getBasedir(), "license.feature"); Feature licenseFeature = Feature.read(new File(licenseFeatureDir, "feature.xml")); assertEquals(NEW_OSGI_VERSION, licenseFeature.getVersion()); File otherFeatureDir = new File(verifier.getBasedir(), "other.feature"); Feature otherFeature = Feature.read(new File(otherFeatureDir, "feature.xml")); assertEquals(NEW_OSGI_VERSION, otherFeature.getLicenseFeatureVersion()); }
Source:
private void setParentInvoice(final InvoiceModelDao invoice, final List<Tag> invoicesTags, final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final InternalTenantContext childContext) { final InvoiceParentChildrenSqlDao invoiceParentChildrenSqlDao = entitySqlDaoWrapperFactory.become(InvoiceParentChildrenSqlDao.class); final List<InvoiceParentChildModelDao> mappings = invoiceParentChildrenSqlDao.getParentChildMappingsByChildInvoiceIds(ImmutableList.of(invoice.getId().toString()), childContext); if (mappings.isEmpty()) { return; } Preconditions.checkState(mappings.size() == 1, String.format("Expected only one parent mapping for invoice", invoice.getId())); final UUID parentInvoiceId = mappings.get(0).getParentInvoiceId(); final InvoiceSqlDao invoiceSqlDao = entitySqlDaoWrapperFactory.become(InvoiceSqlDao.class); final InvoiceModelDao parentInvoice = invoiceSqlDao.getById(parentInvoiceId.toString(), childContext); final Long parentAccountRecordId = internalCallContextFactory.getRecordIdFromObject(parentInvoice.getAccountId(), ObjectType.ACCOUNT, internalCallContextFactory.createTenantContext(childContext)); final InternalTenantContext parentContext = internalCallContextFactory.createInternalTenantContext(childContext.getTenantRecordId(), parentAccountRecordId); populateChildren(parentInvoice, invoicesTags, entitySqlDaoWrapperFactory, parentContext); invoice.addParentInvoice(parentInvoice); }

Target:
private void setParentInvoice(final InvoiceModelDao invoice, final List<Tag> invoicesTags, final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory, final InternalTenantContext childContext) { final InvoiceParentChildrenSqlDao invoiceParentChildrenSqlDao = entitySqlDaoWrapperFactory.become(InvoiceParentChildrenSqlDao.class); final List<InvoiceParentChildModelDao> mappings = invoiceParentChildrenSqlDao.getParentChildMappingsByChildInvoiceIds(ImmutableList.of(invoice.getId().toString()), childContext); if (mappings.isEmpty()) { return; } Preconditions.checkState(mappings.size() == 1, String.format("Expected only one parent mapping for invoice %s", invoice.getId())); final UUID parentInvoiceId = mappings.get(0).getParentInvoiceId(); final InvoiceSqlDao invoiceSqlDao = entitySqlDaoWrapperFactory.become(InvoiceSqlDao.class); final InvoiceModelDao parentInvoice = invoiceSqlDao.getById(parentInvoiceId.toString(), childContext); final Long parentAccountRecordId = internalCallContextFactory.getRecordIdFromObject(parentInvoice.getAccountId(), ObjectType.ACCOUNT, internalCallContextFactory.createTenantContext(childContext)); final InternalTenantContext parentContext = internalCallContextFactory.createInternalTenantContext(childContext.getTenantRecordId(), parentAccountRecordId); populateChildren(parentInvoice, invoicesTags, entitySqlDaoWrapperFactory, parentContext); invoice.addParentInvoice(parentInvoice); }
Source:
public SystemExitException usage(String error) { err.println("Usage: " + programName + " projects [project]"); showCommonOptions(); return systemExit(error); }

Target:
public SystemExitException usage(String error) { err.println("Usage: " + programName + " projects [name]"); showCommonOptions(); return systemExit(error); }
Source:
public Response act(final Request req) throws IOException { final Href href = new RqHref.Base(req).href(); final Iterator<String> token = href.param("token").iterator(); String tokenkey = ""; final Inbox inbox; long number = 0; while (token.hasNext()) { tokenkey = token.next(); } if (tokenkey.isEmpty()) { inbox = new RqAlias(this.base, req).alias().inbox(); } else if (this.tokens.containsKey(tokenkey)) { final Object[] cache = this.tokens.get(tokenkey); final Date today = new Date(); final long diff = today.getTime() - ((Date) cache[0]).getTime(); if ((TimeUnit.MILLISECONDS.toDays(diff)) <= 2) { inbox = (Inbox) cache[1]; } else { this.tokens.remove(tokenkey); inbox = new RqAlias(this.base, req).alias().inbox(); } } else { inbox = new RqAlias(this.base, req).alias().inbox(); this.tokens.put(tokenkey, new Object[] {new Date(), inbox}); } number = inbox.start(); final Bout bout = inbox.bout(number); final StringBuilder msg = new StringBuilder( String.format("new bout #%d started", number) ); this.rename(bout, msg, href); this.invite(bout, msg, href); final Iterator<String> post = href.param("post").iterator(); while (post.hasNext()) { try { bout.messages().post(post.next()); } catch (final Messages.BrokenPostException ex) { this.discard(bout); throw new RsFailure(ex); } msg.append(", message posted"); } throw new RsForward( new RsFlash(msg.toString()), new RqHref.Smart(new RqHref.Base(req)).home().path("b").path( Long.toString(number) ) ); }

Target:
public Response act(final Request req) throws IOException { final Href href = new RqHref.Base(req).href(); final Iterator<String> token = href.param("token").iterator(); String key = ""; long diff = 0; final Inbox inbox; while (token.hasNext()) { key = token.next(); } if (key.isEmpty()) { inbox = new RqAlias(this.base, req).alias().inbox(); } else if (this.tokens.containsKey(key)) { final Pair<Date, Inbox> cached = this.tokens.get(key); diff = (new Date()).getTime() - (cached.getLeft()).getTime(); if ((TimeUnit.MILLISECONDS.toDays(diff)) <= 2) { inbox = cached.getRight(); } else { this.tokens.remove(key); inbox = new RqAlias(this.base, req).alias().inbox(); } } else { inbox = new RqAlias(this.base, req).alias().inbox(); this.tokens.put(key, Pair.of(new Date(), inbox)); } diff = (new Date()).getTime() - checked.getTime(); if ((TimeUnit.MILLISECONDS.toHours(diff)) >= 1) { checked = new Date(); clearCache(); } final long number = inbox.start(); final Bout bout = inbox.bout(number); final StringBuilder msg = new StringBuilder( String.format("new bout #%d started", number) ); this.rename(bout, msg, href); this.invite(bout, msg, href); final Iterator<String> post = href.param("post").iterator(); while (post.hasNext()) { try { bout.messages().post(post.next()); } catch (final Messages.BrokenPostException ex) { this.discard(bout); throw new RsFailure(ex); } msg.append(", message posted"); } throw new RsForward( new RsFlash(msg.toString()), new RqHref.Smart(new RqHref.Base(req)).home().path("b").path( Long.toString(number) ) ); }
Source:
private void validatePositionOfPortOnContainer(String containerName, String portName) { SWTBotGefEditPart swtbotContainerEditPart = editor.getEditPart(containerName); assertNotNull("No container edit part found with the name \"" + containerName + "\"", swtbotContainerEditPart); EditPart containerSquareEP = swtbotContainerEditPart.part(); assertTrue("The parent edit part of the container label is not a AbstractBorderedShapeEditPart", containerSquareEP.getParent() instanceof AbstractBorderedShapeEditPart); final AbstractBorderedShapeEditPart containerEP = (AbstractBorderedShapeEditPart) containerSquareEP.getParent(); final AbstractDiagramBorderNodeEditPart portEP = findPortInContainer(containerEP, portName); assertNotNull("No port edit part found with the name \"" + portName + "\"", portEP); if (ARE_PINNED_PORTS) { pinDiagramElement((DDiagramElement) ((Node) portEP.getModel()).getElement()); } boolean validateEdgeFromPortDoesNotCrossParentContainer = validateEdgeFromPortDoesNotCrossParentContainer(containerEP, portEP); assertTrue("The port " + portName + " has an edge that cross the parent container " + containerName, validateEdgeFromPortDoesNotCrossParentContainer); boolean validateEdgeFromPortHaveBendpointsReseted = validateEdgeFromPortHaveBendpointsReseted(containerEP, portEP); assertTrue("The port " + portName + " has an edge that don't have its bendpoints reseted " + containerName, validateEdgeFromPortHaveBendpointsReseted); }

Target:
private void validatePositionOfPortOnContainer(String containerName, String portName) { SWTBotGefEditPart swtbotContainerEditPart = editor.getEditPart(containerName); assertNotNull("No container edit part found with the name \"" + containerName + "\"", swtbotContainerEditPart); EditPart containerSquareEP = swtbotContainerEditPart.part(); assertTrue("The parent edit part of the container label is not a AbstractBorderedShapeEditPart", containerSquareEP.getParent() instanceof AbstractBorderedShapeEditPart); final AbstractBorderedShapeEditPart containerEP = (AbstractBorderedShapeEditPart) containerSquareEP.getParent(); final AbstractDiagramBorderNodeEditPart portEP = findPortInContainer(containerEP, portName); assertNotNull("No port edit part found with the name \"" + portName + "\"", portEP); if (ARE_PINNED_PORTS) { pinDiagramElement((DDiagramElement) ((Node) portEP.getModel()).getElement()); } boolean validateEdgeFromPortDoesNotCrossParentContainer = validateEdgeFromPortDoesNotCrossParentContainer(containerEP, portEP); assertTrue("The port " + portName + " has an edge that cross the parent container " + containerName, validateEdgeFromPortDoesNotCrossParentContainer); boolean validateEdgeFromPortHaveBendpointsReset = validateEdgeFromPortHaveBendpointsReset(containerEP, portEP); assertTrue("The port " + portName + " has an edge that don't have its bendpoints reset " + containerName, validateEdgeFromPortHaveBendpointsReset); }
Source:
private SecurityGroup generateSecurityGroup(ClaudiaData claudiaData, TierInstance tierInstance) throws EntityNotFoundException { SecurityGroup securityGroup = new SecurityGroup(); securityGroup.setName("sg_" + claudiaData.getService() + "_" + claudiaData.getVdc() + "_" + tierInstance.getName()); log.info("Generate Object Security Group " + "sg_" + claudiaData.getService() + "_" + claudiaData.getVdc() + "_" + tierInstance.getTier().getRegion() + "_" + tierInstance.getName()); List<Rule> rules = getDefaultRules(); if (tierInstance.getTier().getProductReleases() != null) { for (ProductRelease productRelease : tierInstance.getTier().getProductReleases()) { getRulesFromProduct(productRelease, rules); } } securityGroup.setRules(rules); return securityGroup; }

Target:
private SecurityGroup generateSecurityGroup(ClaudiaData claudiaData, TierInstance tierInstance) throws EntityNotFoundException { SecurityGroup securityGroup = new SecurityGroup(); securityGroup.setName("sg_" + claudiaData.getService() + "_" + claudiaData.getVdc() + "_" + tierInstance.getName()); log.info("Generate Object Security Group " + "sg_" + claudiaData.getService() + "_" + claudiaData.getVdc() + "_" + tierInstance.getTier().getRegion() + "_" + tierInstance.getName()); List<Rule> rules = getDefaultRules(); List<ProductRelease> productReleases = tierInstance.getTier().getProductReleases(); if (productReleases != null) { for (ProductRelease productRelease : tierInstance.getTier().getProductReleases()) { getRulesFromProduct(productRelease, rules); } } securityGroup.setRules(rules); return securityGroup; }
Source:
public Integer fromProto(Commons.IPSubnet value, Type clazz) { return IPv4Addr.apply(value.getAddress()).toInt(); }

Target:
public Integer fromProto(Commons.IPSubnet value, Type clazz) { return new IPv4Subnet(value.getAddress(), value.getPrefixLength()) .getIntAddress(); }
Source:
public void close() throws IOException { databases.clear(); functions.clear(); indexes.clear(); indexes.clear(); }

Target:
public void close() throws IOException { databases.clear(); functions.clear(); indexes.clear(); }
Source:
void setItemName(String name) { if (name != null && !name.trim().isEmpty()) { nameLabel.setText(name + ":"); } else { nameLabel.setText(name); } }

Target:
void setItemName(String name) { if (name != null && !name.trim().isEmpty() && !name.endsWith(":")) { nameLabel.setText(name + ":"); } else { nameLabel.setText(name); } }
Source:
public static void updateSettingsBasedOnCurrentSystemProperties() { ourOptmizeSingleElementInExpression = !("true".equals(System.getProperty(HFJ_FORCE_IN_CLAUSES_HF_50))); if (ourOptmizeSingleElementInExpression) { ourLog.warn("Forcing IN(..) clauses for single element SQL predicates"); } }

Target:
public static void updateSettingsBasedOnCurrentSystemProperties() { ourOptmizeSingleElementInExpression = !("true".equals(System.getProperty(HFJ_FORCE_IN_CLAUSES_HF_50))); if (!ourOptmizeSingleElementInExpression) { ourLog.warn("Forcing IN(..) clauses for single element SQL predicates"); } }
Source:
public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(namespace); parcel.writeString(text); parcel.writeString(fragment); parcel.writeParcelable(properties, flags); parcel.writeParcelable(site, flags); parcel.writeString(thumbUrl); parcel.writeString(description); }

Target:
public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(namespace); parcel.writeString(text); parcel.writeString(fragment); parcel.writeParcelable(site, flags); if (hasProperties()) { parcel.writeParcelable(properties, flags); } parcel.writeString(thumbUrl); parcel.writeString(description); }
Source:
public void testBodyConversion() throws Throwable { try ( Connection conn = cf.createConnection(); ) { Session sess = conn.createSession(); MessageProducer producer = sess.createProducer(queue); MessageConsumer cons = sess.createConsumer(queue); conn.start(); BytesMessage bytesMessage = sess.createBytesMessage(); producer.send(bytesMessage); Message msg = cons.receiveNoWait(); if (conn instanceof org.apache.qpid.jms.JmsConnection) { Assert.assertEquals(null, msg.getBody(String.class)); } else if (conn instanceof org.apache.activemq.artemis.jms.client.ActiveMQConnection) { try { msg.getBody(String.class); fail("Exception expected"); } catch (Exception e) { } } } }

Target:
public void testBodyConversion() throws Throwable { try ( Connection conn = cf.createConnection(); ) { Session sess = conn.createSession(); MessageProducer producer = sess.createProducer(queue); MessageConsumer cons = sess.createConsumer(queue); conn.start(); BytesMessage bytesMessage = sess.createBytesMessage(); BytesMessage bytesMessage2 = sess.createBytesMessage(); bytesMessage2.writeInt(42); bytesMessage2.reset(); producer.send(bytesMessage); Message msg = cons.receiveNoWait(); producer.send(bytesMessage2); Message msg2 = cons.receiveNoWait(); assertNotNull(msg); assertNotNull(msg2); Assert.assertNull(msg.getBody(java.lang.Object.class)); Assert.assertNull(msg.getBody(byte[].class)); Assert.assertNull(msg.getBody(String.class)); Assert.assertNotNull(msg2.getBody(byte[].class)); Assert.assertNotNull(msg2.getBody(java.lang.Object.class)); } }
Source:
private Germplasm generateTestGermplasm(final int gid, final int methodId) { final Germplasm germplasm = new Germplasm(); germplasm.setGid(gid); germplasm.setGnpgs(2); final Method method = new Method(methodId); if(methodId > 1) { method.setMname("Backcross"); germplasm.setGpid1(0); germplasm.setGpid2(0); } germplasm.setMethod(method); germplasm.setMethodId(methodId); this.germplasmMap.put(new CropGermplasmKey(AncestryTreeServiceTest.MAIZE, gid), germplasm); this.methodsMap.put(new CropMethodKey(AncestryTreeServiceTest.MAIZE, methodId), method); return germplasm; }

Target:
private Germplasm generateTestGermplasm(final int gid, final int methodId) { final Germplasm germplasm = new Germplasm(); germplasm.setGid(gid); germplasm.setGnpgs(2); final Method method = new Method(methodId); germplasm.setMethod(method); germplasm.setMethodId(methodId); this.germplasmMap.put(new CropGermplasmKey(AncestryTreeServiceTest.MAIZE, gid), germplasm); this.methodsMap.put(new CropMethodKey(AncestryTreeServiceTest.MAIZE, methodId), method); return germplasm; }
Source:
public DatastreamTaskImpl(DatastreamTaskImpl predecessor, Collection<String> partitionsV2) { if (!predecessor.isLocked() && !predecessor.getPartitionsV2().isEmpty()) { throw new DatastreamTransientException("task " + predecessor.getDatastreamTaskName() + " is not locked, " + "the previous assignment has not be picked up"); } _datastreams = predecessor._datastreams; _taskPrefix = predecessor._taskPrefix; _connectorType = predecessor._connectorType; _id = UUID.randomUUID().toString(); _transportProviderName = predecessor._transportProviderName; _partitions = new ArrayList<>(); _partitionsV2 = new ArrayList<>(partitionsV2); _zkAdapter = predecessor._zkAdapter; _eventProducer = predecessor._eventProducer; _checkpoints = predecessor._checkpoints; _transportProviderName = predecessor._transportProviderName; _destinationSerDes = predecessor._destinationSerDes; _dependencies = new ArrayList<>(); _dependencies.add(predecessor.getDatastreamTaskName()); if (partitionsV2.size() > MAX_PARTITION_NUM) { LOG.warn("It's suggest to keep the the size of parition v2 under to avoid hitting Znode size limit" , MAX_PARTITION_NUM); } }

Target:
public DatastreamTaskImpl(DatastreamTaskImpl predecessor, Collection<String> partitionsV2) { if (!predecessor.isLocked() && !predecessor.getPartitionsV2().isEmpty()) { throw new DatastreamTransientException("task " + predecessor.getDatastreamTaskName() + " is not locked, " + "the previous assignment has not been picked up"); } _datastreams = predecessor._datastreams; _taskPrefix = predecessor._taskPrefix; _connectorType = predecessor._connectorType; _id = UUID.randomUUID().toString(); _transportProviderName = predecessor._transportProviderName; _partitions = new ArrayList<>(); _partitionsV2 = new ArrayList<>(partitionsV2); _zkAdapter = predecessor._zkAdapter; _eventProducer = predecessor._eventProducer; _checkpoints = predecessor._checkpoints; _transportProviderName = predecessor._transportProviderName; _destinationSerDes = predecessor._destinationSerDes; _dependencies = new ArrayList<>(); _dependencies.add(predecessor.getDatastreamTaskName()); }
Source:
private static OutputStream buildOutputStream(final File outputFile, final boolean createMd5, final boolean createIndex) throws IOException { OutputStream outputStream = new FileOutputStream(outputFile); if (createMd5) outputStream = new Md5CalculatingOutputStream(outputStream, new File(outputFile.getAbsolutePath() + ".md5")); if (createIndex) outputStream = new StreamInflatingIndexingOutputStream(outputStream, new File(outputFile.getParentFile(), IOUtil.basename(outputFile) + BAMIndex.BAMIndexSuffix)); return outputStream; }

Target:
private static OutputStream buildOutputStream(final File outputFile, final boolean createMd5, final boolean createIndex) throws IOException { OutputStream outputStream = new FileOutputStream(outputFile); if (createMd5) { outputStream = new Md5CalculatingOutputStream(outputStream, new File(outputFile.getAbsolutePath() + ".md5")); } if (createIndex) { outputStream = new StreamInflatingIndexingOutputStream(outputStream, new File(outputFile.getParentFile(), IOUtil.basename(outputFile) + BAMIndex.BAMIndexSuffix)); } return outputStream; }
Source:
public AnalystWorker(Properties config, TransportNetworkCache cache) { LOG.info("Analyst worker starting at {}", machineId, LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)); workOffline = Boolean.parseBoolean(config.getProperty("work-offline", "false")); if (workOffline) { LOG.info("Working offline. Avoiding internet connections and hosted services."); } String statsQueue = config.getProperty("statistics-queue"); if (workOffline || statsQueue == null) { this.taskStatisticsStore = s -> { }; } else { this.taskStatisticsStore = new SQSTaskStatisticsStore(statsQueue); } String addr = config.getProperty("broker-address"); String port = config.getProperty("broker-port"); if (addr != null) { if (port != null) { this.BROKER_BASE_URL = String.format("http://%s:%s", addr, port); } else { this.BROKER_BASE_URL = String.format("http://%s", addr); } } this.networkId = config.getProperty("initial-graph-id"); this.gridCache = new GridCache(config.getProperty("pointsets-bucket")); this.pointSetDatastore = new PointSetDatastore(10, null, false, config.getProperty("pointsets-bucket")); this.transportNetworkCache = cache; Boolean autoShutdown = Boolean.parseBoolean(config.getProperty("auto-shutdown")); this.autoShutdown = autoShutdown == null ? false : autoShutdown; startupTime = System.currentTimeMillis(); nextShutdownCheckTime = startupTime + 55 * 60 * 1000; ec2info = new EC2Info(); if (workOffline) { ec2info.region = Regions.EU_WEST_1.getName(); } else { ec2info.fetchMetadata(); } s3 = new AmazonS3Client(); }

Target:
public AnalystWorker(Properties config, TransportNetworkCache cache) { LOG.info("Analyst worker starting at {}", machineId, LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME)); workOffline = Boolean.parseBoolean(config.getProperty("work-offline", "false")); if (workOffline) { LOG.info("Working offline. Avoiding internet connections and hosted services."); } String statsQueue = config.getProperty("statistics-queue"); if (workOffline || statsQueue == null) { this.taskStatisticsStore = s -> { }; } else { this.taskStatisticsStore = new SQSTaskStatisticsStore(statsQueue); } String addr = config.getProperty("broker-address"); String port = config.getProperty("broker-port"); if (addr != null) { if (port != null) { this.BROKER_BASE_URL = String.format("http://%s:%s", addr, port); } else { this.BROKER_BASE_URL = String.format("http://%s", addr); } } this.networkId = config.getProperty("initial-graph-id"); this.gridCache = new GridCache(config.getProperty("pointsets-bucket")); this.pointSetDatastore = new PointSetDatastore(10, null, false, config.getProperty("pointsets-bucket")); this.transportNetworkCache = cache; Boolean autoShutdown = Boolean.parseBoolean(config.getProperty("auto-shutdown")); this.autoShutdown = autoShutdown == null ? false : autoShutdown; startupTime = System.currentTimeMillis(); nextShutdownCheckTime = startupTime + 55 * 60 * 1000; ec2info = new EC2Info(); if (!workOffline) { ec2info.fetchMetadata(); } if (ec2info.region == null) { ec2info.region = Regions.EU_WEST_1.getName(); } s3 = new AmazonS3Client(); s3.setRegion(Region.getRegion(Regions.fromName(ec2info.region))); }
Source:
public BoundListTreeImpl newBounds(TypeTree classType, Optional<List<Tuple<InternalSyntaxToken, Tree>>> rests) { ImmutableList.Builder<Tree> classTypes = ImmutableList.builder(); classTypes.add(classType); if (rests.isPresent()) { for (Tuple<InternalSyntaxToken, Tree> rest : rests.get()) { classTypes.add(rest.second()); } } return new BoundListTreeImpl(classTypes.build(), Lists.<AstNode>newArrayList()); }

Target:
public BoundListTreeImpl newBounds(TypeTree classType, Optional<List<Tuple<InternalSyntaxToken, Tree>>> rests) { ImmutableList.Builder<Tree> classTypes = ImmutableList.builder(); classTypes.add(classType); if (rests.isPresent()) { for (Tuple<InternalSyntaxToken, Tree> rest : rests.get()) { classTypes.add(rest.second()); } } return new BoundListTreeImpl(classTypes.build()); }
Source:
public static void setup() { WaitUtils.waitForJobs(); SWTBotTreeItem tracesFolder = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME); tracesFolder.contextMenu().menu("Open As Experiment...", "Generic Experiment").click(); SWTBotUtils.activateEditor(fBot, "Experiment"); SWTBotTreeItem project = SWTBotUtils.selectProject(fBot, PROJECT_NAME); SWTBotTreeItem experimentItem = SWTBotUtils.getTraceProjectItem(fBot, project, "Experiments", "Experiment"); experimentItem.select(); TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace trace = traceManager.getActiveTrace(); assertTrue(String.valueOf(trace), trace instanceof TmfExperiment); TmfExperiment experiment = (TmfExperiment) trace; assertNotNull(experiment); ITmfProjectModelElement elem = TmfProjectRegistry.findElement(experiment.getResource(), true); assertTrue(elem instanceof TmfExperimentElement); fOriginalExperiment = experiment; TmfTimeRange traceCutRange = getTraceCutRange(experiment); assertNotNull(traceCutRange); fRequestedTraceCutRange = traceCutRange; ITmfTimestamp requestedTraceCutEnd = traceCutRange.getEndTime(); ITmfTimestamp requestedTraceCutStart = traceCutRange.getStartTime(); assertTrue(experiment.getTimeRange().contains(traceCutRange)); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(null, requestedTraceCutStart, requestedTraceCutEnd, experiment)); experimentItem.contextMenu("Export Time Selection as New Trace...").click(); SWTBotShell shell = fBot.shell("Export trace section to...").activate(); SWTBot dialogBot = shell.bot(); assertEquals("Experiment", dialogBot.text().getText()); dialogBot.text().setText("Experiment-trimmed"); dialogBot.button("OK").click(); SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed"); newExperiment.setFocus(); fNewExperiment = traceManager.getActiveTrace(); assertNotNull("No active trace", fNewExperiment); assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName()); WaitUtils.waitForJobs(); }

Target:
public void setup() { ITmfTimestamp requestedTraceCutEnd = fRequestedTraceCutRange.getEndTime(); ITmfTimestamp requestedTraceCutStart = fRequestedTraceCutRange.getStartTime(); assertTrue(fOriginalExperiment.getTimeRange().contains(fRequestedTraceCutRange)); TmfSignalManager.dispatchSignal(new TmfSelectionRangeUpdatedSignal(this, requestedTraceCutStart, requestedTraceCutEnd, fOriginalExperiment)); fexperimentItem.contextMenu("Export Time Selection as New Trace...").click(); SWTBotShell shell = fBot.shell("Export trace section to...").activate(); SWTBot dialogBot = shell.bot(); assertEquals("Experiment", dialogBot.text().getText()); dialogBot.text().setText("Experiment-trimmed"); dialogBot.button("OK").click(); SWTBotEditor newExperiment = fBot.editorByTitle("Experiment-trimmed"); newExperiment.setFocus(); fNewExperiment = ftraceManager.getActiveTrace(); assertNotNull("No active trace", fNewExperiment); assertEquals("Incorrect active trace", "Experiment-trimmed", fNewExperiment.getName()); WaitUtils.waitForJobs(); }
Source:
public List<Agent> getAllAgents() { return ((List<Agent>) transactionTemplate.execute((TransactionCallback) transactionStatus -> { Query query = sessionFactory.getCurrentSession().createQuery("FROM Agent where deleted = false"); query.setCacheable(true); try { return query.list(); } catch (Exception e) { return emptyList(); } })); }

Target:
public List<Agent> getAllAgents() { return ((List<Agent>) transactionTemplate.execute((TransactionCallback) transactionStatus -> { try { Query query = sessionFactory.getCurrentSession().createQuery("FROM Agent where deleted = false"); query.setCacheable(true); return query.list(); } catch (Exception e) { bomb("Error while retrieving list of all agents from DB.", e); } return emptyList(); })); }
Source:
public SimpleObject getNumberOfPatients( @RequestParam(required = true, value = "nextAppointmentDate") Date nextAppointmentDate, @RequestParam(value = "encounterTypeUuid", defaultValue = "") String encounterTypeUuid) { AdministrationService administrationService = Context.getAdministrationService(); SimpleObject response = new SimpleObject(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String returnDate = formatter.format(nextAppointmentDate); String sql = "SELECT COUNT(obs.person_id) FROM obs WHERE obs.concept_id=5096 AND obs.value_datetime='" + returnDate + "' AND obs.voided = 0"; String encounterFilterWhereClause = ""; if (!StringUtils.isEmpty(encounterTypeUuid)) { String[] encounterType = encounterTypeUuid.split(","); for (String enc : encounterType) { StringUtils.trimToEmpty(enc); } encounterFilterWhereClause = " AND obs.encounter_id IN ( SELECT encounter.encounter_id FROM encounter INNER JOIN encounter_type ON encounter.encounter_type = encounter_type.encounter_type_id WHERE encounter_type.uuid IN('" + StringUtils.join(encounterType, "','") + "'))"; } log.debug("Checking number of appointments for " + returnDate + " for encounter types " + encounterTypeUuid); List numberOfPatients = administrationService.executeSQL(sql + encounterFilterWhereClause, true); response.add("appointmentdate", returnDate); response.add("encountertypeUuid", encounterTypeUuid); response.add("appointmentcount", ((ArrayList) numberOfPatients.get(0)).get(0)); return response; }

Target:
public SimpleObject getNumberOfPatients( @RequestParam(required = true, value = "nextAppointmentDate") Date nextAppointmentDate, @RequestParam(value = "encounterTypeUuid", defaultValue = "") String encounterTypeUuid) { AdministrationService administrationService = Context.getAdministrationService(); SimpleObject response = new SimpleObject(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String returnDate = formatter.format(nextAppointmentDate); String sql = "SELECT COUNT(obs.person_id) FROM obs WHERE obs.concept_id=5096 AND obs.value_datetime='" + returnDate + "' AND obs.voided = 0"; String encounterFilterWhereClause = ""; if (!StringUtils.isEmpty(encounterTypeUuid)) { String[] encounterType = encounterTypeUuid.split(","); ArrayList<String> trimmedEncounterType = new ArrayList<String>(); for (String enc : encounterType) { trimmedEncounterType.add(StringUtils.trimToEmpty(enc)); } encounterFilterWhereClause = " AND obs.encounter_id IN ( SELECT encounter.encounter_id FROM encounter INNER JOIN encounter_type ON encounter.encounter_type = encounter_type.encounter_type_id WHERE encounter_type.uuid IN('" + StringUtils.join(trimmedEncounterType, "','") + "'))"; } log.debug("Checking number of appointments for " + returnDate + " for encounter types " + encounterTypeUuid); List numberOfPatients = administrationService.executeSQL(sql + encounterFilterWhereClause, true); response.add("appointmentdate", returnDate); response.add("encountertypeUuid", encounterTypeUuid); response.add("appointmentcount", ((ArrayList) numberOfPatients.get(0)).get(0)); return response; }
Source:
public void licenceFile(String textToShow, File licenceFile) throws ScriptFailureException, CancelException { try { final FileInputStream content = new FileInputStream(licenceFile); final StringWriter writer = new StringWriter(); IOUtils.copy(content, writer, "UTF-8"); content.close(); licence(textToShow, writer.toString()); } catch (IOException e) { throw new ScriptFailureException("Cannot acces the licence file", e); } }

Target:
public void licenceFile(String textToShow, File licenceFile) throws CancelException { try { final FileInputStream content = new FileInputStream(licenceFile); final StringWriter writer = new StringWriter(); IOUtils.copy(content, writer, "UTF-8"); content.close(); licence(textToShow, writer.toString()); } catch (IOException e) { throw new ScriptFailureException("Cannot acces the licence file", e); } }
Source:
private static String getPropertiesUpdateMessage(String msg, String key, String oldValue, String newValue) { StringBuilder buffer = new StringBuilder(); buffer.append(msg); buffer.append(key); buffer.append(" from "); buffer.append(oldValue); buffer.append(" to "); buffer.append(newValue); buffer.append("."); return buffer.toString(); }

Target:
private static String getPropertiesUpdateMessage(String msg, String key, String oldValue, String newValue) { StringBuilder buffer = new StringBuilder(); buffer.append(msg).append(key).append(" from ").append(oldValue).append(" to ").append(newValue).append("."); return buffer.toString(); }
Source:
private static void fetchDependencies(@NotNull final VirtualFile projectRoot, @NotNull final String mixPath){ final Project project = ProjectImportBuilder.getCurrentProject(); String sdkPath = project != null ? ElixirSdkType.getSdkPath(project) : null; final String elixirPath = sdkPath != null ? JpsElixirSdkType.getScriptInterpreterExecutable(sdkPath).getAbsolutePath() : JpsElixirSdkType.getExecutableFileName(JpsElixirSdkType.SCRIPT_INTERPRETER); ProgressManager.getInstance().run(new Task.Modal(project, "Fetching dependencies", true){ @Override public void run(@NotNull final ProgressIndicator indicator) { indicator.setIndeterminate(true); GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.withWorkDirectory(projectRoot.getCanonicalPath()); commandLine.setExePath(elixirPath); commandLine.addParameter(mixPath); commandLine.addParameter("deps.get"); try{ OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getPreparedCommandLine(Platform.current())); handler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(ProcessEvent event, Key outputType) { String text = event.getText(); indicator.setText2(text); } }); ProcessTerminatedListener.attach(handler); handler.startNotify(); handler.waitFor(); indicator.setText2("Rfreshing"); }catch (ExecutionException e){ LOG.warn(e); } } }); }

Target:
private static void fetchDependencies(@NotNull final VirtualFile projectRoot, @NotNull final String mixPath){ final Project project = ProjectImportBuilder.getCurrentProject(); String sdkPath = project != null ? ElixirSdkType.getSdkPath(project) : null; final String elixirPath = sdkPath != null ? JpsElixirSdkType.getScriptInterpreterExecutable(sdkPath).getAbsolutePath() : JpsElixirSdkType.getExecutableFileName(JpsElixirSdkType.SCRIPT_INTERPRETER); ProgressManager.getInstance().run(new Task.Modal(project, "Fetching dependencies", true){ @Override public void run(@NotNull final ProgressIndicator indicator) { indicator.setIndeterminate(true); GeneralCommandLine commandLine = new GeneralCommandLine(); commandLine.withWorkDirectory(projectRoot.getCanonicalPath()); commandLine.setExePath(elixirPath); commandLine.addParameter(mixPath); commandLine.addParameter("deps.get"); try{ OSProcessHandler handler = new OSProcessHandler(commandLine.createProcess(), commandLine.getPreparedCommandLine(Platform.current())); handler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(ProcessEvent event, Key outputType) { String text = event.getText(); indicator.setText2(text); } }); ProcessTerminatedListener.attach(handler); handler.startNotify(); handler.waitFor(); indicator.setText2("Refreshing"); }catch (ExecutionException e){ LOG.warn(e); } } }); }
Source:
public CardModel create(PopularSpeciesInfo popularSpeciesInfo) { List<Pair<String, Optional<String>>> content = new ArrayList<>(); content.add(Pair.of(popularSpeciesInfo.totalExperiments() + " experiments", Optional.empty())); if(popularSpeciesInfo.baselineExperiments() > 0){ content.add(Pair.of("Baseline: " + popularSpeciesInfo.baselineExperiments(), Optional.of(urlHelpers.getExperimentsFilteredBySpeciesAndExperimentType(popularSpeciesInfo.species(), "baseline")))); } if(popularSpeciesInfo.differentialExperiments() > 0){ content.add(Pair.of("Differential: " + popularSpeciesInfo.differentialExperiments() + " ", Optional.of(urlHelpers.getExperimentsFilteredBySpeciesAndExperimentType(popularSpeciesInfo.species(), "differential")))); } return createCardModel(popularSpeciesInfo, CardIconType.SPECIES, content); }

Target:
public CardModel create(PopularSpeciesInfo popularSpeciesInfo) { List<Pair<String, Optional<String>>> content = new ArrayList<>(); content.add(Pair.of(popularSpeciesInfo.totalExperiments() + " experiments", Optional.empty())); if(popularSpeciesInfo.baselineExperiments() > 0){ content.add(Pair.of("Baseline:" + popularSpeciesInfo.baselineExperiments(), Optional.of(urlHelpers.getExperimentsFilteredBySpeciesAndExperimentType(popularSpeciesInfo.species(), "baseline")))); } if(popularSpeciesInfo.differentialExperiments() > 0){ content.add(Pair.of("Differential:" + popularSpeciesInfo.differentialExperiments() + " ", Optional.of(urlHelpers.getExperimentsFilteredBySpeciesAndExperimentType(popularSpeciesInfo.species(), "differential")))); } return CardModel.create( CardIconType.SPECIES, popularSpeciesInfo.species(), Pair.of(StringUtils.capitalize(popularSpeciesInfo.species()), Optional.of(urlHelpers.getExperimentsFilteredBySpeciesUrl(popularSpeciesInfo.species()))), content); }
Source:
@Override public boolean clean(ByteBuffer buf) { try { Object cleaner = cleanerMtd.invoke(buf); if (cleaner == null) { return false; } VoltUnsafe.invoke(invokeCleanerMtd, buf); return true; } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to invoke direct buffer cleaner", e); } }

Target:
public boolean clean(ByteBuffer buf) { try { Object cleaner = cleanerMtd.invoke(buf); if (cleaner == null) { return false; } VoltUnsafe.invoke(invokeCleanerMtd, buf); return true; } catch (IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to invoke direct buffer cleaner", e); } }
Source:
public static final void setPreferenceNodeId (String id) { if (fgPreferenceNodeId == null) { fgPreferenceNodeId = id; } }

Target:
public static final boolean setPreferenceNodeId (String id) { if (fgPreferenceNodeId == null || id == null) { fgPreferenceNodeId= id; return true; } return false; }
Source:
public String toString() { return label; }

Target:
public String toString() { return !TextUtils.isEmpty(label) ? label : id; }
Source:
public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (StringUtils.isNotEmpty(url)) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { String targetHCID = null; if (targetSystem != null && targetSystem.getHomeCommunity() != null && targetSystem.getHomeCommunity().getHomeCommunityId() != null) { targetHCID = targetSystem.getHomeCommunity().getHomeCommunityId(); } return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getLocalizedMessage()); } return response; }

Target:
public COREEnvelopeBatchSubmissionResponse batchSubmitTransaction(COREEnvelopeBatchSubmission msg, AssertionType assertion, NhinTargetSystemType targetSystem, NhincConstants.GATEWAY_API_LEVEL apiLevel) { COREEnvelopeBatchSubmissionResponse response; try { String url = proxyHelper.getUrlFromTargetSystemByGatewayAPILevel(targetSystem, getServiceName(), apiLevel); if (StringUtils.isNotEmpty(url)) { X12LargePayloadUtils.convertFileLocationToDataIfEnabled(msg); ServicePortDescriptor<GenericBatchTransactionPort> portDescriptor = new COREGenericBatchServicePortDescriptor(); CONNECTClient<GenericBatchTransactionPort> client = getCONNECTClientSecured(portDescriptor, assertion, url, targetSystem, getServiceName()); client.enableMtom(); response = (COREEnvelopeBatchSubmissionResponse) client.invokePort(GenericBatchTransactionPort.class, "batchSubmitTransaction", msg); if (response != null && response.getPayload() != null) { X12LargePayloadUtils.convertDataToFileLocationIfEnabled(response); } } else { String targetHCID = HomeCommunityMap.getCommunityIdFromTargetSystem(targetSystem); return X12EntityExceptionBuilder.getInstance().createErrorResponse(msg, targetHCID); } } catch (Exception ex) { LOG.error("Error calling batchSubmitTransaction: {}", ex.getLocalizedMessage(), ex); return X12EntityExceptionBuilder.getInstance().createWebServiceErrorResponse(msg, ex.getLocalizedMessage()); } return response; }
Source:
Injector getInjector(IClass iClass) { Guice guice = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (guice == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass) iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl) iClass).getParentInjector(); List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); if (isStringNotEmpty(context.getSuite().getParentModule())) { Class<Module> parentModule = (Class<Module>) ClassHelper.forName(context.getSuite().getParentModule()); if (parentModule != null) { moduleInstances.add(newParentModule(parentModule)); } else { throw new TestNGException( "Cannot load parent Guice module class: " + context.getSuite().getParentModule()); } } Injector injector = context.getInjector(moduleInstances); if (injector == null) { Stage stage; String stageString = context.getSuite().getGuiceStage(); if (isStringNotEmpty(stageString)) { stage = Stage.valueOf(stageString); } else { stage = Stage.DEVELOPMENT; } injector = com.google.inject.Guice.createInjector(stage, moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }

Target:
Injector getInjector(IClass iClass) { Guice guice = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (guice == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass) iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl) iClass).getParentInjector(); List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); List<Module> moduleLookup = Lists.newArrayList(moduleInstances); Module parentModule = getParentModule(context); if (parentModule != null) { moduleInstances.add(parentModule); } Injector injector = context.getInjector(moduleLookup); if (injector == null) { injector = createInjector(context, moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }