auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private QueryBuilder buildSearchQuery() { BoolQueryBuilder elasticQueryBuilder = new BoolQueryBuilder(); for (ElasticsearchColumnHandle column : columns) { Type type = column.getColumnType(); tupleDomain.getDomains().ifPresent((e) -> { Domain domain = e.get(column); if (domain != null) { elasticQueryBuilder.must(buildPredicate(column.getColumnJsonPath(), domain, type, column.getIsList())); } }); } return elasticQueryBuilder.hasClauses() ? elasticQueryBuilder : new MatchAllQueryBuilder(); }

Target:
private QueryBuilder buildSearchQuery() { BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder(); for (ElasticsearchColumnHandle column : columns) { BoolQueryBuilder columnQueryBuilder = new BoolQueryBuilder(); Type type = column.getColumnType(); tupleDomain.getDomains().ifPresent((domains) -> { Domain domain = domains.get(column); if (domain != null) { columnQueryBuilder.should(buildPredicate(column.getColumnJsonPath(), domain, type)); } }); boolQueryBuilder.must(columnQueryBuilder); } return boolQueryBuilder.hasClauses() ? boolQueryBuilder : new MatchAllQueryBuilder(); }
Source:
public DBObject toDBObject(DBObject dbObject, Review model) { TranslatorUtils.fromLocaleToLanguageTag(dbObject, LOCALE_KEY, model.getLocale()); TranslatorUtils.from(dbObject, REVIEW_KEY, model.getReview()); TranslatorUtils.from(dbObject, TYPE_KEY, model.getType()); TranslatorUtils.from(dbObject, PEOPLE_KEY, model.getPeople()); List<DBObject> peopleDbList = model.getPeople().stream() .map(person -> personTranslator.toDBObject(dbObject, person)) .collect(Collectors.toList()); BasicDBList dbPeople = new BasicDBList(); for (DBObject dbObject1 : peopleDbList) { dbPeople.add(dbObject1); } dbObject.put(PEOPLE_KEY, dbPeople); return dbObject; }

Target:
public DBObject toDBObject(DBObject dbObject, Review model) { TranslatorUtils.fromLocaleToLanguageTag(dbObject, LOCALE_KEY, model.getLocale()); TranslatorUtils.from(dbObject, REVIEW_KEY, model.getReview()); TranslatorUtils.from(dbObject, TYPE_KEY, model.getType()); authorTranslator.toDBObject(dbObject, model.getAuthor()); return dbObject; }
Source:
public byte[] createDigitalSignature(InputStream data, String alias, String password) throws IOException { PrivateKey privateKey = getPrivateKey(alias, password); if (privateKey == null) { throw new CatalogCommandRuntimeException(""); } try (BufferedInputStream bufferedInputStream = new BufferedInputStream(data)) { Signature rsa = Signature.getInstance("SHA256withRSA"); rsa.initSign(getPrivateKey(alias, password)); byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = bufferedInputStream.read(buffer)) >= 0) { rsa.update(buffer, OFFSET, len); } return rsa.sign(); } catch (SignatureException | InvalidKeyException | NoSuchAlgorithmException e) { String message = "An error occurred while signing file"; LOGGER.debug(message, e); throw new CatalogCommandRuntimeException(message, e); } }

Target:
public byte[] createDigitalSignature(InputStream data, String alias, String password) throws IOException { PrivateKey privateKey = getPrivateKey(alias, password); if (privateKey == null) { throw new CatalogCommandRuntimeException("Unable to retrieve private key"); } try { Signature rsa = Signature.getInstance("SHA256withRSA"); rsa.initSign(privateKey); byte[] buffer = new byte[BUFFER_SIZE]; int len; while ((len = data.read(buffer)) >= 0) { rsa.update(buffer, OFFSET, len); } return rsa.sign(); } catch (SignatureException | InvalidKeyException | NoSuchAlgorithmException e) { String message = "An error occurred while signing file"; LOGGER.debug(message, e); throw new CatalogCommandRuntimeException(message, e); } }
Source:
public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) { if (arguments.size() % 2 != 1 || arguments.size() < 3) { throw new IllegalArgumentException("At least 3 odd number of arguments are required for CASE-WHEN-ELSE function"); } _numberWhenStatements = arguments.size() / 2; for (int i = 0; i < _numberWhenStatements; i++) { _whenStatements.add(arguments.get(i)); } _elseThenStatements.add(arguments.get(_numberWhenStatements * 2)); for (int i = _numberWhenStatements; i < _numberWhenStatements * 2; i++) { _elseThenStatements.add(arguments.get(i)); } Preconditions.checkState(_elseThenStatements.size() == _numberWhenStatements + 1, "Missing THEN/ELSE clause in CASE statement"); _resultMetadata = getResultMetadata(_elseThenStatements); }

Target:
public void init(List<TransformFunction> arguments, Map<String, DataSource> dataSourceMap) { if (arguments.size() % 2 != 1 || arguments.size() < 3) { throw new IllegalArgumentException("At least 3 odd number of arguments are required for CASE-WHEN-ELSE function"); } _numberWhenStatements = arguments.size() / 2; for (int i = 0; i < _numberWhenStatements; i++) { _whenStatements.add(arguments.get(i)); } _elseThenStatements.add(arguments.get(_numberWhenStatements * 2)); for (int i = _numberWhenStatements; i < _numberWhenStatements * 2; i++) { _elseThenStatements.add(arguments.get(i)); } getResultMetadata(); }
Source:
public void doubleClick(int x, int y) { log.debug(MessageFormat.format("Double-clicking on {0}", widget)); notify(SWT.MouseEnter, createMouseEvent(x, y, 0, SWT.NONE, 0)); notify(SWT.MouseMove, createMouseEvent(x, y, 0, SWT.NONE, 0)); notify(SWT.MouseHover, createMouseEvent(x, y, 0, SWT.NONE, 0)); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notify(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 2)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 2)); log.debug(MessageFormat.format("Double-clicked on {0}", widget)); }

