auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static Tuple testTuple(List<Object> values, MkTupleParam param) { String stream = param.getStream(); if (stream == null) { stream = Utils.DEFAULT_STREAM_ID; } String component = param.getComponent(); if (component == null) { component = "component"; } int task = 1; List<String> fields = param.getFields(); if (fields == null) { fields = new ArrayList<>(values.size()); for (int i = 1; i <= values.size(); i++) { fields.add("field"+i); } } Map<Integer, String> taskToComp = new HashMap<>(); taskToComp.put(task, component); Map<String, Map<String, Fields>> compToStreamToFields = new HashMap<>(); Map<String, Fields> streamToFields = new HashMap<>(); streamToFields.put(stream, new Fields(fields)); compToStreamToFields.put(component, streamToFields); TopologyContext context= new TopologyContext(null, ConfigUtils.readStormConfig(), taskToComp, null, compToStreamToFields, null, "test-storm-id", null, null, 1, null, null, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(), new AtomicBoolean(false)); <START> return new TupleImpl(context, values, "component", 1, stream); <END> }</code><technical_language>This I is of some of test failures...</technical_language>

Target:
public static Tuple testTuple(List<Object> values, MkTupleParam param) { String stream = param.getStream(); if (stream == null) { stream = Utils.DEFAULT_STREAM_ID; } String component = param.getComponent(); if (component == null) { component = "component"; } int task = 1; List<String> fields = param.getFields(); if (fields == null) { fields = new ArrayList<>(values.size()); for (int i = 1; i <= values.size(); i++) { fields.add("field"+i); } } Map<Integer, String> taskToComp = new HashMap<>(); taskToComp.put(task, component); Map<String, Map<String, Fields>> compToStreamToFields = new HashMap<>(); Map<String, Fields> streamToFields = new HashMap<>(); streamToFields.put(stream, new Fields(fields)); compToStreamToFields.put(component, streamToFields); TopologyContext context= new TopologyContext(null, ConfigUtils.readStormConfig(), taskToComp, null, compToStreamToFields, null, "test-storm-id", null, null, 1, null, null, new HashMap<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(), new AtomicBoolean(false)); return new TupleImpl(context, values, component, 1, stream); }
Source:
<code>public String getServerAddressByPort(String workspaceId, int port) throws Exception { Workspace workspace = getById(workspaceId); ensureRunningStatus(workspace); return getById(workspaceId) .getRuntime() .getMachines() .get(0) .getServers() .get(valueOf(port) + "/tcp") .getUrl(); <START> .getRuntime() <END> .getServers() .get(valueOf(port) + "/tcp") .getAddress(); }</code><technical_language>a syntax error. check it</technical_language>

Target:
public String getServerAddressByPort(String workspaceId, int port) throws Exception { Workspace workspace = getById(workspaceId); ensureRunningStatus(workspace); Map<String, ? extends Machine> machines = workspace.getRuntime().getMachines(); for (Machine machine : machines.values()) { if (containsWsAgentServer(machine)) { return machine.getServers().get(valueOf(port) + "/tcp").getUrl(); } } return null; }
Source:
<code>private static void setDosingType(DrugOrder drugOrder, MedicationRequest fhirMedicationRequest) { List<Extension> extensions = fhirMedicationRequest.getExtensionsByUrl(ExtensionURL.DOSING_TYPE); <START> if (extensions.size() > 0) { <END> ContextUtil.getDrugOrderHelper().setDosingType(drugOrder, ExtensionsUtil.getStringFromExtension(extensions.get(FIRST))); } }</code><technical_language>CollectionUtils isEmpty</technical_language>

Target:
private static void setDosingType(DrugOrder drugOrder, MedicationRequest fhirMedicationRequest) { List<Extension> extensions = fhirMedicationRequest.getExtensionsByUrl(ExtensionURL.DOSING_TYPE); if (!CollectionUtils.isEmpty(extensions)) { ContextUtil.getDrugOrderHelper().setDosingType(drugOrder, ExtensionsUtil.getStringFromExtension(extensions.get(FIRST))); } }
Source:
<code>Map getNetworkStatsMap(VM vm) { List<Device> nicDevices = vm.getDevicesByType(Device.DeviceType.NIC); String macAddress = vm.getMacAddress(); if( macAddress.equals(VM.NONE_STRING) ) { log.debug("no mac address for vm {}", vm.getId()); return map(); } Map resultMap = map(); int count = 0; for(Device device : nicDevices) { Map netStats = map(); String dName = "vnet" + count; netStats.put("txErrors", "0"); netStats.put("state", "unknown"); netStats.put("macAddr", device.getMacAddr()); netStats.put("name", dName); netStats.put("txDropped", "0"); netStats.put("txRate", <START> Utils.rangeParser(AppConfig.getInstance().getNetworkLoad())); <END> netStats.put("rxErrors", "0"); netStats.put("rxRate", Utils.rangeParser(AppConfig.getInstance().getNetworkLoad())); netStats.put("tx", Utils.rangeParser(AppConfig.getInstance().getNetworkLoad())); netStats.put("rx", Utils.rangeParser(AppConfig.getInstance().getNetworkLoad())); netStats.put("rxDropped", "0"); netStats.put("speed", "1000"); netStats.put("sampleTime", "4318787.08"); resultMap.put(dName, netStats); ++count; } return resultMap; }</code><technical_language>get once</technical_language>

