auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean hasAccess(final Object obj) { if (!(obj instanceof Long)) { return false; } else if (getResourcePermissions().isUserRoleAdmin() || getResourcePermissions().isUserRoleOnc()) { return true; } else { Long acbId = (Long) obj; CertificationBodyDTO acb = null; try { acb = acbDao.getById(acbId); if (acb != null && acb.isRetired()) { LOGGER.warn("Non-admin user " + Util.getUsername() + " tried to see activity for retired ACB " + acb.getName()); return false; } } catch (EntityRetrievalException ex) { } return isAcbValidForCurrentUser(acbId); } }

Target:
public boolean hasAccess(final Object obj) { if (!(obj instanceof Long)) { return false; } else if (getResourcePermissions().isUserRoleAdmin() || getResourcePermissions().isUserRoleOnc()) { return true; } else { Long acbId = (Long) obj; CertificationBodyDTO acb = null; try { acb = acbDao.getById(acbId); if (acb != null && acb.isRetired()) { LOGGER.warn("Non-admin user " + Util.getUsername() + " tried to see activity for retired ACB " + acb.getName()); return false; } } catch (Exception ex) { return false; } return isAcbValidForCurrentUser(acbId); } }
Source:
public void treeExpanded(final TreeExpansionEvent event) { if (event.getElement() instanceof DTreeItem) { DTreeItem dTreeItem = (DTreeItem) event.getElement(); if (!dTreeItem.isExpanded()) { CommandStack commandStack = domain.getCommandStack(); CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new TreeFoldingRecordingCommand(session, event, true)); final SiriusCommand result = new SiriusCommand(domain); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { result.getTasks().add(new RefreshTreeElementTask((DTreeItem) event.getElement(), domain)); } expandDTreeItemCmd.append(result); commandStack.execute(expandDTreeItemCmd); } } }

Target:
public void treeExpanded(final TreeExpansionEvent event) { if (event.getElement() instanceof DTreeItem) { DTreeItem dTreeItem = (DTreeItem) event.getElement(); if (!dTreeItem.isExpanded()) { CommandStack commandStack = domain.getCommandStack(); CompoundCommand expandDTreeItemCmd = new CompoundCommand("Expand " + dTreeItem.getName() + " tree item"); expandDTreeItemCmd.append(new TreeFoldingRecordingCommand(session, event, true)); if (!Platform.getPreferencesService().getBoolean(SiriusPlugin.ID, SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), false, null)) { SiriusCommand result = new SiriusCommand(domain); result.getTasks().add(new RefreshTreeElementTask((DTreeItem) event.getElement(), domain)); expandDTreeItemCmd.append(result); } commandStack.execute(expandDTreeItemCmd); } } }
Source:
private Joiner createAwsJoiner() { try { Class clazz = Class.forName("com.hazelcast.cluster.impl.TcpIpJoinerOverAWS"); Constructor constructor = clazz.getConstructor(Node.class); return (Joiner) constructor.newInstance(this); } catch (ClassNotFoundException e) { StringBuilder message = new StringBuilder("Your Hazelcast network configuration has AWS discovery ") .append("enabled, but there is no Hazelcast AWS module on a classpath. ") .append(LINE_SEPARATOR) .append("Hint: If you are using Maven then add this dependency into your pom.xml:") .append(LINE_SEPARATOR) .append("<dependency>").append(LINE_SEPARATOR) .append(" <groupId>com.hazelcast</groupId>").append(LINE_SEPARATOR) .append(" <artifactId>hazelcast-aws</artifactId>").append(LINE_SEPARATOR) .append(" <version>${hazelcast-aws.version}</version>").append(LINE_SEPARATOR) .append("</dependency>").append(LINE_SEPARATOR); throw new ConfigurationException(message.toString(), e); } catch (Exception e) { throw rethrow(e); } }

Target:
private Joiner createAwsJoiner() { try { Class clazz = Class.forName("com.hazelcast.cluster.impl.TcpIpJoinerOverAWS"); Constructor constructor = clazz.getConstructor(Node.class); return (Joiner) constructor.newInstance(this); } catch (ClassNotFoundException e) { String message = "Your Hazelcast network configuration has AWS discovery " + "enabled, but there is no Hazelcast AWS module on a classpath. " + LINE_SEPARATOR + "Hint: If you are using Maven then add this dependency into your pom.xml:" + LINE_SEPARATOR + "<dependency>" + LINE_SEPARATOR + " <groupId>com.hazelcast</groupId>" + LINE_SEPARATOR + " <artifactId>hazelcast-aws</artifactId>" + LINE_SEPARATOR + " <version>insert hazelcast-aws version</version>" + LINE_SEPARATOR + "</dependency>" + LINE_SEPARATOR + " See <LINK_0> for additional details"; throw new ConfigurationException(message, e); } catch (Exception e) { throw rethrow(e); } }
Source:
public abstract void beginArray() throws IOException; public abstract void endArray() throws IOException; public abstract void beginObject() throws IOException; public abstract void endObject() throws IOException; public abstract boolean hasNext() throws IOException; public abstract Token peek() throws IOException; public abstract String nextName() throws IOException; public abstract int selectName(Options options) throws IOException; public abstract String nextString() throws IOException; public abstract int selectString(Options options) throws IOException; public abstract boolean nextBoolean() throws IOException; public abstract <T> T nextNull() throws IOException; public abstract double nextDouble() throws IOException; public abstract long nextLong() throws IOException; public abstract int nextInt() throws IOException; public abstract void skipValue() throws IOException; public String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }

Target:
public abstract void beginArray() throws IOException; public abstract void endArray() throws IOException; public abstract void beginObject() throws IOException; public abstract void endObject() throws IOException; public abstract boolean hasNext() throws IOException; public abstract Token peek() throws IOException; public abstract String nextName() throws IOException; public abstract int selectName(Options options) throws IOException; public abstract String nextString() throws IOException; public abstract int selectString(Options options) throws IOException; public abstract boolean nextBoolean() throws IOException; public abstract <T> T nextNull() throws IOException; public abstract double nextDouble() throws IOException; public abstract long nextLong() throws IOException; public abstract int nextInt() throws IOException; public abstract void skipValue() throws IOException; public final String getPath() { return JsonScope.getPath(stackSize, scopes, pathNames, pathIndices); }
Source:
FlowScript createFlowScriptByURL() throws InvalidScriptException { try { URL inputUrl = new URL(url); if (flowScriptActionType.equals(FlowActionType.CONTINUE.toString())) { return FlowScript.createContinueFlowScript(); } else if (flowScriptActionType.equals(FlowActionType.IF.toString())) { return FlowScript.createIfFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), getFlowScriptTargetElse(), getFlowScriptTargetContinuation(), parameters()); } else if (flowScriptActionType.equals(FlowActionType.LOOP.toString())) { return FlowScript.createLoopFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), parameters()); } if (flowScriptActionType.equals(FlowActionType.REPLICATE.toString())) { return FlowScript.createReplicateFlowScript(inputUrl, getScriptEngine(), parameters()); } else { throw new DatabaseManagerException("Invalid flow script action: " + flowScriptActionType); } } catch (MalformedURLException e) { throw new InvalidScriptException(e); } }

Target:
FlowScript createFlowScriptByURL() throws InvalidScriptException { URL inputUrl; try { inputUrl = new URL(url); } catch (MalformedURLException e) { throw new InvalidScriptException(e); } if (flowScriptActionType.equals(FlowActionType.CONTINUE.toString())) { return FlowScript.createContinueFlowScript(); } else if (flowScriptActionType.equals(FlowActionType.IF.toString())) { return FlowScript.createIfFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), getFlowScriptTargetElse(), getFlowScriptTargetContinuation(), parameters()); } else if (flowScriptActionType.equals(FlowActionType.LOOP.toString())) { return FlowScript.createLoopFlowScript(inputUrl, getScriptEngine(), getFlowScriptTarget(), parameters()); } if (flowScriptActionType.equals(FlowActionType.REPLICATE.toString())) { return FlowScript.createReplicateFlowScript(inputUrl, getScriptEngine(), parameters()); } else { throw new DatabaseManagerException("Invalid flow script action: " + flowScriptActionType); } }
Source:
private void addCompoundInstallTaskFor(JsonFeature jfeature, TaskList tasks) { tasks.add( Operation.INSTALL, jfeature.getId(), HashMap<String, Set<JsonFeature>>::new, (jfeatures, r) -> installFeatures(r, jfeatures), (id, jfeatures) -> jfeatures.computeIfAbsent(jfeature.getRegion(), r -> new HashSet<>()).add(jfeature)); }

Target:
private void addCompoundInstallTaskFor(JsonFeature jfeature, TaskList tasks) { tasks .addIfAbsent( Operation.INSTALL, HashMap<String, Set<JsonFeature>>::new, (jfeatures, r) -> installFeatures(r, jfeatures)) .add( jfeature.getId(), jfeatures -> jfeatures .computeIfAbsent(jfeature.getRegion(), r -> new HashSet<>()) .add(jfeature)); }
Source:
public Optional<Object> apply( final Object... args ) { Integer maxInt = Integer.MIN_VALUE; Double maxDouble = Double.MIN_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { if(arg instanceof Integer) { maxInt = java.lang.Math.max( maxInt, (Integer) arg ); } else if(arg instanceof Double) { maxDouble = java.lang.Math.max( maxDouble, (Double) arg ); } } if(maxInt == Integer.MIN_VALUE && maxDouble == Double.MIN_VALUE) { return Optional.<Object>of( Double.NaN ); } if(maxInt.doubleValue() >= maxDouble) { return Optional.<Object>of(maxInt); } else { return Optional.<Object>of(maxDouble); } }

Target:
public Optional<Object> apply( final Object... args ) { Integer maxInt = Integer.MIN_VALUE; Double maxDouble = -(Double.MIN_VALUE); Long maxLong = Long.MIN_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { if(arg instanceof Integer) { maxInt = java.lang.Math.max( maxInt, (Integer) arg ); } else if(arg instanceof Double) { maxDouble = java.lang.Math.max( maxDouble, (Double) arg ); } else if(arg instanceof Long) { maxLong = java.lang.Math.max(maxLong, (Long) arg); } } if(maxInt == Integer.MIN_VALUE && maxDouble == Double.MIN_VALUE && maxLong == Long.MIN_VALUE) { return Optional.empty(); } if(maxInt.longValue() >= maxDouble.longValue() && maxInt.longValue() >= maxLong) { return Optional.<Object>of(maxInt); } else if(maxLong >= maxDouble.longValue() && maxLong >= maxInt.longValue()) { return Optional.<Object>of(maxLong); } else { return Optional.<Object>of(maxDouble); } }
Source:
private void setUpPeopleDrawerAdapter() { try { peopleDrawerList = new ArrayList<>(); this.peopleAdapter = new RefreshableCursorAdapter(ZulipActivity.this, peopleDrawerList, app) { @Override protected void doNarrow(int id) { resetPeopleSearch(); if (id == allPeopleId) { openAllPrivateMessages(); } else { Person person = Person.getById(app, (int) id); narrowPMWith(person); switchToPrivate(); } } }; peopleDrawer.setAdapter(peopleAdapter); FloatingHeaderDecoration decor = new FloatingHeaderDecoration(peopleAdapter); peopleDrawer.setAdapter(peopleAdapter); peopleDrawer.addItemDecoration(decor, 1); } catch (Exception e) { ZLog.logException(e); } }

Target:
private void setUpPeopleDrawerAdapter() { try { peopleDrawerList = new ArrayList<>(); this.peopleAdapter = new RefreshableCursorAdapter(ZulipActivity.this, peopleDrawerList, app) { @Override protected void onPeopleSelect(int id) { resetPeopleSearch(); if (id == Constants.ALL_PEOPLE_ID) { openAllPrivateMessages(); } else if (id == Constants.MENTIONS) { doNarrow(new NarrowFilterMentioned()); } else { Person person = Person.getById(app, id); narrowPMWith(person); switchToPrivate(); } } }; peopleDrawer.setAdapter(peopleAdapter); FloatingHeaderDecoration decor = new FloatingHeaderDecoration(peopleAdapter); peopleDrawer.setAdapter(peopleAdapter); peopleDrawer.addItemDecoration(decor, 1); } catch (Exception e) { ZLog.logException(e); } }
Source:
public CompiledSchemaRepository<Schema> provide() { CachedCompiledSchemaRepository<Schema> repository = new CachedCompiledSchemaRepository<>( new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); notificationsBus.registerTopicCallback(new TopicCallback() { @Override public void onTopicRemoved(Topic topic) { repository.removeFromCache(topic); } @Override public void onTopicCreated(Topic topic) { logger.info("Loading latest schema for created topic {}", topic.getQualifiedName()); schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } @Override public void onTopicChanged(Topic topic) { logger.info("Loading latest schema for updated topic {}", topic.getQualifiedName()); schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } }); return repository; }

