auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void updateAlbumArt() { final RadioDroidApp radioDroidApp = (RadioDroidApp) requireActivity().getApplication(); TrackMetadataSearcher trackMetadataSearcher = radioDroidApp.getTrackMetadataSearcher(); final StreamLiveInfo liveInfo = PlayerServiceUtil.getMetadataLive(); trackMetadataSearcher.fetchTrackMetadata(liveInfo.getArtist(), liveInfo.getTrack(), new TrackMetadataCallback() { @Override public void onFailure() { } @Override public void onSuccess(@NonNull final TrackMetadata trackMetadata) { requireActivity().runOnUiThread(() -> { final List<TrackMetadata.AlbumArt> albumArts = trackMetadata.getAlbumArts(); if (!albumArts.isEmpty()) { final String albumArtUrl = albumArts.get(0).url; if (!TextUtils.isEmpty(albumArtUrl)) { Picasso.with(getContext()) .load(albumArtUrl) .into(artAndInfoPagerAdapter.imageViewArt); trackHistoryRepository.setCurrentPlayingTrackArtUrl(albumArtUrl); } } }); } }); }

Target:
private void updateAlbumArt() { if (trackMetadataCallback != null) { trackMetadataCallback.cancel(); } if (PlayerServiceUtil.getCurrentStation() == null) { return; } final RadioDroidApp radioDroidApp = (RadioDroidApp) requireActivity().getApplication(); TrackMetadataSearcher trackMetadataSearcher = radioDroidApp.getTrackMetadataSearcher(); final StreamLiveInfo liveInfo = PlayerServiceUtil.getMetadataLive(); final WeakReference<FragmentPlayerFull> fragmentWeakReference = new WeakReference<>(this); trackHistoryRepository.getLastInsertedHistoryItem((trackHistoryEntry, dao) -> { if (trackHistoryEntry == null) { Log.e(TAG, "trackHistoryEntry is null in updateAlbumArt which should not happen."); return; } FragmentPlayerFull fragment = fragmentWeakReference.get(); if (fragment != null) { fragment.requireActivity().runOnUiThread(() -> { if (fragment.isResumed()) { fragment.trackMetadataCallback = new PlayerTrackMetadataCallback(fragmentWeakReference, trackHistoryEntry); trackMetadataSearcher.fetchTrackMetadata(liveInfo.getArtist(), liveInfo.getTrack(), fragment.trackMetadataCallback); } }); } }); }
Source:
public String getColumnText(@Nullable Object element, int columnIndex) { String value = ""; if (element instanceof HiddenTreeViewerEntry) { if (columnIndex == 0) { value = ((HiddenTreeViewerEntry) element).getName(); } } else { LatencyTreeViewerEntry obj = (LatencyTreeViewerEntry) element; if (obj != null) { if (columnIndex == 0) { return checkNotNull(String.valueOf(obj.getName())); } if (obj.getEntry().getNbSegments() > 0) { if (columnIndex == 1) { value = toFormattedString(obj.getEntry().getMin()); } else if (columnIndex == 2) { value = String.valueOf(toFormattedString(obj.getEntry().getMax())); } else if (columnIndex == 3) { value = String.valueOf(toFormattedString(obj.getEntry().getAverage())); } } } } return checkNotNull(value); }

Target:
public String getColumnText(@Nullable Object element, int columnIndex) { String value = ""; if (element instanceof HiddenTreeViewerEntry) { if (columnIndex == 0) { value = ((HiddenTreeViewerEntry) element).getName(); } } else if (element instanceof LatencyTreeViewerEntry) { LatencyTreeViewerEntry entry = (LatencyTreeViewerEntry) element; if (columnIndex == 0) { return checkNotNull(String.valueOf(entry.getName())); } if (entry.getEntry().getNbSegments() > 0) { if (columnIndex == 1) { value = toFormattedString(entry.getEntry().getMin()); } else if (columnIndex == 2) { value = String.valueOf(toFormattedString(entry.getEntry().getMax())); } else if (columnIndex == 3) { value = String.valueOf(toFormattedString(entry.getEntry().getAverage())); } } } return checkNotNull(value); }
Source:
public void spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored() throws Throwable { requireTestSkip(new ThrowingRunnable() { @Override public void run() throws Throwable { new IdentityProcessorVerification(newTestEnvironment(), DEFAULT_TIMEOUT_MILLIS){ @Override public Processor createIdentityProcessor(int bufferSize) { return new NoopProcessor(); } @Override public ExecutorService publisherExecutorService() { return ex; } @Override public Object createElement(int element) { return null; } @Override public Publisher createHelperPublisher(long elements) { return SKIP; } @Override public Publisher createErrorStatePublisher() { return SKIP; } @Override public long maxSupportedSubscribers() { return 1; } }.spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError(); } }, "The Publisher under test only supports 1 subscribers, while this test requires at least 2 to run"); }

