auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute() { String feedbackSessionName = getNonNullRequestParamValue(ParamsNames.SUBMISSION_FEEDBACK); String courseId = getNonNullRequestParamValue(ParamsNames.SUBMISSION_COURSE); String[] usersToRemind = getNonNullRequestParamValues(ParamsNames.SUBMISSION_REMIND_USERLIST); String[] googleIdOfInstructorToNotify = getNonNullRequestParamValues(ParamsNames.USER_ID); try { FeedbackSessionAttributes session = logic.getFeedbackSession(feedbackSessionName, courseId); List<StudentAttributes> studentsToRemindList = new ArrayList<>(); List<InstructorAttributes> instructorsToRemindList = new ArrayList<>(); InstructorAttributes instructorToNotify = logic.getInstructorForGoogleId(courseId, googleIdOfInstructorToNotify[0]); for (String userEmail : usersToRemind) { StudentAttributes student = logic.getStudentForEmail(courseId, userEmail); if (student != null) { studentsToRemindList.add(student); } InstructorAttributes instructor = logic.getInstructorForEmail(courseId, userEmail); if (instructor != null) { instructorsToRemindList.add(instructor); } } List<EmailWrapper> emails = new EmailGenerator().generateFeedbackSessionReminderEmails( session, studentsToRemindList, instructorsToRemindList, instructorToNotify); taskQueuer.scheduleEmailsForSending(emails); } catch (Exception e) { log.severe("Unexpected error while sending emails: " + TeammatesException.toStringWithStackTrace(e)); } }

Target:
public void execute() { String feedbackSessionName = getNonNullRequestParamValue(ParamsNames.SUBMISSION_FEEDBACK); String courseId = getNonNullRequestParamValue(ParamsNames.SUBMISSION_COURSE); String[] usersToRemind = getNonNullRequestParamValues(ParamsNames.SUBMISSION_REMIND_USERLIST); String googleIdOfInstructorToNotify = getNonNullRequestParamValue(ParamsNames.USER_ID); try { FeedbackSessionAttributes session = logic.getFeedbackSession(feedbackSessionName, courseId); List<StudentAttributes> studentsToRemindList = new ArrayList<>(); List<InstructorAttributes> instructorsToRemindList = new ArrayList<>(); InstructorAttributes instructorToNotify = logic.getInstructorForGoogleId(courseId, googleIdOfInstructorToNotify); for (String userEmail : usersToRemind) { StudentAttributes student = logic.getStudentForEmail(courseId, userEmail); if (student != null) { studentsToRemindList.add(student); } InstructorAttributes instructor = logic.getInstructorForEmail(courseId, userEmail); if (instructor != null) { instructorsToRemindList.add(instructor); } } List<EmailWrapper> emails = new EmailGenerator().generateFeedbackSessionReminderEmails( session, studentsToRemindList, instructorsToRemindList, instructorToNotify); taskQueuer.scheduleEmailsForSending(emails); } catch (Exception e) { log.severe("Unexpected error while sending emails: " + TeammatesException.toStringWithStackTrace(e)); } }
Source:
public void createTable(TableReference tableRef, byte[] tableMetadata) { maybeLog(() -> delegate.createTable(tableRef, tableMetadata), (logger, stopwatch) -> logTimeAndTable(logger, "createTable", tableRef, stopwatch)); }

Target:
public void createTable(TableReference tableRef, byte[] tableMetadata) { maybeLog(() -> delegate.createTable(tableRef, tableMetadata), logTimeAndTable("createTable", tableRef)); }
Source:
public Date getCreated() { return created != null ? new Date(created.getTime()) : null; }

Target:
public Date getCreated() { return created; }
Source:
public void onAvailabilityChecked(OnAvailabilityChecked event) { if (mRequestedEmail == null || !mRequestedEmail.equalsIgnoreCase(event.value)) { return; } if (isInProgress()) { endProgress(); } if (event.isError()) { AppLog.e(T.API, "OnAvailabilityChecked has error: " + event.error.type + " - " + event.error.message); ActivityUtils.hideKeyboardForced(mEmailInput); showEmailError(R.string.error_generic_network); return; } switch (event.type) { case EMAIL: if (event.isAvailable) { ActivityUtils.hideKeyboardForced(mEmailInput); showEmailError(R.string.email_not_registered_wpcom); } else if (mLoginListener != null) { ActivityUtils.hideKeyboardForced(mEmailInput); mLoginListener.gotWpcomEmail(event.value); } break; default: AppLog.e(T.API, "OnAvailabilityChecked unhandled event type: " + event.error.type); break; } }

Target:
public void onAvailabilityChecked(OnAvailabilityChecked event) { if (mRequestedEmail == null || !mRequestedEmail.equalsIgnoreCase(event.value)) { return; } if (isInProgress()) { endProgress(); } if (event.isError()) { AppLog.e(T.API, "OnAvailabilityChecked has error: " + event.error.type + " - " + event.error.message); ActivityUtils.hideKeyboardForced(mEmailInput); if (event.error.type == AccountStore.IsAvailableErrorType.INVALID) { showEmailError(R.string.email_invalid); } else { showErrorDialog(getString(R.string.error_generic_network)); } return; } switch (event.type) { case EMAIL: if (event.isAvailable) { ActivityUtils.hideKeyboardForced(mEmailInput); showEmailError(R.string.email_not_registered_wpcom); } else if (mLoginListener != null) { ActivityUtils.hideKeyboardForced(mEmailInput); mLoginListener.gotWpcomEmail(event.value); } break; default: AppLog.e(T.API, "OnAvailabilityChecked unhandled event type: " + event.error.type); break; } }
Source:
public void release(Object lockOwner) { Objects.requireNonNull(lockOwner, "Lock Owner should be non-null"); if (trace) { log.tracef("Release lock for %s.", lockOwner); } LockPlaceHolder wantToRelease = lockOwners.get(lockOwner); if (wantToRelease == null) { if (trace) { log.tracef("%s not found!", lockOwner); } return; } final boolean released = wantToRelease.setReleased(); if (trace) { log.tracef("Release lock for %s? %s", wantToRelease, released); } LockPlaceHolder currentLocked = current; if (currentLocked == wantToRelease) { if (!casRelease(currentLocked)) { if (trace) { log.tracef("Releasing lock for %s. It is the current lock owner but another thread changed it.", lockOwner); } } else { tryAcquire(); } } }