Target:
public void doubleClick(int x, int y) { log.debug(MessageFormat.format("Double-clicking on {0}", this)); notify(SWT.MouseEnter, createMouseEvent(x, y, 0, SWT.NONE, 0)); notify(SWT.MouseMove, createMouseEvent(x, y, 0, SWT.NONE, 0)); notify(SWT.Activate); notify(SWT.FocusIn); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 1)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1)); notify(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.NONE, 2)); notify(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.NONE, 2)); notify(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 2)); log.debug(MessageFormat.format("Double-clicked on {0}", this)); }
Source:
public static PCA createPCA(final List<String> variables, final List<String> samples, final RealMatrix dataMatrix, final Function<RealMatrix, SVD> svdFactory) { Utils.nonNull(variables, "variable names"); Utils.nonNull(samples, "sample names"); Utils.nonNull(dataMatrix, "the input matrix cannot be null"); Utils.nonNull(svdFactory, "the SVD factory cannot be null"); final List<String> variableNames = checkNonNullUniqueNames(variables, "variable"); final List<String> sampleNames = checkNonNullUniqueNames(samples, "sample"); final int rowCount = dataMatrix.getRowDimension(); final int columnCount = dataMatrix.getColumnDimension(); final double[] centers = new double[rowCount]; final RealMatrix centered = new Array2DRowRealMatrix(rowCount, columnCount); for (int i = 0; i < rowCount; i++) { final double[] row = dataMatrix.getRow(i); final double center = MathUtils.mean(row, 0, row.length); for (int j = 0; j < columnCount; j++) { row[j] -= center; } centered.setRow(i, row); centers[i] = center; } final SVD svd = svdFactory.apply(centered); final RealMatrix eigenVectors = svd.getU(); final double inverseDenominator = 1.0 / (columnCount - 1.0); final double[] variances = DoubleStream.of(svd.getSingularValues()).map(d -> d * d * inverseDenominator).toArray(); return new PCA(variableNames, sampleNames, centers, eigenVectors, variances); }

Target:
public static PCA createPCA(final List<String> variables, final List<String> samples, final RealMatrix dataMatrix, final Function<RealMatrix, SVD> svdFactory) { Utils.nonNull(dataMatrix, "the input matrix cannot be null"); Utils.nonNull(svdFactory, "the SVD factory cannot be null"); final List<String> variableNames = checkNonNullUniqueNames(variables, "variable"); final List<String> sampleNames = checkNonNullUniqueNames(samples, "sample"); final int rowCount = dataMatrix.getRowDimension(); final int columnCount = dataMatrix.getColumnDimension(); final double[] centers = new double[rowCount]; final RealMatrix centered = new Array2DRowRealMatrix(rowCount, columnCount); for (int i = 0; i < rowCount; i++) { final double[] row = dataMatrix.getRow(i); final double center = MathUtils.mean(row, 0, row.length); for (int j = 0; j < columnCount; j++) { row[j] -= center; } centered.setRow(i, row); centers[i] = center; } final SVD svd = svdFactory.apply(centered); final RealMatrix eigenVectors = svd.getU(); final double inverseDenominator = 1.0 / (columnCount - 1.0); final double[] variances = DoubleStream.of(svd.getSingularValues()).map(d -> d * d * inverseDenominator).toArray(); return new PCA(variableNames, sampleNames, centers, eigenVectors, variances); }
Source:
private void initiateActiveContainerFailover(String containerID, String resourceID, AbstractContainerAllocator containerAllocator) { Optional<Entry<String, SamzaResource>> standbyContainer = this.selectStandby(containerID, resourceID); if (standbyContainer.isPresent()) { String standbyContainerId = standbyContainer.get().getKey(); SamzaResource standbyResource = standbyContainer.get().getValue(); String standbyResourceID = standbyResource.getResourceID(); String standbyHost = standbyResource.getHost(); this.registerFailover(containerID, resourceID, standbyResourceID, standbyHost); log.info("Initiating failover and stopping standby container, found standbyContainer = resource {}, " + "for active container {}", standbyContainerId, standbyResourceID, containerID); samzaApplicationState.failoversToStandby.incrementAndGet(); this.clusterResourceManager.stopStreamProcessor(standbyResource); return; } else { log.info("No standby container found for active container {}, making a request for {}", containerID, ResourceRequestState.ANY_HOST); samzaApplicationState.failoversToAnyHost.incrementAndGet(); containerAllocator.requestResource(containerID, ResourceRequestState.ANY_HOST); return; } }

Target:
private void initiateActiveContainerFailover(String containerID, String resourceID, AbstractContainerAllocator containerAllocator) { Optional<Entry<String, SamzaResource>> standbyContainer = this.selectStandby(containerID, resourceID); if (standbyContainer.isPresent()) { String standbyContainerId = standbyContainer.get().getKey(); SamzaResource standbyResource = standbyContainer.get().getValue(); String standbyResourceID = standbyResource.getResourceID(); String standbyHost = standbyResource.getHost(); FailoverMetadata failoverMetadata = this.registerActiveContainerFailure(containerID, resourceID); failoverMetadata.updateStandbyContainer(standbyResourceID, standbyHost); log.info("Initiating failover and stopping standby container, found standbyContainer = resource {}, " + "for active container {}", standbyContainerId, standbyResourceID, containerID); samzaApplicationState.failoversToStandby.incrementAndGet(); this.clusterResourceManager.stopStreamProcessor(standbyResource); } else { log.info("No standby container found for active container {}, making a request for {}", containerID, ResourceRequestState.ANY_HOST); samzaApplicationState.failoversToAnyHost.incrementAndGet(); containerAllocator.requestResource(containerID, ResourceRequestState.ANY_HOST); } }
Source:
public Props getProperties(final Project project, final Flow flow, final String jobName, final String source) throws ProjectManagerException { if (Double.compare(flow.getAzkabanFlowVersion(), Constants.AZKABAN_FLOW_VERSION_2_0) == 0) { return getPropertiesFromFlowFile(flow, jobName, source, 1); } else { return this.projectLoader.fetchProjectProperty(project, source); } }

Target:
public Props getProperties(final Project project, final Flow flow, final String jobName, final String source) throws ProjectManagerException { if (FlowLoaderUtils.isAzkabanFlowVersion20(flow.getAzkabanFlowVersion())) { return getPropertiesFromFlowFile(flow, jobName, source, 1); } else { return this.projectLoader.fetchProjectProperty(project, source); } }
Source:
public void testContinousIntegrationCommentsAreRemoved() throws Exception { ChangeDetailXAsResult result = parseFile("testdata/ChangeDetailX_hudson.json"); ChangeDetailX changeDetailX = result.result; assertEquals(1, changeDetailX.getMessages().size()); }