Target:
public void spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored() throws Throwable { requireTestSkip(new ThrowingRunnable() { @Override public void run() throws Throwable { new IdentityProcessorVerification<Integer>(newTestEnvironment(), DEFAULT_TIMEOUT_MILLIS){ @Override public Processor<Integer, Integer> createIdentityProcessor(int bufferSize) { return new NoopProcessor(); } @Override public ExecutorService publisherExecutorService() { return ex; } @Override public Integer createElement(int element) { return element; } @Override public Publisher<Integer> createHelperPublisher(long elements) { return SKIP; } @Override public Publisher<Integer> createErrorStatePublisher() { return SKIP; } @Override public long maxSupportedSubscribers() { return 1; } }.spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError(); } }, "The Publisher under test only supports 1 subscribers, while this test requires at least 2 to run"); }
Source:
private int filterFeedbackResponseCommentResults( FeedbackResponseCommentSearchResultBundle frCommentSearchResults, List<InstructorAttributes> instructors, int totalResultsSize) { Iterator<Entry<String, List<FeedbackResponseAttributes>>> iterFr = frCommentSearchResults.responses.entrySet().iterator(); while (iterFr.hasNext()) { List<FeedbackResponseAttributes> frs = iterFr.next().getValue(); Iterator<FeedbackResponseAttributes> fr = frs.iterator(); while (fr.hasNext()) { FeedbackResponseAttributes response = fr.next(); FeedbackQuestionAttributes relatedQuestion = getRelatedQuestionOfResponse( frCommentSearchResults, response); InstructorAttributes instructor = this.getInstructorForCourseId( response.courseId, instructors); boolean isVisibleResponse = true; boolean needCheckPrivilege = relatedQuestion == null || !(relatedQuestion.recipientType == FeedbackParticipantType.NONE || relatedQuestion.recipientType == FeedbackParticipantType.INSTRUCTORS || relatedQuestion.recipientType == FeedbackParticipantType.STUDENTS); boolean isNotAllowedForInstructor = instructor == null || !(instructor.isAllowedForPrivilege(response.giverSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) || !(instructor.isAllowedForPrivilege(response.recipientSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); if (needCheckPrivilege && isNotAllowedForInstructor) { isVisibleResponse = false; } if (!isVisibleResponse) { int sizeOfCommentList = frCommentSearchResults.comments.get(response.getId()).size(); totalResultsSize -= sizeOfCommentList; frCommentSearchResults.comments.remove(response.getId()); fr.remove(); } } } return totalResultsSize; }

Target:
private int filterFeedbackResponseCommentResults( FeedbackResponseCommentSearchResultBundle frCommentSearchResults, List<InstructorAttributes> instructors, int totalResultsSize) { Iterator<Entry<String, List<FeedbackResponseAttributes>>> iterFr = frCommentSearchResults.responses.entrySet().iterator(); while (iterFr.hasNext()) { List<FeedbackResponseAttributes> frs = iterFr.next().getValue(); Iterator<FeedbackResponseAttributes> fr = frs.iterator(); while (fr.hasNext()) { FeedbackResponseAttributes response = fr.next(); InstructorAttributes instructor = this.getInstructorForCourseId(response.courseId, instructors); boolean isVisibleResponse = true; boolean isNotAllowedForInstructor = instructor == null || !(instructor.isAllowedForPrivilege(response.giverSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)) || !(instructor.isAllowedForPrivilege(response.recipientSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); if (isNotAllowedForInstructor) { isVisibleResponse = false; } if (!isVisibleResponse) { int sizeOfCommentList = frCommentSearchResults.comments.get(response.getId()).size(); totalResultsSize -= sizeOfCommentList; frCommentSearchResults.comments.remove(response.getId()); fr.remove(); } } } return totalResultsSize; }
Source:
public static String formatType(int pgType) { int valueType; switch (pgType) { case 0: return "-"; case PG_TYPE_BOOL: valueType = Value.BOOLEAN; break; case PG_TYPE_BYTEA: valueType = Value.VARBINARY; break; case 18: return "char"; case 19: return "name"; case PG_TYPE_INT8: valueType = Value.BIGINT; break; case PG_TYPE_INT2: valueType = Value.SMALLINT; break; case 22: return "int2vector"; case PG_TYPE_INT4: valueType = Value.INTEGER; break; case 24: return "regproc"; case PG_TYPE_TEXT: valueType = Value.CLOB; break; case PG_TYPE_FLOAT4: valueType = Value.REAL; break; case PG_TYPE_FLOAT8: valueType = Value.DOUBLE; break; case PG_TYPE_INT2_ARRAY: return "_int2"; case PG_TYPE_INT4_ARRAY: return "_int4"; case PG_TYPE_VARCHAR_ARRAY: return "_varchar"; case PG_TYPE_BPCHAR: valueType = Value.CHAR; break; case PG_TYPE_VARCHAR: valueType = Value.VARCHAR; break; case PG_TYPE_DATE: valueType = Value.DATE; break; case PG_TYPE_TIME: valueType = Value.TIME; break; case PG_TYPE_TIMETZ: valueType = Value.TIME_TZ; break; case PG_TYPE_TIMESTAMP: valueType = Value.TIMESTAMP; break; case PG_TYPE_TIMESTAMPTZ: valueType = Value.TIMESTAMP_TZ; break; case PG_TYPE_NUMERIC: valueType = Value.NUMERIC; break; case 2205: return "regclass"; default: return "???"; } return DataType.getDataType(valueType).name; }

Target:
public static String formatType(int pgType) { int valueType; switch (pgType) { case 0: return "-"; case PG_TYPE_BOOL: valueType = Value.BOOLEAN; break; case PG_TYPE_BYTEA: valueType = Value.VARBINARY; break; case 18: return "char"; case 19: return "name"; case PG_TYPE_INT8: valueType = Value.BIGINT; break; case PG_TYPE_INT2: valueType = Value.SMALLINT; break; case 22: return "int2vector"; case PG_TYPE_INT4: valueType = Value.INTEGER; break; case 24: return "regproc"; case PG_TYPE_TEXT: valueType = Value.CLOB; break; case PG_TYPE_FLOAT4: valueType = Value.REAL; break; case PG_TYPE_FLOAT8: valueType = Value.DOUBLE; break; case PG_TYPE_INT2_ARRAY: return "smallint[]"; case PG_TYPE_INT4_ARRAY: return "integer[]"; case PG_TYPE_VARCHAR_ARRAY: return "character varying[]"; case PG_TYPE_BPCHAR: valueType = Value.CHAR; break; case PG_TYPE_VARCHAR: valueType = Value.VARCHAR; break; case PG_TYPE_DATE: valueType = Value.DATE; break; case PG_TYPE_TIME: valueType = Value.TIME; break; case PG_TYPE_TIMETZ: valueType = Value.TIME_TZ; break; case PG_TYPE_TIMESTAMP: valueType = Value.TIMESTAMP; break; case PG_TYPE_TIMESTAMPTZ: valueType = Value.TIMESTAMP_TZ; break; case PG_TYPE_NUMERIC: valueType = Value.NUMERIC; break; case 2205: return "regclass"; default: return "???"; } return DataType.getDataType(valueType).name; }
Source:
public boolean create(String path, T data, int options) { String clientPath = path; String serverPath = prependChroot(clientPath); Cache<T> cache = getCache(serverPath); if (cache != null) { try { cache.lockWrite(); ZkBaseDataAccessor<T>.AccessResult result = _baseAccessor.doCreate(_zkclient, serverPath, data, options); boolean success = (result._retCode == RetCode.OK); updateCache(cache, result._pathCreated, success, serverPath, data, ZNode.ZERO_STAT); return success; } finally { cache.unlockWrite(); } } return _baseAccessor.create(serverPath, data, options); }

Target:
public boolean create(String path, T data, int options) { String clientPath = path; String serverPath = prependChroot(clientPath); Cache<T> cache = getCache(serverPath); if (cache != null) { try { cache.lockWrite(); ZkBaseDataAccessor<T>.AccessResult result = _baseAccessor.doCreate(serverPath, data, options); boolean success = (result._retCode == RetCode.OK); updateCache(cache, result._pathCreated, success, serverPath, data, ZNode.ZERO_STAT); return success; } finally { cache.unlockWrite(); } } return _baseAccessor.create(serverPath, data, options); }
Source:
PkgControl(final String pkgName, final boolean regex) { parent = null; this.regex = regex; fullPackage = addGroupingIfNecessary(pkgName, regex); if (regex) { patternForPartialMatch = createPatternForPartialMatch(); patternForExactMatch = createPatternForExactMatch(); } else { patternForPartialMatch = null; patternForExactMatch = null; } }

Target:
PkgControl(final String pkgName, final boolean regex) { parent = null; this.regex = regex; if (regex) { fullPackage = encloseInGroup(pkgName); patternForPartialMatch = createPatternForPartialMatch(fullPackage); patternForExactMatch = createPatternForExactMatch(fullPackage); } else { fullPackage = pkgName; patternForPartialMatch = null; patternForExactMatch = null; } }
Source:
private void createDirectoryForLeaderForEachClientUseCase(String namespace) { if (Paths.get(tempFolder.getRoot().toPath().toString(), PaxosTimeLockConstants.LEADER_PAXOS_NAMESPACE, PaxosTimeLockConstants.MULTI_LEADER_PAXOS_NAMESPACE, namespace).toFile().mkdirs()) { return; } throw new RuntimeException("Unexpected error when creating a subdirectory"); }

Target:
private void createDirectoryForLeaderForEachClientUseCase(String namespace) { if (tempFolder.getRoot().toPath() .resolve(PaxosTimeLockConstants.LEADER_PAXOS_NAMESPACE) .resolve(PaxosTimeLockConstants.MULTI_LEADER_PAXOS_NAMESPACE) .resolve(namespace) .toFile() .mkdirs()) { return; } throw new RuntimeException("Unexpected error when creating a subdirectory"); }
Source:
public QueryBuilder projection(SelectExpression... selectExpressions) { if (builder == null) throw new IllegalArgumentException("You have to call projection() on root query builder!"); String[] stringAttributes = new String[selectExpressions.length]; for (int i = 0; i < selectExpressions.length; i++) { stringAttributes[i] = selectExpressions[i].attribute; } builder.setProjection(stringAttributes); return this; }

Target:
public QueryBuilder projection(SelectExpression... selectExpressions) { if (builder == null) throw new IllegalArgumentException("You have to call projection() on root query builder!"); String[] stringAttributes = new String[selectExpressions.length]; for (int i = 0; i < selectExpressions.length; i++) { if (selectExpressions[i].function != AggregationFunction.NONE) { throw new IllegalArgumentException("This version of infinispan doesn't support aggregations!"); } stringAttributes[i] = selectExpressions[i].attribute; } builder.setProjection(stringAttributes); return this; }
Source:
private Object readResolve() { if (StringUtils.isBlank(name)) { LOGGER.log(Level.WARNING, "Read install state with blank name: ''{0}''. It will be ignored", name); return UNKNOWN; } InstallState state = InstallState.valueOf(name); if (state == null) { LOGGER.log(Level.WARNING, "Cannot locate an extension point for the state ''{0}''. It will be ignored", name); return UNKNOWN; } return state; }

Target:
protected Object readResolve() { if (StringUtils.isBlank(name)) { LOGGER.log(Level.WARNING, "Read install state with blank name: ''{0}''. It will be ignored", name); return UNKNOWN; } InstallState state = InstallState.valueOf(name); if (state == null) { LOGGER.log(Level.WARNING, "Cannot locate an extension point for the state ''{0}''. It will be ignored", name); return UNKNOWN; } return state; }
Source:
private int applyFilterFunctions(int[] positions, int positionCount) { BlockLease[] blockLeases = new BlockLease[getStreamReaders().length]; Block[] blocks = new Block[getStreamReaders().length]; for (int columnIndex : filterFunctionInputs) { blockLeases[columnIndex] = getStreamReaders()[columnIndex].getBlockView(positions, positionCount); blocks[columnIndex] = blockLeases[columnIndex].get(); } try { initializeOutputPositions(positionCount); for (FilterFunction function : filterFunctions) { int[] inputs = function.getInputChannels(); Block[] inputBlocks = new Block[inputs.length]; for (int i = 0; i < inputs.length; i++) { inputBlocks[i] = blocks[filterFunctionInputMapping.get(inputs[i])]; } Page page = new Page(positionCount, inputBlocks); positionCount = function.filter(page, outputPositions, positionCount, errors); if (positionCount == 0) { break; } } for (int i = 0; i < positionCount; i++) { if (errors[i] != null) { throw errors[i]; } } for (int i = 0; i < positionCount; i++) { outputPositions[i] = positions[outputPositions[i]]; } return positionCount; } finally { for (int i = 0; i < blockLeases.length; i++) { if (blockLeases[i] != null) { blockLeases[i].close(); } } } }

Target:
private int applyFilterFunctions(int[] positions, int positionCount) { BlockLease[] blockLeases = new BlockLease[getStreamReaders().length]; Block[] blocks = new Block[getStreamReaders().length]; for (int columnIndex : filterFunctionInputs) { blockLeases[columnIndex] = getStreamReaders()[columnIndex].getBlockView(positions, positionCount); blocks[columnIndex] = blockLeases[columnIndex].get(); } try { initializeOutputPositions(positionCount); for (FilterFunction function : filterFunctions) { int[] inputs = function.getInputChannels(); Block[] inputBlocks = new Block[inputs.length]; for (int i = 0; i < inputs.length; i++) { inputBlocks[i] = blocks[filterFunctionInputMapping.get(inputs[i])]; } Page page = new Page(positionCount, inputBlocks); positionCount = function.filter(page, outputPositions, positionCount, errors); if (positionCount == 0) { break; } } for (int i = 0; i < positionCount; i++) { if (errors[i] != null) { throw errors[i]; } } for (int i = 0; i < positionCount; i++) { outputPositions[i] = positions[outputPositions[i]]; } return positionCount; } finally { for (BlockLease blockLease : blockLeases) { if (blockLease != null) { blockLease.close(); } } } }
Source:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.info("PolicyWhichThrowsExceptions::isTaskExecutable is called " + counter); if(counter == 1 || counter == 2 || counter == 3 || counter == 4){ ++counter; throw new Error("Error for TestRMReconnectioBug test"); }else{ ++counter; return super.isTaskExecutable(selectedNodes, task); } }

Target:
public boolean isTaskExecutable(NodeSet selectedNodes, EligibleTaskDescriptor task) { logger.info("PolicyWhichThrowsExceptions::isTaskExecutable is called " + counter); if (1 <= counter && counter <= 4) { ++counter; throw new Error("This error is thrown to perform reconnection to RM"); } else { ++counter; return super.isTaskExecutable(selectedNodes, task); } }
Source:
public Map<Address, Response> forwardCommandIfNeeded(TopologyAffectedCommand command, Set<Object> affectedKeys, Address origin) { LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); if (cacheTopology == null) { if (trace) { log.tracef("Not fowarding command %s because topology is null.", command); } return Collections.emptyMap(); } int cmdTopologyId = command.getTopologyId(); int localTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("CommandTopologyId=%s, localTopologyId=%s", cmdTopologyId, localTopologyId); } if (cmdTopologyId < localTopologyId) { Collection<Address> writeTargets = cacheTopology.getWriteTargets(affectedKeys); Set<Address> newTargets = new HashSet<>(writeTargets != null ? writeTargets : cacheTopology.getMembers()); newTargets.remove(rpcManager.getAddress()); newTargets.remove(origin); if (!newTargets.isEmpty()) { command.setTopologyId(localTopologyId); if (trace) { log.tracef("Forwarding command %s to new targets %s", command, newTargets); } final RpcOptions rpcOptions = rpcManager.getDefaultRpcOptions(false, DeliverOrder.NONE); return rpcManager.invokeRemotely(newTargets, command, rpcOptions); } } return Collections.emptyMap(); }

