auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ActivityModel(ActivityDto activityDto){ <START> this.id = activityDto.getActivityId(); <END> this.title = activityDto.getTitle(); this.webActivityUrl = activityDto.getWebActivityUrl(); this.appActivityUrl = activityDto.getAppActivityUrl(); this.description = activityDto.getDescription(); this.webPictureUrl = activityDto.getWebPictureUrl(); this.appPictureUrl = activityDto.getAppPictureUrl(); this.expiredTime = activityDto.getExpiredTime(); this.source = activityDto.getSource(); }</code><technical_language>remove</technical_language>

Target:
public ActivityModel(ActivityDto activityDto){ this.title = activityDto.getTitle(); this.webActivityUrl = activityDto.getWebActivityUrl(); this.appActivityUrl = activityDto.getAppActivityUrl(); this.description = activityDto.getDescription(); this.webPictureUrl = activityDto.getWebPictureUrl(); this.appPictureUrl = activityDto.getAppPictureUrl(); this.expiredTime = activityDto.getExpiredTime(); this.source = activityDto.getSource(); }
Source:
<code>public void configureMachine( TargetHandlerParameters parameters, String machineId, Instance scopedInstance ) throws TargetException { String ip = acquireIpAddress(); if(! Utils.isEmptyOrWhitespaces(ip)) { try { sendConfiguration(ip, parameters); } catch (IOException e) { throw new TargetException(e); } this.machineIdToRunning.put(machineId, ip); } else { <START> scopedInstance.data.put( Instance.READY_FOR_CFG_MARKER, "true" ); <END> } }</code><technical_language>in a finally block? Post configuration applied updated agent's configuration</technical_language>

Target:
public void configureMachine( TargetHandlerParameters parameters, String machineId, Instance scopedInstance ) throws TargetException { scopedInstance.data.put( Instance.READY_FOR_CFG_MARKER, "true" ); String ip = acquireIpAddress(); if(! Utils.isEmptyOrWhitespaces(ip)) { try { sendConfiguration(ip, parameters); } catch (IOException e) { throw new TargetException(e); } this.machineIdToIp.put(machineId, ip); } }
Source:
<code>private Collection<BeanDefinition> parseExtraConfigs(final String[] extraConfigRefs, final Element element, final ParserContext parserContext) { Collection<BeanDefinition> extraConfigs = new ManagedList<>(extraConfigRefs.length); for (String each : extraConfigRefs) { String attribute = element.getAttribute(each); if (!Strings.isNullOrEmpty(attribute)) { extraConfigs.add(parserContext.getRegistry().getBeanDefinition(attribute)); } } <START> return extraConfigs; <END> }</code><technical_language>Return name result</technical_language>

Target:
private Collection<BeanDefinition> parseExtraConfigs(final String[] extraConfigRefs, final Element element, final ParserContext parserContext) { Collection<BeanDefinition> result = new ManagedList<>(extraConfigRefs.length); for (String each : extraConfigRefs) { String attribute = element.getAttribute(each); if (!Strings.isNullOrEmpty(attribute)) { result.add(parserContext.getRegistry().getBeanDefinition(attribute)); } } return result; }
Source:
<code>public Optional<String> determineLabelsOrTypeForLoading(Class<?> type) { Optional<String> labelsOrType; if (useStrictQuerying) { ClassInfo classInfo = metaData().classInfo(type); String result = null; if (classInfo != null) { result = classInfo.isRelationshipEntity() ? classInfo.neo4jName() : <START> classInfo.staticLabels().stream().collect(Collectors.joining("`:`")); <END> } labelsOrType = Optional.ofNullable(result); } else { labelsOrType = Optional.ofNullable(metaData.entityType(type.getName())); } return labelsOrType.map(String::trim).filter(s -> !s.isEmpty()); }</code><technical_language>suggestion String.join(":", classInfo.staticLabels());</technical_language>

Target:
public Optional<String> determineLabelsOrTypeForLoading(Class<?> type) { Optional<String> labelsOrType; if (useStrictQuerying) { ClassInfo classInfo = metaData().classInfo(type); String result = null; if (classInfo != null) { result = classInfo.isRelationshipEntity() ? classInfo.neo4jName() : String.join("`:`", classInfo.staticLabels()); } labelsOrType = Optional.ofNullable(result); } else { labelsOrType = Optional.ofNullable(metaData.entityType(type.getName())); } return labelsOrType.map(String::trim).filter(s -> !s.isEmpty()); }
Source:
<code>private boolean filterEventByFilterType(Event event, DocumentReference user, NotificationFormat format, NotificationPreferenceScopeFilterType scopeFilterType) { boolean hasRestriction = false; boolean matchRestriction = false; try { for (NotificationPreferenceScope scope : modelBridge.getNotificationPreferenceScopes(user, format, scopeFilterType)) { if (scope.getEventType().equals(event.getType())) { <START> hasRestriction = true; <END> if (event.getDocument().equals(scope.getScopeReference()) || event.getDocument().hasParent(scope.getScopeReference())) { if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.EXCLUSIVE)) { return true; } matchRestriction = true; break; } } } } catch (NotificationException e) { logger.warn(ERROR, e); } if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.INCLUSIVE)) { return hasRestriction && !matchRestriction; } else { return false; } }</code><technical_language>I hasRestriction true NotificationPreferenceScopeFilterType.INCLUSIVE</technical_language>

