auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setReverseDirection(boolean reverseDirection) { if (getReverseDirection() != reverseDirection) { for (CustomEncoder encoder : encoders) { encoder.setReverseDirection(!encoder.getReverseDirection()); } } this.reverseDirection = reverseDirection; }

Target:
public void setReverseDirection(boolean reverseDirection) { if (getReverseDirection() != reverseDirection) { encoders[0].setReverseDirection(!encoders[0].getReverseDirection()); encoders[1].setReverseDirection(!encoders[1].getReverseDirection()); } this.reverseDirection = reverseDirection; }
Source:
public void testNullRepositoryTest() { assertEquals(null, new NullRepository().fetchInstallableApplications()); }

Target:
public void testNullRepositoryTest() { assertEquals(new RepositoryDTO.Builder().build(), new NullRepository().fetchInstallableApplications()); }
Source:
private void resetValidationState() { getOrCreateComponentModel().validFileType = true; getOrCreateComponentModel().validFileSize = true; }

Target:
private void resetValidationState() { final FileWidgetModel componentModel = getComponentModel(); if (!componentModel.validFileSize || !componentModel.validFileType) { final FileWidgetModel userModel = getOrCreateComponentModel(); userModel.validFileType = true; userModel.validFileSize = true; } }
Source:
protected @Nullable IAnalysisModule findSegmentProviderAnalysis(@NonNull ITmfTrace trace) { return TmfTraceUtils.getAnalysisModuleOfClass(trace, SystemCallLatencyAnalysis.class, checkNotNull(SystemCallLatencyAnalysis.ID)); }

Target:
protected @Nullable ISegmentStoreProvider findSegmentProviderAnalysis(@NonNull ITmfTrace trace) { return TmfTraceUtils.getAnalysisModuleOfClass(trace, SystemCallLatencyAnalysis.class, SystemCallLatencyAnalysis.ID); }
Source:
protected String[] tableTypes( DatabaseMetaData metadata, Set<String> types ) throws SQLException { Set<String> uppercaseTypes = new HashSet<>(); for (String type : types) { if (type != null) { uppercaseTypes.add(type.toUpperCase()); } } Set<String> matchingTableTypes = new HashSet<>(); try (ResultSet rs = metadata.getTableTypes()) { while (rs.next()) { String tableType = rs.getString(1); if (tableType != null && uppercaseTypes.contains(tableType.toUpperCase())) { matchingTableTypes.add(tableType); } } } return matchingTableTypes.toArray(new String[matchingTableTypes.size()]); }

Target:
protected String[] tableTypes( DatabaseMetaData metadata, Set<String> types ) throws SQLException { Set<String> uppercaseTypes = new HashSet<>(); for (String type : types) { if (type != null) { uppercaseTypes.add(type.toUpperCase(Locale.ROOT)); } } Set<String> matchingTableTypes = new HashSet<>(); try (ResultSet rs = metadata.getTableTypes()) { while (rs.next()) { String tableType = rs.getString(1); if (tableType != null && uppercaseTypes.contains(tableType.toUpperCase(Locale.ROOT))) { matchingTableTypes.add(tableType); } } } return matchingTableTypes.toArray(new String[matchingTableTypes.size()]); }
Source:
protected void onInit() { super.onInit(); this.createGroup(); this.listenMessage(); }

Target:
protected void onInit() { super.onInit(); registerListener(); }
Source:
public void sendRawPdu(SmsTracker[] trackers) { int error = RESULT_ERROR_NONE; PackageInfo appInfo = null; if (mSmsSendDisabled) { Rlog.e(TAG, "Device does not support sending sms."); error = RESULT_ERROR_NO_SERVICE; } else { for (SmsTracker tracker : trackers) { if (tracker.getData().get(MAP_KEY_PDU) == null) { Rlog.e(TAG, "Empty PDU"); error = RESULT_ERROR_NULL_PDU; break; } } if (error == RESULT_ERROR_NONE) { PackageManager pm = mContext.getPackageManager(); String[] packageNames = pm.getPackagesForUid(Binder.getCallingUid()); if (packageNames == null || packageNames.length == 0) { Rlog.e(TAG, "Can't get calling app package name: refusing to send SMS"); error = RESULT_ERROR_GENERIC_FAILURE; } else { try { appInfo = pm.getPackageInfoAsUser( packageNames[0], PackageManager.GET_SIGNATURES, trackers[0].mUserId); } catch (PackageManager.NameNotFoundException e) { Rlog.e(TAG, "Can't get calling app package info: refusing to send SMS"); error = RESULT_ERROR_GENERIC_FAILURE; } } } } if (error != RESULT_ERROR_NONE) { for (SmsTracker tracker : trackers) { tracker.onFailed(mContext, error, 0 ); } return; } if (checkDestination(trackers)) { if (!mSmsDispatchersController .getUsageMonitor() .check(appInfo.packageName, trackers.length)) { sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, trackers)); return; } for (SmsTracker tracker : trackers) { sendSms(tracker); } } if (PhoneNumberUtils.isLocalEmergencyNumber(mContext, trackers[0].mDestAddress)) { new AsyncEmergencyContactNotifier(mContext).execute(); } }

Target:
public void sendRawPdu(SmsTracker[] trackers) { int error = RESULT_ERROR_NONE; PackageInfo appInfo = null; if (mSmsSendDisabled) { Rlog.e(TAG, "Device does not support sending sms."); error = RESULT_ERROR_NO_SERVICE; } else { for (SmsTracker tracker : trackers) { if (tracker.getData().get(MAP_KEY_PDU) == null) { Rlog.e(TAG, "Empty PDU"); error = RESULT_ERROR_NULL_PDU; break; } } if (error == RESULT_ERROR_NONE) { PackageManager pm = mContext.getPackageManager(); try { appInfo = pm.getPackageInfoAsUser( trackers[0].getAppPackageName(), PackageManager.GET_SIGNATURES, trackers[0].mUserId); } catch (PackageManager.NameNotFoundException e) { Rlog.e(TAG, "Can't get calling app package info: refusing to send SMS"); error = RESULT_ERROR_GENERIC_FAILURE; } } } if (error != RESULT_ERROR_NONE) { handleSmsTrackersFailure(trackers, error, 0 ); return; } if (checkDestination(trackers)) { if (!mSmsDispatchersController .getUsageMonitor() .check(appInfo.packageName, trackers.length)) { sendMessage(obtainMessage(EVENT_SEND_LIMIT_REACHED_CONFIRMATION, trackers)); return; } for (SmsTracker tracker : trackers) { sendSms(tracker); } } if (PhoneNumberUtils.isLocalEmergencyNumber(mContext, trackers[0].mDestAddress)) { new AsyncEmergencyContactNotifier(mContext).execute(); } }
Source:
private ActivityManager.RunningAppProcessInfo getRemoteProcessInfo() { ActivityManager manager = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processInfoList = manager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo info : processInfoList) { if (info.processName.equals(getContext().getPackageName() + ":remote")) { return info; } } return null; }

