auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean attemptTrade(List<EntityVillager> villagers, int tradeSet) { ItemStack buy1 = recipeSlots.getStackInSlot(tradeSet * 3 + 0); ItemStack buy2 = recipeSlots.getStackInSlot(tradeSet * 3 + 1); ItemStack sell = recipeSlots.getStackInSlot(tradeSet * 3 + 2); for (EntityVillager villager : villagers) { MerchantRecipeList recipes = villager.getRecipes(null); for (MerchantRecipe recipe : recipes) { if (recipe.isRecipeDisabled()) continue; if (recipe.getItemToBuy() != InvTools.emptyStack() && !InvTools.isItemLessThanOrEqualTo(recipe.getItemToBuy(), buy1)) continue; if (recipe.getSecondItemToBuy() != InvTools.emptyStack() && !InvTools.isItemLessThanOrEqualTo(recipe.getSecondItemToBuy(), buy2)) continue; if (!InvTools.isItemGreaterOrEqualThan(recipe.getItemToSell(), sell)) continue; if (canDoTrade(recipe)) { doTrade(villager, recipe); return true; } } } return false; }

Target:
private boolean attemptTrade(List<EntityVillager> villagers, int tradeSet) { ItemStack buy1 = recipeSlots.getStackInSlot(tradeSet * 3 + 0); ItemStack buy2 = recipeSlots.getStackInSlot(tradeSet * 3 + 1); ItemStack sell = recipeSlots.getStackInSlot(tradeSet * 3 + 2); for (EntityVillager villager : villagers) { MerchantRecipeList recipes = villager.getRecipes(null); for (MerchantRecipe recipe : recipes) { if (recipe.isRecipeDisabled()) continue; if (!InvTools.isEmpty(recipe.getItemToBuy()) && !InvTools.isItemLessThanOrEqualTo(recipe.getItemToBuy(), buy1)) continue; if (!InvTools.isEmpty(recipe.getSecondItemToBuy()) && !InvTools.isItemLessThanOrEqualTo(recipe.getSecondItemToBuy(), buy2)) continue; if (!InvTools.isItemGreaterOrEqualThan(recipe.getItemToSell(), sell)) continue; if (canDoTrade(recipe)) { doTrade(villager, recipe); return true; } } } return false; }
Source:
public void startVoiceRecognition() { final String language = QuranSettings.getInstance(this).isArabicNames() ? "ar-SA" : "en-US"; String choice = getText(R.string.vChoice).toString(); Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, choice); startActivityForResult(intent, SPEECH_REQUEST_CODE); }

Target:
public void startVoiceRecognition() { int voiceLanguage = settings.getPreferredVoiceLanguage(); final String language = voiceCom.findLanguageCode(voiceLanguage); String choice = getText(R.string.voice_Dialogue_Title).toString(); Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language); intent.putExtra(RecognizerIntent.EXTRA_PROMPT, choice); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 10); startActivityForResult(intent, SPEECH_REQUEST_CODE); }
Source:
public static List<Double> boundingBoxCenter(Place place) { if( place == null ) return new ArrayList<>(); if( place.getBoundingBox() == null ) return new ArrayList<>(); if( place.getBoundingBox().getCoordinates().size() != 1 ) return new ArrayList<>(); if( place.getBoundingBox().getCoordinates().get(0).size() != 4 ) return new ArrayList<>(); List<Double> lats = Lists.newArrayList(); List<Double> lons = Lists.newArrayList(); for( List<Double> point : place.getBoundingBox().getCoordinates().get(0)) { lats.add(point.get(0)); lons.add(point.get(1)); } List<Double> result = new ArrayList<Double>(); result.add(new Double(mean(lats))); result.add(new Double(mean(lons))); return result; }

Target:
public static List<Double> boundingBoxCenter(Place place) { if( place == null ) return new ArrayList<>(); if( place.getBoundingBox() == null ) return new ArrayList<>(); if( place.getBoundingBox().getCoordinates().size() != 1 ) return new ArrayList<>(); if( place.getBoundingBox().getCoordinates().get(0).size() != 4 ) return new ArrayList<>(); List<Double> lats = new ArrayList<>(); List<Double> lons = new ArrayList<>(); for( List<Double> point : place.getBoundingBox().getCoordinates().get(0)) { lats.add(point.get(0)); lons.add(point.get(1)); } List<Double> result = new ArrayList<>(); result.add(new Double(mean(lats))); result.add(new Double(mean(lons))); return result; }
Source:
public List<String> getOutputStreams() { return outputStreams; }

Target:
public Set<String> getOutputStreams() { return Collections.unmodifiableSet(outputStreams); }
Source:
public void setEnvironment() throws Exception { super.init(userMode); String userName = gatewayContextWrk.getContextTenant().getTenantAdmin().getUserNameWithoutDomain(); String password = gatewayContextWrk.getContextTenant().getTenantAdmin().getPassword(); String tenantDomain = gatewayContextWrk.getContextTenant().getDomain(); restAPIPublisher = new RestAPIPublisherImpl(userName, password, tenantDomain); }

Target:
public void setEnvironment() throws Exception { super.init(userMode); }
Source:
public LogReplicationMetadataManager(CorfuRuntime rt, long topologyConfigId, String localClusterId) { this.runtime = rt; this.corfuStore = new CorfuStore(runtime); metadataTableName = getPersistedWriterMetadataTableName(localClusterId); try { metadataTable = this.corfuStore.openTable(NAMESPACE, metadataTableName, LogReplicationMetadataKey.class, LogReplicationMetadataVal.class, null, TableOptions.builder().build()); } catch (Exception e) { log.error("Caught an exception while opening the table NAMESPACE={}, name={}", NAMESPACE, metadataTableName); throw new ReplicationWriterException(e); } setupTopologyConfigId(topologyConfigId); }

