auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ReferenceSequence get(final int sequenceIndex) { if (referenceSequence != null && referenceSequence.getContigIndex() == sequenceIndex) { return referenceSequence; } if (!referenceSequenceFile.isIndexed() && referenceSequence != null && referenceSequence.getContigIndex() > sequenceIndex) { throw new SAMException("Requesting earlier reference sequence: " + sequenceIndex + " < " + referenceSequence.getContigIndex()); } referenceSequence = null; if(referenceSequenceFile.isIndexed()){ final SAMSequenceRecord samSequenceRecord = referenceSequenceFile.getSequenceDictionary().getSequence(sequenceIndex); if(samSequenceRecord != null){ referenceSequence = referenceSequenceFile.getSequence(samSequenceRecord.getSequenceName()) ; } } else { do { referenceSequence = referenceSequenceFile.nextSequence(); } while (referenceSequence != null && referenceSequence.getContigIndex() < sequenceIndex); } if (referenceSequence == null || referenceSequence.getContigIndex() != sequenceIndex) { throw new SAMException("Reference sequence (" + sequenceIndex + ") not found in " + referenceSequenceFile.toString()); } return referenceSequence; }

Target:
public ReferenceSequence get(final int sequenceIndex) { if (referenceSequence != null && referenceSequence.getContigIndex() == sequenceIndex) { return referenceSequence; } if (referenceSequence != null && referenceSequence.getContigIndex() > sequenceIndex) { throw new SAMException("Requesting earlier reference sequence: " + sequenceIndex + " < " + referenceSequence.getContigIndex()); } referenceSequence = null; if(referenceSequenceFile.isIndexed()) { final SAMSequenceRecord samSequenceRecord = referenceSequenceFile.getSequenceDictionary().getSequence(sequenceIndex); if(samSequenceRecord != null) { referenceSequence = referenceSequenceFile.getSequence(samSequenceRecord.getSequenceName()) ; } } else { do { referenceSequence = referenceSequenceFile.nextSequence(); } while (referenceSequence != null && referenceSequence.getContigIndex() < sequenceIndex); } if (referenceSequence == null || referenceSequence.getContigIndex() != sequenceIndex) { throw new SAMException("Reference sequence (" + sequenceIndex + ") not found in " + referenceSequenceFile.toString()); } return referenceSequence; }
Source:
public void writeIndexToFile(long fileEndPointer) throws IOException, StoreException { if (prevNumOfEntriesWritten != index.size()) { File temp = new File(getFile().getAbsolutePath() + ".tmp"); FileOutputStream fileStream = new FileOutputStream(temp); CrcOutputStream crc = new CrcOutputStream(fileStream); DataOutputStream writer = new DataOutputStream(crc); try { rwLock.readLock().lock(); writer.writeShort(PersistentIndex.version); writer.writeInt(this.keySize); writer.writeInt(this.valueSize); writer.writeLong(fileEndPointer); int numOfEntries = 0; for (Map.Entry<StoreKey, IndexValue> entry : index.entrySet()) { long offsetEnd = entry.getValue().getOffset() + entry.getValue().getSize(); if (entry.getValue().getOffset() + entry.getValue().getSize() <= fileEndPointer) { writer.write(entry.getKey().toBytes()); writer.write(entry.getValue().getBytes().array()); logger.trace("IndexSegment : writing key - value - offset size fileEndOffset {}", getFile().getAbsolutePath(), entry.getKey(), entry.getValue().getOffset(), entry.getValue().getSize(), fileEndPointer); numOfEntries++; } } prevNumOfEntriesWritten = numOfEntries; long crcValue = crc.getValue(); writer.writeLong(crcValue); fileStream.getChannel().force(true); temp.renameTo(getFile()); } catch (IOException e) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " IO error while persisting index to disk", e, StoreErrorCodes.IOError); } finally { writer.close(); rwLock.readLock().unlock(); } logger.trace("IndexSegment : completed writing index to file", indexFile.getAbsolutePath()); } }

Target:
public void writeIndexToFile(long fileEndPointer) throws IOException, StoreException { if (prevNumOfEntriesWritten != index.size()) { File temp = new File(getFile().getAbsolutePath() + ".tmp"); FileOutputStream fileStream = new FileOutputStream(temp); CrcOutputStream crc = new CrcOutputStream(fileStream); DataOutputStream writer = new DataOutputStream(crc); try { rwLock.readLock().lock(); writer.writeShort(PersistentIndex.version); writer.writeInt(this.keySize); writer.writeInt(this.valueSize); writer.writeLong(fileEndPointer); int numOfEntries = 0; for (Map.Entry<StoreKey, IndexValue> entry : index.entrySet()) { if (entry.getValue().getOffset() + entry.getValue().getSize() <= fileEndPointer) { writer.write(entry.getKey().toBytes()); writer.write(entry.getValue().getBytes().array()); logger.trace("IndexSegment : writing key - value - offset size fileEndOffset {}", getFile().getAbsolutePath(), entry.getKey(), entry.getValue().getOffset(), entry.getValue().getSize(), fileEndPointer); numOfEntries++; } } prevNumOfEntriesWritten = numOfEntries; long crcValue = crc.getValue(); writer.writeLong(crcValue); fileStream.getChannel().force(true); temp.renameTo(getFile()); } catch (IOException e) { throw new StoreException("IndexSegment : " + indexFile.getAbsolutePath() + " IO error while persisting index to disk", e, StoreErrorCodes.IOError); } finally { writer.close(); rwLock.readLock().unlock(); } logger.trace("IndexSegment : completed writing index to file", indexFile.getAbsolutePath()); } }
Source:
public void testLoadFileTextFromJar() { File jarFile = new File("src/test/resources/evaluation-12.1.1.jar"); assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile,"META-INF","kie-deployment-descriptor.xml")); assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile,"META-INF","kmodule.xml")); }

Target:
public void testLoadFileTextFromJar() { File jarFile = new File("src/test/resources/org/guvnor/m2repo/backend/server/evaluation-12.1.1.jar"); assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, GuvnorM2Repository.KIE_DEPLOYMENT_DESCRIPTOR_XML)); assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, GuvnorM2Repository.KMODULE_XML)); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, "kie-descriptor.xml")); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, "modu.xml")); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, "")); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, "")); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, null)); assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, null)); }
Source:
public boolean removeRoute(@NonNull RouteInfo route) { return Objects.equals(mIfaceName, route.getInterface()) && mRoutes.remove(route); }