Target:
Map getNetworkStatsMap(VM vm) { List<Device> nicDevices = vm.getDevicesByType(Device.DeviceType.NIC); String macAddress = vm.getMacAddress(); if( macAddress.equals(VM.NONE_STRING) ) { log.debug("no mac address for vm {}", vm.getId()); return map(); } List<String> networkLoad = AppConfig.getInstance().getNetworkLoad(); Map resultMap = map(); int count = 0; for(Device device : nicDevices) { Map netStats = map(); String dName = "vnet" + count; netStats.put("txErrors", "0"); netStats.put("state", "unknown"); netStats.put("macAddr", device.getMacAddr()); netStats.put("name", dName); netStats.put("txDropped", "0"); netStats.put("txRate", Utils.rangeParser(networkLoad)); netStats.put("rxErrors", "0"); netStats.put("rxRate", Utils.rangeParser(networkLoad)); netStats.put("tx", Utils.rangeParser(networkLoad)); netStats.put("rx", Utils.rangeParser(networkLoad)); netStats.put("rxDropped", "0"); netStats.put("speed", "1000"); netStats.put("sampleTime", "4318787.08"); resultMap.put(dName, netStats); ++count; } return resultMap; }
Source:
<code>public static CourseUnitAndroidVideoPlayerFragment newInstance(VideoBlockModel unit, boolean hasNextUnit, boolean hasPreviousUnit) { <START> CourseUnitAndroidVideoPlayerFragment f = new CourseUnitAndroidVideoPlayerFragment(); <END> Bundle args = new Bundle(); args.putSerializable(Router.EXTRA_COURSE_UNIT, unit); args.putBoolean(HAS_NEXT_UNIT_ID, hasNextUnit); args.putBoolean(HAS_PREV_UNIT_ID, hasPreviousUnit); f.setArguments(args); return f; }</code><technical_language>CourseUnitAndroidVideoPlayerFragment f = new CourseUnitAndroidVideoPlayerFragment(); // Supply num input argument. Bundle args = new Bundle(); args.putSerializable(Router.EXTRA_COURSE_UNIT, unit); args.putBoolean(HAS_NEXT_UNIT_ID, hasNextUnit); args.putBoolean(HAS_PREV_UNIT_ID, hasPreviousUnit); f.setArguments(args); return f; replaced CourseUnitAndroidVideoPlayerFragment fragment = new CourseUnitAndroidVideoPlayerFragment(); fragment.setArguments(getCourseUnitBundle(unit, hasNextUnit, hasPreviousUnit)); return fragment; getCourseUnitBundle is in CourseUnitVideoFragment.java return arguments</technical_language>

Target:
public static CourseUnitAndroidVideoPlayerFragment newInstance(VideoBlockModel unit, boolean hasNextUnit, boolean hasPreviousUnit) { CourseUnitAndroidVideoPlayerFragment fragment = new CourseUnitAndroidVideoPlayerFragment(); fragment.setArguments(getCourseUnitBundle(unit, hasNextUnit, hasPreviousUnit)); return fragment; }
Source:
<code>public OAuth2ServiceProvider updateProvider(String serviceName, OAuth2ServiceProvider provider) { DirectoryService ds = Framework.getService(DirectoryService.class); try (Session session = ds.open(DIRECTORY_NAME)) { DocumentModel entry = getProviderDocModel(serviceName); entry.setProperty(SCHEMA, "serviceName", provider.getServiceName()); entry.setProperty(SCHEMA, "description", provider.getDescription()); entry.setProperty(SCHEMA, "authorizationServerURL", provider.getAuthorizationServerURL()); entry.setProperty(SCHEMA, "tokenServerURL", provider.getTokenServerURL()); entry.setProperty(SCHEMA, "userAuthorizationURL", provider.getUserAuthorizationURL()); entry.setProperty(SCHEMA, "clientId", provider.getClientId()); entry.setProperty(SCHEMA, "clientSecret", provider.getClientSecret()); entry.setProperty(SCHEMA, "scopes", StringUtils.join(provider.getScopes(), ",")); <START> boolean enabled = (provider.getClientId() != null && provider.getClientSecret() != null); <END> entry.setProperty(SCHEMA, "enabled", enabled && provider.isEnabled()); if (!enabled) { log.info("OAuth2 provider for " + serviceName + " is disabled because clientId and/or clientSecret are empty"); } session.updateEntry(entry); return getProvider(serviceName); } }</code><technical_language>Remove unneeded parentheses</technical_language>

Target:
public OAuth2ServiceProvider updateProvider(String serviceName, OAuth2ServiceProvider provider) { DirectoryService ds = Framework.getService(DirectoryService.class); try (Session session = ds.open(DIRECTORY_NAME)) { DocumentModel entry = getProviderDocModel(serviceName); entry.setProperty(SCHEMA, "serviceName", provider.getServiceName()); entry.setProperty(SCHEMA, "description", provider.getDescription()); entry.setProperty(SCHEMA, "authorizationServerURL", provider.getAuthorizationServerURL()); entry.setProperty(SCHEMA, "tokenServerURL", provider.getTokenServerURL()); entry.setProperty(SCHEMA, "userAuthorizationURL", provider.getUserAuthorizationURL()); entry.setProperty(SCHEMA, "clientId", provider.getClientId()); entry.setProperty(SCHEMA, "clientSecret", provider.getClientSecret()); entry.setProperty(SCHEMA, "scopes", String.join(",", provider.getScopes())); boolean enabled = provider.getClientId() != null && provider.getClientSecret() != null; entry.setProperty(SCHEMA, "enabled", enabled && provider.isEnabled()); if (!enabled) { log.info("OAuth2 provider for " + serviceName + " is disabled because clientId and/or clientSecret are empty"); } session.updateEntry(entry); return getProvider(serviceName); } }
Source:
<code>private void scheduleWriteLastModified(String daoTypeName) { long modifiedTime = getLastModifiedOfTypeName(daoTypeName); Date when = new Date(); synchronized (daoTypeNameReferenceTime) { boolean schedule = daoTypeNameReferenceTime.get(daoTypeName) == null; daoTypeNameReferenceTime.put(daoTypeName, modifiedTime); GcsStorageService service = this; if (schedule) { <START> Runnable task = new Runnable() { <END> public void run() { log.info("RUNNING {}", daoTypeName); Long storedTime; synchronized (service.daoTypeNameReferenceTime) { storedTime = service.daoTypeNameReferenceTime.remove(daoTypeName); if (storedTime == null) { log.info("Defered writeLastModified was canceled."); return; } } long modifiedTime = service.getLastModifiedOfTypeName(daoTypeName); if (modifiedTime <= storedTime) { log.info("Retrying defered writeLastModified for {}", daoTypeName); service.writeLastModified(daoTypeName); } else { log.info("Canceling defered writeLastModified because timestamp already updated."); } } }; when.setSeconds(when.getSeconds() + 1); log.info("Scheduling defered update timestamp.", daoTypeName); taskScheduler.schedule(task, when); } else { log.info("Already scheduled update timestamp.", daoTypeName); } } }</code><technical_language>indent 2 spaces</technical_language>

