auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void seekToSegment(long entryId, SeekErrorRule errorRule) throws NoSuchOffsetException, IOException { assert(entryId >= 0); synchronized(PersistentBinaryDeque.this) { PBDSegment<M> seekSegment = findSegmentWithEntry(entryId, errorRule); moveToValidSegment(); if (m_segment.segmentIndex() == seekSegment.segmentIndex()) { if (m_segment != null && m_segment.getReader(m_cursorId) != null) { m_numRead -= m_segment.getReader(m_cursorId).readIndex(); m_segment.getReader(m_cursorId).close(); m_segment.openForRead(m_cursorId); } } else { if (m_segment.segmentIndex() > seekSegment.segmentIndex()) { for (PBDSegment<M> curr : m_segments.tailMap(seekSegment.segmentIndex(), true).values()) { if (curr.segmentIndex() > m_segment.segmentIndex()) { break; } PBDSegmentReader<M> currReader = curr.getReader(m_cursorId); if (curr.segmentIndex() == m_segment.segmentIndex()) { if (currReader != null) { m_numRead -= currReader.readIndex(); } } else { m_numRead -= curr.getNumEntries(); } if (currReader != null) { currReader.close(); } } } else { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); m_numRead += m_segment.getNumEntries(); if (segmentReader != null) { m_numRead -= segmentReader.readIndex(); segmentReader.close(); } for (PBDSegment<M> curr : m_segments.tailMap(m_segment.segmentIndex(), false).values()) { if (curr.segmentIndex() == seekSegment.segmentIndex()) { break; } m_numRead += curr.getNumEntries(); } } m_segment = seekSegment; } } }

Target:
public void seekToSegment(long entryId, SeekErrorRule errorRule) throws NoSuchOffsetException, IOException { assert(entryId >= 0); synchronized(PersistentBinaryDeque.this) { PBDSegment<M> seekSegment = findSegmentWithEntry(entryId, errorRule); moveToValidSegment(); if (m_segment.segmentIndex() == seekSegment.segmentIndex()) { if (m_segment.getReader(m_cursorId) != null) { m_numRead -= m_segment.getReader(m_cursorId).readIndex(); m_segment.getReader(m_cursorId).close(); m_segment.openForRead(m_cursorId); } } else { if (m_segment.segmentIndex() > seekSegment.segmentIndex()) { for (PBDSegment<M> curr : m_segments.tailMap(seekSegment.segmentIndex(), true).values()) { if (curr.segmentIndex() > m_segment.segmentIndex()) { break; } PBDSegmentReader<M> currReader = curr.getReader(m_cursorId); if (curr.segmentIndex() == m_segment.segmentIndex()) { if (currReader != null) { m_numRead -= currReader.readIndex(); } } else { m_numRead -= curr.getNumEntries(); } if (currReader != null) { currReader.close(); } } } else { PBDSegmentReader<M> segmentReader = m_segment.getReader(m_cursorId); m_numRead += m_segment.getNumEntries(); if (segmentReader != null) { m_numRead -= segmentReader.readIndex(); segmentReader.close(); } for (PBDSegment<M> curr : m_segments.tailMap(m_segment.segmentIndex(), false).values()) { if (curr.segmentIndex() == seekSegment.segmentIndex()) { break; } m_numRead += curr.getNumEntries(); } } m_segment = seekSegment; } } }
Source:
public int getInt(int col) { return col == 0 ? PG_TYPE_OIDS.get(row) : col == 4 ? PgOIDs.PG_PUBLIC_OID : 0; }

Target:
public int getInt(int col) { return intValues[col]; }
Source:
public void visit(final SnmpConfigVisitor visitor) { if ((visitor.getLocation() != null) && (!visitor.getLocation().equals(m_location))) { return; } visitor.visitDefinition(this); visitor.visitSpecifics(this.getSpecifics()); visitor.visitSpecificsFinished(); visitor.visitRanges(this.getRanges()); visitor.visitRangesFinished(); visitor.visitIpMatches(this.getIpMatches()); visitor.visitIpMatchesFinished(); visitor.visitDefinitionFinished(); }