Target:
public boolean removeRoute(@NonNull RouteInfo route) { if (Objects.equals(mIfaceName, route.getInterface())) { int i = findRouteIndexByDestination(route); if (i >= 0) { mRoutes.remove(i); return true; } } return false; }
Source:
private static List<String> getAnnotatedMethodsFromJar( Path jarFile, Collection<String> annotations) throws IOException { List<String> annotatedMethods = new ArrayList<>(); JarFile jar = new JarFile(jarFile.toFile()); Stream<JarEntry> jarEntries = jar.stream(); jarEntries.forEach( jarEntry -> { try { if (jarEntry.getName().endsWith(".class")) { InputStream is = jar.getInputStream(jarEntry); annotatedMethods.addAll(getAnnotatedMethodsFromClassFile(is, annotations)); } } catch (IOException e) { throw new RuntimeException("Failure to parse: " + e.getMessage()); } }); Collections.sort(annotatedMethods); return annotatedMethods; }

Target:
private static List<String> getAnnotatedMethodsFromJar( Path jarFile, Collection<String> annotations) throws IOException { List<String> annotatedMethods = new ArrayList<>(); JarFile jar = new JarFile(jarFile.toFile()); Stream<JarEntry> jarEntries = jar.stream(); jarEntries.forEach( jarEntry -> { try { if (jarEntry.getName().endsWith(".class")) { InputStream is = jar.getInputStream(jarEntry); annotatedMethods.addAll(getAnnotatedMethodsFromClassFile(is, annotations)); } } catch (IOException e) { throw new RuntimeException(e); } }); Collections.sort(annotatedMethods); return annotatedMethods; }
Source:
public IntegrationTestingConfig get() { loadProperties(); return new IntegrationTestingConfig() { @Override public String getCoordinatorHost() { return coordinatorHost; } @Override public String getIndexerHost() { return indexerHost; } @Override public String getRouterHost() { return routerHost; } @Override public String getBrokerHost() { return brokerHost; } @Override public String getMiddleManagerHost() { return middleManagerHost; } @Override public String getZookeeperHosts() { return zookeeperHosts; } }; }

Target:
public IntegrationTestingConfig get() { return new IntegrationTestingConfig() { @Override public String getCoordinatorHost() { return coordinatorHost; } @Override public String getIndexerHost() { return indexerHost; } @Override public String getRouterHost() { return routerHost; } @Override public String getBrokerHost() { return brokerHost; } @Override public String getMiddleManagerHost() { return middleManagerHost; } @Override public String getZookeeperHosts() { return zookeeperHosts; } }; }
Source:
public static Optional<String> parameterNonNullGlobalAnnotation(Symbol.MethodSymbol method) { if (isGloballyAnnotatedWith(method, JAVAX_ANNOTATION_PARAMETERS_ARE_NONNULL_BY_DEFAULT)) { return Optional.of(JAVAX_ANNOTATION_PARAMETERS_ARE_NONNULL_BY_DEFAULT); } if (isGloballyAnnotatedWith(method, ORG_ECLIPSE_JDT_ANNOTATION_NON_NULL_BY_DEFAULT, "PARAMETER")) { return Optional.of(ORG_ECLIPSE_JDT_ANNOTATION_NON_NULL_BY_DEFAULT); } return Optional.empty(); }

Target:
public static String parameterNonNullGlobalAnnotation(Symbol.MethodSymbol method) { if (isGloballyAnnotatedWith(method, JAVAX_ANNOTATION_PARAMETERS_ARE_NONNULL_BY_DEFAULT)) { return JAVAX_ANNOTATION_PARAMETERS_ARE_NONNULL_BY_DEFAULT; } if (isGloballyAnnotatedWith(method, ORG_ECLIPSE_JDT_ANNOTATION_NON_NULL_BY_DEFAULT, "PARAMETER")) { return ORG_ECLIPSE_JDT_ANNOTATION_NON_NULL_BY_DEFAULT; } return null; }
Source:
public final String toStringWithId() { return String.format("[%s][%s]", getId(), getName()); }

Target:
public final String toStringWithId() { return String.format("[%s][%s]", getName(), getId()); }
Source:
public MessageUnpacker(MessageBufferInput in) { this.in = in; }

Target:
public MessageUnpacker(MessageBufferInput in) { this.in = checkNotNull(in, "MessageBufferInput"); }
Source:
public GatewayResponse capture(CaptureGatewayRequest request) { return smartpayCaptureHandler.capture(request); }

Target:
public GatewayResponse<BaseCaptureResponse> capture(CaptureGatewayRequest request) { return smartpayCaptureHandler.capture(request); }
Source:
private void dispose(boolean deleting) { try { RandomAccessFile randomAccessFile = fRandomAccessFile; if (randomAccessFile != null) { if (!deleting && fIsDirty) { if (fHeader != null) { fHeader.serialize(randomAccessFile); } randomAccessFile.seek(0); randomAccessFile.writeInt(getVersion()); fIsDirty = false; } randomAccessFile.close(); } setCreatedFromScratch(true); fRandomAccessFile = null; String headerTrace = fHeader == null ? "No header" : "nbEvents: " + fHeader.fNbEvents + " timerange:" + fHeader.fTimeRange; TmfCoreTracer.traceIndexer(this.getClass().getSimpleName() + " disposed. " + headerTrace); } catch (IOException e) { Activator.logError(MessageFormat.format(Messages.IOErrorClosingIndex, fFile), e); } }

