auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Message<?> doReceive(long timeout) { try { if (timeout > 0) { if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).poll(timeout, TimeUnit.MILLISECONDS); } else { long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); long deadline = System.nanoTime() + nanos; Message<?> message = null; while ((message = this.queue.poll()) == null){ if (Thread.interrupted() || System.nanoTime() > deadline) { break; } } return message; } } if (timeout == 0) { return this.queue.poll(); } if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).take(); } else { Message<?> message = null; while ((message = this.queue.poll()) == null) { if (Thread.interrupted()) { break; } } return message; } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }

Target:
protected Message<?> doReceive(long timeout) { try { if (timeout > 0) { if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).poll(timeout, TimeUnit.MILLISECONDS); } else { long nanos = TimeUnit.MILLISECONDS.toNanos(timeout); long deadline = System.nanoTime() + nanos; while (this.queue.size() == 0 && nanos > 0) { this.queueSemaphore.tryAcquire(nanos, TimeUnit.NANOSECONDS); nanos = deadline - System.nanoTime(); } return this.queue.poll(); } } if (timeout == 0) { return this.queue.poll(); } if (this.queue instanceof BlockingQueue) { return ((BlockingQueue<Message<?>>) this.queue).take(); } else { while (this.queue.size() == 0) { this.queueSemaphore.tryAcquire(50, TimeUnit.MILLISECONDS); } return this.queue.poll(); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }
Source:
public static <I, R> Aggregator<I, CanonicalizingHashSet<R>> distinct(String attributePath) { return new DistinctValuesAggregator<I, R>(attributePath); }

Target:
public static <I, R> Aggregator<I, Set<R>> distinct(String attributePath) { return new DistinctValuesAggregator<>(attributePath); }
Source:
public ExecutionReference(int execId, Executor executor) { this.execId = execId; this.executor = executor; }

Target:
public ExecutionReference(int execId, Executor executor) { if (executor == null) { throw new IllegalArgumentException(String.format( "Executor cannot be null for exec id: %d ExecutionReference", execId)); } this.execId = execId; this.executor = executor; }
Source:
private static void setProperty(String entryId, KalturaEntryIdKey entryIdKey, String subKey, Object value) throws Exception { if (!entryIdToKalturaLiveEntryMap.containsKey(entryIdKey)) { entryIdToKalturaLiveEntryMap.put(entryIdKey, new ConcurrentHashMap<String, Object>()); ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryIdKey); entryMap.put(subKey, value); } logger.debug("(" + entryId + ") successfully updated entry " + entryIdKey.getEntryId() + " sub key " + subKey + "."); }

Target:
private static void setProperty(String entryId, KalturaEntryIdKey entryIdKey, String subKey, Object value) throws Exception { ConcurrentHashMap<String, Object> entryMap = entryIdToKalturaLiveEntryMap.get(entryIdKey); entryMap.put(subKey, value); logger.debug("(" + entryId + ") successfully updated entry " + entryIdKey.getEntryId() + " sub key \"" + subKey + "\" (map size:" + entryIdToKalturaLiveEntryMap.size() + ")"); }
Source:
public void testIndexSegmentRollOverNewIndexSegmentVersion() throws StoreException, IOException { state.closeAndClearIndex(); state.reloadIndex(false, false); Offset endOffset = state.index.getCurrentEndOffset(); state.index.close(); state.appendToLog(100); IndexEntry entry = new IndexEntry(state.getUniqueId(), IndexValueUtils.getIndexValue(100, endOffset, state.time.seconds(), PersistentIndex.VERSION_0)); MetricRegistry metricRegistry = new MetricRegistry(); StoreMetrics metrics = new StoreMetrics(state.tempDirStr, metricRegistry); StoreConfig config = new StoreConfig(new VerifiableProperties(state.properties)); IndexSegment info = new IndexSegment(state.tempDirStr, entry.getValue().getOffset(), state.STORE_KEY_FACTORY, entry.getKey().sizeInBytes(), entry.getValue().getBytes().capacity(), config, metrics, state.time); endOffset = new Offset(entry.getValue().getOffset().getName(), entry.getValue().getOffset().getOffset() + entry.getValue().getSize()); info.addEntry(entry, endOffset); StoreTestUtils.writeIndexSegmentToFile(info, endOffset); metricRegistry = new MetricRegistry(); metrics = new StoreMetrics(state.tempDirStr, metricRegistry); config = new StoreConfig(new VerifiableProperties(state.properties)); state.index = new PersistentIndex(state.tempDirStr, state.scheduler, state.log, config, state.STORE_KEY_FACTORY, state.recovery, state.hardDelete, metrics, state.time, state.sessionId, state.incarnationId); int indexCount = state.index.indexes.size(); state.addPutEntries(1, 100, Utils.Infinite_Time); assertEquals("Index roll over should have happened ", indexCount + 1, state.index.indexes.size()); state.closeAndClearIndex(); }

Target:
public void testIndexSegmentRollOverNewIndexSegmentVersion() throws StoreException, IOException { indexSegmentRollOverTest(true); indexSegmentRollOverTest(false); }
Source:
public void testWatermarkBeforeRecords() { final TestingWatermarkOutput output = new TestingWatermarkOutput(); final WatermarkGenerator<Object> watermarks = WatermarkStrategy .forMonotonousTimestamps() .createWatermarkGenerator(() -> null); watermarks.onPeriodicEmit(output); assertEquals(Long.MIN_VALUE, output.lastWatermark().getTimestamp()); }