Target:
public CompiledSchemaRepository<Schema> provide() { CachedCompiledSchemaRepository<Schema> repository = new CachedCompiledSchemaRepository<>( new DirectCompiledSchemaRepository<>(rawSchemaClient, SchemaCompilersFactory.avroSchemaCompiler()), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_MAXIMUM_SIZE), configFactory.getIntProperty(Configs.SCHEMA_CACHE_COMPILED_EXPIRE_AFTER_ACCESS_MINUTES)); notificationsBus.registerTopicCallback(new TopicCallback() { @Override public void onTopicRemoved(Topic topic) { repository.removeFromCache(topic); } @Override public void onTopicCreated(Topic topic) { updateLatestSchema(topic, "new"); } @Override public void onTopicChanged(Topic topic) { updateLatestSchema(topic, "updated"); } private void updateLatestSchema(Topic topic, String operationName) { if (topic.getContentType() == ContentType.AVRO) { logger.info("Loading latest schema for topic {}", operationName, topic.getQualifiedName()); schemaVersionsRepository.onlineLatestSchemaVersion(topic).ifPresent( schemaVersion -> repository.getSchema(topic, schemaVersion, true)); } } }); return repository; }
Source:
public void checkHoveringFeature() { String expectedTextInHoverPopUp = "System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited."; editor.moveCursorToText("Console"); Assert.assertEquals(editor.getTextFromHoverPopup(), expectedTextInHoverPopUp, "<LINK_0>"); }

Target:
public void checkHoveringFeature() { String expectedTextInHoverPopUp = "System.Console\nRepresents the standard input, output, and error streams for console applications. This class cannot be inherited."; editor.moveCursorToText("Console"); try { editor.waitTextInHoverPopUpEqualsTo(expectedTextInHoverPopUp); } catch (TimeoutException ex) { fail("Known permanent failure: <LINK_0>", ex); } }
Source:
int getAccessValue(ReaderWay way) { int accessValue = 0; Integer tmpAccessValue = 0; for (String restriction : restrictions) { tmpAccessValue = accessMap.get(way.getTag(restriction, "yes")); if (tmpAccessValue != null && tmpAccessValue > accessValue) { accessValue = tmpAccessValue; } } if(accessValue == 0){ GHPoint estmCentre = way.getTag("estimated_center", null); if (estmCentre != null) { SpatialRule rule = spatialRuleLookup.lookupRule(estmCentre); accessValue = getEdgeValueForAccess(rule.isAccessible(way, "")); } } return accessValue; }

Target:
int getAccessValue(ReaderWay way) { int accessValue = 0; Integer tmpAccessValue; for (String restriction : restrictions) { tmpAccessValue = accessMap.get(way.getTag(restriction, "yes")); if (tmpAccessValue != null && tmpAccessValue > accessValue) { accessValue = tmpAccessValue; } } if (spatialRuleLookupEnabled() && accessValue == 0) { switch (getSpatialRule(way).getAccessValue(way.getTag("highway", ""), TransportationMode.MOTOR_VEHICLE, AccessValue.ACCESSIBLE)){ case ACCESSIBLE: accessValue = accessMap.get("yes"); break; case EVENTUALLY_ACCESSIBLE: accessValue = accessMap.get("destination"); break; case NOT_ACCESSIBLE: accessValue = accessMap.get("no"); break; } } return accessValue; }
Source:
public Assignments(@JsonProperty("assignments") Map<VariableReferenceExpression, RowExpression> assignments) { this.assignments = unmodifiableMap(new HashMap<>(requireNonNull(assignments, "assignments is null"))); this.outputs = new ArrayList<>(assignments.keySet()); }

Target:
public Assignments(@JsonProperty("assignments") Map<VariableReferenceExpression, RowExpression> assignments) { this.assignments = unmodifiableMap(new LinkedHashMap<>(requireNonNull(assignments, "assignments is null"))); this.outputs = unmodifiableList(new ArrayList<>(assignments.keySet())); }
Source:
public QueryResult find(Map<String, Object> query, long skip, long limit, List<String> fields, List<Map<String, String>> sortDocument) throws CheckedQueryException { if (query == null) { logger.log(Level.SEVERE, "-find called with null selector; bailing."); throw new CheckedQueryException(); } if (!updateAllIndexes()) { throw new CheckedQueryException(); } QueryExecutor queryExecutor = new QueryExecutor(this, dbQueue); Map<String, Object> indexes = listIndexes(); return queryExecutor.find(query, indexes, skip, limit, fields, sortDocument); }

Target:
public QueryResult find(Map<String, Object> query, long skip, long limit, List<String> fields, List<Map<String, String>> sortDocument) throws CheckedQueryException { if (query == null) { logger.log(Level.SEVERE, "-find called with null selector; bailing."); throw new CheckedQueryException(); } if (!updateAllIndexes()) { throw new CheckedQueryException(); } QueryExecutor queryExecutor = new QueryExecutor(this, indexDbQueue); Map<String, Object> indexes = listIndexes(); return queryExecutor.find(query, indexes, skip, limit, fields, sortDocument); }
Source:
private void updateDiskSize(DiskImage diskImage) { getSizeExtend().validateEntity(new IValidation[] { new NotEmptyValidation(), new NonNegativeLongNumberValidation(), }); if (getSizeExtend().getIsValid()) { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } } }

Target:
private void updateDiskSize(DiskImage diskImage) { long sizeToAddInGigabytes = Long.parseLong(getSizeExtend().getEntity()); if (sizeToAddInGigabytes > 0) { diskImage.setSizeInGigabytes(diskImage.getSizeInGigabytes() + sizeToAddInGigabytes); } }
Source:
public static XSLTTransformation using(String location) { contextClassLoader = Thread.currentThread().getContextClassLoader(); XSLTTransformation tansformation = new XSLTTransformation(); tansformation.location = location; return tansformation; }

Target:
public static XSLTTransformation using(String location) { XSLTTransformation tansformation = new XSLTTransformation(); tansformation.contextClassLoader = Thread.currentThread().getContextClassLoader(); tansformation.location = location; return tansformation; }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/chunksAlphaReject"); final Vector3f cameraPosition = playerCamera.getPosition(); int numberOfRenderedTriangles = 0; int numberOfChunksThatAreNotReadyYet = 0; displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).bind(); chunkShader.setFloat("clip", 0.0f, true); chunkShader.activateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); while (renderQueues.chunksAlphaReject.size() > 0) { RenderableChunk chunk = renderQueues.chunksAlphaReject.poll(); if (chunk.hasMesh()) { final ChunkMesh chunkMesh = chunk.getMesh(); final Vector3f chunkPosition = chunk.getPosition().toVector3f(); chunkMesh.updateMaterial(chunkShader, chunkPosition, chunk.isAnimated()); numberOfRenderedTriangles += chunkMesh.render(ALPHA_REJECT, chunkPosition, cameraPosition); } else { numberOfChunksThatAreNotReadyYet++; } } chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); worldRenderer.increaseTrianglesCount(numberOfRenderedTriangles); worldRenderer.increaseNotReadyChunkCount(numberOfChunksThatAreNotReadyYet); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/chunksAlphaReject"); final Vector3f cameraPosition = playerCamera.getPosition(); int numberOfRenderedTriangles = 0; int numberOfChunksThatAreNotReadyYet = 0; sceneOpaqueFbo.bind(); chunkShader.setFloat("clip", 0.0f, true); chunkShader.activateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); while (renderQueues.chunksAlphaReject.size() > 0) { RenderableChunk chunk = renderQueues.chunksAlphaReject.poll(); if (chunk.hasMesh()) { final ChunkMesh chunkMesh = chunk.getMesh(); final Vector3f chunkPosition = chunk.getPosition().toVector3f(); chunkMesh.updateMaterial(chunkShader, chunkPosition, chunk.isAnimated()); numberOfRenderedTriangles += chunkMesh.render(ALPHA_REJECT, chunkPosition, cameraPosition); } else { numberOfChunksThatAreNotReadyYet++; } } chunkShader.deactivateFeature(ShaderProgramFeature.FEATURE_ALPHA_REJECT); worldRenderer.increaseTrianglesCount(numberOfRenderedTriangles); worldRenderer.increaseNotReadyChunkCount(numberOfChunksThatAreNotReadyYet); PerformanceMonitor.endActivity(); }
Source:
private void setupWsClient() { try { wsClient = new PubSubWSClientBuilder().setContext(plan.getLogicalPlan()).build(); if (wsClient != null) { wsClient.setup(); } } catch (Exception e) { LOG.warn("Cannot establish websocket connection", e); } }

Target:
private void setupWsClient() { wsClient = new PubSubWebSocketClientBuilder().setContext(plan.getLogicalPlan()).build(); if (wsClient != null) { try { wsClient.openConnection(); } catch (Exception e) { LOG.warn("Cannot establish websocket connection to uri {}", wsClient.getUri(), e); } } }
Source:
private void addRepos() { IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class); IArtifactRepositoryManager artifactManager = agent.getService(IArtifactRepositoryManager.class); List<URI> currentMetaRepos = Arrays .asList(metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)); if (reposToMigrate != null && metaManager != null && artifactManager != null) { for (URI reposToMigrate1 : reposToMigrate) { if (!currentMetaRepos.contains(reposToMigrate1)) { metaManager.addRepository(reposToMigrate1); artifactManager.addRepository(reposToMigrate1); addedRepos.add(reposToMigrate1); } } } }

Target:
private void addRepos() { IProvisioningAgent agent = ServiceHelper.getService(AutomaticUpdatePlugin.getContext(), IProvisioningAgent.class); IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class); IArtifactRepositoryManager artifactManager = agent.getService(IArtifactRepositoryManager.class); List<URI> currentMetaRepos = Arrays .asList(metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)); if (reposToMigrate != null && metaManager != null && artifactManager != null) { for (URI repoToMigrate : reposToMigrate) { if (!currentMetaRepos.contains(repoToMigrate)) { metaManager.addRepository(repoToMigrate); artifactManager.addRepository(repoToMigrate); addedRepos.add(repoToMigrate); } } } }
Source:
public void setRxBufferCapacity(int rxBufferCapacity) { this.rxBufferCapacity = rxBufferCapacity; }

Target:
public Builder setRxBufferCapacity(int rxBufferCapacity) { this.rxBufferCapacity = rxBufferCapacity; return this; }
Source:
public String getFileName() { return fileName; }

Target:
public String getFileName() { return this.fileName; }
Source:
public static String generateHmacSha256(String key, String valueToEncrypt) { try { byte[] hash = generateHmacSha256Bytes(key, valueToEncrypt); StringBuffer result = new StringBuffer(); for (byte b : hash) { result.append(String.format("%02x", b)); } return result.toString(); } catch (RuntimeException e) { throw new RuntimeException("CommunityCommons::EncodeHmacSha256::Unable to encode: " + e.getMessage(), e); } }

Target:
public static String generateHmacSha256(String key, String valueToEncrypt) { try { byte[] hash = generateHmacSha256Bytes(key, valueToEncrypt); StringBuilder result = new StringBuilder(); for (byte b : hash) { result.append(String.format("%02x", b)); } return result.toString(); } catch (UnsupportedEncodingException | IllegalStateException | InvalidKeyException | NoSuchAlgorithmException e) { throw new RuntimeException("CommunityCommons::generateHmacSha256::Unable to encode: " + e.getMessage(), e); } }
Source:
public static java.util.TimeZone getTimeZone( int offset, boolean dst, long when, String country) { if (country == null) { return null; } TimeZone bias = TimeZone.getDefault(); TimeZone timeZone = TimeZoneFinder.getInstance() .lookupTimeZoneByCountryAndOffset(country, offset, dst, when, bias); return timeZone != null ? java.util.TimeZone.getTimeZone(timeZone.getID()) : null; }