Target:
private void dispose(boolean deleting) { try { RandomAccessFile randomAccessFile = fRandomAccessFile; if (randomAccessFile != null) { if (!deleting && fIsDirty) { if (fHeader != null) { fHeader.serialize(randomAccessFile); } randomAccessFile.seek(0); randomAccessFile.writeInt(getVersion()); fIsDirty = false; } randomAccessFile.close(); } setCreatedFromScratch(true); String headerTrace = fHeader == null ? "No header" : "nbEvents: " + fHeader.fNbEvents + " timerange:" + fHeader.fTimeRange; TmfCoreTracer.traceIndexer(this.getClass().getSimpleName() + " disposed. " + headerTrace); } catch (IOException e) { Activator.logError(MessageFormat.format(Messages.IOErrorClosingIndex, fFile), e); } finally { fRandomAccessFile = null; } }
Source:
public void validate() { savedId.clear(); if (ApsAdminSystemConstants.EDIT == this.getStrutsAction()) { fetchFileDescriptions(); if (null == getFileDescriptions()) { this.addFieldError(DESCR_FIELD + 0, getText("error.resource.file.descrEmpty")); } if (null == getFileUpload()) { this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.fileEmpty")); } if (this.getFileUploadFileName().size()>0) { ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(this.getResourceType()); this.checkRightFileType(resourcePrototype, this.getFileUploadFileName().get(0)); } } else { try { fetchFileDescriptions(); for (int i = 0; i < getFileDescriptions().size(); i++) { if (null == getFileUploadInputStream(i)) { this.addFieldError(FILE_UPLOAD_FIELD + i, this.getText("error.resource.file.void")); } } } catch (Throwable ex) { this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.void")); } if (null != getFileUpload()) { validateFileDescriptions(); if (null != this.getResourceType()) { ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(this.getResourceType()); this.getFileUploadFileName().forEach(fileName -> checkRightFileType(resourcePrototype, fileName)); } else { this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.genericError")); } } } }

Target:
public void validate() { savedId.clear(); if (ApsAdminSystemConstants.EDIT == this.getStrutsAction()) { if (null == getFileDescriptions()) { logger.debug("Description empty for the field ", DESCR_FIELD + 0); this.addFieldError(DESCR_FIELD + 0, getText("error.resource.file.descrEmpty")); } if (null == getFileUpload()) { logger.debug("File empty for the field ", FILE_UPLOAD_FIELD); this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.fileEmpty")); } if (this.getFileUploadFileName().size()>0) { ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(this.getResourceType()); this.checkRightFileType(resourcePrototype, this.getFileUploadFileName().get(0)); } } else { try { for (int i = 0; i < getFileDescriptions().size(); i++) { if (null == getFileUploadInputStream(i)) { logger.debug("File void for the field ", FILE_UPLOAD_FIELD + i); this.addFieldError(FILE_UPLOAD_FIELD + i, this.getText("error.resource.file.void")); } } } catch (Throwable ex) { logger.debug("File void for the field ", FILE_UPLOAD_FIELD); this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.void")); } if (null != getFileUpload()) { validateFileDescriptions(); if (null != this.getResourceType()) { ResourceInterface resourcePrototype = this.getResourceManager().createResourceType(this.getResourceType()); this.getFileUploadFileName().forEach(fileName -> checkRightFileType(resourcePrototype, fileName)); } else { logger.debug("Resource Type null for the field ", FILE_UPLOAD_FIELD); this.addFieldError(FILE_UPLOAD_FIELD, this.getText("error.resource.file.genericError")); } } } }
Source:
private List<String> getNamesOfDerivedVmsFromTemplate(DiskImage diskImage) { List<String> result = new ArrayList<String>(); for (VM vm : getDbFacade().getVmDao().getAllWithTemplate(getVmTemplateId())) { for (Disk vmDisk : getDbFacade().getDiskDao().getAllForVm(vm.getId())) { if (vmDisk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage vmDiskImage = (DiskImage) vmDisk; if (vmDiskImage.getImageTemplateId().equals(diskImage.getImageId())) { if (vmDiskImage.getStorageIds().contains(getParameters().getStorageDomainId())) { result.add(vm.getName()); } break; } } } } return result; }

Target:
private List<String> getNamesOfDerivedVmsFromTemplate(DiskImage diskImage) { List<String> result = new ArrayList<String>(); for (VM vm : getVmDAO().getAllWithTemplate(getVmTemplateId())) { for (Disk vmDisk : getDiskDao().getAllForVm(vm.getId())) { if (vmDisk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage vmDiskImage = (DiskImage) vmDisk; if (vmDiskImage.getImageTemplateId().equals(diskImage.getImageId())) { if (vmDiskImage.getStorageIds().contains(getParameters().getStorageDomainId())) { result.add(vm.getName()); } break; } } } } return result; }
Source:
protected void generate(final Resource file, final int bits) { if (!ResourceUtils.doesResourceExist(file)) { val rsaJsonWebKey = RsaJwkGenerator.generateJwk(bits); val jsonWebKeySet = new JsonWebKeySet(rsaJsonWebKey); val data = jsonWebKeySet.toJson(JsonWebKey.OutputControlLevel.INCLUDE_PRIVATE); File location; if (file instanceof FileSystemResource) { location = file.getFile(); } else if (file instanceof FileUrlResource) { location = file.getFile(); } else { location = DEFAULT_JWKS_LOCATION; } FileUtils.write(location, data, StandardCharsets.UTF_8); LOGGER.debug("Generated JSON web keystore at [{}]", location); } else { LOGGER.debug("Located JSON web keystore at [{}]", file); } }

Target:
protected void generate(final Resource file, final int bits) { if (!ResourceUtils.doesResourceExist(file)) { val rsaJsonWebKey = RsaJwkGenerator.generateJwk(bits); val jsonWebKeySet = new JsonWebKeySet(rsaJsonWebKey); val data = jsonWebKeySet.toJson(JsonWebKey.OutputControlLevel.INCLUDE_PRIVATE); val location = resolveLocation(file); FileUtils.write(location, data, StandardCharsets.UTF_8); LOGGER.debug("Generated JSON web keystore at [{}]", location); } else { LOGGER.debug("Located JSON web keystore at [{}]", file); } }
Source:
@Override public void error() { ImageView target = this.target.get(); if (target == null) { return; } if (errorResId != 0) { target.setImageResource(errorResId); } else if (errorDrawable != null) { target.setImageDrawable(errorDrawable); } if (getCallback(callback, callbackRef) != null) { getCallback(callback, callbackRef).onError(); } }