Target:
public void testWatermarkBeforeRecords() { final TestingWatermarkOutput output = new TestingWatermarkOutput(); final AscendingTimestampsWatermarks<Object> watermarks = new AscendingTimestampsWatermarks<>(); watermarks.onPeriodicEmit(output); assertEquals(Long.MIN_VALUE, output.lastWatermark().getTimestamp()); }
Source:
public static void logDriverVersion() { Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); core.info("DataStax Java driver for Apache Cassandra version {}", getDriverVersion()); }

Target:
public static void logDriverVersion() { Logger core = LoggerFactory.getLogger("com.datastax.driver.core"); core.info("DataStax Java driver for Apache Cassandra", getDriverVersion()); }
Source:
public void testDeleteJob() { JobRequest jobRequest = createSpace("deleteJobOrgUnitWith" + user.getUserName()); assertOperation(() -> roleClient.deleteJob(jobRequest.getJobId())); }

Target:
public void testDeleteJob() { JobRequest jobRequest = createSpace("deleteSpaceWith" + user.getUserName()); assertOperation(() -> roleClient.deleteJob(jobRequest.getJobId())); }
Source:
public void setUp() { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { final Runnable r = (Runnable) invocation.getArguments()[0]; new InstantExecutor().execute(r); return null; } }).when(factory).queueOnEventThread(any(Runnable.class)); mockListener = getEventListener(); channel = newInstance(getChannelName()); channel.setEventListener(mockListener); }

Target:
public void setUp() { doAnswer(new Answer() { @Override public Object answer(InvocationOnMock invocation) throws Throwable { final Runnable r = (Runnable) invocation.getArguments()[0]; r.run(); return null; } }).when(factory).queueOnEventThread(any(Runnable.class)); mockListener = getEventListener(); channel = newInstance(getChannelName()); channel.setEventListener(mockListener); }
Source:
private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { List<Map<String, Set<Object>>> result = Lists.newLinkedList(); Set<Map<String, Set<Object>>> resultNoKey = Sets.newHashSet(); for (Long record: records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry: r.entrySet()) { Set<Object> values = Transformers.transformSet(entry.getValue(), Functions.TOBJECT_TO_JAVA); rec.put(entry.getKey(), values); } if (includePrimaryKey) { Set<Object> recordSet = Sets.newHashSet(); recordSet.add(record); rec.put("$primaryKey$", recordSet); result.add(rec); } else { resultNoKey.add(rec); } } if (includePrimaryKey) { jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }

Target:
private AtomicOperation doJsonify(List<Long> records, boolean includePrimaryKey, Compoundable store, StringBuilder jsonStr) { AtomicOperation operation = store.startAtomicOperation(); try { List<Map<String, Set<Object>>> result = Lists.newLinkedList(); Set<Map<String, Set<Object>>> resultNoKey = Sets.newHashSet(); for (Long record : records) { Map<String, Set<Object>> rec = Maps.newHashMap(); Map<String, Set<TObject>> r = operation.browse(record); for (Map.Entry<String, Set<TObject>> entry : r.entrySet()) { Set<Object> values = Transformers.transformSet( entry.getValue(), Functions.THRIFT_TO_JAVA); rec.put(entry.getKey(), values); } if (includePrimaryKey) { Set<Object> recordSet = Sets.newHashSet(); recordSet.add(record); rec.put("$primaryKey$", recordSet); result.add(rec); } else { resultNoKey.add(rec); } } if (includePrimaryKey) { jsonStr.append(Convert.javaToJson(result)); } else { jsonStr.append(Convert.javaToJson(resultNoKey)); } return operation; } catch (AtomicStateException e) { return null; } }
Source:
public void display(final List<MergeStrategySection> mergeStrategies) { while (1 < table.getRowCount()) table.removeRow(table.getRowCount() - 1); for (final MergeStrategySection r : mergeStrategies) { final int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); populate(row, r); } }

Target:
public void display(final List<MergeStrategySection> mergeStrategies) { while (1 < table.getRowCount()) table.removeRow(table.getRowCount() - 1); Collections.sort(mergeStrategies); for (final MergeStrategySection r : mergeStrategies) { final int row = table.getRowCount(); table.insertRow(row); applyDataRowStyle(row); populate(row, r); } }
Source:
public VdcActionParametersBase getParameters(Host incoming, VDS entity) { String managementIp = null; if (incoming.isSetPowerManagement()) { managementIp = getManagementIp(incoming.getPowerManagement(), entity.getStaticData()); } VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); if (incoming.isSetPowerManagement()) { updated.setManagementIp(managementIp); } UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "", false); if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }

Target:
public VdcActionParametersBase getParameters(Host incoming, VDS entity) { VdsStatic updated = getMapper(modelType, VdsStatic.class).map(incoming, entity.getStaticData()); UpdateVdsActionParameters updateParams = new UpdateVdsActionParameters(updated, "", false); if (incoming.isSetOverrideIptables()) { updateParams.setOverrideFirewall(incoming.isOverrideIptables()); } return updateParams; }
Source:
@Test public void testRequestNotFound() throws Throwable { enqueue404(); AnnouncementClient.Callback cb = mock(AnnouncementClient.Callback.class); request(cb); server().takeRequest(); verify(cb, never()).success(eq(new ArrayList<Card>())); verify(cb).error(any(Throwable.class)); }

Target:
@Test public void testRequestNotFound() throws Throwable { enqueue404(); Callback cb = mock(Callback.class); request(cb); server().takeRequest(); verify(cb, never()).success(anyListOf(Card.class)); verify(cb).error(any(Throwable.class)); }
Source:
private void updateFooter() { if (issueCount == 0){ totalIssueText.setText(String.valueOf(0)); hideFooterPanelStatsDetails(true); } else { openIssueText.setText(String.valueOf(openIssueCount)); closedIssueText.setText(String.valueOf(closedIssueCount)); totalIssueText.setText(String.valueOf(issueCount)); hideFooterPanelStatsDetails(false); } }