Target:
public LogReplicationMetadataManager(CorfuRuntime rt, long topologyConfigId, String localClusterId) { this.runtime = rt; this.corfuStore = new CorfuStore(runtime); metadataTableName = getPersistedWriterMetadataTableName(localClusterId); try { metadataTable = this.corfuStore.openTable(NAMESPACE, metadataTableName, LogReplicationMetadataKey.class, LogReplicationMetadataVal.class, null, TableOptions.builder().build()); } catch (Exception e) { log.error("Caught an exception while opening the table NAMESPACE={}, name={}", NAMESPACE, metadataTableName, e); throw new ReplicationWriterException(e); } setupTopologyConfigId(topologyConfigId); }
Source:
private GetRouterMonitorResultsAnswer execute(GetRouterMonitorResultsCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String args = cmd.shouldPerformFreshChecks() ? "true" : "false"; s_logger.debug("Fetching health check result for " + routerIp + " and executing fresh checks: " + args); ExecutionResult result = _vrDeployer.executeInVR(routerIp, VRScripts.ROUTER_MONITOR_RESULTS, args); if (result.isSuccess()) { List<String> failingChecks = new ArrayList<>(); StringBuilder monitorResults = new StringBuilder(); if (!result.getDetails().isEmpty()) { String[] lines = result.getDetails().trim().split("\n"); boolean readingFailedChecks = false, readingMonitorResults = false; for (String line : lines) { line = line.trim(); if (line.contains("FAILING CHECKS")) { readingFailedChecks = true; readingMonitorResults = false; continue; } else if (line.contains("MONITOR RESULTS")) { readingFailedChecks = false; readingMonitorResults = true; continue; } if (readingFailedChecks && !readingMonitorResults) { for (String w : line.split(",")) { if (!w.trim().isEmpty()) { failingChecks.add(w.trim()); } } } else if (!readingFailedChecks && readingMonitorResults) { monitorResults.append(line); } else { s_logger.info("Unexpected state of lines reached while parsing response. Skipping line."); } } } else { s_logger.warn("Received no results back in monitor results."); } if (monitorResults.length() == 0) { monitorResults.append("No results available."); } return new GetRouterMonitorResultsAnswer(cmd, true, failingChecks, monitorResults.toString()); } else { return new GetRouterMonitorResultsAnswer(cmd, false, null, result.getDetails()); } }

Target:
private GetRouterMonitorResultsAnswer execute(GetRouterMonitorResultsCommand cmd) { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String args = cmd.shouldPerformFreshChecks() ? "true" : "false"; s_logger.info("Fetching health check result for " + routerIp + " and executing fresh checks: " + args); ExecutionResult result = _vrDeployer.executeInVR(routerIp, VRScripts.ROUTER_MONITOR_RESULTS, args); if (!result.isSuccess()) { s_logger.warn("Result of " + cmd + " failed with details: " + result.getDetails()); return new GetRouterMonitorResultsAnswer(cmd, false, null, result.getDetails()); } if (result.getDetails().isEmpty()) { s_logger.warn("Result of " + cmd + " received no details."); return new GetRouterMonitorResultsAnswer(cmd, false, null, "No results available."); } return parseLinesForHealthChecks(cmd, result.getDetails()); }
Source:
private BlobId getRandomBlobId(short version) throws Exception { byte[] bytes = new byte[2]; random.nextBytes(bytes); random.nextBytes(bytes); byte datacenterId = bytes[0]; short accountId = getRandomShort(random); short containerId = getRandomShort(random); BlobIdType type = random.nextBoolean() ? BlobIdType.NATIVE : BlobIdType.CRAFTED; PartitionId partitionId = referenceClusterMap.getWritablePartitionIds(MockClusterMap.DEFAULT_PARTITION_CLASS).get(random.nextInt(3)); boolean isEncrypted = random.nextBoolean(); return new BlobId(version, type, datacenterId, accountId, containerId, partitionId, isEncrypted, null); }

Target:
private BlobId getRandomBlobId(short version) throws Exception { byte[] bytes = new byte[2]; random.nextBytes(bytes); random.nextBytes(bytes); byte datacenterId = bytes[0]; short accountId = getRandomShort(random); short containerId = getRandomShort(random); BlobIdType type = random.nextBoolean() ? BlobIdType.NATIVE : BlobIdType.CRAFTED; PartitionId partitionId = referenceClusterMap.getWritablePartitionIds(MockClusterMap.DEFAULT_PARTITION_CLASS).get(random.nextInt(3)); boolean isEncrypted = random.nextBoolean(); BlobDataType dataType = BlobDataType.values()[random.nextInt(BlobDataType.values().length)]; return new BlobId(version, type, datacenterId, accountId, containerId, partitionId, isEncrypted, dataType); }
Source:
public void verifyAPIName(String apiName) throws APIManagerIntegrationTestException { HttpResponse getApi = apiPublisher.getAPI(apiName, "admin"); JSONObject response = new JSONObject(getApi.getData()); log.info("API Infor : " + getApi.getData()); Assert.assertEquals(response.getJSONObject("api").get("name").toString(), apiName, "Expected API name value not match"); }

Target:
private void verifyAPIName(String apiName) throws APIManagerIntegrationTestException { HttpResponse getApi = apiPublisher.getAPI(apiName, "admin"); JSONObject response = new JSONObject(getApi.getData()); log.info("API Infor : " + getApi.getData()); Assert.assertEquals(response.getJSONObject("api").get("name").toString(), apiName, "Expected API name value not match"); }
Source:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || this.getClass() != o.getClass()) { return false; } final GraphMLEdgeStatus that = (GraphMLEdgeStatus) o; return Objects.equal(this.getSeverity(), that.getSeverity()) && Objects.equal(this.getStyleProperties(), that.getStyleProperties()); }

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof GraphMLEdgeStatus)) { return false; } final GraphMLEdgeStatus that = (GraphMLEdgeStatus) o; return Objects.equal(this.getSeverity(), that.getSeverity()) && Objects.equal(this.getStyleProperties(), that.getStyleProperties()); }
Source:
private void initializeGitIndexWatcher() { requestTransmitter.newRequest() .endpointId("ws-agent") .methodName("track:git-index") .noParams() .sendAndSkipResult(); }

Target:
private void initializeGitIndexWatcher() { requestTransmitter.newRequest() .endpointId("ws-agent") .methodName("track/git-index") .noParams() .sendAndSkipResult(); }
Source:
public boolean isBackgroundSprite() { return this == ProjectManager.getInstance().getCurrentlyEditedScene().getSpriteList().get(0); }

