auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void service(HttpRequest request, HttpResponse response) throws IOException { if (request.getMethod() != "POST") { response.setStatusCode(HttpURLConnection.HTTP_BAD_METHOD); return; } String bodyString = request.getReader().lines().collect(Collectors.joining()); JsonObject body = (new Gson()).fromJson(bodyString, JsonObject.class); if (body == null || !body.has("text")) { response.setStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); return; } if (!isValidSlackWebhook(request, bodyString)) { response.setStatusCode(HttpURLConnection.HTTP_UNAUTHORIZED); return; } String query = body.get("text").getAsString(); List<Object> kgResults = searchKnowledgeGraph(query); BufferedWriter writer = response.getWriter(); writer.write(formatSlackMessage(kgResults, query)); }

Target:
public void service(HttpRequest request, HttpResponse response) throws IOException { if (request.getMethod() != "POST") { response.setStatusCode(HttpURLConnection.HTTP_BAD_METHOD); return; } String bodyString = request.getReader().lines().collect(Collectors.joining()); JsonObject body = (new Gson()).fromJson(bodyString, JsonObject.class); if (body == null || !body.has("text")) { response.setStatusCode(HttpURLConnection.HTTP_BAD_REQUEST); return; } if (!isValidSlackWebhook(request, bodyString)) { response.setStatusCode(HttpURLConnection.HTTP_UNAUTHORIZED); return; } String query = body.get("text").getAsString(); JsonObject kgResponse = searchKnowledgeGraph(query); BufferedWriter writer = response.getWriter(); writer.write(formatSlackMessage(kgResponse, query)); }
Source:
public static Properties resolvePropertiesFile(String fileNamePath) { Properties properties = new Properties(); try { logger.debug("Loading properties from file " + fileNamePath); FileInputStream stream = new FileInputStream(fileNamePath); properties.load(stream); } catch (Exception e) { logger.warn("Properties file not found : '" + fileNamePath + "'", e); } return properties; }

Target:
public static Properties resolvePropertiesFile(String fileNamePath) { Properties properties = new Properties(); logger.debug("Loading properties from file " + fileNamePath); try (FileInputStream stream = new FileInputStream(fileNamePath)) { properties.load(stream); } catch (Exception e) { logger.warn("Properties file not found : '" + fileNamePath + "'", e); } return properties; }
Source:
public static CellProcessor getLongCellProcessor(Boolean required, Long equals, Long minValue, Long maxValue) { CellProcessor cellProcessor = null; if (equals != null) { cellProcessor = addEquals(cellProcessor, equals); } else if (minValue != null || maxValue != null) { cellProcessor = addLongMinMax(minValue, maxValue); } else { cellProcessor = addParseLong(null); } if (required == null || !required) { cellProcessor = addOptional(cellProcessor); } return cellProcessor; }

Target:
public static CellProcessor getLongCellProcessor(Boolean required, Long equals, Long minValue, Long maxValue) { CellProcessor cellProcessor = null; if (equals != null) { cellProcessor = addEquals(cellProcessor, equals); cellProcessor = addParseLong(cellProcessor); } else if (minValue != null || maxValue != null) { cellProcessor = addLongMinMax(minValue, maxValue); } if (required == null || !required) { cellProcessor = addOptional(cellProcessor); } return cellProcessor; }
Source:
public void setUpCallToAction(String callToActionText) { if (callToActionText == null) { callToActionContainer.setVisibility(GONE); } else { callToActionContainer.setVisibility(VISIBLE); callToActionTextView.setText(callToActionText); } }

Target:
public void setUpCallToAction(String callToActionText) { if (callToActionText != null) { callToActionContainer.setVisibility(VISIBLE); callToActionTextView.setText(callToActionText); } else { callToActionContainer.setVisibility(GONE); } }
Source:
private GlobalMetricRegistriesAdapter() { DefaultMetricsSystem.initialize("HBase"); JvmMetrics.initSingleton("HBase", ""); }

Target:
private GlobalMetricRegistriesAdapter() { DefaultMetricsSystem.initialize("Phoenix"); JvmMetrics.initSingleton("Phoenix", ""); }
Source:
private void downloadUploads(final int page) { if (handler == null) { MainActivity.error("downloadUploads handler is null"); } if (!busy) { final int pageStart = page * ROW_COUNT; final String downloadUrl = MainActivity.UPLOADS_STATS_URL + "?pagestart=" + pageStart + "&pageend=" + (pageStart + ROW_COUNT); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, null, downloadUrl, false, true, true, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { if (!isCache) { handleUploads(json, handler); } busy = false; } }); try { task.startDownload(this); } catch (WiGLEAuthException waex) { MainActivity.info("Transactions Download Failed due to failed auth"); } } else { MainActivity.error("preventing download because previous is still in progress."); } }

Target:
private void downloadUploads(final int page) { if (handler == null) { MainActivity.error("downloadUploads handler is null"); } if (!busy.get()) { final int pageStart = page * ROW_COUNT; final String downloadUrl = MainActivity.UPLOADS_STATS_URL + "?pagestart=" + pageStart + "&pageend=" + (pageStart + ROW_COUNT); busy.set(true); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, null, downloadUrl, false, true, true, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { if (!isCache) { handleUploads(json, handler); } busy.set(false); } }); try { task.startDownload(this); } catch (WiGLEAuthException waex) { MainActivity.info("Transactions Download Failed due to failed auth"); } } else { MainActivity.error("preventing download because previous is still in progress."); } }
Source:
public boolean shouldUseCommitTemplate() { return Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.COMMIT_DIALOG_MESSAGE_TEMPLATE) && getCommitMessage() == null && getCommitTemplate().isPresent(); }