Target:
private ActivityManager.RunningAppProcessInfo getRemoteProcessInfo() { ActivityManager manager = (ActivityManager)getContext().getSystemService(Context.ACTIVITY_SERVICE); List<ActivityManager.RunningAppProcessInfo> processInfoList = manager.getRunningAppProcesses(); for (ActivityManager.RunningAppProcessInfo info : processInfoList) { if (info.processName.equals(getContext().getPackageName() + REMOTE_PROCESS_POSTFIX)) { return info; } } return null; }
Source:
public static void main(String[] args) { Random rnd = new Random(); String[] eventTypes = new String[64]; try (FileOutputStream fos = new FileOutputStream("/home/ematkho/nexusTrace")) { for (int i = 0; i < 64; i++) { eventTypes[i] = new String("Event " + i); } for (int i = 0; i < 64; i++) { fos.write(eventTypes[i].getBytes()); if (i != 63) { fos.write(','); } else { fos.write('\n'); } } int timestamp = 500 + rnd.nextInt(500); for (int i = 0; i < 400000; i++) { timestamp = timestamp + rnd.nextInt(50) + 1; int data = rnd.nextInt(); fos.write(intToByteArray(timestamp)); fos.write(intToByteArray(data)); if (i % 10000 == 0 && i != 0) { System.out.print('.'); } } } catch (IOException e) { e.printStackTrace(); } }

Target:
public static void main(String[] args) { Random rnd = new Random(); String[] eventTypes = new String[64]; final String fileLoc = System.getProperty("user.home") + File.separator + "nexusTrace"; try (FileOutputStream fos = new FileOutputStream(fileLoc)) { for (int i = 0; i < 64; i++) { eventTypes[i] = new String("Event " + i); } for (int i = 0; i < 64; i++) { fos.write(eventTypes[i].getBytes()); if (i != 63) { fos.write(','); } else { fos.write('\n'); } } int timestamp = 500 + rnd.nextInt(500); for (int i = 0; i < 400000; i++) { timestamp = timestamp + rnd.nextInt(50) + 1; int data = rnd.nextInt(); fos.write(intToByteArray(timestamp)); fos.write(intToByteArray(data)); if (i % 10000 == 0 && i != 0) { System.out.print('.'); } } System.out.print('\n'); System.out.println("Trace written to : " + fileLoc); } catch (IOException e) { e.printStackTrace(); } }
Source:
private String parseExpectedSessionId(Object data) { if (data == null) { return null; } ZNRecord record; try { record = (ZNRecord) data; } catch (ClassCastException e) { LOG.debug("Failed to parse expected session id!", e); return null; } if (record.getSimpleField(MSG_ID_ATTRIBUTE) != null) { return record.getSimpleField(MSG_SRC_SESSION_ID_ATTRIBUTE); } return null; }

Target:
private String parseExpectedSessionId(Object data) { if (!(data instanceof SessionAwareZNRecord)) { return null; } return ((SessionAwareZNRecord) data).getExpectedSessionId(); }
Source:
public FactoryDto createFactory(@NotNull final Map<String, String> factoryParameters) throws BadRequestException, ServerException { String devfileLocation = factoryParameters.get(URL_PARAMETER_NAME); FileContentProvider contentProvider = devfileLocation == null ? new FetchNotSupportedProvider(LOCAL_FILES_REFERENCES_ARE_NOT_SUPPORTED) : new URLFileContentProvider(URI.create(devfileLocation), urlFetcher); return urlFactoryBuilder .createFactoryFromDevfile(devfileLocation, contentProvider) .orElse(null); }

Target:
public FactoryDto createFactory(@NotNull final Map<String, String> factoryParameters) throws BadRequestException, ServerException { String devfileLocation = factoryParameters.get(URL_PARAMETER_NAME); return urlFactoryBuilder .createFactoryFromDevfile( devfileLocation, new URLFileContentProvider(URI.create(devfileLocation), urlFetcher)) .orElse(null); }
Source:
public Object getDescriptor() { final List<Tad> elements = CollectionUtil.newArrayList(); final Tad sensorName = new Tad(); sensorName.setName(SENSOR_NAME); sensorName.setId(SENSOR_NAME); sensorName.setDescription(SENSOR_NAME); sensorName.setType(Tscalar.STRING); sensorName.setRequired(true); sensorName.setDefault("TEMPERATURE"); addOptions(sensorName, SensorName.values()); final Tad XdkAddress = new Tad(); XdkAddress.setName(XDK_ADDRESS); XdkAddress.setId(XDK_ADDRESS); XdkAddress.setDescription(XDK_ADDRESS); XdkAddress.setType(Tscalar.STRING); XdkAddress.setRequired(true); XdkAddress.setDefault("AA:BB:CC:DD:EE:FF"); elements.add(XdkAddress); elements.add(sensorName); return elements; }