Target:
public void scheduleWriteLastModified(String daoTypeName) { long modifiedTime = getLastModifiedOfTypeName(daoTypeName); Date when = new Date(); synchronized (daoTypeNameReferenceTime) { boolean schedule = daoTypeNameReferenceTime.get(daoTypeName) == null; daoTypeNameReferenceTime.put(daoTypeName, modifiedTime); GcsStorageService service = this; if (schedule) { Runnable task = new Runnable() { public void run() { log.info("RUNNING {}", daoTypeName); Long storedTime; synchronized (service.daoTypeNameReferenceTime) { storedTime = service.daoTypeNameReferenceTime.remove(daoTypeName); } long modifiedTime = service.getLastModifiedOfTypeName(daoTypeName); if (modifiedTime <= storedTime) { log.info("Retrying defered writeLastModified for {}", daoTypeName); service.writeLastModified(daoTypeName); } else { log.info("Canceling defered writeLastModified because timestamp already updated."); } } }; when.setSeconds(when.getSeconds() + 1); log.info("Scheduling defered update timestamp.", daoTypeName); taskScheduler.schedule(task, when); } else { log.info("Already scheduled update timestamp.", daoTypeName); } } }
Source:
<code>public void testDynamicAddressReinitializedCorrectly() { ClientConfiguration ccfg = new ClientConfiguration() .setAddressesFinder(new TestAddressFinder("127.0.0.1:8000", "127.0.0.1:8003")); ReliableChannel rc = new ReliableChannel(chFactory, ccfg, null); rc.initConnection(); List<ReliableChannel.ClientChannelHolder> originChannels = Collections.unmodifiableList(rc.getChannelHolders()); rc.initChannelHolders(true); <START> List<ReliableChannel.ClientChannelHolder> closedChannels = originChannels.stream() .filter(r -> r.isClosed()) .collect(Collectors.toList()); assertEquals(2, closedChannels.size()); <END> List<ReliableChannel.ClientChannelHolder> reuseChannel = originChannels.stream() .filter(c -> !c.isClosed()) .collect(Collectors.toList()); assertEquals(1, reuseChannel.size()); List<ReliableChannel.ClientChannelHolder> newChannels = rc.getChannelHolders(); assertEquals(2, newChannels.size()); assertTrue(newChannels.get(0) == reuseChannel.get(0) || newChannels.get(1) == reuseChannel.get(0)); newChannels.forEach(c -> assertFalse(c.isClosed())); }</code><technical_language>assertEquals(2, F.size(originChannels, r -> r.isClosed()));</technical_language>

Target:
public void testDynamicAddressReinitializedCorrectly() { TestAddressFinder finder = new TestAddressFinder() .nextAddresesResponse(dfltAddrs) .nextAddresesResponse("127.0.0.1:10800", "127.0.0.1:10803"); ClientConfiguration ccfg = new ClientConfiguration().setAddressesFinder(finder); ReliableChannel rc = new ReliableChannel(chFactory, ccfg, null); rc.channelsInit(); List<ReliableChannel.ClientChannelHolder> originChannels = Collections.unmodifiableList(rc.getChannelHolders()); rc.initChannelHolders(); assertEquals(2, F.size(originChannels, ReliableChannel.ClientChannelHolder::isClosed)); List<ReliableChannel.ClientChannelHolder> reuseChannel = originChannels.stream() .filter(c -> !c.isClosed()) .collect(Collectors.toList()); assertEquals(1, reuseChannel.size()); List<ReliableChannel.ClientChannelHolder> newChannels = rc.getChannelHolders(); assertEquals(2, newChannels.size()); assertTrue(newChannels.get(0) == reuseChannel.get(0) || newChannels.get(1) == reuseChannel.get(0)); newChannels.forEach(c -> assertFalse(c.isClosed())); }
Source:
<code>private OutputContext outputContext(QueryContext queryContext) { String channelGroupParam = queryContext.getRequest() .getParameter(SherlockAttributes.SCHEDULE_CHANNEL_GROUP_PARAM); OutputContext.Builder builder = OutputContext.builder(queryContext); List<String> channelGroups; if (!Strings.isNullOrEmpty(channelGroupParam)) { <START> channelGroups = Arrays.asList(channelGroupParam.split("\\s*,\\s*")); <END> } else { channelGroups = new ArrayList<>(); } List<Region> regions = new ArrayList<>(); List<Platform> platforms = new ArrayList<>(); for (ChannelGroup<?> channelGroup : resolveChannelGroups(channelGroups)) { if (channelGroup instanceof Region) { regions.add((Region) channelGroup); } else if (channelGroup instanceof Platform) { platforms.add((Platform) channelGroup); } else { throw new RuntimeException(new NotAcceptableException( String.format( "%s is not a region or platform.", channelGroup.getId() ) )); } } if (!regions.isEmpty()) { builder.withRegions(regions); } if (!platforms.isEmpty()) { builder.withPlatforms(platforms); } return builder.build(); }</code><technical_language>Is this kind of done elsewhere? a bit unusual debate if treat other list parameters</technical_language>