Target:
private void updateFooter() { updateFooterPanelStatsDetails(); if (issuesCount == 0){ hideFooterPanelStatsDetails(true); } else { hideFooterPanelStatsDetails(false); } }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public void draw(TooltipLine value, Canvas canvas) { final UISkin skin = value.getSkin(); if (skin != null) { canvas.setSkin(skin); canvas.setFamily(value.getFamily()); canvas.drawText(value.getText()); } else { canvas.setSkin(defaultSkin); Font font = value.getFont(); if (font == null) { font = canvas.getCurrentStyle().getFont(); } Color color = value.getColor(); if (color == null) { color = canvas.getCurrentStyle().getTextColor(); } canvas.drawTextRaw(value.getText(), font, color, canvas.getRegion()); } }

Target:
public void draw(TooltipLine value, Canvas canvas) { Font font = getFont(value); Color color = getColor(value); canvas.drawTextRaw(value.getText(), font, color, canvas.getRegion()); }
Source:
public IMarkerResolution[] getResolutions(final IMarker marker) { List<IMarkerResolution> resolutions = new ArrayList<>(); resolutions.add(new ShowRuleDescriptionMarkerResolver(marker)); if (hasResolutions(marker)) { resolutions.add(new ShowIssueFlowsMarkerResolver(marker)); } if (isStandalone(marker)) { resolutions.add(new DeactivateRuleMarkerResolver(marker)); } return resolutions.toArray(new IMarkerResolution[resolutions.size()]); }

Target:
public IMarkerResolution[] getResolutions(final IMarker marker) { List<IMarkerResolution> resolutions = new ArrayList<>(); resolutions.add(new ShowRuleDescriptionMarkerResolver(marker)); if (hasExtraLocations(marker)) { resolutions.add(new ShowIssueFlowsMarkerResolver(marker)); } if (isStandaloneIssue(marker)) { resolutions.add(new DeactivateRuleMarkerResolver(marker)); } return resolutions.toArray(new IMarkerResolution[resolutions.size()]); }
Source:
protected void executeCommand() { executeInNewTransaction(() -> { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; }); runVdsCommand(VDSCommandType.ExtendStorageDomain, new ExtendStorageDomainVDSCommandParameters(getStoragePoolId(), getStorageDomain() .getId(), getParameters().getLunIds(), getParameters().isForce())); getParameters().setLunsList(getVgInfo()); executeInNewTransaction(() -> { for (LUNs lun : getParameters().getLunsList()) { proceedLUNInDb(lun, getStorageDomain().getStorageType(), getStorageDomain().getStorage()); } setStorageDomainStatus(StorageDomainStatus.Active, null); getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); return null; }); setSucceeded(true); }

Target:
protected void executeCommand() { executeInNewTransaction(() -> { setStorageDomainStatus(StorageDomainStatus.Locked, getCompensationContext()); getCompensationContext().stateChanged(); return null; }); runVdsCommand(VDSCommandType.ExtendStorageDomain, new ExtendStorageDomainVDSCommandParameters(getStoragePoolId(), getStorageDomain() .getId(), getParameters().getLunIds(), getParameters().isForce())); updateLunsList(); executeInNewTransaction(() -> { for (LUNs lun : getParameters().getLunsList()) { proceedLUNInDb(lun, getStorageDomain().getStorageType(), getStorageDomain().getStorage()); } setStorageDomainStatus(StorageDomainStatus.Active, null); getCompensationContext().cleanupCompensationDataAfterSuccessfulCommand(); return null; }); setSucceeded(true); }
Source:
public void createUnauthorized() throws Exception { context.turnOffAuthorisationSystem(); MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setElement(ELEMENT); metadataFieldRest.setQualifier(QUALIFIER); metadataFieldRest.setScopeNote(SCOPE_NOTE); getClient() .perform(post("/api/core/metadatafields") .param("schemaId", metadataSchema.getID() + "") .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }

Target:
public void createUnauthorized() throws Exception { MetadataFieldRest metadataFieldRest = new MetadataFieldRest(); metadataFieldRest.setElement(ELEMENT); metadataFieldRest.setQualifier(QUALIFIER); metadataFieldRest.setScopeNote(SCOPE_NOTE); getClient() .perform(post("/api/core/metadatafields") .param("schemaId", metadataSchema.getID() + "") .content(new ObjectMapper().writeValueAsBytes(metadataFieldRest)) .contentType(contentType)) .andExpect(status().isUnauthorized()); }
Source:
private String clearQueue(Queue queue, SampleResult res) { String retVal = null; try { QueueReceiver consumer = session.createReceiver(queue); Message deletedMsg = null; long deletedMsgCount = 0; do { deletedMsg = consumer.receiveNoWait(); if (deletedMsg != null) { deletedMsgCount++; deletedMsg.acknowledge(); } } while (deletedMsg != null); retVal = deletedMsgCount + " message(s) removed"; res.setResponseMessage(retVal); } catch (Exception ex) { res.setResponseMessage("Error clearing queue"); ex.printStackTrace(); LOGGER.error(ex.getMessage()); } return retVal; }

Target:
private String clearQueue(Queue queue, SampleResult res) throws JMSException { String retVal; consumer = session.createReceiver(queue); Message deletedMsg; long deletedMsgCount = 0; do { deletedMsg = consumer.receive(Long.valueOf(getTimeoutAsInt())); if (deletedMsg != null) { deletedMsgCount++; } } while (deletedMsg != null); retVal = " " + deletedMsgCount + " message(s) removed"; res.setResponseMessage(retVal); return retVal; }
Source:
void openFirstTimeWindow() { final boolean showProgress = PrefUtil.getAPIPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP); if (!showProgress) { doOpenFirstTimeWindow(); } else { final int expectedProgressCount = Math.max(1, WorkbenchPlugin.getDefault().getBundleCount()); runStartupWithProgress(expectedProgressCount, () -> doOpenFirstTimeWindow()); } }