Target:
public Object getDescriptor() { final List<Tad> elements = CollectionUtil.newArrayList(); final Tad sensorName = new Tad(); sensorName.setName(SENSOR_NAME); sensorName.setId(SENSOR_NAME); sensorName.setDescription(SENSOR_NAME); sensorName.setType(Tscalar.STRING); sensorName.setRequired(true); sensorName.setDefault("TEMPERATURE"); addOptions(sensorName, SensorName.values()); final Tad xdkAddress = new Tad(); xdkAddress.setName(XDK_ADDRESS); xdkAddress.setId(XDK_ADDRESS); xdkAddress.setDescription(XDK_ADDRESS); xdkAddress.setType(Tscalar.STRING); xdkAddress.setRequired(true); xdkAddress.setDefault("AA:BB:CC:DD:EE:FF"); elements.add(xdkAddress); elements.add(sensorName); return elements; }
Source:
public void authoriseCharge() { addGatewayAccount(ImmutableMap.of("stripe_account_id", STRIPE_ACCOUNT_ID)); String externalChargeId = addCharge(); given().port(testContext.getPort()) .contentType(JSON) .body(validAuthorisationDetails) .post(authoriseChargeUrlFor(externalChargeId)) .then() .body("status", Matchers.is(AUTHORISATION_SUCCESS.toString())) .statusCode(200); verify(postRequestedFor(urlEqualTo("/v1/tokens")) .withHeader("Content-Type", equalTo(APPLICATION_FORM_URLENCODED)) .withRequestBody(matching(constructExpectedRequestBody()))); verify(postRequestedFor(urlEqualTo("/v1/charges")) .withHeader("Content-Type", equalTo(APPLICATION_JSON))); List<LoggedRequest> requests = findAll(postRequestedFor(urlMatching("/v1/charges"))); assertThat(requests).hasSize(1); assertThat(requests.get(0).getBodyAsString()).isEqualTo(stripeAuthoriseJsonPayload()); }

Target:
public void authoriseCharge() { addGatewayAccount(ImmutableMap.of("stripe_account_id", STRIPE_ACCOUNT_ID)); String externalChargeId = addCharge(); given().port(testContext.getPort()) .contentType(JSON) .body(validAuthorisationDetails) .post(authoriseChargeUrlFor(externalChargeId)) .then() .body("status", Matchers.is(AUTHORISATION_SUCCESS.toString())) .statusCode(200); verify(postRequestedFor(urlEqualTo("/v1/tokens")) .withHeader("Content-Type", equalTo(APPLICATION_FORM_URLENCODED)) .withRequestBody(matching(constructExpectedRequestBody()))); verify(postRequestedFor(urlEqualTo("/v1/charges")) .withHeader("Content-Type", equalTo(APPLICATION_FORM_URLENCODED))); List<LoggedRequest> requests = findAll(postRequestedFor(urlMatching("/v1/charges"))); assertThat(requests).hasSize(1); assertThat(requests.get(0).getBodyAsString()).isEqualTo(stripeAuthoriseJsonPayload()); }
Source:
public void testManualNullMetadataBasedRule() throws InterruptedException { RetentionRule testRule = createManualMetadataBasedRuleMillis("dc:expired", 500L); Calendar haldSecond = Calendar.getInstance(); haldSecond.add(Calendar.MILLISECOND, -1000); file = session.saveDocument(file); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); }

Target:
public void testManualNullMetadataBasedRule() { RetentionRule testRule = createManualMetadataBasedRuleMillis("dc:expired", 500); Calendar minusOneSecond = Calendar.getInstance(); minusOneSecond.add(Calendar.MILLISECOND, -1000); file = session.saveDocument(file); file = service.attachRule(file, testRule, session); assertTrue(file.isRecord()); assertFalse(session.isUnderRetentionOrLegalHold(file.getRef())); }
Source:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { if (op.getPath().endsWith(LICENSE_STEP_OPERATION_ENTRY)) { PatchOperation<String> patchOperation = new PatchOperationFactory() .instanceOf(LICENSE_STEP_OPERATION_ENTRY, op.getOp()); patchOperation.perform(context, currentRequest, source, op); } else { throw new UnprocessableEntityException("This path : " + op.getPath() + " can not to be replaced"); } }

Target:
public void doPatchProcessing(Context context, Request currentRequest, InProgressSubmission source, Operation op, SubmissionStepConfig stepConf) throws Exception { if (op.getPath().endsWith(LICENSE_STEP_OPERATION_ENTRY)) { PatchOperation<String> patchOperation = new PatchOperationFactory() .instanceOf(LICENSE_STEP_OPERATION_ENTRY, op.getOp()); patchOperation.perform(context, currentRequest, source, op); } else { throw new UnprocessableEntityException("The path " + op.getPath() + " cannot be patched"); } }
Source:
public DruidStatement( final String connectionId, final int statementId, final Map<String, Object> queryContext, final Runnable onClose ) { this.connectionId = Preconditions.checkNotNull(connectionId, "connectionId"); this.statementId = statementId; this.queryContext = queryContext == null ? ImmutableMap.of() : queryContext; this.onClose = Preconditions.checkNotNull(onClose, "onClose"); this.yielderOpenCloseExecutor = Executors.newSingleThreadExecutor(); }

Target:
public DruidStatement( final String connectionId, final int statementId, final Map<String, Object> queryContext, final Runnable onClose ) { this.connectionId = Preconditions.checkNotNull(connectionId, "connectionId"); this.statementId = statementId; this.queryContext = queryContext == null ? ImmutableMap.of() : queryContext; this.onClose = Preconditions.checkNotNull(onClose, "onClose"); this.yielderOpenCloseExecutor = Execs.singleThreaded( String.format("JDBCYielderOpenCloseExecutor-connection-%s-statement-%d", connectionId, statementId) ); }
Source:
public feign.Response execute(Request request, Request.Options _options) throws IOException { com.palantir.dialogue.Request.Builder builder = com.palantir.dialogue.Request.builder().body(requestBody(request)); request.headers().forEach((headerName, values) -> { if (includeRequestHeader(headerName)) { builder.putAllHeaderParams(headerName, values); } }); try { Response response = clients.block(clients.call( channel, new FeignRequestEndpoint(request), builder.build(), IdentityDeserializer.INSTANCE)); return feign.Response.create( response.code(), null, Multimaps.asMap((Multimap<String, String>) response.headers()), new DialogueResponseBody(response)); } catch (UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw e; } }