Target:
public boolean shouldUseCommitTemplate() { return getCommitMessage() == null && getCommitTemplate().isPresent(); }
Source:
public void run(final int iteration, final AtomicBoolean abortFlag) { final List<LassoData> totalInstancesProcessed = new LinkedList<>(); Map<Long, LassoData> nextTrainingData = trainingDataProvider.getNextTrainingData(); while (!nextTrainingData.isEmpty()) { final List<LassoData> instances = new ArrayList<>(nextTrainingData.values()); pullModels(); final List<Vector> features = new LinkedList<>(); final Vector yValue = vectorFactory.createDenseZeros(instances.size()); int iter = 0; for (final LassoData instance : instances) { features.add(instance.getFeature()); yValue.set(iter++, instance.getValue()); } final Matrix featureMatrix = matrixFactory.horzcatVecDense(features).transpose(); final Vector precalculate = featureMatrix.mmul(newModel); for (int i = 0; i < numFeatures; i++) { final Vector getColumn = featureMatrix.sliceColumn(i); final double getColumnNorm = getColumn.dot(getColumn); if (getColumnNorm == 0) { continue; } precalculate.subi(getColumn.scale(newModel.get(i))); newModel.set(i, sthresh((getColumn.dot(yValue.sub(precalculate))) / getColumnNorm, lambda, getColumnNorm)); precalculate.addi(getColumn.scale(newModel.get(i))); } pushAndResetGradients(); totalInstancesProcessed.addAll(instances); nextTrainingData = trainingDataProvider.getNextTrainingData(); } pullModels(); final double loss = computeLoss(totalInstancesProcessed); LOG.log(Level.INFO, "Loss value: {0}", new Object[]{loss}); if ((iteration + 1) % printModelPeriod == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", new Object[]{newModel.get(i)}); } } }

Target:
public void run(final int iteration, final AtomicBoolean abortFlag) { final List<LassoData> totalInstancesProcessed = new LinkedList<>(); Map<Long, LassoData> nextTrainingData = trainingDataProvider.getNextTrainingData(); while (!nextTrainingData.isEmpty()) { final List<LassoData> instances = new ArrayList<>(nextTrainingData.values()); pullModels(); final Pair<Matrix, Vector> featureMatrixAndValues = convertToFeaturesAndValues(instances); final Matrix featureMatrix = featureMatrixAndValues.getLeft(); final Vector yValues = featureMatrixAndValues.getRight(); final Vector precalculate = featureMatrix.mmul(newModel); for (int i = 0; i < numFeatures; i++) { final Vector columnVector = featureMatrix.sliceColumn(i); final double columnNorm = columnVector.dot(columnVector); if (columnNorm == 0 || newModel.get(i) == 0) { continue; } precalculate.subi(columnVector.scale(newModel.get(i))); newModel.set(i, sthresh((columnVector.dot(yValues.sub(precalculate))) / columnNorm, lambda, columnNorm)); precalculate.addi(columnVector.scale(newModel.get(i))); } pushAndResetGradients(); totalInstancesProcessed.addAll(instances); nextTrainingData = trainingDataProvider.getNextTrainingData(); } pullModels(); final double loss = computeLoss(totalInstancesProcessed); LOG.log(Level.INFO, "Loss value: {0}", new Object[]{loss}); if ((iteration + 1) % PRINT_MODEL_PERIOD == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", new Object[]{newModel.get(i)}); } } }
Source:
public Long getMaxDepth() { return this.maxDepth; }

Target:
public long getMaxDepth() { return this.maxDepth; }
Source:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null) { allowCreateSnapshot = false; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); }

Target:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); }
Source:
private void removeReportedPeer(NodeAddress nodeAddress) { List<Peer> reportedPeersClone = new ArrayList<>(reportedPeers); Optional<Peer> reportedPeerOptional = reportedPeersClone.stream() .filter(e -> e.getNodeAddress().equals(nodeAddress)).findAny(); if (reportedPeerOptional.isPresent()) { Peer reportedPeer = reportedPeerOptional.get(); removeReportedPeer(reportedPeer); } }

Target:
private void removeReportedPeer(NodeAddress nodeAddress) { List<Peer> reportedPeersClone = new ArrayList<>(reportedPeers); reportedPeersClone.stream() .filter(e -> e.getNodeAddress().equals(nodeAddress)) .findAny() .ifPresent(this::removeReportedPeer); }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DBObject<?> dbObject = (DBObject<?>) o; if (alias != null ? !alias.equals(dbObject.alias) : dbObject.alias != null) { return false; } if (expressionForComparison() != null ? !expressionForComparison().equals(dbObject.expressionForComparison()) : dbObject.expressionForComparison() != null) { return false; } return !(qualifier != null ? !qualifier.equals(dbObject.qualifier) : dbObject.qualifier != null); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DBObject<?> dbObject = (DBObject<?>) o; if (alias != null ? !alias.equals(dbObject.alias) : dbObject.alias != null) { return false; } String myExpression = expressionForComparison(); String otherExpression = dbObject.expressionForComparison(); if (myExpression != null ? !myExpression.equals(otherExpression) : otherExpression != null) { return false; } return !(qualifier != null ? !qualifier.equals(dbObject.qualifier) : dbObject.qualifier != null); }
Source:
void onDrop(DropEvent event) { event.preventDefault(); int sourceIndex = Integer.parseInt(event.getData(DRAG_INDEX)); if (sourceIndex != controller.getColumnIndex(column)) { controller.swapColumns(controller.getColumn(sourceIndex), column); } }