Target:
public void testContinousIntegrationCommentsAreRemoved() throws Exception { ChangeDetailXAsResult result = parseFile("testdata/ChangeDetailX_hudson.json"); ChangeDetailX changeDetailX = result.result; assertEquals(1, changeDetailX.getMessages().size()); ChangeMessage lastMessageLeft = changeDetailX.getMessages().get(0); boolean doesNotContainHudsonMessage = !lastMessageLeft.getMessage().contains("hudson.eclipse.org"); assertEquals(true, doesNotContainHudsonMessage); }
Source:
private Map<String, Object> createAmendment(Site site, Map<String, ?> relatedArticle) { Map<String, Object> amendment = new HashMap<>(relatedArticle); String relationshipType = (String) relatedArticle.get("type"); AmendmentType amendmentType = AmendmentType.BY_RELATIONSHIP_TYPE.get(relationshipType); if (amendmentType == null) return null; if (amendmentType != AmendmentType.CORRECTION) { RenderContext renderContext = new RenderContext(site); renderContext.setArticleId((String) amendment.get("doi")); String body; try { body = getAmendmentBody(renderContext); } catch (IOException e) { throw new RuntimeException(e); } amendment.put("body", body); } amendment.put("type", amendmentType.getLabel()); return amendment; }

Target:
private Map<String, Object> createAmendment(Site site, Map<String, ?> relatedArticle) { Map<String, Object> amendment = new HashMap<>(relatedArticle); String relationshipType = (String) relatedArticle.get("type"); AmendmentType amendmentType = AmendmentType.BY_RELATIONSHIP_TYPE.get(relationshipType); if (amendmentType == null) return null; if (amendmentType != AmendmentType.CORRECTION) { RenderContext renderContext = new RenderContext(site); String doi = (String) amendment.get("doi"); renderContext.setArticleId(doi); String body; try { body = getAmendmentBody(renderContext); } catch (IOException e) { throw new RuntimeException("Could not get body for amendment: " + doi, e); } amendment.put("body", body); } amendment.put("type", amendmentType.getLabel()); return amendment; }
Source:
public void testSaveChanges() { DataModel dataModel = homepage.menu().selectDataExplorer().selectEntity("TypeTest").selectDataTab(); final FormsModalModel model = dataModel.clickOnEditFirstRowButton(); dataModel = model.clickOnSaveChangesButton(); assertTrue(dataModel.existAlertMessage("", "")); assertFalse(model.isModalFormOpen()); LOG.info("Tested save changes button"); }

Target:
public void testSaveChanges() { DataModel dataModel = homepage.menu().selectDataExplorer().selectEntity("TypeTest").selectDataTab(); final FormsModalModel model = dataModel.clickOnEditFirstRowButton(); dataModel = model.clickOnSaveChangesButton(); assertTrue(model.isModalFormClosed()); LOG.info("Tested save changes button"); }
Source:
public void close() throws IOException { closeJSONStream(); super.close(); }

Target:
public void close() throws IOException { jsonElementStream.close(); }
Source:
public void init(SamzaContainerContext containerContext, TaskContext taskContext) { super.init(containerContext, taskContext); writeFn.init(containerContext, taskContext); }

Target:
public void init(SamzaContainerContext containerContext, TaskContext taskContext) { super.init(containerContext, taskContext); putNs = taskContext.getMetricsRegistry().newTimer(groupName, tableId + "-put-ns"); putThrottleNs = taskContext.getMetricsRegistry().newTimer(groupName, tableId + "-put-throttle-ns"); deleteNs = taskContext.getMetricsRegistry().newTimer(groupName, tableId + "-delete-ns"); flushNs = taskContext.getMetricsRegistry().newTimer(groupName, tableId + "-flush-ns"); numPuts = taskContext.getMetricsRegistry().newCounter(groupName, tableId + "-num-puts"); numDeletes = taskContext.getMetricsRegistry().newCounter(groupName, tableId + "-num-deletes"); numFlushes = taskContext.getMetricsRegistry().newCounter(groupName, tableId + "-num-flushes"); }
Source:
@VisibleForTesting protected Iterator<LlapCacheableBuffer> getIterator() { final LlapCacheableBuffer currentHead = clockHand; if (currentHead == null) { return new Iterator<LlapCacheableBuffer>() { @Override public boolean hasNext() { return false; } @Override public LlapCacheableBuffer next() { return null; } }; } final LlapCacheableBuffer tail = clockHand.prev; return new Iterator<LlapCacheableBuffer>() { LlapCacheableBuffer current = currentHead; private boolean isLast = false; @Override public boolean hasNext() { return !isLast; } @Override public LlapCacheableBuffer next() { if (isLast) { throw new NoSuchElementException("Iterator done"); } if (current == tail) { isLast = true; } LlapCacheableBuffer r = current; current = current.next; return r; } }; }

Target:
@VisibleForTesting protected Iterator<LlapCacheableBuffer> getIterator() { final LlapCacheableBuffer currentHead = clockHand; if (currentHead == null) { return new Iterator<LlapCacheableBuffer>() { @Override public boolean hasNext() { return false; } @Override public LlapCacheableBuffer next() { throw new NoSuchElementException("empty iterator"); } }; } final LlapCacheableBuffer tail = clockHand.prev; return new Iterator<LlapCacheableBuffer>() { LlapCacheableBuffer current = currentHead; private boolean isLast = false; @Override public boolean hasNext() { return !isLast; } @Override public LlapCacheableBuffer next() { if (isLast) { throw new NoSuchElementException("Iterator done"); } if (current == tail) { isLast = true; } LlapCacheableBuffer r = current; current = current.next; return r; } }; }
Source:
private boolean networkExists() { List<NetworkCluster> networks = getNetworkClusterDAO().getAllForCluster(getVdsGroupId()); for (NetworkCluster networkCluster : networks) { if (networkCluster.getNetworkId().equals( getNetworkCluster().getNetworkId())) { return true; } } return false; }

Target:
private boolean networkExists() { return getNetworkClusterDAO().get(getNetworkCluster().getId()) != null; }
Source:
public Collection<ObjQualifier> getObjQualifiers() { return this.dateAttributes.stream() .map(attribute -> attribute.getAttribute()) .collect(Collectors.toSet()); }