Target:
public void release(Object lockOwner) { Objects.requireNonNull(lockOwner, "Lock Owner should be non-null"); if (trace) { log.tracef("Release lock for %s.", lockOwner); } LockPlaceHolder wantToRelease = lockOwners.get(lockOwner); if (wantToRelease == null) { if (trace) { log.tracef("%s not found!", lockOwner); } return; } final boolean released = wantToRelease.setReleased(); if (trace) { log.tracef("Release lock for %s? %s", wantToRelease, released); } LockPlaceHolder currentLocked = current; if (currentLocked == wantToRelease) { tryAcquire(wantToRelease); } }
Source:
public static Set<org.drools.workbench.models.datamodel.oracle.Annotation> getClassAnnotations( Class<?> clazz ) { if ( clazz == null ) { return null; } return getAnnotations( clazz.getAnnotations(), false ); }

Target:
public static Set<org.drools.workbench.models.datamodel.oracle.Annotation> getClassAnnotations( Class<?> clazz ) { if ( clazz == null ) { return Collections.EMPTY_SET; } return getAnnotations( clazz.getAnnotations(), false ); }
Source:
public void setUp() throws Exception { streamNames.addAll(Arrays.asList("T1", "T2")); }

Target:
public void setUp() throws Exception { streamNames.addAll(Arrays.asList("T1", "T3")); }
Source:
private Response doGetAgent(String artifact, String version) throws IOException { if (!artifact.endsWith("org.eclipse.che.ws-agent")) { return Response.status(Response.Status.NOT_FOUND).build(); } String content = format("{ \"name\" : \"%s\", \"version\" : \"%s\"}", artifact, version); java.nio.file.Path file = Paths.get(System.getProperty("java.io.tmpdir"), "config.tmp"); copy(new ByteArrayInputStream(content.getBytes()), file, StandardCopyOption.REPLACE_EXISTING); return Response.ok(file.toFile(), MediaType.APPLICATION_OCTET_STREAM) .header("Content-Length", String.valueOf(Files.size(file))) .header("Content-Disposition", "attachment; filename=" + file.getFileName().toString()) .build(); }

Target:
private Response doGetAgent(String artifact, String version) throws IOException { if (!artifact.endsWith("org.eclipse.che.ws-agent")) { return Response.status(Response.Status.NOT_FOUND).build(); } String content = format("{ \"name\" : \"%s\", \"version\" : \"%s\"}", artifact, version); java.nio.file.Path file = Paths.get(System.getProperty("java.io.tmpdir"), "config.tmp"); file.toFile().deleteOnExit(); copy(new ByteArrayInputStream(content.getBytes()), file, StandardCopyOption.REPLACE_EXISTING); return Response.ok(file.toFile(), MediaType.APPLICATION_OCTET_STREAM) .header("Content-Length", String.valueOf(Files.size(file))) .header("Content-Disposition", "attachment; filename=" + file.getFileName().toString()) .build(); }
Source:
protected boolean mergeImpl() throws IOException { DirCache dc = getRepository().lockDirCache(); try { builder = dc.builder(); DirCacheBuildIterator buildIt = new DirCacheBuildIterator(builder); tw = new NameConflictTreeWalk(db); tw.reset(); tw.addTree(mergeBase()); tw.addTree(sourceTrees[0]); tw.addTree(sourceTrees[1]); tw.addTree(buildIt); tw.addTree(new FileTreeIterator(getRepository().getWorkTree(), getRepository().getFS())); while (tw.next()) { if (!processEntry( tw.getTree(T_BASE, CanonicalTreeParser.class), tw.getTree(T_OURS, CanonicalTreeParser.class), tw.getTree(T_THEIRS, CanonicalTreeParser.class), tw.getTree(T_INDEX, DirCacheBuildIterator.class), tw.getTree(T_FILE, WorkingTreeIterator.class))) { cleanUp(); return false; } if (tw.isSubtree() && enterSubtree) tw.enterSubtree(); } if (!builder.commit()) { cleanUp(); throw new IndexWriteException(); } builder = null; checkout(); if (getUnmergedPathes().isEmpty()) { resultTree = dc.writeTree(oi); return true; } else { resultTree = null; return false; } } finally { dc.unlock(); } }

Target:
protected boolean mergeImpl() throws IOException { boolean implicitDirCache = false; if (dircache == null) { dircache = getRepository().lockDirCache(); implicitDirCache = true; } try { builder = dircache.builder(); DirCacheBuildIterator buildIt = new DirCacheBuildIterator(builder); tw = new NameConflictTreeWalk(db); tw.reset(); tw.addTree(mergeBase()); tw.addTree(sourceTrees[0]); tw.addTree(sourceTrees[1]); tw.addTree(buildIt); if (workingTreeIt != null) tw.addTree(workingTreeIt); while (tw.next()) { if (!processEntry( tw.getTree(T_BASE, CanonicalTreeParser.class), tw.getTree(T_OURS, CanonicalTreeParser.class), tw.getTree(T_THEIRS, CanonicalTreeParser.class), tw.getTree(T_INDEX, DirCacheBuildIterator.class), (workingTreeIt == null) ? null : tw.getTree(T_FILE, WorkingTreeIterator.class))) { cleanUp(); return false; } if (tw.isSubtree() && enterSubtree) tw.enterSubtree(); } if (!builder.commit()) { cleanUp(); throw new IndexWriteException(); } builder = null; checkout(); if (getUnmergedPathes().isEmpty()) { resultTree = dircache.writeTree(oi); return true; } else { resultTree = null; return false; } } finally { if (implicitDirCache) dircache.unlock(); } }
Source:
public String update(Request request, Response response) { String fromCookie = request.cookie(COOKIE_NAME); final Long userId = currentUserId(request); if (!Objects.equals(pipelineSelectionsService.load(fromCookie, userId).etag(), getIfMatch(request))) { response.status(PRECONDITION_FAILED); return "Update failed because client filter data is out-of-date"; } Filters filters; try { filters = Filters.fromJson(request.body()); } catch (FilterValidationException | JsonParseException e) { response.status(BAD_REQUEST); return e.getMessage(); } Long recordId = pipelineSelectionsService.save(fromCookie, userId, filters); if (!apiAuthenticationHelper.securityEnabled()) { response.cookie("/go", COOKIE_NAME, String.valueOf(recordId), ONE_YEAR, systemEnvironment.isSessionCookieSecure(), true); } response.status(OK); return format("{ \"contentHash\": \"%s\" }", pipelineSelectionsService.load(fromCookie, userId).etag()); }