Target:
void onDrop(DropEvent event) { event.preventDefault(); if (dragIndex != controller.getColumnIndex(column)) { controller.swapColumns(controller.getColumn(dragIndex), column); } dragIndex = -1; }
Source:
private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (Map.Entry<VmDynamic, VmStatistics> vmHelper : _runningVms.values()) { VmDynamic vmDynamic = vmHelper.getKey(); if (vmDynamic != null) { VM vm = _vmDict.get(vmDynamic.getId()); if (vm != null) { String dbHash = vm.getHash(); if ((dbHash == null && vmDynamic.getHash() != null) || !dbHash.equals(vmDynamic.getHash())) { vmsToUpdate.add(vmDynamic.getId().toString()); if (_vmDynamicToSave.containsKey(vm.getId())) { _vmDynamicToSave.get(vm.getId()).setHash(vmDynamic.getHash()); } else { vmDynamic.setHash(vmDynamic.getHash()); AddVmDynamicToList(vmDynamic); } } } } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }

Target:
private void handleVmDeviceChange() { List<String> vmsToUpdate = new ArrayList<String>(); for (Map.Entry<VmDynamic, VmStatistics> vmHelper : _runningVms.values()) { VmDynamic vmDynamic = vmHelper.getKey(); if (vmDynamic != null) { VM vm = _vmDict.get(vmDynamic.getId()); if (vm != null) { String dbHash = vm.getHash(); if ((dbHash == null && vmDynamic.getHash() != null) || !dbHash.equals(vmDynamic.getHash())) { vmsToUpdate.add(vmDynamic.getId().toString()); if (_vmDynamicToSave.containsKey(vm.getId())) { _vmDynamicToSave.get(vm.getId()).setHash(vmDynamic.getHash()); } else { AddVmDynamicToList(vmDynamic); } } } } } if (vmsToUpdate.size() > 0) { updateVmDevices(vmsToUpdate); } }
Source:
private static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), 4, extraProperties); queryRunner.installPlugin(new GeoPlugin()); return queryRunner; }

