auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateRespondents(FeedbackSessionAttributes session, Set<InstructorAttributes> courseInstructors, Set<FeedbackQuestionAttributes> sessionQuestions, Set<FeedbackResponseAttributes> sessionResponses) { String sessionKey = makeSessionKey(session.getFeedbackSessionName(), session.getCourseId()); SetMultimap<String, String> instructorQuestionKeysMap = HashMultimap.create(); for (InstructorAttributes instructor : courseInstructors) { List<FeedbackQuestionAttributes> questionsForInstructor = feedbackQuestionsLogic .getFeedbackQuestionsForInstructor(new ArrayList(sessionQuestions), session.isCreator(instructor.email)); List<String> questionKeys = makeQuestionKeys(questionsForInstructor, sessionKey); instructorQuestionKeysMap.putAll(instructor.email, questionKeys); } Set<String> respondingInstructors = new HashSet<>(); Set<String> respondingStudents = new HashSet<>(); for (FeedbackResponseAttributes response : sessionResponses) { String respondent = response.giver; String responseQuestionNumber = response.feedbackQuestionId; String responseQuestionKey = makeQuestionKey(sessionKey, responseQuestionNumber); Set<String> instructorQuestionKeys = instructorQuestionKeysMap.get(respondent); if (instructorQuestionKeys.contains(responseQuestionKey)) { respondingInstructors.add(respondent); } else { respondingStudents.add(respondent); } } session.setRespondingInstructorList(respondingInstructors); session.setRespondingStudentList(respondingStudents); }

Target:
private void updateRespondents(FeedbackSessionAttributes session, Set<InstructorAttributes> courseInstructors, Set<FeedbackQuestionAttributes> sessionQuestions, Set<FeedbackResponseAttributes> sessionResponses) { String sessionKey = makeSessionKey(session.getFeedbackSessionName(), session.getCourseId()); SetMultimap<String, String> instructorQuestionKeysMap = HashMultimap.create(); for (InstructorAttributes instructor : courseInstructors) { List<FeedbackQuestionAttributes> questionsForInstructor = feedbackQuestionsLogic.getFeedbackQuestionsForInstructor( new ArrayList<>(sessionQuestions), session.isCreator(instructor.email)); List<String> questionKeys = makeQuestionKeys(questionsForInstructor, sessionKey); instructorQuestionKeysMap.putAll(instructor.email, questionKeys); } Set<String> respondingInstructors = new HashSet<>(); Set<String> respondingStudents = new HashSet<>(); for (FeedbackResponseAttributes response : sessionResponses) { String respondent = response.giver; String responseQuestionNumber = response.feedbackQuestionId; String responseQuestionKey = makeQuestionKey(sessionKey, responseQuestionNumber); Set<String> instructorQuestionKeys = instructorQuestionKeysMap.get(respondent); if (instructorQuestionKeys.contains(responseQuestionKey)) { respondingInstructors.add(respondent); } else { respondingStudents.add(respondent); } } session.setRespondingInstructorList(respondingInstructors); session.setRespondingStudentList(respondingStudents); }
Source:
public String saveDefaults(WebRequest request, @RequestParam("theme") String theme, @RequestParam("locale") String locale) throws Exception { boolean localeInList = false; String allowedLocales = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST); String[] allowedLocalesList = allowedLocales.split(","); GlobalProperty themeGP = Context.getAdministrationService().getGlobalPropertyObject( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_THEME); themeGP.setPropertyValue(theme); Context.getAdministrationService().saveGlobalProperty(themeGP); for (String loc : allowedLocalesList) { loc = loc.trim(); if (loc.equals(locale)) { localeInList = true; GlobalProperty localeGP = Context.getAdministrationService().getGlobalPropertyObject( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE); localeGP.setPropertyValue(locale); Context.getAdministrationService().saveGlobalProperty(localeGP); break; } } if (localeInList) { request.setAttribute(WebConstants.OPENMRS_MSG_ATTR, Context.getMessageSourceService().getMessage( "LocalesAndThemes.saved"), WebRequest.SCOPE_SESSION); } else { request.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, Context.getMessageSourceService().getMessage( "LocalesAndThemes.localeError"), WebRequest.SCOPE_SESSION); } return "redirect:/admin/maintenance/localesAndThemes.form"; }

Target:
public String saveDefaults(WebRequest request, @RequestParam("theme") String theme, @RequestParam("locale") String locale) throws Exception { boolean localeInList = false; String allowedLocales = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST); String[] allowedLocalesList = allowedLocales.split(","); GlobalProperty themeGP = Context.getAdministrationService().getGlobalPropertyObject( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_THEME); themeGP.setPropertyValue(theme); Context.getAdministrationService().saveGlobalProperty(themeGP); for (String loc : allowedLocalesList) { loc = loc.trim(); if (loc.equals(locale)) { localeInList = true; GlobalProperty localeGP = Context.getAdministrationService().getGlobalPropertyObject( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE); localeGP.setPropertyValue(locale); Context.getAdministrationService().saveGlobalProperty(localeGP); break; } } if (localeInList || StringUtils.isBlank(locale)) { request.setAttribute(WebConstants.OPENMRS_MSG_ATTR, Context.getMessageSourceService().getMessage( "LocalesAndThemes.saved"), WebRequest.SCOPE_SESSION); } else { request.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, Context.getMessageSourceService().getMessage( "LocalesAndThemes.localeError"), WebRequest.SCOPE_SESSION); } return "redirect:/admin/maintenance/localesAndThemes.form"; }
Source:
public void startup() throws Exception { String sessionId = options.getSessionId(); if (sessionId == null) { sessionId = createSessionId(); } data.setSessionId(sessionId); output = createAgentOutput(); output.startup(options, data); if (options.getJmx()) { jmxRegistration = new JmxRegistration(this); } }