Target:
public void visit(final SnmpConfigVisitor visitor) { visitor.visitDefinition(this); visitor.visitSpecifics(this.getSpecifics()); visitor.visitSpecificsFinished(); visitor.visitRanges(this.getRanges()); visitor.visitRangesFinished(); visitor.visitIpMatches(this.getIpMatches()); visitor.visitIpMatchesFinished(); visitor.visitDefinitionFinished(); }
Source:
public ReusableSubprocessTaskExecutionSet() { this(new CalledElement(), new IsCase(), new Independent(), new WaitForCompletion(), new IsAsync(), new SLADueDate(), new AdHocAutostart(), new IsMultipleInstance(false), new MultipleInstanceExecutionMode(false), new MultipleInstanceCollectionInput(), new MultipleInstanceDataInput(), new MultipleInstanceCollectionOutput(), new MultipleInstanceDataOutput(), new MultipleInstanceCompletionCondition(), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", "")))); }

Target:
public ReusableSubprocessTaskExecutionSet() { this(new CalledElement(), new IsCase(), new Independent(), new AbortParent(), new WaitForCompletion(), new IsAsync(), new AdHocAutostart(), new IsMultipleInstance(false), new MultipleInstanceExecutionMode(false), new MultipleInstanceCollectionInput(), new MultipleInstanceDataInput(), new MultipleInstanceCollectionOutput(), new MultipleInstanceDataOutput(), new MultipleInstanceCompletionCondition(), new OnEntryAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new OnExitAction(new ScriptTypeListValue().addValue(new ScriptTypeValue("java", ""))), new SLADueDate()); }
Source:
private void configure() { Label emailLabel = WidgetUtil.getLabel(CoreModule.user.getEmail(), 15); emailField = FieldUtil.getTextItem(200, "[a-zA-Z0-9_.\\-+@]"); emailField.setName("email"); emailField.setValidators(ValidatorUtil.getEmailValidator()); saveButton = WidgetUtil.getIButton("Change email", CoreConstants.ICON_SAVED, new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { if (emailField.validate()) { ConfigurationServiceAsync service = ConfigurationService.Util.getInstance(); final AsyncCallback<User> callback = new AsyncCallback<User>() { @Override public void onFailure(Throwable caught) { WidgetUtil.resetIButton(saveButton, "Change email", CoreConstants.ICON_SAVED); Layout.getInstance().setWarningMessage("Unable to change email:<br />" + caught.getMessage()); } @Override public void onSuccess(User result) { Modules.getInstance().userUpdated(CoreModule.user, result); CoreModule.user = result; WidgetUtil.resetIButton(saveButton, "Change email", CoreConstants.ICON_SAVED); Layout.getInstance().setNoticeMessage( "Your email change has been taken into account. " +" You will receive a mail with a code to validate it.<br />" + "Please refresh VIP to enter the code in your account"); } }; WidgetUtil.setLoadingIButton(saveButton, "Saving..."); service.requestNewEmail( emailField.getValueAsString().trim(), callback); } } }); saveButton.setWidth(150); this.addMember(emailLabel); addField("New email", emailField); this.addMember(saveButton); }

Target:
private void configure() { Label emailLabel = WidgetUtil.getLabel(CoreModule.user.getEmail(), 15); emailField = FieldUtil.getTextItem(200, "[a-zA-Z0-9_.\\-+@]"); emailField.setName("email"); emailField.setValidators(ValidatorUtil.getEmailValidator()); saveButton = WidgetUtil.getIButton("Change email", CoreConstants.ICON_SAVED, new ClickHandler() { @Override public void onClick(ClickEvent clickEvent) { if (emailField.validate()) { ConfigurationServiceAsync service = ConfigurationService.Util.getInstance(); final AsyncCallback<User> callback = new AsyncCallback<User>() { @Override public void onFailure(Throwable caught) { WidgetUtil.resetIButton(saveButton, "Change email", CoreConstants.ICON_SAVED); Layout.getInstance().setWarningMessage("Unable to change email:<br />" + caught.getMessage()); } @Override public void onSuccess(User result) { Modules.getInstance().userUpdated(CoreModule.user, result); CoreModule.user = result; WidgetUtil.resetIButton(saveButton, "Change email", CoreConstants.ICON_SAVED); Layout.getInstance().setNoticeMessage( "Your email change has been taken into account. " +" Please use the validation code sent to your new email address in order to validate it. <br />" + "Note that your login email will not change until you validate the new address"); } }; WidgetUtil.setLoadingIButton(saveButton, "Saving..."); service.requestNewEmail( emailField.getValueAsString().trim(), callback); } } }); saveButton.setWidth(150); this.addMember(emailLabel); addField("New email", emailField); this.addMember(saveButton); }
Source:
public LocalDB readLocalDB(final Path localDBFile) throws Exception { if (localDBFile.toFile().isDirectory()) throw new Exception("Invalid Arguments: Path provided is directory and not a file: " + localDBFile.toString()); if (!localDBFile.toFile().exists()) return new LocalDB(new ArrayList<>()); try (FileReader reader = new FileReader(localDBFile.toFile())) { LocalDB localDB = GsonJsonSerializer.getGson().fromJson(reader, LocalDB.class); String columnfamilyName = localDBFile.getParent().toFile().getName(); String keyspaceName = localDBFile.getParent().getParent().toFile().getName(); localDB.getLocalDb().stream().forEach(localDBEntry -> { localDBEntry.getFileUploadResult().setColumnFamilyName(columnfamilyName); localDBEntry.getFileUploadResult().setKeyspaceName(keyspaceName); }); if (logger.isDebugEnabled()) logger.debug("Local DB: {}", localDB); return localDB; } }

Target:
public LocalDB readLocalDB(final Path localDBFile) throws Exception { if (!localDBFile.toFile().exists()) return new LocalDB(new ArrayList<>()); try (FileReader reader = new FileReader(localDBFile.toFile())) { LocalDB localDB = GsonJsonSerializer.getGson().fromJson(reader, LocalDB.class); String columnfamilyName = localDBFile.getParent().toFile().getName(); String keyspaceName = localDBFile.getParent().getParent().toFile().getName(); localDB.getLocalDBEntries().forEach(localDBEntry -> { localDBEntry.getFileUploadResult().setColumnFamilyName(columnfamilyName); localDBEntry.getFileUploadResult().setKeyspaceName(keyspaceName); }); if (logger.isDebugEnabled()) logger.debug("Local DB: {}", localDB); return localDB; } }
Source:
private static boolean isOptionalPrimitive(Schema schema) { return schema.getType().equals(Schema.Type.UNION) && schema.getTypes().size() == 2 && schema.getTypes().get(0).getType().equals(Schema.Type.NULL) && (isPrimitive(schema.getTypes().get(1)) || isPrimitiveArray(schema.getTypes().get(1))); }

Target:
public static boolean isOptionalPrimitive(Schema schema) { return schema.getType().equals(Schema.Type.UNION) && schema.getTypes().size() == 2 && ( (schema.getTypes().get(0).getType().equals(Schema.Type.NULL) && (isPrimitive(schema.getTypes().get(1)) || isPrimitiveArray(schema.getTypes().get(1)))) || (schema.getTypes().get(1).getType().equals(Schema.Type.NULL) && (isPrimitive(schema.getTypes().get(0)) || isPrimitiveArray(schema.getTypes().get(0)))) ); }
Source:
public void deserializeAndAddExtension(WalletExtension extension, byte[] data) throws Exception { String id = checkNotNull(extension).getWalletExtensionID(); lock.lock(); try { if (extensions.containsKey(id)) return; else { extension.deserializeWalletExtension(this, data); addExtension(extension); } } finally { lock.unlock(); } }

Target:
public void deserializeAndAddExtension(WalletExtension extension, byte[] data) throws Exception { String id = checkNotNull(extension).getWalletExtensionID(); lock.lock(); try { if (extensions.containsKey(id)) { return; } else { extension.deserializeWalletExtension(this, data); addExtension(extension); } } finally { lock.unlock(); } }
Source:
private synchronized void solvingTerminated() { solverManager.getProblemIdToSolverJobMap().remove(problemId); solverStatus = SolverStatus.NOT_SOLVING; terminatedLatch.countDown(); }

Target:
private void solvingTerminated() { solverStatusReference.set(SolverStatus.NOT_SOLVING); solverManager.getProblemIdToSolverJobMap().remove(problemId); terminatedLatch.countDown(); }
Source:
private String retrievePomContentFromHpi() throws PluginSourcesUnavailableException { InputStream pluginUrlStream = null; ZipInputStream zin = null; try { pluginUrlStream = new URL(hpiRemoteUrl).openStream(); zin = new ZipInputStream(pluginUrlStream); ZipEntry zipEntry = zin.getNextEntry(); while(!zipEntry.getName().startsWith("META-INF/maven") || !zipEntry.getName().endsWith("pom.xml")){ zin.closeEntry(); zipEntry = zin.getNextEntry(); } StringBuilder sb = new StringBuilder(); byte[] buf = new byte[1024]; int n; while ((n = zin.read(buf, 0, 1024)) > -1) sb.append(new String(buf, 0, n)); return sb.toString(); } catch (Exception e) { System.err.println("Error : " + e.getMessage()); throw new PluginSourcesUnavailableException("Problem while retrieving pom content in hpi !", e); } finally { IOUtils.closeQuietly(pluginUrlStream); IOUtils.closeQuietly(zin); } }

Target:
private String retrievePomContentFromHpi() throws PluginSourcesUnavailableException { try (InputStream pluginUrlStream = new URL(hpiRemoteUrl).openStream(); ZipInputStream zin = new ZipInputStream(pluginUrlStream)) { ZipEntry zipEntry = zin.getNextEntry(); while(!zipEntry.getName().startsWith("META-INF/maven") || !zipEntry.getName().endsWith("pom.xml")){ zin.closeEntry(); zipEntry = zin.getNextEntry(); } StringBuilder sb = new StringBuilder(); byte[] buf = new byte[1024]; int n; while ((n = zin.read(buf, 0, 1024)) > -1) sb.append(new String(buf, 0, n)); return sb.toString(); } catch (Exception e) { System.err.println("Error : " + e.getMessage()); throw new PluginSourcesUnavailableException("Problem while retrieving pom content in hpi !", e); } }
Source:
public void setBinaryData(Object answer) { stringAnswer = (String) answer; if (stringAnswer != null && !stringAnswer.isEmpty()) { String[] parts = stringAnswer.split(" "); answerDisplay.setText(getContext().getString( R.string.gps_result, formatGps(Double.parseDouble(parts[0]), "lat"), formatGps(Double.parseDouble(parts[1]), "lon"), truncateDouble(parts[2]), truncateDouble(parts[3]) )); answerDisplay.setText(String.format(getContext().getString(R.string.gps_result), formatGps(Double.parseDouble(parts[0]), "lat"), formatGps(Double.parseDouble(parts[1]), "lon"), truncateDouble(parts[2]), truncateDouble(parts[3]))); } else { answerDisplay.setText(""); } updateButtonLabelsAndVisibility(true); widgetValueChanged(); }

Target:
public void setBinaryData(Object answer) { stringAnswer = (String) answer; if (stringAnswer != null && !stringAnswer.isEmpty()) { String[] parts = stringAnswer.split(" "); answerDisplay.setText(getContext().getString( R.string.gps_result, formatGps(Double.parseDouble(parts[0]), "lat"), formatGps(Double.parseDouble(parts[1]), "lon"), truncateDouble(parts[2]), truncateDouble(parts[3]) )); } else { answerDisplay.setText(""); } updateButtonLabelsAndVisibility(true); widgetValueChanged(); }
Source:
public static boolean isEntityInsideOfMaterial(Entity entity, Predicate<Material> predicate) { if (entity.getRidingEntity() instanceof EntityBoat) { return false; } else { BlockPos pos = new BlockPos(entity.posX, entity.posY + entity.getEyeHeight(), entity.posZ); Material material = entity.world.getBlockState(pos).getMaterial(); if (predicate.test(material)) { if (entity instanceof EntityPlayer) System.out.println("Passed predicate test"); return isInsideOfMaterial(material, entity, pos); } else { return false; } } }

Target:
public static boolean isEntityInsideOfMaterial(Entity entity, Predicate<Material> predicate) { if (entity.getRidingEntity() instanceof EntityBoat) { return false; } else { double eyePosY = entity.posY + entity.getEyeHeight(); BlockPos pos = new BlockPos(entity.posX, eyePosY, entity.posZ); IBlockState iBlockState = entity.world.getBlockState(pos); Material material = iBlockState.getMaterial(); Boolean result = iBlockState.getBlock().isEntityInsideMaterial(entity.world, pos, iBlockState, entity, eyePosY, material, true); if (result != null) return result; if (predicate.test(material)) { return isInsideOfMaterial(material, entity, pos); } else { return false; } } }
Source:
public ProjectDetail call() throws NoSuchProjectException { final ProjectControl pc = projectControlFactory.validateFor(projectName, ProjectControl.OWNER | ProjectControl.VISIBLE); final ProjectState projectState = pc.getProjectState(); final ProjectDetail detail = new ProjectDetail(); final Project p = projectState.getProject(); boolean setDefaultMergeStrategy = true; for (MergeStrategySection section : projectState.getLocalMergeStrategySections()) { if (section.getName().equals(RefConfigSection.ALL)) { p.setSubmitType(section.getSubmitType().name()); p.setUseContentMerge(section.isUseContentMerge()); setDefaultMergeStrategy = false; break; } } if (setDefaultMergeStrategy) { p.setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY.name()); } detail.setProject(p); final boolean userIsOwner = pc.isOwner(); final boolean userIsOwnerAnyRef = pc.isOwnerAnyRef(); detail.setCanModifyAccess(userIsOwnerAnyRef); detail.setCanModifyAgreements(userIsOwner); detail.setCanModifyDescription(userIsOwner); detail.setCanModifyMergeType(userIsOwner); return detail; }

