auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testLoadFileTextFromJar() { File jarFile = new File("src/test/resources/evaluation-12.1.1.jar"); <START> assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile,"META-INF","kie-deployment-descriptor.xml")); <END> assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile,"META-INF","kmodule.xml")); }</code><technical_language>@bxf12315 check expected String instead of notnull</technical_language>

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:
<code>public boolean removeRoute(@NonNull RouteInfo route) { return Objects.equals(mIfaceName, route.getInterface()) && <START> mRoutes.remove(route); <END> }</code><technical_language>This need check destination instead of checking for equality. removeLinkAddress for example</technical_language>

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:
<code>private static List<String> getAnnotatedMethodsFromJar( <START> Path jarFile, Collection<String> annotations) throws IOException { <END> 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; }</code><technical_language>throws IOException accurate. code catches IOException, code catches RandoopUsageError | FailedPredicateException</technical_language>

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:
<code>public IntegrationTestingConfig get() { <START> loadProperties(); <END> 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; } }; }</code><technical_language>this required again</technical_language>

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:
<code><START> public static Optional<String> parameterNonNullGlobalAnnotation(Symbol.MethodSymbol method) { <END> 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(); }</code><technical_language>I understand usage of this method get out of Optional: this method return null</technical_language>

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:
<code><START> public final String toStringWithId() { <END> return String.format("[%s][%s]", getId(), getName()); }</code><technical_language>other methods this put name first, id. switch for consistency</technical_language>

Target:
public final String toStringWithId() { return String.format("[%s][%s]", getName(), getId()); }
Source:
<code>public MessageUnpacker(MessageBufferInput in) { <START> this.in = in; <END> }</code><technical_language>add null check</technical_language>

Target:
public MessageUnpacker(MessageBufferInput in) { this.in = checkNotNull(in, "MessageBufferInput"); }
Source:
<code><START> public GatewayResponse capture(CaptureGatewayRequest request) { <END> return smartpayCaptureHandler.capture(request); }</code><technical_language>Adding a generic type <BaseCaptureResponse> remove potential compile warnings</technical_language>

Target:
public GatewayResponse<BaseCaptureResponse> capture(CaptureGatewayRequest request) { return smartpayCaptureHandler.capture(request); }
Source:
<code>private void dispose(boolean deleting) { try { <START> RandomAccessFile randomAccessFile = fRandomAccessFile; <END> 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); } }</code><technical_language>here, initialize() tryRestore() called construction, change it. good practice sure</technical_language>

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:
<code>public void validate() { savedId.clear(); if (ApsAdminSystemConstants.EDIT == this.getStrutsAction()) { fetchFileDescriptions(); <START> if (null == getFileDescriptions()) { <END> 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")); } } } }</code><technical_language>Log errors</technical_language>

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:
<code>private List<String> getNamesOfDerivedVmsFromTemplate(DiskImage diskImage) { List<String> result = new ArrayList<String>(); for (VM vm : getDbFacade().getVmDao().getAllWithTemplate(getVmTemplateId())) { <START> for (Disk vmDisk : getDbFacade().getDiskDao().getAllForVm(vm.getId())) { <END> 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; }</code><technical_language>getDiskDao(), getVmDao(), etc</technical_language>

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:
<code>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); <START> File location; <END> 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); } }</code><technical_language>Refactor a separate smaller method return result check</technical_language>

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:
<code>@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) { <START> getCallback(callback, callbackRef).onError(); <END> } }</code><technical_language>Cache call above</technical_language>

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:
<code>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; <START> ; <END> } } 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); }</code><technical_language>extra semicolon</technical_language>

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:
<code>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 -> { <START> throw new APIAuthenticationException("Role.you.must.have.privileges: " <END> + missing.stream().map(Privilege::getPrivilege).collect(Collectors.joining(", "))); }); }</code><technical_language>This APIException, + a , other part wrapped in new Object[] { } this properly localised</technical_language>

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:
<code>private String process(String textToParse) { try { List<String> matchStrings = new ArrayList<String>(); <START> extractWithJSonPath(textToParse, jsonPathExpressionField.getText(), matchStrings); <END> 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(); } }</code><technical_language>do pass in a list instead of creating of extractWithJsonPath returning it</technical_language>

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:
<code>public void verifyDepictions() { List<DepictedItem> selectedDepictions = repository.getSelectedDepictions(); <START> Log.e("depictsline118", selectedDepictions.size()+""); <END> if (selectedDepictions != null && !selectedDepictions.isEmpty()) { repository.setSelectedDepictions(repository.getDepictionsEntityIdList()); view.goToNextScreen(); } else { view.noDepictionSelected(); } }</code><technical_language>debug</technical_language>

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

Target:
public String call() throws IOException { InputStream urlStream = url.openStream(); String result = Util.readAsUTF8(urlStream); urlStream.close(); return result; }
Source:
<code>public void removeModule(Module module) { ChannelRegistry registry = findRegistry(module); <START> if (registry != null) { <END> registry.deleteInbound(module.getProperties().getProperty("xd.stream.name")); } }</code><technical_language>again: module.getDeploymentMetadata().getGroup() instead of property access</technical_language>

Target:
public void removeModule(Module module) { ChannelRegistry registry = findRegistry(module); if (registry != null) { registry.deleteInbound(module.getDeploymentMetadata().getGroup()); } }
Source:
<code>@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) { <START> recordEvent(EventType.EVT_CLUSTER_ACTIVATION_FAILED); <END> throw U.convertException(e); } finally { unguard(); } }</code><technical_language>need this one. I find other unhandled failure events</technical_language>

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:
<code><START> protected void removeDiskFromDbCallBack(final CinderDisk cinderVolume) { <END> 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; } }); }</code><technical_language>is used</technical_language>

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:
<code>public void onUpdated(Item item) { if (item instanceof SCMSourceOwner) { try { ((SCMSourceOwner) item).getSCMSources(); } catch (NullPointerException e) { check = false; <START> throw e; <END> } } }</code><technical_language>ant: a good test style, this sense bug is fixed, catch unrelated problems. set check false initially, set true calling getSCMSources (with catch block)</technical_language>

Target:
public void onUpdated(Item item) { if (item instanceof SCMSourceOwner) { try { ((SCMSourceOwner) item).getSCMSources(); } catch (NullPointerException e) { check = new Exception(e); } } }
Source:
<code>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); <START> if (key != null) { <END> PartitionedDataset<E> partition = ((PartitionedDataset<E>) dataset).getPartition(key, false); LOG.debug("Partition: {}", partition); return getDelegateInputFormat(partition); } throw new DatasetException("Cannot find partition " + partitionDir); }</code><technical_language>check dataset is a PartitionedDataset casting</technical_language>

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:
<code>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()); <START> nextImage = (MapillaryImage) nextImage.next(); <END> } if (prevImage != null && prevImage.previous() != null) { CacheUtils.downloadPicture((MapillaryImage) prevImage.previous()); prevImage = (MapillaryImage) prevImage.previous(); } } }); }</code><technical_language>great, if get rid of unchecked casts here. nextImage prevImage of type MapillaryAbstractImage surround calls CacheUtils.downloadPicture if (nextImage instanceof MapillaryImage) unchecked cats gone</technical_language>

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:
<code>public void emitTuples() { if (!windowDone) { try { preparedStatement.setLong(1, offset); preparedStatement.setLong(2, batchSize); ResultSet resultSet = preparedStatement.executeQuery(); <START> if (resultSet.next()) { <END> 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); } } }</code><technical_language>I mistaken this. right</technical_language>

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:
<code>void onSave() { if (!validate()) { return; } <START> if (getProgress() != null) { <END> 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); }</code><technical_language>Is this happen</technical_language>

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:
<code>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 <START> long1 : <END> 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; }</code><technical_language>rename location</technical_language>

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:
<code>public static void onFogRender(EntityViewRenderEvent.FogDensity event) { <START> if (event.getInfo().getFluidState().getFluid() == MSFluids.ENDER.get() || event.getInfo().getFluidState().getFluid() == MSFluids.FLOWING_ENDER.get()) <END> { event.setCanceled(true); event.setDensity(Float.MAX_VALUE); GlStateManager.fogMode(GlStateManager.FogMode.EXP); } }</code><technical_language>If time, suggest ender fluid tag checking fluid types</technical_language>

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:
<code>public double getSetupTime(Config conf) { <START> String fpu_name = (String) conf.getItemValue(FPU_KEY); <END> 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; } }</code><technical_language>surprised this is a String. "shocked surprised" days. a GmosSouthType.FPUnitSouth GmosNorthType.GPUnitNorth? is ask is IFU, etc. I expect this method implemented like: java import java.util.Optional; ... 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); }</technical_language>

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:
<code>public DataTransactionResult offerToStore(ValueContainer<?> container, Boolean value) { <START> final ImmutableValue<Boolean> newValue = new ImmutableSpongeValue<Boolean>(Keys.IS_SNEAKING, false, value); <END> 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); }</code><technical_language>caching util</technical_language>

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:
<code>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(); } <START> } <END> }); } }</code><technical_language>this run a thread some okHttpClient provided stack</technical_language>