Target:
public void startup() throws Exception { try { String sessionId = options.getSessionId(); if (sessionId == null) { sessionId = createSessionId(); } data.setSessionId(sessionId); output = createAgentOutput(); output.startup(options, data); if (options.getJmx()) { jmxRegistration = new JmxRegistration(this); } } catch (final Exception e) { logger.logExeption(e); throw e; } }
Source:
public void createLineModelsFromMap(Map<String, Object> keyValueMap) { List<KeyValueLineModel> lineModels = new ArrayList<>(); if (useEditableKey) { for (String key : keyValueMap.keySet()) { KeyValueLineModel lineModel = createNewLineModel(null); lineModel.getValue().setEntity(key); lineModel.getEditableKey().setEntity((String) keyValueMap.get(key)); lineModels.add(lineModel); } } setItems(lineModels); }

Target:
public void createLineModelsFromMap(Map<String, Object> keyValueMap) { List<KeyValueLineModel> lineModels = new ArrayList<>(); if (useEditableKey) { for (Map.Entry<String, Object> entry : keyValueMap.entrySet()) { KeyValueLineModel lineModel = createNewLineModel(null); lineModel.getValue().setEntity(entry.getKey()); lineModel.getEditableKey().setEntity((String) keyValueMap.get(entry.getKey())); lineModels.add(lineModel); } } setItems(lineModels); }
Source:
private VirtualFile getVirtualFile(final String filePath, final String displayFileName, final String contents, final String baseDir) throws IOException { VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); if (virtualFile == null) { String digest = UUID.randomUUID().toString().substring(0, 10); final String fullFilePath = Utils.getInstance() .createFileWithContents(displayFileName, contents, baseDir, digest); virtualFile = LocalFileSystem.getInstance().findFileByPath(fullFilePath); if (virtualFile != null) { Preconditions.checkNotNull(virtualFile, "Virtual file should not be null. Can be an issue with FileSystem."); } } windowEditorOps.setWriteStatus(virtualFile, false); return virtualFile; }

Target:
private VirtualFile getVirtualFile(final String filePath, final String displayFileName, final String contents, final String baseDir) throws IOException { VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); if (virtualFile == null) { String digest = UUID.randomUUID().toString().substring(0, 10); final String fullFilePath = Utils.getInstance() .createFileWithContents(displayFileName, contents, baseDir, digest); virtualFile = LocalFileSystem.getInstance().findFileByPath(fullFilePath); if (virtualFile == null) { throw new IllegalArgumentException("Virtual file should not be null." + " Can be an issue with FileSystem."); } } windowEditorOps.setWriteStatus(virtualFile, false); return virtualFile; }
Source:
public void rethrows_exception() throws Throwable { rule.expectThrowable(RuntimeException.class, "foo"); throw new RuntimeException("foo"); }

Target:
public void rethrows_exception() throws Throwable { rule.expectFailure(RuntimeException.class, "foo"); throw new RuntimeException("foo"); }
Source:
public void convertGroupToRichGroupWithAttributesTest() throws Exception { System.out.println("groupsManagerBl.convertGroupToRichGroupWithAttributes"); vo = setUpVo(); attributesList = setUpGroupAttributes(); this.groupsManager.createGroup(sess, vo, group); attributesManager.setAttributes(sess, group, attributesList); Group myGroup = groupsManagerBl.getGroupByName(sess, vo, "GroupsManagerTestGroup1"); RichGroup richGroup = new RichGroup(myGroup, attributesManager.getAttributes(sess, myGroup)); assertEquals("Both rich groups should be same", richGroup, groupsManagerBl.convertGroupToRichGroupWithAttributes(sess, myGroup)); }

Target:
public void convertGroupToRichGroupWithAttributesTest() throws Exception { System.out.println("groupsManagerBl.convertGroupToRichGroupWithAttributes"); vo = setUpVo(); attributesList = setUpGroupAttributes(); setUpGroup(vo); attributesManager.setAttributes(sess, group, attributesList); RichGroup richGroup = new RichGroup(group, attributesManager.getAttributes(sess, group)); assertEquals("Both rich groups should be same", richGroup, groupsManagerBl.convertGroupToRichGroupWithAttributes(sess, group)); }
Source:
private int numberOfEntries(ByteBuffer mmap) { return (mmap.capacity() - indexSizeExcludingEntries) / (persistedEntrySize); }

Target:
private int numberOfEntries(ByteBuffer mmap) { return (mmap.capacity() - indexSizeExcludingEntries) / persistedEntrySize; }
Source:
private static String getApiErrorMessage(@NonNull Context c, @NonNull ApiException e) { String text; if (e.getInfo() != null) { text = String.format(c.getString(R.string.format_error_server_message), e.getInfo()); } else if (e.getCode() != null) { text = String.format(c.getString(R.string.format_error_server_code), e.getCode()); } else { text = e.getMessage(); } return text; }

Target:
private static String getApiErrorMessage(@NonNull Context c, @NonNull ApiException e) { String text; if (e.getInfo() != null) { text = c.getString(R.string.format_error_server_message, e.getInfo()); } else if (e.getCode() != null) { text = c.getString(R.string.format_error_server_code, e.getCode()); } else { text = e.getMessage(); } return text; }
Source:
public void stop() { if (!isStarted.compareAndSet(true, false)) { return; } if (!reapEntriesHandle.isCancelled() || !reapEntriesHandle.isDone()) { reapEntriesHandle.cancel(true); } if (!scheduler.isShutdown()) { scheduler.shutdown(); try { scheduler.awaitTermination(5, TimeUnit.SECONDS); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); log.info(String.format("%s stop sequence has been interrupted",threadScheduledExecutorName)); } } }

Target:
public void stop() { if (!isStarted.compareAndSet(true, false)) { return; } if (!reapEntriesHandle.isCancelled() || !reapEntriesHandle.isDone()) { reapEntriesHandle.cancel(true); } if (!scheduler.isShutdown()) { scheduler.shutdown(); try { scheduler.awaitTermination(5, TimeUnit.SECONDS); } catch (final InterruptedException e) { log.info(String.format("{} stop sequence has been interrupted",threadScheduledExecutorName)); Thread.currentThread().interrupt(); } } }
Source:
public String toFullString() { return String.format("data:%s;base64,%s", mimeType, PortableBase64.getEncoder().encode(bytes)); }