Target:
private boolean filterEventByFilterType(Event event, DocumentReference user, NotificationFormat format, NotificationPreferenceScopeFilterType scopeFilterType) { boolean hasRestriction = false; boolean matchRestriction = false; try { for (NotificationPreferenceScope scope : modelBridge.getNotificationPreferenceScopes(user, format, scopeFilterType)) { if (scope.getEventType().equals(event.getType())) { hasRestriction = true; if (event.getDocument().equals(scope.getScopeReference()) || event.getDocument().hasParent(scope.getScopeReference())) { if (scopeFilterType.equals(NotificationPreferenceScopeFilterType.EXCLUSIVE)) { return true; } matchRestriction = true; break; } } } } catch (NotificationException e) { logger.warn(ERROR, e); } return (scopeFilterType.equals(NotificationPreferenceScopeFilterType.INCLUSIVE) && hasRestriction && !matchRestriction); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { <START> resultCode = intent != null ? intent.getIntExtra("result", 0) : 0; <END> if (resultCode != 0) { Log.v(TAG, "onStart: #" + startId + " resultCode: " + resultCode + " = " + translateResultCode(resultCode)); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return Service.START_NOT_STICKY; }</code><technical_language>Please define resultcode it. int resultCode = intent != null ? intent.getIntExtra("result", 0) : 0;</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { int resultCode = intent != null ? intent.getIntExtra("result", 0) : 0; if (resultCode != 0) { Log.v(TAG, "onStart: #" + startId + " resultCode: " + resultCode + " = " + translateResultCode(resultCode)); } Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.obj = intent; mServiceHandler.sendMessage(msg); return Service.START_NOT_STICKY; }
Source:
<code>public void searchThemes(String searchTerm) { if (TextUtils.isEmpty(searchTerm)) { return; } <START> ThemeStore.SearchThemesPayload payload = new ThemeStore.SearchThemesPayload(searchTerm); <END> mDispatcher.dispatch(ThemeActionBuilder.newSearchThemesAction(payload)); }</code><technical_language>A quick general nitpick. I code payloads separately imported, me</technical_language>

Target:
public void searchThemes(String searchTerm) { if (TextUtils.isEmpty(searchTerm)) { return; } SearchThemesPayload payload = new SearchThemesPayload(searchTerm); mDispatcher.dispatch(ThemeActionBuilder.newSearchThemesAction(payload)); }
Source:
<code>public List<TestCase> getTestCases() { if (testCases.isEmpty()) { Class<? extends TestScript> clazz = getClass(); Method[] allMethods = clazz.getDeclaredMethods(); Map<Integer, Method> methodTree = new TreeMap<>(); Vector<Method> unsortedMethods = new Vector<>(); for (Method method : allMethods) { if (method.isAnnotationPresent(Test.class) && !method.isAnnotationPresent(Ignore.class)) { <START> try { <END> methodTree.put(method.getAnnotation(Order.class).value(), method); } catch (Exception ex) { unsortedMethods.add(method); } } } for (Method method : methodTree.values()) { addMethodAsTestCase(method); } unsortedMethods.forEach((n) -> addMethodAsTestCase(n)); } ArrayList<TestCase> testCaseList = new ArrayList<>(); testCaseList.add(getSetupTestCase()); testCaseList.addAll(testCases); testCaseList.add(getTearDownTestCase()); return testCaseList; }</code><technical_language>ways skin a cat (pardon expression). is check annotations present, above, for Order annotation put in TreeMap, if Order annotation, put in Vector, for example. way, if exceptions, of missing Order annotation, of else, about, is tabs exception</technical_language>

Target:
public List<TestCase> getTestCases() { if (testCases.isEmpty()) { Class<? extends TestScript> clazz = getClass(); Method[] allMethods = clazz.getDeclaredMethods(); Map<Integer, Method> methodTree = new TreeMap<>(); Vector<Method> unsortedMethods = new Vector<>(); for (Method method : allMethods) { if (method.isAnnotationPresent(Test.class) && !method.isAnnotationPresent(Ignore.class)) { if (method.isAnnotationPresent(Order.class)) { try { methodTree.put(method.getAnnotation(Order.class).value(), method); } catch (Exception ex) { OseeCoreException.wrap(ex); } } else { try { unsortedMethods.add(method); } catch (Exception ex) { OseeCoreException.wrap(ex); } } } } for (Method method : methodTree.values()) { addMethodAsTestCase(method); } unsortedMethods.forEach((n) -> addMethodAsTestCase(n)); } ArrayList<TestCase> testCaseList = new ArrayList<>(); testCaseList.add(getSetupTestCase()); testCaseList.addAll(testCases); testCaseList.add(getTearDownTestCase()); return testCaseList; }
Source:
<code>private void fireRESTCallForPageChange(@NonNull final OSInAppMessage message, @NonNull final OSInAppMessagePage page) { final String variantId = variantIdForMessage(message); if (variantId == null) return; final String pageId = page.getPageId(); <START> <END> if (message.getViewedPageIds().contains(pageId)) return; message.addPageId(page.getPageId()); try { JSONObject json = new JSONObject() {{ put("app_id", OneSignal.appId); put("player_id", OneSignal.getUserId()); put("variant_id", variantId); put("device_type", new OSUtils().getDeviceType()); put("page_id", pageId); }}; OneSignalRestClient.post("in_app_messages/" + message.messageId + "/pageImpression", json, new ResponseHandler() { @Override void onSuccess(String response) { printHttpSuccessForInAppMessageRequest("page impression", response); } @Override void onFailure(int statusCode, String response, Throwable throwable) { printHttpErrorForInAppMessageRequest("page impression", statusCode, response); message.getViewedPageIds().remove(page.getPageId()); } }); } catch (JSONException e) { e.printStackTrace(); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "Unable to execute in-app message impression HTTP request due to invalid JSON"); } }</code><technical_language>remove extra enter</technical_language>

Target:
private void fireRESTCallForPageChange(@NonNull final OSInAppMessage message, @NonNull final OSInAppMessagePage page) { final String variantId = variantIdForMessage(message); if (variantId == null) return; final String pageId = page.getPageId(); final String messagePrefixedPageId = message.messageId + pageId; if (viewedPageIds.contains(messagePrefixedPageId)) { OneSignal.onesignalLog(OneSignal.LOG_LEVEL.VERBOSE, "Already sent page impression for id: " + pageId); return; } viewedPageIds.add(messagePrefixedPageId); try { JSONObject json = new JSONObject() {{ put("app_id", OneSignal.appId); put("player_id", OneSignal.getUserId()); put("variant_id", variantId); put("device_type", new OSUtils().getDeviceType()); put("page_id", pageId); }}; OneSignalRestClient.post("in_app_messages/" + message.messageId + "/pageImpression", json, new ResponseHandler() { @Override void onSuccess(String response) { printHttpSuccessForInAppMessageRequest("page impression", response); saveViewedPageIdsToPrefs(); } @Override void onFailure(int statusCode, String response, Throwable throwable) { printHttpErrorForInAppMessageRequest("page impression", statusCode, response); viewedPageIds.remove(messagePrefixedPageId); } }); } catch (JSONException e) { e.printStackTrace(); OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "Unable to execute in-app message impression HTTP request due to invalid JSON"); } }
Source:
<code>public void muleApplicationGetClassifiers() { assertThat("The mule application classifiers are not the expected", asList(MULE_APPLICATION.getClassifiers()), containsInAnyOrder(Classifier.MULE_APPLICATION, <START> Classifier.MULE_PLUGIN, <END> MULE_APPLICATION_EXAMPLE, MULE_APPLICATION_TEMPLATE)); }</code><technical_language>static import</technical_language>