Target:
private static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception { DistributedQueryRunner queryRunner = new DistributedQueryRunner(testSessionBuilder().build(), DEFAULT_WORKER_COUNT, extraProperties); queryRunner.installPlugin(new GeoPlugin()); return queryRunner; }
Source:
protected Response migrateIncomingPhoneNumbers(String targetAccountSid, MultivaluedMap<String, String> data, MediaType responseType) { Account effectiveAccount = userIdentityContext.getEffectiveAccount(); secure(effectiveAccount, "RestComm:Modify:IncomingPhoneNumbers"); allowOnlySuperAdmin(); try{ Account targetAccount = accountsDao.getAccount(targetAccountSid); if(targetAccount.getParentSid() == null){ return status(BAD_REQUEST).entity("Super Admin account numbers can not be migrated. Please provide a valid account sid").build(); }else{ String organizationSidStr = data.getFirst("OrganizationSid"); if(organizationSidStr == null){ return status(BAD_REQUEST).entity("OrganizationSid cannot be null").build(); } Sid organizationSid = null; try{ organizationSid = new Sid(organizationSidStr); }catch(IllegalArgumentException iae){ return status(BAD_REQUEST).entity("OrganizationSid is not valid").build(); } Organization destinationOrganization = organizationsDao.getOrganization(organizationSid); if(destinationOrganization == null){ return status(NOT_FOUND).entity("Destination organization not found").build(); } migrateNumbersFromAccountTree(targetAccount, destinationOrganization); return status(OK).build(); } }catch(Exception e){ logger.error("Exception while performing migrateIncomingPhoneNumbers: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }

Target:
protected Response migrateIncomingPhoneNumbers(String targetAccountSid, MultivaluedMap<String, String> data, MediaType responseType) { Account effectiveAccount = userIdentityContext.getEffectiveAccount(); secure(effectiveAccount, "RestComm:Modify:IncomingPhoneNumbers"); allowOnlySuperAdmin(); try{ Account targetAccount = accountsDao.getAccount(targetAccountSid); if(targetAccount == null){ return status(NOT_FOUND).entity("Account not found").build(); } if(targetAccount.getParentSid() == null){ return status(BAD_REQUEST).entity("Super Admin account numbers can not be migrated. Please provide a valid account sid").build(); }else{ String organizationSidStr = data.getFirst("OrganizationSid"); if(organizationSidStr == null){ return status(BAD_REQUEST).entity("OrganizationSid cannot be null").build(); } Sid organizationSid = null; try{ organizationSid = new Sid(organizationSidStr); }catch(IllegalArgumentException iae){ return status(BAD_REQUEST).entity("OrganizationSid is not valid").build(); } Organization destinationOrganization = organizationsDao.getOrganization(organizationSid); if(destinationOrganization == null){ return status(NOT_FOUND).entity("Destination organization not found").build(); } migrateNumbersFromAccountTree(targetAccount, destinationOrganization); return status(OK).build(); } }catch(Exception e){ logger.error("Exception while performing migrateIncomingPhoneNumbers: ", e); return status(INTERNAL_SERVER_ERROR).build(); } }
Source:
public String getUrl() { return String.format("/job/%s/%d/Azure/processDownloadRequest/%s", action.getContainerName(), action.getBuild().number, artifact.getBlobName()); }

Target:
public String getUrl() { return String.format("/job/%s/%d/Azure/processDownloadRequest/%s", getStorageName(), action.getBuild().number, artifact.getBlobName()); }
Source:
static Comparer<byte[]> getBestComparer() { if (System.getProperty("os.arch").toLowerCase().startsWith("sparc")) { return lexicographicalComparerJavaImpl(); } return lexicographicalComparerJavaImpl(); }

Target:
static Comparer<byte[]> getBestComparer() { return lexicographicalComparerJavaImpl(); }
Source:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextRefreshedEvent) { String namespace = ((EmbeddedWebApplicationContext) event.getSource()).getNamespace(); if (!MGMT_CONTEXT_NAMESPACE.equals(namespace)) { this.applicationContext = ((ContextRefreshedEvent) event).getApplicationContext(); String delay = this.applicationContext.getEnvironment().getProperty(QUIET_PERIOD_PROPERTY); if (StringUtils.hasText(delay)) { quietPeriod.set(Long.parseLong(delay)); logger.info("Set container quiet period to ms", delay); } if (this.zkConnection.isConnected()) { if (this.applicationContext.equals(((ContextRefreshedEvent) event).getApplicationContext())) { registerWithZooKeeper(zkConnection.getClient()); } requestLeadership(this.zkConnection.getClient()); } this.zkConnection.addListener(connectionListener); } } else if (event instanceof ContextStoppedEvent) { if (this.leaderSelector != null) { this.leaderSelector.close(); } } else if (event instanceof EmbeddedServletContainerInitializedEvent) { String namespace = ((EmbeddedServletContainerInitializedEvent) event).getApplicationContext().getNamespace(); int port = ((EmbeddedServletContainerInitializedEvent) event).getEmbeddedServletContainer().getPort(); synchronized (adminAttributes) { if (MGMT_CONTEXT_NAMESPACE.equals(namespace)) { adminAttributes.setManagementPort(port); } else { adminAttributes.setPort(port); } if (zkConnection.isConnected() && adminRepository.exists(adminAttributes.getId())) { adminRepository.update(new Admin(adminAttributes.getId(), adminAttributes)); } } } }

Target:
public void onApplicationEvent(ApplicationEvent event) { if (event instanceof ContextRefreshedEvent) { String namespace = ((EmbeddedWebApplicationContext) event.getSource()).getNamespace(); if (!MGMT_CONTEXT_NAMESPACE.equals(namespace)) { this.applicationContext = ((ContextRefreshedEvent) event).getApplicationContext(); String delay = this.applicationContext.getEnvironment().getProperty(QUIET_PERIOD_PROPERTY); if (StringUtils.hasText(delay)) { quietPeriod.set(Long.parseLong(delay)); logger.info("Set container quiet period to ms", delay); } if (this.zkConnection.isConnected()) { registerWithZooKeeper(zkConnection.getClient()); requestLeadership(this.zkConnection.getClient()); } this.zkConnection.addListener(connectionListener); } } else if (event instanceof ContextStoppedEvent) { if (this.leaderSelector != null) { this.leaderSelector.close(); } } else if (event instanceof EmbeddedServletContainerInitializedEvent) { String namespace = ((EmbeddedServletContainerInitializedEvent) event).getApplicationContext().getNamespace(); int port = ((EmbeddedServletContainerInitializedEvent) event).getEmbeddedServletContainer().getPort(); synchronized (adminAttributes) { if (MGMT_CONTEXT_NAMESPACE.equals(namespace)) { adminAttributes.setManagementPort(port); } else { adminAttributes.setPort(port); } if (zkConnection.isConnected() && adminRepository.exists(adminAttributes.getId())) { adminRepository.update(new Admin(adminAttributes.getId(), adminAttributes)); } } } }
Source:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSaveSmartLock = mHelper.getSaveSmartLockInstance(getActivity()); String email = getArguments().getString(ExtraConstants.EXTRA_EMAIL); String provider = getArguments().getString(ExtraConstants.EXTRA_PROVIDER); AuthUI.IdpConfig providerConfig = null; for (AuthUI.IdpConfig config : mHelper.getFlowParams().providerInfo) { if (config.getProviderId().equalsIgnoreCase(provider)) { providerConfig = config; break; } } if (providerConfig == null) { finish(ResultCodes.UNKNOWN_ERROR, new Intent()); return; } if (provider.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)) { mIdpProvider = new FacebookProvider(getContext(), providerConfig); } else if (provider.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)) { mIdpProvider = new GoogleProvider(getActivity(), providerConfig, email); } else if (provider.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) { mIdpProvider = new TwitterProvider(getContext()); } mIdpProvider.setAuthenticationCallback(this); mIdpProvider.startLogin(getActivity()); }

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mSaveSmartLock = mHelper.getSaveSmartLockInstance(getActivity()); String provider = getArguments().getString(ExtraConstants.EXTRA_PROVIDER); AuthUI.IdpConfig providerConfig = null; for (AuthUI.IdpConfig config : mHelper.getFlowParams().providerInfo) { if (config.getProviderId().equalsIgnoreCase(provider)) { providerConfig = config; break; } } if (providerConfig == null) { finish(ResultCodes.CANCELED, IdpResponse.getErrorCodeIntent(ErrorCodes.UNKNOWN_ERROR)); return; } if (provider.equalsIgnoreCase(GoogleAuthProvider.PROVIDER_ID)) { mIdpProvider = new GoogleProvider( getActivity(), providerConfig, getArguments().getString(ExtraConstants.EXTRA_EMAIL)); } else if (provider.equalsIgnoreCase(FacebookAuthProvider.PROVIDER_ID)) { mIdpProvider = new FacebookProvider( getContext(), providerConfig, mHelper.getFlowParams().themeId); } else if (provider.equalsIgnoreCase(TwitterAuthProvider.PROVIDER_ID)) { mIdpProvider = new TwitterProvider(getContext()); } mIdpProvider.setAuthenticationCallback(this); mIdpProvider.startLogin(getActivity()); }
Source:
public static void nailMain(final NGContext context) throws IOException { try { Thread mainThread = Thread.currentThread(); context.addClientListener(() -> mainThread.interrupt()); context.addHeartbeatListener(intervalMillis -> context.out.print("H")); while(!Thread.currentThread().isInterrupted()) { Thread.sleep(5000); context.out.print("S"); } } catch (InterruptedException ignored) { System.exit(42); } System.exit(0); }