Target:
@Override public void error() { ImageView target = this.target.get(); if (target == null) { return; } if (errorResId != 0) { target.setImageResource(errorResId); } else if (errorDrawable != null) { target.setImageDrawable(errorDrawable); } Callback realCallback = getCallback(callback, callbackRef); if (realCallback != null) { realCallback.onError(); } }
Source:
private void handlePurgeProject(HttpServletRequest req, HttpServletResponse resp, Session session) throws ServletException, IOException { User user = session.getUser(); String projectName = getParam(req, "project"); HashMap<String, Object> ret = new HashMap<String, Object>(); boolean valid = true; Project project = projectManager.getProject(projectName); if (project != null) { ret.put("error", "Project " + projectName + " should be deleted before purging"); valid = false; } if (valid) { project = projectManager.getInactiveProject(projectName); if (!hasPermission(project, user, Type.ADMIN)) { ret.put("error", "Cannot purge. User '" + user.getUserId() + "' is not an ADMIN."); valid = false; ; } } if (valid) { try { projectManager.purgeProject(project, user); } catch (ProjectManagerException e) { ret.put("error", e.getMessage()); valid = false; } } ret.put("success", valid); this.writeJSON(resp, ret); }

Target:
private void handlePurgeProject(HttpServletRequest req, HttpServletResponse resp, Session session) throws ServletException, IOException { User user = session.getUser(); String projectName = getParam(req, "project"); HashMap<String, Object> ret = new HashMap<String, Object>(); boolean isOperationSuccessful = true; if (projectManager.isActiveProject(projectName)) { ret.put("error", "Project " + projectName + " should be deleted before purging"); isOperationSuccessful = false; } try { Project project = null; if (isOperationSuccessful) { project = projectManager.getProject(projectName); if (project == null) { ret.put("error", "no project with name : " + projectName); isOperationSuccessful = false; } } if (isOperationSuccessful && !hasPermission(project, user, Type.ADMIN)) { ret.put("error", "Cannot purge. User '" + user.getUserId() + "' is not an ADMIN."); isOperationSuccessful = false; } if (isOperationSuccessful) { projectManager.purgeProject(project, user); } } catch (Exception e) { ret.put("error", e.getMessage()); isOperationSuccessful = false; } ret.put("success", isOperationSuccessful); this.writeJSON(resp, ret); }
Source:
private void checkPrivileges(Role role) { Collection<Privilege> privileges = role.getPrivileges(); Optional.ofNullable(role.getPrivileges()) .map(p -> p.stream().filter(pr -> !Context.hasPrivilege(pr.getPrivilege())).collect(Collectors.toSet())) .ifPresent(missing -> { throw new APIAuthenticationException("Role.you.must.have.privileges: " + missing.stream().map(Privilege::getPrivilege).collect(Collectors.joining(", "))); }); }

Target:
private void checkPrivileges(Role role) { Collection<Privilege> privileges = role.getPrivileges(); Optional.ofNullable(role.getPrivileges()) .map(p -> p.stream().filter(pr -> !Context.hasPrivilege(pr.getPrivilege())).map(Privilege::getPrivilege) .distinct().collect(Collectors.joining(", "))) .ifPresent(missing -> { throw new APIException("Role.you.must.have.privileges: ", new Object[] { missing }); }); }
Source:
private String process(String textToParse) { try { List<String> matchStrings = new ArrayList<String>(); extractWithJSonPath(textToParse, jsonPathExpressionField.getText(), matchStrings); if(matchStrings.size()==0) { return "NO MATCH"; } else { StringBuilder builder = new StringBuilder(); int i=0; for (String text : matchStrings) { builder.append("Result[").append(i++).append("]=").append(text).append("\n"); } return builder.toString(); } } catch (Exception e) { return "Exception:"+ e.getMessage(); } }

Target:
private String process(String textToParse) { try { List<String> matchStrings = extractWithJSonPath(textToParse, jsonPathExpressionField.getText()); if(matchStrings.size()==0) { return "NO MATCH"; } else { StringBuilder builder = new StringBuilder(); int i=0; for (String text : matchStrings) { builder.append("Result[").append(i++).append("]=").append(text).append("\n"); } return builder.toString(); } } catch (Exception e) { return "Exception:"+ e.getMessage(); } }
Source:
public void verifyDepictions() { List<DepictedItem> selectedDepictions = repository.getSelectedDepictions(); Log.e("depictsline118", selectedDepictions.size()+""); if (selectedDepictions != null && !selectedDepictions.isEmpty()) { repository.setSelectedDepictions(repository.getDepictionsEntityIdList()); view.goToNextScreen(); } else { view.noDepictionSelected(); } }

Target:
public void verifyDepictions() { List<DepictedItem> selectedDepictions = repository.getSelectedDepictions(); if (selectedDepictions != null && !selectedDepictions.isEmpty()) { repository.setSelectedDepictions(repository.getDepictionsEntityIdList()); view.goToNextScreen(); } else { view.noDepictionSelected(); } }
Source:
public String call() { try { InputStream urlStream = url.openStream(); String result = Util.readAsUTF8(urlStream); urlStream.close(); return result; } catch (IOException e) { return null; } }

Target:
public String call() throws IOException { InputStream urlStream = url.openStream(); String result = Util.readAsUTF8(urlStream); urlStream.close(); return result; }
Source:
public void removeModule(Module module) { ChannelRegistry registry = findRegistry(module); if (registry != null) { registry.deleteInbound(module.getProperties().getProperty("xd.stream.name")); } }

Target:
public void removeModule(Module module) { ChannelRegistry registry = findRegistry(module); if (registry != null) { registry.deleteInbound(module.getDeploymentMetadata().getGroup()); } }
Source:
@Override public void active(boolean active) { guard(); try { ctx.state().changeGlobalState(active, baselineNodes(), false).get(); recordEvent(active ? EventType.EVT_CLUSTER_ACTIVATED : EventType.EVT_CLUSTER_DEACTIVATED); } catch (IgniteCheckedException e) { recordEvent(EventType.EVT_CLUSTER_ACTIVATION_FAILED); throw U.convertException(e); } finally { unguard(); } }

Target:
@Override public void active(boolean active) { guard(); try { ctx.state().changeGlobalState(active, baselineNodes(), false).get(); } catch (IgniteCheckedException e) { throw U.convertException(e); } finally { unguard(); } }
Source:
protected void removeDiskFromDbCallBack(final CinderDisk cinderVolume) { final Snapshot updated; if (getParameters().isUpdateSnapshot()) { updated = getSnapshotWithoutCinderVolume(cinderVolume); } else { updated = null; } TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { removeDiskFromDb(cinderVolume, updated); return null; } }); }

