auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void publish(Object message, Map<String, String> dynamicProperties) { if (message instanceof Map) { String uuid = UUID.randomUUID().toString(); try { for (Map.Entry<String, Object> entry : ((Map<String, Object>) message).entrySet()) { mutator.insert(uuid, columnFamilyName, HFactory.createStringColumn(entry.getKey(), entry.getValue().toString())); } mutator.execute(); } catch (Throwable t) { TenantConfigHolder.logAndDrop(eventAdapterConfiguration.getName(), message, null, t, log, tenantId); } } else { TenantConfigHolder.logAndDrop(eventAdapterConfiguration.getName(), message, "Event is not type of Map.", log, tenantId); } }

Target:
public void publish(Object message, Map<String, String> dynamicProperties) { if (message instanceof Map) { String uuid = UUID.randomUUID().toString(); try { for (Map.Entry<String, Object> entry : ((Map<String, Object>) message).entrySet()) { mutator.insert(uuid, columnFamilyName, HFactory.createStringColumn(entry.getKey(), entry.getValue().toString())); } mutator.execute(); } catch (Throwable t) { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, null, t, log, tenantId); } } else { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, "Event is not type of Map.", log, tenantId); } }
Source:
public void setLayoutManager(LayoutManager layout) { super.setLayoutManager(layout); }

Target:
public void setLayoutManager(LayoutManager layout) { super.setLayoutManager(layout); if (mAdapter != null) { mAdapter.setLayoutManager(getLayoutManager()); } }
Source:
private boolean filterDeaggregatedRecord(final UserRecord record) { if (lastSequenceNum.isAggregated()) { return !record.getSequenceNumber().equals(lastSequenceNum.getSequenceNumber()) || record.getSubSequenceNumber() > lastSequenceNum.getSubSequenceNumber(); } return true; }

Target:
private boolean filterDeaggregatedRecord(final UserRecord record) { if (!lastSequenceNum.isAggregated()) { return true; } return !record.getSequenceNumber().equals(lastSequenceNum.getSequenceNumber()) || record.getSubSequenceNumber() > lastSequenceNum.getSubSequenceNumber(); }
Source:
public void verifyURLStatus(int desiredStatus, String URL) { int timeOut = 500; int status = getURLStatus(URL); while (!(status == desiredStatus)) { try { status = getURLStatus(URL); System.out.println(timeOut + " " + status + " " + URL); Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } timeOut += 500; if (timeOut > 20000) { break; } } Assertion.assertEquals(status, desiredStatus); PageObjectLogging.log("verifyURLStatus", URL + " has status " + status, true); }

Target:
public void verifyURLStatus(int desiredStatus, String URL) { int timeOut = 500; int statusCode = 0; boolean status = false; while (!status) { try { statusCode = getURLStatus(URL); if (statusCode == desiredStatus){ status = true; } else { Thread.sleep(500); timeOut += 500; } if (timeOut > 20000) { break; } } catch (InterruptedException e) { throw new RuntimeException(e); } } Assertion.assertEquals(statusCode, desiredStatus); PageObjectLogging.log("verifyURLStatus", URL + " has status " + statusCode, true); }
Source:
private void loadData() { okHttpClient.newCall(new Request.Builder() .url(courseData.getCourse().getCourse_handouts()) .get() .build()) .enqueue(new ErrorHandlingOkCallback<HandoutModel>(getActivity(), HandoutModel.class, CallTrigger.LOADING_CACHED) { @Override protected void onResponse(@NonNull final HandoutModel result) { if (getActivity() == null) { return; } if (result != null && (!TextUtils.isEmpty(result.handouts_html))) { populateHandouts(result); } else { CourseHandoutFragment.this.showErrorMessage(R.string.no_handouts_to_display, FontAwesomeIcons.fa_exclamation_circle); } isHandoutFetched = true; } @Override protected void onFailure(@NonNull final Throwable error) { super.onFailure(error); if (getActivity() == null) { return; } isHandoutFetched = false; CourseHandoutFragment.this.showErrorMessage(R.string.no_handouts_to_display, FontAwesomeIcons.fa_exclamation_circle); } }); }

Target:
private void loadData() { okHttpClientProvider.getWithOfflineCache().newCall(new Request.Builder() .url(courseData.getCourse().getCourse_handouts()) .get() .build()) .enqueue(new ErrorHandlingOkCallback<HandoutModel>(getActivity(), HandoutModel.class, CallTrigger.LOADING_CACHED) { @Override protected void onResponse(@NonNull final HandoutModel result) { if (getActivity() == null) { return; } if (!TextUtils.isEmpty(result.handouts_html)) { populateHandouts(result); } else { CourseHandoutFragment.this.showErrorMessage(R.string.no_handouts_to_display, FontAwesomeIcons.fa_exclamation_circle); } isHandoutFetched = true; } @Override protected void onFailure(@NonNull final Throwable error) { super.onFailure(error); if (getActivity() == null) { return; } isHandoutFetched = false; CourseHandoutFragment.this.showErrorMessage(R.string.no_handouts_to_display, FontAwesomeIcons.fa_exclamation_circle); } }); }
Source:
@Override protected void doEnqueue(Callback<V> callback) { sendRequest().handle((response, t) -> { if (t != null) { callback.onError(t); } else { V value = null; try { value = parseResponse(response, bodyConverter); } catch (Throwable t1) { propagateIfFatal(t1); callback.onError(t1); } if (value != null) callback.onSuccess(value); } return null; }); }

Target:
@Override protected void doEnqueue(Callback<V> callback) { sendRequest().handle((response, t) -> { if (t != null) { callback.onError(t); } else { try { V value = parseResponse(response, bodyConverter); callback.onSuccess(value); } catch (Throwable t1) { propagateIfFatal(t1); callback.onError(t1); } } return null; }); }
Source:
public void setupGraph(final QueryPipelineContext context, final QueryNodeConfig config, final QueryPlanner planner) { if (((TimeSeriesDataSourceConfig) config).timeShifts() == null) { return; } final TimeShiftConfig shift_config = (TimeShiftConfig) TimeShiftConfig.newBuilder() .setConfig((TimeSeriesDataSourceConfig) config) .setId(config.getId() + "-timeShift") .addSource(config.getId()) .build(); ((HAClusterConfig) config).getPushDownNodes().add(shift_config); }