Target:
public feign.Response execute(Request request, Request.Options _options) throws IOException { com.palantir.dialogue.Request.Builder builder = com.palantir.dialogue.Request.builder().body(requestBody(request)); request.headers().forEach((headerName, values) -> { if (includeRequestHeader(headerName)) { builder.putAllHeaderParams(headerName, values); } }); try { return runtime.clients() .block(runtime.clients() .call( channel, new FeignRequestEndpoint(request), builder.build(), FeignResponseDeserializer.INSTANCE)); } catch (UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw e; } }
Source:
public void reasonPhraseIsOptional() { Response response = Response.builder() .status(200) .reason(null) .headers(Collections.<String, Collection<String>>emptyMap()) .body(new byte[0]) .build(); assertThat(response.reason()).isNull(); assertThat(response.toString()).isEqualTo("HTTP/1.1 200\n\n"); }

Target:
public void reasonPhraseIsOptional() { Response response = Response.builder() .status(200) .headers(Collections.<String, Collection<String>>emptyMap()) .body(new byte[0]) .build(); assertThat(response.reason()).isNull(); assertThat(response.toString()).isEqualTo("HTTP/1.1 200\n\n"); }
Source:
private List<CourseAttributes> extractArchivedCourses( List<CourseDetailsBundle> courseBundles) { ArrayList<CourseAttributes> archivedCourses = new ArrayList<CourseAttributes>(); for (CourseDetailsBundle courseBundle : courseBundles) { CourseAttributes course = courseBundle.course; InstructorAttributes curInstructor = logic.getInstructorForGoogleId(course.id, account.googleId); boolean isCourseArchived = (curInstructor.isArchived != null)? curInstructor.isArchived : course.isArchived; if (isCourseArchived) { archivedCourses.add(course); } } return archivedCourses; }

Target:
private List<CourseAttributes> extractArchivedCourses( List<CourseDetailsBundle> courseBundles) { ArrayList<CourseAttributes> archivedCourses = new ArrayList<CourseAttributes>(); for (CourseDetailsBundle courseBundle : courseBundles) { CourseAttributes course = courseBundle.course; InstructorAttributes curInstructor = logic.getInstructorForGoogleId(course.id, account.googleId); if (logic.isCourseArchived(course.id, curInstructor.googleId)) { archivedCourses.add(course); } } return archivedCourses; }
Source:
public void shouldBeAuthorizedToSetLegalHold() throws LoginException { ACP acp = new ACPImpl(); ACE allowLegalHold = new ACE("user", RetentionConstants.MANAGE_LEGAL_HOLD_PERMISSION, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { allowLegalHold }); acp.addACL(acl); file.setACP(acp, true); file = session.saveDocument(file); try (CloseableCoreSession userSession = CoreInstance.openCoreSession(session.getRepositoryName(), "user")) { userSession.makeRecord(file.getRef()); userSession.setLegalHold(file.getRef(), true, null); } }

Target:
public void shouldBeAuthorizedToSetLegalHold() { ACP acp = new ACPImpl(); ACE allowLegalHold = new ACE("user", RetentionConstants.MANAGE_LEGAL_HOLD_PERMISSION, true); ACL acl = new ACLImpl(); acl.setACEs(new ACE[] { allowLegalHold }); acp.addACL(acl); file.setACP(acp, true); file = session.saveDocument(file); try (CloseableCoreSession userSession = CoreInstance.openCoreSession(session.getRepositoryName(), "user")) { userSession.makeRecord(file.getRef()); userSession.setLegalHold(file.getRef(), true, null); } }
Source:
public IssueChangeNotification setProject(ComponentDto project) { return setProject(project.getKey(), project.longName(), project.getBranch(), project.getRootUuid()); }

Target:
public IssueChangeNotification setProject(ComponentDto project) { return setProject(project.getKey(), project.name(), project.getBranch(), project.uuid()); }
Source:
private List<String> toPartitionValues(Page partitionColumns, int position) { ImmutableList.Builder<String> partitionValues = ImmutableList.builder(); for (int field = 0; field < partitionColumns.getChannelCount(); field++) { Object value = getField(partitionColumnTypes.get(field), partitionColumns.getBlock(field), position); if (value == null) { partitionValues.add(HIVE_DEFAULT_DYNAMIC_PARTITION); } else { String valueString = value.toString(); if (!CharMatcher.inRange((char) 0x20, (char) 0x7E).matchesAllOf(valueString)) { throw new PrestoException(HIVE_INVALID_PARTITION_VALUE, "\"" + valueString + "\" contains characters not in the range of 0x20 - 0x7E"); } partitionValues.add(valueString); } } return partitionValues.build(); }

Target:
private List<String> toPartitionValues(Page partitionColumns, int position) { ImmutableList.Builder<String> partitionValues = ImmutableList.builder(); for (int field = 0; field < partitionColumns.getChannelCount(); field++) { Object value = getField(partitionColumnTypes.get(field), partitionColumns.getBlock(field), position); if (value == null) { partitionValues.add(HIVE_DEFAULT_DYNAMIC_PARTITION); } else { String valueString = value.toString(); if (!CharMatcher.inRange((char) 0x20, (char) 0x7E).matchesAllOf(valueString)) { throw new PrestoException( HIVE_INVALID_PARTITION_VALUE, format("Cannot use %s as value of a partition column in Hive. Partition keys in Hive can only contain characters in the range of 0x20 - 0x7E.", valueString)); } partitionValues.add(valueString); } } return partitionValues.build(); }
Source:
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); SortNode sortNode = (SortNode) node; for (int i = 0; i < orderBy.size(); ++i) { Ordering ordering = orderBy.get(i); Symbol symbol = Symbol.from(symbolAliases.get(ordering.getField())); OrderingScheme orderingScheme = sortNode.getOrderingScheme(); if (!symbol.equals(orderingScheme.getOrderBy().get(i))) { return NO_MATCH; } if (!ordering.getSortOrder().equals(orderingScheme.getOrdering(symbol))) { return NO_MATCH; } } return MatchResult.match(); }