Target:
private OutputContext outputContext(QueryContext queryContext) { String channelGroupParam = queryContext.getRequest() .getParameter(SherlockParameter.SCHEDULE_CHANNEL_GROUP.getName()); OutputContext.Builder builder = OutputContext.builder(queryContext); if (channelGroupParam != null) { List<String> channelGroupsParams = SPLITTER.splitToList(channelGroupParam); List<ChannelGroup<?>> channelGroups = resolveChannelGroups(channelGroupsParams); List<Region> regions = channelGroups.stream() .filter(cg -> cg instanceof Region) .map(cg -> (Region) cg) .collect(Collectors.toList()); if (!regions.isEmpty()) { builder.withRegions(regions); } List<Platform> platforms = channelGroups.stream() .filter(cg -> cg instanceof Platform) .map(cg -> (Platform) cg) .collect(Collectors.toList()); if (!platforms.isEmpty()) { builder.withPlatforms(platforms); } } return builder.build(); }
Source:
<code>public void testResponseFilters() throws Exception { TestReplicationListener listener = new TestReplicationListener(); PullReplication pullReplication = createPullReplication(); pullReplication.responseFilters.add(new ResponseStreamReaderFilter()); Replicator replicator = ReplicatorFactory.oneway(pullReplication); replicator.getEventBus().register(listener); replicator.start(); while(replicator.getState() != Replicator.State.COMPLETE && replicator.getState() != Replicator.State.ERROR) { <START> Thread.sleep(1000); <END> } Assert.assertEquals(Replicator.State.ERROR, replicator.getState()); Assert.assertFalse(listener.finishCalled); Assert.assertTrue(listener.errorCalled); Assert.assertTrue(listener.exception instanceof RuntimeException); RuntimeException exception = (RuntimeException)listener.exception; Assert.assertTrue(exception.getCause() instanceof IOException); }</code><technical_language>Again, a long pause shorter</technical_language>

Target:
public void testResponseFilters() throws Exception { FilterCallCounter filterCallCounter = new FilterCallCounter(); PullReplication pullReplication = createPullReplication(); pullReplication.responseFilters.add(filterCallCounter); runReplicationUntilComplete(pullReplication); Assert.assertTrue(filterCallCounter.filterResponseTimesCalled >= 1); }
Source:
<code><START> Map<String, Object> getExtraInformation() { <END> return extraInformation; }</code><technical_language>this is public API, visibility deprecating</technical_language>

Target:
public Map<String, Object> getExtraInformation() { return extraInformation; }
Source:
<code>private static String computeDefaultResolution(Context context, int key, int value) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); String resolution = preferences != null ? preferences.getString(context.getString(key), context.getString(value)) : context.getString(R.string.best_resolution_key); String maxResolution = getResolutionLimit(context); <START> if (maxResolution != null && (resolution.equals("best_resolution") <END> || compareVideoStreamResolution(maxResolution, resolution) < 1)) { resolution = maxResolution; } return resolution; }</code><technical_language>please show me, "best_resolution" from? I do time managed find :)</technical_language>

Target:
private static String computeDefaultResolution(Context context, int key, int value) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); String resolution = preferences != null ? preferences.getString(context.getString(key), context.getString(value)) : context.getString(R.string.best_resolution_key); String maxResolution = getResolutionLimit(context); if (maxResolution != null && (resolution.equals(context.getString(R.string.best_resolution_key)) || compareVideoStreamResolution(maxResolution, resolution) < 1)) { resolution = maxResolution; } return resolution; }
Source:
<code>private void addCertificate() { fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(certFilter); fileChooser.setFileFilter(certFilter); int retVal = fileChooser.showOpenDialog(this); if (retVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { idControll.addEntryToKeyStore(file); <START> } catch (IOException e) { <END> Log.error("Cannot upload certificate file", e); } catch (IllegalArgumentException e) { Log.warning("Certificate or it's alias cannot be null", e); } catch (HeadlessException e) { Log.error("Error at setting certificate alias", e); } } }</code><technical_language>Instead of writing this a log file (or perhaps, in addition writing a log file), good error message pop up. users log file, wrong</technical_language>

Target:
private void addCertificate() { fileChooser.setAcceptAllFileFilterUsed(false); fileChooser.addChoosableFileFilter(certFilter); fileChooser.setFileFilter(certFilter); int retVal = fileChooser.showOpenDialog(this); if (retVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { idControll.addEntryToKeyStore(file); } catch (CertificateException e) { JOptionPane.showMessageDialog(null, Res.getString("dialog.cannot.upload.certificate.might.be.ill.formated")); Log.error("Cannot upload certificate file", e); } catch (InvalidKeySpecException | NoSuchAlgorithmException | KeyStoreException | InvalidNameException | IOException e) { JOptionPane.showMessageDialog(null, "dialog.cannot.upload.certificate"); Log.error("Cannot upload certificate file", e); } } }
Source:
<code>public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { IRepositoryElement reviewRepoElement = delta.getElement(); if (!(reviewRepoElement instanceof ITask)) { return; } ITask review = (ITask) reviewRepoElement; AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { switch (delta.getKind()) { case REMOVED: break; case DELETED: deleteMappingsTo(review); break; <START> case CONTENT: <END> String taskUrl = getTaskUrl(review); updateMapping(review, taskUrl); } } } }</code><technical_language>a bit skewed logic is spread around. plan is listen for deletions. If suggestions handle great</technical_language>

Target:
public void containersChanged(Set<TaskContainerDelta> containers) { for (TaskContainerDelta delta : containers) { IRepositoryElement reviewRepoElement = delta.getElement(); if (!(reviewRepoElement instanceof ITask)) { return; } ITask review = (ITask) reviewRepoElement; AbstractRepositoryConnector connector = repositoryManager.getRepositoryConnector(review.getConnectorKind()); if (review != null && connector instanceof ReviewsConnector) { if (delta.getKind() == Kind.DELETED) { deleteMappingsTo(review); } } } }
Source:
<code>public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = mInflater.inflate(R.layout.theme_grid_item, parent, false); ThemeViewHolder themeViewHolder = new ThemeViewHolder(view); view.setTag(themeViewHolder); <START> mViewWidth = parent.getWidth(); <END> return view; }</code><technical_language>Nice, I method returned pixels, does</technical_language>

Target:
public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = mInflater.inflate(R.layout.theme_grid_item, parent, false); configureThemeImageSize(parent); ThemeViewHolder themeViewHolder = new ThemeViewHolder(view); view.setTag(themeViewHolder); return view; }
Source:
<code>private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { List<DiskImage> imagesByGuid = new ArrayList<>(); <START> if (getParameters().getDisks() != null) { for (Guid guid : getParameters().getDisks()) { DiskImage image = diskImageDao.getSnapshotById(guid); imagesByGuid.add(image); } imagesToPreview = imagesByGuid; } <END> else { imagesToPreview = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); } List<CinderDisk> CinderImagesToPreview = DisksFilter.filterCinderDisks(imagesToPreview); imagesToPreview = DisksFilter.filterImageDisks(imagesToPreview, ONLY_NOT_SHAREABLE, ONLY_SNAPABLE); imagesToPreview.addAll(CinderImagesToPreview); } return imagesToPreview; }</code><technical_language>Java 8's steams this a lot more elegant: imagesByGuid = getParameters() .getDisks() .map(diskImageDao::getSnapshotById) .collect(Collectors.toList());</technical_language>