Target:
public void setupGraph(final QueryPipelineContext context, final QueryNodeConfig config, final QueryPlanner planner) { if (((TimeSeriesDataSourceConfig) config).timeShifts() == null) { return; } TimeSeriesDataSourceConfig new_config = ((Builder) config.toBuilder()) .setTimeShifts(((TimeSeriesDataSourceConfig) config).timeShifts()) .setTimeShiftInterval(((TimeSeriesDataSourceConfig) config).getTimeShiftInterval()) .build(); planner.replace(config, new_config); final TimeShiftConfig shift_config = (TimeShiftConfig) TimeShiftConfig.newBuilder() .setTimeshiftInterval(new_config.getTimeShiftInterval()) .setId(new_config.getId() + "-timeShift") .addSource(new_config.getId()) .build(); for (QueryNodeConfig pushdown : new_config.getPushDownNodes()) { if (pushdown.getSources().contains(new_config.getId())) { pushdown.getSources().remove(new_config.getId()); pushdown.getSources().add(shift_config.getId()); } } if (new_config.getPushDownNodes().size() == 0) { List<QueryNodeConfig> pushdown = new ArrayList<>(); pushdown.add(shift_config); BaseTimeSeriesDataSourceConfig.Builder builder = (BaseTimeSeriesDataSourceConfig.Builder) new_config.toBuilder(); ((BaseTimeSeriesDataSourceConfig)new_config).newBuilder(new_config, builder).setPushDownNodes(pushdown); } else { new_config.getPushDownNodes().add(shift_config); } }
Source:
private void fillLocationByGeoLocationProperties(final List<GeolocationProperty> geolocationProperties, final SampleDetailsDTO samplesDetailsDto) { for (GeolocationProperty properties:geolocationProperties) { if (properties.getTypeId().equals(TermId.TRIAL_LOCATION.getId()) && StringUtils.isNotBlank(properties.getValue())) { samplesDetailsDto.setLocationName(properties.getValue()); } else if (properties.getTypeId().equals(TermId.LOCATION_ID.getId()) && StringUtils.isNotBlank(properties.getValue())) { samplesDetailsDto.setLocationDbId(Integer.valueOf(properties.getValue())); } } }

Target:
private void fillLocationByGeoLocationProperties(final List<GeolocationProperty> geolocationProperties, final SampleDetailsDTO samplesDetailsDto) { for (final GeolocationProperty properties : geolocationProperties) { if (properties.getTypeId().equals(TermId.TRIAL_LOCATION.getId()) && StringUtils.isNotBlank(properties.getValue())) { samplesDetailsDto.setLocationName(properties.getValue()); } else if (properties.getTypeId().equals(TermId.LOCATION_ID.getId()) && StringUtils.isNotBlank(properties.getValue())) { samplesDetailsDto.setLocationDbId(Integer.valueOf(properties.getValue())); } } }
Source:
public LogicalPlan visitQueryNoWith(QueryNoWithContext ctx) { LogicalPlan plan = plan(ctx.queryTerm()); if (!ctx.orderBy().isEmpty()) { List<OrderByContext> orders = ctx.orderBy(); OrderByContext endContext = orders.get(orders.size() - 1); plan = new OrderBy(source(ctx.ORDER(), endContext), plan, visitList(ctx.orderBy(), Order.class)); } LimitClauseContext limitClause = ctx.limitClause(); if (limitClause != null) { Token limit = limitClause.limit; if (limit != null && limitClause.INTEGER_VALUE() != null) { if (plan instanceof Limit) { throw new ParsingException(source(limitClause), "Cannot use both TOP and LIMIT in the same query"); } else { plan = limit(plan, source(limitClause), limit); } } } return plan; }

Target:
public LogicalPlan visitQueryNoWith(QueryNoWithContext ctx) { LogicalPlan plan = plan(ctx.queryTerm()); if (!ctx.orderBy().isEmpty()) { List<OrderByContext> orders = ctx.orderBy(); OrderByContext endContext = orders.get(orders.size() - 1); plan = new OrderBy(source(ctx.ORDER(), endContext), plan, visitList(ctx.orderBy(), Order.class)); } LimitClauseContext limitClause = ctx.limitClause(); if (limitClause != null) { Token limit = limitClause.limit; if (limit != null && limitClause.INTEGER_VALUE() != null) { if (plan instanceof Limit) { throw new ParsingException(source(limitClause), "TOP and LIMIT are not allowed in the same query - use one or the other"); } else { plan = limit(plan, source(limitClause), limit); } } } return plan; }
Source:
public void untag(CoreSession session, String docId, String label) throws DocumentSecurityException { if (!session.exists(new IdRef(docId)) || canUntag(session, docId, label)) { CoreInstance.doPrivileged(session, s -> { doUntag(s, docId, cleanLabel(label, true, false)); }); if (label != null) { fireUpdateEvent(session, docId); } } else { String principalName = session.getPrincipal().getName(); throw new DocumentSecurityException("User '" + principalName + "' is not allowed to remove tag '" + label + "' on document '" + docId + "'"); } }

Target:
public void untag(CoreSession session, String docId, String label) throws DocumentSecurityException { if (!session.exists(new IdRef(docId)) || canUntag(session, docId, label)) { String cleanLabel = cleanLabel(label, true, false); CoreInstance.doPrivileged(session, s -> { doUntag(s, docId, cleanLabel); }); if (label != null) { fireUpdateEvent(session, docId); } } else { String principalName = session.getPrincipal().getName(); throw new DocumentSecurityException("User '" + principalName + "' is not allowed to remove tag '" + label + "' on document '" + docId + "'"); } }
Source:
public void shouldShowMyResourcesAndUpdatePermissions() { assertEquals(6, myResourcesPage.getResourcesListCount()); final int row = 1; myResourcesPage.clickExpandButton(row); pause(2000); assertEquals("Resource is shared with jdoe.", myResourcesPage.getSharedWith(row)); myResourcesPage.clickEditButton(row); waitForModalFadeIn(); myResourcesPage.removeAllPermissions(); waitForModalFadeOut(); assertEquals("This resource is not shared.", myResourcesPage.getSharedWith(row)); }