Target:
public void muleApplicationGetClassifiers() { assertThat("The mule application classifiers are not the expected", asList(PackagingType.MULE_APPLICATION.getClassifiers()), containsInAnyOrder(Classifier.MULE_APPLICATION, MULE_PLUGIN, MULE_APPLICATION_EXAMPLE, MULE_APPLICATION_TEMPLATE)); }
Source:
<code><START> private void testUpdateInsertion(String updatedInsertion) throws Exception { <END> String url = "/ats/program/" + getSawProgram().getArtId() + "/insertion"; JsonArray array = putAndCheck(url, Entity.entity(updatedInsertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion", array); Assert.assertNotNull("Did not find value Renamed Insertion", obj); }</code><technical_language>getUuid instead of getArtId,</technical_language>

Target:
private void testUpdateInsertion(String updatedInsertion) throws Exception { String url = "/ats/program/" + getSawProgram().getUuid() + "/insertion"; JsonArray array = putAndCheck(url, Entity.entity(updatedInsertion, MediaType.APPLICATION_JSON_TYPE)); Assert.assertEquals(1, array.size()); JsonObject obj = getObjectNamed("Renamed Insertion", array); Assert.assertNotNull("Did not find value Renamed Insertion", obj); }
Source:
<code><START> private static boolean isIncluded(String[] groups, Collection<String> includedGroups, boolean noGroupsSpecified) { <END> if (noGroupsSpecified) { return isMemberOf(groups, includedGroups); } if (includedGroups.size() == 0) { return true; } else { return isMemberOf(groups, includedGroups); } }</code><technical_language>if private static boolean isIncluded(String[] groups, Collection<String> includedGroups, Collection<String> excludedGroups) instead of 2 methods</technical_language>

Target:
private static boolean isIncluded(String[] groups, Collection<String> includedGroups, boolean noGroupsSpecified) { if (noGroupsSpecified) { return isMemberOf(groups, includedGroups); } return (includedGroups.isEmpty() || isMemberOf(groups, includedGroups)); }
Source:
<code>public void testNoServices() { <START> when(_nodeDiscovery.getNodes()).thenReturn(Maps.<String, Void>newHashMap()); <END> assertEquals(0, Iterables.size(_discovery.getServices())); }</code><technical_language>this registerServices() consistent other tests</technical_language>

Target:
public void testNoServices() { setServices(); assertEquals(0, Iterables.size(_discovery.getServices())); }
Source:
<code>public Response serve(IHTTPSession session) { HttpServe serve = methodServes.get(session.getMethod()); <START> if(serve != null) { <END> try { Response response = serve.serve(session); if(response == null) { return statusCode(Response.Status.NO_CONTENT); } return response; } catch (Exception e) { e.printStackTrace(); return statusCode(Response.Status.INTERNAL_ERROR); } } else { return statusCode(Response.Status.METHOD_NOT_ALLOWED); } }</code><technical_language>styling: needs space if (, space left of condition right (before {</technical_language>

Target:
public Response serve(IHTTPSession session) { HttpServe serve = methodServes.get(session.getMethod()); if (serve != null) { try { Response response = serve.serve(session); if (response == null) { return statusCode(Response.Status.NO_CONTENT); } return response; } catch (Exception e) { Timber.e(e, e.getMessage()); return statusCode(Response.Status.INTERNAL_ERROR); } } else { return statusCode(Response.Status.METHOD_NOT_ALLOWED); } }
Source:
<code>public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { Optional<OAuth2AuthorizedClient> attribute = request.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME) .map(OAuth2AuthorizedClient.class::cast); <START> if (!attribute.isPresent()) { <END> return Mono.just(request) .flatMap(this::mergeRequestAttributesFromContext) .filter(mergedRequest -> mergedRequest.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .flatMap(mergedRequest -> authorizedClient(mergedRequest, next, getOAuth2AuthorizedClient(mergedRequest.attributes()))) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); } else { return Mono.justOrEmpty(attribute) .flatMap(authorizedClient -> authorizedClient(request, next, authorizedClient)) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); } }</code><technical_language>This code is else block. able restructured like: try get authorized client, if default it, process (same process in case)</technical_language>

Target:
public Mono<ClientResponse> filter(ClientRequest request, ExchangeFunction next) { return Mono.just(request) .filter(req -> req.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .switchIfEmpty(mergeRequestAttributesFromContext(request)) .filter(req -> req.attribute(OAUTH2_AUTHORIZED_CLIENT_ATTR_NAME).isPresent()) .flatMap(req -> authorizedClient(req, next, getOAuth2AuthorizedClient(req.attributes()))) .map(authorizedClient -> bearer(request, authorizedClient)) .flatMap(next::exchange) .switchIfEmpty(next.exchange(request)); }
Source:
<code>private static void checkSensibility(AnnotatedType<?> type) { if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } <START> ArraySet<Class<?>> hierarchy = new ArraySet<Class<?>>(); <END> for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); hierarchy.addAll(clazz.getInterfaces()); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }</code><technical_language>ArraySet</technical_language>

Target:
private static void checkSensibility(AnnotatedType<?> type) { if (type.getConstructors().isEmpty() && !type.getJavaClass().isInterface()) { MetadataLogger.LOG.noConstructor(type); } Set<Class<?>> hierarchy = new HashSet<Class<?>>(); for (Class<?> clazz = type.getJavaClass(); clazz != null; clazz = clazz.getSuperclass()) { hierarchy.add(clazz); WeldCollections.addAll(hierarchy, clazz.getInterfaces()); } checkMembersBelongToHierarchy(type.getConstructors(), hierarchy, type); checkMembersBelongToHierarchy(type.getMethods(), hierarchy, type); checkMembersBelongToHierarchy(type.getFields(), hierarchy, type); }
Source:
<code>protected void onConfigure(ISQLiteDatabase db) { db.enableWriteAheadLogging(); <START> setFastInsertEnabled(true); <END> }</code><technical_language>cool if find a run regular fast inserts in a single run code branches executed. thoughts pull off</technical_language>

Target:
protected void onConfigure(ISQLiteDatabase db) { db.enableWriteAheadLogging(); setPreparedInsertCacheEnabled(true); }
Source:
<code>public Response intercept(Chain chain) throws IOException { Request request = chain.request(); if(expiringSAMLAuth==null) authorize(null); <START> else if(Instant.now().getEpochSecond()>= threshold.getEpochSecond()){ <END> authorize(expiringSAMLAuth.getExpiry()); } String samlHeaderValue = RESTServices.AUTHORIZATION_TYPE_SAML+ " "+ RESTServices.AUTHORIZATION_PARAM_TOKEN + "=" + authorizationTokenValue; Request authenticatedRequest = request.newBuilder().header(RESTServices.HEADER_AUTHORIZATION, samlHeaderValue).build(); return chain.proceed(authenticatedRequest); }</code><technical_language>simpler call threshold.isBefore(Instant.now)</technical_language>

Target:
public Response intercept(Chain chain) throws IOException { Request request = chain.request(); if(expiringSAMLAuth==null) { authorize(null); } else if(threshold<=Instant.now().getEpochSecond()){ authorize(expiringSAMLAuth.getExpiry()); } String samlHeaderValue = RESTServices.AUTHORIZATION_TYPE_SAML+ " "+ RESTServices.AUTHORIZATION_PARAM_TOKEN + "=" + authorizationTokenValue; Request authenticatedRequest = request.newBuilder().header(RESTServices.HEADER_AUTHORIZATION, samlHeaderValue).build(); return chain.proceed(authenticatedRequest); }
Source:
<code>public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { String msg = String.format("Failed to run command %s. Domain is %s. User is %s.", getClass().getSimpleName(), getDomain(), getLoginName()); log.errorFormat(msg); <START> setSucceeded(false); <END> _ldapReturnValue.setExceptionString(msg); } return _ldapReturnValue; }</code><technical_language>Hmm, setSucceeded false is necessary, default this is set false (see implementation of setSucceeded, i checked set true). Correct if wrong here, if prefer this "emphasize failure"</technical_language>

Target:
public LdapReturnValueBase execute() { try { log.debugFormat("Running LDAP command: {0}", getClass().getName()); String loginNameForKerberos = LdapBrokerUtils.modifyLoginNameForKerberos(getLoginName(), getAuthenticationDomain()); LdapCredentials ldapCredentials = new LdapCredentials(loginNameForKerberos, getPassword()); DirectorySearcher directorySearcher = new DirectorySearcher(ldapCredentials); executeQuery(directorySearcher); } catch (RuntimeException e) { String msg = String.format("Failed to run command %s. Domain is %s. User is %s.", getClass().getSimpleName(), getDomain(), getLoginName()); log.errorFormat(msg); _ldapReturnValue.setExceptionString(msg); } return _ldapReturnValue; }
Source:
<code>public void formatsHtml4DoctypeBody() throws IOException { MatcherAssert.assertThat( new RsPrint( new RsPrettyXML( <START> new RsWithBody("<!DOCTYPE HTML " <END> + "PUBLIC \"- + "\"<LINK_1>\">" + "<html xmlns=\"<LINK_0>\" " + "lang=\"en\"><head><a>foo</a></head>" + "<body>this is body</body></html>" ) ) ).printBody(), Matchers.is("<!DOCTYPE html\n " + "PUBLIC \"- + "\"<LINK_1>\">\n" + "<html xmlns=\"<LINK_0>\" " + "lang=\"en\">\n <head>\n " + "<meta http-equiv=\"Content-Type\" content=\"text/html; " + "charset=UTF-8\" /><a>foo</a></head>\n " + "<body>this is body</body>\n</html>" ) ); }</code><technical_language>@dimonn12 Joiner instead of +</technical_language>

Target:
public void formatsHtml4DoctypeBody() throws IOException { final String pid = "PUBLIC \"- final String xhtml = "<html xmlns=\"<LINK_0>\" " .concat("lang=\"en\">"); MatcherAssert.assertThat( new RsPrint( new RsPrettyXML( new RsWithBody( Joiner.on("").appendTo( new StringBuilder("<!DOCTYPE HTML "), pid, "\"<LINK_1>\">", xhtml, "<head><a>foo</a></head>", "<body>this is body</body></html>" ) ) ) ).printBody(), Matchers.is( Joiner.on("").appendTo( new StringBuilder("<!DOCTYPE html\n "), pid, "\"<LINK_1>\">\n", xhtml, "\n <head>\n ", "<meta http-equiv=\"Content-Type\" content=\"text/html; ", "charset=UTF-8\" /><a>foo</a></head>\n ", "<body>this is body</body>\n</html>" ).toString() ) ); }
Source:
<code>public List<ImportKeysListEntry> search(String name, ParcelableProxy proxy) throws QueryFailedException, QueryNeedsRepairException { Timber.d("Web Key Directory import: " + name + " using Proxy: " + proxy.getProxy()); <START> List<ImportKeysListEntry> entry = new ArrayList<>(1); <END> byte[] data = query(name, proxy); try { try { entry.add(getEntry(name, data)); } catch (UnsupportedOperationException e) { Timber.e("Parsing retrieved Web Key Directory key failed!"); } } catch (PgpGeneralException | IOException e) { Timber.e(e, "Failed parsing key from Web Key Directory during search"); throw new QueryFailedException("No valid key found on Web Key Directory"); } return entry; }</code><technical_language>I fine. Worse case die in dns resolution request a nonexisting hash :)</technical_language>

Target:
public List<ImportKeysListEntry> search(String name, ParcelableProxy proxy) throws QueryFailedException { URL webKeyDirectoryURL = toWebKeyDirectoryURL(name); if (webKeyDirectoryURL == null) { Timber.d("Name not supported by Web Key Directory Client: " + name); return Collections.emptyList(); } Timber.d("Web Key Directory import: " + name + " using Proxy: " + proxy.getProxy()); byte[] data = query(webKeyDirectoryURL, proxy.getProxy()); if (data == null) { Timber.d("No Web Key Directory endpoint for: " + name); return Collections.emptyList(); } try { UncachedKeyRing ring = UncachedKeyRing.decodeFromData(data); return Collections.singletonList(new ImportKeysListEntry(null, ring)); } catch (PgpGeneralException | IOException e) { Timber.e(e, "Failed parsing key from Web Key Directory during search"); throw new QueryFailedException("No valid key found on Web Key Directory"); } }
Source:
<code>public void addCameraFootprint(FootPrint footprintToBeDraw) { final BaiduMap map = getBaiduMap(); if (map == null) return; PolygonOptions pathOptions = new PolygonOptions(); <START> pathOptions.stroke(new Stroke(FOOTPRINT_DEFAULT_WIDTH, FOOTPRINT_DEFAULT_COLOR)); <END> pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(footprintToBeDraw.getVertexInGlobalFrame().size()); for (LatLong coord : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(CoordToLatLang(coord)); } pathOptions.points(pathPoints); map.addOverlay(pathOptions); }</code><technical_language>@droneboost store new Stroke(...) a constant change</technical_language>

Target:
public void addCameraFootprint(FootPrint footprintToBeDraw) { final BaiduMap map = getBaiduMap(); if (map == null) return; PolygonOptions pathOptions = new PolygonOptions(); pathOptions.stroke(mFootprintStroke); pathOptions.fillColor(FOOTPRINT_FILL_COLOR); final List<LatLng> pathPoints = new ArrayList<LatLng>(footprintToBeDraw.getVertexInGlobalFrame().size()); for (LatLong coord : footprintToBeDraw.getVertexInGlobalFrame()) { pathPoints.add(CoordToLatLng(coord)); } pathOptions.points(pathPoints); map.addOverlay(pathOptions); }
Source:
<code>private void dispatchHeartbeats() { <START> uiSynchronizer.asyncExec( <END> () -> clientDocs.forEach( (path, jupiter) -> { JupiterActivity heartbeat = jupiter.generateJupiterActivity( new NoOperation(), sarosSession.getLocalUser(), path); fireActivity(heartbeat); })); }</code><technical_language>Missing @Override (in case remove Startable implementation)</technical_language>

Target:
private void dispatchHeartbeats() { uiSynchronizer.asyncExec( () -> jupiter .getClientDocs() .forEach( (path, jupiter) -> { JupiterActivity heartbeat = jupiter.generateJupiterActivity( new NoOperation(), sarosSession.getLocalUser(), path); fireActivity(heartbeat); })); }
Source:
<code>public void testJdbcComputePushdownUnsupported() { String table = "test_table"; String schema = "test_schema"; String predicate = "(c1 + c2) > c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(predicate), typeProvider); <START> Set<ColumnHandle> columns = Arrays.asList("c1", "c2").stream().map(TestJdbcComputePushdown::intJdbcColumnHandle).collect(Collectors.toSet()); <END> PlanNode original = filter(jdbcTableScan(schema, table, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.empty()); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); assertPlanMatch(actual, PlanMatchPattern.filter( predicate, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }</code><technical_language>Stream.of</technical_language>

Target:
public void testJdbcComputePushdownUnsupported() { String table = "test_table"; String schema = "test_schema"; String expression = "(c1 + c2) > c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(expression), typeProvider); Set<ColumnHandle> columns = Stream.of("c1", "c2").map(TestJdbcComputePushdown::integerJdbcColumnHandle).collect(Collectors.toSet()); PlanNode original = filter(jdbcTableScan(schema, table, BIGINT, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.empty()); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); assertPlanMatch(actual, PlanMatchPattern.filter( expression, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }
Source:
<code>@Override public RelDataType deriveDecimalModType(RelDataTypeFactory typeFactory, RelDataType type1, RelDataType type2) { if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) { if (SqlTypeUtil.isDecimal(type1) || SqlTypeUtil.isDecimal(type2)) { type1 = RelDataTypeFactoryImpl.isJavaType(type1) ? typeFactory.decimalOf(type1) : type1; type2 = RelDataTypeFactoryImpl.isJavaType(type2) ? typeFactory.decimalOf(type2) : type2; int p1 = type1.getPrecision(); int p2 = type2.getPrecision(); int s1 = type1.getScale(); int s2 = type2.getScale(); if (s1 == 0 && s2 == 0) { return type2; } int scale = Math.max(s1, s2); assert scale <= getMaxNumericScale(); int precision = Math.min(p1 - s1, p2 - s2) + Math.max(s1, s2); precision = Math.min(precision, getMaxNumericPrecision()); assert precision > 0; RelDataType ret; ret = typeFactory.createSqlType( SqlTypeName.DECIMAL, precision, <START> scale); <END> return ret; } } return null; }</code><technical_language>return typeFactory.createSqlType directly</technical_language>

Target:
@Override public RelDataType deriveDecimalModType(RelDataTypeFactory typeFactory, RelDataType type1, RelDataType type2) { if (SqlTypeUtil.isExactNumeric(type1) && SqlTypeUtil.isExactNumeric(type2)) { if (SqlTypeUtil.isDecimal(type1) || SqlTypeUtil.isDecimal(type2)) { type1 = RelDataTypeFactoryImpl.isJavaType(type1) ? typeFactory.decimalOf(type1) : type1; type2 = RelDataTypeFactoryImpl.isJavaType(type2) ? typeFactory.decimalOf(type2) : type2; int p1 = type1.getPrecision(); int p2 = type2.getPrecision(); int s1 = type1.getScale(); int s2 = type2.getScale(); if (s1 == 0 && s2 == 0) { return type2; } int scale = Math.max(s1, s2); assert scale <= getMaxNumericScale(); int precision = Math.min(p1 - s1, p2 - s2) + Math.max(s1, s2); precision = Math.min(precision, getMaxNumericPrecision()); assert precision > 0; return typeFactory.createSqlType(SqlTypeName.DECIMAL, precision, scale); } } return null; }
Source:
<code>public List<WorkflowAction> findInitialAvailableActionsByContentType(ContentType contentType, User user) throws DotDataException, DotSecurityException{ final ImmutableList.Builder<WorkflowAction> actions = new ImmutableList.Builder<>(); final List<WorkflowScheme> schemes = findSchemesForContentType(contentType); for(WorkflowScheme scheme: schemes){ List<WorkflowStep> steps = findSteps(scheme); <START> actions.addAll(findActions(steps.get(0), user)); <END> } return actions.build(); }</code><technical_language>I do steps.stream().findFirst().orElse(null); If findActions receives null, return a Collections.emptyList();</technical_language>

Target:
public List<WorkflowAction> findInitialAvailableActionsByContentType(ContentType contentType, User user) throws DotDataException, DotSecurityException{ final ImmutableList.Builder<WorkflowAction> actions = new ImmutableList.Builder<>(); final List<WorkflowScheme> schemes = findSchemesForContentType(contentType); for(WorkflowScheme scheme: schemes){ List<WorkflowStep> steps = findSteps(scheme); actions.addAll(findActions(steps.stream().findFirst().orElse(null), user)); } return actions.build(); }
Source:
<code><START> public String buildDefaultResourceDescription(HostPort hostPort, JBossProduct product) { <END> return String.format("Standalone %s server", product.FULL_NAME); }</code><technical_language>Do augment visibility (keep package protected in parent class), avoid future problems API compatibility</technical_language>

Target:
String buildDefaultResourceDescription(HostPort hostPort, JBossProduct product) { return String.format("Standalone %s server", product.FULL_NAME); }
Source:
<code>void postConstruct() { <START> chatPrefs = preferencesService.getPreferences().getChatPrefs(); <END> userToCssStyle.put(userService.getUsername(), chatPrefs.getSelfChatColor()); mentionPattern = Pattern.compile("\\b" + Pattern.quote(userService.getUsername()) + "\\b"); initChatView(); addFocusListeners(); addImagePasteListener(); }</code><technical_language>Reading ChatPrefs storing problematic if reload settings e.g. disk deserialize (as discussed) a new ChatPrefs instance created. This reference stale. call preferencesService.getPreferences().*** access preferences. a local variable though</technical_language>

Target:
void postConstruct() { mentionPattern = Pattern.compile("\\b" + Pattern.quote(userService.getUsername()) + "\\b"); Platform.runLater(this::initChatView); addFocusListeners(); addImagePasteListener(); }
Source:
<code><START> public static void sortOrdersBasedOnDateActivatedOrDateStopped(List<Order> orders, final String sortOrder, <END> final String status) { Collections.sort(orders, new Comparator<Order>() { @Override public int compare(Order o1, Order o2) { if (status.equalsIgnoreCase("inactive")) { return sortOrder.equalsIgnoreCase("ASC") ? o1.getDateStopped().compareTo(o2.getDateStopped()) : o2 .getDateStopped().compareTo(o1.getDateStopped()); } else { return sortOrder.equalsIgnoreCase("asc") ? o1.getDateActivated().compareTo(o2.getDateActivated()) : o2 .getDateActivated().compareTo(o1.getDateActivated()); } } }); }</code><technical_language>I if method returns sorted list</technical_language>

Target:
public List<Order> sortOrdersBasedOnDateActivatedOrDateStopped(List<Order> orders, final String sortOrder, final String status) { List<Order> sortedList = new ArrayList<Order>(orders); Collections.sort(sortedList, new Comparator<Order>() { @Override public int compare(Order o1, Order o2) { if (status.equalsIgnoreCase("inactive")) { return sortOrder.equalsIgnoreCase("ASC") ? getUsableDate(o1).compareTo(getUsableDate(o2)) : getUsableDate(o2).compareTo(getUsableDate(o1)); } else { return sortOrder.equalsIgnoreCase("asc") ? getActiveOrderSortDate(o1).compareTo(getActiveOrderSortDate(o2)) : getActiveOrderSortDate(o2).compareTo(getActiveOrderSortDate(o1)); } } }); return sortedList; }
Source:
<code>private boolean areComparableForDuplicates(final ReadEndsForMarkDuplicates lhs, final ReadEndsForMarkDuplicates rhs, final boolean compareRead2, final boolean useBarcodes) { boolean retval = lhs.libraryId == rhs.libraryId; if (retval && useBarcodes) { if (retval) retval = 0 == compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).barcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).barcode); if (retval) retval = 0 == compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).readOneBarcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).readOneBarcode); if (retval) retval = 0 == compareInteger(((ReadEndsForMarkDuplicatesWithBarcodes) lhs).readTwoBarcode, ((ReadEndsForMarkDuplicatesWithBarcodes) rhs).readTwoBarcode); } if (retval) { retval = lhs.read1ReferenceIndex == rhs.read1ReferenceIndex && lhs.read1Coordinate == rhs.read1Coordinate && lhs.orientation == rhs.orientation; <START> } <END> if (retval && compareRead2) { retval = lhs.read2ReferenceIndex == rhs.read2ReferenceIndex && lhs.read2Coordinate == rhs.read2Coordinate; } return retval; }</code><technical_language>worth renaming retval else (e.g. areComparable). confusing (and possibly bug-prone) switch this code means thing, ReadEndsMDComparator.compare means different</technical_language>