Target:
public static void nailMain(final NGContext context) throws IOException { try { Thread mainThread = Thread.currentThread(); context.addClientListener(mainThread::interrupt); context.addHeartbeatListener(() -> context.out.print("H")); while(!Thread.currentThread().isInterrupted()) { Thread.sleep(5000); context.out.print("S"); } } catch (InterruptedException ignored) { System.exit(42); } System.exit(0); }
Source:
public void testFindByRegionsAndComplexFilters() throws AnnotationMetadataNotFoundException { String chr = "11"; int start = 190062; int end = 190064; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantWithSamplesAndAnnotation> variantEntityList = service.findByRegionsAndComplexFilters( regions, null, null, null, new PageRequest(0, 10000)); assertEquals(1, variantEntityList.size()); for (VariantSourceEntryWithSampleNames variantSourceEntry : variantEntityList.get(0).getSourceEntries()) { if (!variantSourceEntry.getFileId().equals("ERZX00051")) { continue; } assertNotEquals(0, variantSourceEntry.getSamplesData().size()); Map<String, Map<String, String>> samplesData = variantSourceEntry.getSamplesDataMap(); assertEquals("0|1", samplesData.get("HG03805").get("GT")); } assertFalse(variantEntityList.get(0).getAnnotation() == null); }

Target:
public void testFindByRegionsAndComplexFilters() throws AnnotationMetadataNotFoundException { String chr = "11"; int start = 190062; int end = 190064; Region region = new Region(chr, start, end); List<Region> regions = new ArrayList<>(); regions.add(region); List<VariantWithSamplesAndAnnotation> variantEntityList = service.findByRegionsAndComplexFilters( regions, null, null, null, new PageRequest(0, 10000)); assertEquals(1, variantEntityList.size()); for (VariantSourceEntryWithSampleNames variantSourceEntry : variantEntityList.get(0).getSourceEntries()) { if (!variantSourceEntry.getFileId().equals("ERZX00051")) { continue; } assertNotEquals(0, variantSourceEntry.getSamplesData().size()); Map<String, Map<String, String>> samplesData = variantSourceEntry.getSamplesDataMap(); assertEquals("0|1", samplesData.get("HG03805").get("GT")); } assertNotNull(variantEntityList.get(0).getAnnotation()); }
Source:
public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof GenericData) { GenericData that = (GenericData) o; return super.equals(that) && Objects.equals(this.classInfo, that.classInfo); } return false; }

Target:
public boolean equals(Object o) { if (o == this) { return true; } if (o == null || !(o instanceof GenericData)) { return false; } GenericData that = (GenericData) o; return super.equals(that) && Objects.equals(this.classInfo, that.classInfo); }
Source:
public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); hiveScript = jobProps.getProperty("hive.script"); if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runHive(args); return null; } }); } else { runHive(args); } }

Target:
public static void main(final String[] args) throws Exception { Properties jobProps = HadoopSecureWrapperUtils.loadAzkabanProps(); HadoopConfigurationInjector.injectResources(new Props(null, jobProps)); hiveScript = jobProps.getProperty("hive.script"); if (HadoopSecureWrapperUtils.shouldProxy(jobProps)) { String tokenFile = System.getenv(HADOOP_TOKEN_FILE_LOCATION); UserGroupInformation proxyUser = HadoopSecureWrapperUtils.setupProxyUser(jobProps, tokenFile, logger); proxyUser.doAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { runHive(args); return null; } }); } else { runHive(args); } }
Source:
public ITypedElement getLeft() { if (getBaseCommit() != null && baseId != null) return CompareUtils.getFileRevisionTypedElement(gitPath, getBaseCommit(), getRepository(), baseId); return null; }

Target:
public ITypedElement getLeft() { if (objectExist(getRemoteCommit(), remoteId)) return CompareUtils.getFileRevisionTypedElement(gitPath, getRemoteCommit(), getRepository(), remoteId); return null; }
Source:
static <T> Iterator<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); return Collections.fill(n, s, Iterator.empty(), Iterator::of); }

Target:
static <T> Iterator<T> fill(int n, Supplier<? extends T> s) { Objects.requireNonNull(s, "s is null"); return Collections.fill(n, s); }
Source:
public void anUpdateFirmwareOSLPMessageIsSentToDevice(final String deviceIdentification) { final Message message = this.oslpMockServer.waitForRequest(DeviceRequestMessageType.UPDATE_FIRMWARE); Assert.assertNotNull(message); Assert.assertTrue(message.hasUpdateFirmwareRequest()); }

Target:
public void anUpdateFirmwareOSLPMessageIsSentToDevice(final String deviceIdentification) { final Message message = this.oslpMockServer.waitForRequest(DeviceRequestMessageType.UPDATE_FIRMWARE); Assert.assertNotNull(message); Assert.assertTrue(message.hasUpdateFirmwareRequest()); @SuppressWarnings("unused") final UpdateFirmwareRequest updateFirmwareRequest = message.getUpdateFirmwareRequest(); }
Source:
public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); assertNotNull(cpuAspect); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); String cpu = "cpu"; ITmfCallsiteIterator iter = module.iterator(uuid.toString(), cpu, "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for (int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), cpu, "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", cpu, "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), cpu, "elephant", 42); evaluateEmptyIterator(iter); }

