auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setTitleIconStartMargin(@Px int margin) { MarginLayoutParams marginParams = (MarginLayoutParams) mTitleIconView.getLayoutParams(); marginParams.setMarginStart(margin); }

Target:
public void setTitleIconStartMargin(@Px int margin) { MarginLayoutParams marginParams = (MarginLayoutParams) mTitleIconView.getLayoutParams(); marginParams.setMarginStart(margin); requestLayout(); }
Source:
void refreshChildren() { IFolder folder = getResource(); Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>(); for (ITmfProjectModelElement element : getChildren()) { childrenMap.put(element.getResource().getName(), element); } try { IResource[] members = folder.members(); for (IResource resource : members) { String name = resource.getName(); boolean isFolder = resource instanceof IFolder && (resource.getPersistentProperty(TmfCommonConstants.TRACETYPE) == null) && !TmfTraceType.getInstance().isDirectoryTrace(resource.getLocationURI().getPath()); ITmfProjectModelElement element = childrenMap.get(name); if (isFolder && !(element instanceof TmfTraceFolder)) { element = new TmfTraceFolder(name, (IFolder) resource, this); } else if (!isFolder && !(element instanceof TmfTraceElement)) { element = new TmfTraceElement(name, resource, this); } else { childrenMap.remove(name); } ((TmfProjectModelElement) element).refreshChildren(); } } catch (CoreException e) { } for (ITmfProjectModelElement danglingChild : childrenMap.values()) { removeChild(danglingChild); } }