Target:
private List<DiskImage> getImagesToPreview() { if (imagesToPreview == null) { if (getParameters().getDisks() != null) { imagesToPreview = getParameters().getDisks().stream() .map(diskImageDao::getSnapshotById) .collect(Collectors.toList()); } else { imagesToPreview = diskImageDao.getAllSnapshotsForVmSnapshot(getDstSnapshot().getId()); } List<CinderDisk> CinderImagesToPreview = DisksFilter.filterCinderDisks(imagesToPreview); imagesToPreview = DisksFilter.filterImageDisks(imagesToPreview, ONLY_NOT_SHAREABLE, ONLY_SNAPABLE); imagesToPreview.addAll(CinderImagesToPreview); } return imagesToPreview; }
Source:
<code>private static HttpURLConnection createConnection(Connection.Request req) throws IOException { HttpURLConnection conn = (HttpURLConnection) req.url().openConnection(); conn.setRequestMethod(req.method().name()); conn.setInstanceFollowRedirects(false); conn.setConnectTimeout(req.timeout()); conn.setReadTimeout(req.timeout()); if (!req.isSecure()) { <START> initUnSecureSSL(); <END> if (conn instanceof HttpsURLConnection) { ((HttpsURLConnection)conn).setSSLSocketFactory(sslSocketFactory); } } if (req.method() == Method.POST) conn.setDoOutput(true); if (req.cookies().size() > 0) conn.addRequestProperty("Cookie", getRequestCookieString(req)); for (Map.Entry<String, String> header : req.headers().entrySet()) { conn.addRequestProperty(header.getKey(), header.getValue()); } return conn; }</code><technical_language>Move init if (is SSL request), I think. need initialize otherwise</technical_language>

Target:
private static HttpURLConnection createConnection(Connection.Request req) throws IOException { HttpURLConnection conn = (HttpURLConnection) req.url().openConnection(); conn.setRequestMethod(req.method().name()); conn.setInstanceFollowRedirects(false); conn.setConnectTimeout(req.timeout()); conn.setReadTimeout(req.timeout()); if (conn instanceof HttpsURLConnection) { if (!req.isValidateSSLCertificates()) { initUnSecureSSL(); ((HttpsURLConnection)conn).setSSLSocketFactory(sslSocketFactory); ((HttpsURLConnection)conn).setHostnameVerifier(getInsecureVerifier()); } } if (req.method().hasBody()) conn.setDoOutput(true); if (req.cookies().size() > 0) conn.addRequestProperty("Cookie", getRequestCookieString(req)); for (Map.Entry<String, String> header : req.headers().entrySet()) { conn.addRequestProperty(header.getKey(), header.getValue()); } return conn; }
Source:
<code>public void attempToRestoreVmConfigurationFromSnapshot(VM vm, Snapshot snapshot, Guid activeSnapshotId, CompensationContext compensationContext) { <START> boolean vmUpdatedFromConfiguration = updateVmFromConfiguration(vm, snapshot.getVmConfiguration()); <END> if (snapshot.getVmConfiguration() == null || !vmUpdatedFromConfiguration) { vm.setImages(new ArrayList<DiskImage>(getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshot.getId()))); } vm.setapp_list(snapshot.getAppList()); getVmDynamicDao().update(vm.getDynamicData()); synchronizeDisksFromSnapshot(vm.getId(), snapshot.getId(), activeSnapshotId, vm.getImages()); if (vmUpdatedFromConfiguration) { getVmStaticDao().update(vm.getStaticData()); synchronizeNics(vm.getId(), vm.getInterfaces(), compensationContext); } }</code><technical_language>pleas if snapshot.getVmConfiguration() is null updateVmFromConfiguration throw exception</technical_language>

Target:
public void attempToRestoreVmConfigurationFromSnapshot(VM vm, Snapshot snapshot, Guid activeSnapshotId, CompensationContext compensationContext) { boolean vmUpdatedFromConfiguration = false; if (snapshot.getVmConfiguration() != null) { vmUpdatedFromConfiguration = updateVmFromConfiguration(vm, snapshot.getVmConfiguration()); } if (!vmUpdatedFromConfiguration) { vm.setImages(new ArrayList<DiskImage>(getDiskImageDao().getAllSnapshotsForVmSnapshot(snapshot.getId()))); } vm.setapp_list(snapshot.getAppList()); getVmDynamicDao().update(vm.getDynamicData()); synchronizeDisksFromSnapshot(vm.getId(), snapshot.getId(), activeSnapshotId, vm.getImages(), vm.getvm_name()); if (vmUpdatedFromConfiguration) { getVmStaticDao().update(vm.getStaticData()); synchronizeNics(vm.getId(), vm.getInterfaces(), compensationContext); } }
Source:
<code>public static List<Sample> convert(final List<Sample> samples) { if (samples.size() <= Math.max(DEFAULT_NOISE_LENGTH_TOLERANCE, DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_HIGH_RESOLUTION)) { return samples; } final double[] values = getSampleValuesArray(samples); final double mean = new Mean().evaluate(values); final double stdDev = new StandardDeviation().evaluate(values, mean); <START> final int movingAvgWindowSize = samples.get(1).dateTime - samples.get(0).dateTime > 60000 ? <END> DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_LOW_RESOLUTION : DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_HIGH_RESOLUTION; final double[] noiseFreeValues = smudgeNoise(values, mean, stdDev, DEFAULT_NOISE_LENGTH_TOLERANCE); final double[] smoothedValues = smooth(noiseFreeValues, movingAvgWindowSize); final List<Sample> convertedSamples = Lists.newArrayList(); for (int i=0; i < samples.size(); i++) { convertedSamples.add(new Sample(samples.get(i).dateTime, (float) smoothedValues[i], samples.get(i).offsetMillis)); } return convertedSamples; }</code><technical_language>Joda compute interval</technical_language>