Target:
void openFirstTimeWindow() { final boolean showProgress = PrefUtil.getAPIPreferenceStore().getBoolean( IWorkbenchPreferenceConstants.SHOW_PROGRESS_ON_STARTUP); if (!showProgress) { doOpenFirstTimeWindow(); } else { runStartupWithProgress(() -> doOpenFirstTimeWindow()); } }
Source:
public void testRemoveProject() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"foo\" />") .append("<project path=\"bar\" name=\"bar\" />") .append("<remove-project name=\"foo\" />") .append("<project path=\"foo\" name=\"baz\" />") .append("</manifest>"); ManifestParser parser = new ManifestParser(null, null, "master", "<LINK_0>", null, null); parser.read(new ByteArrayInputStream( xmlContent.toString().getBytes(CHARSET))); Set<String> results = new HashSet<>(); results.add("bar"); results.add("baz"); for (RepoProject proj : parser.getProjects()) { assertTrue("Unexpected project is included: " + proj.getName(), results.contains(proj.getName())); results.remove(proj.getName()); } assertTrue( "Expected projects are not included", results.isEmpty()); }

Target:
public void testRemoveProject() throws Exception { StringBuilder xmlContent = new StringBuilder(); xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") .append("<manifest>") .append("<remote name=\"remote1\" fetch=\".\" />") .append("<default revision=\"master\" remote=\"remote1\" />") .append("<project path=\"foo\" name=\"foo\" />") .append("<project path=\"bar\" name=\"bar\" />") .append("<remove-project name=\"foo\" />") .append("<project path=\"foo\" name=\"baz\" />") .append("</manifest>"); ManifestParser parser = new ManifestParser(null, null, "master", "<LINK_0>", null, null); parser.read(new ByteArrayInputStream( xmlContent.toString().getBytes(CHARSET))); assertEquals(Stream.of("bar", "baz").collect(Collectors.toSet()), parser.getProjects().stream().map(RepoProject::getName) .collect(Collectors.toSet())); }
Source:
private static <K, V> void prune(Map<K, Reference<V>> map) { for (final Iterator<Map.Entry<K, Reference<V>>> i = map.entrySet() .iterator(); i.hasNext();) { final Map.Entry<K, Reference<V>> e = i.next(); if (e.getValue().get() == null) { i.remove(); } } }

Target:
private static <K, V> void prune(Map<K, Reference<V>> map) { for (final Iterator<Map.Entry<K, Reference<V>>> i = map.entrySet() .iterator(); i.hasNext();) { if (i.next().getValue().get() == null) i.remove(); } }
Source:
public DeliveryErrors executeFor(List<InboxMessage> messages) { List<Segment> segments = groupByTargetType(messages); DeliveryErrors.Builder errors = DeliveryErrors.newBuilder(); for (Segment segment : segments) { ShardedMessageDelivery<InboxMessage> delivery = inboxDeliveries.get(segment.typeUrl); List<InboxMessage> deliveryPackage = segment.messages; try { delivery.deliver(deliveryPackage); } catch (RuntimeException exception) { errors.addException(exception); } catch (@SuppressWarnings("ErrorNotRethrown") ModelError error) { errors.addError(error); } } return errors.build(); }

Target:
public DeliveryErrors executeFor(List<InboxMessage> messages) { List<Segment> segments = Segment.groupByTargetType(messages); DeliveryErrors.Builder errors = DeliveryErrors.newBuilder(); for (Segment segment : segments) { ShardedMessageDelivery<InboxMessage> delivery = inboxDeliveries.get(segment.typeUrl()); List<InboxMessage> deliveryPackage = segment.messages(); try { delivery.deliver(deliveryPackage); } catch (RuntimeException exception) { errors.addException(exception); } catch (@SuppressWarnings("ErrorNotRethrown") ModelError error) { errors.addError(error); } } return errors.build(); }
Source:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); int selectedItemLocalId = mAdapter.getSelectedItemLocalId(); if (selectedItemLocalId != 1) { outState.putInt(ARG_LAST_USED_BLOG_LOCAL_ID, mAdapter.getSelectedItemLocalId()); } }

Target:
public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); int selectedItemLocalId = mAdapter.getSelectedItemLocalId(); if (selectedItemLocalId != -1) { outState.putInt(ARG_LAST_USED_BLOG_LOCAL_ID, mAdapter.getSelectedItemLocalId()); } }
Source:
public PrimitiveLongIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { NodeValueIterator nodeValueIterator = new NodeValueIterator(); query( nodeValueIterator, null, predicates ); return nodeValueIterator; }

Target:
public PrimitiveLongIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { NodeValueIterator nodeValueIterator = new NodeValueIterator(); query( nodeValueIterator, IndexOrder.NONE, predicates ); return nodeValueIterator; }
Source:
public HTMLPageAsset getPage(final HttpServletRequest request, final User user, final String uri, final PageMode mode) throws DotSecurityException, DotDataException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = (uri.length()>0 && '/' == uri.charAt(0)) ? uri : ("/" + uri); return (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); }