Target:
public static java.util.TimeZone getTimeZone( int offset, boolean dst, long when, String country) { android.icu.util.TimeZone icuTimeZone = getIcuTimeZone(offset, dst, when, country); return icuTimeZone != null ? java.util.TimeZone.getTimeZone(icuTimeZone.getID()) : null; }
Source:
public void buildStorageAccount(AzureClient client, StorageAccountParameters storageAccountParameters) { try { String template = azureStorageAccountTemplateBuilder.build(storageAccountParameters); if (!client.templateDeploymentExists(storageAccountParameters.getResourceGroupName(), storageAccountParameters.getStorageAccountName())) { String parameters = new Json(Map.of()).getValue(); Deployment templateDeployment = client.createTemplateDeployment( storageAccountParameters.getResourceGroupName(), storageAccountParameters.getStorageAccountName(), template, parameters); LOGGER.debug("Created template deployment for storage account: {}", templateDeployment.exportTemplate().template()); } } catch (Exception e) { String message = String.format("Could not create storage account %s in resource group %s", storageAccountParameters.getStorageAccountName(), storageAccountParameters.getResourceGroupName()); LOGGER.warn(message, e); throw new CloudConnectorException(message); } }

Target:
public void buildStorageAccount(AzureClient client, StorageAccountParameters storageAccountParameters) { String resourceGroupName = storageAccountParameters.getResourceGroupName(); String storageAccountName = storageAccountParameters.getStorageAccountName(); try { String template = azureStorageAccountTemplateBuilder.build(storageAccountParameters); if (!client.templateDeploymentExists(resourceGroupName, storageAccountName)) { String parameters = new Json(Map.of()).getValue(); Deployment templateDeployment = client.createTemplateDeployment(resourceGroupName, storageAccountName, template, parameters); LOGGER.debug("Created template deployment for storage account: {}", templateDeployment.exportTemplate().template()); } } catch (CloudException e) { LOGGER.info("Provisioning error, cloud exception happened: ", e); if (e.body() != null && e.body().details() != null) { String details = e.body().details().stream().map(CloudError::message).collect(Collectors.joining(", ")); throw new CloudConnectorException(String.format("Storage account provisioning failed, status code %s, error message: %s, details: %s", e.body().code(), e.body().message(), details)); } else { throw new CloudConnectorException(String.format("Storage account provisioning failed: '%s', please go to Azure Portal for detailed message", e)); } } catch (Exception e) { String message = String.format("Could not create storage account %s in resource group %s", storageAccountName, resourceGroupName); LOGGER.warn(message, e); throw new CloudConnectorException(message); } }
Source:
public AttributesManager(DataManager dataManager) { super(dataManager, Attribute.class, AttributePermission.class, DeviceAttribute.class, GroupAttribute.class); refreshItems(); refreshExtendedPermissions(); }

Target:
public AttributesManager(DataManager dataManager) { super(dataManager, Attribute.class); refreshItems(); refreshExtendedPermissions(); }
Source:
public void executeQueryCommand() { IscsiBond iscsiBond = getDbFacade().getIscsiBondDao().get(getParameters().getId()); if (iscsiBond != null) { iscsiBond.getNetworkIds().addAll(getDbFacade().getIscsiBondDao() .getNetworkIdsByIscsiBondId(iscsiBond.getId())); iscsiBond.getStorageConnectionIds().addAll(getDbFacade().getIscsiBondDao() .getStorageConnectionIdsByIscsiBondId(iscsiBond.getId())); getQueryReturnValue().setReturnValue(iscsiBond); } }

Target:
protected void executeQueryCommand() { IscsiBond iscsiBond = getDbFacade().getIscsiBondDao().get(getParameters().getId()); if (iscsiBond != null) { iscsiBond.getNetworkIds().addAll(getDbFacade().getIscsiBondDao() .getNetworkIdsByIscsiBondId(iscsiBond.getId())); iscsiBond.getStorageConnectionIds().addAll(getDbFacade().getIscsiBondDao() .getStorageConnectionIdsByIscsiBondId(iscsiBond.getId())); getQueryReturnValue().setReturnValue(iscsiBond); } }
Source:
public boolean isCidrFormatValid(String cidr) { return (cidr == null || !cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)) ? false : true; }

Target:
public boolean isCidrFormatValid(String cidr) { return (cidr != null && cidr.matches(ValidationUtils.CIDR_FORMAT_PATTERN)); }
Source:
public void testServiceDiscovery() throws Exception { final TemporaryJob nginx = jobs.job() .image(NGINX) .port("http", 80, ports.localPort("http")) .registration("nginx", "http", "http") .deploy(); final TemporaryJob alpine = jobs.job() .image(ALPINE) .port("nc", 4711, ports.localPort("nc")) .command("sh", "-c", "apk add --update bind-tools " + "&& export SRV=$(dig -t SRV +short _nginx._http.test.$SPOTIFY_DOMAIN) " + "&& export HOST=$(echo $SRV | cut -d' ' -f4) " + "&& export PORT=$(echo $SRV | cut -d' ' -f3) " + "&& nc -lk -p 4711 -e curl http://$HOST:$PORT" ) .deploy(); final HostAndPort alpineAddress = alpine.address("nc"); final Callable<String> curlResponse = () -> { try (final Socket s = new Socket(alpineAddress.getHostText(), alpineAddress.getPort())) { return IOUtils.toString(s.getInputStream()).trim(); } }; Awaitility.await("alpine container returns nginx welcome") .atMost(10, TimeUnit.SECONDS) .until(curlResponse, containsString("Welcome to nginx!")); assertThat(new String(logStreamProvider.getStderr(nginx.job().getId())), containsString("nginx")); }

