auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void wizardCompletedPoints(IAtsTeamWorkflow teamWf, IAtsTeamDefinition teamDef, IAtsChangeSet changes) { ArtifactToken agileTeamArt = AtsClientService.get().getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); if (agileTeamArt != null) { IAgileTeam agileTeam = AtsClientService.get().getConfigItemFactory().getAgileTeam(agileTeamArt); AttributeTypeId agileTeamPointsAttributeType = AtsClientService.get().getAgileService().getAgileTeamPointsAttributeType(agileTeam); XWidget widget = (XWidget) teamDefFieldToWidget.get(teamDef, agileTeamPointsAttributeType.equals( AtsAttributeTypes.Points) ? WizardFields.Points : WizardFields.PointsNumeric); if (widget != null) { String points = null; if (widget instanceof XFloat) { XFloat xFloat = (XFloat) widget; points = xFloat.get(); } else if (widget instanceof XInteger) { XInteger xInteger = (XInteger) widget; points = xInteger.get(); } if (Strings.isValid(points) && Strings.isNumeric(points)) { <START> changes.setSoleAttributeFromString(teamWf, agileTeamPointsAttributeType, points); <END> } } } }</code><technical_language>setSoleAttributeValue object method a numeric attribute set a string</technical_language>

Target:
private void wizardCompletedPoints(IAtsTeamWorkflow teamWf, IAtsTeamDefinition teamDef, IAtsChangeSet changes) { ArtifactToken agileTeamArt = AtsClientService.get().getRelationResolver().getRelatedOrNull(teamDef, AtsRelationTypes.AgileTeamToAtsTeam_AgileTeam); if (agileTeamArt != null) { IAgileTeam agileTeam = AtsClientService.get().getConfigItemFactory().getAgileTeam(agileTeamArt); AttributeTypeId agileTeamPointsAttributeType = AtsClientService.get().getAgileService().getAgileTeamPointsAttributeType(agileTeam); XWidget widget = (XWidget) teamDefFieldToWidget.get(teamDef, agileTeamPointsAttributeType.equals( AtsAttributeTypes.Points) ? WizardFields.Points : WizardFields.PointsNumeric); if (widget != null) { if (widget instanceof XFloat) { XFloat xFloat = (XFloat) widget; String pointsStr = xFloat.get(); if (Strings.isNumeric(pointsStr)) { Double points = Double.valueOf(pointsStr); changes.setSoleAttributeValue(teamWf, agileTeamPointsAttributeType, points); } } else if (widget instanceof XComboViewer) { XComboViewer pointsCombo = (XComboViewer) widget; String pointsStr = (String) pointsCombo.getSelected(); if (Strings.isValid(pointsStr)) { changes.setSoleAttributeValue(teamWf, agileTeamPointsAttributeType, pointsStr); } } } } }
Source:
<code>private @Nullable ByteBuffer skipISBBlockUntilDataPacket(int blockType, SeekableByteChannel fileChannel) throws BadPcapFileException { final String errorMsg = "A pcapng file is invalid"; ByteBuffer pcapNgBlockHeader = null; int blockLength = 0; int typeBlock = 0; <START> pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); <END> pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); while (typeBlock != PcapFileValues.PCAPNG_EPB && typeBlock != PcapFileValues.PCAPNG_PB && typeBlock == blockType && typeBlock != PcapFileValues.PCAPNG_SPB) { try { fileChannel.position(fileChannel.position() + blockLength - PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_PACKET_HEADER_SIZE); pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); } setBlockLength(blockLength); setBlocType(typeBlock); return pcapNgBlockHeader; }</code><technical_language>next block is a packet. 28 bytes</technical_language>