Target:
public ProjectDetail call() throws NoSuchProjectException { final ProjectControl pc = projectControlFactory.validateFor(projectName, ProjectControl.OWNER | ProjectControl.VISIBLE); final ProjectState projectState = pc.getProjectState(); final ProjectDetail detail = new ProjectDetail(); final Project p = projectState.getProject(); p.setSubmitType(MergeStrategySection.SubmitType.MERGE_IF_NECESSARY.name()); for (MergeStrategySection section : projectState .getLocalMergeStrategySections()) { if (section.getName() != null && section.getName().equals(RefConfigSection.ALL)) { if (section.getSubmitType() != null) { p.setSubmitType(section.getSubmitType().name()); } if (section.isUseContentMerge() != null) { p.setUseContentMerge( section.isUseContentMerge() == MergeStrategySection.UseContentMerge.TRUE ? true : false); } break; } } detail.setProject(p); final boolean userIsOwner = pc.isOwner(); final boolean userIsOwnerAnyRef = pc.isOwnerAnyRef(); detail.setCanModifyAccess(userIsOwnerAnyRef); detail.setCanModifyAgreements(userIsOwner); detail.setCanModifyDescription(userIsOwner); detail.setCanModifyMergeType(userIsOwner); detail.setCanModifyState(userIsOwner); final Project.NameKey projectName = projectState.getProject().getNameKey(); Repository git; try { git = gitRepositoryManager.openRepository(projectName); } catch (RepositoryNotFoundException err) { throw new NoSuchProjectException(projectName); } try { Ref head = git.getRef(Constants.HEAD); if (head != null && head.isSymbolic() && GitRepositoryManager.REF_CONFIG.equals(head.getLeaf().getName())) { detail.setPermissionOnly(true); } } catch (IOException err) { throw new NoSuchProjectException(projectName); } finally { git.close(); } return detail; }
Source:
void unregisterSourceReader(int subtaskId) { Preconditions.checkNotNull(registeredReaders.remove(subtaskId), "Failed to unregister source reader of id " + subtaskId + " because it is not registered."); }