Target:
protected void removeDiskFromDbCallBack(final CinderDisk cinderVolume) { final Snapshot updated = getParameters().isUpdateSnapshot() ? getSnapshotWithoutCinderVolume(cinderVolume) : null; TransactionSupport.executeInScope(TransactionScopeOption.Required, new TransactionMethod<Object>() { @Override public Object runInTransaction() { removeDiskFromDb(cinderVolume, updated); return null; } }); }
Source:
public void onUpdated(Item item) { if (item instanceof SCMSourceOwner) { try { ((SCMSourceOwner) item).getSCMSources(); } catch (NullPointerException e) { check = false; throw e; } } }

Target:
public void onUpdated(Item item) { if (item instanceof SCMSourceOwner) { try { ((SCMSourceOwner) item).getSCMSources(); } catch (NullPointerException e) { check = new Exception(e); } } }
Source:
private InputFormat<E, Void> getDelegateInputFormatForPartition(Dataset<E> dataset, String partitionDir) { LOG.debug("Getting delegate input format for dataset with partition directory {}", dataset, partitionDir); PartitionKey key = ((FileSystemDataset<E>) dataset).keyFromDirectory(new Path(partitionDir)); LOG.debug("Partition key: {}", key); if (key != null) { PartitionedDataset<E> partition = ((PartitionedDataset<E>) dataset).getPartition(key, false); LOG.debug("Partition: {}", partition); return getDelegateInputFormat(partition); } throw new DatasetException("Cannot find partition " + partitionDir); }

Target:
private InputFormat<E, Void> getDelegateInputFormatForPartition(Dataset<E> dataset, String partitionDir) { if (!(dataset instanceof FileSystemDataset)) { throw new UnsupportedOperationException("Partitions only supported for " + "FileSystemDataset. Dataset: " + dataset); } FileSystemDataset<E> fsDataset = (FileSystemDataset<E>) dataset; LOG.debug("Getting delegate input format for dataset with partition directory {}", dataset, partitionDir); PartitionKey key = fsDataset.keyFromDirectory(new Path(partitionDir)); LOG.debug("Partition key: {}", key); if (key != null) { PartitionedDataset<E> partition = fsDataset.getPartition(key, false); LOG.debug("Partition: {}", partition); return getDelegateInputFormat(partition); } throw new DatasetException("Cannot find partition " + partitionDir); }
Source:
private void downloadSurroundingImages (MapillaryImage mapillaryImage) { MainApplication.worker.submit(() -> { final int prefetchCount = MapillaryProperties.PRE_FETCH_IMAGE_COUNT.get(); MapillaryImage nextImage = mapillaryImage; MapillaryImage prevImage = mapillaryImage; for (int i = 0; i < prefetchCount; i++) { if (nextImage != null && nextImage.next() != null) { CacheUtils.downloadPicture((MapillaryImage) nextImage.next()); nextImage = (MapillaryImage) nextImage.next(); } if (prevImage != null && prevImage.previous() != null) { CacheUtils.downloadPicture((MapillaryImage) prevImage.previous()); prevImage = (MapillaryImage) prevImage.previous(); } } }); }

Target:
private void downloadSurroundingImages (MapillaryImage mapillaryImage) { MainApplication.worker.execute(() -> { final int prefetchCount = MapillaryProperties.PRE_FETCH_IMAGE_COUNT.get(); CacheAccess <String, BufferedImageCacheEntry> imageCache = Caches.ImageCache.getInstance().getCache(); MapillaryAbstractImage nextImage = mapillaryImage.next(); MapillaryAbstractImage prevImage = mapillaryImage.previous(); for (int i = 0; i < prefetchCount; i++) { if (nextImage != null) { if ((nextImage instanceof MapillaryImage) && (imageCache.get(((MapillaryImage) nextImage).getKey()) == null)) { CacheUtils.downloadPicture((MapillaryImage) nextImage); } nextImage = nextImage.next(); } if (prevImage != null) { if ((prevImage instanceof MapillaryImage) && (imageCache.get(((MapillaryImage) prevImage).getKey()) == null)) { CacheUtils.downloadPicture((MapillaryImage) prevImage); } prevImage = prevImage.previous(); } } }); }
Source:
public void emitTuples() { if (!windowDone) { try { preparedStatement.setLong(1, offset); preparedStatement.setLong(2, batchSize); ResultSet resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { do { Object tuple = getTuple(resultSet); outputPort.emit(tuple); offset++; } while (resultSet.next()); } else { windowDone = true; } resultSet.close(); } catch (SQLException ex) { store.disconnect(); throw new RuntimeException(ex); } } }

Target:
public void emitTuples() { if (!windowDone) { try { setRuntimeParams(); ResultSet resultSet = preparedStatement.executeQuery(); if (resultSet.next()) { do { Object tuple = getTuple(resultSet); outputPort.emit(tuple); } while (resultSet.next()); } else { windowDone = true; } resultSet.close(); pageNumber++; } catch (SQLException ex) { store.disconnect(); throw new RuntimeException(ex); } } else { try { Thread.sleep(sleepMillis); } catch (InterruptedException e) { throw new RuntimeException(e); } } }
Source:
void onSave() { if (!validate()) { return; } if (getProgress() != null) { return; } AffinityGroup group = getAffinityGroup(); group.setName(getName().getEntity()); group.setDescription(getDescription().getEntity()); group.setClusterId(clusterResolver.getClusterId()); group.setEnforcementType(getEnforcementType().getSelectedItem()); group.setPolarity(getPolarity().getSelectedItem()); group.setEntityIds(getVmsSelectionModel().getSelectedVmIds()); startProgress(null); Frontend.getInstance().runAction(getSaveActionType(), new AffinityGroupCRUDParameters(group.getId(), group), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { stopProgress(); if (result != null && result.getReturnValue() != null && result.getReturnValue().getSucceeded()) { cancel(); } } }, this); }