Target:
public String toFullString() { return String.format("data:%s;base64,%s", mimeType, Base64.getEncoder().encodeToString(bytes)); }
Source:
public List<Facility> getAllowedFacilities(PerunSession sess, User user) throws InternalErrorException { try { return jdbc.query("select distinct " + facilityMappingSelectQuery + " from groups_resources" + " join groups on groups_resources.group_id=groups.id" + " join groups_members on groups.id=groups_members.group_id" + " join members on groups_members.member_id=members.id " + " join resources on groups_resources.resource_id=resources.id " + " join facilities on resources.facility_id=facilities.id " + " where members.user_id=? and members.status!=? and members.status!=?", FACILITY_MAPPER, user.getId(), String.valueOf(Status.INVALID.getCode()), String.valueOf(Status.DISABLED.getCode())); } catch (EmptyResultDataAccessException e) { return new ArrayList<>(); } catch (RuntimeException e) { throw new InternalErrorException(e); } }

Target:
public List<Facility> getAllowedFacilities(PerunSession sess, User user) { try { return jdbc.query("select distinct " + facilityMappingSelectQuery + " from groups_resources" + " join groups on groups_resources.group_id=groups.id" + " join groups_members on groups.id=groups_members.group_id" + " join members on groups_members.member_id=members.id " + " join resources on groups_resources.resource_id=resources.id " + " join facilities on resources.facility_id=facilities.id " + " where members.user_id=? and members.status!=? and members.status!=?", FACILITY_MAPPER, user.getId(), String.valueOf(Status.INVALID.getCode()), String.valueOf(Status.DISABLED.getCode())); } catch (RuntimeException e) { throw new InternalErrorException(e); } }
Source:
public T getItem(int index) { if (index < 0) { throw new IndexOutOfBoundsException("Index must be non-negative"); } int activeDataEnd = activeStart + activeKeyOrder.size() - 1; if (index >= activeStart && index <= activeDataEnd) { return getKeyMapper().get(activeKeyOrder.get(index - activeStart)); } else { final int itemCount = getItemCount(); if (isDefinedSize()) { if (itemCount == 0) { throw new IndexOutOfBoundsException(String.format( "Requested index %d on empty data.", index)); } else if (index >= itemCount) { throw new IndexOutOfBoundsException(String.format( "Given index %d is outside of the accepted range '0 - %d'", index, itemCount - 1)); } } if (fetchDisabled) { throw new IllegalStateException( "Data Communicator cannot fetch the item from Data " + "Provider when the fetch is disabled. Please " + "enable it by calling " + "'dataCommunicator.setFetchDisabled(false)'"); } return (T) getDataProvider().fetch(buildQuery(index, 1)).findFirst() .orElse(null); } }

Target:
public T getItem(int index) { if (index < 0) { throw new IndexOutOfBoundsException("Index must be non-negative"); } int activeDataEnd = activeStart + activeKeyOrder.size() - 1; if (index >= activeStart && index <= activeDataEnd) { return getKeyMapper().get(activeKeyOrder.get(index - activeStart)); } else { final int itemCount = getItemCount(); if (isDefinedSize()) { if (itemCount == 0) { throw new IndexOutOfBoundsException(String .format("Requested index %d on empty data.", index)); } else if (index >= itemCount) { throw new IndexOutOfBoundsException(String.format( "Given index %d is outside of the accepted range '0 - %d'", index, itemCount - 1)); } } return (T) getDataProvider().fetch(buildQuery(index, 1)).findFirst() .orElse(null); } }
Source:
void migrateCredentials(SubversionSCM.DescriptorImpl descriptor) throws IOException { CredentialsStore store = CredentialsProvider.lookupStores(project).iterator().next(); for (Map.Entry<String, Credential> e : credentials.entrySet()) { StandardCredentials credential = descriptor.migrateCredentials(store, e.getKey(), e.getValue()); int i = 0; boolean found = false; ModuleLocation[] locations = ((SubversionSCM) project.getScm()).getLocations(); while (i < locations.length && !found) { try { if (e.getKey().contains(locations[i].getSVNURL().getHost())) { locations[i].setCredentialsId(credential.getId()); found = true; } i++; } catch (SVNException ex) { LOGGER.log(WARNING, "Repository location with a malformed URL: " + locations[i].remote, ex); } } } }

Target:
void migrateCredentials(SubversionSCM.DescriptorImpl descriptor) throws IOException { Iterable<CredentialsStore> it = CredentialsProvider.lookupStores(project); if (it != null && it.iterator().hasNext()) { CredentialsStore store = it.iterator().next(); for (Map.Entry<String, Credential> e : credentials.entrySet()) { StandardCredentials credential = descriptor.migrateCredentials(store, e.getKey(), e.getValue()); ModuleLocation[] locations = ((SubversionSCM) project.getScm()).getLocations(); for (int i = 0; i < locations.length; i++) { try { if (e.getKey().contains(locations[i].getSVNURL().getHost())) { locations[i].setCredentialsId(credential.getId()); break; } } catch (SVNException ex) { LOGGER.log(WARNING, "Repository location with a malformed URL: " + locations[i].remote, ex); } } } } }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getMissingServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { String vdsName = vds != null ? vds.getName() : "NO SERVER"; setVdsName(vdsName); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); if (vds!= null){ addCanDoActionMessage(String.format("$%1$s %2$s", "VdsName", vdsName)); } return false; } } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getMissingServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { String vdsName = vds != null ? vds.getName() : "NO SERVER"; setVdsName(vdsName); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); addCanDoActionMessage(String.format("$%1$s %2$s", "VdsName", vdsName)); return false; } } return true; }
Source:
private Map<LocalDate, Set<WeekActivity>> getWeekActivitiesGroupedByDate(UUID userAnonymizedID, Interval interval) { Set<WeekActivity> weekActivityEntities = weekActivityRepository.findAll(userAnonymizedID, interval.startDate, interval.endDate); Map<LocalDate, Set<WeekActivity>> weekActivityEntitiesByLocalDate = weekActivityEntities.stream() .collect(Collectors.groupingBy(a -> a.getDate(), Collectors.toSet())); return weekActivityEntitiesByLocalDate; }