Target:
void unregisterSourceReader(int subtaskId) { Preconditions.checkNotNull(registeredReaders.remove(subtaskId), String.format( "Failed to unregister source reader of id %s because it is not registered.", subtaskId)); }
Source:
public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return "[There is no diff output.\n" + " Reason: This change has more than two parents.\n" + " Gerrit does not support for generating diff output\n" + " between this kind change and its parents by far.]\n"; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); return ""; } try { fmt.setRepository(git); fmt.setDetectRenames(true); fmt.format(patchList.getOldId(), patchList.getNewId()); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException e) { if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) { return ""; } log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }

Target:
public String getUnifiedDiff() { PatchList patchList; try { patchList = getPatchList(); if (patchList.getOldId() == null) { return "[There is no diff output.\n" + " Reason: This change has more than two parents.\n" + " Gerrit does not currently support generating\n" + " diff output for this kind of change."; } } catch (PatchListNotAvailableException e) { log.error("Cannot format patch", e); return ""; } TemporaryBuffer.Heap buf = new TemporaryBuffer.Heap(args.settings.maximumDiffSize); DiffFormatter fmt = new DiffFormatter(buf); Repository git; try { git = args.server.openRepository(change.getProject()); } catch (IOException e) { log.error("Cannot open repository to format patch", e); return ""; } try { fmt.setRepository(git); fmt.setDetectRenames(true); fmt.format(patchList.getOldId(), patchList.getNewId()); return RawParseUtils.decode(buf.toByteArray()); } catch (IOException e) { if (JGitText.get().inMemoryBufferLimitExceeded.equals(e.getMessage())) { return ""; } log.error("Cannot format patch", e); return ""; } finally { fmt.release(); git.close(); } }
Source:
protected void initMiningFieldMap() throws Exception { MiningSchema schema = getMiningSchema(); boolean addExternalBeanRefs = isUseExternalBeanRefs(schema); miningFieldMap = new HashMap<>(); externalMiningFields = new ArrayList<>(); for (MiningField field : schema.getMiningFields()) { miningFieldMap.put(field.getName(), field); if (addExternalBeanRefs) { Extension ext = getExternalClassInfo(field.getExtensions()); if (ext != null) { ExternalBeanRef ref; try { ref = new ExternalBeanRef(field.getName(), ext.getValue(), ModelUsage.MINING); externalMiningFields.add(ref); } catch (Exception e) { throw new Exception("Error while initializing the MiningField map. ",e); } } } } }