Target:
void onSave() { if (!validate()) { return; } if (getProgress() != null) { return; } AffinityGroup group = getAffinityGroup(); group.setName(getName().getEntity()); group.setDescription(getDescription().getEntity()); group.setClusterId(clusterResolver.getClusterId()); group.setEnforcing(getEnforcing().getEntity()); group.setPositive(getPositive().getEntity()); group.setEntityIds(getVmsSelectionModel().getSelectedVmIds()); startProgress(null); Frontend.getInstance().runAction(saveActionType, new AffinityGroupCRUDParameters(group.getId(), group), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { stopProgress(); if (result != null && result.getReturnValue() != null && result.getReturnValue().getSucceeded()) { cancel(); } } }, this); }
Source:
protected List<Location> javaStratumLocationsOfLines(List<Integer> javaLines) throws AbsentInformationException { Set<Long> tmpLocations = new TreeSet<>(); for (Integer key : javaLines) { List<Long> indexes = javaStratumLineToCodeIndexes(key.intValue()); if (indexes != null) { tmpLocations.addAll(indexes); } } List<Location> locations = new ArrayList<>(); for (Long long1 : tmpLocations) { long index = long1.longValue(); int position = Arrays.binarySearch(fCodeIndexTable, index); if(position < 0) { continue; } if (position == 0 || !tmpLocations.contains(new Long(fCodeIndexTable[position - 1]))) { locations.add(new LocationImpl(virtualMachineImpl(), this, index)); } } return locations; }

Target:
protected List<Location> javaStratumLocationsOfLines(List<Integer> javaLines) throws AbsentInformationException { Set<Long> tmpLocations = new TreeSet<>(); for (Integer key : javaLines) { List<Long> indexes = javaStratumLineToCodeIndexes(key.intValue()); if (indexes != null) { tmpLocations.addAll(indexes); } } List<Location> locations = new ArrayList<>(); for (Long location : tmpLocations) { long index = location.longValue(); int position = Arrays.binarySearch(fCodeIndexTable, index); if(position < 0) { continue; } if (position == 0 || !tmpLocations.contains(new Long(fCodeIndexTable[position - 1]))) { locations.add(new LocationImpl(virtualMachineImpl(), this, index)); } } return locations; }
Source:
public static void onFogRender(EntityViewRenderEvent.FogDensity event) { if (event.getInfo().getFluidState().getFluid() == MSFluids.ENDER.get() || event.getInfo().getFluidState().getFluid() == MSFluids.FLOWING_ENDER.get()) { event.setCanceled(true); event.setDensity(Float.MAX_VALUE); GlStateManager.fogMode(GlStateManager.FogMode.EXP); } }

Target:
public static void onFogRender(EntityViewRenderEvent.FogDensity event) { if (event.getInfo().getFluidState().getBlockState().getBlock() instanceof IMSFog) { IMSFog fog = (IMSFog)event.getInfo().getFluidState().getBlockState().getBlock(); float fogDensity = fog.getMSFogDensity(); event.setCanceled(true); event.setDensity(fogDensity); GlStateManager.fogMode(GlStateManager.FogMode.EXP); } }
Source:
public double getSetupTime(Config conf) { String fpu_name = (String) conf.getItemValue(FPU_KEY); if (!fpu_name.equals("None")) { if (!fpu_name.startsWith("IFU")) { return SETUP_TIME_LS_SPECTROSCOPY; } else { return SETUP_TIME_IFU_MOS; } } else { return SETUP_TIME_IMAGING; } }

Target:
public double getSetupTime(Config conf) { return Optional.ofNullable(conf.getItemValue(FPU_KEY)) .map(c -> (GmosCommonType.FPUnit) c) .filter(f -> !f.isImaging()) .map(f -> f.isIFU() ? SETUP_TIME_IFU_MOS : SETUP_TIME_LS_SPECTROSCOPY) .orElse(SETUP_TIME_IMAGING); }
Source:
public DataTransactionResult offerToStore(ValueContainer<?> container, Boolean value) { final ImmutableValue<Boolean> newValue = new ImmutableSpongeValue<Boolean>(Keys.IS_SNEAKING, false, value); if (container instanceof Entity) { final boolean old = getValueFromContainer(container).get(); final ImmutableValue<Boolean> oldValue = new ImmutableSpongeValue<Boolean>(Keys.IS_SNEAKING, false, old); try { ((Entity)container).setSneaking(value.booleanValue()); return DataTransactionBuilder.successReplaceResult(newValue, oldValue); } catch (Exception e) { DataTransactionBuilder.errorResult(newValue); } } return DataTransactionBuilder.failResult(newValue); }

Target:
public DataTransactionResult offerToStore(ValueContainer<?> container, Boolean value) { final ImmutableValue<Boolean> newValue = ImmutableDataCachingUtil.getValue(ImmutableSpongeValue.class, Keys.IS_SNEAKING, value, false); if (container instanceof Entity) { final boolean old = getValueFromContainer(container).get(); final ImmutableValue<Boolean> oldValue = ImmutableDataCachingUtil.getValue(ImmutableSpongeValue.class, Keys.IS_SNEAKING, old, false); try { ((Entity)container).setSneaking(value.booleanValue()); return DataTransactionBuilder.successReplaceResult(newValue, oldValue); } catch (Exception e) { DataTransactionBuilder.errorResult(newValue); } } return DataTransactionBuilder.failResult(newValue); }
Source:
public void cancelCall() { if (call != null) { okHttpClient.getDispatcher().getExecutorService().execute(new Runnable() { @Override public void run() { WebRequestListener listener = getListenerAndSetReferenceToNull(); if (listener != null) { call.cancel(); listener.onCancelledCall(); } } }); } }

Target:
public void cancelCall() { if (call != null) { okHttpClient.getDispatcher().getExecutorService().execute(new Runnable() { @Override public void run() { call.cancel(); } }); } }
Source:
public void postsAndReads() throws Exception { final User user = this.rule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final Inbox inbox = alias.inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename(this.getClass().getName()); final Attachments attachments = bout.attachments(); final String name = "test"; attachments.create(name); final Attachment attachment = attachments.get(name); final byte[] data = RandomUtils.nextBytes(100); attachment.write( new ByteArrayInputStream(data), Attachment.MARKDOWN, Long.toString(System.currentTimeMillis()) ); MatcherAssert.assertThat( IOUtils.toByteArray(attachment.read()), Matchers.equalTo(data) ); attachments.delete(name); }