Target:
private @Nullable ByteBuffer skipISBBlockUntilDataPacket(int blockType, SeekableByteChannel fileChannel) throws BadPcapFileException { final String errorMsg = "A pcapng file is invalid"; ByteBuffer pcapNgBlockHeader = null; int blockLength = 0; int typeBlock = 0; try { if (fileChannel.size() - fileChannel.position() < PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE) { return null; } } catch (IOException e1) { e1.printStackTrace(); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); while (typeBlock != PcapFileValues.PCAPNG_EPB && typeBlock != PcapFileValues.PCAPNG_PB && typeBlock != PcapFileValues.PCAPNG_SPB) { try { fileChannel.position(fileChannel.position() + blockLength - PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader = ByteBuffer.allocate(PcapFileValues.PCAPNG_BLOCK_HEADER_SIZE); pcapNgBlockHeader.clear(); pcapNgBlockHeader.order(getByteOrder()); try { fileChannel.read(pcapNgBlockHeader); } catch (IOException e) { throw new BadPcapFileException(errorMsg, e); } pcapNgBlockHeader.flip(); typeBlock = pcapNgBlockHeader.getInt(); blockLength = pcapNgBlockHeader.getInt(); } setBlockLength(blockLength); setBlocType(typeBlock); return pcapNgBlockHeader; }
Source:
<code>protected void recalculateButtonsAvailability(final ISelection selection, final SlaveObjectAxisProvider slave) { if (null != selection && !selection.isEmpty()) { removeAxis.setEnabled(true); int firstPosition = -1; int lastPosition = -1; if (selection instanceof StructuredSelection) { <START> Iterator<?> selectedObjects = ((StructuredSelection) selection).iterator(); <END> while (selectedObjects.hasNext()) { final Object selectedObject = selectedObjects.next(); final int objectPosition = slave.getAxis().indexOf(selectedObject); if (-1 == firstPosition || objectPosition < firstPosition) { firstPosition = objectPosition; } if (objectPosition > lastPosition) { lastPosition = objectPosition; } } } upAxis.setEnabled(firstPosition != 0); downAxis.setEnabled(lastPosition < slave.getAxis().size() - 1); } else { removeAxis.setEnabled(false); upAxis.setEnabled(false); downAxis.setEnabled(false); } }</code><technical_language>final</technical_language>

Target:
protected void recalculateButtonsAvailability(final ISelection selection, final SlaveObjectAxisProvider slave) { if (null != selection && !selection.isEmpty()) { removeAxis.setEnabled(true); int firstPosition = -1; int lastPosition = -1; if (selection instanceof StructuredSelection) { final Iterator<?> selectedObjects = ((StructuredSelection) selection).iterator(); while (selectedObjects.hasNext()) { final Object selectedObject = selectedObjects.next(); final int objectPosition = slave.getAxis().indexOf(selectedObject); if (-1 == firstPosition || objectPosition < firstPosition) { firstPosition = objectPosition; } if (objectPosition > lastPosition) { lastPosition = objectPosition; } } } upAxis.setEnabled(firstPosition != 0); downAxis.setEnabled(lastPosition < slave.getAxis().size() - 1); } else { removeAxis.setEnabled(false); upAxis.setEnabled(false); downAxis.setEnabled(false); } }
Source:
<code>private boolean isDataCenterValidForAttachedStorageDomains() { StoragePool storagePool = getDbFacade().getStoragePoolDao().get(getParameters().getId()); if ((storagePool != null) && storagePool.getStatus() != StoragePoolStatus.Up) { log.info("The attach of the Storage Domain is being done on a Data Center which is not in UP status." + <START> " The query for attached Storage Domain will not be excuted"); <END> return false; } return true; }</code><technical_language>"The attach of ..." - relevant here. This is a query. "Data Center XYZ is - returning null"</technical_language>

Target:
private boolean isDataCenterValidForAttachedStorageDomains() { StoragePool storagePool = getDbFacade().getStoragePoolDao().get(getParameters().getId()); if ((storagePool == null) || (storagePool.getStatus() != StoragePoolStatus.Up)) { log.info("The Data Center is not in UP status."); return false; } return true; }
Source:
<code>protected String getOperationId(Method method, String httpMethod) { if (isUseEnhancedOperationId()) { <START> return method.getDeclaringClass().getSimpleName() + "_" + method.getName() + "_" + httpMethod; <END> } else { return method.getName(); } }</code><technical_language>Ok ${} option format is bad conflicts maven variables ... else, get idea</technical_language>

Target:
protected String getOperationId(Method method, String httpMethod) { if (this.operationIdFormat == null) { this.operationIdFormat = OPERATION_ID_FORMAT_DEFAULT; } String packageName = method.getDeclaringClass().getPackage().getName(); String className = method.getDeclaringClass().getSimpleName(); String methodName = method.getName(); StrBuilder sb = new StrBuilder(this.operationIdFormat); sb.replaceAll("{{packageName}}", packageName); sb.replaceAll("{{className}}", className); sb.replaceAll("{{methodName}}", methodName); sb.replaceAll("{{httpMethod}}", httpMethod); return sb.toString(); }
Source:
<code>public void shouldRemoveNodeFromExplicitIndex() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { <START> IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, "this is it" ); <END> assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }</code><technical_language>Magic string, static</technical_language>

Target:
public void shouldRemoveNodeFromExplicitIndex() throws Exception { long nodeId = addNodeToExplicitIndex(); try ( Transaction tx = session.beginTransaction() ) { ExplicitIndexWrite indexWrite = tx.indexWrite(); indexWrite.nodeRemoveFromExplicitIndex( INDEX_NAME, nodeId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { IndexHits<Node> hits = graphDb.index().forNodes( INDEX_NAME ).get( KEY, VALUE ); assertFalse( hits.hasNext() ); hits.close(); ctx.success(); } }
Source:
<code>private void setInizialStateWithLastCallScenes() { <START> if (sceneMan != null) { <END> JsonObject response = connMan.getDigitalSTROMAPI().query2(connMan.getSessionToken(), LAST_CALL_SCENE_QUERY); if (response.isJsonObject()) { for (Entry<String, JsonElement> entry : response.entrySet()) { if (entry.getValue().isJsonObject()) { JsonObject zone = entry.getValue().getAsJsonObject(); int zoneID = -1; short groupID = -1; short sceneID = -1; if (zone.get(JSONApiResponseKeysEnum.ZONE_ID.getKey()) != null) { zoneID = zone.get(JSONApiResponseKeysEnum.ZONE_ID.getKey()).getAsInt(); } for (Entry<String, JsonElement> groupEntry : zone.entrySet()) { if (groupEntry.getKey().startsWith("group") && groupEntry.getValue().isJsonObject()) { JsonObject group = groupEntry.getValue().getAsJsonObject(); if (group.get(JSONApiResponseKeysEnum.DEVICES.getKey()) != null) { if (group.get(JSONApiResponseKeysEnum.GROUP.getKey()) != null) { groupID = group.get(JSONApiResponseKeysEnum.GROUP.getKey()).getAsShort(); } if (group.get(JSONApiResponseKeysEnum.LAST_CALL_SCENE.getKey()) != null) { sceneID = group.get(JSONApiResponseKeysEnum.LAST_CALL_SCENE.getKey()) .getAsShort(); } if (zoneID > -1 && groupID > -1 && sceneID > -1) { logger.debug( "inizial state, call scene " + zoneID + "-" + groupID + "-" + sceneID); sceneMan.callInternalSceneWithoutDiscovery(zoneID, groupID, sceneID); } } } } } } } } }</code><technical_language>early return saves a lot of indentation</technical_language>

Target:
private void setInizialStateWithLastCallScenes() { if (sceneMan == null) { return; } JsonObject response = connMan.getDigitalSTROMAPI().query2(connMan.getSessionToken(), LAST_CALL_SCENE_QUERY); if (!response.isJsonObject()) { return; } for (Entry<String, JsonElement> entry : response.entrySet()) { if (!entry.getValue().isJsonObject()) { continue; } JsonObject zone = entry.getValue().getAsJsonObject(); int zoneID = -1; short groupID = -1; short sceneID = -1; if (zone.get(JSONApiResponseKeysEnum.ZONE_ID.getKey()) != null) { zoneID = zone.get(JSONApiResponseKeysEnum.ZONE_ID.getKey()).getAsInt(); } for (Entry<String, JsonElement> groupEntry : zone.entrySet()) { if (groupEntry.getKey().startsWith("group") && groupEntry.getValue().isJsonObject()) { JsonObject group = groupEntry.getValue().getAsJsonObject(); if (group.get(JSONApiResponseKeysEnum.DEVICES.getKey()) != null) { if (group.get(JSONApiResponseKeysEnum.GROUP.getKey()) != null) { groupID = group.get(JSONApiResponseKeysEnum.GROUP.getKey()).getAsShort(); } if (group.get(JSONApiResponseKeysEnum.LAST_CALL_SCENE.getKey()) != null) { sceneID = group.get(JSONApiResponseKeysEnum.LAST_CALL_SCENE.getKey()).getAsShort(); } if (zoneID > -1 && groupID > -1 && sceneID > -1) { logger.debug("initial state, call scene {}-{}-{}", zoneID, groupID, sceneID); sceneMan.callInternalSceneWithoutDiscovery(zoneID, groupID, sceneID); } } } } } }
Source:
<code>public List<Action> getActionLinks(BusinessObjectBase businessObject, Person user) { BatchFile batchFile = (BatchFile) businessObject; List<Action> actionLinks = new LinkedList<>(); if (canCreateDoneFile(batchFile, user)) { <START> actionLinks.add(new Action("Create Done", "GET", getCreateDoneUrl(batchFile))); <END> } return actionLinks; }</code><technical_language>This update remove "kr/" prefix generated URL. Is this intentional? extra prefix of create-done-file issues</technical_language>

Target:
public List<Action> getActionLinks(BusinessObjectBase businessObject, Person user) { BatchFile batchFile = (BatchFile) businessObject; List<Action> actionLinks = new LinkedList<>(); if (canCreateDoneFile(batchFile, user)) { actionLinks.add(new Action("Create Done", "GET", KRAD_URL_PREFIX + getCreateDoneUrl(batchFile))); } return actionLinks; }
Source:
<code><START> public void saveOrder_shouldPassForADiscontinuationOrderWithNoPreviousOrder() { <END> String fulfillerComment ="Some example comment"; TestOrder dcOrder = new TestOrder(); dcOrder.setAction(Action.DISCONTINUE); dcOrder.setPatient(patientService.getPatient(2)); dcOrder.setCareSetting(orderService.getCareSetting(2)); dcOrder.setConcept(conceptService.getConcept(5089)); dcOrder.setEncounter(encounterService.getEncounter(6)); dcOrder.setOrderer(providerService.getProvider(1)); dcOrder.setFulfillerStatus(Order.FulfillerStatus.RECEIVED); dcOrder.setFulfillerComment(fulfillerComment); int order_id = orderService.saveOrder(dcOrder, null).getId(); Order savedOrder = orderService.getOrder(order_id); assertEquals(savedOrder.getFulfillerStatus(), Order.FulfillerStatus.RECEIVED); assertEquals(savedOrder.getFulfillerComment(), fulfillerComment); }</code><technical_language>I correct test of in OrderIntegrationTest, possibly shouldPlaceADrugOrder()</technical_language>

Target:
public void saveOrder_shouldPassForADiscontinuationOrderWithNoPreviousOrder() { TestOrder dcOrder = new TestOrder(); dcOrder.setAction(Action.DISCONTINUE); dcOrder.setPatient(patientService.getPatient(2)); dcOrder.setCareSetting(orderService.getCareSetting(2)); dcOrder.setConcept(conceptService.getConcept(5089)); dcOrder.setEncounter(encounterService.getEncounter(6)); dcOrder.setOrderer(providerService.getProvider(1)); orderService.saveOrder(dcOrder, null); }
Source:
<code>private void onCtrlMsgIdRange(final AvroElasticMemoryMessage msg, final TraceScope parentTraceInfo) { <START> final String operationId = msg.getOperationId().toString(); <END> final CtrlMsg ctrlMsg = msg.getCtrlMsg(); final String dataType = ctrlMsg.getDataType().toString(); final Codec codec = serializer.getCodec(dataType); final Set<Map<Long, Object>> idObjectMapSet = new HashSet<>(); int numObject = 0; for (final AvroLongRange avroLongRange : ctrlMsg.getIdRange()) { final Map<Long, Object> idObjectMap = memoryStore.getElasticStore().getRange(dataType, avroLongRange.getMin(), avroLongRange.getMax()); numObject += idObjectMap.size(); idObjectMapSet.add(idObjectMap); } final Set<Long> ids = new HashSet<>(); final List<UnitIdPair> unitIdPairList = new ArrayList<>(numObject); for (final Map<Long, Object> idObjectMap : idObjectMapSet) { for (final Map.Entry<Long, Object> idObject : idObjectMap.entrySet()) { final long id = idObject.getKey(); final UnitIdPair unitIdPair = UnitIdPair.newBuilder() .setUnit(ByteBuffer.wrap(codec.encode(idObject.getValue()))) .setId(id) .build(); unitIdPairList.add(unitIdPair); ids.add(id); } } pendingUpdates.put(operationId, new RemoveInfo(dataType, ids)); sender.get().sendDataMsg(msg.getDestId().toString(), ctrlMsg.getDataType().toString(), unitIdPairList, operationId, TraceInfo.fromSpan(parentTraceInfo.getSpan())); }</code><technical_language>Do operationType in message</technical_language>

Target:
private void onCtrlMsgIdRange(final AvroElasticMemoryMessage msg, final TraceScope parentTraceInfo) { final String operationId = msg.getOperationId().toString(); final CtrlMsg ctrlMsg = msg.getCtrlMsg(); final String dataType = ctrlMsg.getDataType().toString(); final Codec codec = serializer.getCodec(dataType); final List<UnitIdPair> unitIdPairList = new ArrayList<>(); final SortedSet<Long> ids = new TreeSet<>(); for (final AvroLongRange avroLongRange : ctrlMsg.getIdRange()) { final Map<Long, Object> idObjectMap = memoryStore.getElasticStore().getRange(dataType, avroLongRange.getMin(), avroLongRange.getMax()); for (final Map.Entry<Long, Object> idObject : idObjectMap.entrySet()) { final long id = idObject.getKey(); if (!isMoving(id)) { final UnitIdPair unitIdPair = UnitIdPair.newBuilder() .setUnit(ByteBuffer.wrap(codec.encode(idObject.getValue()))) .setId(id) .build(); unitIdPairList.add(unitIdPair); ids.add(id); } } } if (ids.size() == 0) { final String myId = msg.getDestId().toString(); final String reason = new StringBuilder() .append("No data is movable in ").append(myId) .append(" of type ").append(dataType) .append(". Requested ranges: ").append(Arrays.toString(ctrlMsg.getIdRange().toArray())) .toString(); sender.get().sendFailureMsg(operationId, reason, TraceInfo.fromSpan(parentTraceInfo.getSpan())); return; } final Set<LongRange> ranges = LongRangeUtils.generateDenseLongRanges(ids); pendingUpdates.put(operationId, new Remove(dataType, ranges)); movingRanges.addAll(ranges); sender.get().sendDataMsg(msg.getDestId().toString(), ctrlMsg.getDataType().toString(), unitIdPairList, operationId, TraceInfo.fromSpan(parentTraceInfo.getSpan())); }
Source:
<code>public static AlluxioURI findLowestCommonAncestor(Collection<AlluxioURI> paths) { if (paths == null || paths.isEmpty()) { return null; <START> } <END> List<String> matchedComponents = null; int matchedLen = 0; for (AlluxioURI path : paths) { String[] pathComp = path.getPath().split(AlluxioURI.SEPARATOR); if (matchedComponents == null) { matchedComponents = new ArrayList<>(Arrays.asList(pathComp)); matchedLen = pathComp.length; } for (int i = 0; i < pathComp.length && i < matchedLen; ++i) { if (!matchedComponents.get(i).equals(pathComp[i])) { matchedLen = i; break; } } } AlluxioURI lca = new AlluxioURI(AlluxioURI.SEPARATOR); return new AlluxioURI( PathUtils.concatPath(lca, matchedComponents.subList(0, matchedLen).toArray())); }</code><technical_language>Do if is common rare 1 path in paths</technical_language>

Target:
public static AlluxioURI findLowestCommonAncestor(Collection<AlluxioURI> paths) { if (paths == null || paths.isEmpty()) { return null; } List<String> matchedComponents = null; int matchedLen = 0; for (AlluxioURI path : paths) { String[] pathComp = path.getPath().split(AlluxioURI.SEPARATOR); if (matchedComponents == null) { matchedComponents = new ArrayList<>(Arrays.asList(pathComp)); matchedLen = pathComp.length; } for (int i = 0; i < pathComp.length && i < matchedLen; ++i) { if (!matchedComponents.get(i).equals(pathComp[i])) { matchedLen = i; break; } } } return new AlluxioURI(PathUtils.concatPath(AlluxioURI.SEPARATOR, matchedComponents.subList(0, matchedLen).toArray())); }
Source:
<code>public boolean equals(Object o) { <START> if (this == o) return true; <END> if (o == null || getClass() != o.getClass()) return false; CommentImpl comment = (CommentImpl) o; return Objects.equals(id, comment.id) && Objects.equals(parentId, comment.parentId) && Objects.equals(ancestorIds, comment.ancestorIds) && Objects.equals(author, comment.author) && Objects.equals(text, comment.text) && Objects.equals(creationDate, comment.creationDate) && Objects.equals(modificationDate, comment.modificationDate) && Objects.equals(entityId, comment.entityId) && Objects.equals(origin, comment.origin) && Objects.equals(entity, comment.entity); }</code><technical_language>commons-lang for ? For instance: return EqualsBuilder.reflectionEquals(this, o);</technical_language>

Target:
public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); }
Source:
<code>public Map<NodeRef<Expression>, Type> getTypes() { <START> return types; <END> }</code><technical_language>is dropping defensive copying intentional? Why</technical_language>

Target:
public Map<NodeRef<Expression>, Type> getTypes() { return unmodifiableMap(types); }
Source:
<code>protected Iterable<Text> getLines(int page) throws CommandException { if (this.pages.size() == 0) { return ImmutableList.of(); } else if (page < 1) { throw new CommandException(t("Page %s does not exist!", page)); } else if (page > this.pages.size()) { <START> throw new CommandException(t("Page %s is too high!", page)); <END> } return this.pages.get(page - 1); }</code><technical_language>Include maximum page? "Page %s is greater %s."</technical_language>

Target:
protected Iterable<Text> getLines(int page) throws CommandException { final int size = this.pages.size(); if (size == 0) { return ImmutableList.of(); } else if (page < 1) { throw new CommandException(t("Page %s does not exist!", page)); } else if (page > size) { throw new CommandException(t("Page %s is greater than the max of %s!", page, size)); } return this.pages.get(page - 1); }
Source:
<code>private boolean validateRemovePipelines(CruiseConfig preprocessedConfig) { EnvironmentConfig preprocessedEnvironmentConfig = preprocessedConfig.getEnvironments().find(environmentConfig.name()); if(preprocessedEnvironmentConfig instanceof MergeEnvironmentConfig){ for (String pipelineToRemove : pipelinesToRemove) { if(preprocessedEnvironmentConfig.containsPipelineRemotely(new CaseInsensitiveString(pipelineToRemove))){ <START> String message = String.format("Can not remove pipeline '%s'. As it is defined remotely in environment '%s'", pipelineToRemove, environmentConfig.name()); <END> result.badRequest(actionFailed.addParam(message)); return false; } } } EnvironmentConfig environmentConfig = this.environmentConfig; for (String pipelineToRemove : pipelinesToRemove) { if(!environmentConfig.containsPipeline(new CaseInsensitiveString(pipelineToRemove))){ String message = String.format("Pipeline '%s' does not exist in environment '%s'", pipelineToRemove, environmentConfig.name()); result.badRequest(actionFailed.addParam(message)); return false; } } return true; }</code><technical_language>Pipeline '%s' removed environment '%s' association defined remotely in [<getOrigin().displayName()>] sound better? similar for agent message too</technical_language>

Target:
private boolean validateRemovePipelines(CruiseConfig preprocessedConfig) { EnvironmentConfig preprocessedEnvironmentConfig = preprocessedConfig.getEnvironments().find(environmentConfig.name()); if(preprocessedEnvironmentConfig instanceof MergeEnvironmentConfig){ for (String pipelineToRemove : pipelinesToRemove) { if(preprocessedEnvironmentConfig.containsPipelineRemotely(new CaseInsensitiveString(pipelineToRemove))){ String origin = ((MergeEnvironmentConfig) preprocessedEnvironmentConfig).getOriginForPipeline(new CaseInsensitiveString(pipelineToRemove)).displayName(); String message = String.format("Pipeline '%s' cannot be removed from environment '%s' as the association has been defined remotely in [%s]", pipelineToRemove, environmentConfig.name(), origin); result.badRequest(actionFailed.addParam(message)); return false; } } } EnvironmentConfig environmentConfig = this.environmentConfig; for (String pipelineToRemove : pipelinesToRemove) { if(!environmentConfig.containsPipeline(new CaseInsensitiveString(pipelineToRemove))){ String message = String.format("Pipeline '%s' does not exist in environment '%s'", pipelineToRemove, environmentConfig.name()); result.badRequest(actionFailed.addParam(message)); return false; } } return true; }
Source:
<code>public T readFrom(final Class<T> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { <START> if (entityStream.markSupported()) { <END> entityStream.mark(1); if (entityStream.read() == -1) { throw new NoContentException("Johnzon cannot parse empty input stream"); } entityStream.reset(); } else { final PushbackInputStream buffer = new PushbackInputStream(entityStream); int firstByte = buffer.read(); if (firstByte == -1) { throw new NoContentException("Johnzon cannot parse empty input stream"); } buffer.unread(firstByte); entityStream = buffer; } return getJsonb(type).fromJson(entityStream, genericType); }</code><technical_language>1. solved a bench mainstream is markable (only payara?) citizen probably? 2. benefit is speed, overhead in O(1) O(size of stream) (you bench small, medium, huge streams) 3. this is hard slow ;). main point is slow a stream more do already, is slowest part try handle a case (literally) overhead in O(n) is negative for real users. 4. I didnt read answer :D</technical_language>

Target:
public T readFrom(final Class<T> type, final Type genericType, final Annotation[] annotations, final MediaType mediaType, final MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException { try { return getJsonb(type).fromJson(entityStream, genericType); } catch (final NothingToRead e) { throw new NoContentException(e); } }
Source:
<code>public void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff) { MultiplicityElementChange refChange = (MultiplicityElementChange)extension; DifferenceSource differenceSource = refChange.getSource(); if (differenceSource == refiningDiff.getSource()) { if (refiningDiff.getRefines().isEmpty()) { refChange.getRefinedBy().add(refiningDiff); } else { <START> refChange.getRefinedBy().addAll( <END> Collections2.filter(refiningDiff.getRefines(), not(equalTo((Diff)refChange)))); } updateReferenceKind(refChange, refiningDiff); collectAndAddOtherRefiningDiffs(refChange, refiningDiff); } }</code><technical_language>Is is voluntary add refiningDiff refChanges</technical_language>

Target:
public void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff) { if (refiningDiff.getSource() == extension.getSource()) { addRefiningDiffAndDependencies(extension, refiningDiff); for (Diff otherRefiningDiff : getRefiningDiffsOnSameSide(refiningDiff)) { addRefiningDiffAndDependencies(extension, otherRefiningDiff); } } }
Source:
<code>public void propagateGeometryPathCommandsToPathPoints(Force force, AbstractProperty prop, JSONArray commands) { int lastIndex = commands.size()-1; JSONObject lastCommand = (JSONObject) commands.get(lastIndex); String commandName = (String) lastCommand.get("name"); if (commandName.equalsIgnoreCase("SetVisible")){ lastCommand.put("type", "SetValueCommandMuscle"); } else { JSONObject pathpointCommand = (JSONObject) lastCommand.clone(); <START> GeometryPath gPath = GeometryPath.safeDownCast(force.getPropertyByName("GeometryPath").getValueAsObject()); <END> pathpointCommand.put("objectUuid", getFirstPathPointUUID4GeometryPath(gPath).toString()); commands.add(pathpointCommand); } }</code><technical_language>I prefer avoiding getPropertyByName(). do for property exists? if-statement</technical_language>

