auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static GeometryCollection unifyWindingOrderForGeometryCollection( GeometryCollection geoCollection, boolean counterClockWise) { int noOfGeoms = geoCollection.getNumGeometries(); Geometry[] revGeoms = new Geometry[noOfGeoms]; for (int i = 0; i < noOfGeoms; i++) { Geometry geometry = geoCollection.getGeometryN(i); if (geometry instanceof MultiPolygon) { revGeoms[i] = unifyWindingOrderForMultiPolygon((MultiPolygon) geometry, counterClockWise); } else if (geometry instanceof Polygon) { revGeoms[i] = unifyWindingOrderForPolyGon((Polygon) geometry, counterClockWise); } else if (geometry instanceof LinearRing) { revGeoms[i] = unifyWindingOrderForLinearRing((LinearRing) geometry, counterClockWise); } else if (geometry instanceof GeometryCollection) { revGeoms[i] = unifyWindingOrderForGeometryCollection((GeometryCollection) geometry, counterClockWise); } else revGeoms[i] = geometry; } return factory.createGeometryCollection(revGeoms); }

Target:
public static GeometryCollection unifyWindingOrderForGeometryCollection( GeometryCollection geoCollection, boolean counterClockWise) { int noOfGeoms = geoCollection.getNumGeometries(); Geometry[] revGeoms = new Geometry[noOfGeoms]; for (int i = 0; i < noOfGeoms; i++) { revGeoms[i] = unifyWindingOrder(geoCollection.getGeometryN(i), counterClockWise); } return factory.createGeometryCollection(revGeoms); }
Source:
public void enableOtherFeedbackPathOptionsForNewQuestion() { WebElement questionTable = browser.driver.findElement(By.id("questionTableNew")); WebElement dropdownButton = questionTable.findElement(By.cssSelector(".feedback-path-dropdown > button")); WebElement otherOption = questionTable.findElement( By.className("feedback-path-dropdown-option-other")); dropdownButton.click(); otherOption.click(); }

Target:
public void enableOtherFeedbackPathOptionsForNewQuestion() { WebElement questionTable = browser.driver.findElement(By.id("questionTable--1")); WebElement dropdownButton = questionTable.findElement(By.cssSelector(".feedback-path-dropdown > button")); WebElement otherOption = questionTable.findElement( By.className("feedback-path-dropdown-option-other")); click(dropdownButton); click(otherOption); }
Source:
public boolean hasNext() { if (episodes.hasNext()) { return true; } return false; }

Target:
public boolean hasNext() { return episodes.hasNext(); }
Source:
public JSONObject getPayLoadJSON() { JSONObject payloadJSON = null; HttpServletRequest req = this.getRequest(); try (InputStream in = req.getInputStream()) { final byte[] json = IOHelper.readBytes(in); final String jsonString = new String(json, StandardCharsets.UTF_8); return new JSONObject(jsonString); } catch (Exception ignored) return payloadJSON; }

Target:
public JSONObject getPayLoadJSON() throws ActionParamsException { HttpServletRequest req = this.getRequest(); try (InputStream in = req.getInputStream()) { final byte[] json = IOHelper.readBytes(in); final String jsonString = new String(json, StandardCharsets.UTF_8); return new JSONObject(jsonString); } catch (Exception exception) { throw new ActionParamsException("Cannot get payload JSON"); } }
Source:
private String generateClusterId() { final String randomUUID = UUID.randomUUID().toString().replaceAll("-", ""); return (CLUSTER_ID_PREFIX + randomUUID).substring(0, Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID); }

Target:
private String generateClusterId() { final String randomID = new AbstractID().toString(); return (CLUSTER_ID_PREFIX + randomID).substring(0, Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID); }
Source:
public void writeUrls(URI baseUri) { setUrl(WritableUrls.buildUriPath(baseUri, "/rest/tree/sample/{id}", getId())); setUpdatedByUrl(WritableUrls.buildUriPath(baseUri, "/rest/user/{id}", getUpdatedById())); if (getRootSampleClassId() != null) { setRootSampleClassUrl(WritableUrls.buildUriPath(baseUri, "/rest/sampleclass/{id}", getRootSampleClassId())); } setUrl(WritableUrls.buildUriPath(baseUri, "/rest/sample/{id}", getId())); }

Target:
public void writeUrls(URI baseUri) { setUrl(WritableUrls.buildUriPath(baseUri, "/rest/tree/sample/{id}", getId())); setUpdatedByUrl(WritableUrls.buildUriPath(baseUri, "/rest/user/{id}", getUpdatedById())); if (getRootSampleClassId() != null) { setRootSampleClassUrl(WritableUrls.buildUriPath(baseUri, "/rest/sampleclass/{id}", getRootSampleClassId())); } }
Source:
public void setParams(MatrixLib mean, MatrixLib covariance) { if (mean != null) { if (!(mean.numCols() == 1 && mean.numRows() > 0)) { throw new IllegalArgumentException( "The mean given is not a valid column vector. It has dimensions " + mean.numRows() + " by " + mean.numCols() + "."); } this.mean = mean; this.hasMean = true; this.legalAssignment = false; } if (covariance != null) { if (!(covariance.numCols() > 0 && covariance.isSymmetric())) { throw new IllegalArgumentException( "The covariance matrix given is not symmetric"); } this.covariance = covariance; this.hasCovariance = true; this.legalAssignment = false; } if (!this.legalAssignment && this.hasMean && this.hasCovariance) { if (this.covariance.numCols() != this.mean.numCols()) { throw new IllegalArgumentException( "Dimensions of the mean vector and the covariance matrix do not match: " + "The covariance matrix is " + covariance.numCols() + " by " + covariance.numRows() + " while the mean vector is " + mean.numRows() + " by " + mean.numCols() + "."); } initializeConstants(); this.legalAssignment = true; } }