Target:
public Collection<ObjQualifier> getObjQualifiers() { return this.dateAttributes.stream() .map(OverPeriodDateAttribute::getAttribute) .collect(Collectors.toSet()); }
Source:
void start() throws IOException { if (portFile.exists()) { throw new FileAlreadyExistsException(portFile.toString(), null, "Port file already exists. If the emulator crashed, please delete it"); } port = getFreePort(); try { process = Runtime.getRuntime().exec(emulatorPath.toString() + " --host=localhost --port=" + port); } catch (FileNotFoundException e) { throw new RuntimeException("cbtemulator could not be found"); } writeProps(); isStarted = true; }

Target:
void start() throws IOException { if (portFile.exists()) { throw new FileAlreadyExistsException(portFile.toString(), null, "Port file already exists. If the emulator crashed, please delete it"); } port = getFreePort(); try { process = new ProcessBuilder(emulatorPath.toString(), "--host=localhost", "--port=" + port) .redirectErrorStream(true) .redirectOutput(logFile) .start(); } catch (FileNotFoundException e) { throw new RuntimeException("cbtemulator could not be found"); } writeProps(); isStarted = true; }
Source:
Statement compileAlterTableDropColumn(Table table, String colName, boolean cascade) { HsqlName writeName = null; int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } if (table.timeToLive != null) { final String ttlColumn = table.timeToLive.ttlColumn.getNameString(); if (colName.equalsIgnoreCase(ttlColumn)) { throw Error.error("This column used by TTL cannot be dropped."); } } Object[] args = new Object[] { table.getColumn(colindex).getName(), Integer.valueOf(SchemaObject.CONSTRAINT), Boolean.valueOf(cascade), Boolean.valueOf(false) }; if (!table.isTemp()) { writeName = table.getName(); } return new StatementSchema(null, StatementTypes.DROP_COLUMN, args, null, writeName); }

Target:
Statement compileAlterTableDropColumn(Table table, String colName, boolean cascade) { HsqlName writeName = null; int colindex = table.getColumnIndex(colName); if (table.getColumnCount() == 1) { throw Error.error(ErrorCode.X_42591); } if (table.timeToLive != null) { final String ttlColumn = table.timeToLive.ttlColumn.getNameString(); if (colName.equalsIgnoreCase(ttlColumn)) { throw Error.error("Columns used by TTL cannot be dropped."); } } Object[] args = new Object[] { table.getColumn(colindex).getName(), Integer.valueOf(SchemaObject.CONSTRAINT), Boolean.valueOf(cascade), Boolean.valueOf(false) }; if (!table.isTemp()) { writeName = table.getName(); } return new StatementSchema(null, StatementTypes.DROP_COLUMN, args, null, writeName); }
Source:
public YearsMonthsValue fromDMNString(final String dmnString) { String dmnStringWithoutWhiteSpaces = dmnString.replaceAll("\\s",""); final YearsMonthsValue yearsMonthsValue = new YearsMonthsValue(); final String value = removePrefixAndSuffix(dmnStringWithoutWhiteSpaces); final String[] yearsSplit = value.split(YEARS); String months = ""; if (yearsSplit.length > 0 && !yearsSplit[0].equals(value)) { yearsMonthsValue.setYears(yearsSplit[0]); if (yearsSplit.length == 2) { months = getMonths(yearsSplit[1]); } } else { months = getMonths(value); } yearsMonthsValue.setMonths(months); return yearsMonthsValue; }

Target:
public YearsMonthsValue fromDMNString(final String dmnString) { final YearsMonthsValue yearsMonthsValue = new YearsMonthsValue(); final String value = removePrefixAndSuffix(dmnString); final String[] yearsSplit = value.split(YEARS); String months = ""; if (yearsSplit.length > 0 && !yearsSplit[0].equals(value)) { yearsMonthsValue.setYears(yearsSplit[0]); if (yearsSplit.length == 2) { months = getMonths(yearsSplit[1]); } } else { months = getMonths(value); } yearsMonthsValue.setMonths(months); return yearsMonthsValue; }
Source:
private T doGetItem() { T item = this.available.poll(); if (item != null && logger.isDebugEnabled()) { logger.debug("Obtained " + item + " from pool."); } if (item == null) { item = this.callback.createForPool(); if (logger.isDebugEnabled()) { logger.debug("Obtained new " + item + "."); } allocated.add(item); } else if (this.callback.isStale(item)) { if (logger.isDebugEnabled()) { logger.debug("Received a stale item, will attempt to get a new one."); } doRemoveItem(item); item = doGetItem(); } return item; }

Target:
private T doGetItem() { T item = this.available.poll(); if (item != null && logger.isDebugEnabled()) { logger.debug("Obtained " + item + " from pool."); } if (item == null) { item = this.callback.createForPool(); if (logger.isDebugEnabled()) { logger.debug("Obtained new " + item + "."); } allocated.add(item); } else if (this.callback.isStale(item)) { if (logger.isDebugEnabled()) { logger.debug("Received a stale item, will attempt to get a new one."); } doRemoveItem(item); item = doGetItem(); } this.inUse.add(item); return item; }
Source:
private List<LatLon> getLatLonList(List<Double> numbers) { List<LatLon> latLons = new ArrayList<>(); for (int index = 0; index < numbers.size(); index++) { double latitude = numbers.get(index); if (isValidLatitude(latitude)) { if (index + 1 < numbers.size()) { double longitude = numbers.get(index + 1); if (isValidLongitude(longitude)) { latLons.add(LatLon.from(latitude, longitude)); ++index; } } } } return latLons; }

Target:
private List<LatLon> getLatLonList(List<Double> numbers) { List<LatLon> latLons = new ArrayList<>(); for (int index = 0; index < numbers.size(); index++) { double latitude = numbers.get(index); if (LatLon.isValidLatitude(latitude) && index + 1 < numbers.size()) { double longitude = numbers.get(index + 1); if (LatLon.isValidLongitude(longitude)) { latLons.add(LatLon.from(latitude, longitude)); ++index; } } } return latLons; }
Source:
public LineRecordWriter(DataOutputStream out) { this.out = out; jsonMapper.getFactory() .configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, true); jsonWriter = jsonMapper.writer(new JsonIndenter()); try { out.writeBytes("["); } catch (IOException e) { } }