Target:
public HTMLPageAsset getPage(final HttpServletRequest request, final User user, final String uri, final PageMode mode) throws DotSecurityException, DotDataException { final String siteName = null == request.getParameter(Host.HOST_VELOCITY_VAR_NAME) ? request.getServerName() : request.getParameter(Host.HOST_VELOCITY_VAR_NAME); final Host site = this.hostWebAPI.resolveHostName(siteName, user, RESPECT_FE_ROLES); final String pageUri = URLUtils.addSlashIfNeeded(uri); return (HTMLPageAsset) this.htmlPageAssetAPI.getPageByPath(pageUri, site, this.languageAPI.getDefaultLanguage().getId(), mode.respectAnonPerms); }
Source:
public StringBuilder dateToText( Date date, StringBuilder output ){ DateFormat formatter; if (date.getTime() % 1000 == 0) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); } formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); String text = formatter.format(date); text = text.replace("GMT", ""); output.append( text ); return output; }

Target:
public StringBuilder dateToText( Date date, StringBuilder output ){ final DateFormat formatter; if (date.getTime() % 1000 == 0) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz"); } formatter.setTimeZone(TimeZone.getTimeZone("GMT+00:00")); String text = formatter.format(date); text = text.replace("GMT", ""); output.append( text ); return output; }
Source:
private static String getRandomString() { String alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; Random rand = new Random(); int length = 8; StringBuilder result = new StringBuilder(length); for (int i = 0; i < length; i++) { result.append(alphabet.charAt(rand.nextInt(alphabet.length()))); } return result.toString(); }

Target:
private static String getRandomString() { Random rand = new Random(); StringBuilder result = new StringBuilder(RAND_STR_LEN); for (int i = 0; i < RAND_STR_LEN; i++) { result.append(alphabet.charAt(rand.nextInt(alphabet.length()))); } return result.toString(); }
Source:
public long getLongMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0L; } if (metricValue instanceof Number) { return ((Number) metricValue).longValue(); } else if (metricValue instanceof String) { try { String s = ((String) metricValue).replace(",", ""); return s.contains(".") ? Math.round(Double.valueOf(s)) : Long.valueOf(s); } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }

Target:
public long getLongMetric(String metric) { Object metricValue = event.get(metric); if (metricValue == null) { return 0L; } if (metricValue instanceof Number) { return ((Number) metricValue).longValue(); } else if (metricValue instanceof String) { try { String s = ((String) metricValue).replace(",", ""); return LONG_PAT.matcher(s).matches() ? Long.valueOf(s) : Double.valueOf(s).longValue(); } catch (Exception e) { throw new ParseException(e, "Unable to parse metrics[%s], value[%s]", metric, metricValue); } } else { throw new ParseException("Unknown type[%s]", metricValue.getClass()); } }
Source:
public NetworkDiagnostics( Network network, LinkProperties lp, PrivateDnsConfig privateDnsCfg, long timeoutMs) { mNetwork = network; mLinkProperties = lp; mPrivateDnsCfg = privateDnsCfg; mInterfaceIndex = getInterfaceIndex(mLinkProperties.getInterfaceName()); mTimeoutMs = timeoutMs; mStartTime = now(); mDeadlineTime = mStartTime + mTimeoutMs; if (mLinkProperties.isReachable(TEST_DNS4)) { mLinkProperties.addDnsServer(TEST_DNS4); } if (mLinkProperties.hasGlobalIpv6Address() || mLinkProperties.hasIpv6DefaultRoute()) { mLinkProperties.addDnsServer(TEST_DNS6); } for (RouteInfo route : mLinkProperties.getRoutes()) { if (route.hasGateway()) { InetAddress gateway = route.getGateway(); prepareIcmpMeasurement(gateway); if (route.isIPv6Default()) { prepareExplicitSourceIcmpMeasurements(gateway); } } } for (InetAddress nameserver : mLinkProperties.getDnsServers()) { prepareIcmpMeasurement(nameserver); prepareDnsMeasurement(nameserver); prepareDnsTlsMeasurement("", nameserver); } for (InetAddress tlsNameserver : mPrivateDnsCfg.ips) { if (mLinkProperties.isReachable(tlsNameserver)) { prepareDnsTlsMeasurement(mPrivateDnsCfg.hostname, tlsNameserver); } } mCountDownLatch = new CountDownLatch(totalMeasurementCount()); startMeasurements(); mDescription = "ifaces{" + TextUtils.join(",", mLinkProperties.getAllInterfaceNames()) + "}" + " index{" + mInterfaceIndex + "}" + " network{" + mNetwork + "}" + " nethandle{" + mNetwork.getNetworkHandle() + "}"; }