Target:
public void shouldShowMyResourcesAndUpdatePermissions() { final int row = 1; myResourcesPage.clickExpandButton(row); myResourcesPage.clickCollapseButton(row); myResourcesPage.clickExpandButton(row); assertEquals("Resource is shared with jdoe.", myResourcesPage.getSharedWith(row)); myResourcesPage.clickEditButton(row); assertEquals("jdoe", myResourcesPage.getEditDialogUsername(0)); myResourcesPage.removeAllPermissions(); myResourcesPage.alert().assertSuccess(); assertEquals("This resource is not shared.", myResourcesPage.getSharedWith(row)); }
Source:
public void run() { tryingAgain = false; for (Project.NameKey projectName : projectCache.all()) { ProjectConfig config = projectCache.get(projectName).getConfig(); GroupReference ref = config.getGroup(uuid); if (ref == null || newName.equals(ref.getName())) { continue; } try { MetaDataUpdate md = metaDataUpdateFactory.create(projectName); try { rename(md); } finally { md.close(); } } catch (RepositoryNotFoundException noProject) { continue; } catch (ConfigInvalidException err) { log.error("Cannot rename group " + oldName + " in " + projectName, err); } catch (IOException err) { log.error("Cannot rename group " + oldName + " in " + projectName, err); } } }

Target:
public void run() { Iterable<NameKey> names = tryingAgain ? retryOn : projectCache.all(); for (Project.NameKey projectName : names) { ProjectConfig config = projectCache.get(projectName).getConfig(); GroupReference ref = config.getGroup(uuid); if (ref == null || newName.equals(ref.getName())) { continue; } try { MetaDataUpdate md = metaDataUpdateFactory.create(projectName); try { rename(md); } finally { md.close(); } } catch (RepositoryNotFoundException noProject) { continue; } catch (ConfigInvalidException err) { log.error("Cannot rename group " + oldName + " in " + projectName, err); } catch (IOException err) { log.error("Cannot rename group " + oldName + " in " + projectName, err); } } if (!retryOn.isEmpty() && !tryingAgain) { tryingAgain = true; start(5, TimeUnit.MINUTES); } }
Source:
public void shutdown() throws ReplicationException { try { for (ReplicaThread replicaThread : replicaThreads) { replicaThread.shutdown(); } persistor.write(); } catch (Exception e) { logger.error("Error shutting down replica manager {}", e); throw new ReplicationException("Error shuting down replica manager"); } }

Target:
public void shutdown() throws ReplicationException { try { for (ReplicaThread replicaThread : replicaThreads) { replicaThread.shutdown(); } persistor.write(); } catch (Exception e) { logger.error("Error shutting down replica manager {}", e); throw new ReplicationException("Error shutting down replica manager"); } }
Source:
public DefaultCompilationResponse(final Boolean successful, final List<String> mavenOutput, final Path workingDir, final List<String> targetContent, final List<String> projectDependencies) { this.successful = successful; this.mavenOutput = mavenOutput; this.workingDir = workingDir; this.targetContent = targetContent; this.projectDependencies = projectDependencies; }

Target:
public DefaultCompilationResponse(final Boolean successful, final List<String> mavenOutput, final Path workingDir, final List<String> targetContent, final List<String> projectDependencies) { this.successful = successful; this.mavenOutput = mavenOutput; this.workingDir = workingDir; this.targetContent = new ArrayList<>(targetContent); this.projectDependencies = new ArrayList<>(projectDependencies); }
Source:
public void testCRAMThroughBAMRoundTrip(final File originalCRAMFile, final File referenceFile) throws IOException { List<SAMRecord> originalCRAMRecords = getSAMRecordsFromFile(originalCRAMFile, referenceFile); List<SAMRecord> copiedCRAMRecords = new ArrayList<>(); originalCRAMRecords.forEach(origRec -> copiedCRAMRecords.add(origRec.deepCopy())); final File tempBamFile = File.createTempFile("testCRAMToBAMToCRAM", BamFileIoUtils.BAM_FILE_EXTENSION); tempBamFile.deleteOnExit(); SAMFileHeader samHeader = getFileHeader(originalCRAMFile, referenceFile); writeRecordsToFile(copiedCRAMRecords, tempBamFile, referenceFile, samHeader); List<SAMRecord> bamRecords = getSAMRecordsFromFile(tempBamFile, referenceFile); int i = 0; for (SAMRecord rec : bamRecords) { rec.setIndexingBin(null); Assert.assertTrue(rec.equals(originalCRAMRecords.get(i++))); } Assert.assertEquals(i, originalCRAMRecords.size()); final File tempCRAMFile = File.createTempFile("testCRAMToBAMToCRAM", CramIO.CRAM_FILE_EXTENSION); tempCRAMFile.deleteOnExit(); writeRecordsToFile(bamRecords, tempCRAMFile, referenceFile, samHeader); List<SAMRecord> roundTripCRAMRecords = getSAMRecordsFromFile(tempCRAMFile, referenceFile); i = 0; for (SAMRecord rec : roundTripCRAMRecords) { if (!rec.equals(originalCRAMRecords.get(i))) { System.out.println(originalCRAMRecords.get(i).getSAMString() + rec.getSAMString()); rec.equals(originalCRAMRecords.get(i)); } i++; } i = 0; for (SAMRecord rec : roundTripCRAMRecords) { Assert.assertTrue(rec.equals(originalCRAMRecords.get(i++))); } Assert.assertEquals(i, originalCRAMRecords.size()); }