Target:
public LineRecordWriter(DataOutputStream out) { this.out = out; jsonMapper.getFactory() .configure(JsonGenerator.Feature.ESCAPE_NON_ASCII, true); jsonWriter = jsonMapper.writer(new JsonIndenter()); }
Source:
public Status(@JsonProperty(value = "expectedValue", required = true) String expectedValue) { if (isNumeric(expectedValue)) { matcher = CoreMatchers.is(expectedValue); } else if (isFamily(expectedValue)) { matcher = CoreMatchers.startsWith(expectedValue.substring(0, 1)); } }

Target:
public Status(@JsonProperty(value = "expectedValue", required = true) String expectedValue) { if (!PATTERN.matcher(expectedValue).matches()) { throw new StatusCodeDefinitionException(expectedValue); } matcher = CoreMatchers.startsWith(expectedValue.toLowerCase().replace("x", "")); }
Source:
protected void shutDown() throws Exception { log.info("Shutting Down"); if (server != null) { if (!server.isStopping()) { server.stop(); } } final List<AbstractIdleService> shutdownServices = ImmutableList.of(hostInfoReporter, agentInfoReporter, environmentVariableReporter, agent, zkRegistrar, model); for (AbstractIdleService subService : shutdownServices) { log.info("shutting down " + subService); subService.stopAsync(); } for (AbstractIdleService subService : shutdownServices) { log.info("awaiting termination " + subService); subService.awaitTerminated(); } if (serviceRegistrar != null) { log.info("closing service registrar"); serviceRegistrar.close(); } log.info("stopping metrics"); metrics.stop(); log.info("stopping zk client"); zooKeeperClient.close(); try { log.info("releasing persistent state lock"); stateLock.release(); } catch (IOException e) { log.error("Failed to release state lock", e); } try { stateLockFile.close(); } catch (IOException e) { log.error("Failed to close state lock file", e); } }

Target:
protected void shutDown() throws Exception { if (server != null) { server.stop(); } hostInfoReporter.stopAsync().awaitTerminated(); agentInfoReporter.stopAsync().awaitTerminated(); environmentVariableReporter.stopAsync().awaitTerminated(); agent.stopAsync().awaitTerminated(); if (serviceRegistrar != null) { serviceRegistrar.close(); } zkRegistrar.stopAsync().awaitTerminated(); model.stopAsync().awaitTerminated(); metrics.stop(); zooKeeperClient.close(); try { stateLock.release(); } catch (IOException e) { log.error("Failed to release state lock", e); } try { stateLockFile.close(); } catch (IOException e) { log.error("Failed to close state lock file", e); } }
Source:
private static String getSubmissionUri() { try { SharedPreferences settings = CommCareApplication._().getCurrentApp().getAppPreferences(); return settings.getString(CommCarePreferences.PREFS_SUBMISSION_URL_KEY, CommCareApplication._().getString(R.string.PostURL)); } catch (Exception e) { return CommCareApplication._().getString(R.string.PostURL); } }

Target:
private static String getSubmissionUri() { CommCareApp currentApp = CommCareApplication._().getCurrentApp(); if (currentApp != null) { return currentApp.getAppPreferences().getString( CommCarePreferences.PREFS_SUBMISSION_URL_KEY, CommCareApplication._().getString(R.string.PostURL)); } else { return CommCareApplication._().getString(R.string.PostURL); } }
Source:
protected void doAccept(IModelDeltaVisitor visitor, int depth) { if (visitor.visit(this, depth)) { for (IModelDelta childDelta : getChildDeltas()) { ((ModelDelta)childDelta).doAccept(visitor, depth+1); } } }

Target:
protected void doAccept(IModelDeltaVisitor visitor, int depth) { if (visitor.visit(this, depth)) { for (IModelDelta delta : getChildDeltas()) { ((ModelDelta)delta).doAccept(visitor, depth+1); } } }
Source:
public @NonNull Image getIcon() { String traceType = getTraceType(); if (traceType == null || TmfTraceType.getTraceType(traceType) == null) { Image icon = TmfProjectModelIcons.WORKSPACE_LABEL_PROVIDER.getImage(getResource()); return (icon == null ? TmfProjectModelIcons.DEFAULT_TRACE_ICON : icon); } IConfigurationElement traceUIAttributes = TmfTraceTypeUIUtils.getTraceUIAttributes(traceType, (this instanceof TmfTraceElement) ? TraceElementType.TRACE : TraceElementType.EXPERIMENT); if (traceUIAttributes != null) { String iconAttr = traceUIAttributes.getAttribute(TmfTraceTypeUIUtils.ICON_ATTR); if (iconAttr != null) { String name = traceUIAttributes.getContributor().getName(); if (name != null) { Bundle bundle = Platform.getBundle(name); if (bundle != null) { Image image = TmfProjectModelIcons.loadIcon(bundle, iconAttr); if (image != null) { return image; } } } } } if (this instanceof TmfTraceElement) { return TmfProjectModelIcons.DEFAULT_TRACE_ICON; } return TmfProjectModelIcons.DEFAULT_EXPERIMENT_ICON; }

Target:
public Image getIcon() { String traceType = getTraceType(); if (traceType == null || TmfTraceType.getTraceType(traceType) == null) { Image icon = TmfProjectModelIcons.WORKSPACE_LABEL_PROVIDER.getImage(getResource()); return (icon == null ? TmfProjectModelIcons.DEFAULT_TRACE_ICON : icon); } IConfigurationElement traceUIAttributes = TmfTraceTypeUIUtils.getTraceUIAttributes(traceType, (this instanceof TmfTraceElement) ? TraceElementType.TRACE : TraceElementType.EXPERIMENT); if (traceUIAttributes != null) { String iconAttr = traceUIAttributes.getAttribute(TmfTraceTypeUIUtils.ICON_ATTR); if (iconAttr != null) { String name = traceUIAttributes.getContributor().getName(); if (name != null) { Bundle bundle = Platform.getBundle(name); if (bundle != null) { Image image = TmfProjectModelIcons.loadIcon(bundle, iconAttr); if (image != null) { return image; } } } } } return null; }
Source:
public String createRecordName(String objectType) { StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb, Locale.US); formatter.format("SyncManagerTest_%s_%08d", objectType, (int) (Math.random()*10000000)); String name = sb.toString(); return name; }