Target:
public boolean isBackgroundSprite() { return look.getZIndex() == Constants.Z_INDEX_BACKGROUND; }
Source:
private void setDefaultBootDevice() { boolean hasBootDevice = vmBase.getManagedDeviceMap().values().stream().anyMatch(device -> device.getBootOrder() > 0); if (hasBootDevice) { return; } final int[] order = new int[]{1}; _images.stream() .filter(DiskImage::isBoot) .map(image -> vmBase.getManagedDeviceMap().get(image.getId())) .filter(Objects::nonNull) .forEachOrdered(device -> device.setBootOrder(order[0]++)); }

Target:
private void setDefaultBootDevice() { boolean hasBootDevice = vmBase.getManagedDeviceMap().values().stream() .anyMatch(device -> device.getBootOrder() > 0); if (hasBootDevice) { return; } AtomicInteger order = new AtomicInteger(1); _images.stream() .filter(DiskImage::isBoot) .map(image -> vmBase.getManagedDeviceMap().get(image.getId())) .filter(Objects::nonNull) .forEachOrdered(device -> device.setBootOrder(order.getAndIncrement())); }
Source:
public ArticlePageObject savePage() { switchToIFrame(); waitForElementInViewPort(editSummary); WebElement publishButton = driver.findElement(By.cssSelector(".oo-ui-window-foot .oo-ui-flaggableElement-constructive .oo-ui-labeledElement-label")); waitForElementClickableByElement(publishButton); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } publishButton.click(); PageObjectLogging.log("savePage", "The 2nd Publish Button is clicked", true); switchOutOfIFrame(); return new ArticlePageObject(driver); }

Target:
public ArticlePageObject savePage() { switchToIFrame(); waitForElementInViewPort(editSummary); waitForElementClickableByElement(publishButton); publishButton.click(); PageObjectLogging.log("savePage", "The 2nd Publish Button is clicked", true); switchOutOfIFrame(); return new ArticlePageObject(driver); }
Source:
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { ClassNotFoundException firstException = null; for (ClassLoader classLoader : delegates) { try { return classLoader.loadClass(name); } catch (ClassNotFoundException e) { firstException = e; } } throw firstException; }

Target:
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { ClassNotFoundException firstException = null; for (ClassLoader classLoader : delegates) { try { Class<?> result = classLoader.loadClass(name); if (resolve) { resolveClass(result); } return result; } catch (ClassNotFoundException e) { firstException = e; } } throw firstException; }
Source:
public void onClickTypeButton(final ClickEvent clickEvent) { final String value = typeSelector.getValue(); dataTypeModal.show(); }

Target:
public void onClickTypeButton(final ClickEvent clickEvent) { dataTypeModal.show(); }
Source:
public BranchId getBranch(IAtsConfigObject configObject) { BranchId branch = BranchId.SENTINEL; if (configObject instanceof IAtsVersion) { IAtsVersion version = (IAtsVersion) configObject; if (version.getBaselineBranchId().isValid()) { branch = version.getBaselineBranchId(); } } if (branch.isInvalid() && configObject instanceof IAtsTeamDefinition) { IAtsTeamDefinition teamDef = (IAtsTeamDefinition) configObject; if (teamDef.getBaselineBranchId().isValid()) { branch = teamDef.getBaselineBranchId(); } } if (branch.isInvalid()) { BranchId branchId = BranchId.valueOf(services.getAttributeResolver().getSoleAttributeValue(configObject, AtsAttributeTypes.BaselineBranchUuid, 0L)); if (branchId.isValid()) { branch = branchId; } } return branch; }

Target:
public BranchId getBranch(IAtsConfigObject configObject) { BranchId branch = BranchId.SENTINEL; if (configObject instanceof IAtsVersion) { IAtsVersion version = (IAtsVersion) configObject; if (version.getBaselineBranchId().isValid()) { branch = version.getBaselineBranchId(); } } if (branch.isInvalid() && configObject instanceof IAtsTeamDefinition) { IAtsTeamDefinition teamDef = (IAtsTeamDefinition) configObject; if (teamDef.getBaselineBranchId().isValid()) { branch = teamDef.getBaselineBranchId(); } } if (branch.isInvalid()) { branch = BranchId.valueOf(services.getAttributeResolver().getSoleAttributeValue(configObject, AtsAttributeTypes.BaselineBranchUuid, BranchId.SENTINEL.getId())); } return branch; }
Source:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (unsafeParamNames.isEmpty() || !SAFE_ARG_OF.matches(tree, state)) { return Description.NO_MATCH; } List<? extends ExpressionTree> args = tree.getArguments(); ExpressionTree argNameExpression = args.get(0); if (compileTimeConstExpressionMatcher.matches(argNameExpression, state)) { if (argNameExpression instanceof JCTree.JCLiteral) { String argName = (String) ((JCTree.JCLiteral) argNameExpression).getValue(); if (unsafeParamNames.stream().anyMatch(unsafeArgName -> unsafeArgName.equalsIgnoreCase(argName))) { SuggestedFix.Builder builder = SuggestedFix.builder(); String unsafeArg = SuggestedFixes.qualifyType(state, builder, "com.palantir.logsafe.UnsafeArg"); return buildDescription(tree) .setMessage("Arguments with name '" + argName + "' must be marked as unsafe.") .addFix(builder.replace(tree.getMethodSelect(), unsafeArg + ".of") .build()) .build(); } } } return Description.NO_MATCH; }

Target:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (unsafeParamNames.isEmpty() || !SAFE_ARG_OF.matches(tree, state)) { return Description.NO_MATCH; } List<? extends ExpressionTree> args = tree.getArguments(); ExpressionTree argNameExpression = args.get(0); if (argNameExpression instanceof JCTree.JCLiteral) { String argName = (String) ((JCTree.JCLiteral) argNameExpression).getValue(); if (unsafeParamNames.stream().anyMatch(unsafeArgName -> unsafeArgName.equalsIgnoreCase(argName))) { SuggestedFix.Builder builder = SuggestedFix.builder(); String unsafeArg = SuggestedFixes.qualifyType(state, builder, "com.palantir.logsafe.UnsafeArg"); return buildDescription(tree) .setMessage("Arguments with name '" + argName + "' must be marked as unsafe.") .addFix(builder.replace(tree.getMethodSelect(), unsafeArg + ".of") .build()) .build(); } } return Description.NO_MATCH; }
Source:
public static void viewCurrentBlogPeople(Context context) { Intent intent = new Intent(context, PeopleManagementActivity.class); slideInFromRight(context, intent); AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.OPENED_PEOPLE); }