Target:
void refreshChildren() { IFolder folder = getResource(); Map<String, ITmfProjectModelElement> childrenMap = new HashMap<>(); for (ITmfProjectModelElement element : getChildren()) { childrenMap.put(element.getResource().getName(), element); } try { IResource[] members = folder.members(); for (IResource resource : members) { String name = resource.getName(); boolean isFolder = resource instanceof IFolder && (resource.getPersistentProperty(TmfCommonConstants.TRACETYPE) == null); ITmfProjectModelElement element = childrenMap.get(name); if (isFolder && !(element instanceof TmfTraceFolder) && !(element instanceof TmfTraceElement)) { if (TmfTraceType.getInstance().isDirectoryTrace(resource.getLocationURI().getPath())) { element = new TmfTraceElement(name, resource, this); } else { element = new TmfTraceFolder(name, (IFolder) resource, this); } } else if (!isFolder && !(element instanceof TmfTraceElement)) { element = new TmfTraceElement(name, resource, this); } else { childrenMap.remove(name); } ((TmfProjectModelElement) element).refreshChildren(); } } catch (CoreException e) { } for (ITmfProjectModelElement danglingChild : childrenMap.values()) { removeChild(danglingChild); } }
Source:
private String encodeOptions(Map<String, String> options) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os); oos.writeInt(options.size()); for (Map.Entry<String, String> entry : options.entrySet()) { oos.writeUTF(entry.getKey()); oos.writeUTF(entry.getValue()); } oos.flush(); return printBase64Binary(os.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
private String encodeOptions(Map<String, String> options) { try (ByteArrayOutputStream os = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(os)) { oos.writeInt(options.size()); for (Map.Entry<String, String> entry : options.entrySet()) { oos.writeUTF(entry.getKey()); oos.writeUTF(entry.getValue()); } oos.flush(); return printBase64Binary(os.toByteArray()); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private void serveAttachmentSet(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { final String documentType = getDocumentType(request); final String documentId = request.getParameter(PortalConstants.DOCUMENT_ID); final User user = UserCacheHolder.getUserFromRequest(request); final TSerializer serializer = new TSerializer(new TSimpleJSONProtocol.Factory()); List<String> attachments = getAttachments(documentId, documentType, user).stream().sorted((left, right) -> { return left.getFilename().compareTo(right.getFilename()); }).map(attachment -> { try { return serializer.toString(attachment); } catch (TException exception) { return "{ \"error\": \"" + TagUtils.escapeAttributeValue(exception.toString()) + "\" }"; } }).collect(Collectors.toList()); JSONObject attachmentTypes = JSONFactoryUtil.createJSONObject(); for (AttachmentType attachmentType : AttachmentType.values()) { attachmentTypes.put(String.valueOf(attachmentType.getValue()), ThriftEnumUtils.enumToString(attachmentType)); } JSONObject checkStatuses = JSONFactoryUtil.createJSONObject(); for (CheckStatus checkStatus : CheckStatus.values()) { checkStatuses.put(String.valueOf(checkStatus.getValue()), ThriftEnumUtils.enumToString(checkStatus)); } try { JSONObject data = JSONFactoryUtil.createJSONObject(); data.put("data", JSONFactoryUtil.createJSONArray(attachments.toString())); data.put("attachmentTypes", attachmentTypes); data.put("checkStatuses", checkStatuses); writeJSON(request, response, data); } catch (JSONException exception) { LOGGER.error("Cannot serialize attachments", exception); response.setProperty(ResourceResponse.HTTP_STATUS_CODE, "500"); } }

Target:
private void serveAttachmentSet(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { final String documentType = getDocumentType(request); final String documentId = request.getParameter(PortalConstants.DOCUMENT_ID); final User user = UserCacheHolder.getUserFromRequest(request); List<Attachment> attachments = getAttachments(documentId, documentType, user).stream() .sorted(Comparator.comparing(Attachment::getFilename)).collect(Collectors.toList()); Map<String, Object> data = Maps.newHashMap(); data.put("data", attachments); data.put("attachmentTypes", ATTACHMENT_TYPE_MAP); data.put("checkStatuses", CHECK_STATUS_MAP); writeJSON(request, response, OBJECT_MAPPER.writeValueAsString(data)); }
Source:
public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> objectToDrop) { List children = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; Point center = graphicalEditPart.getFigure().getBounds().getCenter(); dropObjectsRequest.setLocation(center); dropObjectsRequest.setObjects(objectToDrop); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }

Target:
public static Command lookForCommandInSubContainer(GraphicalEditPart targetEditPart, List<EObject> objectToDrop) { List<?> children = targetEditPart.getChildren(); DropObjectsRequest dropObjectsRequest = new DropObjectsRequest(); for (Object object : children) { if (object instanceof GraphicalEditPart) { GraphicalEditPart graphicalEditPart = (GraphicalEditPart) object; Point center = graphicalEditPart.getFigure().getBounds().getCenter(); dropObjectsRequest.setLocation(center); dropObjectsRequest.setObjects(objectToDrop); Command command = graphicalEditPart.getCommand(dropObjectsRequest); if (command != null) { return command; } } } return null; }
Source:
public String getVoxelId() { return voxelState.getId(); }

Target:
public String getVoxelId() { return this.voxelState.getId(); }
Source:
public ReactiveProcessor apply(Processor component, ReactiveProcessor next) { if (!isInterceptable(component)) { return next; } final ComponentLocation componentLocation = ((Component) component).getLocation(); if (!interceptorFactory.intercept(componentLocation)) { return next; } final ProcessorInterceptor interceptor = interceptorFactory.get(); Map<String, String> dslParameters = (Map<String, String>) ((Component) component).getAnnotation(ANNOTATION_PARAMETERS); ReactiveProcessor interceptedProcessor = doApply(component, next, componentLocation, interceptor, dslParameters.entrySet().stream().filter(param -> !(param.getKey().equals("moduleOperation") || param.getKey().equals("moduleName"))).collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()))); LOGGER.debug("Interceptor '{}' for processor '{}' configured.", interceptor, componentLocation.getLocation()); return interceptedProcessor; }

Target:
public ReactiveProcessor apply(Processor component, ReactiveProcessor next) { if (!isInterceptable(component)) { return next; } final ComponentLocation componentLocation = ((Component) component).getLocation(); if (!interceptorFactory.intercept(componentLocation)) { return next; } final ProcessorInterceptor interceptor = interceptorFactory.get(); Map<String, String> dslParameters = (Map<String, String>) ((Component) component).getAnnotation(ANNOTATION_PARAMETERS); ReactiveProcessor interceptedProcessor = doApply(component, next, componentLocation, interceptor, dslParameters.entrySet().stream().filter(param -> !macroExpansionInternalParams.contains(param.getKey())).collect(toMap(p -> p.getKey(), p -> p.getValue()))); LOGGER.debug("Interceptor '{}' for processor '{}' configured.", interceptor, componentLocation.getLocation()); return interceptedProcessor; }
Source:
public boolean canFlipToNextPage() { if (generationOptions.isAutogeneratedScript()) { return true; } else { return false; } }

Target:
public boolean canFlipToNextPage() { if (contract.eContainer() instanceof Pool) { return generationOptions.isAutogeneratedScript() && super.canFlipToNextPage(); } else { return super.canFlipToNextPage(); } }
Source:
void addTransactionsDependingOn(Set<Transaction> txSet, Set<Transaction> txPool) { Deque<Transaction> txDeque = new LinkedList<Transaction>(); txDeque.addAll(txSet); while(!txDeque.isEmpty()) { Transaction tx = txDeque.poll(); for (Transaction anotherTx : txPool) { if (anotherTx.equals(tx)) continue; for (TransactionInput input : anotherTx.getInputs()) { if (input.getOutpoint().getHash().equals(tx.getHash())) { if (!txDeque.contains(anotherTx)) { txDeque.add(anotherTx); txSet.add(anotherTx); } } } } } }

Target:
void addTransactionsDependingOn(Set<Transaction> txSet, Set<Transaction> txPool) { Map<Sha256Hash, Transaction> txQueue = new LinkedHashMap<Sha256Hash, Transaction>(); for (Transaction tx : txSet) { txQueue.put(tx.getHash(), tx); } while(!txQueue.isEmpty()) { Transaction tx = txQueue.remove(txQueue.keySet().iterator().next()); for (Transaction anotherTx : txPool) { if (anotherTx.equals(tx)) continue; for (TransactionInput input : anotherTx.getInputs()) { if (input.getOutpoint().getHash().equals(tx.getHash())) { if (txQueue.get(anotherTx.getHash()) == null) { txQueue.put(anotherTx.getHash(), anotherTx); txSet.add(anotherTx); } } } } } }
Source:
void processChange(InvocationContext ctx, FlagAffectedCommand command, Object storedKey, Object storedOldValue, Object storedNewValue) { int segment = SegmentSpecificCommand.extractSegment(command, storedKey, keyPartitioner); Object key = extractKey(storedKey); Object oldValue = storedOldValue == UNKNOWN ? UNKNOWN : extractValue(storedOldValue); Object newValue = extractValue(storedNewValue); boolean skipIndexCleanup = command != null && command.hasAnyFlag(FlagBitSets.SKIP_INDEX_CLEANUP); if (!skipIndexCleanup) { if (oldValue == UNKNOWN) { if (shouldModifyIndexes(command, ctx, storedKey, newValue)) { removeFromIndexes(key, segment); } } else if (indexInspector.isIndexedType(oldValue) && (newValue == null || shouldRemove(newValue, oldValue)) && shouldModifyIndexes(command, ctx, storedKey, oldValue)) { removeFromIndexes(oldValue, key, segment); } else if (trace) { log.tracef("Index cleanup not needed for %s -> %s", oldValue, newValue); } } else if (trace) { log.tracef("Skipped index cleanup for command %s", command); } if (indexInspector.isIndexedType(newValue)) { if (shouldModifyIndexes(command, ctx, storedKey, newValue)) { updateIndexes(skipIndexCleanup, newValue, key, segment); } else { if (trace) { log.tracef("Not modifying index for %s (%s)", storedKey, command); } } } else if (trace) { log.tracef("Update not needed for %s", newValue); } }

Target:
void processChange(InvocationContext ctx, FlagAffectedCommand command, Object storedKey, Object storedOldValue, Object storedNewValue) { int segment = SegmentSpecificCommand.extractSegment(command, storedKey, keyPartitioner); Object key = extractKey(storedKey); Object oldValue = storedOldValue == UNKNOWN ? UNKNOWN : extractValue(storedOldValue); Object newValue = extractValue(storedNewValue); boolean skipIndexCleanup = command != null && command.hasAnyFlag(FlagBitSets.SKIP_INDEX_CLEANUP); if (!skipIndexCleanup) { if (oldValue == UNKNOWN) { if (shouldModifyIndexes(command, ctx, storedKey)) { removeFromIndexes(key, segment); } } else if (searchMappingHolder.isIndexedType(oldValue) && (newValue == null || shouldRemove(newValue, oldValue)) && shouldModifyIndexes(command, ctx, storedKey)) { removeFromIndexes(oldValue, key, segment); } else if (trace) { log.tracef("Index cleanup not needed for %s -> %s", oldValue, newValue); } } else if (trace) { log.tracef("Skipped index cleanup for command %s", command); } if (searchMappingHolder.isIndexedType(newValue)) { if (shouldModifyIndexes(command, ctx, storedKey)) { updateIndexes(skipIndexCleanup, newValue, key, segment); } else { if (trace) { log.tracef("Not modifying index for %s (%s)", storedKey, command); } } } else if (trace) { log.tracef("Update not needed for %s", newValue); } }
Source:
public ResponseEntity<Problem> handleDbWriteOperationsBlockedException( final DbWriteOperationsBlockedException exception, final NativeWebRequest request) { LOG.error(exception.getMessage()); return Responses.create(Response.Status.SERVICE_UNAVAILABLE, "Database is currently in read-only mode", request); }

Target:
public ResponseEntity<Problem> handleDbWriteOperationsBlockedException( final DbWriteOperationsBlockedException exception, final NativeWebRequest request) { LOG.warn(exception.getMessage()); return Responses.create(Response.Status.SERVICE_UNAVAILABLE, "Database is currently in read-only mode", request); }
Source:
public void start() { LOG.info("Starting Azure job coordinator."); streamMetadataCache = StreamMetadataCache.apply(METADATA_CACHE_TTL_MS, config); table.addProcessorEntity(INITIAL_STATE, processorId, azureLeaderElector.amILeader()); LOG.info("Starting scheduler for heartbeating."); heartbeat.scheduleTask(); azureLeaderElector.tryBecomeLeader(); LOG.info("Starting scheduler to check for job model version upgrades."); versionUpgrade.setStateChangeListener(createJMVersionUpgradeListener()); versionUpgrade.scheduleTask(); LOG.info("Starting scheduler to check for leader liveness."); leaderAlive.setStateChangeListener(createLeaderLivenessListener()); leaderAlive.scheduleTask(); }

Target:
public void start() { LOG.info("Starting Azure job coordinator."); streamMetadataCache = StreamMetadataCache.apply(METADATA_CACHE_TTL_MS, config); table.addProcessorEntity(INITIAL_STATE, processorId, false); LOG.info("Starting scheduler for heartbeating."); heartbeat.scheduleTask(); azureLeaderElector.tryBecomeLeader(); LOG.info("Starting scheduler to check for job model version upgrades."); versionUpgrade.setStateChangeListener(createJMVersionUpgradeListener()); versionUpgrade.scheduleTask(); LOG.info("Starting scheduler to check for leader liveness."); leaderAlive.setStateChangeListener(createLeaderLivenessListener()); leaderAlive.scheduleTask(); }
Source:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); boolean isLongInstance = value instanceof Long; boolean isStringInstance = value instanceof String && !"".equals(((String) value).trim()); if (value != null && (isStringInstance || isLongInstance)) { Long longValue = tryParseLong(value); String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }

Target:
public ValidationResult validate(Object value) { ValidationResult result = new ValidationResult(); boolean isLongInstance = value instanceof Long; boolean isStringInstance = value instanceof String && !((String) value).trim().isEmpty(); if (value != null && (isStringInstance || isLongInstance)) { Long longValue = tryParseLong(value); String msg = ""; String prefixMsg = ConstantsManager.getInstance().getConstants().thisFieldMustContainNumberInvalidReason(); if (longValue == null) { result.setSuccess(false); msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); result.getReasons().add(msg); } else if (longValue < getMinimum() || longValue > getMaximum()) { if (getMinimum() != Long.MIN_VALUE && getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberBetweenInvalidReason(prefixMsg, getMinimum(), getMaximum()); } else if (getMinimum() != Long.MIN_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberGreaterInvalidReason(prefixMsg, getMinimum()); } else if (getMaximum() != Long.MAX_VALUE) { msg = ConstantsManager.getInstance() .getMessages() .longValidationNumberLessInvalidReason(prefixMsg, getMaximum()); } result.setSuccess(false); result.getReasons().add(msg); } } return result; }
Source:
public void saveConcept_shouldSaveAConceptNumericAsAConcept() throws Exception { executeDataSet(INITIAL_CONCEPTS_XML); Context.setLocale(Locale.US); Concept c2 = new Concept(2); ConceptName cn = new ConceptName("not a numeric anymore", Locale.US); c2.addName(cn); c2.addDescription(new ConceptDescription("some description",Context.getLocale())); c2.setDatatype(new ConceptDatatype(3)); conceptService.saveConcept(c2); Concept secondConcept = conceptService.getConcept(2); assertFalse(secondConcept.isNumeric()); assertEquals("not a numeric anymore", secondConcept.getName(Locale.US).getName()); }