Target:
protected String createRecordName(String objectType) { return String.format(Locale.US, "ManagerTest_%s_%08d", objectType, System.currentTimeMillis()); }
Source:
public <T> JsonAdapter<T> adapter(Type type, Class<? extends Annotation>... annotationTypes) { if (annotationTypes.length == 1) { return adapter(type, Collections.singleton(Types.createJsonQualifierImplementation(annotationTypes[0]))); } Set<Annotation> annotations = new LinkedHashSet<>(annotationTypes.length); for (Class<? extends Annotation> annotationType : annotationTypes) { annotations.add(Types.createJsonQualifierImplementation(annotationType)); } return adapter(type, annotations); }

Target:
public <T> JsonAdapter<T> adapter(Type type, Class<? extends Annotation>... annotationTypes) { if (annotationTypes.length == 1) { return adapter(type, annotationTypes[0]); } Set<Annotation> annotations = new LinkedHashSet<>(annotationTypes.length); for (Class<? extends Annotation> annotationType : annotationTypes) { annotations.add(Types.createJsonQualifierImplementation(annotationType)); } return adapter(type, Collections.unmodifiableSet(annotations)); }
Source:
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null).buildClient(); }); }

Target:
public void nullAADCredential() { assertThrows(NullPointerException.class, () -> { final TextAnalyticsClientBuilder builder = new TextAnalyticsClientBuilder(); builder.endpoint(getEndpoint()).credential(null); }); }
Source:
protected String velocifyFile(String name) { Exception eo; try { StringWriter w = new StringWriter(); Velocity.mergeTemplate(name, velocityContext, w); return w.toString(); } catch(ResourceNotFoundException e) { try { StringWriter w = new StringWriter(); String pkg = "com/google/gerrit/server/mail/"; Velocity.mergeTemplate(pkg + name, velocityContext, w); return w.toString(); } catch(Exception e2) { eo = e; } } catch(Exception e) { eo = e; } return "Velocity exception in template " + name + ".\n" + eo.toString(); }

Target:
protected String velocifyFile(String name) throws EmailException { try { StringWriter w = new StringWriter(); Velocity.mergeTemplate(name, velocityContext, w); return w.toString(); } catch(ResourceNotFoundException e) { try { StringWriter w = new StringWriter(); String pkg = "com/google/gerrit/server/mail/"; Velocity.mergeTemplate(pkg + name, velocityContext, w); return w.toString(); } catch(Exception e2) { throw new EmailException("Velocity WAR template" + name + ".\n", e2); } } catch(Exception e) { throw new EmailException("Velocity template " + name + ".\n", e); } }
Source:
public Log(String dataDir, long totalCapacityInBytes, long segmentCapacityInBytes, StoreMetrics metrics) throws IOException { if (totalCapacityInBytes <= 0 || segmentCapacityInBytes <= 0) { throw new IllegalArgumentException( "One of totalCapacityInBytes [" + totalCapacityInBytes + "] or " + "segmentCapacityInBytes [" + segmentCapacityInBytes + "] is <=0"); } long segmentCapacity = Math.min(totalCapacityInBytes, segmentCapacityInBytes); if (totalCapacityInBytes % segmentCapacity != 0) { throw new IllegalArgumentException( "Capacity of log [" + totalCapacityInBytes + "] should be a perfect multiple of segment capacity [" + segmentCapacityInBytes + "]"); } this.dataDir = dataDir; this.capacityInBytes = totalCapacityInBytes; this.metrics = metrics; remainingUnallocatedCapacity = new AtomicLong(totalCapacityInBytes); long numSegments = (totalCapacityInBytes - 1) / segmentCapacityInBytes + 1; loadSegments(segmentCapacity, numSegments); }

Target:
Log(String dataDir, long totalCapacityInBytes, long segmentCapacityInBytes, StoreMetrics metrics) throws IOException { this.dataDir = dataDir; this.capacityInBytes = totalCapacityInBytes; this.metrics = metrics; File dir = new File(dataDir); File[] segmentFiles = dir.listFiles(LogSegmentNameHelper.LOG_FILE_FILTER); if (segmentFiles == null) { throw new IOException("Could not read from directory: " + dataDir); } else if (segmentFiles.length == 0) { checkArgsAndAllocateFirstSegment(totalCapacityInBytes, segmentCapacityInBytes); } else { loadSegments(segmentFiles, totalCapacityInBytes); } activeSegment = segmentsByName.lastEntry().getValue(); }
Source:
public void setAttributeEnumMap(List<String> entries) { List<String> displayedAttributes = new ArrayList<>(); Map<String, Set<String>> attributeValueEnums = new HashMap<>(); for (String entry : entries) { if (entry.isEmpty()) { continue; } String[] kvPair = entry.split("=", 2); String attrName = kvPair[0]; displayedAttributes.add(attrName); if (kvPair.length == 2) { Set<String> valueSet = attributeValueEnums.containsKey(attrName) ? attributeValueEnums.get(attrName) : new LinkedHashSet<>(); for (String value : kvPair[1].split(",")) { String trimmedValue = value.trim(); if (trimmedValue.length() > 0) { valueSet.add(value.trim()); } } if (!valueSet.isEmpty()) { attributeValueEnums.put(attrName, valueSet); } } } setEditorAttributes(displayedAttributes); setAttributeEnumMap(attributeValueEnums); }

Target:
public void setAttributeEnumMap(List<String> entries) { Map<String, Set<String>> mergedEntryMap = new LinkedHashMap<>(); for (String entry : entries) { if (StringUtils.isBlank(entry)) { continue; } String[] kvPair = entry.split("=", 2); String attribute = kvPair[0].trim(); if (!attribute.isEmpty()) { Set<String> values; if (mergedEntryMap.containsKey(attribute)) { values = mergedEntryMap.get(attribute); } else { values = new LinkedHashSet<>(); mergedEntryMap.put(attribute, values); } if (kvPair.length == 2) { values.addAll(Splitter.on(',').trimResults().omitEmptyStrings().splitToList(kvPair[1])); } } } Set<String> attributeSet = new LinkedHashSet<>(mergedEntryMap.keySet()); setEditorAttributes(attributeSet); mergedEntryMap.entrySet().removeIf(entry -> entry.getValue().isEmpty()); setAttributeEnumMap(mergedEntryMap); }
Source:
public void update(ServiceProvider serviceProvider) { long count = datastore.entityCount(ServiceProviderEntity.class, Filter.where("name").is(serviceProvider.name)); if (count != 0) { throw new ServiceProviderException("Duplicate Service Provider Names are not allowed."); } datastore.save(adapt(serviceProvider)); }