Target:
public void testCRAMThroughBAMRoundTrip(final File originalCRAMFile, final File referenceFile) throws IOException { List<SAMRecord> originalCRAMRecords = getSAMRecordsFromFile(originalCRAMFile, referenceFile); List<SAMRecord> copiedCRAMRecords = new ArrayList<>(); originalCRAMRecords.forEach(origRec -> copiedCRAMRecords.add(origRec.deepCopy())); final File tempBamFile = File.createTempFile("testCRAMToBAMToCRAM", BamFileIoUtils.BAM_FILE_EXTENSION); tempBamFile.deleteOnExit(); SAMFileHeader samHeader = getFileHeader(originalCRAMFile, referenceFile); writeRecordsToFile(copiedCRAMRecords, tempBamFile, referenceFile, samHeader); List<SAMRecord> bamRecords = getSAMRecordsFromFile(tempBamFile, referenceFile); int i = 0; for (SAMRecord rec : bamRecords) { rec.setIndexingBin(null); Assert.assertTrue(rec.equals(originalCRAMRecords.get(i++))); } Assert.assertEquals(i, originalCRAMRecords.size()); final File tempCRAMFile = File.createTempFile("testCRAMToBAMToCRAM", CramIO.CRAM_FILE_EXTENSION); tempCRAMFile.deleteOnExit(); writeRecordsToFile(bamRecords, tempCRAMFile, referenceFile, samHeader); List<SAMRecord> roundTripCRAMRecords = getSAMRecordsFromFile(tempCRAMFile, referenceFile); i = 0; for (SAMRecord rec : roundTripCRAMRecords) { Assert.assertTrue(rec.equals(originalCRAMRecords.get(i++))); } Assert.assertEquals(i, originalCRAMRecords.size()); }
Source:
public static int getTemporalLayerIndex(byte[] buf, int off, int len) { if (buf == null || buf.length < off + len || len < 2) { return -1; } if ((buf[off] & X_BIT) == 0 || (buf[off+1] & T_BIT) == 0) { return -1; } int sz = getSize(buf, off); return (buf[off + sz - 1] & 0xc0) >> 6; }

Target:
public static int getTemporalLayerIndex(byte[] buf, int off, int len) { if (buf == null || buf.length < off + len || len < 2) { return -1; } if ((buf[off] & X_BIT) == 0 || (buf[off+1] & T_BIT) == 0) { return -1; } int sz = getSize(buf, off); if (buf.length < off + sz || sz < 1) { return -1; } return (buf[off + sz - 1] & 0xc0) >> 6; }
Source:
public Flux<String> getServices() { return Flux.defer(getServicesFromZookeeper()) .subscribeOn(Schedulers.elastic()); }

Target:
public Flux<String> getServices() { return Flux.defer(getServicesFromZookeeper()) .subscribeOn(Schedulers.boundedElastic()); }
Source:
void repaintPositionOverlay() { final long currentTimeMillis = System.currentTimeMillis(); if (currentTimeMillis > timeLastRepaintPositionOverlay + MIN_UPDATE_INTERVAL) { timeLastRepaintPositionOverlay = currentTimeMillis; try { if (mapView != null) { if (overlayPosition == null) { overlayPosition = mapView.createAddPositionOverlay(activity); } boolean needsRepaintForDistance = needsRepaintForDistance(); boolean needsRepaintForHeading = needsRepaintForHeading(); if (needsRepaintForDistance) { if (followMyLocation) { centerMap(new Geopoint(currentLocation)); } } if (needsRepaintForDistance || needsRepaintForHeading) { overlayPosition.setCoordinates(currentLocation); overlayPosition.setHeading(currentHeading); mapView.repaintRequired(overlayPosition); } } } catch (Exception e) { Log.w("Failed to update location."); } } }

Target:
void repaintPositionOverlay() { final long currentTimeMillis = System.currentTimeMillis(); if (currentTimeMillis > timeLastPositionOverlayCalculation + MIN_UPDATE_INTERVAL) { timeLastPositionOverlayCalculation = currentTimeMillis; try { if (mapView != null) { if (overlayPosition == null) { overlayPosition = mapView.createAddPositionOverlay(activity); } boolean needsRepaintForDistance = needsRepaintForDistance(); boolean needsRepaintForHeading = needsRepaintForHeading(); if (needsRepaintForDistance) { if (followMyLocation) { centerMap(new Geopoint(currentLocation)); } } if (needsRepaintForDistance || needsRepaintForHeading) { overlayPosition.setCoordinates(currentLocation); overlayPosition.setHeading(currentHeading); mapView.repaintRequired(overlayPosition); } } } catch (Exception e) { Log.w("Failed to update location."); } } }
Source:
public static void addHeader(Headers target, String key, Object value) { Assert.notNull(target, () -> "target may not be null"); if (value instanceof Instant) { target.add(key, toBytes((Number) ((Instant) value).toEpochMilli())); } else if (value instanceof Number) { target.add(key, toBytes((Number) value)); } else if (value instanceof String) { target.add(key, ((String) value).getBytes()); } else if (value == null) { target.add(key, null); } else { target.add(key, value.toString().getBytes()); } }

Target:
public static void addHeader(Headers target, String key, Object value) { Assert.notNull(target, () -> "target may not be null"); if (value instanceof Instant) { target.add(key, toBytes((Number) ((Instant) value).toEpochMilli())); } else if (value instanceof Number) { target.add(key, toBytes((Number) value)); } else if (value instanceof String) { target.add(key, ((String) value).getBytes(UTF_8)); } else if (value == null) { target.add(key, null); } else { target.add(key, value.toString().getBytes(UTF_8)); } }
Source:
public void forceDestroyRaftGroup(String groupName) { checkNotNull(groupName); checkFalse(metadataGroupId.name().equalsIgnoreCase(groupName), "Cannot force-destroy the METADATA CP group!"); boolean found = false; for (CPGroupInfo group : groups.values()) { if (group.name().equals(groupName)) { if (group.forceSetDestroyed()) { logger.info(group.id() + " is force-destroyed."); sendDestroyRaftNodeOps(group); } else if (logger.isFineEnabled()) { logger.fine(group.id() + " is already force-destroyed."); } found = true; } } if (!found) { throw new IllegalArgumentException("CP group with name: " + groupName + " does not exist to force-destroy!"); } }

Target:
public void forceDestroyRaftGroup(String groupName) { checkNotNull(groupName); checkFalse(METADATA_CP_GROUP_NAME.equalsIgnoreCase(groupName), "Cannot force-destroy the METADATA CP group!"); checkMetadataGroupInitSuccessful(); boolean found = false; for (CPGroupInfo group : groups.values()) { if (group.name().equals(groupName)) { if (group.forceSetDestroyed()) { logger.info(group.id() + " is force-destroyed."); sendDestroyRaftNodeOps(group); } else if (logger.isFineEnabled()) { logger.fine(group.id() + " is already force-destroyed."); } found = true; } } if (!found) { throw new IllegalArgumentException("CP group with name: " + groupName + " does not exist to force-destroy!"); } }
Source:
public void shouldNotMatchUrlStaringWithAPI() throws DotDataException { final String newsPatternPrefix = "/testpattern" + System.currentTimeMillis() + "/"; final UrlMapContext context = getUrlMapContext(systemUser, host, "/api/v1/page/render" + newsPatternPrefix + "u-s-labor-department-moves-forward-on-retirement-advice-proposal-esp" + System.currentTimeMillis()); assertFalse(urlMapAPI.isUrlPattern(context)); }