Target:
public void setParams(MatrixLib mean, MatrixLib covariance) { if (mean != null) { if (!(mean.numCols() > 0 && mean.numRows() == 1)) { throw new IllegalArgumentException( "The mean given is not a valid row vector. It has dimensions " + mean.numRows() + " by " + mean.numCols() + "."); } this.mean = mean; this.hasMean = true; } if (covariance != null) { if (!(covariance.numCols() > 0 && covariance.isSymmetric())) { throw new IllegalArgumentException( "The covariance matrix given is not symmetric"); } this.covariance = covariance; this.hasCovariance = true; } if (this.hasMean && this.hasCovariance) { if (this.covariance.numRows() != this.mean.numCols()) { throw new IllegalArgumentException( "Dimensions of the mean vector and the covariance matrix do not match: " + "The covariance matrix is " + covariance.numCols() + " by " + covariance.numRows() + " while the mean vector is " + mean.numRows() + " by " + mean.numCols() + "."); } initializeConstants(); } }
Source:
private void checkForDRBufferLimit() { tmLog.debug("drBufferChanged: " + m_drBufferChangedAgg + " limit:" + MAX_DR_BUFFER_SIZE); if (m_drBufferChangedAgg >= MAX_DR_BUFFER_SIZE) { tmLog.debug("rollback for dr limit"); setNeedsRollback(true); throw new SQLException(volt_output_buffer_overflow, "Aggregate MP Transaction requiring " + m_drBufferChangedAgg + " bytes exceeds max DR Buffer size of " + MAX_DR_BUFFER_SIZE + " bytes."); } }

Target:
private void checkForDRBufferLimit() { if (!m_drProducerActive) { return; } if (tmLog.isTraceEnabled()) { tmLog.trace("Total DR buffer allocate for this txn: " + m_drBufferChangedAgg + " limit:" + DR_MAX_AGGREGATE_BUFFERSIZE); } if (getDRMessageSizeEstimation() >= DR_MAX_AGGREGATE_BUFFERSIZE) { if (tmLog.isDebugEnabled()) { tmLog.debug("Transaction txnid: " + TxnEgo.txnIdToString(txnId) + " exceeding DR Buffer Limit, need rollback."); } setNeedsRollback(true); throw new SQLException(volt_output_buffer_overflow, "Aggregate MP Transaction requiring " + m_drBufferChangedAgg + " bytes exceeds max DR Buffer size of " + DR_MAX_AGGREGATE_BUFFERSIZE + " bytes."); } }
Source:
public boolean supports(final Element<? extends Definition> element) { return element.getContent().getDefinition() instanceof DMNDiagram; }

Target:
public boolean supports(final Element<? extends Definition> element) { return DefinitionUtils.getElementDefinition(element) instanceof DMNDiagram; }
Source:
public void createSchema(SimpleFeatureType featureType) throws IOException { List<String> header = new ArrayList<String>(); GeometryDescriptor geometryDescrptor = featureType.getGeometryDescriptor(); if (geometryDescrptor != null && CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, geometryDescrptor.getCoordinateReferenceSystem()) && geometryDescrptor.getType().getBinding().isAssignableFrom(Point.class)) { header.add("LAT"); header.add("LON"); } else { throw new IOException("Unable use LAT/LON to represent " + geometryDescrptor); } for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) { if (descriptor instanceof GeometryDescriptor) continue; header.add(descriptor.getLocalName()); } CsvWriter writer = new CsvWriter(new FileWriter(this.csvFileState.getFile()),','); try { writer.writeRecord( header.toArray(new String[header.size()])); } finally { writer.close(); } }

Target:
public void createSchema(SimpleFeatureType featureType) throws IOException { List<String> header = new ArrayList<String>(); GeometryDescriptor geometryDescrptor = featureType.getGeometryDescriptor(); if (geometryDescrptor != null && CRS.equalsIgnoreMetadata(DefaultGeographicCRS.WGS84, geometryDescrptor.getCoordinateReferenceSystem()) && geometryDescrptor.getType().getBinding().isAssignableFrom(Point.class)) { header.add(this.latField); header.add(this.lngField); } else { throw new IOException("Unable use LAT/LON to represent " + geometryDescrptor); } for (AttributeDescriptor descriptor : featureType.getAttributeDescriptors()) { if (descriptor instanceof GeometryDescriptor) continue; header.add(descriptor.getLocalName()); } CsvWriter writer = new CsvWriter(new FileWriter(this.csvFileState.getFile()),','); try { writer.writeRecord( header.toArray(new String[header.size()])); } finally { writer.close(); } }
Source:
public BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownload urlDownload) { StringBuilder messageError = new StringBuilder(); BackgroundTask<Path> downloadTask = BackgroundTask .wrap(() -> { Optional<ExternalFileType> suggestedType = inferFileType(urlDownload); ExternalFileType externalFileType = suggestedType.orElse(StandardExternalFileType.PDF); String suggestedTypeName = externalFileType.getName(); linkedFile.setFileType(suggestedTypeName); String suggestedName = linkedFileHandler.getSuggestedFileName(externalFileType.getExtension()); String fulltextDir = FileUtil.createDirNameFromPattern(databaseContext.getDatabase(), entry, filePreferences.getFileDirectoryPattern()); String finalName = FileNameUniqueness.getNonOverWritingFileName(targetDirectory.resolve(fulltextDir), suggestedName); if (!suggestedName.equals(finalName)) { messageError.append("File: \""); messageError.append(suggestedName); messageError.append("\" already exists"); return null; } return targetDirectory.resolve(fulltextDir).resolve(finalName); }) .then(destination -> new FileDownloadTask(urlDownload.getSource(), destination)) .onFailure(exception -> handleDownloadError(messageError, exception)); return downloadTask; }