Target:
public NetworkDiagnostics( Network network, LinkProperties lp, PrivateDnsConfig privateDnsCfg, long timeoutMs) { mNetwork = network; mLinkProperties = lp; mPrivateDnsCfg = privateDnsCfg; mInterfaceIndex = getInterfaceIndex(mLinkProperties.getInterfaceName()); mTimeoutMs = timeoutMs; mStartTime = now(); mDeadlineTime = mStartTime + mTimeoutMs; if (mLinkProperties.isReachable(TEST_DNS4)) { mLinkProperties.addDnsServer(TEST_DNS4); } if (mLinkProperties.hasGlobalIpv6Address() || mLinkProperties.hasIpv6DefaultRoute()) { mLinkProperties.addDnsServer(TEST_DNS6); } for (RouteInfo route : mLinkProperties.getRoutes()) { if (route.hasGateway()) { InetAddress gateway = route.getGateway(); prepareIcmpMeasurement(gateway); if (route.isIPv6Default()) { prepareExplicitSourceIcmpMeasurements(gateway); } } } for (InetAddress nameserver : mLinkProperties.getDnsServers()) { prepareIcmpMeasurement(nameserver); prepareDnsMeasurement(nameserver); prepareDnsTlsMeasurement(null , nameserver); } for (InetAddress tlsNameserver : mPrivateDnsCfg.ips) { if (mLinkProperties.isReachable(tlsNameserver)) { prepareDnsTlsMeasurement(mPrivateDnsCfg.hostname, tlsNameserver); } } mCountDownLatch = new CountDownLatch(totalMeasurementCount()); startMeasurements(); mDescription = "ifaces{" + TextUtils.join(",", mLinkProperties.getAllInterfaceNames()) + "}" + " index{" + mInterfaceIndex + "}" + " network{" + mNetwork + "}" + " nethandle{" + mNetwork.getNetworkHandle() + "}"; }
Source:
public EventProcessor buildEventProcessor() { Objects.requireNonNull(processEvent); Objects.requireNonNull(eventProcessorStore); final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessor(eventHubClientBuilder, this.consumerGroup, getPartitionProcessorSupplier(), EventPosition.earliest(), eventProcessorStore, tracerProvider); }

Target:
public EventProcessor buildEventProcessor() { Objects.requireNonNull(processEvent, "'processEvent' cannot be null"); Objects.requireNonNull(eventProcessorStore, "'eventProcessStore' cannot be null"); Objects.requireNonNull(consumerGroup, "'consumerGroup' cannot be null"); final TracerProvider tracerProvider = new TracerProvider(ServiceLoader.load(Tracer.class)); return new EventProcessor(eventHubClientBuilder, this.consumerGroup, getPartitionProcessorSupplier(), EventPosition.earliest(), eventProcessorStore, tracerProvider); }
Source:
private void updateVertexBuffer(final PointCloud2 pointCloud) { Preconditions.checkArgument(pointCloud.getHeight() == 1); Preconditions.checkArgument(pointCloud.getIsDense()); Preconditions.checkArgument(pointCloud.getFields().size() == 3); Preconditions.checkArgument(pointCloud.getFields().get(0).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(1).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(2).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getPointStep() == 16); Preconditions.checkArgument(pointCloud.getData().order().equals(ByteOrder.LITTLE_ENDIAN)); final int numVertices = (pointCloud.getRowStep() / pointCloud.getPointStep() + 1 ) * 3 ; if (vertexBackBuffer == null || vertexBackBuffer.capacity() < numVertices) { vertexBackBuffer = Vertices.allocateBuffer(numVertices); } vertexBackBuffer.clear(); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); final ChannelBuffer buffer = pointCloud.getData(); while (buffer.readable()) { vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(buffer.readFloat()); buffer.readFloat(); buffer.readFloat(); vertexBackBuffer.put(0.f); } vertexBackBuffer.position(0); synchronized (mutex) { FloatBuffer tmp = vertexFrontBuffer; vertexFrontBuffer = vertexBackBuffer; vertexBackBuffer = tmp; } }

Target:
private void updateVertexBuffer(final PointCloud2 pointCloud) { Preconditions.checkArgument(pointCloud.getHeight() == 1); Preconditions.checkArgument(pointCloud.getIsDense()); Preconditions.checkArgument(pointCloud.getFields().size() == 3); Preconditions.checkArgument(pointCloud.getFields().get(0).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(1).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getFields().get(2).getDatatype() == PointField.FLOAT32); Preconditions.checkArgument(pointCloud.getPointStep() == 16); Preconditions.checkArgument(pointCloud.getData().order().equals(ByteOrder.LITTLE_ENDIAN)); final int numVertices = (pointCloud.getRowStep() / pointCloud.getPointStep() + 1 ) * 3 ; if (vertexBackBuffer == null || vertexBackBuffer.capacity() < numVertices) { vertexBackBuffer = Vertices.allocateBuffer(numVertices); } vertexBackBuffer.clear(); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); vertexBackBuffer.put(0.f); final ChannelBuffer buffer = pointCloud.getData(); while (buffer.readable()) { vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(buffer.readFloat()); vertexBackBuffer.put(0.f); buffer.readFloat(); buffer.readFloat(); } vertexBackBuffer.position(0); synchronized (mutex) { FloatBuffer tmp = vertexFrontBuffer; vertexFrontBuffer = vertexBackBuffer; vertexBackBuffer = tmp; } }
Source:
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, @NonNull Preference preference) { super.onPreferenceTreeClick(preferenceScreen, preference); if (preference instanceof PreferenceScreen) { Dialog prefDialog = ((PreferenceScreen) preference).getDialog(); if (prefDialog != null) { String title = String.valueOf(preference.getTitle()); WPActivityUtils.addToolbarToDialog(this, prefDialog, title); } AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_STREAMS_OPENED); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_DETAILS_OPENED); } if (preference instanceof SwitchPreference&& preference.getKey().equalsIgnoreCase(getString(R.string.wp_pref_notification_receive))) { if (((SwitchPreference) preference).isChecked()) { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_APP_NOTIFICATIONS_ENABLED); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_APP_NOTIFICATIONS_DISABLED); } } return false; }