Target:
protected void initMiningFieldMap() throws IllegalArgumentException { MiningSchema schema = getMiningSchema(); boolean addExternalBeanRefs = isUseExternalBeanRefs(schema); miningFieldMap = new HashMap<>(); externalMiningFields = new ArrayList<>(); for (MiningField field : schema.getMiningFields()) { miningFieldMap.put(field.getName(), field); if (addExternalBeanRefs) { Extension ext = getExternalClassInfo(field.getExtensions()); if (ext != null) { ExternalBeanRef ref; try { ref = new ExternalBeanRef(field.getName(), ext.getValue(), ModelUsage.MINING); externalMiningFields.add(ref); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Error while initializing the MiningField map. ",e); } } } } }
Source:
public Device searchActiveDevice(@Identification final String deviceIdentification) throws UnregisteredDeviceException, InactiveDeviceException, UnknownEntityException { final Device device = this.searchDevice(deviceIdentification); final Ssld ssld = this.ssldRepository.findOne(device.getId()); if (!device.isActive()) { throw new InactiveDeviceException(deviceIdentification); } if (ssld != null && !ssld.isPublicKeyPresent()) { throw new UnregisteredDeviceException(deviceIdentification); } return device; }

Target:
public Device searchActiveDevice(@Identification final String deviceIdentification) throws UnregisteredDeviceException, InactiveDeviceException, UnknownEntityException { final Device device = this.searchDevice(deviceIdentification); final Ssld ssld = this.ssldRepository.findOne(device.getId()); if (!device.isActivated() || !device.isActive()) { throw new InactiveDeviceException(deviceIdentification); } if (ssld != null && !ssld.isPublicKeyPresent()) { throw new UnregisteredDeviceException(deviceIdentification); } return device; }
Source:
public PublicKey getRawPublicKey(String keyType, Buffer buffer) throws GeneralSecurityException { byte[] nonce = buffer.getBytes(); String rawKeyType = OpenSshCertificate.getRawKeyType(keyType); PublicKey publicKey = DEFAULT.getRawPublicKey(rawKeyType, buffer); long serial = buffer.getLong(); int userOrHostType = buffer.getInt(); String id = buffer.getString(); List<String> vPrincipals = new ByteArrayBuffer(buffer.getBytes()).getNameList(); long vAfter = buffer.getLong(); long vBefore = buffer.getLong(); List<String> criticalOptions = buffer.getNameList(); List<String> extensions = buffer.getNameList(); String reserved = buffer.getString(); PublicKey signatureKey; try { signatureKey = buffer.getPublicKey(); } catch (SshException ex) { throw new GeneralSecurityException("Could not parse public CA key.", ex); } byte[] message = buffer.getBytesConsumed(); byte[] signature = buffer.getBytes(); if (buffer.rpos() != buffer.wpos()) { throw new GeneralSecurityException("KeyExchange signature verification failed, got more data than expected: " + buffer.rpos() + ", actual: " + buffer.wpos()); } return OpenSshCertificate.OpenSshPublicKeyBuilder.anOpenSshCertificate() .withKeyType(keyType) .withNonce(nonce) .withServerHostPublicKey(publicKey) .withSerial(serial) .withType(userOrHostType) .withId(id) .withPrincipals(vPrincipals) .withValidAfter(vAfter) .withValidBefore(vBefore) .withCriticalOptions(criticalOptions) .withExtensions(extensions) .withReserved(reserved) .withCaPubKey(signatureKey) .withMessage(message) .withSignature(signature) .build(); }

Target:
public PublicKey getRawPublicKey(String keyType, Buffer buffer) throws GeneralSecurityException { OpenSshCertificateImpl certificate = new OpenSshCertificateImpl(); certificate.setKeyType(keyType); certificate.setNonce(buffer.getBytes()); String rawKeyType = certificate.getRawKeyType(); certificate.setServerHostKey(DEFAULT.getRawPublicKey(rawKeyType, buffer)); certificate.setSerial(buffer.getLong()); certificate.setType(buffer.getInt()); certificate.setId(buffer.getString()); certificate.setPrincipals(new ByteArrayBuffer(buffer.getBytes()).getStringList(false)); certificate.setValidAfter(buffer.getLong()); certificate.setValidBefore(buffer.getLong()); certificate.setCriticalOptions(buffer.getNameList()); certificate.setExtensions(buffer.getNameList()); certificate.setReserved(buffer.getString()); try { certificate.setCaPubKey(buffer.getPublicKey()); } catch (SshException ex) { throw new GeneralSecurityException("Could not parse public CA key with ID: " + certificate.getId(), ex); } certificate.setMessage(buffer.getBytesConsumed()); certificate.setSignature(buffer.getBytes()); if (buffer.rpos() != buffer.wpos()) { throw new GeneralSecurityException("KeyExchange signature verification failed, got more data than expected: " + buffer.rpos() + ", actual: " + buffer.wpos() + ". ID of the ca certificate: " + certificate.getId()); } return certificate; }
Source:
protected BlockingQueue<IncomingMessageEnvelope> newBlockingQueue() { return new LinkedBlockingQueue<>(config.getConsumerBufferCapacity()); }

Target:
protected BlockingQueue<IncomingMessageEnvelope> newBlockingQueue() { return new LinkedBlockingQueue<>(config.getConsumerBufferCapacity(systemName)); }
Source:
public CookieCsrfTokenRepository() { this.setHttpOnlyMethod = ReflectionUtils.findMethod(Cookie.class, "setHttpOnly", boolean.class); }

Target:
public CookieCsrfTokenRepository() { this.setHttpOnlyMethod = ReflectionUtils.findMethod(Cookie.class, "setHttpOnly", boolean.class); if (this.setHttpOnlyMethod != null) { this.cookieHttpOnly = true; } }
Source:
public int findAtBPartsAvailabilityLevel(IAcquisitionWork acquisition, StringBuilder reportBuilder) { AtBContract contract = acquisition != null ? getAttachedAtBContract(acquisition.getUnit()) : null; for (Mission m : getMissions()) { if (m.isActive() && m instanceof AtBContract && ((AtBContract) m).getStartDate().isBefore(currentDay)) { if (null == contract || ((AtBContract) m).getPartsAvailabilityLevel() > contract.getPartsAvailabilityLevel()) { contract = (AtBContract) m; } } } if (null != contract && contract.getStartDate().isBefore(currentDay)) { if (reportBuilder != null) { reportBuilder.append(contract.getPartsAvailabilityLevel() + " (" + contract.getType() +")"); } return contract.getPartsAvailabilityLevel(); } Person adminLog = findBestInRole(Person.T_ADMIN_LOG, SkillType.S_ADMIN); int adminLogExp = (adminLog == null) ? SkillType.EXP_ULTRA_GREEN : adminLog.getSkill(SkillType.S_ADMIN).getExperienceLevel(); int adminMod = adminLogExp - SkillType.EXP_REGULAR; if (reportBuilder != null) { reportBuilder.append(getUnitRatingMod() + "(unit rating)"); if(adminLog != null) { reportBuilder.append(adminMod + "(" + adminLog.getFullName() +", logistics admin)"); } else { reportBuilder.append(adminMod + "(no logistics admin)"); } } return getUnitRatingMod() + adminMod; }

Target:
public int findAtBPartsAvailabilityLevel(IAcquisitionWork acquisition, StringBuilder reportBuilder) { AtBContract contract = (acquisition != null) ? getAttachedAtBContract(acquisition.getUnit()) : null; if (hasActiveContract()) { for (Contract c : getActiveContracts()) { if ((c instanceof AtBContract) && ((contract == null) || (((AtBContract) c).getPartsAvailabilityLevel() > contract.getPartsAvailabilityLevel()))) { contract = (AtBContract) c; } } } if ((null != contract) && getLocalDate().isBefore(contract.getStartDate())) { if (reportBuilder != null) { reportBuilder.append(contract.getPartsAvailabilityLevel() + " (" + contract.getType() +")"); } return contract.getPartsAvailabilityLevel(); } Person adminLog = findBestInRole(Person.T_ADMIN_LOG, SkillType.S_ADMIN); int adminLogExp = (adminLog == null) ? SkillType.EXP_ULTRA_GREEN : adminLog.getSkill(SkillType.S_ADMIN).getExperienceLevel(); int adminMod = adminLogExp - SkillType.EXP_REGULAR; if (reportBuilder != null) { reportBuilder.append(getUnitRatingMod() + "(unit rating)"); if (adminLog != null) { reportBuilder.append(adminMod + "(" + adminLog.getFullName() +", logistics admin)"); } else { reportBuilder.append(adminMod + "(no logistics admin)"); } } return getUnitRatingMod() + adminMod; }
Source:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest) request; String path = httpRequest.getServletPath(); if (path.startsWith("/search/") || path.startsWith("/oauth/token") || path.startsWith("/experimental_rdf_v1/") || path.startsWith("/static/identifierTypes.xsl")) { filterChain.doFilter(request, response); } else { Matcher matcher = VERSION_PATTERN.matcher(path); String version = null; if (matcher.lookingAt()) { version = matcher.group(1); } if (PojoUtil.isEmpty(version)) { if (Features.PUB_API_2_0_BY_DEFAULT.isActive()) { String baseUrl = orcidUrlManager.getPubBaseUrl(); String redirectUri = baseUrl + "/v2.0" + path; response.sendRedirect(redirectUri); } else { filterChain.doFilter(request, response); } } else { filterChain.doFilter(request, response); } } }

Target:
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { HttpServletRequest httpRequest = (HttpServletRequest) request; String path = httpRequest.getServletPath(); if (path.startsWith("/resources/") || path.startsWith("/search/") || path.startsWith("/oauth/token") || path.startsWith("/experimental_rdf_v1/") || path.startsWith("/static/")) { filterChain.doFilter(request, response); } else { Matcher matcher = VERSION_PATTERN.matcher(path); String version = null; if (matcher.lookingAt()) { version = matcher.group(1); } if (PojoUtil.isEmpty(version)) { if (Features.PUB_API_2_0_BY_DEFAULT.isActive()) { String baseUrl = orcidUrlManager.getPubBaseUrl(); String redirectUri = baseUrl + "/v2.0" + path; response.sendRedirect(redirectUri); } else { filterChain.doFilter(request, response); } } else { filterChain.doFilter(request, response); } } }
Source:
public Response getPolicy(@PathParam("tenant") String tenant, @PathParam("subject") String subject, @PathParam("policyId") String policyId) { LOGGER.debug("Getting policy with id [" + policyId + "] for [" + tenant + "] and subject [" + subject + "]"); String id = URLEncoding.decode(policyId); Policy p = dao.loadPolicy(tenant, subject, id); if (p != null) { return Response.ok(p.getPolicy()).build(); } else { return Response.status(404).build(); } }

Target:
public Response getPolicy(@PathParam("tenant") String tenant, @PathParam("subject") String subject, @PathParam("policyId") String policyId) { LOGGER.debug("Getting policy with id for and subject [{}]", policyId, tenant, subject); String id = URLEncoding.decode(policyId); Policy p = dao.loadPolicy(tenant, subject, id); if (p != null) { return Response.ok(p.getPolicy()).build(); } else { return Response.status(404).build(); } }
Source:
public static JavaArchive createDeployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar"); jar.addPackage(UserTransactionAccessTestCase.class.getPackage()); jar.as(ZipExporter.class).exportTo(new File(TestSuiteEnvironment.getTmpDir(), jar.getName()), true); return jar; }

Target:
public static JavaArchive createDeployment() { final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar"); jar.addPackage(UserTransactionAccessTestCase.class.getPackage()); return jar; }
Source:
protected String getId() { return "IAR compiler 6.X (C/C++)"; }

Target:
protected String getId() { return "IAR compiler (C/C++)"; }
Source:
public <T> T construct(Class<T> componentType) { if (globalConfiguration.security().authorization().enabled()) return (T) new GlobalSecurityManagerImpl(); else return null; }

Target:
public <T> T construct(Class<T> componentType) { if (globalConfiguration.security().authorization().enabled()) return componentType.cast(new GlobalSecurityManagerImpl()); else return null; }
Source:
public void findByUserNameShouldFindUserForRegisteredUserName() { UserEntity registeredUser = repository.findByUserName(REGISTERED_USER_NAME); assertThat(registeredUser, notNullValue()); assertThat(registeredUser.getUserName(),is(REGISTERED_USER_NAME)); assertThat(registeredUser.getId(), is(1L)); assertThat(registeredUser.getUserPassword(), is("$2a$04$6r2eBlucnE3/m0fDYgE3e.eI5akUx55qPMID3O/SlptCIqOFFcCPK")); }

Target:
public void findByUserNameShouldFindUserForRegisteredUserName() { UserEntity registeredUser = repository.findByUserName(REGISTERED_USER_NAME); assertThat(registeredUser, notNullValue()); assertThat(registeredUser.getUserName(),is(REGISTERED_USER_NAME)); assertThat(registeredUser.getId(), is(1L)); assertThat(registeredUser.getUserPassword(), is(REGISTERED_USER_PASSWORD)); }
Source:
private void onApiAvailable() { if (mApi == null) { Log.e(TAG, "onApiAvailable: Did we stop the binary during startup? mApi == null"); return; } synchronized (mStateLock) { if (mCurrentState != State.STARTING) { Log.e(TAG, "onApiAvailable: Wrong state " + mCurrentState + " detected. Cancelling callback."); return; } onServiceStateChange(State.ACTIVE); } if (mDestroyScheduled) { mDestroyScheduled = false; stopSelf(); return; } if (mEventProcessor == null) { mEventProcessor = new EventProcessor(SyncthingService.this, mApi); } mEventProcessor.start(); }

Target:
private void onApiAvailable() { if (mApi == null) { Log.e(TAG, "onApiAvailable: Did we stop the binary during startup? mApi == null"); return; } synchronized (mStateLock) { if (mCurrentState != State.STARTING) { Log.e(TAG, "onApiAvailable: Wrong state " + mCurrentState + " detected. Cancelling callback."); return; } onServiceStateChange(State.ACTIVE); } if (mDestroyScheduled) { mDestroyScheduled = false; stopSelf(); return; } if (mEventProcessor == null) { mEventProcessor = new EventProcessor(SyncthingService.this, mApi); mEventProcessor.start(); } }
Source:
public void createNetworkSecurityRule() throws InterruptedException { NetworkSecurityRule rule = createRule(); server.enqueue(jsonResponse("/networksecurityrulecreate.json").setResponseCode(200)); final NetworkSecurityRuleApi ruleApi = api.getNetworkSecurityRuleApi(resourcegroup, DEFAULT_NSG_NAME); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s/securityRules/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, rule.name(), apiVersion); NetworkSecurityRule result = ruleApi.createOrUpdate(rule.name(), rule.properties()); assertSent(server, "PUT", path); assertNotNull(result); assertEquals(result.name(), rule.name()); }

Target:
public void createNetworkSecurityRule() throws InterruptedException { NetworkSecurityRule rule = createRule(); server.enqueue(jsonResponse("/networksecurityrulecreate.json").setResponseCode(200)); final NetworkSecurityRuleApi ruleApi = api.getNetworkSecurityRuleApi(resourcegroup, DEFAULT_NSG_NAME); String path = String.format("/subscriptions/%s/resourcegroups/%s/providers/Microsoft.Network/networkSecurityGroups/%s/securityRules/%s?%s", subscriptionid, resourcegroup, DEFAULT_NSG_NAME, rule.name(), apiVersion); NetworkSecurityRule result = ruleApi.createOrUpdate(rule.name(), rule.properties()); String json = String.format("{\"properties\":%s}", new Gson().toJson(rule.properties())); assertSent(server, "PUT", path, json); assertNotNull(result); assertEquals(result.name(), rule.name()); }
Source:
public void executeCommand() { boolean mergeRunning = false; try { updateVolumeDescription(); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeRunning = true; } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeRunning = true; } } finally { if (mergeRunning) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }

Target:
public void executeCommand() { boolean mergeRunning = false; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.Merge, createVDSParameters()); if (vdsReturnValue.getSucceeded()) { Guid jobId = (Guid) vdsReturnValue.getReturnValue(); persistBlockJobPlaceholder(jobId); getParameters().setVmJobId(jobId); persistCommand(getParameters().getParentCommand(), true); log.debug("Merge started successfully"); mergeRunning = true; updateVolumeDescription(); } else { log.error("Failed to start Merge on VDS"); } } catch (EngineException e) { log.error("Engine exception thrown while sending merge command", e); if (e.getErrorCode() == EngineError.imageErr || e.getErrorCode() == EngineError.mergeErr) { mergeRunning = true; } } finally { if (mergeRunning) { setSucceeded(true); } else { setCommandStatus(CommandStatus.FAILED); } } }
Source:
public boolean violates(Constraint other, Action.ActionEffect actionEffect) { if (other instanceof PatternScopedConstraint) { PatternScopedConstraint psc = (PatternScopedConstraint) other; if (user) { assert !psc.user : "illegal comparison"; if (!readOnly) { if (!global) { if (actionEffect == Action.ActionEffect.WRITE_RUNTIME || actionEffect == Action.ActionEffect.WRITE_CONFIG) { Set<Pattern> ourPatterns = patternsHolder.patterns; String theTarget = psc.target; boolean anyMatch = anyMatch(ourPatterns, theTarget); if (!anyMatch) ControllerLogger.ACCESS_LOGGER.tracef("pattern constraint violated " + "for action %s due to no match between target %s and allowed patterns %s", actionEffect, theTarget, ourPatterns); return !anyMatch; } } } } else { assert psc.user : "illegal comparison"; return other.violates(this, actionEffect); } } return false; }