Target:
public static void viewCurrentBlogPeople(Context context) { Intent intent = new Intent(context, PeopleManagementActivity.class); slideInFromRight(context, intent); AnalyticsUtils.trackWithCurrentBlogDetails(AnalyticsTracker.Stat.OPENED_PEOPLE_MANAGEMENT); }
Source:
public QuotaVdsConsumptionParameter clone() { return new QuotaVdsConsumptionParameter( this.quotaGuid, this.quota, this.action, this.vdsGroupId, this.requestedCpu, this.requestedMemory); }

Target:
public QuotaVdsConsumptionParameter clone() { return new QuotaVdsConsumptionParameter( this.getQuotaGuid(), this.getQuota(), this.getAction(), this.vdsGroupId, this.requestedCpu, this.requestedMemory); }
Source:
public static String getUriPath(Map<String, Object> tags) { for (String key : tags.keySet()) { if (isUriKey(key)) { return getUriPath(tags.get(key).toString()); } } return null; }

Target:
public static String getUriPath(Map<String, Object> tags) { for (Map.Entry<String,Object> entry : tags.entrySet()) { if (isUriKey(entry.getKey())) { return getUriPath(entry.getValue().toString()); } } return null; }
Source:
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception { ControlMessage message = (ControlMessage) e.getMessage(); switch (message.getKind()) { case PREPARED: writePreparedRequested(ctx, e); break; case STARTED: writeStartedRequested(ctx, e); break; case FINISHED: writeFinishedRequested(ctx, e); break; case ERROR: writeErrorRequested(ctx, e); break; case NOTIFY: writeNotifyRequested(ctx, e); default: throw new IllegalArgumentException(String.format("Unexpected control message: %s", message.getKind())); } }

Target:
public void writeRequested(ChannelHandlerContext ctx, MessageEvent e) throws Exception { ControlMessage message = (ControlMessage) e.getMessage(); switch (message.getKind()) { case PREPARED: writePreparedRequested(ctx, e); break; case STARTED: writeStartedRequested(ctx, e); break; case FINISHED: writeFinishedRequested(ctx, e); break; case ERROR: writeErrorRequested(ctx, e); break; case NOTIFY: writeNotifyRequested(ctx, e); break; default: throw new IllegalArgumentException(String.format("Unexpected control message: %s", message.getKind())); } }
Source:
public boolean hasUsableImageCount(int minImageCount, int minImageWidth) { if (!mContentContainsImages) { return false; } int numFound = 0; Matcher imgMatcher = IMG_TAG_PATTERN.matcher(mContent); while (imgMatcher.find()) { String imgTag = mContent.substring(imgMatcher.start(), imgMatcher.end()); String imageUrl = ReaderHtmlUtils.getSrcAttrValue(imgTag); int width = Math.max(ReaderHtmlUtils.getWidthAttrValue(imgTag), ReaderHtmlUtils.getIntQueryParam(imageUrl, "w")); if (width >= minImageWidth) { numFound++; if (numFound >= minImageCount) { return true; } } } return false; }

Target:
public boolean hasUsableImageCount(int minImageCount, int minImageWidth) { return getImageList(minImageCount, minImageWidth).size() == minImageCount; }
Source:
public String describe() { return "User " + consumedAU.getUserIdentifier() + " ( type: " + consumedAU.getAuthenticatedUserLookup().getAuthenticationProviderId() + " ) merged into " +ongoingAU.getUserIdentifier(); }

Target:
public String describe() { return "User " + consumedAU.getUserIdentifier() + " (type: " + consumedAU.getAuthenticatedUserLookup().getAuthenticationProviderId() + " | persistentUserId: " + consumedAU.getAuthenticatedUserLookup().getPersistentUserId() + "; Name: "+ consumedAU.getFirstName() + " " + consumedAU.getLastName() +"; Institution: " + consumedAU.getAffiliation() + "; Email: " + consumedAU.getEmail() + ") merged into " +ongoingAU.getUserIdentifier(); }
Source:
default <U extends Comparable<? super U>> Option<T> maxBy(Function<? super T, ? extends U> f) { Objects.requireNonNull(f, "f is null"); if (isEmpty()) { return None.instance(); } else { T tm = null; U um = null; for (T t : Iterator.ofAll(this)) { U u = f.apply(t); if (um == null || u.compareTo(um) >= 0) { um = u; tm = t; } } return new Some<>(tm); } }