Target:
public void shouldNotMatchUrlStaringWithAPI() throws DotDataException { final String newsPatternPrefix = "/testpattern" + System.currentTimeMillis() + "/"; final Contentlet newsTestContent = createURLMapperContentType(newsPatternPrefix); final UrlMapContext context = getUrlMapContext(systemUser, host, "/api" + newsPatternPrefix + newsTestContent.getStringProperty("urlTitle")); assertFalse(urlMapAPI.isUrlPattern(context)); }
Source:
private void deleteOldRedisplayedInAppMessages() { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); inAppMessageRepository.deleteOldRedisplayedInAppMessages(); } }, OS_SAVE_IN_APP_MESSAGE).start(); }

Target:
private void deleteOldRedisplayedInAppMessages() { new Thread(new Runnable() { @Override public void run() { Thread.currentThread().setPriority(Process.THREAD_PRIORITY_BACKGROUND); inAppMessageRepository.deleteOldRedisplayedInAppMessages(); } }, OS_DELETE_IN_APP_MESSAGE).start(); }
Source:
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) { List<ValidationResult> checks = new ArrayList<>(1); TMarkLogicConnectionStandalone standalone = new TMarkLogicConnectionStandalone(); try { standalone.initialize(container, properties); standalone.connect(container); checks.add(ValidationResult.OK); } catch (ComponentException ce) { checks.add(new ValidationResult(ce)); } return checks; }

Target:
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) { TMarkLogicConnectionStandalone standalone = new TMarkLogicConnectionStandalone(); ValidationResult validationResult; try { standalone.initialize(container, properties); standalone.connect(container); validationResult = ValidationResult.OK; } catch (ComponentException ce) { validationResult = new ValidationResult(ce); } return Collections.singletonList(validationResult); }
Source:
public void process(Writable value) throws HiveException { ExecMapperContext context = getExecContext(); if (context != null && context.inputFileChanged()) { cleanUpInputFileChanged(); } int childrenDone = 0; for (MapOpCtx current : currentCtxs) { Object row = null; try { row = current.readRow(value, context); if (!current.forward(row)) { childrenDone++; } } catch (Exception e) { String message = null; try { message = toErrorMessage(value, row, current.rowObjectInspector); } catch (Throwable t) { message = "[" + row + ", " + value + "]: cannot get error message " + t.getMessage(); } if (row == null) { deserialize_error_count.set(deserialize_error_count.get() + 1); throw new HiveException("Hive Runtime Error while processing writable " + message, e); } LOG.debug("Hive Runtime Error while processing row " + message); throw new HiveException("Hive Runtime Error while processing row", e); } } rowsForwarded(childrenDone, 1); }

Target:
public void process(Writable value) throws HiveException { ExecMapperContext context = getExecContext(); if (context != null && context.inputFileChanged()) { cleanUpInputFileChanged(); } int childrenDone = 0; for (MapOpCtx current : currentCtxs) { Object row = null; try { row = current.readRow(value, context); if (!current.forward(row)) { childrenDone++; } } catch (Exception e) { String message = null; try { message = toErrorMessage(value, row, current.rowObjectInspector); } catch (Throwable t) { message = "[" + row + ", " + value + "]: cannot get error message " + t.getMessage(); } if (row == null) { deserialize_error_count.set(deserialize_error_count.get() + 1); LOG.trace("Hive Runtime Error while processing writable " + message); throw new HiveException("Hive Runtime Error while processing writable", e); } LOG.trace("Hive Runtime Error while processing row " + message); throw new HiveException("Hive Runtime Error while processing row", e); } } rowsForwarded(childrenDone, 1); }
Source:
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { final GitHubPRTrigger trigger = JobInfoHelpers.triggerFrom(run.getParent(), GitHubPRTrigger.class); if (trigger == null) { return; } GitHubPRCause cause = run.getCause(GitHubPRCause.class); if (cause == null) { return; } try { if (statusMessage != null) { String url = trigger.getDescriptor().getJenkinsURL() + run.getUrl(); String expandedMessage; if (run instanceof AbstractBuild<?, ?>) { final AbstractBuild<?, ?> build = (AbstractBuild<?, ?>) run; expandedMessage = statusMessage.expandAll(build, listener); } else { expandedMessage = statusMessage.getContent(); } trigger.getRemoteRepo().createCommitStatus( cause.getHeadSha(), GHCommitState.PENDING, url, expandedMessage, run.getParent().getFullName() ); } } catch (IOException e) { listener.getLogger().println("Can't update build description"); LOGGER.error("Can't set commit status", e); } }

Target:
public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnull Launcher launcher, @Nonnull TaskListener listener) throws InterruptedException, IOException { final GitHubPRTrigger trigger = JobInfoHelpers.triggerFrom(run.getParent(), GitHubPRTrigger.class); if (trigger == null) { return; } GitHubPRCause cause = run.getCause(GitHubPRCause.class); if (cause == null) { return; } try { if (statusMessage != null) { String url = trigger.getDescriptor().getJenkinsURL() + run.getUrl(); trigger.getRemoteRepo().createCommitStatus( cause.getHeadSha(), GHCommitState.PENDING, url, statusMessage.expandAll(run, listener), run.getParent().getFullName() ); } } catch (IOException e) { listener.getLogger().println("Can't update build description"); LOGGER.error("Can't set commit status", e); } }
Source:
public void stop() { for (PageSubscription cursor : activeCursors.values()) { cursor.stop(); } int pendingCleanupTasks = scheduledCleanup.get(); if (pendingCleanupTasks > 0) { logger.tracef("Try to wait %d cleanup tasks to complete", pendingCleanupTasks); if (!executor.flush(10, TimeUnit.SECONDS)) { pendingCleanupTasks = scheduledCleanup.get(); if (pendingCleanupTasks > 0) { logger.warnf("Stopping while leaving %d cleanup tasks undone", pendingCleanupTasks); } } } final List<Runnable> pendingTasks = new ArrayList<>(); final int pendingTasksWhileShuttingDown = executor.shutdownNow(pendingTasks::add); if (pendingTasksWhileShuttingDown > 0) { logger.tracef("Try executing %d pending tasks on stop", pendingTasksWhileShuttingDown); for (Runnable pendingTask : pendingTasks) { try { pendingTask.run(); } catch (Throwable t) { logger.warn("Error while executing a pending task on shutdown", t); } } } }