Target:
public MatchResult detailMatches(PlanNode node, StatsProvider stats, Session session, Metadata metadata, SymbolAliases symbolAliases) { checkState(shapeMatches(node), "Plan testing framework error: shapeMatches returned false in detailMatches in %s", this.getClass().getName()); SortNode sortNode = (SortNode) node; if (!orderingSchemeMatches(orderBy, sortNode.getOrderingScheme(), symbolAliases)) { return NO_MATCH; } return MatchResult.match(); }
Source:
public void serialize(T record, DataOutputView target) throws IOException { SimpleVersionedSerializer<T> serializer = getSerializer(); target.writeInt(serializer.getVersion()); byte[] serializedRecord = serializer.serialize(record); target.writeInt(serializedRecord.length); target.write(serializedRecord); }

Target:
public void serialize(T record, DataOutputView target) throws IOException { SimpleVersionedSerializer<T> serializer = getSerializer(); SimpleVersionedSerialization.writeVersionAndSerialize(serializer, record, target); }
Source:
private void assertSchema(ParquetMetadata parquetMetadata) { List<Type> fields = parquetMetadata.getFileMetaData().getSchema().getFields(); assertEquals(2, fields.size()); Type stringField = fields.get(0); assertEquals("s", stringField.getName()); assertEquals(PrimitiveType.PrimitiveTypeName.BINARY, stringField.asPrimitiveType().getPrimitiveTypeName()); assertEquals(OriginalType.UTF8, stringField.getOriginalType()); Type binaryField = fields.get(1); assertEquals("b", binaryField.getName()); assertEquals(PrimitiveType.PrimitiveTypeName.BINARY, binaryField.asPrimitiveType().getPrimitiveTypeName()); assertNull(binaryField.getOriginalType()); }

Target:
private void assertSchema(ParquetMetadata parquetMetadata) { List<Type> fields = parquetMetadata.getFileMetaData().getSchema().getFields(); assertEquals(2, fields.size()); assertEquals(Types.required(PrimitiveType.PrimitiveTypeName.BINARY).id(1).named("s"), fields.get(0)); assertEquals(OriginalType.UTF8, fields.get(0).getOriginalType()); assertEquals(Types.required(PrimitiveType.PrimitiveTypeName.BINARY).id(2).named("b"), fields.get(1)); assertNull(fields.get(1).getOriginalType()); }
Source:
public void setUp() { MockitoAnnotations.initMocks(this); FakeFeatureFactory.setupForTest(mContext); mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext); mFragment = spy(new TestFragment()); mFragment.onAttach(ShadowApplication.getInstance().getApplicationContext()); doReturn(mActivity).when(mFragment).getActivity(); Resources res = application.getResources(); theme = res.newTheme(); doReturn(res).when(mFragment).getResources(); when(mFragment.getActivity().getTheme()).thenReturn(theme); when(mFragment.getActivity().getIntent()).thenReturn(intent); when(mFragment.getActivity().getResources()).thenReturn(res); when(mFragment.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager); }