Target:
public static List<Sample> convert(final List<Sample> samples) { if (samples.size() <= Math.max(DEFAULT_NOISE_LENGTH_TOLERANCE, DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_HIGH_RESOLUTION)) { return samples; } final double[] values = getSampleValuesArray(samples); final double mean = new Mean().evaluate(values); final double stdDev = new StandardDeviation().evaluate(values, mean); final int movingAvgWindowSize = new Interval(samples.get(0).dateTime, samples.get(1).dateTime).toDuration().getStandardMinutes() > 5 ? DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_LOW_RESOLUTION : DEFAULT_MOVING_AVERAGE_WINDOW_SIZE_FOR_HIGH_RESOLUTION; final double[] noiseFreeValues = smudgeNoise(values, mean, stdDev, DEFAULT_NOISE_LENGTH_TOLERANCE); final double[] smoothedValues = smooth(noiseFreeValues, movingAvgWindowSize); final List<Sample> convertedSamples = Lists.newArrayList(); for (int i=0; i < samples.size(); i++) { convertedSamples.add(new Sample(samples.get(i).dateTime, (float) smoothedValues[i], samples.get(i).offsetMillis)); } return convertedSamples; }
Source:
<code>public void shouldSetRemovalTime_HistoricProcessInstanceAuthorization() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(true); String processInstanceId = testRule.process().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .absoluteRemovalTime(REMOVAL_TIME) .byQuery(query) .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isEqualTo(REMOVAL_TIME); <START> testRule.clearAuthorization(); <END> }</code><technical_language>@After method clears authorizations if assert statement fails</technical_language>

Target:
public void shouldSetRemovalTime_HistoricProcessInstanceAuthorization() { testRule.getProcessEngineConfiguration() .setEnableHistoricInstancePermissions(true); String processInstanceId = testRule.process().userTask().deploy().start(); Authorization authorization = authorizationService.createNewAuthorization(Authorization.AUTH_TYPE_GRANT); authorization.setResource(Resources.HISTORIC_PROCESS_INSTANCE); authorization.setResourceId(processInstanceId); authorization.setUserId("foo"); authorizationService.saveAuthorization(authorization); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); testRule.syncExec( historyService.setRemovalTimeToHistoricProcessInstances() .absoluteRemovalTime(REMOVAL_TIME) .byQuery(query) .executeAsync() ); authorization = authorizationService.createAuthorizationQuery() .resourceType(Resources.HISTORIC_PROCESS_INSTANCE) .singleResult(); assertThat(authorization.getRemovalTime()).isEqualTo(REMOVAL_TIME); }
Source:
<code>public String toString() { <START> StringBuilder sb = new StringBuilder(); <END> sb.append("class Exec {\n"); sb.append(" command: ").append(toIndentedString(command)).append("\n"); sb.append("}"); return sb.toString(); }</code><technical_language>While interesting, this is a standard toString() impl in Che codebase. generally do multi-line string representation do "class" prefix. generally do enclose string fields in single quotes simple string concatenation build string. Please in sibling classes for guidance</technical_language>

Target:
public String toString() { return "Exec{" + "command=" + command + '}'; }
Source:
<code>public Path getFileName() { if (this.withoutRoot().isEmpty()) { return null; } else { <START> return this.parentFileSystem.getPath(Flux.fromArray(this.splitToElements()).last().block()); <END> } }</code><technical_language>reason a reactive stream block it? Instead a Stream used? Another option, based logic here, a local instance of String[] access return element in list</technical_language>

Target:
public Path getFileName() { if (this.withoutRoot().isEmpty()) { return null; } else { List<String> elements = Arrays.asList(this.splitToElements()); return this.parentFileSystem.getPath(elements.get(elements.size() - 1)); } }
Source:
<code>private boolean classesDeclareOverridingNativeMethod(IType[] classes) throws CoreException { for (IType <START> classe : <END> classes) { for (IMethod method : classe.getMethods()) { if ((!method.equals(getMethod())) && (JdtFlags.isNative(method)) && (null != Checks.findSimilarMethod(getMethod(), new IMethod[]{method}))) { return true; } } } return false; }</code><technical_language>rename type</technical_language>

Target:
private boolean classesDeclareOverridingNativeMethod(IType[] classes) throws CoreException { for (IType type : classes) { for (IMethod method : type.getMethods()) { if ((!method.equals(getMethod())) && (JdtFlags.isNative(method)) && (null != Checks.findSimilarMethod(getMethod(), new IMethod[]{method}))) { return true; } } } return false; }
Source:
<code>public boolean evaluate(IEvaluationContext context) { if (activeWhen == null) { active = true; } else { try { active = false; active = activeWhen.evaluate(context) != EvaluationResult.FALSE; } catch (CoreException e) { if (Policy.DEBUG_CMDS) { Activator.trace(Policy.DEBUG_CMDS_FLAG, "Failed to calculate active", e); } } } if (active) { try { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(context); } if (!handler.isEnabled()) { active = false; } } catch (RuntimeException e) { active = false; Activator.trace(Policy.DEBUG_CMDS_FLAG, <START> "Failed to calculate active", e); <END> } } return active; }</code><technical_language>message is incomplete, I miss context handler. "Failed valuate active state for handler XYZ in context ABC"</technical_language>

Target:
public boolean evaluate(IEvaluationContext context) { if (activeWhen == null) { active = true; } else { try { active = false; active = activeWhen.evaluate(context) != EvaluationResult.FALSE; } catch (CoreException e) { if (Policy.DEBUG_CMDS) { Activator.trace(Policy.DEBUG_CMDS_FLAG, "Failed to evaluate activeWhen for HandlerActivation " + this + " in context " + context, e); } } } if (active) { try { if (handler instanceof IHandler2) { ((IHandler2) handler).setEnabled(context); } if (!handler.isEnabled()) { active = false; } } catch (RuntimeException e) { active = false; Activator.trace(Policy.DEBUG_CMDS_FLAG, "Failed to evaluate handler active state for HandlerActivation " + this + " in context " + context, e); } } return active; }
Source:
<code><START> public static ContentSigner createSigner(PrivateKey privateKey) { <END> try { AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder() .find("SHA256WithRSAEncryption"); AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder() .find(sigAlgId); return new BcRSAContentSignerBuilder(sigAlgId, digAlgId) .build(PrivateKeyFactory.createKey(privateKey.getEncoded())); } catch (Exception e) { throw new RuntimeException("Could not create content signer.", e); } }</code><technical_language>above, this private</technical_language>