Target:
public void propagateGeometryPathCommandsToPathPoints(Force force, AbstractProperty prop, JSONArray commands) { int lastIndex = commands.size()-1; JSONObject lastCommand = (JSONObject) commands.get(lastIndex); String commandName = (String) lastCommand.get("name"); if (commandName.equalsIgnoreCase("SetVisible")){ lastCommand.put("type", "SetValueCommandMuscle"); } else { JSONObject pathpointCommand = (JSONObject) lastCommand.clone(); if (force.hasGeometryPath()){ GeometryPath gPath = GeometryPath.safeDownCast(force.getPropertyByName("GeometryPath").getValueAsObject()); pathpointCommand.put("objectUuid", getFirstPathPointUUID4GeometryPath(gPath).toString()); commands.add(pathpointCommand); } else { throw new UnsupportedOperationException("Trying to update GeometryPath of Force that has no GeometryPath:"+force.getName()); } } }
Source:
<code>private void removePlacemarks(HashMap<? extends Feature, Object> placemarks) { <START> super.removeFeatures((HashMap<Feature, Object>) placemarks); <END> }</code><technical_language>super reference removed here, removeFeatures() is static</technical_language>

Target:
private void removePlacemarks(HashMap<? extends Feature, Object> placemarks) { removeFeatures((HashMap<Feature, Object>) placemarks); }
Source:
<code>public SentryClient createSentryClient(Dsn dsn) { if (!checkPermission(Manifest.permission.INTERNET)) { Log.e(TAG, Manifest.permission.INTERNET + " is required to connect to the Sentry server," + " please add it to your AndroidManifest.xml"); } <START> Log.d(TAG, "Sentry init with ctx='" + this.ctx.toString() + "'"); <END> String protocol = dsn.getProtocol(); if (protocol.equalsIgnoreCase("noop")) { Log.w(TAG, "*** Couldn't find a suitable DSN, Sentry operations will do nothing!" + " See documentation: <LINK_0> ***"); } else if (!(protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https"))) { String async = Lookup.lookup(DefaultSentryClientFactory.ASYNC_OPTION, dsn); if (async != null && async.equalsIgnoreCase("false")) { throw new IllegalArgumentException("Sentry Android cannot use synchronous connections, remove '" + DefaultSentryClientFactory.ASYNC_OPTION + "=false' from your options."); } throw new IllegalArgumentException("Only 'http' or 'https' connections are supported in" + " Sentry Android, but received: " + protocol); } SentryClient sentryClient = super.createSentryClient(dsn); sentryClient.addBuilderHelper(new AndroidEventBuilderHelper(this.ctx)); return sentryClient; }</code><technical_language>// nitpick-mode-on change this.ctx ctx? // nitpick-mode-off</technical_language>

Target:
public SentryClient createSentryClient(Dsn dsn) { if (!checkPermission(Manifest.permission.INTERNET)) { Log.e(TAG, Manifest.permission.INTERNET + " is required to connect to the Sentry server," + " please add it to your AndroidManifest.xml"); } Log.d(TAG, "Sentry init with ctx='" + ctx.toString() + "'"); String protocol = dsn.getProtocol(); if (protocol.equalsIgnoreCase("noop")) { Log.w(TAG, "*** Couldn't find a suitable DSN, Sentry operations will do nothing!" + " See documentation: <LINK_0> ***"); } else if (!(protocol.equalsIgnoreCase("http") || protocol.equalsIgnoreCase("https"))) { String async = Lookup.lookup(DefaultSentryClientFactory.ASYNC_OPTION, dsn); if (async != null && async.equalsIgnoreCase("false")) { throw new IllegalArgumentException("Sentry Android cannot use synchronous connections, remove '" + DefaultSentryClientFactory.ASYNC_OPTION + "=false' from your options."); } throw new IllegalArgumentException("Only 'http' or 'https' connections are supported in" + " Sentry Android, but received: " + protocol); } SentryClient sentryClient = super.createSentryClient(dsn); sentryClient.addBuilderHelper(new AndroidEventBuilderHelper(ctx)); return sentryClient; }
Source:
<code>private void writeSingleElement(IndentingWriter writer, String name, String text) { if (text != null) { writer.print(String.format("<%s>", name)); <START> writer.print(StringEscapeUtils.escapeXml10(text)); <END> writer.println(String.format("</%s>", name)); } }</code><technical_language>bring entire library level method. initializr-generator is pretty barebone way</technical_language>

Target:
private void writeSingleElement(IndentingWriter writer, String name, String text) { if (text != null) { writer.print(String.format("<%s>", name)); writer.print(escapeString(text)); writer.println(String.format("</%s>", name)); } }
Source:
<code>private void build() { Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); <START> <END> if (OpenGlHelper.useVbo()) vbo = new net.minecraft.client.renderer.vertex.VertexBuffer(FORMAT); else GlStateManager.glNewList(displayList = GLAllocation.generateDisplayLists(1), GL11.GL_COMPILE); vertices(buffer); if (OpenGlHelper.useVbo()) { buffer.finishDrawing(); buffer.reset(); vbo.bufferData(buffer.getByteBuffer()); } else { tess.draw(); GlStateManager.glEndList(); } }</code><technical_language>need fully-qualified name this is targeting 1.12 - advantage of name change</technical_language>

Target:
private void build() { Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); if (OpenGlHelper.useVbo()) vbo = new VertexBuffer(FORMAT); else GlStateManager.glNewList(displayList = GLAllocation.generateDisplayLists(1), GL11.GL_COMPILE); vertices(buffer); if (OpenGlHelper.useVbo()) { buffer.finishDrawing(); buffer.reset(); vbo.bufferData(buffer.getByteBuffer()); } else { tess.draw(); GlStateManager.glEndList(); } }
Source:
<code>private CmisServiceFactory createServiceFactory() { String className = "nl.nn.adapterframework.extensions.cmis.server.RepositoryConnectorFactory"; Object object = null; try { object = ClassLoaderUtil.loadClass(className).newInstance(); } catch (Exception e) { <START> log.warn("Could not create a services factory instance: "+ e.toString(), e); <END> return null; } if (!(object instanceof CmisServiceFactory)) { log.warn("The provided class is not an instance of CmisServiceFactory!"); } return (CmisServiceFactory) object; }</code><technical_language>log.warn("Could create a services factory instance: "+ e.toString(), e);</technical_language>

Target:
private CmisServiceFactory createServiceFactory() { String className = "nl.nn.adapterframework.extensions.cmis.server.RepositoryConnectorFactory"; Object object = null; try { object = ClassLoaderUtil.loadClass(className).newInstance(); } catch (Exception e) { log.warn("Could not create a services factory instance", e); return null; } if (!(object instanceof CmisServiceFactory)) { log.warn("The provided class is not an instance of CmisServiceFactory!"); } return (CmisServiceFactory) object; }
Source:
<code>private File getPath(DataSegment segment) throws SegmentLoadingException { <START> return new File(MapUtils.getString(segment.getLoadSpec(), "path")); <END> }</code><technical_language>Is tie this LoadLocalSpec ? parsing loadspec calling getPath a extreme for here, "path" put a public static final String in class something</technical_language>

Target:
private File getPath(DataSegment segment) throws SegmentLoadingException { return new File(MapUtils.getString(segment.getLoadSpec(), PATH_KEY)); }
Source:
<code>public String getCurrentDatabaseVersion(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if (!AuthzResolver.isAuthorized(sess, Role.SELF) <START> && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) throw new PrivilegeException(sess, "getCurrentDatabaseVersion"); <END> return getDatabaseManagerBl().getCurrentDatabaseVersion(); }</code><technical_language>Currently PERUNOBSERVER role assignable config specific credentials (unlike perun admin). This mean, User, related this role. anywhere, check (without user passed user is own) PERUNOBSERVER pass too. if filter result, separate them. do @stavamichal @licehammer @martin-kuba ? need PERUNOBSERVER role for accounts User in Perun ? I suppose not, is safer account contact info etc</technical_language>

Target:
public String getCurrentDatabaseVersion(PerunSession sess) throws InternalErrorException, PrivilegeException { Utils.checkPerunSession(sess); if (!AuthzResolver.isAuthorized(sess, Role.SELF)) throw new PrivilegeException(sess, "getCurrentDatabaseVersion"); return getDatabaseManagerBl().getCurrentDatabaseVersion(); }
Source:
<code>public void testDefaultProperties() throws IOException { <START> DocumentModel root = session.getDocument(new PathRef("/")); <END> PageProvider<?> pp = pps.getPageProvider("DOCUMENT_HISTORY_PROVIDER", null, Long.valueOf(20), Long.valueOf(0), new HashMap<>(), root); @SuppressWarnings("unchecked") List<LogEntry> entries = (List<LogEntry>) pp.getCurrentPage(); RenderingContext renderingCtx = RenderingContext.CtxBuilder.get(); for (LogEntry entry : entries) { CSVAssert csv = csvAssert(entry, renderingCtx); csv.has("id"); csv.has("category"); csv.has("principalName"); csv.has("comment"); csv.has("docLifeCycle"); csv.has("docPath"); csv.has("docType"); csv.has("docUUID"); csv.has("eventId"); csv.has("repositoryId"); csv.has("eventDate"); csv.has("logDate"); } }</code><technical_language>I do check fields a LogEntry a file now. CSVAssert give enough apis check I check presence of id dates</technical_language>

Target:
public void testDefaultProperties() throws IOException { RenderingContext renderingCtx = RenderingContext.CtxBuilder.get(); for (LogEntry entry : getLogEntries()) { CSVAssert csv = csvAssert(entry, renderingCtx); csv.has("id"); csv.has("category").isEquals("eventDocumentCategory"); csv.has("principalName").isEquals("Administrator"); csv.has("comment").isEquals(""); csv.has("docLifeCycle").isEquals("project"); csv.has("docPath").isEquals("/myFile"); csv.has("docType").isEquals("File"); csv.has("docUUID").isEquals(file.getId()); csv.has("eventId").isEquals(DocumentEventTypes.DOCUMENT_CREATED); csv.has("repositoryId").isEquals("test"); csv.has("eventDate"); csv.has("logDate"); } }
Source:
<code><START> public List findPublishedSchemaById(long id) { <END> Tool tool = findPublishedById(id); List schemaObjects = new ArrayList(); if (tool != null) { String defaultVersion = tool.getDefaultVersion(); String descriptorJson = getDescriptorJson(tool, defaultVersion); String schemaVariable = getSchemaVariable(descriptorJson); if (!schemaVariable.isEmpty()) { Map<String, Object> map = new HashMap(); map = cwlJson2Map(descriptorJson, schemaVariable); map = addContext(map, schemaVariable); map = stripNamespace(map, schemaVariable); schemaObjects = getSchemaObjectsList(map); } } return schemaObjects; }</code><technical_language>move methods dealing json-ld a new class/package</technical_language>

Target:
public List findPublishedSchemaById(long id) { Tool tool = findPublishedById(id); return JsonLdRetriever.getSchema(tool); }
Source:
<code>private void handleInvokedMethodException(Throwable cause) throws KeeperException, InterruptedException { if (cause instanceof KeeperException.UnimplementedException) { LOG.warn("Paginated getChildren is unimplemented in ZK server! " + "Falling back to non-paginated getChildren"); <START> lookupNonPaginatedGetChildren(); <END> throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS); } else if (cause instanceof KeeperException) { throw KeeperException.create(((KeeperException) cause).code()); } else if (cause instanceof InterruptedException) { throw new InterruptedException(cause.getMessage()); } else { throw ExceptionUtil.convertToRuntimeException(cause); } }</code><technical_language>In this case, do want retry operation</technical_language>