Target:
default <U extends Comparable<? super U>> Option<T> maxBy(Function<? super T, ? extends U> f) { Objects.requireNonNull(f, "f is null"); if (isEmpty()) { return None.instance(); } else { final Iterator<T> iter = iterator(); T tm = iter.next(); U um = f.apply(tm); while (iter.hasNext()) { final T t = iter.next(); final U u = f.apply(t); if (u.compareTo(um) > 0) { um = u; tm = t; } } return new Some<>(tm); } }
Source:
public void setKeyStore(String keyStore, String ksType) { if (Arrays.stream(VALID_KEY_STORE_TYPES.split("\\s*,\\s*")).noneMatch(ksType.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid keystore type: " + ksType.toUpperCase() + ". Valid options: " + Arrays.toString(VALID_KEY_STORE_TYPES.split("\\s*,\\s*"))); } signatureKeyProperties.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin"); signatureKeyProperties.put("org.apache.ws.security.crypto.merlin.keystore.file", Environment.getInstance().getFilePathFromWikiUrl(keyStore)); signatureKeyProperties.put("org.apache.ws.security.crypto.merlin.keystore.type", ksType.toUpperCase()); }

Target:
public void setKeyStore(String keyStore, String ksType) { if (Arrays.stream(VALID_KEY_STORE_TYPES.split("\\s*,\\s*")).noneMatch(ksType.toUpperCase()::equals)) { throw new SlimFixtureException(false, "Invalid keystore type: " + ksType.toUpperCase() + ". Valid options: " + VALID_KEY_STORE_TYPES); } signatureKeyProperties.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin"); signatureKeyProperties.put("org.apache.ws.security.crypto.merlin.keystore.file", Environment.getInstance().getFilePathFromWikiUrl(keyStore)); signatureKeyProperties.put("org.apache.ws.security.crypto.merlin.keystore.type", ksType.toUpperCase()); }
Source:
public boolean containsAllConstantNodes() { int size = size(); for (int index = 0; index < size; index++) { ValueNode literalVal = (ValueNode) elementAt(index); if (! (literalVal instanceof ConstantNode)) { return false; } else if (literalVal instanceof ListValueNode) { if (! ((ListValueNode)literalVal).containsAllConstantNodes()) return false; } } return true; }

Target:
public boolean containsAllConstantNodes() { int size = size(); for (int index = 0; index < size; index++) { ValueNode literalVal = (ValueNode) elementAt(index); if (! (literalVal instanceof ConstantNode)) { if (literalVal instanceof ListValueNode) { if (!((ListValueNode) literalVal).containsAllConstantNodes()) return false; } else return false; } } return true; }
Source:
public String getInventoryDisplayName() { if (itemHandler instanceof InvWrapper) { ITextComponent textName = ((InvWrapper) itemHandler).getInv().getDisplayName(); if (textName != null) { return textName.getFormattedText(); } } if(tile instanceof IWorldNameable) { IWorldNameable nameable = (IWorldNameable) tile; ITextComponent textName = ((IWorldNameable) tile).getDisplayName(); return textName != null ? textName.getFormattedText() : nameable.getName(); } return null; }

Target:
public String getInventoryDisplayName() { IWorldNameable nameable = null; if (itemHandler instanceof InvWrapper) { nameable = ((InvWrapper) itemHandler).getInv(); if (nameable.getDisplayName() == null) { nameable = null; } } if(nameable == null && tile instanceof IWorldNameable) { nameable = (IWorldNameable) tile; } if (nameable != null) { ITextComponent textName = nameable.getDisplayName(); return textName != null ? textName.getFormattedText() : nameable.getName(); } return null; }
Source:
public void setUp() throws Exception{ mongoClient = MockMongoFactory.with(Version.Main.PRODUCTION).newMongoClient(); final int port = mongoClient.getServerAddressList().get(0).getPort(); conf = new MongoDBRdfConfiguration(); conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, "test"); conf.set(MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX, "rya"); conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya"); conf.set(MongoDBRdfConfiguration.MONGO_INSTANCE_PORT, Integer.toString(port)); conf.setBoolean(ConfigUtils.USE_MONGO, true); conf.setBoolean(OptionalConfigUtils.USE_GEOTEMPORAL, true); conf.setMongoClient(mongoClient); conf.setTablePrefix("isthisused_"); final Sail sail = GeoRyaSailFactory.getInstance(conf); conn = new SailRepository(sail).getConnection(); conn.begin(); indexer = new MongoGeoTemporalIndexer(); indexer.setConf(conf); indexer.setClient(mongoClient); indexer.init(); }

Target:
public void setUp() throws Exception{ mongoClient = MockMongoFactory.newFactory().newMongoClient(); conf = new MongoDBRdfConfiguration(); conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, "test"); conf.set(MongoDBRdfConfiguration.MONGO_COLLECTION_PREFIX, "rya"); conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya"); conf.setBoolean(ConfigUtils.USE_MONGO, true); conf.setBoolean(OptionalConfigUtils.USE_GEOTEMPORAL, true); conf.setMongoClient(mongoClient); final Sail sail = GeoRyaSailFactory.getInstance(conf); conn = new SailRepository(sail).getConnection(); conn.begin(); addStatements(); }
Source:
public static String readNullableIntString(DataInputStream input) throws IOException { String tmp = readIntString(input, StandardCharsets.UTF_8); if (tmp.length() == 0) { return null; } else { return tmp; } }

Target:
public static String readNullableIntString(DataInputStream input) throws IOException { String tmp = readIntString(input, StandardCharsets.UTF_8); return tmp.isEmpty() ? null : tmp; }
Source:
public void move(ReplicatorQueue replicatorQueue, ResourceResolver rr) throws IllegalAccessException, MovingException { Session session = rr.adaptTo(Session.class); try { session.getWorkspace().getObservationManager().setUserData("changedByWorkflowProcess"); session.move(getSourcePath(), getDestinationPath()); session.save(); if (session.nodeExists(getDestinationPath())) { Node originalAssetJcrContentNode = session .getNode(getDestinationPath() + "/" + JcrConstants.JCR_CONTENT); JcrUtil.setProperty(originalAssetJcrContentNode, JcrConstants.JCR_LASTMODIFIED, new Date()); JcrUtil.setProperty(originalAssetJcrContentNode, JcrConstants.JCR_LAST_MODIFIED_BY, DEFAULT_LAST_MODIFIED_BY); } updateReferences(replicatorQueue, rr); } catch (RepositoryException e) { throw new MovingException(getSourcePath(), e); } }

Target:
public void move(ReplicatorQueue replicatorQueue, ResourceResolver rr) throws IllegalAccessException, MovingException { Session session = rr.adaptTo(Session.class); try { session.getWorkspace().getObservationManager().setUserData("changedByWorkflowProcess"); session.move(getSourcePath(), getDestinationPath()); session.save(); if (Util.resourceExists(rr, getDestinationPath())) { Node originalAssetJcrContentNode = session .getNode(getDestinationPath() + "/" + JcrConstants.JCR_CONTENT); if (originalAssetJcrContentNode!=null) { JcrUtil.setProperty(originalAssetJcrContentNode, JcrConstants.JCR_LASTMODIFIED, new Date()); JcrUtil.setProperty(originalAssetJcrContentNode, JcrConstants.JCR_LAST_MODIFIED_BY, DEFAULT_LAST_MODIFIED_BY); } } updateReferences(replicatorQueue, rr); } catch (RepositoryException e) { throw new MovingException(getSourcePath(), e); } }
Source:
public void ChatPreview_004_basicUserChatFails() { switchToWindow(driverOne); ChatPageObject chatUserOne = openChatForUser( driverOne, userOne, userOnePassword ); WebElement permissionError = driverOne.findElement(By.cssSelector(".WikiaPageHeader")); PageObjectLogging.log( "basicUserPermissions", "User doesn't have permission to chat", permissionError.getText().toString().matches("Permissions error.*\n?.*") ); }

Target:
public void ChatPreview_004_basicUserChatFails() { switchToWindow(driverOne); ChatPageObject chatUserOne = openChatForUser( driverOne, credentials.userName, credentials.password ); SpecialPageObject special = new SpecialPageObject(driver); special.verifyPageHeader("Permissions error"); }
Source:
private boolean InitializeStorage() { boolean returnValue = false; setStoragePoolId(getVds().getstorage_pool_id()); if (getStoragePool() == null || StoragePoolStatus.Uninitialized == getStoragePool().getstatus() || StoragePoolStatus.Maintanance == getStoragePool().getstatus()) { returnValue = true; _connectStorageSucceeded = true; _connectPoolSucceeded = true; } else { Guid storagePoolGuid = getVds().getstorage_pool_id(); boolean suppressCheck = getAllRunningVdssInPool().size() == 0; StoragePoolParametersBase tempStorageBaseParams = new StoragePoolParametersBase( storagePoolGuid); tempStorageBaseParams.setVdsId(getVds().getId()); tempStorageBaseParams.setSuppressCheck(suppressCheck); tempStorageBaseParams .setTransactionScopeOption(TransactionScopeOption.Suppress); if (Backend .getInstance() .runInternalAction( VdcActionType.ConnectHostToStoragePoolServers, tempStorageBaseParams).getSucceeded() || suppressCheck) { _connectStorageSucceeded = true; reloadStoragePool(); returnValue = _connectPoolSucceeded = executeConnectStoragePoolCommand(storagePoolGuid); if (suppressCheck) { if (!returnValue) { returnValue = reconstructMasterDomain(storagePoolGuid); if (returnValue) { reloadStoragePool(); returnValue = _connectPoolSucceeded = executeConnectStoragePoolCommand(storagePoolGuid); } if (!returnValue) { AuditLogDirector .log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_CONNECTION_FAILED_BUT_LAST_VDS); returnValue = true; } } } } } return returnValue; }

Target:
private boolean InitializeStorage() { boolean returnValue = false; setStoragePoolId(getVds().getstorage_pool_id()); if (getStoragePool() == null || StoragePoolStatus.Uninitialized == getStoragePool().getstatus() || StoragePoolStatus.Maintanance == getStoragePool().getstatus()) { returnValue = true; _connectStorageSucceeded = true; _connectPoolSucceeded = true; } else { Guid storagePoolGuid = getVds().getstorage_pool_id(); boolean suppressCheck = getAllRunningVdssInPool().size() == 0; StoragePoolParametersBase tempStorageBaseParams = new StoragePoolParametersBase( storagePoolGuid); tempStorageBaseParams.setVdsId(getVds().getId()); tempStorageBaseParams.setSuppressCheck(suppressCheck); tempStorageBaseParams .setTransactionScopeOption(TransactionScopeOption.Suppress); if (Backend .getInstance() .runInternalAction( VdcActionType.ConnectHostToStoragePoolServers, tempStorageBaseParams).getSucceeded() || suppressCheck) { _connectStorageSucceeded = true; reloadStoragePool(); returnValue = _connectPoolSucceeded = executeConnectStoragePoolCommand(storagePoolGuid); if (suppressCheck) { if (!returnValue) { returnValue = executeReconstructMasterDomainCommand(storagePoolGuid); if (returnValue) { reloadStoragePool(); returnValue = _connectPoolSucceeded = executeConnectStoragePoolCommand(storagePoolGuid); } if (!returnValue) { AuditLogDirector .log(new AuditLogableBase(getVdsId()), AuditLogType.VDS_STORAGE_CONNECTION_FAILED_BUT_LAST_VDS); returnValue = true; } } } } } return returnValue; }
Source:
public void testGetProducerInfoJustClient() { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("1"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("1"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); try { spanCache.store(null, Arrays.asList(serverSpan, clientSpan), SpanUniqueIdGenerator::toUnique); } catch (CacheException e) { fail("Failed to store span"); } ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }

Target:
public void testGetProducerInfoJustClient() throws CacheException { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("1"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("1"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); spanCache.store(null, Arrays.asList(serverSpan, clientSpan), SpanUniqueIdGenerator::toUnique); ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }
Source:
public static boolean nameExists(String name) { return NAME_TO_FLUIDS.containsKey(name.toLowerCase()); }

Target:
public static boolean nameExists(String name) { return NAME_TO_FLUIDS.containsKey(name.toLowerCase(Locale.ENGLISH)); }
Source:
public boolean isVmTemlateWithSameNameExist(String name, Guid datacenterId) { return DbFacade.getInstance().getVmTemplateDao().getByName(name, datacenterId, null, false) != null; }

Target:
public boolean isVmTemlateWithSameNameExist(String name, Guid datacenterId) { return vmTemplateDao.getByName(name, datacenterId, null, false) != null; }
Source:
public DataSegment push(File inDir, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getHdfsStorageDir(segment); log.info( "Copying segment[%s] to HDFS at location[%s/%s]", segment.getIdentifier(), config.getStorageDirectory(), storageDir ); Path outFile = new Path(String.format( "%s/%s/index.zip", config.getStorageDirectory(), RandomStringUtils.randomAlphanumeric(4))); FileSystem fs = outFile.getFileSystem(hadoopConfig); fs.mkdirs(outFile.getParent()); log.info("Compressing files from[%s] to [%s]", inDir, outFile); final long size; try (FSDataOutputStream out = fs.create(outFile)) { size = CompressionUtils.zip(inDir, out); } DataSegment dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(outFile)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(inDir)), outFile.getParent(), fs ); Path outDir = new Path(String.format("%s/%s", config.getStorageDirectory(), storageDir)); fs.rename(outFile.getParent(), outDir); return dataSegment; }

Target:
public DataSegment push(File inDir, DataSegment segment) throws IOException { final String storageDir = DataSegmentPusherUtil.getHdfsStorageDir(segment); log.info( "Copying segment[%s] to HDFS at location[%s/%s]", segment.getIdentifier(), config.getStorageDirectory(), storageDir ); Path tmpFile = new Path(String.format( "%s/%s/index.zip", config.getStorageDirectory(), UUIDUtils.generateUuid() )); FileSystem fs = tmpFile.getFileSystem(hadoopConfig); fs.mkdirs(tmpFile.getParent()); log.info("Compressing files from[%s] to [%s]", inDir, tmpFile); final long size; final DataSegment dataSegment; try (FSDataOutputStream out = fs.create(tmpFile)) { size = CompressionUtils.zip(inDir, out); dataSegment = createDescriptorFile( segment.withLoadSpec(makeLoadSpec(tmpFile)) .withSize(size) .withBinaryVersion(SegmentUtils.getVersionFromDir(inDir)), tmpFile.getParent(), fs ); Path outDir = new Path(String.format("%s/%s", config.getStorageDirectory(), storageDir)); if (!fs.rename(tmpFile.getParent(), outDir)) { if (!fs.delete(tmpFile.getParent(), true)) { log.error("Failed to delete temp directory[%s]", tmpFile); } if (fs.exists(outDir)) { log.info( "Unable to rename temp directory[%s] to segment directory[%s]. It is already pushed by a replica task.", tmpFile, outDir ); } else { throw new IOException(String.format( "Failed to rename temp directory[%s] and segment directory[%s] is not present.", tmpFile, outDir )); } } } return dataSegment; }
Source:
public ExactNumberOfProblemsExists(ProblemType type, int count) { if(type == null) { throw new NullPointerException("Problem Type cannot be null"); } if(count < 0) { throw new IllegalArgumentException("Number of problems must be greater than zero."); } this.problemType = type; this.expectedProblemsCount = count; matchers = new AbstractProblemMatcher[]{}; problemsView = new ProblemsView(); }

Target:
public ExactNumberOfProblemsExists(ProblemType type, int count) { this(type, count, new AbstractProblemMatcher[]{}); }
Source:
public WorkunitWrapper getWUInfo(WUInfoRequestWrapper wuinfodetailsparams) throws Exception, ArrayOfEspExceptionWrapper { WorkunitWrapper workunit = null; verifyStub(); WUInfoResponseWrapper wuInfoResponse = stubWrapper.WUInfo(wuinfodetailsparams); ArrayOfEspException exceptions = wuInfoResponse.getRawArrayOfEspExceptions1_75(); if (exceptions == null && wuInfoResponse.getWorkunit() != null) { if (wuinfodetailsparams.isUnarchive() && wuInfoResponse.getWorkunit().getArchived()) { doWorkunitAction(wuinfodetailsparams.getWuid(), ECLWUActions.Restore); wuinfodetailsparams.setUnarchive(false); return getWUInfo(wuinfodetailsparams); } workunit = wuInfoResponse.getWorkunit(); workunit.setOriginalEclWatchUrl(getEclWatchUrl()); workunit.setResultViews(wuInfoResponse.getResultViews()); } else { handleEspExceptions(new ArrayOfEspExceptionWrapper(exceptions), "Could not fetch WU Info"); } return workunit; }

Target:
public WorkunitWrapper getWUInfo(WUInfoRequestWrapper wuinfodetailsparams) throws Exception, ArrayOfEspExceptionWrapper { WorkunitWrapper workunit = null; verifyStub(); WUInfoResponseWrapper wuInfoResponse = stubWrapper.WUInfo(wuinfodetailsparams); ArrayOfEspException exceptions = wuInfoResponse.getRawArrayOfEspExceptions1_75(); if (exceptions == null && wuInfoResponse.getWorkunit() != null) { workunit = wuInfoResponse.getWorkunit(); workunit.setOriginalEclWatchUrl(getEclWatchUrl()); workunit.setResultViews(wuInfoResponse.getResultViews()); if (wuinfodetailsparams.attemptUnarchive() && workunit.getArchived()) { doWorkunitAction(wuinfodetailsparams.getWuid(), ECLWUActions.Restore); wuInfoResponse = stubWrapper.WUInfo(wuinfodetailsparams); if (exceptions == null && wuInfoResponse.getWorkunit() != null) { workunit = wuInfoResponse.getWorkunit(); workunit.setOriginalEclWatchUrl(getEclWatchUrl()); workunit.setResultViews(wuInfoResponse.getResultViews()); } } } else { handleEspExceptions(new ArrayOfEspExceptionWrapper(exceptions), "Could not fetch WU Info"); } return workunit; }
Source:
private void withMyClassLoader(Runnable runnable) { ClassLoader classLoader = getClass().getClassLoader(); ClassLoader oldloader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(classLoader); runnable.run(); } finally { Thread.currentThread().setContextClassLoader(oldloader); } }