Target:
public void cancelCall() { if (call != null) { okHttpClient.getDispatcher().getExecutorService().execute(new Runnable() { @Override public void run() { call.cancel(); } }); } }
Source:
<code>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); <START> final byte[] data = RandomUtils.nextBytes(100); <END> attachment.write( new ByteArrayInputStream(data), Attachment.MARKDOWN, Long.toString(System.currentTimeMillis()) ); MatcherAssert.assertThat( IOUtils.toByteArray(attachment.read()), Matchers.equalTo(data) ); attachments.delete(name); }</code><technical_language>@dmzaytsev this introduces a non-deterministic component test. I fixed binary array instead of RandomUtils</technical_language>

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:
<code>public void addAttribute(String key, Object value) { this.properties.put(key, value); if (key.equals(NAME)) { this.name = (String) value; } if (key.equals(FREQ)) { <START> isScaled = ((Long)getProperty(FREQ)).equals(1000000000); <END> clockScale = 1000000000.0/((Long)getProperty(FREQ)).doubleValue(); clockAntiScale = 1.0 / clockScale; } if (key.equals(OFFSET)) { clockOffset = (Long)getProperty(OFFSET); } }</code><technical_language>I .equals handle anyway, safe put a L end of literal</technical_language>

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:
<code>private boolean isAlumni(Student student) { return student .getRegistrationsSet() .stream() .anyMatch(registration -> ProgramConclusion .conclusionsFor(registration) .filter(ProgramConclusion::isAlumniProvider) .anyMatch(conclusion -> conclusion.groupFor(registration).isPresent() <START> && conclusion.groupFor(registration).get().isConclusionProcessed())); <END> }</code><technical_language>Optional.map instead of this isPresent() & get()</technical_language>

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:
<code>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()); <START> requireFBO(new FBOConfig("sceneReflectiveRefractive", 1.0f, FBO.Type.HDR).useNormalBuffer()); <END> }</code><technical_language>This is nice</technical_language>

Target:
public void initialise() { prePostComposite = worldRenderer.getMaterial("engine:prog.combine"); requiresFBO(new FBOConfig(REFLECTIVE_REFRACTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); }
Source:
<code>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; <START> getCurrentSubscriptionState(appContext).setPushDisabled(!disable); <END> OneSignalStateSynchronizer.setSubscription(disable); }</code><technical_language>Remove ! flipping logic here. changes in OSSubscriptionState.java account for this</technical_language>

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:
<code>public String getItemString(ITmfEvent event) { if (event instanceof CustomEvent) { <START> String ret = ((CustomEvent) event).getEventString(fId); <END> return (ret == null ? EMPTY_STRING : ret); } return EMPTY_STRING; }</code><technical_language>more index custom event column data array, id</technical_language>

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:
<code>private void enqueueOperation(final RangeKeyOperation operation, final Map<Integer, List<Pair<K, K>>> blockToKeyRangesMap) { final int numSubOps = blockToKeyRangesMap.size(); operation.setNumSubOps(numSubOps); <START> for (final Map.Entry<Integer, List<Pair<K, K>>> blockToSubKeyRanges : blockToKeyRangesMap.entrySet()) { <END> 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}); } }</code><technical_language>Similar RemoteOpHandlerImpl rangekey side, this for loop simplified forEach statement</technical_language>

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:
<code>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, <START> e.getLocalizedMessage()); <END> throw new RuntimeException(e.getLocalizedMessage(), e); } }</code><technical_language>need localized message here</technical_language>

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:
<code>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) <START> && ((msgLen % 4) + 4) != (binMessage.length - HEADER_LENGTH)) <END> { 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; }</code><technical_language>I tired ICE TURN, assume binMessage.length - HEADER_LENGTH legally greater [4,7]</technical_language>

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

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:
<code>protected void updateCustomPropertySheet() { <START> updateCustomPropertySheet(getModel().getEffectiveCompatibilityVersion()); <END> }</code><technical_language>this return null - please add a null check</technical_language>

Target:
protected void updateCustomPropertySheet() { if (getModel().getCompatibilityVersion() != null) { updateCustomPropertySheet(getModel().getCompatibilityVersion()); } }
Source:
<code>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; <START> if (!Strings.isNullOrEmpty(consoleProxyUrlDomain)) { <END> proxyAddress = consoleProxyUrlDomain; } proxyPort = port; this.proxyUrlPort = proxyUrlPort; proxyImageUrl = "http://" + proxyAddress; if (proxyUrlPort != 80) proxyImageUrl += ":" + proxyUrlPort; } }</code><technical_language>org.apache.commons.lang3.StringUtils.isNotBlank(CharSequence), do need !. catches "blanks" values, I if here</technical_language>

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; } }