Target:
public String update(Request request, Response response) { String fromCookie = request.cookie(COOKIE_NAME); final Long userId = currentUserId(request); if (!Objects.equals(pipelineSelectionsService.load(fromCookie, userId).etag(), getIfMatch(request))) { throw HaltApiResponses.haltBecauseEtagDoesNotMatch(DATA_IS_OUT_OF_DATE); } Filters filters; try { filters = Filters.fromJson(request.body()); } catch (FilterValidationException | JsonParseException e) { throw HaltApiResponses.haltBecauseOfReason(e.getMessage()); } Long recordId = pipelineSelectionsService.save(fromCookie, userId, filters); if (!apiAuthenticationHelper.securityEnabled()) { response.cookie("/go", COOKIE_NAME, String.valueOf(recordId), ONE_YEAR, systemEnvironment.isSessionCookieSecure(), true); } response.status(OK); return format("{ \"contentHash\": \"%s\" }", pipelineSelectionsService.load(fromCookie, userId).etag()); }
Source:
public static boolean containsKey(String key) { return props.containsKey(key); }

Target:
public boolean containsKey(String key) { return props.containsKey(key); }
Source:
private void lsRefsV2() throws IOException { LsRefsV2Request.Builder builder = LsRefsV2Request.builder(); List<String> prefixes = new ArrayList<>(); String line = pckIn.readString(); END if not. if (line == PacketLineIn.DELIM) { while ((line = pckIn.readString()) != PacketLineIn.END) { if (line.equals("peel")) { builder.setPeel(true); } else if (line.equals("symrefs")) { builder.setSymrefs(true); } else if (line.startsWith("ref-prefix ")) { prefixes.add(line.substring("ref-prefix ".length())); } else { throw new PackProtocolException(MessageFormat .format(JGitText.get().unexpectedPacketLine, line)); } } } else if (line != PacketLineIn.END) { throw new PackProtocolException(MessageFormat .format(JGitText.get().unexpectedPacketLine, line)); } LsRefsV2Request req = builder.setRefPrefixes(prefixes).build(); protocolV2Hook.onLsRefs(req); rawOut.stopBuffering(); PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); adv.setUseProtocolV2(true); if (req.getPeel()) { adv.setDerefTags(true); } try { advertiseRefsHook.advertiseRefs(this); } catch (ServiceMayNotContinueException fail) { if (fail.getMessage() != null) { adv.writeOne("ERR " + fail.getMessage()); fail.setOutput(); } throw fail; } Map<String, Ref> refsToSend; if (req.getRefPrefixes().isEmpty()) { refsToSend = getAdvertisedOrDefaultRefs(); } else { refsToSend = new HashMap<>(); for (String refPrefix : req.getRefPrefixes()) { for (Ref ref : db.getRefDatabase().getRefsByPrefix(refPrefix)) { refsToSend.put(ref.getName(), ref); } } } if (req.getSymrefs()) { findSymrefs(adv, refsToSend); } adv.send(refsToSend); adv.end(); }

Target:
private void lsRefsV2() throws IOException { LsRefsV2Request.Builder builder = LsRefsV2Request.builder(); List<String> prefixes = new ArrayList<>(); String line = pckIn.readString(); END if not. if (line == PacketLineIn.DELIM) { while ((line = pckIn.readString()) != PacketLineIn.END) { if (line.equals("peel")) { builder.setPeel(true); } else if (line.equals("symrefs")) { builder.setSymrefs(true); } else if (line.startsWith("ref-prefix ")) { prefixes.add(line.substring("ref-prefix ".length())); } else { throw new PackProtocolException(MessageFormat .format(JGitText.get().unexpectedPacketLine, line)); } } } else if (line != PacketLineIn.END) { throw new PackProtocolException(MessageFormat .format(JGitText.get().unexpectedPacketLine, line)); } LsRefsV2Request req = builder.setRefPrefixes(prefixes).build(); protocolV2Hook.onLsRefs(req); rawOut.stopBuffering(); PacketLineOutRefAdvertiser adv = new PacketLineOutRefAdvertiser(pckOut); adv.setUseProtocolV2(true); if (req.getPeel()) { adv.setDerefTags(true); } Map<String, Ref> refsToSend; if (req.getRefPrefixes().isEmpty()) { refsToSend = getAdvertisedOrDefaultRefs(); } else { refsToSend = new HashMap<>(); for (String refPrefix : req.getRefPrefixes()) { for (Ref ref : db.getRefDatabase().getRefsByPrefix(refPrefix)) { refsToSend.put(ref.getName(), ref); } } } if (req.getSymrefs()) { findSymrefs(adv, refsToSend); } adv.send(refsToSend); adv.end(); }
Source:
public static <T extends EventUiBinder> T get(final EventType eventType) { return (T) uiBinderMap.get(eventType); }

Target:
public static <T extends EventLayout> T get(final EventType eventType) { return (T) uiBinderMap.get(eventType); }
Source:
public static boolean setExternalUserId(final CallbackContext callback, JSONArray data) { try { String authHashToken = null; if (data.length() > 0) { authHashToken = data.getString(1); } OneSignal.setExternalUserId(data.getString(0), authHashToken, new OneSignal.OSExternalUserIdUpdateCompletionHandler() { @Override public void onComplete(JSONObject results) { CallbackHelper.callbackSuccess(callback, results); } }); return true; } catch (JSONException e) { e.printStackTrace(); } return false; }

Target:
public static boolean setExternalUserId(final CallbackContext callback, JSONArray data) { try { String authHashToken = null; if (data.length() > 1) authHashToken = data.getString(1); OneSignal.setExternalUserId(data.getString(0), authHashToken, new OneSignal.OSExternalUserIdUpdateCompletionHandler() { @Override public void onComplete(JSONObject results) { CallbackHelper.callbackSuccess(callback, results); } }); return true; } catch (JSONException e) { e.printStackTrace(); } return false; }
Source:
public static String readLine(final InputStream is) throws IOException { return readLine(is,100); }

Target:
public static String readLine(final InputStream is) throws IOException { return readLine(is, DEFAULT_BUFFER_SIZE); }
Source:
public AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) throws FormException { GlobalMatrixAuthorizationStrategy gmas = create(); Map<String,Object> data = formData.getJSONObject("data"); for(Map.Entry<String,Object> r : data.entrySet()) { String sid = r.getKey(); if (!(r.getValue() instanceof JSONObject)) { throw new FormException("not an object: " + formData, "data"); } Map<String,Object> value = (JSONObject) r.getValue(); for (Map.Entry<String,Object> e : value.entrySet()) { if (!(e.getValue() instanceof Boolean)) { throw new FormException("not an boolean: " + formData, "data"); } if ((Boolean) e.getValue()) { Permission p = Permission.fromId(e.getKey()); if (p == null) { throw new IllegalArgumentException("Unknown permission:\"" + e.getKey() + "\" set to \"" + e.getValue() +"\" for sid \"" + sid + "\""); } gmas.add(p,sid); } } } return gmas; }