Target:
public void testIterator() { TmfXmlKernelTraceStub trace = fTrace; assertNotNull(trace); CallsiteAnalysis module = TmfTraceUtils.getAnalysisModuleOfClass(trace, CallsiteAnalysis.class, CallsiteAnalysis.ID); assertNotNull(module); assertTrue(module.schedule().isOK()); assertTrue(module.waitForCompletion()); UUID uuid = trace.getUUID(); assertNotNull(uuid); String cpu = "cpu"; ITmfCallsiteIterator iter = module.iterator(uuid.toString(), cpu, "0", 1); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); for (int i = 0; i < 10; i++) { evaluateEmptyIterator(iter); } iter = module.iterator(uuid.toString(), cpu, "0", 42); evaluateIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); for (int i = 0; i < 10; i++) { evaluateIterator(iter, 71, new TmfCallsite("fs/read_write.c", 0L)); evaluateEmptyIterator(iter); evaluatePrevIterator(iter, 40, new TmfCallsite("fs/open.c", 0L)); evaluateBackEmptyIterator(iter); } iter = module.iterator("", cpu, "0", 42); evaluateEmptyIterator(iter); iter = module.iterator(uuid.toString(), cpu, "elephant", 42); evaluateEmptyIterator(iter); }
Source:
private static void writeReportLastScanTo(HttpMessage msg, ScanReportType reportType) throws Exception { ReportLastScan rls = new ReportLastScan(); StringBuilder report = new StringBuilder(); rls.generate(report, Model.getSingleton()); String response; if (ScanReportType.XML == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/xml; charset=UTF-8")); response = report.toString(); } else if (ScanReportType.MD == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/markdown; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.md.xsl").toString()); } else if (ScanReportType.JSON == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/json; charset=UTF-8")); response = ReportGenerator.stringToJson(report.toString()); } else { msg.setResponseHeader(API.getDefaultResponseHeader("text/html; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.html.xsl").toString()); } msg.setResponseBody(response); msg.getResponseHeader().setContentLength(msg.getResponseBody().length()); }

Target:
private static void writeReportLastScanTo(HttpMessage msg, ScanReportType reportType) throws Exception { ReportLastScan rls = new ReportLastScan(); StringBuilder report = new StringBuilder(); rls.generate(report, Model.getSingleton()); String response; if (ScanReportType.XML == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/xml; charset=UTF-8")); response = report.toString(); } else if (ScanReportType.MD == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("text/markdown; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.md.xsl").toString()); } else if (ScanReportType.JSON == reportType) { msg.setResponseHeader(API.getDefaultResponseHeader("application/json; charset=UTF-8")); response = ReportGenerator.stringToJson(report.toString()); } else { msg.setResponseHeader(API.getDefaultResponseHeader("text/html; charset=UTF-8")); response = ReportGenerator.stringToHtml( report.toString(), Paths.get(Constant.getZapInstall(), "xml/report.html.xsl").toString()); } msg.setResponseBody(response); msg.getResponseHeader().setContentLength(msg.getResponseBody().length()); }
Source:
public String resolveJsModule( String scriptAddress, String moduleAddress, String sourcename, int lineno, int colno) { if (ModuleLoader.isAmbiguousIdentifier(moduleAddress)) { if (errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make( sourcename, lineno, colno, ModuleLoader.INVALID_MODULE_PATH, moduleAddress, "BROWSER")); } return null; } String loadAddress = locate(scriptAddress, moduleAddress); if (loadAddress == null && errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, ModuleLoader.LOAD_WARNING, moduleAddress)); } return loadAddress; }

Target:
public String resolveJsModule( String scriptAddress, String moduleAddress, String sourcename, int lineno, int colno) { if (ModuleLoader.isAmbiguousIdentifier(moduleAddress)) { errorHandler.report( CheckLevel.WARNING, JSError.make( sourcename, lineno, colno, ModuleLoader.INVALID_MODULE_PATH, moduleAddress, "BROWSER")); return null; } String loadAddress = locate(scriptAddress, moduleAddress); if (loadAddress == null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, ModuleLoader.LOAD_WARNING, moduleAddress)); } return loadAddress; }
Source:
public TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task, Throwable exception, TaskLogs output) throws UnknownTaskException { if (task == null){ throw new UnknownTaskException(); } TaskResultImpl taskResult; JobDescriptor jobDescriptor = job.getJobDescriptor(); try{ taskResult = (TaskResultImpl) dbManager.loadTasksResults(job.getId(), Collections.singletonList(task.getId())).get(task.getId()); }catch(DatabaseManagerException e){ taskResult = getEmptyTaskResultWithTaskIdAndExecutionTime(task, exception,output); } EligibleTaskDescriptor etd = null; if (jobDescriptor.getPausedTasks().get(task.getId()) != null){ etd = (EligibleTaskDescriptor) jobDescriptor.getPausedTasks().get(task.getId()); }else if (jobDescriptor.getRunningTasks().get(task.getId()) != null){ etd = (EligibleTaskDescriptor) jobDescriptor.getRunningTasks().get(task.getId()); } if (etd != null){ taskResult.setPropagatedVariables(getPropagatedVariables(dbManager, etd, job, task)); } return taskResult; }

Target:
public TaskResultImpl getTaskResult(SchedulerDBManager dbManager, InternalJob job, InternalTask task, Throwable exception, TaskLogs output) throws UnknownTaskException { if (task == null) { throw new UnknownTaskException(); } TaskResultImpl taskResult; JobDescriptor jobDescriptor = job.getJobDescriptor(); EligibleTaskDescriptor etd = null; if (jobDescriptor.getPausedTasks().get(task.getId()) != null) { etd = (EligibleTaskDescriptor) jobDescriptor.getPausedTasks().get(task.getId()); } else if (jobDescriptor.getRunningTasks().get(task.getId()) != null) { etd = (EligibleTaskDescriptor) jobDescriptor.getRunningTasks().get(task.getId()); } if (jobDescriptor.getRunningTasks().get(task.getId()) != null) { taskResult = (TaskResultImpl) dbManager.loadTasksResults(job.getId(), Collections.singletonList(task.getId())).get(task.getId()); } else { taskResult = getEmptyTaskResultWithTaskIdAndExecutionTime(task, exception, output); if (etd != null) { taskResult.setPropagatedVariables(getPropagatedVariables(dbManager, etd, job, task)); } } return taskResult; }
Source:
private void verifySchemaVersion() throws CatalogException { int schemaVersion = -1; schemaVersion = getSchemaVersion(); if (schemaVersion == -1 || schemaVersion != getDriverVersion()) { LOG.info(String.format("Catalog version (%d) and current driver version (%d) are mismatch to each other", schemaVersion, getDriverVersion())); LOG.info("It will start upgrade process on catalog stores."); catalogSchemaManager.upgradeBaseSchema(getConnection(), schemaVersion); insertSchemaVersion(); } LOG.info(String.format("The compatibility of the catalog schema (version: %d) has been verified.", getDriverVersion())); }

Target:
private void verifySchemaVersion() throws CatalogException { int schemaVersion = -1; schemaVersion = getSchemaVersion(); if (schemaVersion == -1 || schemaVersion != getDriverVersion()) { LOG.error(String.format("Catalog version (%d) and current driver version (%d) are mismatch to each other", schemaVersion, getDriverVersion())); LOG.error("========================================================================="); LOG.error("| Catalog Store Migration Is Needed |"); LOG.error("========================================================================="); LOG.error("| You might downgrade or upgrade Apache Tajo. Downgrading or upgrading |"); LOG.error("| Tajo without migration process is only available in some versions. |"); LOG.error("| In order to learn how to migration Apache Tajo instance, |"); LOG.error("| please refer <LINK_0> |"); LOG.error("========================================================================="); throw new CatalogException("Migration Needed. Please refer <LINK_0>"); } LOG.info(String.format("The compatibility of the catalog schema (version: %d) has been verified.", getDriverVersion())); }
Source:
public HostMetricTagsPair(String host, String metric, @Nullable Map<String, String> tags) { Preconditions.checkNotNull(host, "HostMetricTagsPair.host cannot be null"); Preconditions.checkNotNull(metric, "HostMetricTagsPair.metric cannot be null"); this.metric = metric.trim().toLowerCase(); this.host = host.trim().toLowerCase(); this.tags = tags; }