Target:
private Map<LocalDate, Set<WeekActivity>> getWeekActivitiesGroupedByDate(UUID userAnonymizedID, Interval interval) { Set<WeekActivity> weekActivityEntities = weekActivityRepository.findAll(userAnonymizedID, interval.startDate, interval.endDate); return weekActivityEntities.stream().collect(Collectors.groupingBy(a -> a.getDate(), Collectors.toSet())); }
Source:
public boolean equals(Object obj) { return EqualsUtil.equals(this, obj, (equalsBuilder, otherObj) -> { equalsBuilder.append(dataForm.getType(), otherObj.getDataForm().getType()) .append(dataForm.getTitle(), otherObj.getDataForm().getTitle()) .append(dataForm.getReportedData(), otherObj.getDataForm().getReportedData()) .append(dataForm.getItems(), otherObj.getDataForm().getItems()) .append(dataForm.getFields(), otherObj.getDataForm().getFields()) .append(dataForm.getExtensionElements(), otherObj.getDataForm().getExtensionElements()); }); }

Target:
public boolean equals(Object obj) { return EqualsUtil.equals(this, obj, (equalsBuilder, otherObj) -> { equalsBuilder.append(getDataForm().getType(), otherObj.getDataForm().getType()) .append(getDataForm().getTitle(), otherObj.getDataForm().getTitle()) .append(getDataForm().getReportedData(), otherObj.getDataForm().getReportedData()) .append(getDataForm().getItems(), otherObj.getDataForm().getItems()) .append(getDataForm().getFields(), otherObj.getDataForm().getFields()) .append(getDataForm().getExtensionElements(), otherObj.getDataForm().getExtensionElements()); }); }
Source:
public void testCloseNotifyWaiters() throws Exception { final int numWorkers = 2; BufferPool pool = new BufferPool(1, 1, metrics, Time.SYSTEM, metricGroup); ByteBuffer buffer = pool.allocate(1, Long.MAX_VALUE); CountDownLatch completed = new CountDownLatch(numWorkers); ExecutorService executor = Executors.newFixedThreadPool(numWorkers); Callable<Void> work = new Callable<Void>() { public Void call() throws Exception { assertThrows(KafkaException.class, () -> pool.allocate(1, maxBlockTimeMs)); completed.countDown(); return null; } }; for (int i = 0; i < numWorkers; ++i) { executor.submit(work); } assertEquals("Allocation shouldn't have happened yet, waiting on memory", numWorkers, completed.getCount()); pool.close(); completed.await(200, TimeUnit.MILLISECONDS); pool.deallocate(buffer); }

Target:
public void testCloseNotifyWaiters() throws Exception { final int numWorkers = 2; BufferPool pool = new BufferPool(1, 1, metrics, Time.SYSTEM, metricGroup); ByteBuffer buffer = pool.allocate(1, Long.MAX_VALUE); CountDownLatch completed = new CountDownLatch(numWorkers); ExecutorService executor = Executors.newFixedThreadPool(numWorkers); Callable<Void> work = new Callable<Void>() { public Void call() throws Exception { assertThrows(KafkaException.class, () -> pool.allocate(1, Long.MAX_VALUE)); completed.countDown(); return null; } }; for (int i = 0; i < numWorkers; ++i) { executor.submit(work); } assertEquals("Allocation shouldn't have happened yet, waiting on memory", numWorkers, completed.getCount()); pool.close(); completed.await(15, TimeUnit.SECONDS); pool.deallocate(buffer); }
Source:
public CifsTelnetConnection(String type, ConnectionOptions options, AddressPortMapper mapper) { super(type, options, mapper, true); ConnectionValidator.assertIsWindowsHost(os, CIFS_PROTOCOL, cifsConnectionType); ConnectionValidator.assertNotNewStyleWindowsDomain(username, CIFS_PROTOCOL, cifsConnectionType); connected(); }

Target:
public CifsTelnetConnection(String type, ConnectionOptions options, AddressPortMapper mapper) { super(type, options, mapper); }
Source:
public Response workspaceChatSettingsGet(@PathParam("WorkspaceEntityId") Long workspaceEntityId) { if (!sessionController.isLoggedIn()) { return Response.status(Status.FORBIDDEN).entity("Must be logged in").build(); } return Response.ok(workspaceEntityId).build(); }

Target:
public Response workspaceChatSettingsGet(@PathParam("WorkspaceEntityId") Long workspaceEntityId) { if (!sessionController.isLoggedIn()) { return Response.status(Status.FORBIDDEN).entity("Must be logged in").build(); } WorkspaceChatSettings workspaceChatSettings = chatController.findWorkspaceChatSettings(workspaceEntityId); if (workspaceChatSettings == null) { return Response.status(Status.NOT_FOUND).build(); } return Response.ok(restModel(workspaceChatSettings)).build(); }
Source:
public StructuredRecord joinOn(String stageName, StructuredRecord record) { Schema keySchema; List<String> joinKeys = perStageJoinKeys.get(stageName); if (keySchemas.containsKey(stageName)) { keySchema = keySchemas.get(stageName); } else { List<Schema.Field> fields = new ArrayList<>(); Schema schema = record.getSchema(); int i = 1; for (String joinKey : joinKeys) { Schema.Field field = schema.getField(joinKey); if (field == null) { throw new IllegalArgumentException(String.format("Join key field '%s' does not exist in schema from '%s'.", joinKey, stageName)); } Schema.Field joinField = Schema.Field.of(String.valueOf(i++), field.getSchema()); fields.add(joinField); } keySchema = Schema.recordOf("join.key", fields); keySchemas.put(stageName, keySchema); } StructuredRecord.Builder keyRecordBuilder = StructuredRecord.builder(keySchema); int i = 1; for (String joinKey : joinKeys) { keyRecordBuilder.set(String.valueOf(i++), record.get(joinKey)); } StructuredRecord keyRecord = keyRecordBuilder.build(); return keyRecord; }