Target:
public void setUp() { MockitoAnnotations.initMocks(this); mFragment = spy(new TestFragment()); mFragment.onAttach(application); doReturn(mActivity).when(mFragment).getActivity(); Resources res = application.getResources(); doReturn(res).when(mFragment).getResources(); when(mActivity.getTheme()).thenReturn(res.newTheme()); when(mActivity.getIntent()).thenReturn(mIntent); when(mActivity.getResources()).thenReturn(res); when(mFragment.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager); }
Source:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("text/html; charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); PrintWriter writer = response.getWriter(); if (CurrentSimulator.isRunning() == true) writer.println(RaoRuntime.getCurrentTime()); else writer.println("Модель не запущена"); baseRequest.setHandled(true); }

Target:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setContentType("application/json; charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); JsonObject result = new JsonObject(); PrintWriter writer = response.getWriter(); if (CurrentSimulator.isRunning() == true) { result.addProperty("currentTime", RaoRuntime.getCurrentTime()); writer.println(result); } else { result.addProperty("modelState", "Модель не запущена"); writer.println(result); } baseRequest.setHandled(true); }
Source:
public static ImmutableMap<Long, String> getBlobChecksumMap(final Headers headers) { if (headers.keys() == null) { return ImmutableMap.of(); } final ImmutableMap.Builder<Long, String> builder = ImmutableMap.builder(); for (final String key : headers.keys()) { if (key.startsWith(BLOB_CHECKSUM_HEADER)) { builder.put(getOffsetFromHeaderKey(key), getBlobChecksumValue(key, headers)); } } return builder.build(); }

Target:
public static ImmutableMap<Long, String> getBlobChecksumMap(final Headers headers) { if (headers.keys() == null) { return ImmutableMap.of(); } final ImmutableMap.Builder<Long, String> builder = ImmutableMap.builder(); headers.keys().stream() .filter(key -> key.startsWith(BLOB_CHECKSUM_HEADER)) .forEach(key -> builder.put(getOffsetFromHeaderKey(key), getBlobChecksumValue(key, headers))); return builder.build(); }
Source:
public static void main(String[] args) throws Exception { SpringApplication.run(ZipkinStreamServerApplication.class, "--debug"); }

Target:
public static void main(String[] args) throws Exception { SpringApplication.run(ZipkinStreamServerApplication.class, args); }
Source:
public static void markLastJobAsFailed(JobRepository jobRepository, String jobName, JobParameters jobParameters) throws NoPreviousJobExecution { JobExecution lastJobExecution = jobRepository.getLastJobExecution(jobName, jobParameters); if (lastJobExecution == null) { throw new NoPreviousJobExecution(jobName, jobParameters); } Date currentTime = new Date(); lastJobExecution.setEndTime(currentTime); lastJobExecution.setStatus(BatchStatus.FAILED); lastJobExecution.setExitStatus( lastJobExecution.getExitStatus().replaceExitCode("FAILED").addExitDescription("Manually " + "failed job") ); jobRepository.update(lastJobExecution); for (StepExecution stepExecution : lastJobExecution.getStepExecutions()) { stepExecution.setEndTime(currentTime); stepExecution.setStatus(BatchStatus.FAILED); stepExecution.setExitStatus(lastJobExecution.getExitStatus().replaceExitCode("FAILED")); jobRepository.update(stepExecution); } }

Target:
public static void markLastJobAsFailed(JobRepository jobRepository, String jobName, JobParameters jobParameters) throws NoPreviousJobExecutionException { JobExecution lastJobExecution = jobRepository.getLastJobExecution(jobName, jobParameters); if (lastJobExecution == null) { throw new NoPreviousJobExecutionException(jobName, jobParameters); } Date currentTime = new Date(); lastJobExecution.setEndTime(currentTime); lastJobExecution.setStatus(BatchStatus.FAILED); lastJobExecution.setExitStatus( lastJobExecution.getExitStatus().replaceExitCode("FAILED").addExitDescription("Manually " + "failed job") ); jobRepository.update(lastJobExecution); for (StepExecution stepExecution : lastJobExecution.getStepExecutions()) { stepExecution.setEndTime(currentTime); stepExecution.setStatus(BatchStatus.FAILED); stepExecution.setExitStatus(lastJobExecution.getExitStatus().replaceExitCode("FAILED")); jobRepository.update(stepExecution); } }
Source:
public int read(byte[] b, int off, int len) throws IOException { byte[] contiguousRange = null; long rangeStart = -1L; long absoluteOffset = streamPos + off; for (Map.Entry<Long, byte[]> entry : data.entrySet()) { long start = entry.getKey(); long end = entry.getKey() + entry.getValue().length; if (absoluteOffset >= start && absoluteOffset < end) { contiguousRange = entry.getValue(); rangeStart = entry.getKey(); } } if (contiguousRange == null || rangeStart == -1L) { streamPos += len; return len; } int relativeStreamPos = (int)(streamPos - rangeStart) + off; for (int i = 0; i < len; i++) { try { b[i] = contiguousRange[relativeStreamPos + i]; } catch (Exception e) { LOGGER.severe("Error copying bytes. requested offset: " + off + " - requested length: " + len + " - relativeStreamPos: " + relativeStreamPos + " - streamPos: " + streamPos); } } streamPos += len; return len; }

Target:
public int read(byte[] b, int off, int len) throws IOException { byte[] contiguousRange = null; long rangeStart = -1L; long absoluteOffset = streamPos + off; for (Map.Entry<Long, byte[]> entry : data.entrySet()) { long start = entry.getKey(); long end = entry.getKey() + entry.getValue().length; if (absoluteOffset >= start && absoluteOffset < end) { contiguousRange = entry.getValue(); rangeStart = entry.getKey(); } } if (contiguousRange == null || rangeStart == -1L) { LOGGER.severe("The requested offset is not present in the available data. Requested offset: " + off + " - requested length: " + len + " - streamPos: " + streamPos); throw new IOException("No COG data available for the requested byte location."); } int relativeStreamPos = (int)(streamPos - rangeStart) + off; System.arraycopy(contiguousRange, relativeStreamPos, b, 0, len); streamPos += len; return len; }
Source:
public void testGetNameSpaceArray() throws JsonProcessingException { String json = "[\"key\", \"value\", \"MetricGroupType.key\", \"MetricGroupType.value\"]"; MetricKey key = MetricKey.create("step", MetricName.named(json, "name")); assertThat(FlinkMetricContainer.getNameSpaceArray(key), is(DEFAULT_SCOPE_COMPONENTS)); }

Target:
public void testGetNameSpaceArray() { String json = "[\"key\", \"value\", \"MetricGroupType.key\", \"MetricGroupType.value\"]"; MetricKey key = MetricKey.create("step", MetricName.named(json, "name")); assertThat(FlinkMetricContainer.getNameSpaceArray(key), is(DEFAULT_SCOPE_COMPONENTS)); }
Source:
public void getBitstreamFormat() throws Exception { getClient().perform(get("/api/core/bitstreams/" + bitstream.getID() + "/format")) .andExpect(status().isUnauthorized()); getClient(getAuthToken(eperson.getEmail(), password)) .perform(get("/api/core/bitstreams/" + bitstream.getID() + "/format")) .andExpect(status().isForbidden()); context.turnOffAuthorisationSystem(); resourcePolicy = resourcePolicyService.create(context); resourcePolicy.setEPerson(eperson); resourcePolicy.setAction(READ); resourcePolicy.setdSpaceObject(bitstream); context.commit(); getClient(getAuthToken(eperson.getEmail(), password)) .perform(get("/api/core/bitstreams/" + bitstream.getID() + "/format")) .andExpect(status().isOk()); getClient(getAuthToken(admin.getEmail(), password)) .perform(get("/api/core/bitstreams/" + bitstream.getID() + "/format")) .andExpect(status().isOk()) .andExpect(jsonPath("$", matchBitstreamFormat( supportedFormat.getID(), supportedFormat.getMIMEType(), supportedFormat.getDescription(), supportedFormat.getShortDescription(), "SUPPORTED" ))); }

Target:
public void getBitstreamFormat() throws Exception { getClient() .perform(get("/api/core/bitstreams/" + bitstream.getID() + "/format")) .andExpect(status().isOk()) .andExpect(jsonPath("$", matchBitstreamFormat( supportedFormat.getID(), supportedFormat.getMIMEType(), supportedFormat.getDescription(), supportedFormat.getShortDescription(), "SUPPORTED" ))); }
Source:
private ClientConfig getConfigFromLocation(URI location, ClassLoader classLoader, String instanceName) throws URISyntaxException, IOException { String scheme = location.getScheme(); if (scheme == null) { location = new URI(System.getProperty(location.getRawSchemeSpecificPart())); scheme = location.getScheme(); } ClassLoader theClassLoader = classLoader == null ? getDefaultClassLoader() : classLoader; URL configURL; if ("classpath".equals(scheme)) { configURL = theClassLoader.getResource(location.getRawSchemeSpecificPart()); } else if ("file".equals(scheme) || "http".equals(scheme) || "https".equals(scheme)) { configURL = location.toURL(); } else { throw new URISyntaxException(location.toString(), "Unsupported protocol in configuration location URL"); } try { return getConfig(configURL, classLoader, instanceName); } catch (Exception e) { throw rethrow(e); } }

Target:
private ClientConfig getConfigFromLocation(URI location, ClassLoader classLoader, String instanceName) throws URISyntaxException, IOException { String scheme = location.getScheme(); if (scheme == null) { location = new URI(System.getProperty(location.getRawSchemeSpecificPart())); scheme = location.getScheme(); } ClassLoader theClassLoader = classLoader == null ? getDefaultClassLoader() : classLoader; URL configURL; if ("classpath".equals(scheme)) { configURL = theClassLoader.getResource(location.getRawSchemeSpecificPart()); } else if ("file".equals(scheme) || "http".equals(scheme) || "https".equals(scheme)) { configURL = location.toURL(); } else { throw new URISyntaxException(location.toString(), "Unsupported protocol in configuration location URL"); } try { return getConfig(configURL, theClassLoader, instanceName); } catch (Exception e) { throw rethrow(e); } }
Source:
public Object processFetch(Environment context, PersistentResourceFetcher fetcher) { String entityName = context.field.getName(); String aliasName = context.field.getAlias(); String keyName = (aliasName == null ? "" : aliasName) + ":" + entityName; return fetcher.fetchObject( context.requestScope, context.requestScope .getProjectionInfo() .getProjections() .get(keyName), context.ids ); }

Target:
public Object processFetch(Environment context, PersistentResourceFetcher fetcher) { String entityName = context.field.getName(); String aliasName = context.field.getAlias(); return fetcher.fetchObject( context.requestScope, context.requestScope .getProjectionInfo() .getProjection(aliasName, entityName), context.ids ); }
Source:
protected TokenResponse executeRefreshToken() throws IOException { GenerateAccessTokenResponse accessTokenResponse = null; try { accessTokenResponse = generateAccessToken(); } catch (GeneralSecurityException e) { throw new RuntimeException("Failed to get access token", e); } String accessToken = Preconditions.checkNotNull( accessTokenResponse.getAccessToken(), "Access Token cannot be null!"); Instant expirationTimeInInstant = Instant.parse(accessTokenResponse.getExpireTime()); Long expirationTimeMilliSeconds = expirationTimeInInstant.toEpochMilli(); return new TokenResponse() .setAccessToken(accessToken) .setExpiresInSeconds( expirationTimeMilliSeconds == null ? null : (expirationTimeMilliSeconds - clock.currentTimeMillis()) / 1000); }

Target:
protected TokenResponse executeRefreshToken() throws IOException { GenerateAccessTokenResponse accessTokenResponse = generateAccessToken(); TokenResponse tokenResponse = new TokenResponse().setAccessToken(accessTokenResponse.getAccessToken()); if (isNullOrEmpty(accessTokenResponse.getExpireTime())) { return tokenResponse; } Instant expirationTimeInInstant = Instant.parse(accessTokenResponse.getExpireTime()); long expirationTimeMilliSeconds = expirationTimeInInstant.getEpochSecond(); return tokenResponse.setExpiresInSeconds( expirationTimeMilliSeconds - clock.currentTimeMillis() / 1000); }
Source:
public Class<? extends Compressor> getCompressorType() { return LzopCodec.HadoopLzopCompressor.class; }

Target:
public Class<? extends Compressor> getCompressorType() { return LzopCompressor.class; }
Source:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { if (anyFailed) { setCommandEndStatus(command, anyFailed, status, childCmdIds); return; } else { RemoveVmPoolCommand<? extends VmPoolParametersBase> removeVmPoolCommand = (RemoveVmPoolCommand) command; VmPool pool = DbFacade.getInstance().getVmPoolDao().get(removeVmPoolCommand.getVmPoolId()); if (pool == null || pool.getRunningVmsCount() == 0) { setCommandEndStatus(command, false, status, childCmdIds); return; } } }

Target:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { if (anyFailed) { setCommandEndStatus(command, true, status, childCmdIds); } else { RemoveVmPoolCommand<? extends VmPoolParametersBase> removeVmPoolCommand = (RemoveVmPoolCommand<? extends VmPoolParametersBase>) command; VmPool pool = DbFacade.getInstance().getVmPoolDao().get(removeVmPoolCommand.getVmPoolId()); if (pool == null || pool.getRunningVmsCount() == 0) { setCommandEndStatus(command, false, status, childCmdIds); } } }
Source:
protected boolean validate() { if (!super.validate()) { return false; } if (!getGlusterVolume().getVolumeType().isReplicatedType()) { addValidationMessage(EngineMessage.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getGlusterVolume().getAsyncTask() != null && getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_HAS_RUNNING_TASKS); return false; } if (getParameters().getExistingBrick() == null || getParameters().getNewBrick() == null) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } if (!updateBrickServerAndInterfaceName(getParameters().getNewBrick(), true)) { return false; } return true; }

Target:
protected boolean validate() { if (!super.validate()) { return false; } if (!getGlusterVolume().getVolumeType().isReplicatedType()) { addValidationMessage(EngineMessage.ACTION_TYPE_NOT_SUPPORTED_FOR_VOLUME_TYPE); return false; } if (!getGlusterVolume().isOnline()) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_VOLUME_IS_DOWN); return false; } if (getGlusterVolume().getAsyncTask() != null && (getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.STARTED || getGlusterVolume().getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && getGlusterVolume().getAsyncTask().getStatus() == JobExecutionStatus.FINISHED)) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_VOLUME_OPERATION_IN_PROGRESS); return false; } if (getParameters().getExistingBrick() == null || getParameters().getNewBrick() == null) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_BRICKS_REQUIRED); return false; } if (!isValidVolumeBrick(getParameters().getExistingBrick())) { addValidationMessage(EngineMessage.ACTION_TYPE_FAILED_NOT_A_GLUSTER_VOLUME_BRICK); return false; } if (!updateBrickServerAndInterfaceName(getParameters().getNewBrick(), true)) { return false; } return true; }
Source:
public void doDecrypt(String productBranding, String productVersion) { Validate.notNull(productBranding, "invalid null product branding"); Validate.notNull(productVersion, "invalid null product version"); final String ddfHome = System.getProperty("ddf.home"); LOGGER.debug( "Decrypting product under from to [{}]...", productBranding, productVersion, ddfHome, exportFile, decryptFile); zip.stream().forEach(this::decrypt); }