Target:
public void saveConcept_shouldSaveAConceptNumericAsAConcept() throws Exception { executeDataSet(INITIAL_CONCEPTS_XML); Context.setLocale(Locale.US); Concept c2 = new Concept(2); ConceptName cn = new ConceptName("not a numeric anymore", Locale.US); c2.addName(cn); c2.addDescription(new ConceptDescription("some description",null)); c2.setDatatype(new ConceptDatatype(3)); conceptService.saveConcept(c2); Concept secondConcept = conceptService.getConcept(2); assertFalse(secondConcept.isNumeric()); assertEquals("not a numeric anymore", secondConcept.getName(Locale.US).getName()); }
Source:
public void testCommandlineProgramPropertiesOneLineSummaryLength() { PicardCommandLine.processAllCommandLinePrograms( Collections.singletonList("picard"), (Class<picard.cmdline.CommandLineProgram> clazz, CommandLineProgramProperties clProperties) -> Assert.assertTrue( clProperties.oneLineSummary().length() <= CommandLineProgram.MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, String.format("One line summary for tool '%s' exceeds allowable length of %d", clazz.getCanonicalName(), CommandLineProgram.MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH))); }

Target:
public void testCommandlineProgramPropertiesOneLineSummaryLength() { allCLPS.forEach( (Class<picard.cmdline.CommandLineProgram> clazz, CommandLineProgramProperties clProperties) -> { Assert.assertNotNull(clProperties); Assert.assertTrue( clProperties.oneLineSummary().length() <= CommandLineProgram.MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, String.format("One line summary for tool '%s' exceeds allowable length of %d", clazz.getCanonicalName(), CommandLineProgram.MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH)); }); }
Source:
public int searchCommentInGroup(String text, List<StyledText> listStyledText, int commentIndex, List<CommentViewer> commentViewers) { int numResultsInGroup = 0; for (int i = commentViewers.size() - 1; i >= 0; i--) { CommentViewer viewer = commentViewers.get(i); ExpandableComposite composite = (ExpandableComposite) viewer.getControl(); if (hasResultInComment( text, getModel().getTaskData() .getAttributeMapper() .getAttributesByType(getModel().getTaskData(), TaskAttribute.TYPE_COMMENT) .get(commentIndex))) { viewer.setHasSearchStarted(true); if (composite != null && !composite.isExpanded()) { CommonFormUtil.setExpanded(composite, true); } findStyledText(composite, listStyledText); viewer.setHasSearchStarted(false); numResultsInGroup++; } else { if (composite != null && composite.isExpanded()) { } } commentIndex--; } return numResultsInGroup; }