Target:
private void withMyClassLoader(Runnable runnable) { ClassLoader classLoader = getClass().getClassLoader(); ClassLoader oldloader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); try { runnable.run(); } finally { Thread.currentThread().setContextClassLoader(oldloader); } }
Source:
protected String createClassPath(Class taskletClass) { URLClassLoader jobClassLoader; URLClassLoader contextClassLoader; try { contextClassLoader = (URLClassLoader) Thread.currentThread().getContextClassLoader(); jobClassLoader = (URLClassLoader) Class.forName("org.springframework.xd.dirt.core.Job").getClassLoader(); } catch (Exception e) { throw new IllegalStateException("Unable to determine classpath from ClassLoader.", e); } if (jobClassLoader == null) { throw new IllegalStateException("Unable to access ClassLoader for " + taskletClass + "."); } if (contextClassLoader == null) { throw new IllegalStateException("Unable to access Context ClassLoader."); } List<String> classPath = new ArrayList<String>(); for (URL url : jobClassLoader.getURLs()) { String file = url.getFile().split("\\!/", 2)[0]; if (file.endsWith(".jar")) { classPath.add(file); } } for (URL url : contextClassLoader.getURLs()) { String file = url.getFile().split("\\!/", 2)[0]; if (file.endsWith(".jar") && !classPath.contains(file)) { classPath.add(file); } } StringBuilder classPathBuilder = new StringBuilder(); String separator = System.getProperty("path.separator"); for (String url : classPath) { if (classPathBuilder.length() > 0) { classPathBuilder.append(separator); } classPathBuilder.append(url); } return classPathBuilder.toString(); }