Target:
public StructuredRecord joinOn(String stageName, StructuredRecord record) { Schema keySchema; List<String> joinKeys = perStageJoinKeys.get(stageName); if (keySchemas.containsKey(stageName)) { keySchema = keySchemas.get(stageName); } else { List<Schema.Field> fields = new ArrayList<>(); Schema schema = record.getSchema(); int i = 1; for (String joinKey : joinKeys) { Schema.Field field = schema.getField(joinKey); if (field == null) { throw new IllegalArgumentException(String.format("Join key field '%s' does not exist in schema from '%s'.", joinKey, stageName)); } Schema.Field joinField = Schema.Field.of(String.valueOf(i++), field.getSchema()); fields.add(joinField); } keySchema = Schema.recordOf("join.key", fields); keySchemas.put(stageName, keySchema); } StructuredRecord.Builder keyRecordBuilder = StructuredRecord.builder(keySchema); int i = 1; for (String joinKey : joinKeys) { keyRecordBuilder.set(String.valueOf(i++), record.get(joinKey)); } return keyRecordBuilder.build(); }
Source:
public Principal getUserPrincipal() { return subject::getUserName; }

Target:
public Principal getUserPrincipal() { return principal; }
Source:
public void onSocialChanged(OnSocialChanged event) { if (event.isError()) { switch (event.error.type) { case UNABLE_CONNECT: AppLog.e(T.API, "Unable to connect WordPress.com account to social account."); doFinishLogin(); break; case USER_ALREADY_ASSOCIATED: AppLog.e(T.API, "This social account is already associated with a WordPress.com account."); break; } if (isSocialLogin) { doFinishLogin(); } } else if (!event.requiresTwoStepAuth) { doFinishLogin(); } }

Target:
public void onSocialChanged(OnSocialChanged event) { if (event.isError()) { switch (event.error.type) { case UNABLE_CONNECT: AppLog.e(T.API, "Unable to connect WordPress.com account to social account."); break; case USER_ALREADY_ASSOCIATED: AppLog.e(T.API, "This social account is already associated with a WordPress.com account."); break; } doFinishLogin(); } else if (!event.requiresTwoStepAuth) { doFinishLogin(); } }
Source:
public void setScanningDepth(int scanningDepth) throws IllegalArgumentException { if (scanningDepth < 0) { throw new IllegalArgumentException( String.format("Invalid value for scanningDepth \"%d\"", scanningDepth)); } this.scanningDepth = scanningDepth; }

Target:
public void setScanningDepth(int scanningDepth) throws IllegalArgumentException { if (scanningDepth < 0) { throw new IllegalArgumentException( String.format(NEGATIVE_NUMBER_ERROR, "scanningDepth", scanningDepth)); } this.scanningDepth = scanningDepth; }
Source:
public static TestContainerResource getResource() { if (currentInstance == null) { currentInstance = new TestContainerResource(); try { Properties properties = new Properties(); properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("server.properties")); serverVersion = properties.getProperty("server.version"); if(properties.getProperty("server.resource").compareTo("container") != 0) { return null; } } catch (IOException ex) { serverVersion = "5.0.1"; } couchbaseContainer = new FixedHostPortGenericContainer("couchbase:" + serverVersion) .withFixedExposedPort(8091, 8091) .withFixedExposedPort(18091, 18091) .withFixedExposedPort(8092, 8092) .withFixedExposedPort(18092, 18092) .withFixedExposedPort(8093, 8093) .withFixedExposedPort(18093, 18093) .withFixedExposedPort(8094, 8094) .withFixedExposedPort(18094, 18094) .withFixedExposedPort(11210, 11210) .withFixedExposedPort(11211, 11211) .withFixedExposedPort(11207, 11207); couchbaseContainer.waitingFor(new CouchbaseWaitStrategy(serverVersion)); couchbaseContainer.start(); } return currentInstance; }

Target:
public static TestContainerResource getResource() { if (currentInstance == null) { currentInstance = new TestContainerResource(); try { Properties properties = new Properties(); properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("server.properties")); serverVersion = properties.getProperty("server.version"); if(!properties.getProperty("server.resource").contentEquals("container")) { return null; } } catch (Exception ex) { serverVersion = "5.0.1"; } couchbaseContainer = new FixedHostPortGenericContainer("couchbase:" + serverVersion) .withFixedExposedPort(8091, 8091) .withFixedExposedPort(18091, 18091) .withFixedExposedPort(8092, 8092) .withFixedExposedPort(18092, 18092) .withFixedExposedPort(8093, 8093) .withFixedExposedPort(18093, 18093) .withFixedExposedPort(8094, 8094) .withFixedExposedPort(18094, 18094) .withFixedExposedPort(11210, 11210) .withFixedExposedPort(11211, 11211) .withFixedExposedPort(11207, 11207); couchbaseContainer.waitingFor(new CouchbaseWaitStrategy(serverVersion)); couchbaseContainer.start(); } return currentInstance; }
Source:
public static void optionHelp(final Class<?> clazz, final String commandName, final Collection<OptionParam> optionParams, final PrintStream out) { if (optionParams.size() == 0) { return; } ResourceBundle general = null; final List<Item> items = new ArrayList<Item>(optionParams.size()); int width = 20; for (final OptionParam optionParam : optionParams) { String description = optionParam.getDescription(); if (description == null || description.isEmpty()) { if (general == null) { general = getResourceBundle(clazz); } description = getDescription(general, commandName, optionParam.getName()); } final Item item = new Item(optionParam, description); items.add(item); width = Math.max(width, item.flag.length()); } final String format = " %-" + width + "s %s%n"; out.println("Options: "); for (final Item item : items) { final List<String> lines = new ArrayList<String>(); if (item.description != null) { lines.add(item.description); } lines.addAll(item.note); if (lines.isEmpty()) { lines.add(""); } out.printf(format, item.flag, lines.remove(0)); for (final String line : lines) { out.printf(format, "", String.format("(%s)", line)); } } }