Target:
private boolean areComparableForDuplicates(final ReadEndsForMarkDuplicates lhs, final ReadEndsForMarkDuplicates rhs, final boolean compareRead2, final boolean useBarcodes) { boolean areComparable = lhs.libraryId == rhs.libraryId; if (useBarcodes && areComparable) { final ReadEndsForMarkDuplicatesWithBarcodes lhsWithBarcodes = (ReadEndsForMarkDuplicatesWithBarcodes) lhs; final ReadEndsForMarkDuplicatesWithBarcodes rhsWithBarcodes = (ReadEndsForMarkDuplicatesWithBarcodes) rhs; areComparable = lhsWithBarcodes.barcode == rhsWithBarcodes.barcode && lhsWithBarcodes.readOneBarcode == rhsWithBarcodes.readOneBarcode && lhsWithBarcodes.readTwoBarcode == rhsWithBarcodes.readTwoBarcode; } if (areComparable) { areComparable = lhs.read1ReferenceIndex == rhs.read1ReferenceIndex && lhs.read1Coordinate == rhs.read1Coordinate && lhs.orientation == rhs.orientation; } if (areComparable && compareRead2) { areComparable = lhs.read2ReferenceIndex == rhs.read2ReferenceIndex && lhs.read2Coordinate == rhs.read2Coordinate; } return areComparable; }
Source:
<code>public AuditLogType getAuditLogTypeValue() { <START> return getSucceeded() ? AuditLogType.VDS_GET_CAPABILITIES : AuditLogType.VDS_GET_CAPABILITIES_FAILED; <END> }</code><technical_language>more correctly phrased HOST_REFRESHED_CAPABILITIES HOST_REFRESH_CAPABILITIES_FAILED</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { return getSucceeded() ? AuditLogType.HOST_REFRESHED_CAPABILITIES : AuditLogType.HOST_REFRESHED_CAPABILITIES_FAILED; }
Source:
<code>private Authentication getAuthentication(boolean isExpired, String... scopes) { <START> val request = new OAuth2Request(emptyMap(), "", emptyList(), true, new TreeSet<>(Arrays.asList(scopes)), emptySet(), "", emptySet(), emptyMap()); return ExpiringOauth2Authentication.from(new OAuth2Authentication(request, null), isExpired ? 0 : 3600); <END> }</code><technical_language>instead of of this, do similar this: java val map = new HashMap<String, Object>(); map.put("exp", isExpired ? 0 : 3600); return new AccessTokenConverterWithExpiry().extractAuthentication(map);</technical_language>