Target:
protected String createClassPath(Class taskletClass) { URLClassLoader serverClassLoader; URLClassLoader taskletClassLoader; try { serverClassLoader = (URLClassLoader) Class.forName("org.springframework.xd.dirt.core.Job").getClassLoader(); taskletClassLoader = (URLClassLoader) taskletClass.getClassLoader(); } catch (Exception e) { throw new IllegalStateException("Unable to determine classpath from ClassLoader.", e); } if (serverClassLoader == null) { throw new IllegalStateException("Unable to access ClassLoader for " + taskletClass + "."); } if (taskletClassLoader == null) { throw new IllegalStateException("Unable to access Context ClassLoader."); } List<String> classPath = new ArrayList<String>(); for (URL url : serverClassLoader.getURLs()) { String file = url.getFile().split("\\!/", 2)[0]; if (file.endsWith(".jar")) { classPath.add(file); } } for (URL url : taskletClassLoader.getURLs()) { String file = url.getFile().split("\\!/", 2)[0]; if (file.endsWith(".jar") && !classPath.contains(file)) { classPath.add(file); } } StringBuilder classPathBuilder = new StringBuilder(); String separator = System.getProperty("path.separator"); for (String url : classPath) { if (classPathBuilder.length() > 0) { classPathBuilder.append(separator); } classPathBuilder.append(url); } return classPathBuilder.toString(); }
Source:
public void attributes_person() { final Query query = Query.parse("-i person name"); assertThat(query.getAttributeTypes(), contains(AttributeType.ABUSE_C, AttributeType.ADMIN_C, AttributeType.TECH_C, AttributeType.ZONE_C, AttributeType.AUTHOR, AttributeType.PING_HDL)); }