Target:
public Map<Address, Response> forwardCommandIfNeeded(TopologyAffectedCommand command, Set<Object> affectedKeys, Address origin) { LocalizedCacheTopology cacheTopology = distributionManager.getCacheTopology(); if (cacheTopology == null) { if (trace) { log.tracef("Not fowarding command %s because topology is null.", command); } return Collections.emptyMap(); } int cmdTopologyId = command.getTopologyId(); int localTopologyId = cacheTopology.getTopologyId(); if (trace) { log.tracef("CommandTopologyId=%s, localTopologyId=%s", cmdTopologyId, localTopologyId); } if (cmdTopologyId < localTopologyId) { Collection<Address> newTargets = new HashSet<>(cacheTopology.getWriteOwners(affectedKeys)); newTargets.remove(rpcManager.getAddress()); newTargets.remove(origin); if (!newTargets.isEmpty()) { command.setTopologyId(localTopologyId); if (trace) { log.tracef("Forwarding command %s to new targets %s", command, newTargets); } final RpcOptions rpcOptions = rpcManager.getDefaultRpcOptions(false, DeliverOrder.NONE); return rpcManager.invokeRemotely(newTargets, command, rpcOptions); } } return Collections.emptyMap(); }
Source:
public void setLocalStorageProviderId(String id) { if (!mLocalStorageProviderId.equals(id)) { boolean successful = false; try { switchLocalStorage(id); successful = true; } catch (MessagingException e) { Timber.e("Switching local storage provider from " + mLocalStorageProviderId + " to " + id + " failed.", e); } if (!successful) { return; } mLocalStorageProviderId = id; } }

Target:
public void setLocalStorageProviderId(String id) { if (!mLocalStorageProviderId.equals(id)) { boolean successful = false; try { switchLocalStorage(id); successful = true; } catch (MessagingException e) { Timber.e(e, "Switching local storage provider from %s to %s failed.", mLocalStorageProviderId, id); } if (!successful) { return; } mLocalStorageProviderId = id; } }
Source:
private void checkServiceClientNaming(DetailAST classDefToken) { if (!hasServiceClientAnnotation) { return; } final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); if (isAsync && !className.endsWith(ASYNC_CLIENT)) { log(classDefToken, String.format("Async class ''%s'' should named <ServiceName>AsyncClient ", className)); } if (!isAsync && !className.endsWith(CLIENT)) { log(classDefToken, String.format("Sync class %s should named <ServiceName>Client.", className)); } }

Target:
private void checkServiceClientNaming(DetailAST classDefToken) { final String className = classDefToken.findFirstToken(TokenTypes.IDENT).getText(); if (isAsync && !className.endsWith(ASYNC_CLIENT)) { log(classDefToken, String.format("Async class ''%s'' must be named <ServiceName>AsyncClient ", className)); } if (!isAsync && !className.endsWith(CLIENT)) { log(classDefToken, String.format("Sync class %s must be named <ServiceName>Client.", className)); } }
Source:
protected void setDefaultValue( long defaultValue ) throws IOException { if ( entrySize == Integer.BYTES ) { defaultValue |= defaultValue << 32; } try ( PageCursor writeCursor = pagedFile.io( 0, PF_SHARED_WRITE_LOCK | PF_NO_GROW ) ) { writeCursor.next(); int pageSize = pagedFile.pageSize(); fillPageWithDefaultValue( writeCursor, defaultValue, pageSize ); if ( pageId( length - 1 ) > 0 ) { try ( PageCursor cursor = pagedFile.io( 1, PF_NO_GROW | PF_SHARED_WRITE_LOCK ) ) { while ( cursor.next() ) { writeCursor.copyTo( 0, cursor, 0, pageSize ); } } } } }

Target:
protected void setDefaultValue( long defaultValue ) throws IOException { try ( PageCursor writeCursor = pagedFile.io( 0, PF_SHARED_WRITE_LOCK | PF_NO_GROW ) ) { writeCursor.next(); int pageSize = pagedFile.pageSize(); fillPageWithDefaultValue( writeCursor, defaultValue, pageSize ); if ( pageId( length - 1 ) > 0 ) { try ( PageCursor cursor = pagedFile.io( 1, PF_NO_GROW | PF_SHARED_WRITE_LOCK ) ) { while ( cursor.next() ) { writeCursor.copyTo( 0, cursor, 0, pageSize ); checkBounds( writeCursor ); } } } } }
Source:
public void findOne() throws Exception { context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description") .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$.description", is(bitstreamFormat.getDescription()))) .andExpect(jsonPath("$.shortDescription", is(bitstreamFormat.getShortDescription()))) .andExpect(jsonPath("$.mimetype", is(bitstreamFormat.getMIMEType()))) .andExpect(jsonPath("$.type", is("bitstreamformat"))) .andExpect(jsonPath("$._links.self.href", startsWith(REST_SERVER_URL))) .andExpect(jsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + bitstreamFormat.getID()))); }

Target:
public void findOne() throws Exception { context.turnOffAuthorisationSystem(); BitstreamFormat bitstreamFormat = BitstreamFormatBuilder.createBitstreamFormat(context) .withMimeType("application/octet-stream") .withDescription("Description") .build(); context.restoreAuthSystemState(); getClient().perform(get("/api/core/bitstreamformats/" + bitstreamFormat.getID())) .andExpect(status().isOk()) .andExpect(content().contentType(contentType)) .andExpect(jsonPath("$", Matchers.is( BitstreamFormatMatcher .matchBitstreamFormat(bitstreamFormat.getID(), bitstreamFormat.getMIMEType(), bitstreamFormat.getDescription()) ))); }
Source:
protected void showSelection() { if (getEdgeEditPart() == null) { return; } super.showSelection(); final ViewEdgeFigure fig = getViewEdgeFigure(); if (fig != null && Display.getCurrent() != null) { fig.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION)); fig.setLineWidth(DiagramEdgeEditPartOperation.getLineWidth(getEdgeEditPart()) + WIDTH_FEEDBACK); for (final Object child : fig.getChildren()) { if (child instanceof PolylineDecoration) { final PolylineDecoration decoration = (PolylineDecoration) child; decoration.setLineWidth(DiagramEdgeEditPartOperation.getLineWidth(getEdgeEditPart()) + WIDTH_FEEDBACK); } } } if (getHost() instanceof AbstractDiagramNameEditPart) { if (((AbstractDiagramNameEditPart) getHost()).getFigure() instanceof SiriusWrapLabelWithAttachment) { ((SiriusWrapLabelWithAttachment) ((AbstractDiagramNameEditPart) getHost()).getFigure()).showAttachment(); } } else { for (final AbstractDiagramNameEditPart edgeNameEditPart : getEdgeNameEditPart()) { if (edgeNameEditPart != null && edgeNameEditPart.getEditText() != null && !"".equals(edgeNameEditPart.getEditText())) { if (edgeNameEditPart.getFigure() instanceof SiriusWrapLabelWithAttachment) { ((SiriusWrapLabelWithAttachment) edgeNameEditPart.getFigure()).showAttachment(); } } } } }

Target:
protected void showSelection() { if (getEdgeEditPart() == null) { return; } super.showSelection(); final ViewEdgeFigure fig = getViewEdgeFigure(); if (fig != null && Display.getCurrent() != null) { fig.setForegroundColor(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION)); fig.setLineWidth(DiagramEdgeEditPartOperation.getLineWidth(getEdgeEditPart()) + WIDTH_FEEDBACK); for (final Object child : fig.getChildren()) { if (child instanceof PolylineDecoration) { final PolylineDecoration decoration = (PolylineDecoration) child; decoration.setLineWidth(DiagramEdgeEditPartOperation.getLineWidth(getEdgeEditPart()) + WIDTH_FEEDBACK); } } } if (getHost() instanceof AbstractDiagramNameEditPart) { if (((AbstractDiagramNameEditPart) getHost()).getFigure() instanceof SiriusWrapLabelWithAttachment) { ((SiriusWrapLabelWithAttachment) ((AbstractDiagramNameEditPart) getHost()).getFigure()).showAttachment(); } } else { for (final AbstractDiagramNameEditPart edgeNameEditPart : getEdgeNameEditPart()) { if (edgeNameEditPart != null && !StringUtil.isEmpty(edgeNameEditPart.getEditText())) { if (edgeNameEditPart.getFigure() instanceof SiriusWrapLabelWithAttachment) { ((SiriusWrapLabelWithAttachment) edgeNameEditPart.getFigure()).showAttachment(); } } } } }
Source:
public static NodeId getNodeId(Map<String, Object> properties, int nodeNamespaceIndex, NodeIdType nodeIdType) { String nodeIdString = (String) properties.get(NODE_ID); if (nodeIdType == NodeIdType.NUMERIC) { return new NodeId(nodeNamespaceIndex, Integer.parseInt(nodeIdString)); } else if (nodeIdType == NodeIdType.STRING) { return new NodeId(nodeNamespaceIndex, nodeIdString); } else if (nodeIdType == NodeIdType.GUID) { return new NodeId(nodeNamespaceIndex, UUID.fromString(nodeIdString)); } else { return new NodeId(nodeNamespaceIndex, ByteString.of(Base64.getDecoder().decode(nodeIdString))); } }

Target:
public static NodeId getNodeId(Map<String, Object> properties, int nodeNamespaceIndex, NodeIdType nodeIdType) { String nodeIdString = (String) properties.get(NODE_ID); switch (nodeIdType) { case NUMERIC: return new NodeId(nodeNamespaceIndex, Integer.parseInt(nodeIdString)); case STRING: return new NodeId(nodeNamespaceIndex, nodeIdString); case GUID: return new NodeId(nodeNamespaceIndex, UUID.fromString(nodeIdString)); case OPAQUE: return new NodeId(nodeNamespaceIndex, ByteString.of(Base64.getDecoder().decode(nodeIdString))); default: throw new IllegalArgumentException(); } }
Source:
public Buffer(String directory) { FileSystem.mkdirs(directory); this.directory = directory; this.inventory = Inventory.create(directory + File.separator + "meta" + File.separator + "inventory"); this.threadNamePrefix = "buffer-" + System.identityHashCode(this); this.percentageOfVerifiesScanningBuffer = ((double) this.numberOfVerifiesTouchingPage)/this.numberOfVerifiesInitiated; }

Target:
public Buffer(String directory) { FileSystem.mkdirs(directory); this.directory = directory; this.inventory = Inventory.create(directory + File.separator + "meta" + File.separator + "inventory"); this.threadNamePrefix = "buffer-" + System.identityHashCode(this); numVerifyRequests = new AtomicLong(); numVerifyScans = new AtomicLong(); }
Source:
public void hitRateCanBeReturned() throws IllegalAccessException, InstantiationException { Store.ValueHolder<V> valueHolder = factory.newValueHolder(factory.createValue(1)); assertThat(valueHolder.hitRate(TimeUnit.MILLISECONDS.convert(Time.time(), TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS), is(notNullValue())); }

Target:
public void hitRateCanBeReturned() throws IllegalAccessException, InstantiationException { Store.ValueHolder<V> valueHolder = factory.newValueHolder(factory.createValue(1)); assertThat(valueHolder.hitRate(TimeUnit.MILLISECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS), anyOf(is(Float.NaN), is(0.0f))); }
Source:
public void updateUserPassword() throws Exception { HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null); j.jenkins.setSecurityRealm(securityRealm); WebClient wc = j.createWebClient(); spySecurityListener.usersWithPasswordUpdate.clear(); assertTrue(spySecurityListener.usersWithPasswordUpdate.isEmpty()); SignupPage signup = new SignupPage(wc.goTo("signup")); signup.enterUsername("debbie"); signup.enterPassword("debbie"); signup.enterFullName(StringUtils.capitalize("debbie user")); signup.enterEmail("debbie" + "@" + "debbie" + ".com"); HtmlPage p = signup.submit(j); assertEquals(200, p.getWebResponse().getStatusCode()); User debbie = User.getById("debbie", false); URL configPage = wc.createCrumbedUrl(debbie.getUrl() + "/" + "configSubmit"); String formData = "{\"fullName\": \"debbie user\", \"description\": \"\", \"userProperty3\": {\"primaryViewName\": \"\"}, \"userProperty5\": {\"password\": \"admin\", \"$redact\": [\"password\", \"password2\"], \"password2\": \"admin\"}, \"userProperty6\": {\"authorizedKeys\": \"\"}, \"userProperty8\": {\"insensitiveSearch\": true}, \"core:apply\": \"true\"}"; WebRequest request = new WebRequest(configPage, HttpMethod.POST); request.setAdditionalHeader("Content-Type", "application/x-www-form-urlencoded"); request.setRequestBody("json=" + URLEncoder.encode(formData, StandardCharsets.UTF_8.name())); Page page = wc.getPage(request); assertTrue(spySecurityListener.usersWithPasswordUpdate.get(0).equals("debbie")); assertEquals(200, page.getWebResponse().getStatusCode()); }

Target:
public void updateUserPassword() throws Exception { HudsonPrivateSecurityRealm securityRealm = new HudsonPrivateSecurityRealm(true, false, null); j.jenkins.setSecurityRealm(securityRealm); WebClient wc = j.createWebClient(); spyPasswordListener.usersWithPasswordUpdate.clear(); assertTrue(spyPasswordListener.usersWithPasswordUpdate.isEmpty()); SignupPage signup = new SignupPage(wc.goTo("signup")); signup.enterUsername("debbie"); signup.enterPassword("debbie"); signup.enterFullName(StringUtils.capitalize("debbie user")); signup.enterEmail("debbie" + "@" + "debbie" + ".com"); HtmlPage p = signup.submit(j); assertEquals(200, p.getWebResponse().getStatusCode()); User debbie = User.getById("debbie", false); URL configPage = wc.createCrumbedUrl(debbie.getUrl() + "/" + "configSubmit"); String formData = "{\"fullName\": \"debbie user\", \"description\": \"\", \"userProperty3\": {\"primaryViewName\": \"\"}, \"userProperty5\": {\"user.password\": \"admin\", \"$redact\": [\"user.password\", \"user.password2\"], \"user.password2\": \"admin\"}, \"userProperty6\": {\"authorizedKeys\": \"\"}, \"userProperty8\": {\"insensitiveSearch\": true}, \"core:apply\": \"true\"}"; WebRequest request = new WebRequest(configPage, HttpMethod.POST); request.setAdditionalHeader("Content-Type", "application/x-www-form-urlencoded"); request.setRequestBody("json=" + URLEncoder.encode(formData, StandardCharsets.UTF_8.name())); Page page = wc.getPage(request); assertEquals(200, page.getWebResponse().getStatusCode()); assertTrue(spyPasswordListener.usersWithPasswordUpdate.get(0).equals("debbie")); }
Source:
private String getPropertyName(ASTMethod astMethod) { String methodName = astMethod.getName(); if(astMethod.isAnnotated(ParcelProperty.class)){ return astMethod.getAnnotation(ParcelProperty.class).value(); } for (String prepend : PREPENDS) { if (methodName.startsWith(prepend) && methodName.length() - prepend.length() > 0) { String name = methodName.substring(prepend.length()); return name.substring(0, 1).toLowerCase(Locale.getDefault()) + (name.length() > 1 ? name.substring(1) : ""); } } throw new TransfuseAnalysisException("Unable to convert Method name " + methodName); }

Target:
private String getPropertyName(ASTMethod astMethod) { String methodName = astMethod.getName(); if(astMethod.isAnnotated(ParcelProperty.class)){ return astMethod.getAnnotation(ParcelProperty.class).value(); } for (String prepend : PREPENDS) { if (methodName.startsWith(prepend)) { String name = methodName.substring(prepend.length()); return name.substring(0, 1).toLowerCase(Locale.getDefault()) + name.substring(1); } } throw new TransfuseAnalysisException("Unable to convert Method name " + methodName); }
Source:
void shouldReturnPong(String acceptHeader) { ValidatableMockMvcResponse response = given() .header(HttpHeaders.ACCEPT, acceptHeader) .when() .get(getContextBaseUrl()) .peek() .then() .statusCode(HttpStatus.OK.value()); String message = "pong"; getResponseBody(response, acceptHeader, message); }

Target:
void shouldReturnPong(String acceptHeader) { ValidatableMockMvcResponse response = given().accept(acceptHeader) .when() .get(getContextBaseUrl()) .peek() .then() .statusCode(HttpStatus.OK.value()); String message = "pong"; validateResponseBody(response, acceptHeader, message); }
Source:
public UniquenessEnforcerNode(ReteContainer reteContainer, int tupleWidth) { super(reteContainer); this.parents = new ArrayList<Supplier>(); this.memory = new TupleMemory(); this.rederivableMemory = new TupleMemory(); this.tupleWidth = tupleWidth; reteContainer.registerClearable(this.memory); this.nullMask = TupleMask.linear(0, tupleWidth); this.identityMask = TupleMask.identity(tupleWidth); this.deleteRederive = true; }

Target:
public UniquenessEnforcerNode(ReteContainer reteContainer, int tupleWidth) { super(reteContainer); this.parents = new ArrayList<Supplier>(); this.memory = new TupleMemory(); this.rederivableMemory = new TupleMemory(); this.tupleWidth = tupleWidth; reteContainer.registerClearable(this.memory); reteContainer.registerClearable(this.rederivableMemory); this.nullMask = TupleMask.linear(0, tupleWidth); this.identityMask = TupleMask.identity(tupleWidth); this.deleteRederive = true; }
Source:
public Integer encode(MonthDay value) { if ( value == null ) { return null; } return 37 * value.getMonthValue() + value.getDayOfMonth(); }

Target:
public Integer encode(MonthDay value) { if ( value == null ) { return null; } return 100 * value.getMonthValue() + value.getDayOfMonth(); }
Source:
public Optional<BaseObject> getXObject(XWikiDocument doc, DocumentReference classRef, int objectNumber) { BaseObject bObj = null; List<BaseObject> objs = getXObjects(doc, classRef); for (BaseObject baseObject : objs) { if (baseObject.getNumber() == objectNumber) { bObj = baseObject; } } return Optional.fromNullable(bObj); }

Target:
public Optional<BaseObject> getXObject(XWikiDocument doc, DocumentReference classRef, int objectNumber) { BaseObject bObj = null; List<BaseObject> objs = getXObjects(doc, classRef); for (BaseObject baseObject : objs) { if (baseObject.getNumber() == objectNumber) { bObj = baseObject; break; } } return Optional.fromNullable(bObj); }
Source:
private static NewXmlVerifier createVerifier(String fileName, NewXmlCheck check) { File file = new File(BASE_DIR.toFile(), check.getClass().getSimpleName() + "/" + fileName); RuleKey checkRuleKey = RuleKey.of(Xml.REPOSITORY_KEY, check.ruleKey()); SensorContextTester context = SensorContextTester.create(BASE_DIR) .setActiveRules(new ActiveRulesBuilder().create(checkRuleKey).activate().build()); String filePath = file.getPath(); String content; try { content = Files.lines(file.toPath()).collect(Collectors.joining("\n")); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to load content of file %s", filePath), e); } DefaultInputFile defaultInputFile = TestInputFileBuilder.create("", filePath) .setType(InputFile.Type.MAIN) .initMetadata(content) .setLanguage(Xml.KEY) .setCharset(StandardCharsets.UTF_8) .build(); context.fileSystem().add(defaultInputFile); NewXmlFile newXmlFile; try { newXmlFile = NewXmlFile.create(defaultInputFile); } catch (IOException | ParserConfigurationException e) { throw new IllegalStateException(String.format("Unable to scan xml file %s", filePath), e); } check.scanFile(context, newXmlFile); return new NewXmlVerifier(context.allIssues()); }

Target:
private static NewXmlVerifier createVerifier(String fileName, NewXmlCheck check) { File file = new File(new File(BASE_DIR.toFile(), check.getClass().getSimpleName()), fileName); RuleKey checkRuleKey = RuleKey.of(Xml.REPOSITORY_KEY, check.ruleKey()); SensorContextTester context = SensorContextTester.create(BASE_DIR) .setActiveRules(new ActiveRulesBuilder().create(checkRuleKey).activate().build()); String filePath = file.getPath(); String content; try { content = Files.lines(file.toPath()).collect(Collectors.joining("\n")); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to load content of file %s", filePath), e); } DefaultInputFile defaultInputFile = TestInputFileBuilder.create("", filePath) .setType(InputFile.Type.MAIN) .initMetadata(content) .setLanguage(Xml.KEY) .setCharset(StandardCharsets.UTF_8) .build(); context.fileSystem().add(defaultInputFile); NewXmlFile newXmlFile; try { newXmlFile = NewXmlFile.create(defaultInputFile); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to scan xml file %s", filePath), e); } check.scanFile(context, newXmlFile); return new NewXmlVerifier(context.allIssues()); }
Source:
static short computeSerialVersionUid(Class cls, List<Field> fields) throws IOException { if (Serializable.class.isAssignableFrom(cls) && !Enum.class.isAssignableFrom(cls)) { try { Field field = cls.getDeclaredField("serialVersionUID"); if (field.getType() == long.class) { int mod = field.getModifiers(); if (Modifier.isStatic(mod) && Modifier.isFinal(mod)) { field.setAccessible(true); return (short)field.getLong(null); } } } catch (NoSuchFieldException ignored) { } catch (IllegalAccessException e) { throw new IOException(e); } if (false ) return (short)ObjectStreamClass.lookup(cls).getSerialVersionUID(); } MessageDigest md; try { md = MessageDigest.getInstance("SHA"); } catch (NoSuchAlgorithmException e) { throw new IOException("Failed to get digest for SHA.", e); } md.update(cls.getName().getBytes(UTF_8)); if (!F.isEmpty(fields)) { for (int i = 0; i < fields.size(); i++) { Field f = fields.get(i); md.update(f.getName().getBytes(UTF_8)); md.update(f.getType().getName().getBytes(UTF_8)); } } byte[] hashBytes = md.digest(); long hash = 0; for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) hash = (hash << 8) | (hashBytes[i] & 0xFF); return (short)hash; }

Target:
static short computeSerialVersionUid(Class cls, List<Field> fields) throws IOException { if (Serializable.class.isAssignableFrom(cls) && !Enum.class.isAssignableFrom(cls)) { try { Field field = cls.getDeclaredField("serialVersionUID"); if (field.getType() == long.class) { int mod = field.getModifiers(); if (Modifier.isStatic(mod) && Modifier.isFinal(mod)) { field.setAccessible(true); return (short)field.getLong(null); } } } catch (NoSuchFieldException ignored) { } catch (IllegalAccessException e) { throw new IOException(e); } if (USE_DFLT_SUID) return (short)ObjectStreamClass.lookup(cls).getSerialVersionUID(); } MessageDigest md; try { md = MessageDigest.getInstance("SHA"); } catch (NoSuchAlgorithmException e) { throw new IOException("Failed to get digest for SHA.", e); } md.update(cls.getName().getBytes(UTF_8)); if (!F.isEmpty(fields)) { for (int i = 0; i < fields.size(); i++) { Field f = fields.get(i); md.update(f.getName().getBytes(UTF_8)); md.update(f.getType().getName().getBytes(UTF_8)); } } byte[] hashBytes = md.digest(); long hash = 0; for (int i = Math.min(hashBytes.length, 8) - 1; i >= 0; i--) hash = (hash << 8) | (hashBytes[i] & 0xFF); return (short)hash; }
Source:
public void _provlr(CommandInterpreter interpreter) { String urlString = processArgument(interpreter.nextArgument()); String id = processArgument(interpreter.nextArgument()); String version = processArgument(interpreter.nextArgument()); if (urlString == null) { URI[] repositories = ProvisioningHelper.getMetadataRepositories(agent); if (repositories != null) for (URI repositorie : repositories) { interpreter.println(repositorie); } return; } URI repoLocation = toURI(interpreter, urlString); if (repoLocation == null) return; IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(agent, repoLocation, QueryUtil.createIUQuery(id, VersionRange.create(version)), null)); for (IInstallableUnit unit : units) { println(interpreter, unit); } }

Target:
public void _provlr(CommandInterpreter interpreter) { String urlString = processArgument(interpreter.nextArgument()); String id = processArgument(interpreter.nextArgument()); String version = processArgument(interpreter.nextArgument()); if (urlString == null) { URI[] repositories = ProvisioningHelper.getMetadataRepositories(agent); if (repositories != null) for (URI repository : repositories) { interpreter.println(repository); } return; } URI repoLocation = toURI(interpreter, urlString); if (repoLocation == null) return; IInstallableUnit[] units = sort(ProvisioningHelper.getInstallableUnits(agent, repoLocation, QueryUtil.createIUQuery(id, VersionRange.create(version)), null)); for (IInstallableUnit unit : units) { println(interpreter, unit); } }
Source:
public Optional<List> jsonValueToMetacardValue( WorkspaceTransformer transformer, List metacardJsonData) { ((List<Object>) metacardJsonData) .stream() .filter(Map.class::isInstance) .map(Map.class::cast) .forEach(listMetacardMap -> EXTERNAL_LIST_ATTRIBUTES.forEach(listMetacardMap::remove)); return super.jsonValueToMetacardValue(transformer, metacardJsonData); }

Target:
public Optional<List> jsonValueToMetacardValue( WorkspaceTransformer transformer, List metacardJsonData) { ((List<Object>) metacardJsonData) .stream() .filter(Map.class::isInstance) .map(Map.class::cast) .forEach(this::removeExternalListAttributes); return super.jsonValueToMetacardValue(transformer, metacardJsonData); }
Source:
public URI apply(final HttpResponse from) { final String statusCode = Integer.toString(from.getStatusCode()); if (statusCode != null && statusCode.equals("202") && from.getHeaders().containsKey("Location")){ String uri = from.getFirstHeaderOrNull("Location"); return URI.create(uri); } else if (statusCode != null && statusCode.equals("200")){ return null; } throw new IllegalStateException("did not receive expected response code and header in: " + from); }

Target:
public URI apply(final HttpResponse from) { if (from.getStatusCode() == 202 && from.getHeaders().containsKey("Location")){ String uri = from.getFirstHeaderOrNull("Location"); return URI.create(uri); } else if (from.getStatusCode() == 200){ return null; } throw new IllegalStateException("did not receive expected response code and header in: " + from); }
Source:
protected String[] customCommandLineValidation() { final LinkedList<String> errors = new LinkedList<String>(); if (READ_NAME_FORMAT == ReadNameFormat.CASAVA_1_8 && MACHINE_NAME == null) { errors.add("MACHINE_NAME is required when using Casava1.8-style read name headers."); } if (READ_NAME_FORMAT == ReadNameFormat.CASAVA_1_8 && FLOWCELL_BARCODE == null) { errors.add("FLOWCELL_BARCODE is required when using Casava1.8-style read name headers."); } if (ADAPTERS_TO_CHECK != null) { log.warn("ADAPTERS_TO_CHECK is no not used"); } if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }

Target:
protected String[] customCommandLineValidation() { final LinkedList<String> errors = new LinkedList<String>(); if (READ_NAME_FORMAT == ReadNameFormat.CASAVA_1_8 && MACHINE_NAME == null) { errors.add("MACHINE_NAME is required when using Casava1.8-style read name headers."); } if (READ_NAME_FORMAT == ReadNameFormat.CASAVA_1_8 && FLOWCELL_BARCODE == null) { errors.add("FLOWCELL_BARCODE is required when using Casava1.8-style read name headers."); } if (ADAPTERS_TO_CHECK != null) { log.warn("ADAPTERS_TO_CHECK is not used"); } if (errors.isEmpty()) { return null; } else { return errors.toArray(new String[errors.size()]); } }
Source:
@Override public BinaryType metadata(int typeId, int schemaId) throws BinaryObjectException { BinaryType meta = cache.metadata(typeId); if (meta == null || !((BinaryTypeImpl)meta).metadata().hasSchema(schemaId)) meta = requestAndCacheBinaryType(typeId); return meta != null && ((BinaryTypeImpl)meta).metadata().hasSchema(schemaId) ? meta : null; }

Target:
@Override public BinaryType metadata(int typeId, int schemaId) throws BinaryObjectException { BinaryType meta = cache.metadata(typeId); if (hasSchema(meta, schemaId)) return meta; meta = requestAndCacheBinaryType(typeId); return hasSchema(meta, schemaId) ? meta : null; }
Source:
public Map<?, ?> lookupArticlesByDois(List<String> dois) throws IOException { String doiQueryString = Joiner.on(" OR ").join(dois); ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery(doiQueryString) .setStart(0) .setRows(dois.size()) .setDateRange(SolrSearchApiImpl.SolrEnumeratedDateRange.ALL_TIME); return search(query.build()); }

Target:
public Map<?, ?> lookupArticlesByDois(List<String> dois) throws IOException { String doiQueryString = Joiner.on(" OR ").join(dois); ArticleSearchQuery.Builder query = ArticleSearchQuery.builder() .setQuery(doiQueryString) .setStart(0) .setRows(dois.size()); return search(query.build()); }