Target:
private static ContentSigner createSigner(PrivateKey privateKey) { try { AlgorithmIdentifier sigAlgId = new DefaultSignatureAlgorithmIdentifierFinder() .find("SHA256WithRSAEncryption"); AlgorithmIdentifier digAlgId = new DefaultDigestAlgorithmIdentifierFinder() .find(sigAlgId); return new BcRSAContentSignerBuilder(sigAlgId, digAlgId) .build(PrivateKeyFactory.createKey(privateKey.getEncoded())); } catch (Exception e) { throw new RuntimeException("Could not create content signer.", e); } }
Source:
<code>public Comparator<String> nameComparator() { final Map<String, Integer> positions = positions(); return new Comparator<String>() { @Override public int compare(String left, String right) { Integer lp = positions.get(left); Integer rp = positions.get(right); if (lp == rp) { return 0; <START> } else if (lp == null) { <END> return -1; } else if (rp == null) { return 1; } else { return lp - rp; } } }; }</code><technical_language>sort unknown names first? I thought sort unknown names last. sort name if is unknown</technical_language>

Target:
public Comparator<String> nameComparator() { final Map<String, Integer> positions = positions(); return new Comparator<String>() { @Override public int compare(String left, String right) { Integer lp = positions.get(left); Integer rp = positions.get(right); if (lp == null) { return rp != null ? 1 : left.compareTo(right); } else if (rp == null) { return lp != null ? -1 : left.compareTo(right); } else if (lp == rp) { return left.compareTo(right); } else { return lp - rp; } } }; }
Source:
<code>private static void setLightConditions(AtBDynamicScenario scenario) { int roll = Compute.randomInt(10) + 1; int light = PlanetaryConditions.L_DAY; <START> if ((6 <= roll) && (roll < 8)){ <END> light = PlanetaryConditions.L_DUSK; } else if (roll == 8){ light = PlanetaryConditions.L_FULL_MOON; } else if (roll == 9) { light = PlanetaryConditions.L_MOONLESS; } else { light = PlanetaryConditions.L_PITCH_BLACK; } scenario.setLight(light); }</code><technical_language>Inconsistent spacing open brace in this block</technical_language>

Target:
private static void setLightConditions(AtBDynamicScenario scenario) { int roll = Compute.randomInt(10) + 1; int light; if (roll < 6) { light = PlanetaryConditions.L_DAY; } else if (roll < 8) { light = PlanetaryConditions.L_DUSK; } else if (roll == 8) { light = PlanetaryConditions.L_FULL_MOON; } else if (roll == 9) { light = PlanetaryConditions.L_MOONLESS; } else { light = PlanetaryConditions.L_PITCH_BLACK; } scenario.setLight(light); }
Source:
<code>public void onNext(final TaskMessage taskMessage) { final String taskId = taskMessage.getId(); final byte[] retBytes = taskMessage.get(); <START> final String retStr = retBytes == null ? "No RetVal" : new String(retBytes, StandardCharsets.UTF_8); <END> LOG.log(Level.FINE, "Line count from {0} : {1}", new String[]{taskId, retStr}); if (retBytes == null) { return; } lineCnt.addAndGet(Integer.parseInt(retStr)); if (completedTasks.incrementAndGet() >= numEvals) { LOG.log(Level.INFO, "FilePath: {0}, Total line count: {1}", new Object[]{inputPathList.get(fileCounter.get() - 1), lineCnt.get()}); lineCnt.set(0); completedTasks.set(0); if (!loadNextFileInEvals()) { runningTaskList.forEach(RunningTask::close); } } }</code><technical_language>simplify logic follows? if (retBytes == null) { LOG.log(Level.FINE, "No line read {0}", taskId); return; } else { // Normal path }</technical_language>

Target:
public void onNext(final TaskMessage taskMessage) { final String taskId = taskMessage.getId(); final byte[] retBytes = taskMessage.get(); if (retBytes == null) { LOG.log(Level.FINE, "No line was read by {0}", taskId); return; } final String retStr = new String(retBytes, StandardCharsets.UTF_8); LOG.log(Level.FINE, "Line count from {0} : {1}", new String[]{taskId, retStr}); lineCnt.addAndGet(Integer.parseInt(retStr)); if (completedTasks.incrementAndGet() >= numEvals) { LOG.log(Level.INFO, "FilePath: {0}, Total line count: {1}", new Object[]{inputPathList.get(fileCounter.get() - 1), lineCnt.get()}); lineCnt.set(0); completedTasks.set(0); if (!loadNextFileInEvals()) { runningTaskList.forEach(RunningTask::close); } } }
Source:
<code>public void forPage_fails_with_IAE_if_page_is_less_than_0() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("page index must be >= 1"); <START> forPage(-Math.abs(new Random().nextInt() + 1)); <END> }</code><technical_language>crazy man :-)</technical_language>

Target:
public void forPage_fails_with_IAE_if_page_is_less_than_0() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("page index must be >= 1"); forPage(-Math.abs(new Random().nextInt()) - 1); }
Source:
<code>protected void parseCoreEnvironmentElement(final XMLExtendedStreamReader reader, final ModelNode operation) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NODE_IDENTIFIER: TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.parseAndSetParameter(value, operation, reader); break; case PATH: case RELATIVE_TO: <START> throw new XMLStreamException("the attribute '" + attribute.getLocalName() + "' is no longer supported", reader.getLocation()); <END> default: throw unexpectedAttribute(reader, i); } } final EnumSet<Element> required = EnumSet.of(Element.PROCESS_ID); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); required.remove(element); switch (element) { case PROCESS_ID: { if (!encountered.add(element)) { throw duplicateNamedElement(reader, reader.getLocalName()); } parseProcessIdEnvironmentElement(reader, operation); break; } default: throw unexpectedElement(reader); } } if (!required.isEmpty()) { throw missingRequiredElement(reader, required); } }</code><technical_language>This call method</technical_language>