Target:
public void attributes_person() { final Query query = Query.parse("-i person name"); assertThat(query.getAttributeTypes(), contains(AttributeType.ABUSE_C, AttributeType.ADMIN_C, AttributeType.TECH_C, AttributeType.ZONE_C, AttributeType.AUTHOR, AttributeType.PING_HDL)); final Query queryPn = Query.parse("-i pn name"); assertThat(queryPn.getAttributeTypes(), contains(AttributeType.ABUSE_C, AttributeType.ADMIN_C, AttributeType.TECH_C, AttributeType.ZONE_C, AttributeType.AUTHOR, AttributeType.PING_HDL)); }
Source:
private String getLocationName() { return m_location == null ? "Default" : m_location.getLocationName(); }

Target:
private String getLocationName() { return m_location == null ? DEFAULT_LOCATION_NAME: m_location.getLocationName(); }
Source:
private ApnsClient buildApnsClient(final iOSVariant iOSVariant) { if (iOSVariant.getCertificate() != null && iOSVariant.getPassphrase() != null) { ApnsClient apnsClient = null; try { final ByteArrayInputStream stream = new ByteArrayInputStream(iOSVariant.getCertificate()); apnsClient = new ApnsClientBuilder() .setClientCredentials(stream, iOSVariant.getPassphrase()) .build(); stream.close(); } catch (Exception e) { logger.error("Error reading certificate", e); return null; } return apnsClient; } return null; }

Target:
private ApnsClient buildApnsClient(final iOSVariant iOSVariant) { if (iOSVariant.getCertificate() != null && iOSVariant.getPassphrase() != null) { try { final ByteArrayInputStream stream = new ByteArrayInputStream(iOSVariant.getCertificate()); final ApnsClient apnsClient = new ApnsClientBuilder() .setClientCredentials(stream, iOSVariant.getPassphrase()) .build(); stream.close(); return apnsClient; } catch (Exception e) { logger.error("Error reading certificate", e); } } throw new IllegalArgumentException("Not able to construct APNS client"); }
Source:
private void navigateStats() { swipeDownOnView(R.id.scroll_view); moveToStats(); idleFor(2000); swipeToAvoidGrayOverlay(R.id.statsPager); setNightModeAndWait(true); takeScreenshot("3-build-an-audience"); pressBackUntilElementIsDisplayed(R.id.nav_sites); }

Target:
private void navigateStats() { swipeDownOnView(R.id.scroll_view); moveToStats(); swipeToAvoidGrayOverlay(R.id.statsPager); setNightModeAndWait(true); takeScreenshot("3-build-an-audience"); pressBackUntilElementIsDisplayed(R.id.nav_sites); }
Source:
Map<String, String> updateAdditionalAttributes(Map<String, String> oldAdditionalAttributes) { oldAdditionalAttributes.putAll(this.additionalAttributes); return oldAdditionalAttributes; }

Target:
private Map<String, String> updateAdditionalAttributes(Map<String, String> oldAdditionalAttributes) { Map<String, String> aux = new HashMap<String, String>(); aux.putAll(oldAdditionalAttributes); aux.putAll(this.additionalAttributes); return aux; }
Source:
public void shouldBeAlphabeticalWhenNoHomeAndLocation() { ChapterComparator comparator = new ChapterComparator(null, null); assertTrue(0 > comparator.compare(chapterStartsWithDigit, chapterStartsWithLetterA)); assertTrue(0 < comparator.compare(chapterStartsWithLetterA, chapterStartsWithDigit)); assertTrue(0 == comparator.compare(chapterStartsWithDigit, chapterStartsWithDigit)); assertTrue(0 > comparator.compare(chapterStartsWithDigit, chapterIstanbul)); assertTrue(0 < comparator.compare(chapterIstanbul, chapterStartsWithDigit)); }

Target:
public void shouldBeAlphabeticalWhenNoHomeAndLocation() { ChapterComparator comparator = new ChapterComparator(null, null); assertElementsOrderedLikeThis(comparator, chapterStartsWithDigit, chapterStartsWithLetterA, chapterIstanbul); }