Target:
public void testServiceDiscovery() throws Exception { final TemporaryJob nginx = jobs.job() .image(NGINX) .port("http", 80, ports.localPort("http")) .registration("nginx", "http", "http") .deploy(); final TemporaryJob alpine = jobs.job() .image(ALPINE) .port("nc", 4711, ports.localPort("nc")) .command("sh", "-c", "apk add --update bind-tools " + "&& export SRV=$(dig -t SRV +short _nginx._http.test.$SPOTIFY_DOMAIN) " + "&& export HOST=$(echo $SRV | cut -d' ' -f4) " + "&& export PORT=$(echo $SRV | cut -d' ' -f3) " + "&& nc -lk -p 4711 -e curl http://$HOST:$PORT" ) .deploy(); final HostAndPort alpineAddress = alpine.address("nc"); final Callable<String> socketResponse = () -> { try (final Socket s = new Socket(alpineAddress.getHostText(), alpineAddress.getPort())) { return IOUtils.toString(s.getInputStream()).trim(); } }; Awaitility.await("alpine container returns nginx welcome") .atMost(10, TimeUnit.SECONDS) .until(socketResponse, containsString("Welcome to nginx!")); assertThat(new String(logStreamProvider.getStderr(nginx.job().getId())), containsString("nginx")); }
Source:
private static String zoneFromUri(String defaultZoneUri) { String hostname = null; try { hostname = new URI(defaultZoneUri).getHost(); } catch (URISyntaxException e) { LOGGER.warning(String.format(INDETERMINATE_EUREKA_ZONE_MESSAGE + " %s", DEFAULT_ZONE_PROPERTY, defaultZoneUri, UNKNOWN_ZONE, e)); return UNKNOWN_ZONE; } if (hostname == null || !hostname.contains(".")) { LOGGER.warning(String.format(INDETERMINATE_EUREKA_ZONE_MESSAGE, DEFAULT_ZONE_PROPERTY, defaultZoneUri, UNKNOWN_ZONE)); return UNKNOWN_ZONE; } return hostname.substring(hostname.indexOf(".") + 1); }

Target:
private static String zoneFromUri(String defaultZoneUri) { String hostname = null; try { hostname = new URI(defaultZoneUri).getHost(); } catch (Exception e) { LOGGER.warning(String.format(INDETERMINATE_EUREKA_ZONE_MESSAGE + " %s", DEFAULT_ZONE_PROPERTY, defaultZoneUri, UNKNOWN_ZONE, e)); return UNKNOWN_ZONE; } if (hostname == null || !hostname.contains(".")) { LOGGER.warning(String.format(INDETERMINATE_EUREKA_ZONE_MESSAGE, DEFAULT_ZONE_PROPERTY, defaultZoneUri, UNKNOWN_ZONE)); return UNKNOWN_ZONE; } return hostname.substring(hostname.indexOf(".") + 1); }
Source:
protected void setup(Context context) throws IOException, InterruptedException { this.connectionTimeout = context.getConfiguration().getInt( IMPORT_CONTENT_CONNECTION_TIMEOUT, 60000); this.readTimeout = context.getConfiguration().getInt( IMPORT_CONTENT_READ_TIMEOUT, 60000); String maxFileSizeMBStr = WorkflowRuntimeParameters.getParamValue( ImportWorkflowRuntimeParameters.IMPORT_CONTENT_MAX_FILE_SIZE_MB, context.getConfiguration()); if (maxFileSizeMBStr != null) { this.contentApprover = new ComplexContentApprover( new PDFHeaderBasedContentApprover(), new SizeLimitContentApprover(Integer.valueOf(maxFileSizeMBStr))); } else { this.contentApprover = new PDFHeaderBasedContentApprover(); } }

Target:
protected void setup(Context context) throws IOException, InterruptedException { this.connectionTimeout = context.getConfiguration().getInt(IMPORT_CONTENT_CONNECTION_TIMEOUT, 60000); this.readTimeout = context.getConfiguration().getInt(IMPORT_CONTENT_READ_TIMEOUT, 60000); Integer maxFileSizeMB = WorkflowRuntimeParameters.getIntegerParamValue( ImportWorkflowRuntimeParameters.IMPORT_CONTENT_MAX_FILE_SIZE_MB, context.getConfiguration()); if (maxFileSizeMB != null) { this.contentApprover = new ComplexContentApprover(new PDFHeaderBasedContentApprover(), new SizeLimitContentApprover(maxFileSizeMB)); } else { this.contentApprover = new PDFHeaderBasedContentApprover(); } }
Source:
public Response getTopology(@PathParam("id") String id, @DefaultValue(":all-time") @QueryParam("window") String window, @QueryParam("sys") boolean sys, @QueryParam(callbackParameterName) String callback) throws TException { topologyPageRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getTopologySummary( nimbusClient.getClient().getTopologyPageInfo(id, window, sys), window, config, servletRequest.getRemoteUser() ), callback ); } catch (RuntimeException e) { LOG.error("Failure getting topology visualization", e); throw e; } }

Target:
public Response getTopology(@PathParam("id") String id, @DefaultValue(":all-time") @QueryParam("window") String window, @QueryParam("sys") boolean sys, @QueryParam(callbackParameterName) String callback) throws TException { topologyPageRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getTopologySummary( nimbusClient.getClient().getTopologyPageInfo(id, window, sys), window, config, servletRequest.getRemoteUser() ), callback ); } }
Source:
public HttpRequest setUrl(String url) { try { this.url = new URL(url); } catch (MalformedURLException e) { throw logger.logExceptionAsWarning(new IllegalArgumentException("'url' must be a valid URL.")); } return this; }

Target:
public HttpRequest setUrl(String url) { try { this.url = new URL(url); } catch (MalformedURLException ex) { throw logger.logExceptionAsWarning(new IllegalArgumentException("'url' must be a valid URL.", ex)); } return this; }
Source:
public void prepareListeners(){ this.dummyListener = ExtensionList.lookup(SecurityListener.class).get(DummySecurityListener.class); dummyListener.clearPreviousCalls(); }

Target:
public void prepareListeners(){ this.spySecurityListener = ExtensionList.lookup(SecurityListener.class).get(SpySecurityListenerImpl.class); }
Source:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = children.get(0); if (!expression.evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } byte[] bs = ptr.get(); if (this.dataType == null) { this.dataType = getDataType(); } Object object = this.dataType.toObject(bs, ptr.getOffset(), ptr.getLength(), this.dataType, this.index); byte[] bytes = this.dataType.toBytes(object); ptr.set(bytes); return true; }