Target:
public static void optionHelp(final Class<?> clazz, final String commandName, final Collection<OptionParam> optionParams, final PrintStream out) { if (optionParams.isEmpty()) { return; } ResourceBundle general = null; final List<Item> items = new ArrayList<Item>(optionParams.size()); int width = 20; for (final OptionParam optionParam : optionParams) { String description = optionParam.getDescription(); if (description == null || description.isEmpty()) { if (general == null) { general = getResourceBundle(clazz); } description = getDescription(general, commandName, optionParam.getName()); } final Item item = new Item(optionParam, description); items.add(item); width = Math.max(width, item.flag.length()); } final String format = " %-" + width + "s %s%n"; out.println("Options: "); for (final Item item : items) { final List<String> lines = new ArrayList<String>(); if (item.description != null) { lines.add(item.description); } lines.addAll(item.note); if (lines.isEmpty()) { lines.add(""); } out.printf(format, item.flag, lines.remove(0)); for (final String line : lines) { out.printf(format, "", String.format("(%s)", line)); } } }
Source:
public synchronized boolean registerLogReader(final String watchPath, final LogReader reader) { if (readerMap == null) { readerMap = new HashMap<String, LogReader>(); parentWathchPathSet = new HashSet<String>(); } if (!readerMap.containsKey(watchPath)) { readerMap.put(watchPath, reader); String parentPath = Util.getParentAbsolutePath(watchPath); int fwd; if (!parentWathchPathSet.contains(parentPath)) { parentWathchPathSet.add(parentPath); try { fwd = iJNotifyInstance.addWatch(parentPath, FILE_CREATED, false, this); if (path2wd == null) { path2wd = new HashMap<String, Integer>(); } path2wd.put(parentPath, fwd); } catch (JNotifyException e) { LOG.error("Failed to add watch for " + parentPath, e); readerMap.remove(watchPath); parentWathchPathSet.remove(parentPath); return false; } LOG.info("Registerring and monitoring parent path " + parentPath + " \"FILE_CREATE\""); } else { LOG.info("Watch parent path " + parentPath + " has already exist in the Set"); } int wd; try { wd = iJNotifyInstance.addWatch(watchPath, FILE_MODIFIED, false, this); } catch (JNotifyException e) { LOG.error("Failed to add watch for " + watchPath, e); readerMap.remove(watchPath); return false; } LOG.info("Registerring and monitoring tail file " + watchPath + " \"FILE_MODIFIED\""); if (path2wd == null) { path2wd = new HashMap<String, Integer>(); } path2wd.put(watchPath, wd); } else { LOG.info("Watch path " + watchPath + " has already exist in the Map"); } return true; }

Target:
public boolean registerLogReader(final String watchPath, final LogReader reader) { int fwd, wd; if (!readerMap.containsKey(watchPath)) { lock.lock(); try { readerMap.put(watchPath, reader); String parentPath = Util.getParentAbsolutePath(watchPath); if (!parentWathchPathSet.contains(parentPath)) { parentWathchPathSet.add(parentPath); try { fwd = iJNotifyInstance.addWatch(parentPath, FILE_CREATED, false, this); path2wd.put(parentPath, fwd); } catch (JNotifyException e) { LOG.error("Failed to add watch for " + parentPath, e); readerMap.remove(watchPath); parentWathchPathSet.remove(parentPath); return false; } LOG.info("Registerring and monitoring parent path " + parentPath + " \"FILE_CREATE\""); } else { LOG.info("Watch parent path " + parentPath + " has already exist in the Set"); } try { wd = iJNotifyInstance.addWatch(watchPath, FILE_MODIFIED, false, this); } catch (JNotifyException e) { LOG.error("Failed to add watch for " + watchPath, e); readerMap.remove(watchPath); return false; } LOG.info("Registerring and monitoring tail file " + watchPath + " \"FILE_MODIFIED\""); path2wd.put(watchPath, wd); } finally { lock.unlock(); } } else { LOG.info("Watch path " + watchPath + " has already exist in the Map"); } return true; }
Source:
public void setLimit(long num) { throw new TajoRuntimeException(new UnsupportedException()); }

Target:
public void setLimit(long num) { }
Source:
private CompletableFuture<Void> doUnicast(String subject, byte[] payload, NodeId toNodeId) { Node node = cluster.getNode(toNodeId); if (node == null) { return Futures.exceptionalFuture(new ConnectException()); } return messagingService.sendAsync(node.endpoint(), subject, payload); }

Target:
private CompletableFuture<Void> doUnicast(String subject, byte[] payload, NodeId toNodeId) { Node node = cluster.getNode(toNodeId); if (node == null) { return Futures.exceptionalFuture(CONNECT_EXCEPTION); } return messagingService.sendAsync(node.endpoint(), subject, payload); }
Source:
private List<SearchHit> sendElasticsearchQuery(ElasticsearchQueryBuilder queryBuilder) { ImmutableList.Builder<SearchHit> result = ImmutableList.builder(); SearchResponse response = queryBuilder.buildScrollSearchRequest() .execute() .actionGet(timeout.toMillis()); if (response.getHits().getTotalHits() > maxHits) { throw new PrestoException(ELASTICSEARCH_MAX_HITS_EXCEEDED, format("The number of hits for the query (%d) exceeds the configured max hits (%d)", response.getHits().getTotalHits(), maxHits)); } while (true) { for (SearchHit hit : response.getHits().getHits()) { result.add(hit); } response = queryBuilder.prepareSearchScroll(response.getScrollId()) .execute() .actionGet(timeout.toMillis()); if (response.getHits().getHits().length == 0) { break; } } return result.build(); }

Target:
private List<SearchHit> sendElasticsearchQuery(ElasticsearchQueryBuilder queryBuilder) { SearchResponse response = getSearchResponse(queryBuilder); if (response.getHits().getTotalHits() > maxHits) { throw new PrestoException(ELASTICSEARCH_MAX_HITS_EXCEEDED, format("The number of hits for the query (%d) exceeds the configured max hits (%d)", response.getHits().getTotalHits(), maxHits)); } ImmutableList.Builder<SearchHit> result = ImmutableList.builder(); while (true) { for (SearchHit hit : response.getHits().getHits()) { result.add(hit); } response = getScrollResponse(queryBuilder, response.getScrollId()); if (response.getHits().getHits().length == 0) { break; } } return result.build(); }
Source:
public Statement apply(final Statement statement, Description description) { CompatChange compatChange = description.getAnnotation(CompatChange.class); if (compatChange == null) { return statement; } return new Statement() { @Override public void evaluate() throws Throwable { try { Compatibility.setOverridesForTest(compatChange.enabled(), compatChange.disabled()); statement.evaluate(); } finally { Compatibility.unsetOverridesForTest(); } } }; }