Target:
public boolean violates(Constraint other, Action.ActionEffect actionEffect) { if (other instanceof PatternScopedConstraint) { PatternScopedConstraint psc = (PatternScopedConstraint) other; if (user) { assert !psc.user : "illegal comparison"; if (!readOnly) { if (!global) { if (actionEffect == Action.ActionEffect.WRITE_RUNTIME || actionEffect == Action.ActionEffect.WRITE_CONFIG) { Set<Pattern> ourPatterns = patternsHolder.patterns; String theTarget = psc.target; boolean anyMatch = anyMatch(ourPatterns, theTarget); if (!anyMatch) { ControllerLogger.ACCESS_LOGGER.tracef("pattern constraint violated " + "for action %s due to no match between target and allowed patterns", actionEffect); } return !anyMatch; } } } } else { assert psc.user : "illegal comparison"; return other.violates(this, actionEffect); } } return false; }
Source:
public void testFilterWithWrongString() { mockFilterObserver.setName("WRONG"); assert mockFilterObserver.getFilteredInstalledApplications().size() == 0; }

Target:
public void testFilterWithWrongString() { mockFilterObserver.setName("WRONG"); assertEquals(0, mockFilterObserver.getFilteredInstalledApplications().size()); }
Source:
private void setInitialState(PlexBindingProvider provider) { for (String itemName : provider.getItemNames()) { PlexBindingConfig config = provider.getConfig(itemName); if (config != null) setInitialState(config); } }