Target:
public HostMetricTagsPair(String host, String metric, @Nullable Map<String, String> tags) { Preconditions.checkNotNull(host, "HostMetricTagsPair.host cannot be null"); Preconditions.checkNotNull(metric, "HostMetricTagsPair.metric cannot be null"); this.metric = metric.trim(); this.host = host.trim().toLowerCase(); this.tags = tags; }
Source:
public void tesMatchEngineFactoryRegistry() throws IOException { final Resource left = input.getExtlibraryLeft(); final Resource right = input.getExtlibraryRight(); final IMatchEngine.Factory.Registry registry = MatchEngineFactoryRegistryImpl .createStandaloneInstance(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); IMatchEngine.Factory factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithHighestRanking = new MatchEngineFactoryTest(); factoryWithHighestRanking.setRanking(100); registry.add(factoryWithHighestRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertFalse(factory instanceof MatchEngineFactoryTest); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithMiddleRanking = new MatchEngineFactoryOtherTest(); factoryWithMiddleRanking.setRanking(50); registry.add(factoryWithMiddleRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertFalse(factory instanceof MatchEngineFactoryTest); assertTrue(factory instanceof MatchEngineFactoryOtherTest); assertEquals(2, registry.getMatchEngineFactories(scope).size()); }

Target:
public void tesMatchEngineFactoryRegistry() throws IOException { final Resource left = input.getExtlibraryLeft(); final Resource right = input.getExtlibraryRight(); final IMatchEngine.Factory.Registry registry = MatchEngineFactoryRegistryImpl .createStandaloneInstance(); final IComparisonScope scope = EMFCompare.createDefaultScope(left, right); IMatchEngine.Factory factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryImpl); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithHighestRanking = new MatchEngineFactoryTest(); factoryWithHighestRanking.setRanking(100); registry.add(factoryWithHighestRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertFalse(factory instanceof MatchEngineFactoryTest); assertEquals(1, registry.getMatchEngineFactories(scope).size()); IMatchEngine.Factory factoryWithMiddleRanking = new MatchEngineFactoryOtherTest(); factoryWithMiddleRanking.setRanking(50); registry.add(factoryWithMiddleRanking); factory = registry.getHighestRankingMatchEngineFactory(scope); assertTrue(factory instanceof MatchEngineFactoryOtherTest); assertEquals(2, registry.getMatchEngineFactories(scope).size()); }
Source:
public void setUp() throws Exception { this.conf = new TajoConf(); util = new TajoTestingCluster(); catalog = util.startCatalogCluster().getCatalog(); testDir = CommonTestingUtil.getTestDir(TEST_PATH); catalog.createTablespace(DEFAULT_TABLESPACE_NAME, testDir.toUri().toString()); catalog.createDatabase(DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME); conf.setVar(TajoConf.ConfVars.WORKER_TEMPORAL_DIR, testDir.toString()); Schema schema = new Schema(); schema.addColumn("managerid", TajoDataTypes.Type.INT4); schema.addColumn("empid", TajoDataTypes.Type.INT4); schema.addColumn("deptname", TajoDataTypes.Type.TEXT); TableMeta employeeMeta = CatalogUtil.newTableMeta("RAW"); Path employeePath = new Path(testDir, "employee.csv"); Appender appender = ((FileTablespace) TablespaceManager.getLocalFs()) .getAppender(employeeMeta, schema, employeePath); appender.enableStats(); appender.init(); VTuple tuple = new VTuple(schema.size()); for (int i = 0; i < numTuple; i++) { tuple.put(new Datum[] { DatumFactory.createInt4(rnd.nextInt(50)), DatumFactory.createInt4(rnd.nextInt(100)), DatumFactory.createText("dept_" + i), }); appender.addTuple(tuple); } appender.flush(); appender.close(); if (LOG.isDebugEnabled()) { LOG.debug(appender.getStats().getNumRows() + " rows (" + appender.getStats().getNumBytes() + " Bytes)"); } testDataStats = appender.getStats(); employee = new TableDesc( CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "employee"), schema, employeeMeta, employeePath.toUri()); catalog.createTable(employee); analyzer = new SQLAnalyzer(); planner = new LogicalPlanner(catalog, TablespaceManager.getInstance()); }

Target:
public void setUp() throws Exception { this.conf = new TajoConf(); util = new TajoTestingCluster(); catalog = util.startCatalogCluster().getCatalog(); testDir = CommonTestingUtil.getTestDir(TEST_PATH); catalog.createTablespace(DEFAULT_TABLESPACE_NAME, testDir.toUri().toString()); catalog.createDatabase(DEFAULT_DATABASE_NAME, DEFAULT_TABLESPACE_NAME); conf.setVar(TajoConf.ConfVars.WORKER_TEMPORAL_DIR, testDir.toString()); Schema schema = new Schema(); schema.addColumn("managerid", TajoDataTypes.Type.INT4); schema.addColumn("empid", TajoDataTypes.Type.INT4); schema.addColumn("deptname", TajoDataTypes.Type.TEXT); TableMeta employeeMeta = CatalogUtil.newTableMeta("RAW"); Path employeePath = new Path(testDir, "employee.csv"); Appender appender = ((FileTablespace) TablespaceManager.getLocalFs()) .getAppender(employeeMeta, schema, employeePath); appender.enableStats(); appender.init(); VTuple tuple = new VTuple(schema.size()); for (int i = 0; i < numTuple; i++) { tuple.put(new Datum[] { DatumFactory.createInt4(rnd.nextInt(50)), DatumFactory.createInt4(rnd.nextInt(100)), DatumFactory.createText("dept_" + i), }); appender.addTuple(tuple); } appender.flush(); appender.close(); testDataStats = appender.getStats(); employee = new TableDesc( CatalogUtil.buildFQName(TajoConstants.DEFAULT_DATABASE_NAME, "employee"), schema, employeeMeta, employeePath.toUri()); catalog.createTable(employee); analyzer = new SQLAnalyzer(); planner = new LogicalPlanner(catalog, TablespaceManager.getInstance()); }
Source:
public String getFirstNLinesOfInvalidityErrors(int maxNumOfLines) { StringBuilder errors = new StringBuilder(); ArrayList<String> invalidityErrorLines = scriptGeneratorTable.getInvalidityErrorLines(); for (int i = 0; i < invalidityErrorLines.size(); i++) { if (maxNumOfLines <= i) { errors.append("\nLimited to " + maxNumOfLines + " lines. To see an error for a specific row hover over it."); break; } errors.append(invalidityErrorLines.get(i)+"\n"); } return errors.toString(); }

Target:
public String getFirstNLinesOfInvalidityErrors(int maxNumOfLines) { if(!languageSupported) { firePropertyChange(LANGUAGE_SUPPORT_PROPERTY, true, false); } List<String> errors = scriptGeneratorTable.getInvalidityErrorLines(); String message = errors.stream() .limit(maxNumOfLines) .map((String error) -> String.format("- %s", error)) .collect(Collectors.joining("\n")); if (errors.size() > maxNumOfLines) { message = String.format("%s\n\n ... plus %d suppressed errors." + " To see an error for a specific row hover over it.", message, (errors.size() - maxNumOfLines)); } return message; }
Source:
private static List<String> getMountPointsFilter() { return Arrays.asList(Config.<String> getValue(ConfigValues.MountPointsToIgoreInGlusterStorageList).split(",")); }

Target:
private List<String> getMountPointsFilter() { return Arrays.asList(Config.<String> getValue(ConfigValues.MountPointsToIgoreInGlusterStorageList).split(",")); }
Source:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } return true; }

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getContentConflictServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getContentConflictServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { setVdsName(vds.getName()); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); return false; } } return true; }
Source:
private boolean getForceDecimalEncoding(Configuration configuration) { GMLConfiguration config; if (configuration instanceof GMLConfiguration) { config = (GMLConfiguration) configuration; } else { config = configuration.getDependency(GMLConfiguration.class); } if (config == null) { return true; } else { return config.getForceDecimalEncoding(); } }

Target:
private boolean getForceDecimalEncoding(Configuration configuration) { GMLConfiguration config = getGMLConfiguration(configuration); if (config == null) { return true; } else { return config.getForceDecimalEncoding(); } }