Target:
public Statement apply(final Statement statement, Description description) { Set<Long> enabled = new HashSet<>(); Set<Long> disabled = new HashSet<>(); EnableCompatChanges enableCompatChanges = description.getAnnotation(EnableCompatChanges.class); DisableCompatChanges disableCompatChanges = description.getAnnotation(DisableCompatChanges.class); if (enableCompatChanges != null) { for (long changeId: enableCompatChanges.value()) { enabled.add(changeId); } } if (disableCompatChanges != null) { for (long changeId: disableCompatChanges.value()) { disabled.add(changeId); } } if (enabled.isEmpty() && disabled.isEmpty()) { return statement; } return new CompatChangeStatement(statement, enabled, disabled); }
Source:
public void run() throws OseeCoreException { TestUtil.setDemoDb(true); Branch atsBranch = AtsUtil.getAtsBranch(); SkynetTransaction transaction = TransactionManager.createTransaction(atsBranch, "Create ATS Folders"); Artifact headingArt = OseeSystemArtifacts.getOrCreateArtifact(AtsArtifactToken.HeadingFolder, atsBranch); Artifact oseeWebArt = ArtifactTypeManager.addArtifact(AtsArtifactToken.WebPrograms, AtsUtil.getAtsBranch()); oseeWebArt.persist(transaction); Artifact demoProgramsArt = ArtifactTypeManager.addArtifact(AtsArtifactToken.DemoPrograms, AtsUtil.getAtsBranch()); oseeWebArt.addRelation(CoreRelationTypes.Universal_Grouping__Members, demoProgramsArt); oseeWebArt.persist(transaction); Artifact Sawteam = ArtifactQuery.getArtifactFromId("At2WHxFk5VVE2cafF5AA", AtsUtil.getAtsBranch()); Sawteam.addRelation(CoreRelationTypes.SupportingInfo_SupportedBy, demoProgramsArt); Sawteam.persist(transaction); headingArt.addChild(oseeWebArt); headingArt.addChild(demoProgramsArt); headingArt.persist(transaction); transaction.execute(); }

Target:
public void run() throws OseeCoreException { TestUtil.setDemoDb(true); Branch atsBranch = AtsUtil.getAtsBranch(); SkynetTransaction transaction = TransactionManager.createTransaction(atsBranch, "Create ATS Folders"); Artifact headingArt = OseeSystemArtifacts.getOrCreateArtifact(AtsArtifactToken.HeadingFolder, atsBranch); Artifact oseeWebArt = ArtifactTypeManager.addArtifact(AtsArtifactToken.WebPrograms, atsBranch); oseeWebArt.persist(transaction); Artifact demoProgramsArt = ArtifactTypeManager.addArtifact(DemoArtifactToken.DemoPrograms, atsBranch); oseeWebArt.addRelation(CoreRelationTypes.Universal_Grouping__Members, demoProgramsArt); oseeWebArt.persist(transaction); Artifact sawTeam = ArtifactQuery.getArtifactFromToken(DemoArtifactToken.SAW_Bld_1, atsBranch); sawTeam.addRelation(CoreRelationTypes.SupportingInfo_SupportedBy, demoProgramsArt); sawTeam.persist(transaction); headingArt.addChild(oseeWebArt); headingArt.addChild(demoProgramsArt); headingArt.persist(transaction); transaction.execute(); }
Source:
public void tearDown() { removeTempDatabase(props, database); }

Target:
public void tearDown() { removeTempDatabase(props, database); removeRestrictedUser(props); }
Source:
private void validateCountDistinct(Schema.Field inputField, FailureCollector collector, String validationFieldName) { if (inputField != null) { Schema.Type type = inputField.getSchema().isNullable() ? inputField.getSchema().getNonNullable().getType() : inputField.getSchema().getType(); if (type != Schema.Type.STRING && type != Schema.Type.INT && type != Schema.Type.LONG && type != Schema.Type.FLOAT && type != Schema.Type.DOUBLE && type != Schema.Type.BOOLEAN) { collector.addFailure( String.format("Distinct counting is not supported for the field %s of type %s.", inputField.getName(), type), "Please specify a string, integer, long, float, double or boolean field.") .withConfigElement("aggregates", validationFieldName); } } }

Target:
private void validateCountDistinct(Schema.Field inputField, FailureCollector collector, String validationFieldName) { if (inputField != null) { Schema.Type type = inputField.getSchema().isNullable() ? inputField.getSchema().getNonNullable().getType() : inputField.getSchema().getType(); if (type != Schema.Type.STRING && type != Schema.Type.INT && type != Schema.Type.LONG && type != Schema.Type.BOOLEAN) { collector.addFailure( String.format("Distinct counting is not supported for the field %s of type %s.", inputField.getName(), type), "Please specify a string, integer, long or boolean field.") .withConfigElement("aggregates", validationFieldName); } } }
Source:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object object = method.invoke(producer, args); if (method.getName().equals("produce") && spiedClasses.contains(object.getClass())) { object = spy(object); } return object; }

Target:
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Object object = method.invoke(producer, args); if (object != null && method.getName().equals("produce") && spiedClasses.contains(object.getClass())) { object = spy(object); } return object; }
Source:
public void pushSurveys(SurveyContainerWSObject surveyContainerWSObject, WSClientCallBack wsClientCallBack) { Response<SurveyWSResult> response = null; try { response = mSurveyApiClientRetrofit.pushSurveys( surveyContainerWSObject).execute(); } catch (UnrecognizedPropertyException e) { ConversionException conversionException = new ConversionException(e); wsClientCallBack.onError(conversionException); } catch (IOException e) { wsClientCallBack.onError(e); } if (response != null && response.code() == 401) { ConversionException conversionException = new ConversionException(null); wsClientCallBack.onError(conversionException); } else if (response != null && response.code() == 402) { InvalidCreedentialsOnPushException invalidCredentialsException = new InvalidCreedentialsOnPushException(); wsClientCallBack.onError(invalidCredentialsException); } else if (response != null && response.isSuccessful()) { wsClientCallBack.onSuccess(response.body()); } else { Log.e(TAG, "Failed response when pushing surveys"); wsClientCallBack.onError(new ConversionException(null)); } }