Target:
public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression indexExpr = children.get(1); if (!indexExpr.evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } int index = PDataType.INTEGER.getCodec().decodeInt(ptr, indexExpr.getColumnModifier()); if(index < 0) { throw new ParseException("Index cannot be negative :" + index); } Expression arrayExpr = children.get(0); if (!arrayExpr.evaluate(tuple, ptr)) { return false; } else if (ptr.getLength() == 0) { return true; } PArrayDataType.positionAtArrayElement(ptr, index, getDataType()); return true; }
Source:
public String getGridNodeContainerId() throws IOException { if (!gridMode) { throw new UnsupportedOperationException("We can't get grid node container id in local mode."); } if (gridNodeContainerId == null) { String getGridNodeInfoUrl = format("http://localhost:4444/grid/api/testsession?session=%s", getSessionId()); Map<String, String> gridNodeInfo; try { gridNodeInfo = httpJsonRequestFactory.fromUrl(getGridNodeInfoUrl).request().asProperties(); } catch (ServerException | UnauthorizedException | ForbiddenException | NotFoundException | ConflictException | BadRequestException e) { throw new IOException(e); } if (!gridNodeInfo.containsKey("proxyId")) { throw new IOException("Proxy ID of grid node wasn't found."); } URL proxyId = new URL(gridNodeInfo.get("proxyId")); gridNodeContainerId = dockerUtil.findGridNodeContainerByIp(proxyId.getHost()); } return gridNodeContainerId; }

Target:
public String getGridNodeContainerId() throws IOException { if (!gridMode) { throw new UnsupportedOperationException("We can't get grid node container id in local mode."); } if (gridNodeContainerId == null) { String getGridNodeInfoUrl = format( "http://localhost:%s/grid/api/testsession?session=%s", webDriverPort, driver.getSessionId()); Map<String, String> gridNodeInfo; try { gridNodeInfo = httpJsonRequestFactory.fromUrl(getGridNodeInfoUrl).request().asProperties(); } catch (ServerException | UnauthorizedException | ForbiddenException | NotFoundException | ConflictException | BadRequestException e) { throw new IOException(e); } if (!gridNodeInfo.containsKey("proxyId")) { throw new IOException("Proxy ID of grid node wasn't found."); } URL proxyId = new URL(gridNodeInfo.get("proxyId")); gridNodeContainerId = dockerUtil.findGridNodeContainerByIp(proxyId.getHost()); } return gridNodeContainerId; }
Source:
public List<String> getSuggestions(String input) { return WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getWorlds().stream() .map(World::getId) .filter(world -> world.startsWith(input)) .collect(Collectors.toList()); }

Target:
public List<String> getSuggestions(String input) { return getWorlds() .map(World::getId) .filter(world -> world.startsWith(input)) .collect(Collectors.toList()); }
Source:
private Criteria buildCoreCriteria(final Map<StudyFilters, String> parameters, final Order orderBy) { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.createAlias("properties", "pr"); criteria.add(Restrictions.eq("pr.typeId", TermId.STUDY_TYPE.getId())); final DetachedCriteria inactive = DetachedCriteria.forClass(ProjectProperty.class); inactive.add(Restrictions.eq(DmsProjectDao.TYPE_ID, Integer.valueOf(DmsProjectDao.STUDY_STATUS))); inactive.add(Restrictions.eq(DmsProjectDao.VALUE, String.valueOf(DmsProjectDao.DELETED_STUDY))); inactive.setProjection(Projections.property("project.projectId")); criteria.add(Property.forName(DmsProjectDao.PROJECT_ID).notIn(inactive)); if (parameters.containsKey(StudyFilters.PROGRAM_ID)) { criteria.add(Restrictions.eq(StudyFilters.PROGRAM_ID.getParameter(), parameters.get(StudyFilters.PROGRAM_ID))); }else{ criteria.add(Restrictions.isNotNull(StudyFilters.PROGRAM_ID.getParameter())); } if (parameters.containsKey(StudyFilters.LOCATION_ID)) { final DetachedCriteria ppLocation = DetachedCriteria.forClass(ProjectProperty.class); ppLocation.add(Restrictions.eq(DmsProjectDao.TYPE_ID, DmsProjectDao.LOCATION_ABBR)); ppLocation.add(Restrictions.ilike(DmsProjectDao.VALUE, '%' + parameters.get(StudyFilters.LOCATION_ID).toLowerCase() + '%')); ppLocation.setProjection(Projections.property("project.projectId")); criteria.add(Property.forName(DmsProjectDao.PROJECT_ID).in(ppLocation)); } criteria.addOrder(orderBy); return criteria; }

Target:
private Criteria buildCoreCriteria(final Map<StudyFilters, String> parameters, final Order orderBy) { final Criteria criteria = this.getSession().createCriteria(this.getPersistentClass()); criteria.createAlias("properties", "pr"); criteria.add(Restrictions.eq("pr.typeId", TermId.STUDY_TYPE.getId())); final DetachedCriteria inactive = DetachedCriteria.forClass(ProjectProperty.class); inactive.add(Restrictions.eq(DmsProjectDao.TYPE_ID, Integer.valueOf(DmsProjectDao.STUDY_STATUS))); inactive.add(Restrictions.eq(DmsProjectDao.VALUE, String.valueOf(DmsProjectDao.DELETED_STUDY))); inactive.setProjection(Projections.property("project.projectId")); criteria.add(Property.forName(DmsProjectDao.PROJECT_ID).notIn(inactive)); if (parameters.containsKey(StudyFilters.PROGRAM_ID)) { criteria.add(Restrictions.eq(StudyFilters.PROGRAM_ID.getParameter(), parameters.get(StudyFilters.PROGRAM_ID))); } else { criteria.add(Restrictions.isNotNull(StudyFilters.PROGRAM_ID.getParameter())); } if (parameters.containsKey(StudyFilters.LOCATION_ID)) { final DetachedCriteria ppLocation = DetachedCriteria.forClass(ProjectProperty.class); ppLocation.add(Restrictions.eq(DmsProjectDao.TYPE_ID, DmsProjectDao.LOCATION_ID)); ppLocation.add(Restrictions.eq(DmsProjectDao.VALUE, parameters.get(StudyFilters.LOCATION_ID))); ppLocation.setProjection(Projections.property("project.projectId")); criteria.add(Property.forName(DmsProjectDao.PROJECT_ID).in(ppLocation)); } criteria.addOrder(orderBy); return criteria; }
Source:
public void run() { while (true) { try { Thread.sleep(watchInterval); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } if (!isBookieRunning()) { shutdown(); if (null != uncaughtExceptionHandler) { uncaughtExceptionHandler.uncaughtException( this, new BookieDeadException("Bookie is not running any more") .fillInStackTrace()); } break; } } LOG.info("BookieDeathWatcher exited loop!"); }