Target:
public BackgroundTask<Path> prepareDownloadTask(Path targetDirectory, URLDownload urlDownload) { StringBuilder messageError = new StringBuilder(); BackgroundTask<Path> downloadTask = BackgroundTask .wrap(() -> { Optional<ExternalFileType> suggestedType = inferFileType(urlDownload); ExternalFileType externalFileType = suggestedType.orElse(StandardExternalFileType.PDF); String suggestedTypeName = externalFileType.getName(); linkedFile.setFileType(suggestedTypeName); String suggestedName = linkedFileHandler.getSuggestedFileName(externalFileType.getExtension()); String fulltextDir = FileUtil.createDirNameFromPattern(databaseContext.getDatabase(), entry, filePreferences.getFileDirectoryPattern()); String finalName = FileNameUniqueness.getNonOverWritingFileName(targetDirectory.resolve(fulltextDir), suggestedName); if (!suggestedName.equals(finalName)) { messageError.append(Localization.lang("File")); messageError.append(": \""); messageError.append(suggestedName); messageError.append("\""); messageError.append(Localization.lang(" already exists")); return null; } return targetDirectory.resolve(fulltextDir).resolve(finalName); }) .then(destination -> new FileDownloadTask(urlDownload.getSource(), destination)) .onFailure(exception -> handleDownloadError(messageError, exception)); return downloadTask; }
Source:
public <P extends ProviderProxy<?>> P create(Provider<?> provider) { switch (provider.getType()) { case EXTERNAL_NETWORK: if (provider.getIsUnmanaged()) { return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: if (provider.getIsUnmanaged()) { return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }

Target:
public <P extends ProviderProxy<?>> P create(Provider<?> provider) { switch (provider.getType()) { case EXTERNAL_NETWORK: if (provider.getIsUnmanaged()) { return (P) new UnmanagedNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); } return (P) new ExternalNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case FOREMAN: return (P) new ForemanHostProviderProxy(provider); case OPENSTACK_NETWORK: return (P) new OpenstackNetworkProviderProxy((Provider<OpenstackNetworkProviderProperties>) provider); case OPENSTACK_IMAGE: return (P) new OpenStackImageProviderProxy((Provider<OpenStackImageProviderProperties>) provider); case OPENSTACK_VOLUME: return (P) new OpenStackVolumeProviderProxy((Provider<OpenStackVolumeProviderProperties>) provider); case VMWARE: return (P) Injector.injectMembers(new VmwareVmProviderProxy((Provider<VmwareVmProviderProperties>) provider)); case KVM: return (P) Injector.injectMembers(new KVMVmProviderProxy((Provider<KVMVmProviderProperties>) provider)); case XEN: return (P) Injector.injectMembers(new XENVmProviderProxy((Provider<XENVmProviderProperties>) provider)); default: return null; } }
Source:
private void assertFailureCatalogContains(Class<?> beanClass, String failureStringToCheck) { Assert.assertFalse("Failure on checking bean " + beanClass.getName() + " should happen", FailureCatalog.INSTANCE.isEmpty()); Assert.assertThat(FailureCatalog.INSTANCE.formatCatalogContent().split(String.format("%n")), HamcrestRegexpMatcher.matches(failureStringToCheck)); }

Target:
private void assertFailureCatalogContains(Class<?> beanClass, String failureStringToCheck) { Assert.assertFalse("Failure on checking bean " + beanClass.getName() + " should happen", FailureCatalog.INSTANCE.isEmpty()); Assert.assertThat(FailureCatalog.INSTANCE.formatCatalogContent().split(System.lineSeparator()), HamcrestRegexpMatcher.matches(failureStringToCheck)); }
Source:
private void logProjectCreatedEvent(@Nonnull String projectName, @Nonnull String projectType) { String paas = projectType.startsWith("GAE") ? "GAE" : "default"; LOG.info("EVENT#project-created# PROJECT#{}# TYPE#{}# WS#{}# USER#{}# PAAS#{}#", projectName, projectType, EnvironmentContext.getCurrent().getWorkspaceName(), EnvironmentContext.getCurrent().getUser().getName(), paas); }

Target:
private void logProjectCreatedEvent(@Nonnull String projectName, @Nonnull String projectType) { LOG.info("EVENT#project-created# PROJECT#{}# TYPE#{}# WS#{}# USER#{}# PAAS#default#", projectName, projectType, EnvironmentContext.getCurrent().getWorkspaceId(), EnvironmentContext.getCurrent().getUser().getId()); }
Source:
public long getTailSegment() { if (tailSegment.get() == Address.NON_ADDRESS) { long dbTailSegment = Optional.ofNullable(dataStore.get(TAIL_SEGMENT_RECORD)).orElse(0L); tailSegment.set(dbTailSegment); } return tailSegment.get(); }

Target:
public long getTailSegment() { if (tailSegment.get() == Address.NON_ADDRESS) { tailSegment.set(dataStore.get(TAIL_SEGMENT_RECORD, ZERO_ADDRESS)); } return tailSegment.get(); }
Source:
public void visitScript(ScriptTree tree) { storageTypes = new HashedMap(); super.visitScript(tree); checkForIssues(); }

Target:
public void visitScript(ScriptTree tree) { storageTypes.clear(); super.visitScript(tree); checkForIssues(); }
Source:
public void updateVisibility() { messageLabel.setVisible(false); if (!ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) { externalProviderEditor.setVisible(false); neutronPhysicalNetwork.setVisible(false); createSubnetEditor.setVisible(false); vlanTagging.setVisible(false); vlanTag.setVisible(false); exportLabel.setVisible(false); exportEditor.setVisible(false); profilesTab.setVisible(false); } }

Target:
public void updateVisibility() { messageLabel.setVisible(false); exportLabel.setVisible(ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)); }
Source:
protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); final List<String> selectedRepoDirectories = getDirectoriesOfSelectedRepositoryNodes( selection); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups util = new RepositoryGroups(); addStaticItems(util, selectedRepoDirectories, result); List<RepositoryGroup> groups = util.getGroups(); Collections.sort(groups); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(util, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }

Target:
protected IContributionItem[] getContributionItems() { List<IContributionItem> result = new ArrayList<>(); ISelection selection = serviceLocator .getService(ISelectionService.class).getSelection(); final List<File> selectedRepoDirectories = getDirectoriesOfSelectedRepositoryNodes( selection); if (!selectedRepoDirectories.isEmpty()) { final RepositoryGroups groupsUtil = RepositoryGroups.getInstance(); addStaticItems(groupsUtil, selectedRepoDirectories, result); List<RepositoryGroup> groups = groupsUtil.getGroups(); Collections.sort(groups, (g1, g2) -> CommonUtils.STRING_ASCENDING_COMPARATOR .compare(g1.getName(), g2.getName())); if (!groups.isEmpty()) { result.add(new Separator()); for (RepositoryGroup group : groups) { result.add(getAssignGroupItem(groupsUtil, group, selectedRepoDirectories)); } } } return result.toArray(new IContributionItem[0]); }
Source:
public String getPathForHadoop() { String hadoopPath = StringUtils.format( "%s://%s@%s.%s/%s", AzureUtils.AZURE_STORAGE_HADOOP_PROTOCOL, segmentConfig.getContainer(), accountConfig.getAccount(), AzureUtils.AZURE_STORAGE_HOST_ADDRESS, segmentConfig.getPrefix().isEmpty() ? "" : segmentConfig.getPrefix() + '/' ); log.info("Using Azure blob storage Hadoop path: %s", hadoopPath); return hadoopPath; }

Target:
public String getPathForHadoop() { String prefix = segmentConfig.getPrefix(); boolean prefixIsNullOrEmpty = org.apache.commons.lang.StringUtils.isEmpty(prefix); String hadoopPath = StringUtils.format( "%s://%s@%s.%s/%s", AzureUtils.AZURE_STORAGE_HADOOP_PROTOCOL, segmentConfig.getContainer(), accountConfig.getAccount(), AzureUtils.AZURE_STORAGE_HOST_ADDRESS, prefixIsNullOrEmpty ? "" : StringUtils.maybeRemoveTrailingSlash(prefix) + '/' ); log.info("Using Azure blob storage Hadoop path: %s", hadoopPath); return hadoopPath; }
Source:
public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); LocalExchange inMemoryExchange = localExchangeFactory.getLocalExchange(driverContext.getLifespan()); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, LocalExchangeSourceOperator.class.getSimpleName()); PageWithPositionComparator comparator = comparatorFactory.create(types, sortChannels, orderings); List<LocalExchangeSource> sources = IntStream.range(0, inMemoryExchange.getBufferCount()) .boxed() .map(index -> inMemoryExchange.getNextSource()) .collect(toImmutableList()); return new LocalMergeSourceOperator(operatorContext, sources, types, comparator); }

Target:
public Operator createOperator(DriverContext driverContext) { checkState(!closed, "Factory is already closed"); LocalExchange localExchange = localExchangeFactory.getLocalExchange(driverContext.getLifespan()); OperatorContext operatorContext = driverContext.addOperatorContext(operatorId, planNodeId, LocalMergeSourceOperator.class.getSimpleName()); PageWithPositionComparator comparator = orderingCompiler.compilePageWithPositionComparator(types, sortChannels, orderings); List<LocalExchangeSource> sources = IntStream.range(0, localExchange.getBufferCount()) .boxed() .map(index -> localExchange.getNextSource()) .collect(toImmutableList()); return new LocalMergeSourceOperator(operatorContext, sources, types, comparator); }
Source:
public Response localEntryGet(String apiName, String label, String apiId, MessageContext messageContext){ InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); JSONArray localEntryArray = new JSONArray(); if (gatewayAPIDTO != null) { if (gatewayAPIDTO.getLocalEntriesToBeAdd() != null) { LocalEntryServiceProxy localEntryServiceProxy = new LocalEntryServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO localEntry : gatewayAPIDTO.getLocalEntriesToBeAdd()) { try { if (localEntryServiceProxy.isEntryExists(localEntry.getName())) { localEntryArray.put(localEntryServiceProxy.getEntry(localEntry.getName())); } else { log.error(localEntry.getName() + " was not deployed in the gateway"); } } catch (AxisFault axisFault) { log.error("Error in fetching deployed Local entries from Synapse Configuration." , axisFault); } } } responseObj.put("LocalEntry", localEntryArray); String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }

Target:
public Response localEntryGet(String apiName, String label, String apiId, MessageContext messageContext){ InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); if (gatewayAPIDTO != null) { try { JSONArray localEntryArray = new JSONArray(); JSONArray UnDeploeydLocalEntryArray = new JSONArray(); if (gatewayAPIDTO.getLocalEntriesToBeAdd() != null) { LocalEntryServiceProxy localEntryServiceProxy = new LocalEntryServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO localEntry : gatewayAPIDTO.getLocalEntriesToBeAdd()) { if (localEntryServiceProxy.isEntryExists(localEntry.getName())) { localEntryArray.put(localEntryServiceProxy.getEntry(localEntry.getName())); } else { log.error(localEntry.getName() + " was not deployed in the gateway"); UnDeploeydLocalEntryArray.put(localEntry.getContent()); } } } responseObj.put("Deployed Local Entries", localEntryArray); responseObj.put("Undeployed Local Entries", UnDeploeydLocalEntryArray); } catch (AxisFault e) { String errorMessage = "Error in fetching deployed artifacts from Synapse Configuration"; log.error(errorMessage, e); RestApiUtil.handleInternalServerError(errorMessage, e, log); } String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }
Source:
public void onClick() { super.onClick(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(mContext.getText(R.string.cdma_call_waiting)); builder.setMessage(mContext.getText(R.string.enable_cdma_call_waiting_setting)); builder.setPositiveButton(R.string.enable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(true, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); } }); builder.setNegativeButton(R.string.disable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(false, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); } }); builder.create().show(); if (mTcpListener != null) { mTcpListener.onStarted(this, false); } }

Target:
public void onClick() { super.onClick(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(mContext.getText(R.string.cdma_call_waiting)); builder.setMessage(mContext.getText(R.string.enable_cdma_call_waiting_setting)); builder.setPositiveButton(R.string.enable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(true, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); if (mTcpListener != null) { mTcpListener.onStarted(CdmaCallWaitingPreference.this, false); } } }); builder.setNegativeButton(R.string.disable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(false, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); if (mTcpListener != null) { mTcpListener.onStarted(CdmaCallWaitingPreference.this, false); } } }); builder.create().show(); }
Source:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: " + content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); return params; } else { params[i] = gson.fromJson(node, types[i]); } } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }

Target:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }
Source:
private boolean validateResultSet(ResultSet rs) throws IOException{ if (rs == null) { return false; } try { ResultSetMetaData rsMetadata = rs.getMetaData(); if (CUD_RESULT_SET_COLUMN_NAMES.contains(rsMetadata.getColumnName(1))) { result.totalCount++; result.successCount++; return false; } return true; } catch (SQLException e) { if(dieOnError) { throw new IOException(e); } } return false; }

Target:
private boolean validateResultSet(ResultSet rs) throws IOException { if (rs == null) { return false; } try { ResultSetMetaData rsMetadata = rs.getMetaData(); if (CUD_RESULT_SET_COLUMN_NAMES.contains(rsMetadata.getColumnName(1))) { result.totalCount++; result.successCount++; return false; } return true; } catch (SQLException e) { if (dieOnError) { throw new IOException(e); } LOGGER.warn(I18N_MESSAGES.getMessage("error.resultSetIssue"), e); } return false; }
Source:
protected String[] parseUri(DynamicAwareEntry entry) { String scheme = entry.getProperties().get("protocol"); String host = entry.getProperties().get("host"); String port = entry.getProperties().get("port"); String path = entry.getProperties().get("path"); String s = scheme + "://" + host; if (port != null) { s += ":" + port; } return new String[]{s, path}; }

Target:
protected String[] parseUri(DynamicAwareEntry entry) { String scheme = entry.getProperties().get("protocol"); String host = entry.getProperties().get("host"); String port = entry.getProperties().get("port"); String path = entry.getProperties().get("path"); String baseUrl = scheme + "://" + host; if (port != null) { baseUrl += ":" + port; } return new String[]{baseUrl, path}; }
Source:
public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfoWrapper activeNetworkInfo = new NetworkInfoWrapper(connectivityManager.getActiveNetworkInfo()); return activeNetworkInfo.isConnectedOrConnecting(); }

Target:
public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo.isConnectedOrConnecting(); }
Source:
public void intercept(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!"common".equals(strategy)) { return; } if (isEphemeral(osEnv.getAttributes())) { return; } String namespace = identity.getInfrastructureNamespace(); PodResource<Pod, DoneablePod> podResource = clientFactory .create(identity.getWorkspaceId()) .pods() .inNamespace(namespace) .withName(ASYNC_STORAGE); if (podResource.get() == null) { return; } try { doDeletePod(identity.getWorkspaceId(), namespace).get(5, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( "Interrupted while waiting for pod removal. " + ex.getMessage()); } catch (ExecutionException ex) { throw new InfrastructureException( "Error occurred while waiting for pod removal. " + ex.getMessage()); } catch (TimeoutException ex) { throw new InfrastructureException("Pod removal timeout reached " + ex.getMessage()); } }