Target:
public int searchCommentInGroup(String text, List<StyledText> listStyledText, int commentIndex, List<CommentViewer> commentViewers) { int numResultsInGroup = 0; for (int i = commentViewers.size() - 1; i >= 0; i--) { CommentViewer viewer = commentViewers.get(i); try { ExpandableComposite composite = (ExpandableComposite) viewer.getControl(); if (hasResultInEachComment( text, getModel().getTaskData() .getAttributeMapper() .getAttributesByType(getModel().getTaskData(), TaskAttribute.TYPE_COMMENT) .get(commentIndex))) { viewer.setHasSearchStarted(true); if (composite != null && !composite.isExpanded()) { CommonFormUtil.setExpanded(composite, true); } findStyledText(composite, listStyledText); numResultsInGroup++; } } finally { viewer.setHasSearchStarted(false); } commentIndex--; } return numResultsInGroup; }
Source:
private Set<AccessModelPrivelege> immutePrivileges(final Set<PrivilegeDto> source) { return source != null ? ImmutableSet.copyOf(source.stream().map(p -> new AccessModelPrivelege(p)).collect(toSet())) : Collections.emptySet(); }

Target:
private Set<AccessModelPrivilege> immutePrivileges(final Set<PrivilegeDto> source) { return source != null ? ImmutableSet.copyOf(source.stream().map(p -> new AccessModelPrivilege(p)).collect(toSet())) : Collections.emptySet(); }
Source:
MongoDbRepository (Properties settings) { final int PORT = parseInt (settings.getProperty ("mongodb.port")); final String HOST = settings.getProperty ("mongodb.host"); final String DATABASE = settings.getProperty ("mongodb.database"); final String WORLD = settings.getProperty ("mongodb.world.collection"); final String FORTUNE = settings.getProperty ("mongodb.fortune.collection"); MongoClient mongoClient = new MongoClient (HOST, PORT); MongoDatabase db = mongoClient.getDatabase (DATABASE); worldCollection = db.getCollection (WORLD); fortuneCollection = db.getCollection (FORTUNE); loadData (); }

Target:
MongoDbRepository (Properties settings) { final int PORT = parseInt (settings.getProperty ("mongodb.port")); final String HOST = settings.getProperty ("mongodb.host"); final String DATABASE = settings.getProperty ("mongodb.database"); final String WORLD = settings.getProperty ("mongodb.world.collection"); final String FORTUNE = settings.getProperty ("mongodb.fortune.collection"); MongoClient mongoClient = new MongoClient (HOST, PORT); MongoDatabase db = mongoClient.getDatabase (DATABASE); worldCollection = db.getCollection (WORLD); fortuneCollection = db.getCollection (FORTUNE); }
Source:
@Test public void writeSpans_updatesPrometheusMetrics() throws Exception { List<Span> spans = asList(LOTS_OF_SPANS[0], LOTS_OF_SPANS[1], LOTS_OF_SPANS[2]); byte[] body = Codec.JSON.writeSpans(spans); Double messagesCount = registry.get("counter.zipkin_collector.spans.http").counter().count(); post("/api/v1/spans", body); post("/api/v1/spans", body); Response response = get("/prometheus"); assertThat(response.isSuccessful()).isTrue(); String prometheus = response.body().string(); assertThat(prometheus) .contains("counter_zipkin_collector_spans_http_total " + (messagesCount + 6)); }