Target:
public AuthorizationStrategy newInstance(StaplerRequest req, JSONObject formData) throws FormException { GlobalMatrixAuthorizationStrategy gmas = create(); Map<String,Object> data = formData.getJSONObject("data"); for(Map.Entry<String,Object> r : data.entrySet()) { String sid = r.getKey(); if (!(r.getValue() instanceof JSONObject)) { throw new FormException("not an object: " + formData, "data"); } Map<String,Object> value = (JSONObject) r.getValue(); for (Map.Entry<String,Object> e : value.entrySet()) { if (!(e.getValue() instanceof Boolean)) { throw new FormException("not an boolean: " + formData, "data"); } if ((Boolean) e.getValue()) { Permission p = Permission.fromId(e.getKey()); if (p == null) { LOGGER.log(Level.FINE, "Silently skip unknown permission \"{0}\" for sid:\"{1}\"", new Object[]{e.getKey(), sid}); } else { gmas.add(p, sid); } } } } return gmas; }
Source:
public static int setBytes(byte[] bytes, int index, byte[] values, int offset, int length) { requireNonNull(bytes, "bytes is null"); requireNonNull(values, "values is null"); checkPositionIndex(index, length, bytes.length); checkPositionIndex(offset, length, values.length); unsafe.copyMemory(values, (long) offset + ARRAY_BYTE_BASE_OFFSET, bytes, (long) index + ARRAY_BYTE_BASE_OFFSET, length); return index + length; }