Target:
private void handleInvokedMethodException(Throwable cause) throws KeeperException, InterruptedException { if (cause instanceof KeeperException.UnimplementedException) { LOG.warn("Paginated getChildren is unimplemented in ZK server! " + "Falling back to non-paginated getChildren"); _getChildrenMethod = lookupNonPaginatedGetChildren(); throw KeeperException.create(KeeperException.Code.CONNECTIONLOSS); } else if (cause instanceof KeeperException) { throw KeeperException.create(((KeeperException) cause).code()); } else if (cause instanceof InterruptedException) { throw new InterruptedException(cause.getMessage()); } else { throw ExceptionUtil.convertToRuntimeException(cause); } }
Source:
<code>public void encode(final SAMSequenceDictionary dictionary) { dictionary.getSequences().forEach(this::encodeSQLine); <START> <END> }</code><technical_language>frivolous newline</technical_language>

Target:
public void encode(final SAMSequenceDictionary dictionary) { codec.encodeHeaderLine(false); dictionary.getSequences().forEach(this::encodeSequenceRecord); }
Source:
<code>public String idFromValue(Object o) { String id = super.idFromValue(o); if (relacementIds.containsKey(id)) { id = relacementIds.get(id); <START> } <END> return id; }</code><technical_language>Starting Java 8 do this: id = replacementIds.getOrDefault(id, id);</technical_language>