Target:
public void update(ServiceProvider serviceProvider) { long count = datastore.entityCount(ServiceProviderEntity.class, Filter.where("name").is(serviceProvider.name).and("_id").isNot(serviceProvider.id.value)); if (count != 0) { throw new ServiceProviderException("Duplicate Service Provider Names are not allowed."); } datastore.save(adapt(serviceProvider)); }
Source:
public Observable<String> observePreferences() { return Observable.create(new ObservableOnSubscribe<String>() { Collection<OnChangeListener> listenerReferences = Collections.synchronizedList(new ArrayList<OnChangeListener>()); @Override public void subscribe(final @io.reactivex.annotations.NonNull ObservableEmitter<String> e) { final OnChangeListener onChangeListener = new OnChangeListener(e); preferences.registerOnSharedPreferenceChangeListener(onChangeListener); listenerReferences.add(onChangeListener); e.setCancellable(new Cancellable() { @Override public void cancel() { preferences.unregisterOnSharedPreferenceChangeListener(onChangeListener); listenerReferences.remove(onChangeListener); } }); } }); }

Target:
public Observable<String> observePreferences() { return Observable.create(new ObservableOnSubscribe<String>() { final Collection<OnChangeListener> listenerReferences = Collections.synchronizedList(new ArrayList<OnChangeListener>()); @Override public void subscribe(final @io.reactivex.annotations.NonNull ObservableEmitter<String> e) { final OnChangeListener onChangeListener = new OnChangeListener(e); preferences.registerOnSharedPreferenceChangeListener(onChangeListener); listenerReferences.add(onChangeListener); e.setCancellable(new Cancellable() { @Override public void cancel() { preferences.unregisterOnSharedPreferenceChangeListener(onChangeListener); listenerReferences.remove(onChangeListener); } }); } }); }
Source:
protected EmbeddedCacheManager createCacheManager() throws Exception { MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext()); cacheManager = TestCacheManagerFactory.createCacheManager(hotRodCacheConfiguration()); cache = cacheManager.getCache(); hotRodServer = TestHelper.startHotRodServer(cacheManager); Properties hotrodClientConf = new Properties(); hotrodClientConf.put("infinispan.client.hotrod.server_list", "localhost:" + hotRodServer.getPort()); hotrodClientConf.put("infinispan.client.hotrod.marshaller", ProtoStreamMarshaller.class.getName()); remoteCacheManager = new RemoteCacheManager(hotrodClientConf); remoteCache = remoteCacheManager.getCache(); return cacheManager; }

Target:
protected EmbeddedCacheManager createCacheManager() throws Exception { MarshallerRegistration.registerMarshallers(ProtoStreamMarshaller.getSerializationContext()); cacheManager = TestCacheManagerFactory.createCacheManager(hotRodCacheConfiguration()); cache = cacheManager.getCache(); hotRodServer = TestHelper.startHotRodServer(cacheManager); ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.addServer().host("127.0.0.1").port(hotRodServer.getPort()); clientBuilder.marshaller(new ProtoStreamMarshaller()); remoteCacheManager = new RemoteCacheManager(clientBuilder.build()); remoteCache = remoteCacheManager.getCache(); return cacheManager; }
Source:
private void checkDestFormatCompatibility() { for (Object item : getItems()) { VM vm = (VM) item; if (vm.getDiskMap() != null) { for (Map.Entry<Guid, Disk> pair : vm.getDiskMap().entrySet()) { DiskImage disk = (DiskImage) pair.getValue(); if (disk.getvolume_type() == VolumeType.Sparse && disk.getvolume_format() == VolumeFormat.RAW && getDiskImportData(disk.getId()) != null && (getDiskImportData(disk.getId()).getSelectedStorageDomain() .getstorage_type().isBlockDomain())) { getProblematicItems().add(vm); break; } } } } if (getProblematicItems().size() > 0) { getCollapseSnapshots().setEntity(true); getCollapseSnapshots().setIsChangable(false); setMessage(ConstantsManager.getInstance() .getConstants() .useSeparateImportOperationForMarkedVMsMsg()); OnPropertyChanged(new PropertyChangedEventArgs(ON_DISK_LOAD)); } }

Target:
private void checkDestFormatCompatibility() { for (Object item : getItems()) { VM vm = (VM) item; if (vm.getDiskMap() != null) { for (Map.Entry<Guid, Disk> pair : vm.getDiskMap().entrySet()) { DiskImage disk = (DiskImage) pair.getValue(); if (disk.getvolume_type() == VolumeType.Sparse && disk.getvolume_format() == VolumeFormat.RAW && getDiskImportData(disk.getId()) != null && (getDiskImportData(disk.getId()).getSelectedStorageDomain() .getstorage_type().isBlockDomain())) { getDisksToConvert().add(vm); break; } } } } if (getDisksToConvert().size() > 0) { getCollapseSnapshots().setEntity(true); getCollapseSnapshots().setIsChangable(false); setMessage(ConstantsManager.getInstance() .getConstants() .useSeparateImportOperationForMarkedVMsMsg()); OnPropertyChanged(new PropertyChangedEventArgs(ON_DISK_LOAD)); } }
Source:
public String getName() { if (StringUtils.isBlank(name)) { return StringUtils.isBlank(apiUrl) || GITHUB_URL.equals(apiUrl) ? GITHUB_NAME : SCMName.fromUrl(apiUrl, COMMON_PREFIX_HOSTNAMES); } return name; }

Target:
public String getName() { return name; }
Source:
private TaskResult processAttempt(StoredSessionAttempt attempt, Config lastStateParams, OptionRerunOn rerunOn, boolean ignoreFailure) { if (attempt.getStateFlags().isDone()) { boolean requireKicked = lastStateParams.get("require_kicked", boolean.class, false); if (!requireKicked && ( rerunOn == OptionRerunOn.ALL || rerunOn == OptionRerunOn.FAILED && !attempt.getStateFlags().isSuccess())) { throw nextPolling(lastStateParams.deepCopy().set("rerun_on_retry_attempt_name", UUID.randomUUID().toString())); } if (!ignoreFailure && !attempt.getStateFlags().isSuccess()) { throw new TaskExecutionException(String.format(ENGLISH, "Dependent workflow failed. Session id: %d, attempt id: %d", attempt.getSessionId(), attempt.getId())); } return TaskResult.empty(cf); } else { throw nextPolling(request.getLastStateParams().deepCopy()); } }