Target:
public static int setBytes(byte[] bytes, int index, byte[] values, int offset, int length) { requireNonNull(bytes, "bytes is null"); requireNonNull(values, "values is null"); checkValidRange(index, length, bytes.length); checkValidRange(offset, length, values.length); unsafe.copyMemory(values, (long) offset + ARRAY_BYTE_BASE_OFFSET, bytes, (long) index + ARRAY_BYTE_BASE_OFFSET, length); return index + length; }
Source:
public void handle(ChannelHandlerContext ctx, FullHttpRequest request) { Tracker.getInstance().track(request); if ( !mediaTypeChecker.isAcceptValid(request.headers()) ) { DefaultHandler.sendResponse(ctx, request, String.format("Unsupported media type for Content-Type: %s", request.headers().get(HttpHeaders.Names.CONTENT_TYPE)), HttpResponseStatus.UNSUPPORTED_MEDIA_TYPE ); return; } final Timer.Context httpMetricNameTokensHandlerTimerContext = HttpMetricNameTokensHandlerTimer.time(); final String tenantId = request.headers().get("tenantId"); HttpRequestWithDecodedQueryParams requestWithParams = (HttpRequestWithDecodedQueryParams) request; List<String> query = requestWithParams.getQueryParams().get("query"); if (query == null || query.size() != 1) { sendResponse(ctx, request, "Invalid Query String", HttpResponseStatus.BAD_REQUEST); return; } if (discoveryHandle == null) { sendResponse(ctx, request, null, HttpResponseStatus.NOT_FOUND); return; } try { List<MetricToken> metricTokens = discoveryHandle.getMetricTokens(tenantId, query.get(0)); sendResponse(ctx, request, getSerializedJSON(metricTokens), HttpResponseStatus.OK); } catch (Exception e) { log.error(String.format("Exception occurred while trying to get metrics index for %s", tenantId), e); sendResponse(ctx, request, "Error getting metrics index", HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { httpMetricNameTokensHandlerTimerContext.stop(); } }

Target:
public void handle(ChannelHandlerContext ctx, FullHttpRequest request) { Tracker.getInstance().track(request); final Timer.Context httpMetricNameTokensHandlerTimerContext = HttpMetricNameTokensHandlerTimer.time(); final String tenantId = request.headers().get("tenantId"); HttpRequestWithDecodedQueryParams requestWithParams = (HttpRequestWithDecodedQueryParams) request; List<String> query = requestWithParams.getQueryParams().get("query"); if (query == null || query.size() != 1) { sendResponse(ctx, request, "Invalid Query String", HttpResponseStatus.BAD_REQUEST); return; } if (discoveryHandle == null) { sendResponse(ctx, request, null, HttpResponseStatus.NOT_FOUND); return; } try { List<MetricToken> metricTokens = discoveryHandle.getMetricTokens(tenantId, query.get(0)); sendResponse(ctx, request, getSerializedJSON(metricTokens), HttpResponseStatus.OK); } catch (Exception e) { log.error(String.format("Exception occurred while trying to get metrics index for %s", tenantId), e); sendResponse(ctx, request, "Error getting metrics index", HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { httpMetricNameTokensHandlerTimerContext.stop(); } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SearchSuggestion that = (SearchSuggestion) o; return com.google.common.base.Objects.equal(context, that.context) && com.google.common.base.Objects.equal(label, that.label) && com.google.common.base.Objects.equal(provider, that.provider); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SearchSuggestion that = (SearchSuggestion) o; return Objects.equals(context, that.context) && Objects.equals(label, that.label) && Objects.equals(provider, that.provider); }
Source:
public static List<String> getStringAsSentences(String text) { Pattern splitTextPattern = Pattern.compile("(?<=[\\.!;\\?])(?<![Mm][Rr]\\.|[Mm][Rr][Ss]\\.|[Dd][Rr]\\.|[Mm][Ss]\\.|[Ss][Tt]\\.|[Jj][Rr]\\.|[Cc][Oo]\\.|[Ii][Nn][Cc]\\.|[Ll][Tt][Dd]\\.)\\s+"); return Arrays.asList(splitTextPattern.split(text)); }

Target:
public static List<String> getStringAsSentences(String text) { Pattern splitTextPattern = Pattern.compile("(?<=[\\.!;\\?])(?<![Mm](([Rr]|[Rr][Ss])|[Ss])\\.|[Dd][Rr]\\.|[Ss][Tt]\\.|[Jj][Rr]\\.|[Cc][Oo]\\.|[Ii][Nn][Cc]\\.|[Ll][Tt][Dd]\\.)\\s+"); return Arrays.asList(splitTextPattern.split(text)); }
Source:
public String getName() { return fName.get(0); }

Target:
public String getName() { return fName.isEmpty() ? "" : fName.get(0); }
Source:
private static BugzillaFixture getDefaultFixture(List<BugzillaFixture> fixtureList) { if (fixtureList != null && fixtureList.size() > 0) { for (BugzillaFixture fixture : fixtureList) { Map<String, String> property = fixture.getProperties(); if (property != null) { if (property.containsKey("default")) { if ("1".equals(property.get("default"))) { return fixture; } } } } } return BUGS_4_2; }

Target:
private static BugzillaFixture getDefaultFixture(List<BugzillaFixture> fixtureList) { if (fixtureList != null && fixtureList.size() > 0) { for (BugzillaFixture fixture : fixtureList) { Map<String, String> property = fixture.getProperties(); if (property != null) { String defaultProperty = property.get("default"); if (defaultProperty != null && "1".equals(defaultProperty)) { return fixture; } } } } return BUGS_4_2; }
Source:
public static BoundedContext systemOf(BoundedContext context) { DefaultSystemGateway gateway = (DefaultSystemGateway) context.getSystemGateway(); return gateway.target(); }

Target:
public static BoundedContext systemOf(BoundedContext context) { SystemGateway systemGateway = context.getSystemGateway(); assertThat(systemGateway, instanceOf(DefaultSystemGateway.class)); DefaultSystemGateway gateway = (DefaultSystemGateway) systemGateway; return gateway.target(); }
Source:
public void testWriteSkew() { Cache<String, Integer> c1 = cache(0); Cache<String, Integer> c2 = cache(1); c1.put(COUNTER_KEY, 0); assert c1.get(COUNTER_KEY) == 0 : "Initial value is different from zero in cache 1" ; assert c2.get(COUNTER_KEY) == 0 : "Initial value is different from zero in cache 2" ; ConcurrentSkipListSet<Integer> uniqueValuesIncremented = new ConcurrentSkipListSet<Integer>(); IncrementCounterThread ict1 = new IncrementCounterThread("thread-node-1", c1, uniqueValuesIncremented); IncrementCounterThread ict2 = new IncrementCounterThread("thread-node-2", c2, uniqueValuesIncremented); try { ict1.start(); ict2.start(); ict1.join(); ict2.join(); } catch (InterruptedException e) { assert false : "Interrupted exception while running the test" ; } assert c1.get(COUNTER_KEY) >= COUNTER_MAX_VALUE : "Final value is less than " + COUNTER_MAX_VALUE + " in cache 1" ; assert c2.get(COUNTER_KEY) >= COUNTER_MAX_VALUE : "Final value is less than " + COUNTER_MAX_VALUE + " in cache 1" ; assert ict1.result : ict1.getName() + " has putted a duplicated value"; assert ict2.result : ict2.getName() + " has putted a duplicated value"; }

Target:
public void testWriteSkew() { Cache<String, Integer> c1 = cache(0); Cache<String, Integer> c2 = cache(1); c1.put(COUNTER_KEY, 0); assert c1.get(COUNTER_KEY) == 0 : "Initial value is different from zero in cache 1" ; assert c2.get(COUNTER_KEY) == 0 : "Initial value is different from zero in cache 2" ; ConcurrentSkipListSet<Integer> uniqueValuesIncremented = new ConcurrentSkipListSet<Integer>(); IncrementCounterThread ict1 = new IncrementCounterThread("thread-node-1", c1, uniqueValuesIncremented); IncrementCounterThread ict2 = new IncrementCounterThread("thread-node-2", c2, uniqueValuesIncremented); try { ict1.start(); ict2.start(); ict1.join(); ict2.join(); } catch (InterruptedException e) { assert false : "Interrupted exception while running the test" ; } assert c1.get(COUNTER_KEY) >= COUNTER_MAX_VALUE : "Final value is less than " + COUNTER_MAX_VALUE + " in cache 1" ; assert c2.get(COUNTER_KEY) >= COUNTER_MAX_VALUE : "Final value is less than " + COUNTER_MAX_VALUE + " in cache 2" ; assert ict1.result : ict1.getName() + " has put a duplicated value"; assert ict2.result : ict2.getName() + " has put a duplicated value"; }
Source:
public void position(long newPosition) throws CTFReaderException { if ((this.buf != null) && (newPosition / 8) > this.buf.capacity()) { throw new CTFReaderException("Out of bounds exception on a position move, attempting to access position: " + newPosition); } this.pos = newPosition; }

Target:
public void position(long newPosition) throws CTFReaderException { if ((fBuffer != null) && (newPosition / 8) > fBuffer.capacity()) { throw new CTFReaderException("Out of bounds exception on a position move, attempting to access position: " + newPosition); } fPosition = newPosition; }
Source:
public long getNativePtr() { return 0; }

Target:
public long getNativePtr() { return this.nativePtr; }
Source:
public abstract void tupleActionFn(int taskId, TupleImpl tuple) throws Exception; @Override public void accept(Object event) { if (this.needToRefreshCreds) { LOG.info("The credentials are being updated {}.", executorId); Credentials creds = this.workerData.getCredentials(); idToTask.stream().map(Task::getTaskObject).filter(taskObject -> taskObject instanceof ICredentialsListener) .forEach(taskObject -> { ((ICredentialsListener) taskObject).setCredentials(creds == null ? null : creds.get_creds()); }); this.needToRefreshCreds = false; } AddressedTuple addressedTuple = (AddressedTuple) event; int taskId = addressedTuple.getDest(); TupleImpl tuple = (TupleImpl) addressedTuple.getTuple(); if (isDebug) { LOG.info("Processing received message FOR TUPLE: {}", taskId, tuple); } try { if (taskId != AddressedTuple.BROADCAST_DEST) { tupleActionFn(taskId, tuple); } else { for (Integer t : taskIds) { tupleActionFn(t, tuple); } } } catch (Exception e) { throw new RuntimeException(e); } }

Target:
public abstract void tupleActionFn(int taskId, TupleImpl tuple) throws Exception; @Override public void accept(Object event) { AddressedTuple addressedTuple = (AddressedTuple) event; int taskId = addressedTuple.getDest(); TupleImpl tuple = (TupleImpl) addressedTuple.getTuple(); if (isDebug) { LOG.info("Processing received TUPLE: for TASK: ", tuple, taskId); } try { if (taskId != AddressedTuple.BROADCAST_DEST) { tupleActionFn(taskId, tuple); } else { for (Integer t : taskIds) { tupleActionFn(t, tuple); } } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
protected DeadMessageTap<EventEnvelope> getDeadMessageHandler() { return deadMessageHandler; }

Target:
protected DeadMessageHandler<EventEnvelope> getDeadMessageHandler() { return deadMessageHandler; }
Source:
private static boolean isValidOutcomeEntry(String name) { if (name == null || name.isEmpty()) { OneSignal.Log(LOG_LEVEL.ERROR, "Outcome name must not be empty"); return false; } return true; }

Target:
private static boolean isValidOutcomeEntry(String name) { if (outcomeEventsController == null) { OneSignal.Log(LOG_LEVEL.ERROR, "Make sure OneSignal.init is called first"); return false; } if (name == null || name.isEmpty()) { OneSignal.Log(LOG_LEVEL.ERROR, "Outcome name must not be empty"); return false; } return true; }
Source:
private void addI18nResources(Map<String, Properties> componentI18nResources, I18nResources i18nResources) { if ((componentI18nResources == null) || componentI18nResources.isEmpty()) { return; } componentI18nResources.forEach((localString, properties) -> { Locale locale = Locale.forLanguageTag(localString.replace("_", "-")); if (!locale.getLanguage().isEmpty()) { i18nResources.addI18nResource(locale, properties); } else { throw new UUFException("Cannot deploy language file for " + localString); } }); }

Target:
private void addI18nResources(Map<String, Properties> componentI18nResources, I18nResources i18nResources) { if ((componentI18nResources == null) || componentI18nResources.isEmpty()) { return; } componentI18nResources.forEach((localString, properties) -> { Locale locale = Locale.forLanguageTag(localString.replace("_", "-")); if (locale.getLanguage().isEmpty()) { throw new UUFException("Locale is not found for the given language code. Hence language file will not" + " be deployed for" + localString); } else { i18nResources.addI18nResource(locale, properties); } }); }
Source:
public void onCheckedChanged(RadioGroup radioGroup, int selectedButtonInt) { switch (selectedButtonInt) { case 2131296642: mapboxMap.setStyle(Style.MAPBOX_STREETS); break; case 2131296351: mapboxMap.setStyle(Style.DARK); break; default: mapboxMap.setStyle(Style.MAPBOX_STREETS); break; } }

Target:
public void onCheckedChanged(RadioGroup radioGroup, int selectedButtonInt) { switch (selectedButtonInt) { case R.id.streets_style_select_radio_button: Log.d("StaticImageActivity", "onCheckedChanged: streets"); mapboxMap.setStyle(Style.MAPBOX_STREETS); break; case R.id.dark_style_select_radio_button: Log.d("StaticImageActivity", "onCheckedChanged: dark"); mapboxMap.setStyle(Style.DARK); break; default: mapboxMap.setStyle(Style.MAPBOX_STREETS); break; } }
Source:
private void dumpCommits() { try { writer.openCommitsMeta( this.repositoryId ); final NodeCommitQuery nodeCommitQuery = NodeCommitQuery.create().build(); final NodeCommitEntries nodeCommitEntries = this.nodeService.findCommits( nodeCommitQuery ). getNodeCommitEntries(); nodeCommitEntries.stream(). map( nodeCommitEntry -> CommitDumpEntry.create(). nodeCommitId( nodeCommitEntry.getNodeCommitId() ). message( nodeCommitEntry.getMessage() ). committer( nodeCommitEntry.getCommitter() ). timestamp( nodeCommitEntry.getTimestamp() ). build() ). forEach( this.writer::writeCommitEntry ); } finally { writer.close(); } }

Target:
private void dumpCommits() { try { writer.openCommitsMeta( this.repositoryId ); final NodeCommitQuery nodeCommitQuery = NodeCommitQuery.create().size( -1 ).build(); final NodeCommitEntries nodeCommitEntries = this.nodeService.findCommits( nodeCommitQuery ). getNodeCommitEntries(); nodeCommitEntries.stream(). map( nodeCommitEntry -> CommitDumpEntry.create(). nodeCommitId( nodeCommitEntry.getNodeCommitId() ). message( nodeCommitEntry.getMessage() ). committer( nodeCommitEntry.getCommitter() ). timestamp( nodeCommitEntry.getTimestamp() ). build() ). forEach( this.writer::writeCommitEntry ); } finally { writer.close(); } }
Source:
public void getBookieInfo(final BookieSocketAddress addr, final long requested, final GetBookieInfoCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.getBookieInfoComplete(getRc(BKException.Code.BookieHandleNotAvailableException), new BookieInfo(), ctx); return; } client.obtain((rc, pcbc) -> { if (rc != BKException.Code.OK) { try { executor.submit(safeRun(() -> { cb.getBookieInfoComplete(rc, new BookieInfo(), ctx); })); } catch (RejectedExecutionException re) { cb.getBookieInfoComplete(getRc(BKException.Code.InterruptedException), new BookieInfo(), ctx); } } else { pcbc.getBookieInfo(requested, cb, ctx); } }, requested, conf.getUseV2WireProtocol()); }

Target:
public void getBookieInfo(final BookieSocketAddress addr, final long requested, final GetBookieInfoCallback cb, final Object ctx) { final PerChannelBookieClientPool client = lookupClient(addr); if (client == null) { cb.getBookieInfoComplete(getRc(BKException.Code.BookieHandleNotAvailableException), new BookieInfo(), ctx); return; } client.obtain((rc, pcbc) -> { if (rc != BKException.Code.OK) { try { executor.submit(safeRun(() -> { cb.getBookieInfoComplete(rc, new BookieInfo(), ctx); })); } catch (RejectedExecutionException re) { cb.getBookieInfoComplete(getRc(BKException.Code.InterruptedException), new BookieInfo(), ctx); } } else { pcbc.getBookieInfo(requested, cb, ctx); } }, requested, useV3Enforced); }
Source:
protected abstract DfsPackDescription newPack(PackSource source) throws IOException; protected void commitPack(Collection<DfsPackDescription> desc, Collection<DfsPackDescription> replaces) throws IOException { commitPackImpl(desc, replaces); if (replaces != null && !replaces.isEmpty()) { DfsBlockCache cache = DfsBlockCache.getInstance(); for (DfsPackDescription replace : replaces) { DfsPackFile packFile = cache.getOrCreate(replace, null); packFile.close(); } } getRepository().fireEvent(new DfsPacksChangedEvent()); }

Target:
protected abstract DfsPackDescription newPack(PackSource source) throws IOException; protected DfsPackDescription newPack(PackSource source, long estimatedPackSize) throws IOException { DfsPackDescription pack = newPack(source); pack.setEstimatedPackSize(estimatedPackSize); return pack; }
Source:
public SqlJsonLengthFunction() { super("JSON_LENGTH", SqlKind.OTHER_FUNCTION, ReturnTypes.cascade(ReturnTypes.INTEGER_NULLABLE, SqlTypeTransforms.FORCE_NULLABLE), null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }

Target:
public SqlJsonLengthFunction() { super("JSON_LENGTH", SqlKind.OTHER_FUNCTION, ReturnTypes.cascade(ReturnTypes.INTEGER, SqlTypeTransforms.FORCE_NULLABLE), null, OperandTypes.ANY, SqlFunctionCategory.SYSTEM); }
Source:
public void findAllForbiddenTest() throws Exception { context.turnOffAuthorisationSystem(); EPerson newUser = EPersonBuilder.createEPerson(context) .withNameInMetadata("John", "Doe") .withEmail("Johndoe@fake-email.com") .build(); String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(get("/api/eperson/eperson")) .andExpect(status().isUnauthorized()); }

Target:
public void findAllForbiddenTest() throws Exception { String authToken = getAuthToken(eperson.getEmail(), password); getClient(authToken).perform(get("/api/eperson/eperson")) .andExpect(status().isForbidden()); }
Source:
private void updateEmailList() { if (currentEmail != null) { int index = emailListIndexOf(currentEmail); if (index == -1) { emailPick.addItem(currentEmail); emailPick.setSelectedIndex(emailPick.getItemCount() - 1); } else { emailPick.setSelectedIndex(index); } } if (emailPick.getItemCount() > 0) { emailPick.setVisible(true); emailPick.setEnabled(true); if (canRegisterNewEmail()) { final String t = Util.C.buttonOpenRegisterNewEmail(); if (emailListIndexOf(t) == -1) { emailPick.addItem("... " + t + " ", t); } } } else { emailPick.setVisible(false); } }

Target:
private void updateEmailList() { if (currentEmail != null) { int index = emailListIndexOf(currentEmail); if (index == -1) { emailPick.addItem(currentEmail); emailPick.setSelectedIndex(emailPick.getItemCount() - 1); } else { emailPick.setSelectedIndex(index); } } if (emailPick.getItemCount() > 0) { emailPick.setVisible(true); emailPick.setEnabled(true); if (canRegisterNewEmail()) { final String t = Util.C.buttonOpenRegisterNewEmail(); int index = emailListIndexOf(t); if (index != -1) { emailPick.removeItem(index); } emailPick.addItem("... " + t + " ", t); } } else { emailPick.setVisible(false); } }
Source:
private void handleStepAndJob() { boolean isCoCoManaged = parentHasCallback() || getCallback() != null; boolean endActionWillRunAgain = !getSucceeded() && getReturnValue().getEndActionTryAgain(); if (isCoCoManaged || endActionWillRunAgain) { return; } boolean succeeded = getSucceeded() && getParameters().getTaskGroupSuccess(); ExecutionHandler.endFinalizingStepOrCurrentStep(getContext().getExecutionContext(), succeeded); ExecutionHandler.endTaskJobIfNeeded(getContext().getExecutionContext(), succeeded); }

Target:
private void handleStepAndJob() { boolean isCoCoManaged = parentHasCallback() || getCallback() != null; boolean endActionWillRunAgain = !getSucceeded() && getReturnValue().getEndActionTryAgain(); if (isCoCoManaged || endActionWillRunAgain) { return; } ExecutionHandler.endTaskStepAndJob(getContext().getExecutionContext(), getSucceeded() && getParameters() .getTaskGroupSuccess()); }
Source:
private void validateRazEnablement(SdxClusterRequest sdxClusterRequest, DetailedEnvironmentResponse environment) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (sdxClusterRequest.isEnableRangerRaz()) { boolean razEntitlementEnabled = entitlementService.razEnabled(environment.getCreator(), Crn.safeFromString(environment.getCreator()).getAccountId()); if (!razEntitlementEnabled) { validationBuilder.error("Provisioning Ranger Raz is not enabled for this account."); } if (!(AWS.name().equalsIgnoreCase(environment.getCloudPlatform()) || AZURE.name().equalsIgnoreCase(environment.getCloudPlatform()))) { validationBuilder.error("Provisioning Ranger Raz is only valid for Amazon Web Services and Microsoft Azure."); } if (!isRazSupported(sdxClusterRequest.getRuntime(), environment.getCloudPlatform())) { boolean aws = AWS.name().equalsIgnoreCase(environment.getCloudPlatform()); String errorMsg = aws ? "Provisioning Ranger Raz on Amazon Web Services is only valid for CM version >= 7.2.2 and not " : "Provisioning Ranger Raz on Microsoft Azure is only valid for CM version >= 7.2.1 and not "; validationBuilder.error(errorMsg + sdxClusterRequest.getRuntime()); } } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }

Target:
private void validateRazEnablement(SdxClusterRequest sdxClusterRequest, DetailedEnvironmentResponse environment) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (sdxClusterRequest.isEnableRangerRaz()) { boolean razEntitlementEnabled = entitlementService.razEnabled(environment.getCreator(), Crn.safeFromString(environment.getCreator()).getAccountId()); if (!razEntitlementEnabled) { validationBuilder.error("Provisioning Ranger Raz is not enabled for this account."); } CloudPlatform cloudPlatform = EnumUtils.getEnumIgnoreCase(CloudPlatform.class, environment.getCloudPlatform()); if (!(AWS.equals(cloudPlatform) || AZURE.equals(cloudPlatform))) { validationBuilder.error("Provisioning Ranger Raz is only valid for Amazon Web Services and Microsoft Azure."); } if (!isRazSupported(sdxClusterRequest.getRuntime(), cloudPlatform)) { String errorMsg = AWS.equals(cloudPlatform) ? "Provisioning Ranger Raz on Amazon Web Services is only valid for CM version >= 7.2.2 and not " : "Provisioning Ranger Raz on Microsoft Azure is only valid for CM version >= 7.2.1 and not "; validationBuilder.error(errorMsg + sdxClusterRequest.getRuntime()); } } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }
Source:
public void testMemoryReservationYield(Type type) { List<Page> input = createPages(type, 5_000, 500, true); OperatorFactory operatorFactory = new DistinctLimitOperator.DistinctLimitOperatorFactory( 0, new PlanNodeId("test"), ImmutableList.of(type), ImmutableList.of(0), Integer.MAX_VALUE, Optional.of(1), joinCompiler); GroupByHashYieldAssertion.GroupByHashYieldResult result = finishOperatorWithYieldingGroupByHash(input, type, operatorFactory, operator -> ((DistinctLimitOperator) operator).getCapacity(), 170_000); assertGreaterThan(result.getYieldCount(), 5); assertGreaterThan(result.getMaxReservedBytes(), 20L << 20); assertEquals(result.getOutput().stream().mapToInt(Page::getPositionCount).sum(), 5_000 * 500); }

Target:
public void testMemoryReservationYield(Type type) { List<Page> input = createPagesWithDistinctHashKeys(type, 5_000, 500); OperatorFactory operatorFactory = new DistinctLimitOperator.DistinctLimitOperatorFactory( 0, new PlanNodeId("test"), ImmutableList.of(type), ImmutableList.of(0), Integer.MAX_VALUE, Optional.of(1), joinCompiler); GroupByHashYieldAssertion.GroupByHashYieldResult result = finishOperatorWithYieldingGroupByHash(input, type, operatorFactory, operator -> ((DistinctLimitOperator) operator).getCapacity(), 170_000); assertGreaterThan(result.getYieldCount(), 5); assertGreaterThan(result.getMaxReservedBytes(), 20L << 20); assertEquals(result.getOutput().stream().mapToInt(Page::getPositionCount).sum(), 5_000 * 500); }
Source:
private void writeAnswer( Sheet sheet, Row row, int startColumn, QuestionDto questionDto, String value, boolean useQuestionId) { assert value != null; List<String> cells = new ArrayList<>(); QuestionType questionType = questionDto.getQuestionType(); switch (questionType) { case DATE: cells.add(dateCellValue(value)); break; case PHOTO: case VIDEO: cells.add(photoCellValue(value, imagePrefix)); break; case GEO: cells.addAll(geoCellValues(value)); break; case CASCADE: cells.addAll(cascadeCellValues(value, useQuestionId, questionDto.getLevelNames() .size())); break; case OPTION: Long qId = questionDto.getKeyId(); cells.addAll(optionCellValues(questionDto.getKeyId(),value,useQuestionId,optionMap.get(qId),allowOtherMap.get(qId))); break; default: cells.add(sanitize(value)); break; } int col = startColumn; for (String cellValue : cells) { if (questionType == QuestionType.NUMBER) { createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else if (questionType == QuestionType.OPTION){ if (cellValue.equals("0") || cellValue.equals("1")){ createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else { createCell(row, col, cellValue, mTextStyle); } } else { createCell(row, col, cellValue, mTextStyle); } col++; } }

Target:
private void writeAnswer( Sheet sheet, Row row, int startColumn, QuestionDto questionDto, String value, boolean useQuestionId) { assert value != null; List<String> cells = new ArrayList<>(); QuestionType questionType = questionDto.getQuestionType(); switch (questionType) { case DATE: cells.add(dateCellValue(value)); break; case PHOTO: case VIDEO: cells.add(photoCellValue(value, imagePrefix)); break; case GEO: cells.addAll(geoCellValues(value)); break; case CASCADE: cells.addAll(cascadeCellValues(value, useQuestionId, questionDto.getLevelNames() .size())); break; case OPTION: Long qId = questionDto.getKeyId(); cells.addAll(optionCellValues(questionDto.getKeyId(), value, useQuestionId, optionMap.get(qId), allowOtherMap.get(qId))); break; default: cells.add(sanitize(value)); break; } int col = startColumn; for (String cellValue : cells) { if (questionType == QuestionType.NUMBER) { createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else if (questionType == QuestionType.OPTION && (cellValue.equals("0") || cellValue.equals("1"))) { createCell(row, col, cellValue, null, Cell.CELL_TYPE_NUMERIC); } else { createCell(row, col, cellValue, mTextStyle); } col++; } }
Source:
public void use_environment_varibales() { LdapDetails details = createDefaultsWithoutManagerCred(ldap.get()); details.addEnvironmentVariable(new LdapEnvironmentVariable("java.naming.ldap.typesOnly", "true")); useLdapAsSecurityRealm(details); Login login = jenkins.login(); login.doLogin("jenkins", "root"); assertThat(jenkins, not(hasLoggedInUser("jenkins"))); assertThat(getElement(by.tagName("pre")).getText(), Matchers.containsString("NoSuchElementException")); }

Target:
public void use_environment_varibales() { LdapDetails details = createDefaultsWithoutManagerCred(ldap.get()); details.addEnvironmentVariable(new LdapEnvironmentVariable("java.naming.ldap.typesOnly", "true")); useLdapAsSecurityRealm(details); Login login = jenkins.login(); login.doLogin("jenkins", "root"); assertThat(jenkins, not(hasLoggedInUser("jenkins"))); }
Source:
public void addRecipients(ExtendedEmailPublisherContext context, EnvVars env, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc) { ExtendedEmailPublisherDescriptor descriptor = Jenkins.getInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); Run<?,?> run = context.getRun(); if(run instanceof AbstractBuild) { Set<User> users = ((AbstractBuild<?,?>)run).getCulprits(); for (User user : users) { if (!EmailRecipientUtils.isExcludedRecipient(user, context.getListener())) { String userAddress = EmailRecipientUtils.getUserConfiguredEmail(user); if (userAddress != null) { descriptor.debug(context.getListener().getLogger(), "Adding user address %s, they were not considered an excluded committer", userAddress); EmailRecipientUtils.addAddressesFromRecipientList(to, cc, bcc, userAddress, env, context.getListener()); } else { context.getListener().getLogger().println("Failed to send e-mail to " + user.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured"); } } } } }

Target:
public void addRecipients(ExtendedEmailPublisherContext context, EnvVars env, Set<InternetAddress> to, Set<InternetAddress> cc, Set<InternetAddress> bcc) { ExtendedEmailPublisherDescriptor descriptor = Jenkins.getActiveInstance().getDescriptorByType(ExtendedEmailPublisherDescriptor.class); Run<?,?> run = context.getRun(); if (run instanceof AbstractBuild) { Set<User> users = ((AbstractBuild<?,?>)run).getCulprits(); for (User user : users) { if (!EmailRecipientUtils.isExcludedRecipient(user, context.getListener())) { String userAddress = EmailRecipientUtils.getUserConfiguredEmail(user); if (userAddress != null) { descriptor.debug(context.getListener().getLogger(), "Adding user address %s, they were not considered an excluded committer", userAddress); EmailRecipientUtils.addAddressesFromRecipientList(to, cc, bcc, userAddress, env, context.getListener()); } else { context.getListener().getLogger().println("Failed to send e-mail to " + user.getFullName() + " because no e-mail address is known, and no default e-mail domain is configured"); } } } } }