Target:
public void intercept(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!COMMON_STRATEGY.equals(pvcStrategy) || isEphemeral(osEnv.getAttributes())) { return; } String namespace = identity.getInfrastructureNamespace(); String workspaceId = identity.getWorkspaceId(); PodResource<Pod, DoneablePod> asyncStoragePodResource = getAsyncStoragePodResource(namespace, workspaceId); if (asyncStoragePodResource.get() == null) { return; } try { deleteAsyncStoragePod(asyncStoragePodResource) .get(DELETE_POD_TIMEOUT_IN_MIN, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( format( "Interrupted while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (ExecutionException ex) { throw new InfrastructureException( format( "Error occurred while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (TimeoutException ex) { throw new InfrastructureException( format("Pod '%s' removal timeout reached " + ex.getMessage(), ASYNC_STORAGE), ex); } }
Source:
public void getMetadataTest() throws Exception { String fname = datasets[0]; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); DFUFileDetailWrapper meta=file.getOriginalFileMetadata(); assertNotNull("Meta was null for this file",meta); assertNotNull("Record count was null for this file",meta.getRecordCount()); assertEquals(expectedCounts[0],new Long(meta.getRecordCountInt64()).intValue()); file=new HPCCFile("notthere",connString,hpccUser,hpccPass); meta=file.getOriginalFileMetadata(); assertNull("Meta should be null for nonexistent file",meta); }

Target:
public void getMetadataTest() throws Exception { String fname = datasets[0]; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); DFUFileDetailWrapper meta=file.getOriginalFileMetadata(); assertNotNull("Meta was null for this file",meta); assertNotNull("Record count was null for this file",meta.getRecordCount()); assertEquals(expectedCounts[0],new Long(meta.getRecordCountInt64()).intValue()); }
Source:
public void testIsValid() { int hours = -18; while (true) { ZoneOffset offset = ZoneOffset.ofHours( hours ); OffsetDateTime future = OffsetDateTime.now( offset ).plusHours( 1 ); OffsetDateTime past = OffsetDateTime.now( offset ).minusHours( 1 ); assertTrue( constraint.isValid( null, null ) ); assertTrue( constraint.isValid( past, null ) ); assertFalse( constraint.isValid( future, null ) ); hours++; if (hours > 18) { break; } } }

Target:
public void testIsValid() { assertTrue( constraint.isValid( null, null ), "null fails validation." ); for ( int i = -18; i <= 18; i++ ) { ZoneOffset offset = ZoneOffset.ofHours( i ); OffsetDateTime future = OffsetDateTime.now( offset ).plusHours( 1 ); OffsetDateTime past = OffsetDateTime.now( offset ).minusHours( 1 ); assertTrue( constraint.isValid( past, null ), "Past OffsetDateTime '" + past + "' fails validation."); assertFalse( constraint.isValid( future, null ), "Future OffsetDateTime '" + future + "' validated as past."); } }
Source:
public GroupsManagerBlImpl(GroupsManagerImplApi groupsManagerImpl) { this.groupsManagerImpl = groupsManagerImpl; this.groupSynchronizerThreads = new HashMap<>(); this.queueOfGroupsToBeSynchronized = new ConcurrentLinkedDeque<>(); this.maxConcurentGroupsToSynchronize = BeansUtils.getCoreConfig().getGroupMaxConcurentGroupsToSynchronize(); }

Target:
public GroupsManagerBlImpl(GroupsManagerImplApi groupsManagerImpl) { this.groupsManagerImpl = groupsManagerImpl; this.groupSynchronizerThreads = new ArrayList<>(); this.poolOfGroupsToBeSynchronized = new PerunBeanProcessingPool<>(); this.maxConcurentGroupsToSynchronize = BeansUtils.getCoreConfig().getGroupMaxConcurentGroupsToSynchronize(); }
Source:
private void onClassNotFoundException(String className, ClassLoader classLoader, ClassNotFoundException e) { if (className.startsWith("com.hazelcast")) { LOGGER.fine("Failed to load " + className + " by " + classLoader + ". This indicates a classloading issue. It can happen at runtime with " + "a complicated classloading model (OSGi, Java EE, etc)"); } else { throw new HazelcastException(e); } }

Target:
private void onClassNotFoundException(String className, ClassLoader classLoader, ClassNotFoundException e) { if (className.startsWith("com.hazelcast")) { LOGGER.fine("Failed to load " + className + " by " + classLoader + ". This indicates a classloading issue. It can happen in a runtime with " + "a complicated classloading model (OSGi, Java EE, etc)"); } else { throw new HazelcastException(e); } }
Source:
public static Endpoint valueOf(String str) { int lastColon = str.lastIndexOf(':'); String host = str.substring(0, lastColon); String port = str.substring(lastColon+1); if (host.startsWith("[")) { if (!host.contains("]")) { throw new IllegalArgumentException(String.format("Endpoint contains an invalid host '%s'. " + "IPv6 address literals must be enclosed in '[' and ']' according to RFC 2732", str)); } host = host.substring(1, host.lastIndexOf(']')); } return create(host, Integer.parseInt(port)); }

Target:
public static Endpoint valueOf(String str) { int lastColon = str.lastIndexOf(':'); if (lastColon == -1) { throw new IllegalArgumentException(String.format("Invalid endpoint format for '%s'. " + "Required format is <ip>:<port>.", str)); } String host = str.substring(0, lastColon); String port = str.substring(lastColon+1); if (host.startsWith("[")) { if (!host.contains("]")) { throw new IllegalArgumentException(String.format("Endpoint contains an invalid host '%s'. " + "IPv6 address literals must be enclosed in '[' and ']' according to RFC 2732", str)); } host = host.substring(1, host.lastIndexOf(']')); } return create(host, Integer.parseInt(port)); }
Source:
public IAtsTeamDefinition getTeamDefinition() { if (teamDef == null) { TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team"); ld.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Active)); int result = ld.open(); if (result == 0) { return (IAtsTeamDefinition) ld.getResult()[0]; } return null; } else { return teamDef; } }

Target:
private IAtsTeamDefinition getTeamDefinition() { if (teamDef == null) { TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team"); ld.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Active)); int result = ld.open(); if (result == 0) { return (IAtsTeamDefinition) ld.getResult()[0]; } return null; } else { return teamDef; } }
Source:
public String toString() { return ToStringBuilder.forInstance(this) .append("JobId", jobId) .append("StepId", stepId) .append("Execution Method", executionMethod).build(); }

Target:
public String toString() { return ToStringBuilder.forInstance(this) .append("jobId", jobId) .append("stepId", stepId) .append("executionMethod", executionMethod) .append("isMonitored", isMonitored) .append("shouldEndJob", shouldEndJob) .append("tasksMonitored", tasksMonitored) .append("completed", completed) .append("jobRequired", jobRequired).build(); }
Source:
public void testStatsForValuesNodeWithJustNulls() { PlanNodeStatsEstimate nullAStats = PlanNodeStatsEstimate.builder() .setOutputRowCount(1) .addSymbolStatistics( new Symbol("a"), SymbolStatsEstimate.builder() .setLowValue(NaN) .setHighValue(NaN) .setNullsFraction(1.0) .setDistinctValuesCount(0.0) .build()) .build(); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("3 + null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", UNKNOWN)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); }

Target:
public void testStatsForValuesNodeWithJustNulls() { PlanNodeStatsEstimate nullAStats = PlanNodeStatsEstimate.builder() .setOutputRowCount(1) .addSymbolStatistics(new Symbol("a"), SymbolStatsEstimate.ZERO_STATS) .build(); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("3 + null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", UNKNOWN)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); }
Source:
public boolean isInitialized() { try { keyValueService.getClusterAvailabilityStatus(); return scrubberStore.isInitialized(); } catch (NotInitializedException ex) { return false; } }

Target:
public boolean isInitialized() { return keyValueService.isInitialized() && scrubberStore.isInitialized(); }
Source:
public synchronized void waitForExit() { while (getStatus() <= STOPPING) { try { waitStatus(STOPPING); } catch (InterruptedException e) { throw new Error(); } } }

Target:
public synchronized void waitForExit() { while (getStatus() <= STOPPING) { try { waitStatus(STOPPED); } catch (InterruptedException e) { throw new Error(); } } }
Source:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); if (ssrc == null) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(ssrc); if (fpt == null) { try { Constructor ctor = fecReceiverType.getConstructor(long.class, byte.class); fpt = (AbstractFECReceiver)ctor.newInstance(ssrc, incomingPT); fecReceivers.put(ssrc, fpt); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { logger.error("Error creating the FEC receiver " + "implementation (" + fecReceiverType.getName() + "): " + e.toString()); return pkts; } } } return fpt.reverseTransform(pkts); }

Target:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); if (ssrc == null) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(ssrc); if (fpt == null) { if (fecType == FecType.ULPFEC) { fpt = new ULPFECReceiver(ssrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); } } } return fpt.reverseTransform(pkts); }
Source:
private Collection<KnowledgePackage> compileDrlString(String content, Collection<String> flows) throws RuleBaseException { KnowledgeBuilder builder = getConfiguredBuilder(); builder.add(ResourceFactory.newReaderResource(new StringReader(content)), ResourceType.DRL); if (flows != null) { for (String drf : flows) { if (drf != null) { Resource resource = ResourceFactory.newReaderResource(new StringReader(drf)); builder.add(resource, ResourceType.DRF); } } } if (builder.hasErrors()) { System.out.println(content.toString()); throw new RuleBaseException(builder.getErrors().toString()); } return builder.getKnowledgePackages(); }