Target:
public void stop() { for (PageSubscription cursor : activeCursors.values()) { cursor.stop(); } final int pendingCleanupTasks = scheduledCleanup.get(); if (pendingCleanupTasks > 0) { logger.tracef("Stopping with %d cleanup tasks to be completed yet", pendingCleanupTasks); } }
Source:
public boolean isStatusIssued(@NonNull final HuId huId){ return isStatusIssued(InterfaceWrapperHelper.load(huId, I_M_HU.class)); }

Target:
public boolean isStatusIssued(@NonNull final HuId huId){ return isStatusIssued(handlingUnitsDAO.getById(huId)); }
Source:
public LargeText(final File file, Charset charset, boolean completed, boolean transparentUnGZIP) { this.charset = charset; if (transparentUnGZIP) { this.source = new Source() { public Session open() throws IOException { return new GzipAwareSession(file); } public long length() { return GzipAwareSession.getGzipStreamSize(file); } public boolean exists() { return file.exists(); } }; } else { this.source = new Source() { public Session open() throws IOException { return new FileSession(file); } public long length() { return file.length(); } public boolean exists() { return file.exists(); } }; } this.completed = completed; }

Target:
public LargeText(final File file, Charset charset, boolean completed, boolean transparentUnGZIP) { this.charset = charset; if (transparentUnGZIP && GzipAwareSession.isGzipStream(file)) { this.source = new Source() { public Session open() throws IOException { return new GzipAwareSession(file); } public long length() { return GzipAwareSession.getGzipStreamSize(file); } public boolean exists() { return file.exists(); } }; } else { this.source = new Source() { public Session open() throws IOException { return new FileSession(file); } public long length() { return file.length(); } public boolean exists() { return file.exists(); } }; } this.completed = completed; }
Source:
private Properties readPropertiesFromOverrideFile() { final Properties properties = new Properties(); findOverrideFile() .ifPresent( overrideFile -> { try { properties.load(new FileInputStream(overrideFile)); } catch (final IOException e) { log.log( Level.SEVERE, "Failed to read override file: " + overrideFile.getAbsolutePath(), e); } }); return properties; }

Target:
private Properties readPropertiesFromOverrideFile() { final Properties properties = new Properties(); findOverrideFile() .ifPresent( overrideFile -> { try (InputStream fileInput = Files.newInputStream(overrideFile)) { properties.load(fileInput); } catch (final IOException e) { log.log( Level.SEVERE, "Failed to read override file: " + overrideFile.toAbsolutePath(), e); } }); return properties; }
Source:
public void testReflectionHierarchyArrayList() { assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION)); assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0); final List<Object> list = new ArrayList<>(10); final String baseString = this.toBaseString(list); final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]"; final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true); if (!expectedWithTransients.equals(toStringWithTransients)) { assertEquals(expectedWithTransients, toStringWithTransients); } final String expectedWithoutTransients = baseString + "[size=0]"; final String toStringWithoutTransients = ToStringBuilder.reflectionToString(list, null, false); if (!expectedWithoutTransients.equals(toStringWithoutTransients)) { assertEquals(expectedWithoutTransients, toStringWithoutTransients); } }

Target:
public void testReflectionHierarchyArrayList() { assumeFalse("IBM Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".equals(SystemUtils.JAVA_SPECIFICATION_VERSION)); assumeFalse("Oracle Corporation".equals(SystemUtils.JAVA_VENDOR) && "1.6".compareTo(SystemUtils.JAVA_SPECIFICATION_VERSION) < 0); final List<Object> list = new ArrayList<>(ARRAYLIST_INITIAL_CAPACITY); final String baseString = this.toBaseString(list); final String expectedWithTransients = baseString + "[elementData={<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>,<null>},size=0,modCount=0]"; final String toStringWithTransients = ToStringBuilder.reflectionToString(list, null, true); if (!expectedWithTransients.equals(toStringWithTransients)) { assertEquals(expectedWithTransients, toStringWithTransients); } final String expectedWithoutTransients = baseString + "[size=0]"; final String toStringWithoutTransients = ToStringBuilder.reflectionToString(list, null, false); if (!expectedWithoutTransients.equals(toStringWithoutTransients)) { assertEquals(expectedWithoutTransients, toStringWithoutTransients); } }
Source:
public CtfTmfEventField resolve(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return null; } ICompositeDefinition eventContext = ((CtfTmfEvent) event).getEventContext(); if (eventContext == null) { return null; } return CtfTmfEventField.parseField(eventContext, "Context.Event"); }

Target:
public ITmfEventField resolve(ITmfEvent event) { if (!(event instanceof CtfTmfEvent)) { return null; } ICompositeDefinition eventContext = ((CtfTmfEvent) event).getEventContext(); if (eventContext == null) { return null; } return CtfTmfEventField.parseField(eventContext, CONTEXT_EVENT); }
Source:
RtRepos(final Github github, final Request req) { this.ghub = github; this.entry = req; this.createRequest = this.entry.uri().path("user/repos").back(); this.removeRequest = this.entry.uri().path("/repos").back(); }