Target:
@Test public void writeSpans_updatesPrometheusMetrics() throws Exception { List<Span> spans = asList(LOTS_OF_SPANS[0], LOTS_OF_SPANS[1], LOTS_OF_SPANS[2]); byte[] body = Codec.JSON.writeSpans(spans); Double messagesCount = registry.get("counter.zipkin_collector.spans.http").counter().count(); long httpCount = registry .find("http_request_duration") .tag("path", "/api/v1/spans") .timer() .count(); httpCount += 2; System.out.print(httpCount); post("/api/v1/spans", body); post("/api/v1/spans", body); Response response = get("/prometheus"); assertThat(response.isSuccessful()).isTrue(); String prometheus = response.body().string(); assertThat(prometheus) .contains("counter_zipkin_collector_spans_http_total " + (messagesCount + 6)); assertThat(prometheus) .contains( "http_request_duration_seconds_count{method=\"POST\",path=\"/api/v1/spans\",status=\"200\",} " + httpCount); }
Source:
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String tagsKey = "Tags=\""; int start = line.indexOf(tagsKey); if (start < 0) { return; } start += tagsKey.length(); int end = line.indexOf('"', start); String cutOffLine = line.substring(start + 4, end - 4); String[] elements = cutOffLine.split("&gt;&lt;"); for (int i = 0; i < elements.length; i++) { outputKey.set(TechnologiesFormatter.removeVersionFromName(elements[i])); for (int j = 0; j < elements.length; j++) { if (i != j) { outputValue.set(TechnologiesFormatter.removeVersionFromName(elements[j])); context.write(outputKey, outputValue); } } } }

Target:
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException { String line = value.toString(); String tagsKey = "Tags=\""; int start = line.indexOf(tagsKey); if (start < 0) { return; } start += tagsKey.length(); int end = line.indexOf('"', start); String cutOffLine = line.substring(start + 4, end - 4); String[] elements = cutOffLine.split("&gt;&lt;"); for (int i = 0; i < elements.length; i++) { outputKey.set(removeVersionFromName(elements[i])); for (int j = 0; j < elements.length; j++) { if (i != j) { outputValue.set(removeVersionFromName(elements[j])); context.write(outputKey, outputValue); } } } }
Source:
public void convertToModelingProject(final IProject project, IProgressMonitor monitor) throws CoreException { final IWorkspaceRunnable create = new IWorkspaceRunnable() { @Override public void run(final IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(Messages.ModelingProjectManagerImpl_convertToModelingProjectTask, 1); doAddModelingNature(project, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); } } }; if (alreadyIsInWorkspaceModificationOperation()) { doAddModelingNature(project, monitor); } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.run(create, workspace.getRuleFactory().createRule(workspace.getRoot()), IWorkspace.AVOID_UPDATE, monitor); } }

Target:
public void convertToModelingProject(final IProject project, IProgressMonitor monitor) throws CoreException { final IWorkspaceRunnable create = new IWorkspaceRunnable() { @Override public void run(final IProgressMonitor monitor) throws CoreException { try { monitor.beginTask(Messages.ModelingProjectManagerImpl_convertToModelingProjectTask, 1); doAddModelingNature(project, new SubProgressMonitor(monitor, 1)); } finally { monitor.done(); } } }; if (alreadyIsInWorkspaceModificationOperation()) { doAddModelingNature(project, monitor); } else { IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.run(create, ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, monitor); } }
Source:
protected void innerDraw(GC gc) { Rectangle drawRect = getBounds(); if (drawRect.width >= 2) { gc.fillRectangle(drawRect); RGBAColor foregroundRGB = BLACK; gc.setAlpha(foregroundRGB.getAlpha()); gc.setForeground(getColor(foregroundRGB.toInt())); gc.drawLine(drawRect.x, drawRect.y, drawRect.x + drawRect.width - 1, drawRect.y); gc.drawLine(drawRect.x, drawRect.y + drawRect.height - 1, drawRect.x + drawRect.width - 1, drawRect.y + drawRect.height - 1); } else { gc.setForeground(gc.getBackground()); gc.drawLine(drawRect.x - 1, drawRect.y, drawRect.x, drawRect.y + drawRect.height -1); } }

Target:
protected void innerDraw(GC gc) { Rectangle drawRect = getBounds(); if (drawRect.width >= 2) { gc.fillRectangle(drawRect); if (drawRect.width > 2) { RGBAColor foregroundRGB = BLACK; gc.setAlpha(foregroundRGB.getAlpha()); gc.setForeground(getColor(foregroundRGB.toInt())); gc.drawLine(drawRect.x, drawRect.y, drawRect.x + drawRect.width - 1, drawRect.y); gc.drawLine(drawRect.x, drawRect.y + drawRect.height - 1, drawRect.x + drawRect.width - 1, drawRect.y + drawRect.height - 1); } } else { gc.setForeground(gc.getBackground()); gc.drawLine(drawRect.x, drawRect.y, drawRect.x, drawRect.y + drawRect.height - 1); } }
Source:
public void run() { while (!canScan()) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } if (pos == null) { pos = getBatchWizard().getFilesToScan().iterator(); } while (pos.hasNext()) { if (getBatchWizard().isReset()) { getBatchWizard().set(); pos = getBatchWizard().getFilesToScan().iterator(); getBatchWizard().getScannedTraces().clearCandidates(); } if (canScan()) { String fileName = pos.next(); boolean updated = false; final List<String> setToReset = new ArrayList<String>(); for (String traceCat : getBatchWizard().getTracesToScan()) { if (ImportUtils.validate(traceCat, fileName)) { getBatchWizard().getScannedTraces().addCandidate(traceCat, new File(fileName)); setToReset.add(traceCat); updated = true; } } position++; final boolean treeUpdated = updated; pb.getDisplay().asyncExec(new Runnable() { @Override public void run() { if (treeUpdated) { for (String traceCat : setToReset) { traceTypeViewer.setChecked(traceCat, false); } traceTypeViewer.refresh(); } pb.setSelection(position); } }); } else { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } }

Target:
public void run() { while (fCanRun == true) { boolean updated = false; try { boolean validCombo; TraceToValidate traceToScan = fTracesToScan.take(); if( !getBatchWizard().hasScanned(traceToScan) ){ getBatchWizard().addResult(traceToScan, ImportUtils.validate(traceToScan)); } validCombo = getBatchWizard().getResult(traceToScan); if (validCombo) { getBatchWizard().getScannedTraces().addCandidate(traceToScan.getTraceType(), new File(traceToScan.getTraceToScan())); updated = true; } position++; final boolean treeUpdated = updated; pb.getDisplay().asyncExec(new UpdateUIRunnable(treeUpdated)); } catch (InterruptedException e) { } } }
Source:
@Override public long getCurrentPmeDuration() { GridDhtPartitionsExchangeFuture fut = ctx.cache().context().exchange().lastTopologyFuture(); return (fut == null || fut.isDone()) ? 0 : TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - fut.getStartTime()); }

Target:
@Override public long getCurrentPmeDuration() { return pmeDuration.value(); }
Source:
public DataFile findByGlobalId(String globalId){ String protocol = ""; String authority = ""; String identifier = ""; int index1 = globalId.indexOf(':'); String nonNullDefaultIfKeyNotFound = ""; String separator = settingsService.getValueForKey(SettingsServiceBean.Key.DoiSeparator, nonNullDefaultIfKeyNotFound); int index2 = globalId.indexOf(separator, index1 + 1); int index3; if (index1 == -1) { logger.info("Error parsing identifier: " + globalId + ". ':' not found in string"); return null; } else { protocol = globalId.substring(0, index1); } if (index2 == -1 ) { logger.info("Error parsing identifier: " + globalId + ". Second separator not found in string"); return null; } else { authority = globalId.substring(index1 + 1, index2); } if (protocol.equals("doi")) { index3 = globalId.indexOf(separator, index2 + 1); if (index3 == -1 ) { identifier = globalId.substring(index2 + 1); } else { if (index3 > -1) { authority = globalId.substring(index1 + 1, index3); identifier = globalId.substring(index3 + 1).toUpperCase(); } } } else { identifier = globalId.substring(index2 + 1).toUpperCase(); } String queryStr = "SELECT s from DataFile s where s.identifier = :identifier and s.protocol= :protocol and s.authority= :authority"; DataFile file = null; try { Query query = em.createQuery(queryStr); query.setParameter("identifier", identifier); query.setParameter("protocol", protocol); query.setParameter("authority", authority); file = (DataFile) query.getSingleResult(); } catch (javax.persistence.NoResultException e) { logger.fine("no file found: " + globalId); } return file; }

Target:
public DataFile findByGlobalId(String globalId) { String queryStr = "select s.id from dvobject s where Concat(s.protocol, ':' , s.authority , s.doiseparator , s.identifier) = '" + globalId + "'"; DataFile file = null; try { Query query = em.createNativeQuery(queryStr); Long fileId = new Long((Integer) query.getSingleResult()); file = em.find(DataFile.class, fileId); } catch (javax.persistence.NoResultException e) { logger.fine("no file found: " + globalId); } return file; }
Source:
public EffectorBody<Void> newSuspendEffectorTask() { return new EffectorBody<Void>() { @Override public Void call(ConfigBag parameters) { suspend(parameters); return null; } }; }

Target:
public EffectorBody<Void> newSuspendEffectorTask() { return new SuspendEffectorBody(); }
Source:
public List<String> getConsumingSegments(String tableNameWithType) { IdealState idealState = _helixAdmin.getResourceIdealState(_helixClusterName, tableNameWithType); if (idealState == null) { throw new IllegalStateException("Ideal state does not exist for table: " + tableNameWithType); } List<String> consumingSegments = new ArrayList<>(); for (String segment : idealState.getPartitionSet()) { Map<String, String> instanceStateMap = idealState.getInstanceStateMap(segment); if (instanceStateMap.containsValue(SegmentStateModel.CONSUMING)) { consumingSegments.add(segment); } } return consumingSegments; }