Target:
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, @NonNull Preference preference) { super.onPreferenceTreeClick(preferenceScreen, preference); if (preference instanceof PreferenceScreen) { Dialog prefDialog = ((PreferenceScreen) preference).getDialog(); if (prefDialog != null) { String title = String.valueOf(preference.getTitle()); WPActivityUtils.addToolbarToDialog(this, prefDialog, title); } AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_STREAMS_OPENED); } else { AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_DETAILS_OPENED); } return false; }
Source:
private static String parseAnnotationFieldTypeName(final Supplier<Class<?>> theTypeSupplier, final String errorMessage) { try { theTypeSupplier.get(); throw new RuntimeException(errorMessage); } catch (MirroredTypeException mte) { return mte.getTypeMirror().toString(); } }

Target:
private static String parseAnnotationFieldTypeName(final Supplier<Class<?>> theTypeSupplier, final String errorMessage) { try { theTypeSupplier.get(); } catch (MirroredTypeException mte) { return mte.getTypeMirror().toString(); } throw new RuntimeException(errorMessage); }
Source:
private void validateConfiguration(MaintenanceConfiguration configuration) { Stream.of(configuration.archiveWorkflows, configuration.deleteArchivedWorkflows, configuration.deleteWorkflows) .filter(Objects::nonNull) .flatMap(configItem -> configItem.workflowTypes.stream()) .forEach(workflowType -> { if (workflowDefinitionService.getWorkflowDefinition(workflowType) == null) { throw new IllegalArgumentException("Workflow type " + workflowType + " is not valid"); } }); }

Target:
private void validateConfiguration(MaintenanceConfiguration configuration) { Stream.of(configuration.archiveWorkflows, configuration.deleteArchivedWorkflows, configuration.deleteWorkflows) .filter(Objects::nonNull) .flatMap(configItem -> configItem.workflowTypes.stream()) .filter(workflowType -> workflowDefinitionService.getWorkflowDefinition(workflowType) == null) .findAny() .ifPresent(workflowType -> { throw new IllegalArgumentException("Workflow type " + workflowType + " is not valid"); }); }
Source:
private void onExecute() { if (getProgress() != null) { return; } startProgress(); for (DiskModel item : getDisks()) { DiskImage disk = (DiskImage) item.getDisk(); if (item.getQuota().getSelectedItem() != null) { disk.setQuotaId(item.getQuota().getSelectedItem().getId()); } List<VdcActionParametersBase> parameters = new ArrayList<>(); RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(disk, disk.getStorageIds().get(0)); registerDiskParams.setRefreshFromStorage(true); parameters.add(registerDiskParams); Frontend.getInstance().runMultipleAction(VdcActionType.RegisterDisk, parameters); } stopProgress(); getCancelCommand().execute(); }

Target:
private void onExecute() { if (getProgress() != null) { return; } startProgress(); for (DiskModel item : getDisks()) { DiskImage disk = (DiskImage) item.getDisk(); if (item.getQuota().getSelectedItem() != null) { disk.setQuotaId(item.getQuota().getSelectedItem().getId()); } RegisterDiskParameters registerDiskParams = new RegisterDiskParameters(disk, disk.getStorageIds().get(0)); registerDiskParams.setRefreshFromStorage(true); Frontend.getInstance().runMultipleAction(VdcActionType.RegisterDisk, Arrays.asList(registerDiskParams)); } stopProgress(); getCancelCommand().execute(); }
Source:
public IArtifactType getArtifactType(IAtsWorkItem workItem) { return ((ArtifactReadable) workItem.getStoreObject()).getArtifactType(); }

Target:
public IArtifactType getArtifactType(IAtsWorkItem workItem) { Assert.isNotNull(workItem, "Work Item can not be null"); return ((ArtifactReadable) workItem.getStoreObject()).getArtifactType(); }
Source:
public DnsException(DnsResponseCode code) { super(String.format(ERROR_MESSAGE_TEMPLATE, code)); Objects.requireNonNull(code, "code"); this.code = code; }

Target:
public DnsException(DnsResponseCode code) { super(ERROR_MESSAGE_PREFIX + code); Objects.requireNonNull(code, "code"); this.code = code; }
Source:
public void show(String indent, LogLevel logLevel) { final String[] eschelonNames = { "Element", "Squad", "(2)", "Lance", "Company", "Battalion", "Regiment", "Brigade", "Division", "Corps", "Army" }; final String[] airEschelonNames = { "Element", "(1)", "(2)", "Flight", "Squadron", "Group", "Wing", "Regiment" }; MegaMek.getLogger().log(logLevel, indent + weightClass + " " + unitType + " " + ((unitType == UnitType.AERO || unitType == UnitType.CONV_FIGHTER)?airEschelonNames[eschelon]:eschelonNames[eschelon]), null); for (ForceDescriptor sub : subforces) { sub.show(indent + " ", logLevel); } for (ForceDescriptor sub : attached) { sub.show(indent + " +", logLevel); } }

Target:
public void show(String indent, LogLevel logLevel) { final String[] eschelonNames = { "Element", "Squad", "(2)", "Lance", "Company", "Battalion", "Regiment", "Brigade", "Division", "Corps", "Army" }; final String[] airEschelonNames = { "Element", "(1)", "(2)", "Flight", "Squadron", "Group", "Wing", "Regiment" }; MegaMek.getLogger().log(logLevel, indent + weightClass + " " + unitType + " " + (((unitType == UnitType.AERO) || (unitType == UnitType.CONV_FIGHTER)) ? airEschelonNames[eschelon] : eschelonNames[eschelon]), null); for (ForceDescriptor sub : subforces) { sub.show(indent + " ", logLevel); } for (ForceDescriptor sub : attached) { sub.show(indent + " +", logLevel); } }
Source:
public void downloadBlob(HttpServletRequest request, HttpServletResponse response, String key, String reason) throws IOException { TransientStore ts = Framework.getService(TransientStoreService.class).getStore(EVENT_NAME); try { List<Blob> blobs = ts.getBlobs(key); if (blobs == null) { throw new IllegalArgumentException("no such blobs referenced with " + key); } if (blobs.size() > 1) { throw new IllegalArgumentException("multipart download not yet implemented"); } Blob blob = blobs.get(0); downloadBlob(request, response, null, null, blob, blob.getFilename(), reason); } finally { ts.remove(key); } }