Target:
public void run() { while (true) { try { Thread.sleep(watchInterval); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } if (!isBookieRunning()) { LOG.info("BookieDeathWatcher noticed the bookie is not running any more, exiting the watch loop!"); throw new RuntimeException("Bookie is not running any more"); } } }
Source:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.SATELLITE, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera( CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .zoom(16) .build()), 4000); fillLayerPointList = new ArrayList<>(); circleLayerFeatureList = new ArrayList<>(); lineLayerPointList = new ArrayList<>(); initCircleSource(); initLineSource(); initFillSource(); circleSource = mapboxMap.getStyle().getSourceAs(CIRCLE_SOURCE_ID); fillSource = mapboxMap.getStyle().getSourceAs(FILL_SOURCE_ID); lineSource = mapboxMap.getStyle().getSourceAs(LINE_SOURCE_ID); initCircleLayer(); initLineLayer(); initFillLayer(); initFloatingActionButtonClickListeners(); Toast.makeText(SatelliteLandSelectActivity.this, R.string.trace_instruction, Toast.LENGTH_LONG).show(); } }); }

Target:
public void onMapReady(@NonNull final MapboxMap mapboxMap) { this.mapboxMap = mapboxMap; mapboxMap.setStyle(Style.SATELLITE, new Style.OnStyleLoaded() { @Override public void onStyleLoaded(@NonNull Style style) { mapboxMap.animateCamera( CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder() .zoom(16) .build()), 4000); circleSource = initCircleSource(style); fillSource = initFillSource(style); lineSource = initLineSource(style); initCircleLayer(style); initLineLayer(style); initFillLayer(style); initFloatingActionButtonClickListeners(); Toast.makeText(SatelliteLandSelectActivity.this, R.string.trace_instruction, Toast.LENGTH_LONG).show(); } }); }
Source:
public static void sendEmail(String content) { if (!shouldSendEmail) { LOGGER.warn("EmailLogger is disabled (email.send must be set to true) or has not been setup. " + "Will not send email. Message: " + content); return; } try { Properties props = System.getProperties(); props.setProperty("mail.transport.protocol", "smtp"); props.put("mail.smtp.host", mailHost); props.put("mail.smtp.port", mailPort); Session session = Session.getInstance(props, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(senderEmail)); for (String to : emailList) message.addRecipient(Message.RecipientType.TO, new InternetAddress(to, false)); message.setSubject(subjectLine); message.setContent(content, "text/html"); Transport.send(message); } catch(Exception exception) { LOGGER.warn("Could not send requested email. Message: " + content, exception); } }

Target:
public static void sendEmail(String content) { if (!shouldSendEmail) { LOGGER.warn("EmailLogger is disabled (email.send must be set to true) or has not been setup. " + "Will not send email. Message: " + content); return; } try { Properties props = System.getProperties(); props.setProperty("mail.transport.protocol", "smtp"); props.put("mail.smtp.host", mailHost); props.put("mail.smtp.port", mailPort); Session session = Session.getInstance(props, null); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(senderEmail)); for (String to : emailList) { message.addRecipient(Message.RecipientType.TO, new InternetAddress(to, false)); } message.setSubject(subjectLine); message.setContent(content, "text/html"); Transport.send(message); } catch(Exception exception) { LOGGER.warn("Could not send requested email. Message: " + content, exception); } }
Source:
public void shouldCreateIndexesInCollection() throws Exception { List<PopulationStatistics> populationStatisticsList = buildPopulationStatsList(); String databaseName = mongoRule.getRandomTemporaryDatabaseName(); StatisticsMongoWriter statisticsMongoWriter = getStatisticsMongoWriter(databaseName); statisticsMongoWriter.write(populationStatisticsList); DBCollection statsCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsStatsName()); assertEquals("[{ \"v\" : 1 , \"key\" : { \"_id\" : 1} , \"name\" : \"_id_\" , \"ns\" : \"" + databaseName + ".populationStatistics\"}, { \"v\" : 1 , \"unique\" : true , \"key\" : " + "{ \"chr\" : 1 , \"start\" : 1 , \"ref\" : 1 , \"alt\" : 1 , \"sid\" : 1 , \"cid\" : 1} , " + "\"name\" : \"vscid\" , \"ns\" : \"" + databaseName + ".populationStatistics\"}]", statsCollection.getIndexInfo().toString()); }

Target:
public void shouldCreateIndexesInCollection() throws Exception { List<PopulationStatistics> populationStatisticsList = buildPopulationStatsList(); String databaseName = mongoRule.getRandomTemporaryDatabaseName(); StatisticsMongoWriter statisticsMongoWriter = getStatisticsMongoWriter(databaseName); statisticsMongoWriter.write(populationStatisticsList); DBCollection statsCollection = mongoRule.getCollection(databaseName, jobOptions.getDbCollectionsStatsName()); List<DBObject> indexes = new ArrayList<>(); indexes.add(new BasicDBObject("v", 1) .append("key", new BasicDBObject("_id", 1)) .append("name", "_id_") .append("ns", databaseName + ".populationStatistics") ); indexes.add(new BasicDBObject("v", 1) .append("unique", true) .append("key", new BasicDBObject("chr", 1) .append("start", 1) .append("ref", 1) .append("alt", 1) .append("sid", 1) .append("cid", 1)) .append("name", "vscid") .append("ns", databaseName + ".populationStatistics") ); assertEquals(statsCollection.getIndexInfo(), indexes); }