Target:
public Set<String> getConsumingSegments(String tableNameWithType) { IdealState idealState = _helixAdmin.getResourceIdealState(_helixClusterName, tableNameWithType); if (idealState == null) { throw new IllegalStateException("Ideal state does not exist for table: " + tableNameWithType); } Set<String> consumingSegments = new HashSet<>(); for (String segment : idealState.getPartitionSet()) { Map<String, String> instanceStateMap = idealState.getInstanceStateMap(segment); if (instanceStateMap.containsValue(SegmentStateModel.CONSUMING)) { consumingSegments.add(segment); } } return consumingSegments; }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { TransactionalEditingDomain editingDomain = getTableEditingDomain(); Table table = getTable(); if (null != editingDomain && null != table) { boolean autoResizeCellHeightFlag = StyleUtils.getBooleanNamedStyleValue(table, NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT); StyleUtils.setBooleanNamedStyle(editingDomain, table, NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT, !autoResizeCellHeightFlag); refreshTable(); } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { TransactionalEditingDomain editingDomain = getTableEditingDomain(); Table table = getTable(); if (null != editingDomain && null != table) { BooleanValueStyle autoResizeValue = (BooleanValueStyle) table.getNamedStyle(NattablestylePackage.eINSTANCE.getBooleanValueStyle(), NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT); if (null != autoResizeValue) { StyleUtils.setBooleanNamedStyle(editingDomain, table, NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT, !autoResizeValue.isBooleanValue()); } else { StyleUtils.initBooleanNamedStyle(editingDomain, table, NamedStyleConstants.AUTO_RESIZE_CELL_HEIGHT, false); } HandlerUtil.toggleCommandState(event.getCommand()); } return null; }
Source:
public void resetPositions(int positionCount) { positions = ensureCapacity(positions, positionCount); this.positionCount = 0; }

Target:
private void resetPositions(int positionCount) { positions = ensureCapacity(positions, positionCount); this.positionCount = 0; }
Source:
private boolean shouldSkipCheck() { long currentTime = Time.monotonicNow(); long minInterval = Math.min(staleNodeIntervalMs, deadNodeIntervalMs); if ((currentTime - lastHealthCheck) >= minInterval) { return true; } return false; }

Target:
private boolean shouldSkipCheck() { long currentTime = Time.monotonicNow(); long minInterval = Math.min(staleNodeIntervalMs, deadNodeIntervalMs); return ((currentTime - lastHealthCheck) >= minInterval); }
Source:
public String get(final Object o, final String s) { final ContainerRequest request = (ContainerRequest) o; final List<String> requestHeader = request.getRequestHeader(s); if (requestHeader == null) { return null; } if (requestHeader.size() > 0) { return requestHeader.get(0); } return null; }

Target:
public String get(final Object o, final String s) { final ContainerRequest request = (ContainerRequest) o; final List<String> requestHeader = request.getRequestHeader(s); if (requestHeader != null && requestHeader.size() > 0) { return requestHeader.get(0); } return null; }
Source:
public static void showMapsWithMeUrl(Activity caller, PendingIntent pendingIntent, double zoomLevel, String url) { final Uri uri = Uri.parse(url); final String[] latlon = uri.getQueryParameter("ll").split(","); final double lat = Double.parseDouble(latlon[0]); final double lon = Double.parseDouble(latlon[1]); final String name = uri.getQueryParameter("n"); final String id = uri.getQueryParameter("id"); showPointsOnMap(caller, name, zoomLevel, pendingIntent, new MWMPoint(lat, lon, name, id)); }

Target:
public static void showMapsWithMeUrl(Activity caller, PendingIntent pendingIntent, double zoomLevel, String url) { final Uri uri = Uri.parse(url); final String latlon[] = uri.getQueryParameter("ll").split(","); final double lat = Double.parseDouble(latlon[0]); final double lon = Double.parseDouble(latlon[1]); final String name = uri.getQueryParameter("n"); final String id = uri.getQueryParameter("id"); showPointsOnMap(caller, name, zoomLevel, pendingIntent, new MWMPoint(lat, lon, name, id)); }
Source:
private void assertTableSize(MySqlDataAccessor dataAccessor, int expectedNumRows) throws SQLException { Connection dbConnection = dataAccessor.getDatabaseConnection(true); Statement statement = dbConnection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM " + AccountReportsDao.ACCOUNT_REPORTS_TABLE); int numRows = 0; if (resultSet != null) { while (resultSet.next()) { numRows++; } } resultSet.close(); assertEquals(expectedNumRows, numRows); }

Target:
private void assertTableSize(MySqlDataAccessor dataAccessor, int expectedNumRows) throws SQLException { Connection dbConnection = dataAccessor.getDatabaseConnection(true); Statement statement = dbConnection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT * FROM " + AccountReportsDao.ACCOUNT_REPORTS_TABLE); int numRows = 0; if (resultSet != null) { while (resultSet.next()) { numRows++; } resultSet.close(); } assertEquals(expectedNumRows, numRows); }
Source:
private boolean generatePom(Model parent, File basedir) throws MojoExecutionException { if (isPluginProject(basedir)) { getLog().debug("Found plugin PDE project " + toString(basedir)); generatePluginPom(parent, basedir); } else if (isFeatureProject(basedir)) { getLog().debug("Found feature PDE project " + toString(basedir)); generateFeaturePom(parent, basedir); } else if (isEclipseRepositoryProject(basedir)) { getLog().debug("Found eclipse-repository PDE project " + toString(basedir)); generateEclipseRepositoryPom(parent, basedir); } else if (isUpdateSiteProject(basedir)) { getLog().debug("Found update site PDE project " + toString(basedir)); getLog().warn("Old style update site found for " + toString(basedir) + ". It is recommended you rename your site.xml to category.xml."); generateUpdateSitePom(parent, basedir); } else { getLog().debug("Not a PDE project " + toString(basedir)); return false; } return true; }

Target:
private boolean generatePom(Model parent, File basedir) throws MojoExecutionException { if (isPluginProject(basedir)) { getLog().debug("Found plugin PDE project " + toString(basedir)); generatePluginPom(parent, basedir); } else if (isFeatureProject(basedir)) { getLog().debug("Found feature PDE project " + toString(basedir)); generateFeaturePom(parent, basedir); } else if (isEclipseRepositoryProject(basedir)) { getLog().debug("Found eclipse-repository PDE project " + toString(basedir)); generateEclipseRepositoryPom(parent, basedir); } else if (isUpdateSiteProject(basedir)) { getLog().debug("Found update site PDE project " + toString(basedir)); getLog().warn("Old style update site found for " + toString(basedir) + ". It is recommended you rename your site.xml to category.xml " + "and use packaging type eclipse-repository instead."); generateUpdateSitePom(parent, basedir); } else { getLog().debug("Not a PDE project " + toString(basedir)); return false; } return true; }
Source:
public PatchLineComment saveDraft(Patch.Key patchKey, String message, int line, short side, String parentUuid, IProgressMonitor monitor) throws GerritException { final Version version = getCachedVersion(monitor); PatchLineComment.Key id = new PatchLineComment.Key(patchKey, null); final PatchLineComment comment = new PatchLineComment(id, line, getAccount(monitor).getId(), parentUuid); comment.setMessage(message); comment.setSide(side); return execute(monitor, new Operation<PatchLineComment>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getPatchDetailService(version).saveDraft(comment, this); } }); }

Target:
public PatchLineComment saveDraft(Patch.Key patchKey, String message, int line, short side, String parentUuid, IProgressMonitor monitor) throws GerritException { PatchLineComment.Key id = new PatchLineComment.Key(patchKey, null); final PatchLineComment comment = new PatchLineComment(id, line, getAccount(monitor).getId(), parentUuid); comment.setMessage(message); comment.setSide(side); return execute(monitor, new Operation<PatchLineComment>() { @Override public void execute(IProgressMonitor monitor) throws GerritException { getPatchDetailService().saveDraft(comment, this); } }); }
Source:
protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); ______TS("only instructors of the same course can access"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); verifyInaccessibleWithoutModifyInstructorPrivilege(submissionParams); ______TS("instructors of other courses cannot access"); verifyInaccessibleForInstructorsOfOtherCourses(submissionParams); }