Target:
protected void parseCoreEnvironmentElement(final XMLExtendedStreamReader reader, final ModelNode operation) throws XMLStreamException { final int count = reader.getAttributeCount(); for (int i = 0; i < count; i++) { requireNoNamespaceAttribute(reader, i); final String value = reader.getAttributeValue(i); final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i)); switch (attribute) { case NODE_IDENTIFIER: TransactionSubsystemRootResourceDefinition.NODE_IDENTIFIER.parseAndSetParameter(value, operation, reader); break; case PATH: case RELATIVE_TO: throw TransactionLogger.ROOT_LOGGER.unsupportedAttribute(attribute.getLocalName(), reader.getLocation()); default: throw unexpectedAttribute(reader, i); } } final EnumSet<Element> required = EnumSet.of(Element.PROCESS_ID); final EnumSet<Element> encountered = EnumSet.noneOf(Element.class); while (reader.hasNext() && reader.nextTag() != END_ELEMENT) { final Element element = Element.forName(reader.getLocalName()); required.remove(element); switch (element) { case PROCESS_ID: { if (!encountered.add(element)) { throw duplicateNamedElement(reader, reader.getLocalName()); } parseProcessIdEnvironmentElement(reader, operation); break; } default: throw unexpectedElement(reader); } } if (!required.isEmpty()) { throw missingRequiredElement(reader, required); } }
Source:
<code>protected boolean canDoAction() { <START> setGlusterVolumeId(getGeoRepSession().getMasterVolumeId()); <END> return super.canDoAction(); }</code><technical_language>volumeId set in constructor only</technical_language>

Target:
protected boolean canDoAction() { return super.canDoAction(); }
Source:
<code><START> public void onProviderDisabled(String provider) { <END> Timber.d("Provider %s disabled", provider); if (provider.equals("gps")) { NearbyParentFragment nearbyParentFragment = new NearbyParentFragment(); nearbyParentFragment.enableLocationOffDialog(); } }</code><technical_language>@Glitch101, instead of making a new instance of NearbyParentFragment, NearbyParentFragmentPresenter is implementing LocationUpdateListener, adding a new method in LocationUpdateListener, enableLocationOffDialog(boolean shouldEnable) presenter implementing it, routed fragment</technical_language>

Target:
public void onProviderDisabled(String provider) { Timber.d("Provider %s disabled", provider); }
Source:
<code>public Map<String, Integer> getRowCounts() throws Exception { Map<String, Integer> ret = new HashMap<String, Integer>(); Connection con = this.getConnection(); DatabaseMetaData metaData = con.getMetaData(); <START> ResultSet rs = metaData.getTables(null, "PUBLIC", "%", null); <END> while (rs.next()) { String tableName = rs.getString(3); Statement stmt = con.createStatement(); ResultSet resultSet = stmt.executeQuery("SELECT count(*) AS rowcount FROM " + tableName); resultSet.next(); ret.put(tableName, resultSet.getInt("rowcount")); resultSet.close(); } return ret; }</code><technical_language>end results arguments null</technical_language>

Target:
public Map<String, Integer> getRowCounts() throws Exception { Map<String, Integer> ret = new HashMap<String, Integer>(); Connection con = this.getConnection(); DatabaseMetaData metaData = con.getMetaData(); DatabaseConnection dbcon = new DatabaseConnection(con); ResultSet rs = metaData.getTables(null, "PUBLIC", "%", null); while (rs.next()) { String tableName = rs.getString(3); ret.put(tableName, dbcon.getRowCount(tableName)); } return ret; }
Source:
<code>protected void innerMap( InputRow inputRow, Object value, Context context ) throws IOException, InterruptedException { final Optional<Bucket> bucket = getConfig().getBucket(inputRow); if (!bucket.isPresent()) { throw new ISE("WTF?! No bucket found for row: %s", inputRow); } final long truncatedTimestamp = granularitySpec.getQueryGranularity().truncate(inputRow.getTimestampFromEpoch()); final byte[] hashedDimensions = hashFunction.hashBytes( HadoopDruidIndexerConfig.jsonMapper.writeValueAsBytes( Rows.toGroupKey( truncatedTimestamp, inputRow ) ) ).asBytes(); <START> byte[] serializedInputRow = inputRow instanceof SegmentInputRow ? <END> InputRowSerde.toBytes(inputRow, combiningAggs) : InputRowSerde.toBytes(inputRow, aggregators); context.write( new SortableBytes( bucket.get().toGroupKey(), ByteBuffer.allocate(Longs.BYTES + hashedDimensions.length) .putLong(truncatedTimestamp) .put(hashedDimensions) .array() ).toBytesWritable(), new BytesWritable(InputRowSerde.toBytes(inputRow, aggregators)) ); }</code><technical_language>tests delta ingestion of metrics regular/combining aggregators works</technical_language>

Target:
protected void innerMap( InputRow inputRow, Object value, Context context ) throws IOException, InterruptedException { final Optional<Bucket> bucket = getConfig().getBucket(inputRow); if (!bucket.isPresent()) { throw new ISE("WTF?! No bucket found for row: %s", inputRow); } final long truncatedTimestamp = granularitySpec.getQueryGranularity().truncate(inputRow.getTimestampFromEpoch()); final byte[] hashedDimensions = hashFunction.hashBytes( HadoopDruidIndexerConfig.jsonMapper.writeValueAsBytes( Rows.toGroupKey( truncatedTimestamp, inputRow ) ) ).asBytes(); byte[] serializedInputRow = inputRow instanceof SegmentInputRow ? InputRowSerde.toBytes(inputRow, combiningAggs) : InputRowSerde.toBytes(inputRow, aggregators); context.write( new SortableBytes( bucket.get().toGroupKey(), ByteBuffer.allocate(Longs.BYTES + hashedDimensions.length) .putLong(truncatedTimestamp) .put(hashedDimensions) .array() ).toBytesWritable(), new BytesWritable(serializedInputRow) ); }