Target:
private Collection<KnowledgePackage> compileDrlString(String content, Collection<String> flows) throws RuleBaseException { KnowledgeBuilder builder = getConfiguredBuilder(); builder.add(ResourceFactory.newReaderResource(new StringReader(content)), ResourceType.DRL); if (flows != null) { for (String drf : flows) { Resource resource = ResourceFactory.newReaderResource(new StringReader(drf)); builder.add(resource, ResourceType.DRF); } } if (builder.hasErrors()) { System.out.println(content.toString()); throw new RuleBaseException(builder.getErrors().toString()); } return builder.getKnowledgePackages(); }
Source:
public void showFilterDialog() { if(fTopInput != null) { List<? extends ITimeGraphEntry> allElements = listAllInputs(fTopInput); fFilterDialog.setInput(fTopInput.toArray(new ITimeGraphEntry[0])); fFilterDialog.setTitle(Messages.TmfTimeFilterDialog_WINDOW_TITLE); fFilterDialog.setMessage(Messages.TmfTimeFilterDialog_MESSAGE); fFilterDialog.setExpandedElements(allElements.toArray()); if (fFilter.getFiltered() != null) { ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<ITimeGraphEntry>(allElements); nonFilteredElements.removeAll(fFilter.getFiltered()); fFilterDialog.setInitialElementSelections(nonFilteredElements); } else { fFilterDialog.setInitialElementSelections(allElements); } fFilterDialog.create(); fFilterDialog.open(); if (fFilterDialog.getResult() != null) { fInhibitTreeSelection = true; if (fFilterDialog.getResult().length != allElements.size()) { ArrayList<? extends ITimeGraphEntry> filteredElements = new ArrayList<ITimeGraphEntry>(allElements); filteredElements.removeAll(Arrays.asList(fFilterDialog.getResult())); fFilter.setFiltered(new ArrayList<Object>(filteredElements)); } else { fFilter.setFiltered(null); } fTreeViewer.refresh(); fTreeViewer.expandAll(); fTimeGraphViewer.refresh(); fInhibitTreeSelection = false; if (fFilterDialog.getResult().length > 0) { setSelection((ITimeGraphEntry) fFilterDialog.getResult()[0]); } } } }