Target:
public String idFromValue(Object o) { String id = super.idFromValue(o); return relacementIds.getOrDefault(id, id); }
Source:
<code>protected Long nullUnsafeScalar(Year value) { <START> return value.atDay( 1 ).atStartOfDay().atZone( ZoneOffset.UTC ).toInstant().toEpochMilli(); <END> }</code><technical_language>call value.toInstant( ZoneOffset.UTC ) instead of atZone(...).toInstant()</technical_language>

Target:
protected Long nullUnsafeScalar(Year value) { return value.atDay( 1 ).atStartOfDay().toInstant( ZoneOffset.UTC ).toEpochMilli(); }
Source:
<code>public void testPushTimeInThePast() { ParsePush.State.Builder builder = new ParsePush.State.Builder(); ParsePush.State state = builder <START> .pushTime(System.currentTimeMillis() - 1000) <END> .data(new JSONObject()) .build(); }</code><technical_language>time unit is converted .pushTime(System.currentTimeMillis() / 1000 - 1)</technical_language>

Target:
public void testPushTimeInThePast() { ParsePush.State.Builder builder = new ParsePush.State.Builder(); ParsePush.State state = builder .pushTime(System.currentTimeMillis() / 1000 - 1000) .data(new JSONObject()) .build(); }
Source:
<code>public float getFloat() { <START> throw new UnsupportedOperationException("not implemented"); <END> }</code><technical_language>"Casting float type is supported". Similar for getLong()</technical_language>