Target:
private TaskResult processAttempt(StoredSessionAttempt attempt, Config lastStateParams, OptionRerunOn rerunOn, boolean ignoreFailure) { if (attempt.getStateFlags().isDone()) { boolean requireKicked = lastStateParams.get("require_kicked", boolean.class, false); if (!requireKicked && ( rerunOn == OptionRerunOn.ALL || rerunOn == OptionRerunOn.FAILED && !attempt.getStateFlags().isSuccess())) { throw nextPolling(lastStateParams.deepCopy().set("rerun_on_retry_attempt_name", UUID.randomUUID().toString())); } if (!ignoreFailure && !attempt.getStateFlags().isSuccess()) { throw new TaskExecutionException(String.format(ENGLISH, "Dependent workflow failed. Session id: %d, attempt id: %d", attempt.getSessionId(), attempt.getId())); } return TaskResult.empty(cf); } else { throw nextPolling(lastStateParams.deepCopy()); } }
Source:
public void enableVersioning(EnableVersioningArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("versioning", ""); VersioningConfiguration config = new VersioningConfiguration("Enabled"); Response response = executePut(args.bucket(), null, null, queryParamMap, config, 0); response.body().close(); }

Target:
public void enableVersioning(EnableVersioningArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("versioning", ""); VersioningConfiguration config = new VersioningConfiguration(true); Response response = executePut(args.bucket(), null, null, queryParamMap, config, 0); response.body().close(); }
Source:
public static boolean shouldReplicate(ReplicationSpec replicationSpec, Table tableHandle, boolean isEventDump, Set<String> bootstrapTableList, ReplScope oldReplScope, HiveConf hiveConf) { if (replicationSpec == null) { replicationSpec = new ReplicationSpec(); } if (replicationSpec.isNoop() || tableHandle == null) { return false; } if (tableHandle.isNonNative() && !replicationSpec.isMetadataOnly() && !Utils.shouldDumpMetaDataOnlyForExternalTables(tableHandle, hiveConf)) { return false; } if (replicationSpec.isInReplicationScope()) { if (tableHandle.isTemporary()) { return false; } if (MetaStoreUtils.isExternalTable(tableHandle.getTTable())) { boolean shouldReplicateExternalTables = hiveConf.getBoolVar(HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES) || replicationSpec.isMetadataOnly() || Utils.shouldDumpMetaDataOnlyForExternalTables(tableHandle, hiveConf); if (isEventDump) { shouldReplicateExternalTables = shouldReplicateExternalTables && !hiveConf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_EXTERNAL_TABLES) && ReplUtils.tableIncludedInReplScope(oldReplScope, tableHandle.getTableName()); } return shouldReplicateExternalTables; } if (AcidUtils.isTransactionalTable(tableHandle.getTTable())) { if (!ReplUtils.includeAcidTableInDump(hiveConf)) { return false; } if (isEventDump && hiveConf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_ACID_TABLES)) { return false; } } if (isEventDump) { if (!ReplUtils.tableIncludedInReplScope(oldReplScope, tableHandle.getTableName())) { return false; } return (bootstrapTableList == null || !bootstrapTableList.contains(tableHandle.getTableName().toLowerCase())); } } return true; }

Target:
public static boolean shouldReplicate(ReplicationSpec replicationSpec, Table tableHandle, boolean isEventDump, Set<String> bootstrapTableList, ReplScope oldReplScope, HiveConf hiveConf) { if (replicationSpec == null) { replicationSpec = new ReplicationSpec(); } if (replicationSpec.isNoop() || tableHandle == null) { return false; } if (tableHandle.isNonNative() && !replicationSpec.isMetadataOnly()) { return false; } if (replicationSpec.isInReplicationScope()) { if (tableHandle.isTemporary()) { return false; } if (MetaStoreUtils.isExternalTable(tableHandle.getTTable())) { boolean shouldReplicateExternalTables = hiveConf.getBoolVar(HiveConf.ConfVars.REPL_INCLUDE_EXTERNAL_TABLES) || replicationSpec.isMetadataOnly(); if (isEventDump) { shouldReplicateExternalTables = shouldReplicateExternalTables && !hiveConf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_EXTERNAL_TABLES) && ReplUtils.tableIncludedInReplScope(oldReplScope, tableHandle.getTableName()); } return shouldReplicateExternalTables; } if (AcidUtils.isTransactionalTable(tableHandle.getTTable())) { if (!ReplUtils.includeAcidTableInDump(hiveConf)) { return false; } if (isEventDump && hiveConf.getBoolVar(HiveConf.ConfVars.REPL_BOOTSTRAP_ACID_TABLES)) { return false; } } if (isEventDump) { if (!ReplUtils.tableIncludedInReplScope(oldReplScope, tableHandle.getTableName())) { return false; } return (bootstrapTableList == null || !bootstrapTableList.contains(tableHandle.getTableName().toLowerCase())); } } return true; }
Source:
protected static DefaultHardwareDevice anDevice(String name, DeviceTargetPlatform platform) throws AndroidDeviceException { DefaultHardwareDevice device = mock(DefaultHardwareDevice.class); when(device.getModel()).thenReturn(name); when(device.getTargetPlatform()).thenReturn(platform); when(device.getModel()).thenReturn("Nexus 5"); when(device.isDeviceReady()).thenReturn(true); when(device.screenSizeMatches("320x480")).thenReturn(true); return device; }

Target:
protected static DefaultHardwareDevice anDevice(String name, DeviceTargetPlatform platform) throws AndroidDeviceException { DefaultHardwareDevice device = mock(DefaultHardwareDevice.class); when(device.getModel()).thenReturn(name); when(device.getTargetPlatform()).thenReturn(platform); when(device.isDeviceReady()).thenReturn(true); when(device.screenSizeMatches("320x480")).thenReturn(true); return device; }