Target:
public void showFilterDialog() { if(fTopInput != null) { List<? extends ITimeGraphEntry> allElements = listAllInputs(fTopInput); fFilterDialog.setInput(fTopInput.toArray(new ITimeGraphEntry[0])); fFilterDialog.setTitle(Messages.TmfTimeFilterDialog_WINDOW_TITLE); fFilterDialog.setMessage(Messages.TmfTimeFilterDialog_MESSAGE); fFilterDialog.setExpandedElements(allElements.toArray()); if (fFilter.getFiltered() != null) { ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<ITimeGraphEntry>(allElements); nonFilteredElements.removeAll(fFilter.getFiltered()); fFilterDialog.setInitialElementSelections(nonFilteredElements); } else { fFilterDialog.setInitialElementSelections(allElements); } fFilterDialog.create(); fFilterDialog.open(); if (fFilterDialog.getResult() != null) { fInhibitTreeSelection = true; if (fFilterDialog.getResult().length != allElements.size()) { ArrayList<Object> filteredElements = new ArrayList<Object>(allElements); filteredElements.removeAll(Arrays.asList(fFilterDialog.getResult())); fFilter.setFiltered(filteredElements); } else { fFilter.setFiltered(null); } fTreeViewer.refresh(); fTreeViewer.expandAll(); fTimeGraphViewer.refresh(); fInhibitTreeSelection = false; if (fFilterDialog.getResult().length > 0) { setSelection((ITimeGraphEntry) fFilterDialog.getResult()[0]); } } } }
Source:
private char formatFieldFirstCharacterToFitDroolsCoreStandards(final String fieldName) { if (fieldName.length() > 2 && Character.isLowerCase(fieldName.charAt(0)) && Character.isUpperCase(fieldName.charAt(1))) { return fieldName.charAt(0); } else { return Character.toUpperCase(fieldName.charAt(0)); } }

Target:
private char formatFieldFirstCharacterToFitDroolsCoreStandards(final String fieldName) { if (fieldName.length() > 1 && Character.isLowerCase(fieldName.charAt(0)) && Character.isUpperCase(fieldName.charAt(1))) { return fieldName.charAt(0); } else { return Character.toUpperCase(fieldName.charAt(0)); } }
Source:
public <T> T getColumn(String column, GenericType<T> type) { return (T) getColumn(column, (Type) type); }

Target:
public <T> T getColumn(String column, GenericType<T> type) { return (T) getColumn(column, type.getType()); }
Source:
private void deleteNetworkResourceGroup(NetworkDeletionRequest networkDeletionRequest) { try { AzureClient azureClient = azureClientService.getClient(networkDeletionRequest.getCloudCredential()); if (resourceGroupExists(azureClient, networkDeletionRequest)) { azureClient.deleteTemplateDeployment(networkDeletionRequest.getResourceGroup(), networkDeletionRequest.getStackName()); azureClient.deleteResourceGroup(networkDeletionRequest.getResourceGroup()); } } catch (CloudException e) { LOGGER.warn("Deletion error, cloud exception happened: ", e); if (e.body() != null && e.body().details() != null) { String details = e.body().details().stream().map(CloudError::message).collect(Collectors.joining(", ")); throw new CloudConnectorException(String.format("Network deletion failed, status code %s, error message: %s, details: %s", e.body().code(), e.body().message(), details)); } else { throw new CloudConnectorException(String.format("Network deletion failed: '%s', please go to Azure Portal for detailed message", e)); } } }

Target:
private void deleteNetworkResourceGroup(NetworkDeletionRequest networkDeletionRequest) { try { LOGGER.debug("Deleting network resource group"); AzureClient azureClient = azureClientService.getClient(networkDeletionRequest.getCloudCredential()); if (resourceGroupExists(azureClient, networkDeletionRequest)) { azureClient.deleteTemplateDeployment(networkDeletionRequest.getResourceGroup(), networkDeletionRequest.getStackName()); azureClient.deleteResourceGroup(networkDeletionRequest.getResourceGroup()); } } catch (CloudException e) { throw azureUtils.convertToCloudConnectorException(e, "Network resource group deletion"); } }