Target:
public void postsAndReads() throws Exception { final User user = this.rule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final Inbox inbox = alias.inbox(); final Bout bout = inbox.bout(inbox.start()); bout.rename(this.getClass().getName()); final Attachments attachments = bout.attachments(); final String name = "test"; attachments.create(name); final Attachment attachment = attachments.get(name); final byte[] data = new byte[Byte.MAX_VALUE - 1]; for (int idx = 0; idx < data.length; ++idx) { data[idx] = (byte) idx; } attachment.write( new ByteArrayInputStream(data), Attachment.MARKDOWN, Long.toString(System.currentTimeMillis()) ); MatcherAssert.assertThat( IOUtils.toByteArray(attachment.read()), Matchers.equalTo(data) ); attachments.delete(name); }
Source:
public void addAttribute(String key, Object value) { this.properties.put(key, value); if (key.equals(NAME)) { this.name = (String) value; } if (key.equals(FREQ)) { isScaled = ((Long)getProperty(FREQ)).equals(1000000000); clockScale = 1000000000.0/((Long)getProperty(FREQ)).doubleValue(); clockAntiScale = 1.0 / clockScale; } if (key.equals(OFFSET)) { clockOffset = (Long)getProperty(OFFSET); } }

Target:
public void addAttribute(String key, Object value) { this.properties.put(key, value); if (key.equals(NAME)) { this.name = (String) value; } if (key.equals(FREQ)) { isScaled = ((Long) getProperty(FREQ)).equals(1000000000L); clockScale = 1000000000.0 / ((Long) getProperty(FREQ)).doubleValue(); clockAntiScale = 1.0 / clockScale; } if (key.equals(OFFSET)) { clockOffset = (Long) getProperty(OFFSET); } }
Source:
private boolean isAlumni(Student student) { return student .getRegistrationsSet() .stream() .anyMatch(registration -> ProgramConclusion .conclusionsFor(registration) .filter(ProgramConclusion::isAlumniProvider) .anyMatch(conclusion -> conclusion.groupFor(registration).isPresent() && conclusion.groupFor(registration).get().isConclusionProcessed())); }

Target:
private boolean isAlumni(Student student) { return student .getRegistrationsSet() .stream() .anyMatch(registration -> ProgramConclusion .conclusionsFor(registration) .filter(ProgramConclusion::isAlumniProvider) .anyMatch(conclusion -> conclusion.groupFor(registration) .map(CurriculumGroup::isConclusionProcessed).orElse(false))); }
Source:
public void initialise() { prePostComposite = worldRenderer.getMaterial("engine:prog.combine"); requireFBO(new FBOConfig("sceneOpaquePingPong", 1.0f, FBO.Type.HDR).useDepthBuffer().useNormalBuffer().useLightBuffer().useStencilBuffer()); requireFBO(new FBOConfig("sceneOpaque", 1.0f, FBO.Type.HDR).useDepthBuffer().useNormalBuffer().useLightBuffer().useStencilBuffer()); requireFBO(new FBOConfig("sceneReflectiveRefractive", 1.0f, FBO.Type.HDR).useNormalBuffer()); }