Target:
RtRepos(final Github github, final Request req) { this.ghub = github; this.entry = req; }
Source:
private void readVersion() { final String command = fScriptCommand.get(0); final List<String> commandLine = ImmutableList.<@NonNull String> builder() .add(command).add(MI_VERSION_FLAG).build(); final String output = getOutputFromCommand(commandLine); if (output == null) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String versionString = output.trim(); if (!versionString.matches("\\d{1,3}\\.\\d{1,3}")) { Activator.instance().logInfo(String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String logMsg = String.format("Command \"%s\" reports MI version %s", command, versionString); Activator.instance().logInfo(logMsg); final String[] parts = versionString.split("\\."); final int major = Integer.valueOf(parts[0]); final int minor = Integer.valueOf(parts[1]); fMiVersion = major * 100 + minor; }

Target:
private void readVersion() { final String command = fScriptCommand.get(0); final List<String> commandLine = ImmutableList.<@NonNull String> builder() .add(command).add(MI_VERSION_FLAG).build(); final String output = getOutputFromCommand(commandLine); if (output == null) { LOGGER.info(() -> String.format(LOG_NO_MI_VERSION_FMT, command)); return; } final String versionString = output.trim(); if (!versionString.matches("\\d{1,3}\\.\\d{1,3}")) { LOGGER.info(() -> String.format(LOG_NO_MI_VERSION_FMT, command)); return; } LOGGER.info(() -> String.format("[LamiAnalysis:MIVersionReport] Command \"%s\" reports MI version %s", command, versionString)); final String[] parts = versionString.split("\\."); final int major = Integer.valueOf(parts[0]); final int minor = Integer.valueOf(parts[1]); fMiVersion = major * 100 + minor; }
Source:
public static String toLongString(final Change.Status status) { if (status == null) { return ""; } switch (status) { case NEW: return C.statusLongNew(); case SUBMITTED: return C.statusLongSubmitted(); case MERGED: return C.statusLongMerged(); case ABANDONED: return C.statusLongAbandoned(); case DRAFT: return C.statusLongDraft(); default: return status.name(); } }

Target:
public static String toLongString(final Change.Status status) { if (status == null) { return ""; } switch (status) { case DRAFT: return C.statusLongDraft(); case NEW: return C.statusLongNew(); case SUBMITTED: return C.statusLongSubmitted(); case MERGED: return C.statusLongMerged(); case ABANDONED: return C.statusLongAbandoned(); default: return status.name(); } }
Source:
public FSHLog(final FileSystem fs, final Path rootDir, final String logDir, final String archiveDir, final Configuration conf, final List<WALActionsListener> listeners, final boolean failIfWALExists, final String prefix, final String suffix) throws IOException { super(fs, rootDir, logDir, archiveDir, conf, listeners, failIfWALExists, prefix, suffix); this.minTolerableReplication = conf.getInt("hbase.regionserver.hlog.tolerable.lowreplication", CommonFSUtils.getDefaultReplication(fs, this.walDir)); this.lowReplicationRollLimit = conf.getInt("hbase.regionserver.hlog.lowreplication.rolllimit", 5); this.closeErrorsTolerated = conf.getInt("hbase.regionserver.logroll.errors.tolerated", 2); String hostingThreadName = Thread.currentThread().getName(); this.disruptor = new Disruptor<>(RingBufferTruck::new, getPreallocatedEventCount(), Threads.newDaemonThreadFactory(hostingThreadName + ".append"), ProducerType.MULTI, new BlockingWaitStrategy()); this.disruptor.getRingBuffer().next(); int maxHandlersCount = conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT, 200); this.ringBufferEventHandler = new RingBufferEventHandler( conf.getInt("hbase.regionserver.hlog.syncer.count", defaultSyncerCount), maxHandlersCount); this.disruptor.setDefaultExceptionHandler(new RingBufferExceptionHandler()); this.disruptor.handleEventsWith(new RingBufferEventHandler[] { this.ringBufferEventHandler }); this.disruptor.start(); }

Target:
public FSHLog(final FileSystem fs, final Path rootDir, final String logDir, final String archiveDir, final Configuration conf, final List<WALActionsListener> listeners, final boolean failIfWALExists, final String prefix, final String suffix) throws IOException { super(fs, rootDir, logDir, archiveDir, conf, listeners, failIfWALExists, prefix, suffix); this.minTolerableReplication = conf.getInt(TOLERABLE_LOW_REPLICATION, CommonFSUtils.getDefaultReplication(fs, this.walDir)); this.lowReplicationRollLimit = conf.getInt(LOW_REPLICATION_ROLL_LIMIT, DEFAULT_LOW_REPLICATION_ROLL_LIMIT); this.closeErrorsTolerated = conf.getInt(ROLL_ERRORS_TOLERATED, DEFAULT_ROLL_ERRORS_TOLERATED); String hostingThreadName = Thread.currentThread().getName(); this.disruptor = new Disruptor<>(RingBufferTruck::new, getPreallocatedEventCount(), Threads.newDaemonThreadFactory(hostingThreadName + ".append"), ProducerType.MULTI, new BlockingWaitStrategy()); this.disruptor.getRingBuffer().next(); int syncerCount = conf.getInt(SYNCER_COUNT, DEFAULT_SYNCER_COUNT); int maxBatchCount = conf.getInt(MAX_BATCH_COUNT, conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT, DEFAULT_MAX_BATCH_COUNT)); this.ringBufferEventHandler = new RingBufferEventHandler(syncerCount, maxBatchCount); this.disruptor.setDefaultExceptionHandler(new RingBufferExceptionHandler()); this.disruptor.handleEventsWith(new RingBufferEventHandler[] { this.ringBufferEventHandler }); this.disruptor.start(); }
Source:
private Object inputOnBlur(final Event event) { final FocusEvent focusEvent = (FocusEvent) event; if (!Objects.equals(focusEvent.relatedTarget, view.getElement()) && !isChildrenOfView((Element) focusEvent.relatedTarget)) { HiddenHelper.hide(view.getElement()); if (!Objects.isNull(previousCallback)) { previousCallback.onInvoke(event); } } refreshDateInPopup(); return null; }

Target:
private Object inputOnBlur(final Event event) { final FocusEvent focusEvent = (FocusEvent) event; onBlur(focusEvent, view.getElement()); refreshDateInPopup(); return this; }
Source:
int countActiveUsers() { final int activeUsersCount = this.personService.getActivePersons().size(); LOG.debug("active users count is {}", activeUsersCount); return activeUsersCount; }