Target:
protected void testAccessControl() throws Exception { InstructorAttributes instructor = typicalBundle.instructors.get("instructor3OfCourse1"); ______TS("only instructors of the same course with modify permission can access"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, instructor.courseId, }; verifyOnlyInstructorsOfTheSameCourseCanAccess(submissionParams); verifyInaccessibleWithoutModifyInstructorPrivilege(submissionParams); ______TS("instructors of other courses cannot access"); verifyInaccessibleForInstructorsOfOtherCourses(submissionParams); ______TS("invalid course id cannot access"); String[] invalidCouseIdParams = new String[] { Const.ParamsNames.COURSE_ID, "invalid-course-id", }; verifyCannotAccess(invalidCouseIdParams); }
Source:
public int acceptsAssignedUser() { if (User.PLANNING_USER.getEntityId().equals(getUser().getEntityId())) { return 0; } return TaskHelper.isPotentialOwner(this, getUser()) ? 0 : -1; }

Target:
public boolean acceptsAssignedUser() { if (User.PLANNING_USER.getEntityId().equals(getUser().getEntityId())) { return true; } return TaskHelper.isPotentialOwner(this, getUser()); }
Source:
private static int parseEap(String eapString) { if (eapString == null) { return WifiEnterpriseConfig.Eap.NONE; } try { return (Integer) WifiEnterpriseConfig.Eap.class.getField(eapString).get(null); } catch (NoSuchFieldException e) { throw new IllegalArgumentException("Unable to find WifiEnterpriseConfig.Eap value for " + eapString); } catch (IllegalAccessException e) { throw new IllegalArgumentException("Unable to parse Eap parameter " + eapString, e); } }

Target:
private static int parseEap(String eapString) { if (eapString == null) { return WifiEnterpriseConfig.Eap.NONE; } switch (eapString) { case "NONE": return WifiEnterpriseConfig.Eap.NONE; case "PEAP": return WifiEnterpriseConfig.Eap.PEAP; case "PWD": return WifiEnterpriseConfig.Eap.PWD; case "TLS": return WifiEnterpriseConfig.Eap.TLS; case "TTLS": return WifiEnterpriseConfig.Eap.TTLS; default: throw new IllegalArgumentException("Unknown value for EAP method: " + eapString); } }
Source:
public void create(User user, boolean isTemporary) throws ConflictException, ServerException { if (isNameReserved(user.getName())) { throw new ConflictException("Username is reserved"); } user.withId(generate("user", ID_LENGTH)) .withPassword(firstNonNull(user.getPassword(), generate("", PASSWORD_LENGTH))); userDao.create(user); profileDao.create(new Profile(user.getId())); final Map<String, String> preferences = new HashMap<>(4); preferences.put("temporary", Boolean.toString(isTemporary)); preferences.put("codenvy:created", Long.toString(System.currentTimeMillis())); try { preferenceDao.setPreferences(user.getId(), preferences); } catch (NotFoundException e) { LOG.warn(format("Cannot set creation time preferences for user %s.", user.getId()), e); } }

Target:
public void create(User user, boolean isTemporary) throws ConflictException, ServerException { if (reservedNames.contains(user.getName().toLowerCase())) { throw new ConflictException(String.format("Username \"%s\" is reserved", user.getName())); } user.withId(generate("user", ID_LENGTH)) .withPassword(firstNonNull(user.getPassword(), generate("", PASSWORD_LENGTH))); userDao.create(user); profileDao.create(new Profile(user.getId())); final Map<String, String> preferences = new HashMap<>(4); preferences.put("temporary", Boolean.toString(isTemporary)); preferences.put("codenvy:created", Long.toString(System.currentTimeMillis())); try { preferenceDao.setPreferences(user.getId(), preferences); } catch (NotFoundException e) { LOG.warn(format("Cannot set creation time preferences for user %s.", user.getId()), e); } }
Source:
public void send(EmailType messageType, Map<String, Object> parameters, String... emails) { if (emails == null || emails.length == 0 || StringUtils.isBlank(emails[0])) { return; } MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper; try { final String emailBody = contentBuilder.build(messageType.getTemplate(), parameters); LOGGER.debug("Sending email: \n\n\n{}\n\n\n", messageType, emailBody); helper = new MimeMessageHelper(message, true); helper.setSubject(messageType.getSubject()); helper.setFrom(from, notifier); helper.setTo(emails); helper.setText(emailBody, true); mailSender.send(message); } catch (MessagingException | MailException | UnsupportedEncodingException ex) { LOGGER.error("{} [user email: {}, subject: {2}]", ex.getMessage(), emails, messageType.getSubject(), ex); throw new RuntimeException(ex); } }

Target:
public void send(EmailType messageType, Map<String, Object> parameters, String... emails) { if (emails == null || emails.length == 0 || StringUtils.isBlank(emails[0])) { return; } MimeMessage message = mailSender.createMimeMessage(); MimeMessageHelper helper; try { final String emailBody = contentBuilder.build(messageType.getTemplate(), parameters); LOGGER.debug("Sending email: \n\n\n{}\n\n\n", messageType, emailBody); helper = new MimeMessageHelper(message, true); helper.setSubject(messageType.getSubject()); helper.setFrom(from, notifier); helper.setTo(emails); helper.setText(emailBody, true); mailSender.send(message); } catch (MessagingException | MailException | UnsupportedEncodingException ex) { LOGGER.error("{} [user email: {}, subject: {}]", ex.getMessage(), emails, messageType.getSubject(), ex); throw new RuntimeException(ex); } }