Target:
public void doDecrypt(String productBranding, String productVersion) { Validate.notNull(productBranding, "invalid null product branding"); Validate.notNull(productVersion, "invalid null product version"); final String ddfHome = System.getProperty("ddf.home"); LOGGER.debug( "Decrypting product under from to [{}]...", productBranding, productVersion, ddfHome, exportFile, decryptFile); zip.stream().forEach(this::copyToOutputZipFile); }
Source:
public ChromeOptions merge(Capabilities extraCapabilities) { super.merge(extraCapabilities); if (extraCapabilities instanceof ChromeOptions) { Map options = (Map) extraCapabilities.asMap().get("goog:chromeOptions"); mergeArguments(options); mergeExtensions(options); mergeExtensionFiles(extraCapabilities); mergeBinary(options); mergeExperimentalOptions(extraCapabilities); } return this; }

Target:
public ChromeOptions merge(Capabilities extraCapabilities) { super.merge(extraCapabilities); return this; }
Source:
public int hashCode() { return messageId() != null ? messageId().hashCode() : 0; }

Target:
public int hashCode() { return messageId().hashCode(); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GenericArrayData that = (GenericArrayData) o; return size == that.size && isPrimitiveArray == that.isPrimitiveArray && Arrays.deepEquals(new Object[] {array}, new Object[]{that.array}); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } GenericArrayData that = (GenericArrayData) o; return size == that.size && isPrimitiveArray == that.isPrimitiveArray && Objects.deepEquals(array, that.array); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { AdapterFactory adapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); final ISelection currentSelection = HandlerUtil.getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { Iterator<?> iterator = ((IStructuredSelection)currentSelection).iterator(); Notifier left = null; Notifier right = null; Notifier origin = null; left = (Notifier)iterator.next(); if (iterator.hasNext()) { right = (Notifier)iterator.next(); } if (iterator.hasNext()) { origin = (Notifier)iterator.next(); } if (origin != null) { Shell shell = HandlerUtil.getActiveShell(event); SelectAncestorDialog dialog = new SelectAncestorDialog(shell, adapterFactory, new Notifier[] { left, right, origin }); if (dialog.open() == Window.CANCEL) { return null; } else { left = dialog.leftNotifier; right = dialog.rightNotifier; origin = dialog.originNotifier; } } if (isContained(left, right) || isContained(right, left)) { MessageDialog .openInformation(activePart.getSite().getShell(), "EMF Compare", "Can't run a comparison between an object and one of its direct or indirect container."); } else { final CompareEditorInput input = createCompareEditorInput(activePart, adapterFactory, left, right, origin); CompareUI.openCompareDialog(input); } } return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { AdapterFactory adapterFactory = new ComposedAdapterFactory( ComposedAdapterFactory.Descriptor.Registry.INSTANCE); final IWorkbenchPart activePart = HandlerUtil.getActivePart(event); final ISelection currentSelection = HandlerUtil.getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { Iterator<?> iterator = ((IStructuredSelection)currentSelection).iterator(); Notifier left = null; Notifier right = null; Notifier origin = null; left = (Notifier)iterator.next(); if (iterator.hasNext()) { right = (Notifier)iterator.next(); } if (iterator.hasNext()) { origin = (Notifier)iterator.next(); } if (origin != null) { Shell shell = HandlerUtil.getActiveShell(event); SelectAncestorDialog dialog = new SelectAncestorDialog(shell, adapterFactory, new Notifier[] { left, right, origin }); if (dialog.open() == Window.CANCEL) { return null; } else { left = dialog.leftNotifier; right = dialog.rightNotifier; origin = dialog.originNotifier; } } if (left instanceof EObject && right instanceof EObject && (EcoreUtil.isAncestor((EObject)left, (EObject)right) || EcoreUtil.isAncestor( (EObject)right, (EObject)left))) { MessageDialog.openInformation(activePart.getSite().getShell(), "EMF Compare", "Can't run a comparison between an object and one of its ancestor."); } else { final CompareEditorInput input = createCompareEditorInput(activePart, adapterFactory, left, right, origin); CompareUI.openCompareDialog(input); } } return null; }
Source:
public static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord) { StreamRecord.Builder streamRecordBuilder = StreamRecord.builder() .approximateCreationDateTime( streamRecord.getApproximateCreationDateTime().toInstant() ) .keys( DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getKeys()) ) .sequenceNumber(streamRecord.getSequenceNumber()) .sizeBytes(streamRecord.getSizeBytes()) .streamViewType(streamRecord.getStreamViewType()); Map<String, com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue> newImage = streamRecord.getNewImage(); if (newImage != null) { streamRecordBuilder.newImage( DynamodbAttributeValueTransformer.toAttributeValueMapV2(newImage) ); } Map<String, com.amazonaws.services.lambda.runtime.events.models.dynamodb.AttributeValue> oldImage = streamRecord.getOldImage(); if (oldImage != null) { streamRecordBuilder.oldImage( DynamodbAttributeValueTransformer.toAttributeValueMapV2(oldImage) ); } return streamRecordBuilder.build(); }

Target:
public static StreamRecord toStreamRecordV2(final com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord) { return StreamRecord.builder() .approximateCreationDateTime( streamRecord.getApproximateCreationDateTime().toInstant() ) .keys( DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getKeys()) ) .newImage( streamRecord.getNewImage() != null ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getNewImage()) : null ) .oldImage( streamRecord.getOldImage() != null ? DynamodbAttributeValueTransformer.toAttributeValueMapV2(streamRecord.getOldImage()) : null ) .sequenceNumber(streamRecord.getSequenceNumber()) .sizeBytes(streamRecord.getSizeBytes()) .streamViewType(streamRecord.getStreamViewType()) .build(); }