Target:
public float getFloat() { throw new UnsupportedOperationException("Casting to float type is not supported"); }
Source:
<code><START> private static boolean isFormatChange(AttributeChange input) { <END> for (EAttribute attribute : NotationPackage.Literals.FONT_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.FILL_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.LINE_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } return false; }</code><technical_language>Please replace this method /** * Check if input is a format change. * * @param input * attribute change difference. * @return <code>true</code> if input is change of attribute in of {@link FontStyle}, * {@link FillStyle}, {@link LineStyle} eClasses of {@link NotationPackage}. */ private static boolean isFormatChange(AttributeChange input) { EAttribute att = input.getAttribute(); if (att != null) { return Arrays.asList(FONT_STYLE, FILL_STYLE, LINE_STYLE).contains(att.getEContainingClass()); } return false; }</technical_language>

Target:
private static boolean isFormatChange(AttributeChange input) { EAttribute attribute = input.getAttribute(); if (attribute != null) { return Arrays.asList(FONT_STYLE, FILL_STYLE, LINE_STYLE) .contains(attribute.getEContainingClass()); } return false; }
Source:
<code>private String applyPartitioningStrategy(final EventType eventType, final JSONObject eventAsJson) throws InvalidOrderingKeyFieldsException { String partitionId; if (!eventType.getOrderingKeyFields().isEmpty()) { partitionId = orderingKeyFieldsPartitioningStrategy.calculatePartition(eventType, eventAsJson, 8); } else { <START> partitionId = "1"; <END> } return partitionId; }</code><technical_language>for a fallback strategy, if planned functionality</technical_language>