Target:
private void setInitialState(PlexBindingProvider provider) { for (String itemName : provider.getItemNames()) { PlexBindingConfig config = provider.getConfig(itemName); if (config != null) { setInitialState(config); } } }
Source:
public void storeInHttpSession(String key, String value) { HttpServletRequest request = this.getThreadLocalRequest(); HttpSession session = request.getSession(); session.setAttribute(key, value); }

Target:
public void storeInHttpSession(String key, String value) { HttpServletRequest request = this.getThreadLocalRequest(); HttpSession session = request.getSession(); session.setAttribute(UI_PREFIX + key, value); }
Source:
private void doVisitToken(FullIdent ident, boolean isStatic, boolean previous) { final String name = ident.getText(); final int groupIdx = getGroupNumber(name); final int line = ident.getLineNo(); if (groupIdx == lastGroup || !beforeFirstImport && isAlphabeticallySortableStaticImport(isStatic)) { doVisitTokenInSameGroup(isStatic, previous, name, line); } else if (groupIdx > lastGroup) { if (!beforeFirstImport && separated && line - lastImportLine < 2) { log(line, MSG_SEPARATION, name); } } else { log(line, MSG_ORDERING, name); } if (checkSeparatorInGroup(groupIdx, isStatic, line) || checkSeparatorInStaticImport(isStatic, line)) { log(line, MSG_SEPARATED_IN_GROUP, name); } lastGroup = groupIdx; lastImport = name; }