Target:
private Authentication getAuthentication(boolean isExpired, String... scopes) { val map = new HashMap<String, Object>(); map.put("exp", isExpired ? 0 : 3600); map.put("scope", new TreeSet<>(Arrays.asList(scopes))); return new AccessTokenConverterWithExpiry().extractAuthentication(map); }
Source:
<code>public void validateDirectory(File path, boolean verbose) throws IOException { File[] files = path.listFiles(); Arrays.sort(files); int problemsDetectedInIndexFiles = 0, problemsDetectedInDataFiles = 0, problemsDetectedInIndexAndDataFilesMatch = 0; for (File file: files) { if (file.length() == 0) { if (verbose) { System.out.println("Skipping empty file: " + file.getName()); } } else if (file.getName().endsWith(ReadOnlyUtils.INDEX_FILE_EXTENSION)) { problemsDetectedInIndexFiles += validateIndexFile(file, verbose); problemsDetectedInIndexAndDataFilesMatch += validateIndexAndDataFileMatch(file, verbose); } else if (file.getName().endsWith(ReadOnlyUtils.DATA_FILE_EXTENSION)) { <START> problemsDetectedInDataFiles += validateDataFile(file, verbose); <END> } else { System.out.println("Skipping file: " + file.getName()); } } System.out.println(); if (problemsDetectedInIndexFiles == 0 && problemsDetectedInDataFiles == 0 && problemsDetectedInIndexAndDataFilesMatch == 0 ) { System.out.println("No problems detected in any of the files in this directory."); } else { System.err.println("Number of problems detected in index files: " + problemsDetectedInIndexFiles); System.err.println("Number of problems detected in data files: " + problemsDetectedInDataFiles); System.err.println("Number of problems detected in the matching of index and data files: " + problemsDetectedInIndexAndDataFilesMatch); } }</code><technical_language>check for existence of .index file</technical_language>