Target:
public void pushSurveys(SurveyContainerWSObject surveyContainerWSObject, WSClientCallBack wsClientCallBack) { Response<SurveyWSResult> response = null; try { response = mSurveyApiClientRetrofit.pushSurveys( surveyContainerWSObject).execute(); } catch (UnrecognizedPropertyException e) { ConversionException conversionException = new ConversionException(e); wsClientCallBack.onError(conversionException); } catch (IOException e) { wsClientCallBack.onError(e); } if (response != null && response.code() == 401) { ConversionException conversionException = new ConversionException(null); wsClientCallBack.onError(conversionException); } else if (response != null && response.code() == 402) { InvalidCredentialsException invalidCredentialsException = new InvalidCredentialsException(); wsClientCallBack.onError(invalidCredentialsException); } else if (response != null && response.isSuccessful()) { wsClientCallBack.onSuccess(response.body()); } else { Log.e(TAG, "Failed response when pushing surveys"); wsClientCallBack.onError(new ConversionException(null)); } }
Source:
public boolean downloadTemplate() { try { String mountSrcUuid = UUID.randomUUID().toString(); String mount = String.format(mountCommand, srcHost + ":" + srcPath, "/mnt/" + mountSrcUuid); Script.runSimpleBashScript(mount); String downloadDir = getDestPoolPath() + File.separator + getDirectDownloadTempPath(getTemplateId()); setDownloadedFilePath(downloadDir + File.separator + getFileNameFromUrl()); Script.runSimpleBashScript("cp /mnt/" + mountSrcUuid + srcPath + " " + getDownloadedFilePath()); Script.runSimpleBashScript("umount /mnt/" + mountSrcUuid); } catch (Exception e) { return false; } return true; }

Target:
public boolean downloadTemplate() { String mountSrcUuid = UUID.randomUUID().toString(); String mount = String.format(mountCommand, srcHost + ":" + srcPath, "/mnt/" + mountSrcUuid); Script.runSimpleBashScript(mount); String downloadDir = getDestPoolPath() + File.separator + getDirectDownloadTempPath(getTemplateId()); setDownloadedFilePath(downloadDir + File.separator + getFileNameFromUrl()); Script.runSimpleBashScript("cp /mnt/" + mountSrcUuid + srcPath + " " + getDownloadedFilePath()); Script.runSimpleBashScript("umount /mnt/" + mountSrcUuid); return true; }
Source:
public float[] getIntensityValues(float[] intensityValues) { if (this.intensityValues == null) try { parseScan(null, null); } catch (IOException | InvalidRangeException e) { throw new MSDKRuntimeException(e); } return this.intensityValues; }

Target:
public float[] getIntensityValues(float[] intensityValues) { if (preLoadedIntensityValues == null) { final Integer scanIndex = getScanIndex(); numOfDataPoints = getNumberOfDataPoints(); try { final int scanStartPosition[] = {scanStartPositions[scanIndex]}; final int scanLength[] = {scanStartPositions[scanIndex + 1] - scanStartPositions[scanIndex]}; final Array intensityValueArray = intensityValueVariable.read(scanStartPosition, scanLength); final Index intensityValuesIndex = intensityValueArray.getIndex(); if (intensityValues == null || intensityValues.length < numOfDataPoints) intensityValues = new float[numOfDataPoints]; for (int i = 0; i < numOfDataPoints; i++) { final Index intensityIndex0 = intensityValuesIndex.set0(i); intensityValues[i] = (float) (intensityValueArray.getDouble(intensityIndex0) * intensityValueScaleFactor); } } catch (IOException | InvalidRangeException e) { throw new MSDKRuntimeException(e); } } else { if (intensityValues == null || intensityValues.length < numOfDataPoints) intensityValues = new float[numOfDataPoints]; for (int i = 0; i < preLoadedIntensityValues.length; i++) intensityValues[i] = preLoadedIntensityValues[i]; } return intensityValues; }
Source:
public IFolder getDestinationFolder() { return fRelativeDestinationFolder; }

Target:
public IFolder getDestinationFolder() { return fDestinationFolder; }
Source:
public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (filtering) { int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); int size = nodes.size(); if (size > maxCount) { Collections.sort(nodes); nodes = nodes.subList(size - maxCount, size); thresholdTime = nodes.get(0).time; } } } else { allNodes.add(treeNode); } }

Target:
public void addNode(RepositoryTreeNode<?> treeNode, Object timeCarrier) { if (isFiltering()) { int time = Integer.MIN_VALUE; if (timeCarrier instanceof RevCommit) { time = ((RevCommit) timeCarrier).getCommitTime(); } if (time >= thresholdTime) { TimedNode node = new TimedNode(treeNode, time); nodes.add(node); int size = nodes.size(); if (size > maxCount) { Collections.sort(nodes); nodes = nodes.subList(size - maxCount, size); thresholdTime = nodes.get(0).time; } } } else { allNodes.add(treeNode); } }
Source:
private ResponseEntity<?> doExecuteForReturnType(String url, Object requestData, Method method, RestTemplate restTemplate) { ResponseEntity<?> response = method.execute(restTemplate, url, requestData); String body = (response.getBody() == null) ? "" : response.getBody().toString(); sendAuditLog(url, requestData, body, response.getStatusCode().toString()); if (RestUtility.isError(response.getStatusCode())) { return null; } else { return response; } }

Target:
private ResponseEntity<?> doExecuteForReturnType(String url, Object requestData, Method method, RestTemplate restTemplate) { ResponseEntity<?> response = method.execute(restTemplate, url, requestData); String body = response.getBody() == null ? StringUtils.EMPTY : response.getBody().toString(); sendAuditLog(url, requestData, body, response.getStatusCode().toString()); if (RestUtility.isError(response.getStatusCode())) { return null; } else { return response; } }