Target:
private void doVisitToken(FullIdent ident, boolean isStatic, boolean previous) { final String name = ident.getText(); final int groupIdx = getGroupNumber(name); final int line = ident.getLineNo(); if (groupIdx == lastGroup || !beforeFirstImport && isAlphabeticallySortableStaticImport(isStatic)) { doVisitTokenInSameGroup(isStatic, previous, name, line); } else if (groupIdx > lastGroup) { if (!beforeFirstImport && separated && line - lastImportLine < 2) { log(line, MSG_SEPARATION, name); } } else { log(line, MSG_ORDERING, name); } if (isSeparatorInGroup(groupIdx, isStatic, line)) { log(line, MSG_SEPARATED_IN_GROUP, name); } lastGroup = groupIdx; lastImport = name; }
Source:
public DefaultCompactionPolicyTest() throws InterruptedException { Pair<MockBlobStore, StoreConfig> initState = CompactionPolicyTest.initializeBlobStore(properties, time, -1, -1, DEFAULT_MAX_BLOB_SIZE); this.config = initState.getSecond(); this.blobStore = initState.getFirst(); this.mockBlobStoreStats = blobStore.getBlobStoreStats(); this.messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.HoursPerDay * Time.SecsPerHour * Time.MsPerSec; this.compactionPolicy = new DefaultCompactionPolicy(config, time); }

Target:
public DefaultCompactionPolicyTest() throws InterruptedException { Pair<MockBlobStore, StoreConfig> initState = CompactionPolicyTest.initializeBlobStore(properties, time, -1, -1, DEFAULT_MAX_BLOB_SIZE); config = initState.getSecond(); blobStore = initState.getFirst(); mockBlobStoreStats = blobStore.getBlobStoreStats(); messageRetentionTimeInMs = config.storeDeletedMessageRetentionDays * Time.HoursPerDay * Time.SecsPerHour * Time.MsPerSec; compactionPolicy = new DefaultCompactionPolicy(config, time); }
Source:
public void adDisplayedBeforeSections() { AdsBaseObject ads = new AdsBaseObject(); ads.getUrl(urlWithInstantGlobals(true)); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(1)))); Assertion.assertTrue(isIncontenAdDisplayed(1, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(2)))); Assertion.assertFalse(isIncontenAdDisplayed(0, ads), "IncontentBoxad is displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(3)))); Assertion.assertTrue(isIncontenAdDisplayed(2, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(4)))); Assertion.assertTrue(isIncontenAdDisplayed(3, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(5)))); Assertion.assertFalse(isIncontenAdDisplayed(5, ads), "IncontentBoxad is displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(6)))); Assertion.assertFalse(isIncontenAdDisplayed(6, ads), "IncontentBoxad is displayed before section" ); }

Target:
public void adDisplayedBeforeSections() { AdsBaseObject ads = new AdsBaseObject(); ads.getUrl(urlWithInstantGlobals(true)); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(1)))); Assertion.assertTrue(isIncontenAdDisplayed(1, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(3)))); Assertion.assertTrue(isIncontenAdDisplayed(2, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(4)))); Assertion.assertTrue(isIncontenAdDisplayed(3, ads), "IncontentBoxad is not displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(5)))); Assertion.assertFalse(isIncontenAdDisplayed(5, ads), "IncontentBoxad is displayed before section" ); ads.scrollTo(By.id(String.format(ARTICLE_HEADER_SELECTOR, Integer.toString(6)))); Assertion.assertFalse(isIncontenAdDisplayed(6, ads), "IncontentBoxad is displayed before section" ); }
Source:
public void setHandlers(Closure<?> handlers) { this.handlers = this.handlers.leftShift(handlers); }

Target:
public void setHandlers(Closure<?> handlers) { assertAtTopLevelOfRatpackDsl("handlers"); this.handlers = new ComposedClosure<>(handlers, this.handlers); }
Source:
public void testInvalidReferenceIndex() { final SAMRecord sam = new SAMRecordSetBuilder().addFrag("test", 0, 1, false, false, "3S9M", null, 2); sam.setReferenceIndex(9999); }

Target:
public void testInvalidReferenceIndex() { final SAMRecord sam = createTestRecordHelper(); sam.setReferenceIndex(9999); }
Source:
private String findQueryToResend(SolrQuery query, QueryResponse solrResponse) { long maxHits = Integer.MIN_VALUE; String queryToResend = query.get("q"); for (SpellCheckResponse.Collation collation : solrResponse.getSpellCheckResponse().getCollatedResults()) { if (maxHits < collation.getNumberOfHits()) { maxHits = collation.getNumberOfHits(); queryToResend = collation.getCollationQueryString(); } } return queryToResend; }

Target:
private String findQueryToResend(SolrQuery query, QueryResponse solrResponse) { long maxHits = Integer.MIN_VALUE; String queryToResend = query.get("q"); for (Collation collation : solrResponse.getSpellCheckResponse().getCollatedResults()) { if (maxHits < collation.getNumberOfHits()) { maxHits = collation.getNumberOfHits(); queryToResend = collation.getCollationQueryString(); } } return queryToResend; }
Source:
public void testConcurrentExpensiveJobs() { final ValidationThreadPool pool = new ValidationThreadPool(VALIDATION_THREAD_COUNT); final IJobManager manager = Job.getJobManager(); final Runnable expensiveRunnable = createValidatableRunnable(CheckType.EXPENSIVE, manager); final List<Promise<Object>> validationPromises = Lists.newArrayList(); for (int i = 0; i < 10; i++) { validationPromises.add(pool.submit(CheckType.EXPENSIVE, expensiveRunnable)); } Promise.all(validationPromises).getSync(); }

Target:
public void testConcurrentExpensiveJobs() { final IJobManager manager = Job.getJobManager(); final Runnable expensiveRunnable = createValidatableRunnable(CheckType.EXPENSIVE, manager); final List<Promise<Object>> validationPromises = Lists.newArrayList(); for (int i = 0; i < 10; i++) { validationPromises.add(pool.submit(CheckType.EXPENSIVE, expensiveRunnable)); } Promise.all(validationPromises).getSync(); }