Target:
public void validateDirectory(File path, boolean verbose) throws IOException { File[] files = path.listFiles(); Arrays.sort(files); int problemsDetectedInIndexFiles = 0, problemsDetectedInDataFiles = 0, problemsDetectedInIndexAndDataFilesMatch = 0; for (File file: files) { if (file.length() == 0) { if (verbose) { printInfo("Skipping empty file: " + file.getName()); } } else if (file.getName().endsWith(ReadOnlyUtils.INDEX_FILE_EXTENSION)) { problemsDetectedInIndexFiles += validateIndexFile(file, verbose); problemsDetectedInIndexAndDataFilesMatch += validateIndexAndDataFileMatch(file, verbose); } else if (file.getName().endsWith(ReadOnlyUtils.DATA_FILE_EXTENSION)) { problemsDetectedInDataFiles += validateDataFile(file, verbose); } else { printInfo("Skipping file: " + file.getName()); } } printInfo(""); if (problemsDetectedInIndexFiles == 0 && problemsDetectedInDataFiles == 0 && problemsDetectedInIndexAndDataFilesMatch == 0 ) { printInfo("No problems detected in any of the files in this directory."); } else { printError("Number of problems detected in index files: " + problemsDetectedInIndexFiles); printError("Number of problems detected in data files: " + problemsDetectedInDataFiles); printError("Number of problems detected in the matching of index and data files: " + problemsDetectedInIndexAndDataFilesMatch); } }
Source:
<code>public List<SyncResponse.FileDownload> getFirmwareUpdate(final String deviceId, final String group, final int currentFirmwareVersion) { Map<Integer, List<SyncResponse.FileDownload>> fw_files = Collections.emptyMap(); try { fw_files = s3FWCache.get(group); } catch (ExecutionException e) { LOGGER.error("Exception while retrieving S3 file list."); } if (fw_files.isEmpty()) { LOGGER.error("Failed to retrieve S3 file list."); return Collections.EMPTY_LIST; } <START> final Integer firmwareVersion = new ArrayList<>(fw_files.keySet()).get(0); <END> LOGGER.warn("Versions to update: {}, current version = for deviceId = {}", firmwareVersion, currentFirmwareVersion, deviceId); if (firmwareVersion.equals(currentFirmwareVersion)) { LOGGER.warn("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); return Collections.EMPTY_LIST; } return fw_files.get(firmwareVersion); }</code><technical_language>a map is ordered, this return expect return time</technical_language>

Target:
public List<SyncResponse.FileDownload> getFirmwareUpdate(final String deviceId, final String group, final int currentFirmwareVersion) { Pair<Integer, List<SyncResponse.FileDownload>> fw_files = new Pair(-1, Collections.EMPTY_LIST); try { fw_files = s3FWCache.get(group, new Callable<Pair<Integer, List<SyncResponse.FileDownload>>>() { @Override public Pair<Integer, List<SyncResponse.FileDownload>> call() throws Exception { LOGGER.debug("Nothing in cache found for group: [{}]. Grabbing info from S3.", group); return getFirmwareFilesForGroup(group); } }); } catch (ExecutionException e) { LOGGER.error("Exception while retrieving S3 file list."); } final Integer firmwareVersion = fw_files.getKey(); if (firmwareVersion == -1) { LOGGER.error("Failed to retrieve S3 file list."); return Collections.EMPTY_LIST; } LOGGER.warn("Versions to update: {}, current version = for deviceId = {}", firmwareVersion, currentFirmwareVersion, deviceId); if (firmwareVersion.equals(currentFirmwareVersion)) { LOGGER.warn("Versions match: {}, current version = {}", firmwareVersion, currentFirmwareVersion); return Collections.EMPTY_LIST; } return fw_files.getValue(); }
Source:
<code>public void init() throws APIManagerIntegrationTestException, APIManagementException, RemoteException, UserAdminUserAdminException { createUserWithPublisherAndCreatorRole(API_CREATOR_PUBLISHER_USER, API_CREATOR_PUBLISHER_USER, ADMIN, ADMIN); apiPublisher = new APIPublisherRestClient(publisherURL); <START> apiPublisher.login(API_CREATOR_PUBLISHER_USER, API_CREATOR_PUBLISHER_USER); <END> createUserWithSubscriberRole(API_SUBSCRIBER_USER, API_SUBSCRIBER_USER, ADMIN, ADMIN); apiStore = new APIStoreRestClient(storeURL); apiStore.login(API_SUBSCRIBER_USER, API_SUBSCRIBER_USER); }</code><technical_language>arguments meant username password. meaning full variables for readability</technical_language>

Target:
public void init() throws APIManagerIntegrationTestException, APIManagementException, RemoteException, UserAdminUserAdminException { createUserWithPublisherAndCreatorRole(API_CREATOR_PUBLISHER_USERNAME, API_CREATOR_PUBLISHER_PW, ADMIN_USERNAME, ADMIN_PW); apiPublisher = new APIPublisherRestClient(publisherURL); apiPublisher.login(API_CREATOR_PUBLISHER_USERNAME, API_CREATOR_PUBLISHER_PW); createUserWithSubscriberRole(API_SUBSCRIBER_USERNAME, API_SUBSCRIBER_PW, ADMIN_USERNAME, ADMIN_PW); apiStore = new APIStoreRestClient(storeURL); apiStore.login(API_SUBSCRIBER_USERNAME, API_SUBSCRIBER_PW); }
Source:
<code>public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case STUDENT_SUBMISSION: case STUDENT_RESULT: if (userInfo == null && StringHelper.isEmpty(getRequestParamValue(Const.ParamsNames.REGKEY))) { throw new UnauthorizedAccessException("Instructor or Student account is required to access this resource."); } StudentAttributes studentAttributes = getStudentOfCourseFromRequest(courseId); checkAccessControlForStudentFeedbackSubmission(studentAttributes, feedbackSession); break; case FULL_DETAIL: <START> if (userInfo == null) { <END> throw new UnauthorizedAccessException("Instructor account is required to access this resource."); } gateKeeper.verifyAccessible( logic.getInstructorForGoogleId(courseId, userInfo.getId()), feedbackSession); break; case INSTRUCTOR_SUBMISSION: case INSTRUCTOR_RESULT: if (userInfo == null) { throw new UnauthorizedAccessException("Instructor account is required to access this resource."); } InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); checkAccessControlForInstructorFeedbackSubmission(instructorAttributes, feedbackSession); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }</code><technical_language>gateKeeper.verifyLoggedInUserPrivileges(); for null check for userInfo</technical_language>

Target:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case STUDENT_SUBMISSION: case STUDENT_RESULT: StudentAttributes studentAttributes = getStudentOfCourseFromRequest(courseId); checkAccessControlForStudentFeedbackSubmission(studentAttributes, feedbackSession); break; case FULL_DETAIL: gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), feedbackSession); break; case INSTRUCTOR_SUBMISSION: case INSTRUCTOR_RESULT: InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); checkAccessControlForInstructorFeedbackSubmission(instructorAttributes, feedbackSession); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }