auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String toProject(final Project.NameKey proj, Status status) { switch (status) { case ABANDONED: return "project,abandoned," + proj.toString() + ",n,z"; case MERGED: return "project,merged," + proj.toString() + ",n,z"; default: return "project,open," + proj.toString() + ",n,z"; } }

Target:
public static String toProject(final Project.NameKey proj, Status status) { switch (status) { case ABANDONED: return "project,abandoned," + proj.toString() + ",n,z"; case MERGED: return "project,merged," + proj.toString() + ",n,z"; case NEW: case SUBMITTED: default: return "project,open," + proj.toString() + ",n,z"; } }
Source:
public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext) { return scheduleMessagesInternal(messages, scheduledEnqueueTime, transactionContext); }

Target:
public Flux<Long> scheduleMessages(Iterable<ServiceBusMessage> messages, OffsetDateTime scheduledEnqueueTime, ServiceBusTransactionContext transactionContext) { if (Objects.isNull(messages)) { return fluxError(logger, new NullPointerException("'messages' cannot be null.")); } if (Objects.isNull(scheduledEnqueueTime)) { return fluxError(logger, new NullPointerException("'scheduledEnqueueTime' cannot be null.")); } return createBatch().flatMapMany(messageBatch -> { messages.forEach(message -> messageBatch.tryAdd(message)); return getSendLink().flatMapMany(link -> connectionProcessor .flatMap(connection -> connection.getManagementNode(entityName, entityType)) .flatMapMany(managementNode -> managementNode.schedule(messageBatch.getMessages(), scheduledEnqueueTime, messageBatch.getMaxSizeInBytes(), link.getLinkName(), transactionContext))); }); }
Source:
private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().OpenGL20, GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel, GLContext.getCapabilities().GL_ARB_shader_objects}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "OpenGL20", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel", "GL_ARB_shader_objects"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }

Target:
private void checkOpenGL() { boolean[] requiredCapabilities = { GLContext.getCapabilities().OpenGL12, GLContext.getCapabilities().OpenGL14, GLContext.getCapabilities().OpenGL15, GLContext.getCapabilities().GL_ARB_framebuffer_object, GLContext.getCapabilities().GL_ARB_texture_float, GLContext.getCapabilities().GL_ARB_half_float_pixel, GLContext.getCapabilities().GL_ARB_shader_objects}; String[] capabilityNames = {"OpenGL12", "OpenGL14", "OpenGL15", "GL_ARB_framebuffer_object", "GL_ARB_texture_float", "GL_ARB_half_float_pixel", "GL_ARB_shader_objects"}; boolean canRunTheGame = true; String missingCapabilitiesMessage = ""; for (int index = 0; index < requiredCapabilities.length; index++) { if (!requiredCapabilities[index]) { missingCapabilitiesMessage += " - " + capabilityNames[index] + "\n"; canRunTheGame = false; } } if (!canRunTheGame) { String completeErrorMessage = completeErrorMessage(missingCapabilitiesMessage); throw new IllegalStateException(completeErrorMessage); } }
Source:
public MetaParams() { this.metas = new MetaParam[]{}; this.length = 0; }

Target:
public MetaParams() { this.metas = EMPTY_ARRAY; this.length = 0; }
Source:
private ClusterState applyCreateIndexRequestWithV2Template(final ClusterState currentState, final CreateIndexClusterStateUpdateRequest request, final boolean silent, final String templateName, final BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception { logger.debug("applying create index request using the composable template [{}]", templateName); final Map<String, Object> mappings = resolveV2Mappings(request.mappings(), currentState, templateName, xContentRegistry); final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, MetadataIndexTemplateService.resolveSettings(currentState.metadata(), templateName), mappings, null, settings, indexScopedSettings); int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null); IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards); return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, mappings, indexService -> resolveAndValidateAliases(request.index(), request.aliases(), MetadataIndexTemplateService.resolveAliases(currentState.metadata(), templateName), currentState.metadata(), aliasValidator, xContentRegistry, indexService.newQueryShardContext(0, null, () -> 0L, null)), Collections.singletonList(templateName), metadataTransformer); }

Target:
private ClusterState applyCreateIndexRequestWithV2Template(final ClusterState currentState, final CreateIndexClusterStateUpdateRequest request, final boolean silent, final String templateName, final BiConsumer<Metadata.Builder, IndexMetadata> metadataTransformer) throws Exception { logger.debug("applying create index request using composable template [{}]", templateName); final Map<String, Object> mappings = resolveV2Mappings(request.mappings(), currentState, templateName, xContentRegistry); final Settings aggregatedIndexSettings = aggregateIndexSettings(currentState, request, MetadataIndexTemplateService.resolveSettings(currentState.metadata(), templateName), mappings, null, settings, indexScopedSettings); int routingNumShards = getIndexNumberOfRoutingShards(aggregatedIndexSettings, null); IndexMetadata tmpImd = buildAndValidateTemporaryIndexMetadata(currentState, aggregatedIndexSettings, request, routingNumShards); return applyCreateIndexWithTemporaryService(currentState, request, silent, null, tmpImd, mappings, indexService -> resolveAndValidateAliases(request.index(), request.aliases(), MetadataIndexTemplateService.resolveAliases(currentState.metadata(), templateName), currentState.metadata(), aliasValidator, xContentRegistry, indexService.newQueryShardContext(0, null, () -> 0L, null)), Collections.singletonList(templateName), metadataTransformer); }
Source:
public void verifyAnswerableForInstructor(FeedbackQuestionAttributes feedbackQuestionAttributes) { verifyNotNull(feedbackQuestionAttributes, "feedback session's course ID"); if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.INSTRUCTORS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.SELF) { throw new UnauthorizedAccessException("Feedback question is not answerable for instructors"); } }

Target:
public void verifyAnswerableForInstructor(FeedbackQuestionAttributes feedbackQuestionAttributes) { verifyNotNull(feedbackQuestionAttributes, "feedback question"); if (feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.INSTRUCTORS && feedbackQuestionAttributes.getGiverType() != FeedbackParticipantType.SELF) { throw new UnauthorizedAccessException("Feedback question is not answerable for instructors"); } }
Source:
public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); if (detail == null) { itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { PatchSet patchSet = null; PatchSetContent content = new PatchSetContent(patchSet, detail); return pull(parentObject, content, monitor); } return null; }

Target:
public PatchSetContent pull(IReviewItemSet parentObject, String key, IProgressMonitor monitor) throws CoreException { RemoteEmfConsumer<IReview, IReviewItemSet, String, PatchSetDetail, PatchSetDetail, String> itemSetConsumer = getGerritProvider().getReviewItemSetFactory() .getConsumerForLocalKey(parentObject.getReview(), key); PatchSetDetail detail = itemSetConsumer.getRemoteObject(); if (detail == null) { itemSetConsumer.pull(false, monitor); detail = itemSetConsumer.getRemoteObject(); } if (detail != null) { PatchSetContent content = new PatchSetContent(null, detail); return pull(parentObject, content, monitor); } return null; }
Source:
public void testEnumObjects() throws Exception { PointerByReference peidlPTR = new PointerByReference(); int SHCONTF_FOLDERS = 0x20; int SHCONTF_NONFOLDERS = 0x40; boolean sawNames=false; WinNT.HRESULT hr = psfMyComputer.EnumObjects(null, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, peidlPTR); if (COMUtils.SUCCEEDED(hr)) { IEnumIDList peidl = IEnumIDList.Converter.PointerToIEnumIDList(peidlPTR); PointerByReference pidlItem = new PointerByReference(); while (peidl.Next(1, pidlItem, null).intValue() == COMUtils.S_OK) { PointerByReference sr = new PointerByReference(); hr = psfMyComputer.GetDisplayNameOf(pidlItem.getValue(), 0, sr); if (COMUtils.SUCCEEDED(hr)) { PointerByReference pszName = new PointerByReference(); hr = Shlwapi.INSTANCE.StrRetToStr(sr, pidlItem.getValue(), pszName); if (COMUtils.SUCCEEDED(hr)) { String wideString = pszName.getValue().getWideString(0); if (wideString != null && wideString.length() > 0) sawNames = true; Ole32.INSTANCE.CoTaskMemFree(pszName.getValue()); } Ole32.INSTANCE.CoTaskMemFree(sr.getValue()); } Ole32.INSTANCE.CoTaskMemFree(pidlItem.getValue()); } peidl.Release(); } assertTrue(sawNames); }

Target:
public void testEnumObjects() throws Exception { PointerByReference peidlPTR = new PointerByReference(); int SHCONTF_FOLDERS = 0x20; int SHCONTF_NONFOLDERS = 0x40; boolean sawNames = false; WinNT.HRESULT hr = psfMyComputer.EnumObjects(null, SHCONTF_FOLDERS | SHCONTF_NONFOLDERS, peidlPTR); assertTrue(COMUtils.SUCCEEDED(hr)); IEnumIDList peidl = IEnumIDList.Converter.PointerToIEnumIDList(peidlPTR); PointerByReference pidlItem = new PointerByReference(); while (peidl.Next(1, pidlItem, null).intValue() == COMUtils.S_OK) { PointerByReference sr = new PointerByReference(); hr = psfMyComputer.GetDisplayNameOf(pidlItem.getValue(), 0, sr); assertTrue(COMUtils.SUCCEEDED(hr)); PointerByReference pszName = new PointerByReference(); hr = Shlwapi.INSTANCE.StrRetToStr(sr, pidlItem.getValue(), pszName); assertTrue(COMUtils.SUCCEEDED(hr)); String wideString = pszName.getValue().getWideString(0); if (wideString != null && wideString.length() > 0) sawNames = true; Ole32.INSTANCE.CoTaskMemFree(pszName.getValue()); Ole32.INSTANCE.CoTaskMemFree(pidlItem.getValue()); } peidl.Release(); assertTrue(sawNames); }
Source:
public String[] search(QueryExpression query) throws ServerException { IndexSearcher luceneSearcher = null; try { searcherManager.maybeRefresh(); luceneSearcher = searcherManager.acquire(); Query luceneQuery = createLuceneQuery(query); ScoreDoc after = null; final int numSkipDocs = Math.max(0, query.getSkipCount()); if (numSkipDocs > 0) { after = skipScoreDocs(luceneSearcher, luceneQuery, numSkipDocs); } final int numDocs = query.getMaxItems() > 0 ? Math.min(query.getMaxItems(), RESULT_LIMIT) : RESULT_LIMIT; final TopDocs topDocs = luceneSearcher.searchAfter(after, luceneQuery, numDocs); final String[] result = new String[topDocs.scoreDocs.length]; for (int i = 0, length = result.length; i < length; i++) { result[i] = luceneSearcher.doc(topDocs.scoreDocs[i].doc).getField("path").stringValue(); } return result; } catch (IOException e) { throw new ServerException(e.getMessage(), e); } finally { try { searcherManager.release(luceneSearcher); } catch (IOException e) { LOG.error(e.getMessage()); } } }

Target:
public String[] search(QueryExpression query) throws ServerException { IndexSearcher luceneSearcher = null; try { searcherManager.maybeRefresh(); luceneSearcher = searcherManager.acquire(); Query luceneQuery = createLuceneQuery(query); ScoreDoc after = null; final int numSkipDocs = Math.max(0, query.getSkipCount()); if (numSkipDocs > 0) { after = skipScoreDocs(luceneSearcher, luceneQuery, numSkipDocs); } final int numDocs = query.getMaxItems() > 0 ? Math.min(query.getMaxItems(), RESULT_LIMIT) : RESULT_LIMIT; final TopDocs topDocs = luceneSearcher.searchAfter(after, luceneQuery, numDocs); final String[] result = new String[topDocs.scoreDocs.length]; for (int i = 0, length = result.length; i < length; i++) { result[i] = luceneSearcher.doc(topDocs.scoreDocs[i].doc).getField("path").stringValue(); } return result; } catch (IOException e) { throw new ServerException(e.getMessage(), e); } finally { try { if (luceneSearcher != null) { searcherManager.release(luceneSearcher); } } catch (IOException e) { LOG.error(e.getMessage()); } } }
Source:
private String getContainersDescriptionForLogging() { StringBuilder sb = new StringBuilder(); for (ContainerTemplate ct : getContainers()) { sb.append("* ).append(ct.getName()).append( ").append(ct.getImage()); StringBuilder optional = new StringBuilder(); optionalField(optional, "resourceRequestCpu", ct.getResourceRequestCpu()); optionalField(optional, "resourceRequestMemory", ct.getResourceRequestMemory()); optionalField(optional, "resourceLimitCpu", ct.getResourceLimitCpu()); optionalField(optional, "resourceLimitMemory", ct.getResourceLimitMemory()); if (optional.length() > 0) { sb.append("(").append(optional).append(")"); } sb.append("\n"); } if (isShowRawYaml()) { for (String yaml : getYamls()) { sb.append("yaml:\n") .append(yaml) .append("\n"); } } return sb.toString(); }

Target:
private String getContainersDescriptionForLogging() { List<ContainerTemplate> containers = getContainers(); StringBuilder sb = new StringBuilder(); for (ContainerTemplate ct : containers) { sb.append("* ).append(ct.getName()).append( ").append(ct.getImage()); StringBuilder optional = new StringBuilder(); optionalField(optional, "resourceRequestCpu", ct.getResourceRequestCpu()); optionalField(optional, "resourceRequestMemory", ct.getResourceRequestMemory()); optionalField(optional, "resourceLimitCpu", ct.getResourceLimitCpu()); optionalField(optional, "resourceLimitMemory", ct.getResourceLimitMemory()); if (optional.length() > 0) { sb.append("(").append(optional).append(")"); } sb.append("\n"); } if (isShowRawYaml()) { for (String yaml : getYamls()) { sb.append("yaml:\n") .append(yaml) .append("\n"); } } return sb.toString(); }
Source:
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (rawPassword == null) { throw new IllegalArgumentException("Raw password cannot be null"); } if (encodedPassword == null || encodedPassword.length() == 0) { logger.warn("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }

Target:
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (rawPassword == null) { throw new IllegalArgumentException("rawPassword cannot be null"); } if (encodedPassword == null || encodedPassword.length() == 0) { logger.warn("Empty encoded password"); return false; } if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
Source:
public void changeDetail(final Change.Id id, final AsyncCallback<ChangeDetail> callback) { run(callback, new Action<ChangeDetail>() { public ChangeDetail run(final ReviewDb db) throws OrmException, Failure { final Account.Id me = Common.getAccountId(); final Change change = db.changes().get(id); if (change == null) { throw new Failure(new NoSuchEntityException()); } final PatchSet patch = db.patchSets().get(change.currentPatchSetId()); final Project proj = Common.getProjectCache().get(change.getDest().getParentKey()) .getProject(); if (patch == null || proj == null) { throw new Failure(new NoSuchEntityException()); } assertCanRead(change); final boolean anon; boolean canAbandon = false; if (me == null) { anon = true; } else { anon = canRead(null, change.getDest().getParentKey()); canAbandon = me.equals(change.getOwner()) || me.equals(patch.getUploader()) || Common.getGroupCache().isAdministrator(me) || Common.getGroupCache().isInGroup(me, proj.getOwnerGroupId()); } final ChangeDetail d = new ChangeDetail(); d.load(db, new AccountInfoCacheFactory(db), change, anon, canAbandon); return d; } }); }

Target:
public void changeDetail(final Change.Id id, final AsyncCallback<ChangeDetail> callback) { run(callback, new Action<ChangeDetail>() { public ChangeDetail run(final ReviewDb db) throws OrmException, Failure { final Account.Id me = Common.getAccountId(); final Change change = db.changes().get(id); if (change == null) { throw new Failure(new NoSuchEntityException()); } final PatchSet patch = db.patchSets().get(change.currentPatchSetId()); final ProjectCache.Entry projEnt = Common.getProjectCache().get(change.getDest().getParentKey()); if (patch == null || projEnt == null) { throw new Failure(new NoSuchEntityException()); } final Project proj = projEnt.getProject(); assertCanRead(change); final boolean anon; boolean canAbandon = false; if (me == null) { anon = true; } else { anon = canRead(null, change.getDest().getParentKey()); canAbandon = me.equals(change.getOwner()) || me.equals(patch.getUploader()) || Common.getGroupCache().isAdministrator(me) || Common.getGroupCache().isInGroup(me, proj.getOwnerGroupId()); } final ChangeDetail d = new ChangeDetail(); d.load(db, new AccountInfoCacheFactory(db), change, anon, canAbandon); return d; } }); }
Source:
void setUp() { factory = shouldHaveSizeLessThan(newArrayList('a', 'b'), 4, 2); }

Target:
void setUp() { factory = shouldHaveSizeLessThan("ab", 4, 2); }
Source:
public PortListOptions displayName(String displayName) { return add("name", displayName); }

Target:
public PortListOptions displayName(String displayName) { return add("display_name", displayName); }
Source:
protected boolean canDoAction() { return getParameters().getDiskImage().getDiskStorageType() == DiskStorageType.IMAGE; }

Target:
protected boolean canDoAction() { if (getParameters().getDiskImage().getDiskStorageType() != DiskStorageType.IMAGE) { addCanDoActionMessage("$diskId " + getParameters().getDiskImage().getId()); addCanDoActionMessage("$storageType " + getParameters().getDiskImage().getDiskStorageType()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_UNSUPPORTED_DISK_STORAGE_TYPE); return false; } else { return true; } }
Source:
private LocalProc( String name, ProcessBuilder procBuilder, InputStream in, OutputStream out, OutputStream err ) throws IOException { Logger.getLogger(Proc.class.getName()).log(Level.FINE, "Running: {0}", name); this.name = name; this.out = out; this.cookie = EnvVars.createCookie(); procBuilder.environment().putAll(cookie); if (procBuilder.directory() != null && !procBuilder.directory().exists()) { throw new IOException(String.format("Process working directory '%s' doesn't exists!", procBuilder.directory().getAbsolutePath())); } this.proc = procBuilder.start(); InputStream procInputStream = proc.getInputStream(); if (out==SELFPUMP_OUTPUT) { stdout = procInputStream; copier = null; } else { copier = new StreamCopyThread(name+": stdout copier", procInputStream, out); copier.start(); stdout = null; } if (in == null) { stdin = null; proc.getOutputStream().close(); } else if (in==SELFPUMP_INPUT) { stdin = proc.getOutputStream(); } else { new StdinCopyThread(name+": stdin copier",in,proc.getOutputStream()).start(); stdin = null; } InputStream procErrorStream = proc.getErrorStream(); if(err!=null) { if (err==SELFPUMP_OUTPUT) { stderr = procErrorStream; copier2 = null; } else { stderr = null; copier2 = new StreamCopyThread(name+": stderr copier", procErrorStream, err); copier2.start(); } } else { if (procErrorStream!=procInputStream) { procErrorStream.close(); } copier2 = null; stderr = null; } }

Target:
private LocalProc( String name, ProcessBuilder procBuilder, InputStream in, OutputStream out, OutputStream err ) throws IOException { Logger.getLogger(Proc.class.getName()).log(Level.FINE, "Running: {0}", name); this.name = name; this.out = out; this.cookie = EnvVars.createCookie(); procBuilder.environment().putAll(cookie); if (procBuilder.directory() != null && !procBuilder.directory().exists()) { throw new IOException(String.format("Process working directory '%s' doesn't exist!", procBuilder.directory().getAbsolutePath())); } this.proc = procBuilder.start(); InputStream procInputStream = proc.getInputStream(); if (out==SELFPUMP_OUTPUT) { stdout = procInputStream; copier = null; } else { copier = new StreamCopyThread(name+": stdout copier", procInputStream, out); copier.start(); stdout = null; } if (in == null) { stdin = null; proc.getOutputStream().close(); } else if (in==SELFPUMP_INPUT) { stdin = proc.getOutputStream(); } else { new StdinCopyThread(name+": stdin copier",in,proc.getOutputStream()).start(); stdin = null; } InputStream procErrorStream = proc.getErrorStream(); if(err!=null) { if (err==SELFPUMP_OUTPUT) { stderr = procErrorStream; copier2 = null; } else { stderr = null; copier2 = new StreamCopyThread(name+": stderr copier", procErrorStream, err); copier2.start(); } } else { if (procErrorStream!=procInputStream) { procErrorStream.close(); } copier2 = null; stderr = null; } }
Source:
private void initFile() { String path = processingEnv.getOptions().get(DOC_OUTPUT_PROPERTY_NAME); if (path != null && path.trim().length() > 0) { file = new File(path); if (file.isDirectory()) { messager.printMessage(Diagnostic.Kind.WARNING, String.format("Specify a file path at %s to generate deep link doc.", DOC_OUTPUT_PROPERTY_NAME)); } else { final File parentDir = file.getParentFile(); if (!parentDir.exists() && !parentDir.mkdirs()) { messager.printMessage(Diagnostic.Kind.WARNING, String.format("Cannot create file specified at %s.", file)); } } } else { messager.printMessage(Diagnostic.Kind.WARNING, "DeepLink doc is not going to be generated."); } }

Target:
private void initFile() { String path = processingEnv.getOptions().get(DOC_OUTPUT_PROPERTY_NAME); if (path == null || path.trim().isEmpty()) { messager.printMessage(Diagnostic.Kind.NOTE, "Output path not specified, DeepLink doc is not going to be generated."); return; } file = new File(path); if (file.isDirectory()) { messager.printMessage(Diagnostic.Kind.NOTE, String.format("Specify a file path at %s to generate deep link doc.", DOC_OUTPUT_PROPERTY_NAME)); return; } File parentDir = file.getParentFile(); if (!parentDir.exists() && !parentDir.mkdirs()) { messager.printMessage(Diagnostic.Kind.NOTE, String.format("Cannot create file specified at %s.", file)); } }
Source:
public BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws IOException { acquireLock(ledgerId); try { EntryLogAndLockTuple entryLogAndLockTuple = ledgerIdEntryLogMap.get(ledgerId); return entryLogAndLockTuple.getEntryLog(); } catch (Exception e) { log.error("Received unexpected exception while fetching entry from map", e); throw new IOException("Received unexpected exception while fetching entry from map", e); } finally { releaseLock(ledgerId); } }

Target:
public BufferedLogChannel getCurrentLogForLedger(long ledgerId) throws IOException { BufferedLogChannelWithDirInfo bufferedLogChannelWithDirInfo = getCurrentLogWithDirInfoForLedger(ledgerId); BufferedLogChannel bufferedLogChannel = null; if (bufferedLogChannelWithDirInfo != null) { bufferedLogChannel = bufferedLogChannelWithDirInfo.getLogChannel(); } return bufferedLogChannel; }
Source:
static NotesMigration allEnabled() { Config cfg = new Config(); cfg.setBoolean("notedb", null, "write", true); cfg.setBoolean("notedb", "patchSetApprovals", "read", true); return new NotesMigration(cfg); }

Target:
static NotesMigration allEnabled() { Config cfg = new Config(); cfg.setBoolean("notedb", null, "write", true); return new NotesMigration(cfg); }
Source:
protected boolean addIgnoreNode(String directory) { File dir = new File(directory); if (!dir.exists()) { return false; } File ignoreFile = new File(directory + "/.gitignore"); if (!ignoreFile.exists()) { return false; } if (ignoreMap.get(directory) != null) { ignoreMap.get(directory).empty(); return true; } IgnoreNode n = new IgnoreNode(dir); ignoreMap.put(directory, n); return true; }

Target:
protected boolean addIgnoreNode(String directory) { File dir = new File(directory); File ignoreFile = new File(directory + "/.gitignore"); if (!ignoreFile.exists()) { return false; } if (ignoreMap.get(directory) != null) { ignoreMap.get(directory).clear(); return true; } IgnoreNode n = new IgnoreNode(dir); ignoreMap.put(directory, n); return true; }
Source:
private void processDeviceFileJobQueue(DatastoreService ds) throws InterruptedException { System.out.println("#Processing DeviceFileJobQueue"); final Filter f = new FilterPredicate("fileName", FilterOperator.LESS_THAN, "wfp"); final Filter f2 = new FilterPredicate("fileName", FilterOperator.GREATER_THAN, "ff"); final Query group_q = new Query("DeviceFileJobQueue"); final PreparedQuery pq = ds.prepare(group_q); for (Entity job : pq.asIterable(FetchOptions.Builder.withChunkSize(500))) { allDevicesJobs++; Long dfjId = job.getKey().getId(); String name = (String) job.getProperty("fileName"); if (name.endsWith("}")) { jsonDeviceJobs++; String name2 = name.substring(0,name.indexOf("\"")); System.out.println(name + " --> " + name2); job.setProperty("fileName", name2); fixupList.add(job); if (!doBatch) { ds.put(job); Thread.sleep(100); } else if (fixupList.size() > 99) { System.out.printf("#Fixing %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); fixupList.clear(); } } } if (doBatch) { System.out.printf("#Fixing final %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); } }

Target:
private void processDeviceFileJobQueue(DatastoreService ds) throws InterruptedException { System.out.println("#Processing DeviceFileJobQueue"); final Query group_q = new Query("DeviceFileJobQueue"); final PreparedQuery pq = ds.prepare(group_q); for (Entity job : pq.asIterable(FetchOptions.Builder.withChunkSize(500))) { allDevicesJobs++; String name = (String) job.getProperty("fileName"); if (name.endsWith("}")) { jsonDeviceJobs++; String name2 = name.substring(0,name.indexOf("\"")); System.out.println(name + " --> " + name2); job.setProperty("fileName", name2); fixupList.add(job); if (!doBatch) { ds.put(job); Thread.sleep(100); } else if (fixupList.size() > 99) { System.out.printf("#Fixing %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); fixupList.clear(); } } } if (doBatch) { System.out.printf("#Fixing final %d Jobs\n",fixupList.size()); batchSaveEntities(ds, fixupList); } }
Source:
public void testTimestamp() { assertNotNull(ToolTipString.fromTimestamp("", -1)); }

Target:
public void testTimestamp() { ToolTipString ts0 = ToolTipString.fromTimestamp("", -1); ToolTipString ts1 = ToolTipString.fromTimestamp("bob", -1); ToolTipString ts2 = ToolTipString.fromTimestamp("", 1); ToolTipString ts3 = ToolTipString.fromTimestamp("bob", 1); assertEquals("", ts0.toString()); assertEquals("bob", ts1.toString()); assertEquals("", ts2.toString()); assertEquals("bob", ts3.toString()); assertEquals("<a href=time://-1></a>", ts0.toHtmlString()); assertEquals("<a href=time://-1>bob</a>", ts1.toHtmlString()); assertEquals("<a href=time://1></a>", ts2.toHtmlString()); assertEquals("<a href=time://1>bob</a>", ts3.toHtmlString()); }
Source:
public Execution(ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, ExecutionStrategy subscriptionStrategy, Instrumentation instrumentation) { this.queryStrategy = queryStrategy != null ? queryStrategy : new AsyncExecutionStrategy(); this.mutationStrategy = mutationStrategy != null ? mutationStrategy : new AsyncExecutionStrategy(); this.subscriptionStrategy = subscriptionStrategy != null ? subscriptionStrategy : new AsyncExecutionStrategy(); this.instrumentation = instrumentation; }

Target:
public Execution(ExecutionStrategy queryStrategy, ExecutionStrategy mutationStrategy, ExecutionStrategy subscriptionStrategy, Instrumentation instrumentation) { this.queryStrategy = queryStrategy != null ? queryStrategy : new AsyncExecutionStrategy(); this.mutationStrategy = mutationStrategy != null ? mutationStrategy : new AsyncSerialExecutionStrategy(); this.subscriptionStrategy = subscriptionStrategy != null ? subscriptionStrategy : new AsyncExecutionStrategy(); this.instrumentation = instrumentation; }
Source:
public boolean addAll(int index, Collection<? extends T> c) { Collection<T> uniqueValuesToAdd = getUniqueValues(c); if (uniqueValuesToAdd.isEmpty()) { return false; } try { return super.addAll(index, uniqueValuesToAdd); } catch (IndexOutOfBoundsException ioobException) { comparingSet.removeAll(uniqueValuesToAdd); throw new IndexOutOfBoundsException(); } }

Target:
public boolean addAll(int index, Collection<? extends T> c) { Collection<T> uniqueValuesToAdd = getUniqueValues(c); if (uniqueValuesToAdd.isEmpty()) { return false; } try { return super.addAll(index, uniqueValuesToAdd); } catch (IndexOutOfBoundsException ioobException) { comparingSet.removeAll(uniqueValuesToAdd); throw ioobException; } }
Source:
public void stepEnded(LocalSearchStepScope stepScope) { super.stepEnded(stepScope); if (waterLevelIncrementScore != null) { currentWaterLevel = currentWaterLevel.subtract(waterLevelIncrementScore); } else { Score increment = currentWaterLevel.multiply(waterLevelIncrementRatio); currentWaterLevel = currentWaterLevel.subtract(increment); } logger.debug(currentWaterLevel.toShortString()); }

Target:
public void stepEnded(LocalSearchStepScope stepScope) { super.stepEnded(stepScope); if (waterLevelIncrementScore != null) { currentWaterLevel = currentWaterLevel.subtract(waterLevelIncrementScore); } else { Score increment = currentWaterLevel.multiply(waterLevelIncrementRatio); currentWaterLevel = currentWaterLevel.subtract(increment); } }
Source:
public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); checkArgument(tableName.length() < 1025, "tableName is longer than 1024 characters"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }

Target:
public void create(String tableName, NewTableConfiguration ntc) throws AccumuloException, AccumuloSecurityException, TableExistsException { checkArgument(tableName != null, "tableName is null"); checkArgument(ntc != null, "ntc is null"); checkArgument(tableName.length() <= MAX_TABLE_NAME_LEN, "Table name is longer than " + MAX_TABLE_NAME_LEN + " characters"); List<ByteBuffer> args = new ArrayList<>(); args.add(ByteBuffer.wrap(tableName.getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getTimeType().name().getBytes(UTF_8))); args.add(ByteBuffer.wrap(ntc.getInitialTableState().name().getBytes(UTF_8))); int numSplits = ntc.getSplits().size(); args.add(ByteBuffer.wrap(String.valueOf(numSplits).getBytes(UTF_8))); if (numSplits > 0) { for (Text t : ntc.getSplits()) { args.add(TextUtil.getByteBuffer(t)); } } Map<String,String> opts = ntc.getProperties(); try { doTableFateOperation(tableName, AccumuloException.class, FateOperation.TABLE_CREATE, args, opts); } catch (TableNotFoundException e) { throw new AssertionError(e); } }
Source:
public void testLdapLoginConfig() { LdapService ldapService = new LdapService(context); LdapLoginConfig ldapConfigOne = createLdapConfig(ldapService, "ldaps://ldap:1636"); ldapConfigOne.configure(); String configIdOne = ldapConfigOne.getId(); verify(context) .registerService( eq(JaasRealm.class), any(JaasRealm.class), Matchers.<Dictionary<String, Object>>any()); LdapLoginConfig ldapConfigTwo = createLdapConfig(ldapService, "ldaps://ldap:1636", "ldaps://ldap2:1636"); ldapConfigTwo.configure(); String configIdTwo = ldapConfigTwo.getId(); Map<String, String> ldapPropsOne = createLdapProperties("cn=user1"); ldapConfigOne.update(ldapPropsOne); Map<String, String> ldapPropsTwo = createLdapProperties("cn=user2"); ldapConfigTwo.update(ldapPropsTwo); List<Module> ldapModules = ldapService.getModules(); for (Module module : ldapModules) { String moduleName = module.getName(); String username = module.getOptions().getProperty(CONNECTION_USERNAME_OPTIONS_KEY); if (moduleName.equals(configIdOne)) { assertThat(username, is(equalTo("cn=user1"))); } else if (moduleName.equals(configIdTwo)) { assertThat(username, is(equalTo("cn=user2"))); } else { fail("The ldap modules did not update correctly."); } } verify(context, times(1)) .registerService( eq(JaasRealm.class), any(JaasRealm.class), Matchers.<Dictionary<String, Object>>any()); ldapConfigOne.destroy(1); assertThat(ldapService.delete(configIdOne), is(equalTo(false))); assertThat(ldapService.delete(configIdTwo), is(equalTo(true))); }

Target:
public void testLdapLoginConfig() { LdapService ldapService = new LdapService(context); LdapLoginConfig ldapConfigOne = createLdapConfig(ldapService, LDAP_URL_1); ldapConfigOne.configure(); String configIdOne = ldapConfigOne.getId(); verify(context) .registerService( eq(JaasRealm.class), any(JaasRealm.class), Matchers.<Dictionary<String, Object>>any()); LdapLoginConfig ldapConfigTwo = createLdapConfig(ldapService, LDAP_URL_1, LDAP_URL_2); ldapConfigTwo.configure(); String configIdTwo = ldapConfigTwo.getId(); Map<String, String> ldapPropsOne = createLdapProperties("cn=user1"); ldapConfigOne.update(ldapPropsOne); Map<String, String> ldapPropsTwo = createLdapProperties("cn=user2"); ldapConfigTwo.update(ldapPropsTwo); List<Module> ldapModules = ldapService.getModules(); for (Module module : ldapModules) { String moduleName = module.getName(); String username = module.getOptions().getProperty(CONNECTION_USERNAME_OPTIONS_KEY); if (moduleName.equals(configIdOne)) { assertThat(username, is(equalTo("cn=user1"))); } else if (moduleName.equals(configIdTwo)) { assertThat(username, is(equalTo("cn=user2"))); } else { fail("The ldap modules did not update correctly."); } } verify(context, times(1)) .registerService( eq(JaasRealm.class), any(JaasRealm.class), Matchers.<Dictionary<String, Object>>any()); ldapConfigOne.destroy(1); assertThat(ldapService.delete(configIdOne), is(equalTo(false))); assertThat(ldapService.delete(configIdTwo), is(equalTo(true))); }
Source:
void tick() { if (counter.getAndIncrement() == 0) { int emitted = 0; do { if (requested.get() > 0) { Object o = buffer.poll(); if (o != null) { if (buffer.isCompleted(o)) { child.onCompleted(); } else { buffer.accept(o, child); emitted++; requested.decrementAndGet(); } } } } while (counter.decrementAndGet() > 0); if (emitted > 0) { for (MultiSourceRequestableSubscriber<T, R> s : subscribers) { s.requestUpTo(emitted); } } } }

Target:
void tick() { AtomicLong localCounter = this.counter; if (localCounter.getAndIncrement() == 0) { int emitted = 0; do { if (requested.get() > 0) { Object o = buffer.poll(); if (o != null) { if (buffer.isCompleted(o)) { child.onCompleted(); } else { buffer.accept(o, child); emitted++; requested.decrementAndGet(); } } } } while (localCounter.decrementAndGet() > 0); if (emitted > 0) { for (MultiSourceRequestableSubscriber<T, R> s : subscribers) { s.requestUpTo(emitted); } } } }
Source:
public URI getSkillifierUrl(String addition) { if (!addition.isEmpty()) { return URI.create("<LINK_1>" + addition); } return URI.create("<LINK_1>"); }

Target:
public URI getSkillifierUrl(String addition) { if (addition.isEmpty()) { return URI.create("<LINK_0>"); } return URI.create("<LINK_0>" + addition); }
Source:
static String toRelativeString(Path path, Path moduleLocationBasePath) { String moduleRelativePath = moduleLocationBasePath.relativize(path).toString(); if (moduleRelativePath.isEmpty()) { return ""; } else { return "/" + MorePaths.pathWithUnixSeparators(moduleRelativePath); } }

Target:
static String toRelativeString(Path path, Path moduleLocationBasePath) { String moduleRelativePath = moduleLocationBasePath.relativize(path).toString(); if (moduleRelativePath.isEmpty()) { return ""; } else { return File.separator + MorePaths.pathWithUnixSeparators(moduleRelativePath); } }
Source:
static CallAdapter<Completable> makeCompletable() { final CompletableCallAdapter callAdapter = new CompletableCallAdapter(); return new CallAdapter<Completable>() { @Override public Type responseType() { return callAdapter.responseType(); } @Override public Completable adapt(Call call) { return callAdapter.adapt(call); } }; }

Target:
static CallAdapter<Completable> makeCompletable() { return COMPLETABLE_CALL_ADAPTER; }
Source:
protected void postSetUp() throws Exception { EventService service = Framework.getService(EventService.class); serviceImpl = (EventServiceImpl) service; }

Target:
protected void postSetUp() throws Exception { serviceImpl = (EventServiceImpl) Framework.getService(EventService.class); }
Source:
public VirtualMachine getCurrentMachineBuild(ITmfEvent event) { VirtualMachine machine = innerGetCurrentMachine(event); if (machine == null) { synchronized (fStateSystem) { String hostId = event.getTrace().getHostId(); machine = createMachine(fStateSystem, event.getTimestamp().toNanos(), hostId, event.getTrace().getName()); fKnownMachines.put(hostId, machine); } } return machine; }

Target:
public VirtualMachine getCurrentMachineBuild(ITmfEvent event) { VirtualMachine machine = innerGetCurrentMachine(event); if (machine == null) { synchronized (fStateSystem) { String hostId = event.getTrace().getHostId(); machine = createMachine(fStateSystem, event.getTimestamp().toNanos(), hostId, String.valueOf(event.getTrace().getName())); fKnownMachines.put(hostId, machine); } } return machine; }
Source:
public void onPageUpdated(ApiDatasetLandingPage page, String uri) throws IOException { try { datasetAPIClient.deleteDataset(page.getapiDatasetId()); } catch (DatasetAPIException e) { throw new RuntimeException(e); } }

Target:
public void onPageUpdated(ApiDatasetLandingPage page, String uri) throws IOException { try { datasetAPIClient.deleteDataset(page.getapiDatasetId()); } catch (DatasetAPIException e) { logError(e, "failed to delete dataset in the dataset api").log(); throw new RuntimeException(e); } }
Source:
public SAMRecord next() { if (!hasNext()) { return null; } return nextAlignment(); }

Target:
public SAMRecord next() { if (!hasNext()) { throw new NoSuchElementException("No more alignments are available"); } return nextAlignment(); }
Source:
public ProcessModelResource getProcessModel(@PathVariable String id) { try (final InputStream resourceStream = repositoryService.getProcessModel(id)) { String xml = new String(IoUtil.readInputStream(resourceStream, null), StandardCharsets.UTF_8); return processModelResourceAssembler.toResource(new ProcessModel(id, xml)); } catch (IOException e) { throw new ActivitiException("Error occured while getting process model '" + id + "' : " + e.getMessage(), e); } }

Target:
public String getProcessModel(@PathVariable String id) { try (final InputStream resourceStream = repositoryService.getProcessModel(id)) { return new String(IoUtil.readInputStream(resourceStream, null), StandardCharsets.UTF_8); } catch (IOException e) { throw new ActivitiException("Error occured while getting process model '" + id + "' : " + e.getMessage(), e); } }
Source:
public void shouldRemoveTemporaryWorkspaces() throws Exception { doNothing().when(workspaceDao).remove(anyString()); when(workspaceDao.getWorkspaces(eq(true), anyInt(), anyLong())) .thenReturn(new Page<>(createEntities(250), 0, 50, 250)); when(workspaceDao.getWorkspaces( eq(true), intThat(integer -> integer.intValue() > 250), anyLong())) .thenReturn(new Page<>(Collections.emptyList(), 250, 50, 250)); remover.removeTemporaryWs(); verify(workspaceDao, times(250)).remove(anyString()); }

Target:
public void shouldRemoveTemporaryWorkspaces() throws Exception { when(workspaceDao.getWorkspaces(eq(true), anyInt(), anyLong())) .thenReturn( new Page<>( createEntities(DEFAULT_PAGE_SIZE), 0, DEFAULT_PAGE_SIZE, COUNT_OF_WORKSPACES)) .thenReturn( new Page<>( createEntities(DEFAULT_PAGE_SIZE), DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE, COUNT_OF_WORKSPACES)) .thenReturn( new Page<>( createEntities(DEFAULT_PAGE_SIZE), DEFAULT_PAGE_SIZE * 2, DEFAULT_PAGE_SIZE, COUNT_OF_WORKSPACES)); remover.removeTemporaryWs(); verify(workspaceDao, times(COUNT_OF_WORKSPACES)).remove(anyString()); }
Source:
public void testrunActionImpl_ignored_failure() { VdcActionParametersBase testParameters = new VdcActionParametersBase(); frontend.runAction(VdcActionType.AddDisk, testParameters, mockActionCallback, testState, false); verify(mockService).runAction(eq(VdcActionType.AddDisk), eq(testParameters), callbackAction.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackAction.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), (FrontendFailureEventArgs) any()); verify(mockActionCallback, never()).executed(any(FrontendActionAsyncResult.class)); verifyAsyncActionStarted(); }

Target:
public void testrunActionImpl_ignored_failure() { VdcActionParametersBase testParameters = new VdcActionParametersBase(); frontend.runAction(VdcActionType.AddDisk, testParameters, mockActionCallback, testState, false); verify(mockService).runAction(eq(VdcActionType.AddDisk), eq(testParameters), callbackAction.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackAction.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), (FrontendFailureEventArgs) any()); verify(mockActionCallback, never()).executed(any(FrontendActionAsyncResult.class)); verifyAsyncActionStartedButNotCompleted(); }
Source:
private <T> Copier<T> createCopier(CopierConfiguration.Type type, Class<T> clazz, Serializer<T> serializer, ServiceConfiguration<?>... configs) { DefaultCopierConfiguration<T> conf = find(type, configs); Copier<T> copier; final ClassInstanceConfiguration<Copier<?>> preConfigured = preconfiguredLoaders.get(clazz.getName()); if (conf != null && conf.getInstance() != null) { copier = conf.getInstance(); } else if (conf != null && conf.getClazz().isAssignableFrom(SerializingCopier.class)) { if (serializer == null) { throw new IllegalStateException("No Serializer configured for type '" + clazz.getName() + "' which doesn't implement java.io.Serializable"); } copier = new SerializingCopier<T>(serializer); } else if (conf == null && preConfigured != null && preConfigured.getClazz().isAssignableFrom(SerializingCopier.class)) { if (serializer == null) { throw new IllegalStateException("No Serializer configured for type '" + clazz.getName() + "' which doesn't implement java.io.Serializable"); } copier = new SerializingCopier<T>(serializer); } else { copier = createCopier(clazz, conf); } LOG.info("Copier for <{}> : {}", clazz.getName(), copier); return copier; }

Target:
private <T> Copier<T> createCopier(CopierConfiguration.Type type, Class<T> clazz, Serializer<T> serializer, ServiceConfiguration<?>... configs) { DefaultCopierConfiguration<T> conf = find(type, configs); Copier<T> copier; final ClassInstanceConfiguration<Copier<?>> preConfigured = preconfigured.get(clazz.getName()); if (conf != null && conf.getInstance() != null) { copier = conf.getInstance(); } else if (conf != null && conf.getClazz().isAssignableFrom(SerializingCopier.class)) { if (serializer == null) { throw new IllegalStateException("No Serializer configured for type '" + clazz.getName() + "' which doesn't implement java.io.Serializable"); } copier = new SerializingCopier<T>(serializer); } else if (conf == null && preConfigured != null && preConfigured.getClazz().isAssignableFrom(SerializingCopier.class)) { if (serializer == null) { throw new IllegalStateException("No Serializer configured for type '" + clazz.getName() + "' which doesn't implement java.io.Serializable"); } copier = new SerializingCopier<T>(serializer); } else { copier = createCopier(clazz, conf); } LOG.info("Copier for <{}> : {}", clazz.getName(), copier); return copier; }
Source:
public void revertSamRecord(final SAMRecord rec) { if (RESTORE_ORIGINAL_QUALITIES) { final byte[] oq = rec.getOriginalBaseQualities(); if (oq != null) { rec.setBaseQualities(oq); rec.setOriginalBaseQualities(null); } } if (REMOVE_DUPLICATE_INFORMATION) { rec.setDuplicateReadFlag(false); } if (REMOVE_ALIGNMENT_INFORMATION) { if (rec.getReadNegativeStrandFlag()) { SAMRecordUtil.reverseComplement(rec); rec.setReadNegativeStrandFlag(false); } rec.setReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setCigarString(SAMRecord.NO_ALIGNMENT_CIGAR); rec.setMappingQuality(SAMRecord.NO_MAPPING_QUALITY); if (!rec.getReadUnmappedFlag()) { rec.setInferredInsertSize(0); rec.setNotPrimaryAlignmentFlag(false); rec.setProperPairFlag(false); rec.setReadUnmappedFlag(true); } rec.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setMateNegativeStrandFlag(false); rec.setMateReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setMateUnmappedFlag(true); for (final String tag : ATTRIBUTE_TO_CLEAR) { rec.setAttribute(tag, null); } } }

Target:
public void revertSamRecord(final SAMRecord rec) { if (RESTORE_ORIGINAL_QUALITIES) { final byte[] oq = rec.getOriginalBaseQualities(); if (oq != null) { rec.setBaseQualities(oq); rec.setOriginalBaseQualities(null); } } if (REMOVE_DUPLICATE_INFORMATION) { rec.setDuplicateReadFlag(false); } if (REMOVE_ALIGNMENT_INFORMATION) { if (rec.getReadNegativeStrandFlag()) { SAMRecordUtil.reverseComplement(rec); rec.setReadNegativeStrandFlag(false); } rec.setReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setCigarString(SAMRecord.NO_ALIGNMENT_CIGAR); rec.setMappingQuality(SAMRecord.NO_MAPPING_QUALITY); rec.setInferredInsertSize(0); rec.setNotPrimaryAlignmentFlag(false); rec.setProperPairFlag(false); rec.setReadUnmappedFlag(true); rec.setMateAlignmentStart(SAMRecord.NO_ALIGNMENT_START); rec.setMateNegativeStrandFlag(false); rec.setMateReferenceIndex(SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX); rec.setMateUnmappedFlag(true); ATTRIBUTE_TO_CLEAR.forEach(tag -> rec.setAttribute(tag, null)); } }
Source:
public void persistFilterActivationState() { synchronized (activeFilters) { CommonFilterDescriptorManager dm = CommonFilterDescriptorManager .getInstance(); StringBuffer activatedFiltersPreferenceValue = new StringBuffer(DELIM); for (String string : activeFilters) { String id = string.toString(); if (!dm.getFilterById(id).isVisibleInUi()) continue; activatedFiltersPreferenceValue.append(id).append(DELIM); } IEclipsePreferences prefs = NavigatorContentService.getPreferencesRoot(); prefs.put(getFilterActivationPreferenceKey(), activatedFiltersPreferenceValue.toString()); NavigatorContentService.flushPreferences(prefs); } }

Target:
public void persistFilterActivationState() { synchronized (activeFilters) { CommonFilterDescriptorManager dm = CommonFilterDescriptorManager .getInstance(); StringBuffer activatedFiltersPreferenceValue = new StringBuffer(DELIM); for (String id : activeFilters) { if (!dm.getFilterById(id).isVisibleInUi()) continue; activatedFiltersPreferenceValue.append(id).append(DELIM); } IEclipsePreferences prefs = NavigatorContentService.getPreferencesRoot(); prefs.put(getFilterActivationPreferenceKey(), activatedFiltersPreferenceValue.toString()); NavigatorContentService.flushPreferences(prefs); } }