Target:
public void initialise() { prePostComposite = worldRenderer.getMaterial("engine:prog.combine"); requiresFBO(new FBOConfig(REFLECTIVE_REFRACTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); }
Source:
public static void disablePush(final boolean disable) { if (taskController.shouldQueueTaskForInit(OSTaskController.SET_SUBSCRIPTION)) { logger.error("Waiting for remote params. " + "Moving " + OSTaskController.SET_SUBSCRIPTION + " operation to a pending queue."); taskController.addTaskToQueue(new Runnable() { @Override public void run() { logger.debug("Running " + OSTaskController.SET_SUBSCRIPTION + " operation from pending queue."); disablePush(disable); } }); return; } if (shouldLogUserPrivacyConsentErrorMessageForMethodName(OSTaskController.SET_SUBSCRIPTION)) return; getCurrentSubscriptionState(appContext).setPushDisabled(!disable); OneSignalStateSynchronizer.setSubscription(disable); }

Target:
public static void disablePush(final boolean disable) { if (taskController.shouldQueueTaskForInit(OSTaskController.SET_SUBSCRIPTION)) { logger.error("Waiting for remote params. " + "Moving " + OSTaskController.SET_SUBSCRIPTION + " operation to a pending queue."); taskController.addTaskToQueue(new Runnable() { @Override public void run() { logger.debug("Running " + OSTaskController.SET_SUBSCRIPTION + " operation from pending queue."); disablePush(disable); } }); return; } if (shouldLogUserPrivacyConsentErrorMessageForMethodName(OSTaskController.SET_SUBSCRIPTION)) return; getCurrentSubscriptionState(appContext).setPushDisabled(disable); OneSignalStateSynchronizer.setSubscription(!disable); }
Source:
public String getItemString(ITmfEvent event) { if (event instanceof CustomEvent) { String ret = ((CustomEvent) event).getEventString(fId); return (ret == null ? EMPTY_STRING : ret); } return EMPTY_STRING; }

Target:
public String getItemString(ITmfEvent event) { if (event instanceof CustomEvent) { String ret = ((CustomEvent) event).getEventString(fIndex); return (ret == null ? EMPTY_STRING : ret); } return EMPTY_STRING; }
Source:
private void enqueueOperation(final RangeKeyOperation operation, final Map<Integer, List<Pair<K, K>>> blockToKeyRangesMap) { final int numSubOps = blockToKeyRangesMap.size(); operation.setNumSubOps(numSubOps); for (final Map.Entry<Integer, List<Pair<K, K>>> blockToSubKeyRanges : blockToKeyRangesMap.entrySet()) { final int blockId = blockToSubKeyRanges.getKey(); final List<Pair<K, K>> keyRanges = blockToSubKeyRanges.getValue(); try { subOperationQueue.put(new Tuple3<>(operation, keyRanges, blockId)); } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Enqueue failed with InterruptedException", e); } LOG.log(Level.FINEST, "Enqueue Op [Id: {0}, block: {1}]", new Object[]{operation.getOpId(), blockId}); } }

Target:
private void enqueueOperation(final RangeKeyOperation operation, final Map<Integer, List<Pair<K, K>>> blockToKeyRangesMap) { final int numSubOps = blockToKeyRangesMap.size(); operation.setNumSubOps(numSubOps); blockToKeyRangesMap.forEach((blockId, keyRanges) -> { try { subOperationQueue.put(new Tuple3<>(operation, keyRanges, blockId)); } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Enqueue failed with InterruptedException", e); } LOG.log(Level.FINEST, "Enqueue Op [Id: {0}, block: {1}]", new Object[]{operation.getOpId(), blockId}); }); }
Source:
public WorkspaceConfigDto deserializeWorkspaceTemplate(String templateName) { requireNonNull(templateName); try { URL url = Resources.getResource( WorkspaceDtoDeserializer.class, format("/templates/workspace/%s/%s", infrastructure, templateName)); return DtoFactory.getInstance() .createDtoFromJson(Resources.toString(url, Charsets.UTF_8), WorkspaceConfigDto.class); } catch (IOException | IllegalArgumentException | JsonSyntaxException e) { LOG.error( "Fail to read workspace template for infrastructure because ", templateName, infrastructure, e.getLocalizedMessage()); throw new RuntimeException(e.getLocalizedMessage(), e); } }

Target:
public WorkspaceConfigDto deserializeWorkspaceTemplate(String templateName) { requireNonNull(templateName); try { URL url = Resources.getResource( WorkspaceDtoDeserializer.class, format("/templates/workspace/%s/%s", infrastructure, templateName)); return DtoFactory.getInstance() .createDtoFromJson(Resources.toString(url, Charsets.UTF_8), WorkspaceConfigDto.class); } catch (IOException | IllegalArgumentException | JsonSyntaxException e) { LOG.error( "Fail to read workspace template for infrastructure because ", templateName, infrastructure, e.getMessage()); throw new RuntimeException(e.getLocalizedMessage(), e); } }
Source:
public static ChannelData decode(byte binMessage[], char offset, char arrayLen) throws StunException { char msgLen = 0; char channelNumber = 0; ChannelData channelData = null; byte data[] = null; if(arrayLen < 4) { throw new StunException(StunException.ILLEGAL_ARGUMENT, "Size too short"); } channelNumber = (char)((binMessage[offset++]<<8) | (binMessage[offset++]&0xFF)); if(!validateChannelNumber(channelNumber)) { throw new StunException(StunException.ILLEGAL_ARGUMENT, "Channel number invalid"); } msgLen = (char)((binMessage[offset++]<<8) | (binMessage[offset++]&0xFF)); if (msgLen != (binMessage.length - HEADER_LENGTH) && ((msgLen % 4) + 4) != (binMessage.length - HEADER_LENGTH)) { throw new StunException(StunException.ILLEGAL_ARGUMENT, "Size mismatch"); } data = new byte[msgLen]; System.arraycopy(binMessage, offset, data, 0, msgLen); channelData = new ChannelData(); channelData.setData(data); channelData.setChannelNumber(channelNumber); return channelData; }

Target:
public static ChannelData decode(byte binMessage[], char offset, char arrayLen) throws StunException { return decode(binMessage, offset); }
Source:
private SpeechletResponse handleYesIntent(Session session, AskState askState) throws SpeechletException { if (askState == AskState.VERIFYSTOP) { return handleVerifyStopResponse(session, true ); } log.error("Recieved yes intent without a question."); return askForCity(Optional.empty()); }

Target:
private SpeechletResponse handleYesIntent(Session session, AskState askState) throws SpeechletException { if (askState == AskState.VERIFYSTOP) { return handleVerifyStopResponse(session, true ); } log.error("Received yes intent without a question."); return askForCity(Optional.empty()); }
Source:
protected void updateCustomPropertySheet() { updateCustomPropertySheet(getModel().getEffectiveCompatibilityVersion()); }

Target:
protected void updateCustomPropertySheet() { if (getModel().getCompatibilityVersion() != null) { updateCustomPropertySheet(getModel().getCompatibilityVersion()); } }
Source:
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort, String consoleProxyUrlDomain) { this.sslEnabled = sslEnabled; if (sslEnabled) { StringBuffer sb = new StringBuffer(); if (consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress); for (int i = 0; i < proxyIpAddress.length(); i++) if (sb.charAt(i) == '.') sb.setCharAt(i, '-'); sb.append(consoleProxyUrlDomain.substring(1)); } else { sb.append(consoleProxyUrlDomain); } proxyAddress = sb.toString(); proxyPort = port; this.proxyUrlPort = proxyUrlPort; proxyImageUrl = "https://" + proxyAddress; if (proxyUrlPort != 443) proxyImageUrl += ":" + this.proxyUrlPort; } else { proxyAddress = proxyIpAddress; if (!Strings.isNullOrEmpty(consoleProxyUrlDomain)) { proxyAddress = consoleProxyUrlDomain; } proxyPort = port; this.proxyUrlPort = proxyUrlPort; proxyImageUrl = "http://" + proxyAddress; if (proxyUrlPort != 80) proxyImageUrl += ":" + proxyUrlPort; } }

Target:
public ConsoleProxyInfo(boolean sslEnabled, String proxyIpAddress, int port, int proxyUrlPort, String consoleProxyUrlDomain) { this.sslEnabled = sslEnabled; if (sslEnabled) { StringBuffer sb = new StringBuffer(); if (consoleProxyUrlDomain.startsWith("*")) { sb.append(proxyIpAddress); for (int i = 0; i < proxyIpAddress.length(); i++) if (sb.charAt(i) == '.') sb.setCharAt(i, '-'); sb.append(consoleProxyUrlDomain.substring(1)); } else { sb.append(consoleProxyUrlDomain); } proxyAddress = sb.toString(); proxyPort = port; this.proxyUrlPort = proxyUrlPort; proxyImageUrl = "https://" + proxyAddress; if (proxyUrlPort != 443) proxyImageUrl += ":" + this.proxyUrlPort; } else { proxyAddress = proxyIpAddress; if (StringUtils.isNotBlank(consoleProxyUrlDomain)) { proxyAddress = consoleProxyUrlDomain; } proxyPort = port; this.proxyUrlPort = proxyUrlPort; proxyImageUrl = "http://" + proxyAddress; if (proxyUrlPort != 80) proxyImageUrl += ":" + proxyUrlPort; } }
Source:
public void getConceptNameTagByName_shouldReturnTheMatchingConceptNameTagObjectIfFound() { ConceptNameTag c = new ConceptNameTag(); c.setTag("tag"); c.setDescription("some description"); assertNull(c.getId()); ConceptNameTag savedC = conceptService.saveConceptNameTag(c); assertNotNull(savedC.getId()); assertEquals(savedC.getDescription(), conceptService.getConceptNameTagByName("tag").getDescription()); }

Target:
public void getConceptNameTagByName_shouldReturnTheMatchingConceptNameTagObjectIfFound() { ConceptNameTag conceptNameTag = conceptService.getConceptNameTag(1); assertNotNull(conceptNameTag); assertEquals(conceptNameTag, conceptService.getConceptNameTagByName(conceptNameTag.getTag())); }