Target:
int countActiveUsers() { final int activeUsersCount = this.personService.numberOfActivePersons(); LOG.debug("active users count is {}", activeUsersCount); return activeUsersCount; }
Source:
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy != null && throwableProxy instanceof ThrowableProxy) { if (throwableProxy.getStackTraceElementProxyArray().length > 0) { StackTraceElement stackTraceElement = throwableProxy.getStackTraceElementProxyArray()[0].getStackTraceElement(); generator.writeObjectFieldStart(getFieldName()); JsonWritingUtils.writeStringField(generator, FIELD_CLASS_NAME, stackTraceElement.getClassName()); JsonWritingUtils.writeStringField(generator, FIELD_METHOD_NAME, stackTraceElement.getMethodName()); generator.writeEndObject(); } } }

Target:
public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException { IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy != null && throwableProxy instanceof ThrowableProxy) { if (throwableProxy.getStackTraceElementProxyArray().length > 0) { StackTraceElement stackTraceElement = throwableProxy.getStackTraceElementProxyArray()[0].getStackTraceElement(); generator.writeObjectFieldStart(getFieldName()); JsonWritingUtils.writeStringField(generator, fieldClassName, stackTraceElement.getClassName()); JsonWritingUtils.writeStringField(generator, fieldMethodName, stackTraceElement.getMethodName()); generator.writeEndObject(); } } }
Source:
public Response updateLastViewed(@Scope(OAuthScope.APP_STATS) final AccessToken accessToken, @Valid final AppStats appStats) { if (appStats.insightsLastViewed.isPresent()) { final DateTime insightsLastViewed = appStats.insightsLastViewed.get(); appStatsDAO.putInsightsLastViewed(accessToken.accountId, insightsLastViewed); } if (appStats.questionsLastViewed.isPresent()) { final DateTime questionsLastViewed = appStats.questionsLastViewed.get(); appStatsDAO.putQuestionsLastViewed(accessToken.accountId, questionsLastViewed); } if (appStats.questionsLastViewed.isPresent() || appStats.insightsLastViewed.isPresent()) { return Response.status(Response.Status.ACCEPTED).build(); } else { return Response.status(Response.Status.NOT_MODIFIED).build(); } }

Target:
public Response updateLastViewed(@Scope(OAuthScope.APP_STATS) final AccessToken accessToken, @Valid final AppStats appStats) { if (appStats.insightsLastViewed.isPresent()) { final DateTime insightsLastViewed = appStats.insightsLastViewed.get(); appStatsDAO.putInsightsLastViewed(accessToken.accountId, insightsLastViewed); } if (appStats.questionsLastViewed.isPresent()) { final DateTime questionsLastViewed = appStats.questionsLastViewed.get(); appStatsDAO.putQuestionsLastViewed(accessToken.accountId, questionsLastViewed); } if (appStats.questionsLastViewed.isPresent() || appStats.insightsLastViewed.isPresent()) { return Response.status(Response.Status.ACCEPTED).build(); } return Response.status(Response.Status.NOT_MODIFIED).build(); }
Source:
public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); if (saveHome && hasHome()) { int[] h = {(int) home.minX, (int) home.minY, (int) home.minZ, (int) home.maxX, (int) home.maxY, (int) home.maxZ}; nbt.setIntArray("home", h); if (moveTowardsRestrictionAdded && moveTowardsRestrictionPrio > -1) { nbt.setInteger("homeMovePrio", moveTowardsRestrictionPrio); } } if (entityActionHandler != null) { if (entityActionHandler.getFlag() && entityActionHandler.getAction() != null) { nbt.setInteger("activeAction", EntityActionManager.idByActions.get(entityActionHandler.getAction())); } } }

Target:
public void writeEntityToNBT(NBTTagCompound nbt) { super.writeEntityToNBT(nbt); if (saveHome && hasHome()) { int[] h = { (int) home.minX, (int) home.minY, (int) home.minZ, (int) home.maxX, (int) home.maxY, (int) home.maxZ }; nbt.setIntArray("home", h); if (moveTowardsRestrictionAdded && moveTowardsRestrictionPrio > -1) { nbt.setInteger("homeMovePrio", moveTowardsRestrictionPrio); } } if (entityActionHandler != null) { entityActionHandler.writeToNBT(nbt); } }
Source:
public List<String> getValidationErrors() { List<String> errors = super.getValidationErrors(); if( tenantId == null ) { errors.add( "'" + getMetricName() + "': No tenantId is provided for the metric." ); } return errors; }

Target:
public List<String> getValidationErrors() { List<String> errors = super.getValidationErrors(); if( StringUtils.isBlank( tenantId ) ) { errors.add( "'" + getMetricName() + "': No tenantId is provided for the metric." ); } return errors; }
Source:
byte[] serializeRecord(IN record, Long timestamp) { if (dos == null) { dos = new DataOutputSerializer(16); } try { if (timestamp == null) { dos.writeInt(TAG_REC_WITHOUT_TIMESTAMP); } else { dos.writeInt(TAG_REC_WITH_TIMESTAMP); dos.writeLong(timestamp); } serializer.serialize(record, dos); } catch (IOException e) { throw new RuntimeException("Unable to serialize record", e); } byte[] ret = dos.getCopyOfBuffer(); dos.clear(); return ret; }

Target:
byte[] serializeRecord(IN record, Long timestamp) { if (dos == null) { dos = new DataOutputSerializer(16); } try { dos.write(KAFKA_SHUFFLE_VERSION); if (timestamp == null) { dos.write(TAG_REC_WITHOUT_TIMESTAMP); } else { dos.write(TAG_REC_WITH_TIMESTAMP); dos.writeLong(timestamp); } serializer.serialize(record, dos); } catch (IOException e) { throw new RuntimeException("Unable to serialize record", e); } byte[] ret = dos.getCopyOfBuffer(); dos.clear(); return ret; }
Source:
public String getTSnePlotMetadata( @PathVariable String experimentAccession) { JsonObject plotData = experimentPageContentService.getTsnePlotData(experimentAccession); return plotData.getAsJsonArray("metadata").size() == 0 ? GSON.toJson(new JsonArray()) : GSON.toJson(plotData.getAsJsonArray("metadata")); }

Target:
public String getTSnePlotMetadata( @PathVariable String experimentAccession) { JsonArray plotData = experimentPageContentService.getTsnePlotMetaData(experimentAccession); if(plotData.size() == 0) { return null; } else { return GSON.toJson(plotData); } }