Target:
public void downloadBlob(HttpServletRequest request, HttpServletResponse response, String key, String reason) throws IOException { TransientStore ts = Framework.getService(TransientStoreService.class).getStore("download"); try { List<Blob> blobs = ts.getBlobs(key); if (blobs == null) { throw new IllegalArgumentException("no such blobs referenced with " + key); } if (blobs.size() > 1) { throw new IllegalArgumentException("multipart download not yet implemented"); } Blob blob = blobs.get(0); downloadBlob(request, response, null, null, blob, blob.getFilename(), reason); } finally { ts.remove(key); } }
Source:
protected String readDescription(final Module module) { final Path root = module.getRootPath(); final POM pom = module.getPom(); final org.uberfire.java.nio.file.Path nioRoot = Paths.convert(root); final org.uberfire.java.nio.file.Path nioDescription = nioRoot.resolve(PROJECT_DESCRIPTON); String description = "Example '" + module.getModuleName() + "' module"; if (ioService.exists(nioDescription)) { description = ioService.readAllString(nioDescription); } else if (pom != null && pom.getDescription() != null && !pom.getDescription().isEmpty()) { description = pom.getDescription(); } if (description != null) { return description.replaceAll("[\\s]+", " "); } return description; }

Target:
protected String readDescription(final Module module) { final Path root = module.getRootPath(); final POM pom = module.getPom(); final org.uberfire.java.nio.file.Path nioRoot = Paths.convert(root); final org.uberfire.java.nio.file.Path nioDescription = nioRoot.resolve(PROJECT_DESCRIPTON); String description = "Example '" + module.getModuleName() + "' module"; if (ioService.exists(nioDescription)) { description = ioService.readAllString(nioDescription); } else if (pom != null && pom.getDescription() != null && !pom.getDescription().isEmpty()) { description = pom.getDescription(); } if (description != null) { return description.replaceAll("\\s+", " "); } return description; }
Source:
public void request(long n) { if (!SubscriptionHelper.validate(n)) { return; } while (true) { long r = get(); if (r == limit) { return; } long r2 = r + n; final long more; if (r2 < 0) { r2 = limit; more = limit - r; } else { r2 = Math.min(limit, r2); more = r2 - r; } if (compareAndSet(r, r2)) { upstream.request(more); break; } } }

Target:
public void request(long n) { if (SubscriptionHelper.validate(n)) { for (;;) { long r = get(); if (r == 0L) { break; } long toRequest; if (r <= n) { toRequest = r; } else { toRequest = n; } long u = r - toRequest; if (compareAndSet(r, u)) { upstream.request(toRequest); break; } } } }
Source:
public void enterVolumeName(String name) { seleniumWebDriverHelper.waitVisibility(newVolumeName).clear(); seleniumWebDriverHelper.waitVisibility(newVolumeName).sendKeys(name); }

Target:
public void enterVolumeName(String name) { seleniumWebDriverHelper.setValue(newVolumeNameElement, name); }
Source:
private ITmfStateValue getMappedValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo, ITmfStateValue value) { try { if (fContainer instanceof XmlPatternStateProvider) { Set<TmfXmlMapEntry> group = ((XmlPatternStateProvider) fContainer).getMappingGroup(fMappingGroup); if (group != null) { for (TmfXmlMapEntry entry : group) { if (entry.getKey().getValue(event, scenarioInfo).equals(value)) { return entry.getValue().getValue(event, scenarioInfo); } } } } return value; } catch (AttributeNotFoundException e) { Activator.logError("Unable to map the state value"); return TmfStateValue.nullValue(); } }

Target:
private ITmfStateValue getMappedValue(@Nullable ITmfEvent event, @Nullable TmfXmlScenarioInfo scenarioInfo, ITmfStateValue value) { try { Set<TmfXmlMapEntry> group = null; if (fContainer instanceof XmlPatternStateProvider) { group = ((XmlPatternStateProvider) fContainer).getMappingGroup(fMappingGroup); } else if (fContainer instanceof XmlStateProvider) { group = ((XmlStateProvider) fContainer).getMappingGroup(fMappingGroup); } if (group != null) { for (TmfXmlMapEntry entry : group) { if (entry.getKey().getValue(event, scenarioInfo).equals(value)) { return entry.getValue().getValue(event, scenarioInfo); } } } return value; } catch (AttributeNotFoundException e) { Activator.logError("Unable to map the state value"); return TmfStateValue.nullValue(); } }
Source:
String getLastToken() { long value = sequence.get(); return prefix + format("%010x", value - 1); }

Target:
String getLastToken() { long value = sequence.get(); return createToken(value - 1); }
Source:
public long skip(long n) { if (n > 0) { long skip = bytes.length - pos; if (skip > n) skip = n; pos += skip; return skip; } else { int idx = Math.min(bytes.length, pos); long skip = idx + n; pos = (int) skip; return skip; } }

Target:
public long skip(long n) { if (n > 0) { long skip = bytes.length - pos; if (skip > n) skip = n; pos += skip; return skip; } else { int idx = Math.min(bytes.length, pos); long skip = idx + n; pos = (int) Math.max(skip, offset); return skip; } }