Target:
private String applyPartitioningStrategy(final EventType eventType, final JSONObject eventAsJson) throws InvalidOrderingKeyFieldsException, NakadiException { String partitionId; final String[] partitions = topicRepository.listPartitionNames(eventType.getName()); if (!eventType.getOrderingKeyFields().isEmpty()) { partitionId = orderingKeyFieldsPartitioningStrategy.calculatePartition(eventType, eventAsJson, partitions); } else { partitionId = "0"; } return partitionId; }
Source:
<code>public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); if (BIG_BANG.equals(ts)) { return 1; } if (BIG_CRUNCH.equals(ts)) { return -1; } if (this == ts || isIdentical(this, ts)) { return 0; } if (scale == ts.getScale()) { <START> if(ts.getValue() == Long.MIN_VALUE){ <END> return 1; } final long delta = saturatedAdd(getValue(), -ts.getValue()); return Long.compare(delta, 0); } final ITmfTimestamp largerScale = (scale > ts.getScale()) ? this : ts; final ITmfTimestamp smallerScale = (scale < ts.getScale()) ? this : ts; final ITmfTimestamp nts = largerScale.normalize(0, smallerScale.getScale()); if (hasSaturated(largerScale, nts)) { if (smallerScale.getScale() == scale) { return Long.compare(0, nts.getValue()); } return Long.compare(nts.getValue(), 0); } if (smallerScale.getScale() == scale) { if(nts.getValue()==Long.MIN_VALUE){ return 1; } final long delta = saturatedAdd(value, - nts.getValue()); return Long.compare(delta, 0); } if (smallerScale.getValue() == Long.MIN_VALUE) { return 1; } final long delta = saturatedAdd(-smallerScale.getValue(), nts.getValue()); return Long.compare(delta, 0); }</code><technical_language>spaces</technical_language>

Target:
public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); if (BIG_BANG.equals(ts)) { return 1; } if (BIG_CRUNCH.equals(ts)) { return -1; } if (this == ts || isIdentical(this, ts)) { return 0; } if (scale == ts.getScale()) { if (ts.getValue() == Long.MIN_VALUE) { return 1; } final long delta = saturatedAdd(getValue(), -ts.getValue()); return Long.compare(delta, 0); } final ITmfTimestamp largerScale = (scale > ts.getScale()) ? this : ts; final ITmfTimestamp smallerScale = (scale < ts.getScale()) ? this : ts; final ITmfTimestamp nts = largerScale.normalize(0, smallerScale.getScale()); if (hasSaturated(largerScale, nts)) { if (smallerScale.getScale() == scale) { return Long.compare(0, nts.getValue()); } return Long.compare(nts.getValue(), 0); } if (smallerScale.getScale() == scale) { return Long.compare(value, nts.getValue()); } return Long.compare(nts.getValue(), smallerScale.getValue()); }
Source:
<code>public DPXReader(SeekableByteChannel ch) throws IOException { this.readBuf = allocate(READ_BUFFER_SIZE); readBuf.order(ByteOrder.BIG_ENDIAN); initialRead(ch); this.magic = readBuf.getInt(); if (magic != SPDX) { <START> readBuf.order(ByteOrder.LITTLE_ENDIAN); <END> } }</code><technical_language>explain this? do set buffer LITTLE_ENDIAN header magic match</technical_language>

Target:
public DPXReader(SeekableByteChannel ch) throws IOException { this.readBuf = allocate(READ_BUFFER_SIZE); initialRead(ch); this.magic = readBuf.getInt(); if (magic == SDPX) { readBuf.order(ByteOrder.BIG_ENDIAN); } else { readBuf.order(ByteOrder.LITTLE_ENDIAN); } }