auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testUpwardsFloating() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); final int TIME_FLOAT_UPWARDS = 50; final Point FLOAT_UP_MOTION = new Point(0, -2); for(int i = 0; i < TIME_FLOAT_UPWARDS; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertEquals(bubble.getMotion(), FLOAT_UP_MOTION); }

Target:
public void testUpwardsFloating() { Bubble bubble = new Bubble(new Point(0, 0), new Point(0, 0), null); ArrayList<Player> playerList = new ArrayList<Player>(); ArrayList<Unit> unitList = new ArrayList<Unit>(); List<Cell> items = new ArrayList<Cell>(); items.add(Cell.EMPTY); Grid<Cell> cells = new Grid<Cell>(items, 1, 1); Level level = new Level(playerList, unitList, cells); for(int i = 0; i < TIME_FLOAT_UPWARDS; i++) { bubble.tick(level); } assertTrue(bubble.isHit()); assertEquals(bubble.getMotion(), FLOAT_UP_MOTION); }
Source:
public List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException { try { List<FileStatus> splittingFiles = getWALsToSplit(crashedServer, splitMeta); return createSplitWALProcedures(splittingFiles, crashedServer); } catch (IOException e) { LOG.error("Failed to create procedures for splitting logs of {}", crashedServer, e); throw e; } }

Target:
public List<Procedure> splitWALs(ServerName crashedServer, boolean splitMeta) throws IOException { try { List<FileStatus> splittingFiles = getWALsToSplit(crashedServer, splitMeta); return createSplitWALProcedures(splittingFiles, crashedServer); } catch (IOException e) { LOG.error("Failed to create procedures for splitting WALs of {}", crashedServer, e); throw e; } }
Source:
private String getPageMatcherByType(HttpMessage msg) { if (CustomPageMatcherType.URL.equals(getPageMatcherType())) { return msg.getRequestHeader().getURI().toString(); } else if (CustomPageMatcherType.RESPONSE_CONTENT.equals(getPageMatcherType())) { return getHttpMessageAsString(msg); } throw new RuntimeException("Not Supported"); }

Target:
private String getPageMatcherByType(HttpMessage msg) { if (CustomPageMatcherLocation.URL.equals(getPageMatcherLocation())) { return msg.getRequestHeader().getURI().toString(); } else if (CustomPageMatcherLocation.RESPONSE_CONTENT.equals(getPageMatcherLocation())) { return getHttpMessageAsString(msg); } LOGGER.error( "Could not get page matcher for the given message, with: " + getPageMatcherLocation()); return ""; }
Source:
public Map<String, String> getUris(Run run) { if (run.getId() == Run.UNSAVED_ID || runUris.isEmpty()) return Collections.emptyMap(); return runUris.get(run.getPlatformType()) .entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, m -> expandRunUrl(m.getValue(), run))); }

Target:
public Map<String, String> getUris(Run run) { if (run.getId() == Run.UNSAVED_ID || runUris.isEmpty() || runUris.get(run.getPlatformType()) == null) return Collections.emptyMap(); return runUris.get(run.getPlatformType()) .entrySet().stream() .collect(Collectors.toMap(Map.Entry::getKey, m -> expandRunUrl(m.getValue(), run))); }
Source:
public Integer int32(String name) { Int32Field field = findField(name, Int32Field.class); if (field == null) { return null; } int before = byteBuffer.position(); Integer decoded = (Integer) field.decode(byteBuffer); int after = byteBuffer.position(); currentlyRead += (after - before); return decoded; }

Target:
public Integer int32(String name) { Int32Field field = fieldSearcher.nextField(name, Int32Field.class, null, readBuffer); if (field == null) { return null; } return (Integer) field.decode(readBuffer); }
Source:
public KerberosCredentials extract(WebContext context) throws CredentialsException, HttpAction { final String header = context.getRequestHeader(HttpConstants.AUTHORIZATION_HEADER); if (header == null) { throw HttpAction.unauthorizedNegotiate("Kerberos Header not found", context); } if (!(header.startsWith("Negotiate ") || header.startsWith("Kerberos "))) { throw new CredentialsException("Wrong prefix for header: " + HttpConstants.AUTHORIZATION_HEADER); } byte[] base64Token = header.substring(header.indexOf(" ") + 1).getBytes(StandardCharsets.UTF_8); byte[] kerberosTicket = Base64.getDecoder().decode(base64Token); return new KerberosCredentials(kerberosTicket, clientName); }

Target:
public KerberosCredentials extract(WebContext context) throws CredentialsException, HttpAction { final String header = context.getRequestHeader(HttpConstants.AUTHORIZATION_HEADER); if (header == null) { return null; } if (!(header.startsWith("Negotiate ") || header.startsWith("Kerberos "))) { return null; } byte[] base64Token = header.substring(header.indexOf(" ") + 1).getBytes(StandardCharsets.UTF_8); byte[] kerberosTicket = Base64.getDecoder().decode(base64Token); return new KerberosCredentials(kerberosTicket, clientName); }
Source:
public void testFindLiveVersionTemplate() throws Exception{ Template template=new Template(); template.setTitle("TEST TEMPLATE VERSIONABLE"); template.setBody("<html><body> I'm mostly empty </body></html>"); template=APILocator.getTemplateAPI().saveTemplate(template, host, user, false); APILocator.getVersionableAPI().setLive(template); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }

Target:
public void testFindLiveVersionTemplate() throws Exception{ Template template = new TemplateDataGen().nextPersisted(); APILocator.getVersionableAPI().setLive(template); Versionable verAPI = APILocator.getVersionableAPI().findLiveVersion(template.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),template.getTitle()); assertEquals(verAPI.getInode(),template.getInode()); APILocator.getTemplateAPI().delete(template, user, false); }
Source:
public EmailConfiguration(@JsonProperty("to") final String to) { this.to = to; }

Target:
public EmailConfiguration(@JsonProperty("to") final String to) { this.to = notEmpty(to, "to"); }
Source:
public Map<String, Integer> getColumnSizes() throws IOException { if (boxStore != null) { return boxStore.getBoxColumnSizes(); } else { throw new IOException("No boxStore available. Check that it has been declared in the Spring config."); } }

Target:
public Map<String, Integer> getColumnSizes() throws IOException { return boxStore.getBoxColumnSizes(); }
Source:
public FormValidation doCheckDescription(@QueryParameter final String value) { if (Util.fixEmpty(value) == null) { return FormValidation.error("You should provide a description."); } if (CauseManagement.NEW_CAUSE_DESCRIPTION.equalsIgnoreCase(value.trim())) { return FormValidation.error("Bad description."); } return FormValidation.ok(); }

Target:
public FormValidation doCheckDescription(@QueryParameter final String value) { Jenkins.getInstance().checkPermission(PluginImpl.UPDATE_PERMISSION); if (Util.fixEmpty(value) == null) { return FormValidation.error("You should provide a description."); } if (CauseManagement.NEW_CAUSE_DESCRIPTION.equalsIgnoreCase(value.trim())) { return FormValidation.error("Bad description."); } return FormValidation.ok(); }
Source:
private static Scope getDeepestCommonScope(Symbol symbol, Usage declaration) { Set<Usage> usages = new HashSet<>(symbol.usages()); if (!declaration.isWrite()) { usages.remove(declaration); } Map<Scope, Integer> scopeDepthMap = new HashMap<>(); for (Usage usage : usages) { Scope scope = usage.identifierTree().scope(); scopeDepthMap.put(scope, getScopeDepth(scope)); } int minDepth = Collections.min(scopeDepthMap.values()); Set<Scope> scopes = new HashSet<>(); for (Entry<Scope, Integer> entry : scopeDepthMap.entrySet()) { scopes.add(raisedScope(entry.getKey(), entry.getValue() - minDepth)); } while (scopes.size() != 1) { scopes = allScopesRaiseOneLevel(scopes); } return (Scope) scopes.toArray()[0]; }

Target:
private static Scope getDeepestCommonScope(Symbol symbol, Usage declaration) { Set<Usage> usages = new HashSet<>(symbol.usages()); if (!declaration.isWrite()) { usages.remove(declaration); } Map<Scope, Integer> scopeDepthMap = new HashMap<>(); for (Usage usage : usages) { Scope scope = usage.identifierTree().scope(); scopeDepthMap.put(scope, getScopeDepth(scope)); } int minDepth = Collections.min(scopeDepthMap.values()); Set<Scope> sameDepthScopes = new HashSet<>(); for (Entry<Scope, Integer> entry : scopeDepthMap.entrySet()) { sameDepthScopes.add(getAncestorScope(entry.getKey(), entry.getValue() - minDepth)); } while (sameDepthScopes.size() != 1) { sameDepthScopes = outerScopes(sameDepthScopes); } return sameDepthScopes.iterator().next(); }
Source:
public List<LegacyStressor> execute() { long startTime = TimeService.currentTimeMillis(); completion = createCompletion(); finishCountDown = new CountDownLatch(1); completion.setCompletionHandler(new Runnable() { @Override public void run() { if (duration > 0) { finished = true; } finishCountDown.countDown(); } }); operationSelector = wrapOperationSelector(createOperationSelector()); List<LegacyStressor> stressors = startStressors(); if (rampUp > 0) { try { Thread.sleep(rampUp); } catch (InterruptedException e) { throw new IllegalStateException("Interrupted during ramp-up.", e); } } while (!isStarted()) { int stressorStartedCount = 0; for (LegacyStressor stressor : stressors) { if (stressor.isStarted()) { stressorStartedCount++; } } started = (stressorStartedCount == stressors.size()); } try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) { throw new TestTimeoutException(); } else { if (!finishCountDown.await(waitTime, TimeUnit.MILLISECONDS)) { throw new TestTimeoutException(); } } } else { finishCountDown.await(); } } catch (InterruptedException e) { throw new IllegalStateException("Unexpected interruption", e); } for (Thread stressorThread : stressors) { try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) throw new TestTimeoutException(); stressorThread.join(waitTime); } else { stressorThread.join(); } } catch (InterruptedException e) { throw new TestTimeoutException(e); } } return stressors; }

Target:
public List<LegacyStressor> execute() { long startTime = TimeService.currentTimeMillis(); completion = createCompletion(); finishCountDown = new CountDownLatch(1); completion.setCompletionHandler(new Runnable() { @Override public void run() { if (duration > 0) { finished = true; } finishCountDown.countDown(); } }); operationSelector = wrapOperationSelector(createOperationSelector()); List<LegacyStressor> stressors = startStressors(); if (rampUp > 0) { try { Thread.sleep(rampUp); } catch (InterruptedException e) { throw new IllegalStateException("Interrupted during ramp-up.", e); } } started = true; try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) { throw new TestTimeoutException(); } else { if (!finishCountDown.await(waitTime, TimeUnit.MILLISECONDS)) { throw new TestTimeoutException(); } } } else { finishCountDown.await(); } } catch (InterruptedException e) { throw new IllegalStateException("Unexpected interruption", e); } for (Thread stressorThread : stressors) { try { if (timeout > 0) { long waitTime = getWaitTime(startTime); if (waitTime <= 0) throw new TestTimeoutException(); stressorThread.join(waitTime); } else { stressorThread.join(); } } catch (InterruptedException e) { throw new TestTimeoutException(e); } } return stressors; }
Source:
private Map<String, String> fetchResources(String path) throws DeploymentEnvironmentException { Map<String, String> resources = new HashMap<String, String>(); Map<String, Object> map; FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(new File(path)); map = (Map<String, Object>) new Yaml().load(fileInputStream); } catch (FileNotFoundException e) { throw new DeploymentEnvironmentException("Unable to find the profile for the given product", e); } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException ignore) { } } } if (map.get(KIND).toString().equalsIgnoreCase(KIND_LIST)) { for (LinkedHashMap item : (List<LinkedHashMap>) map.get(ITEMS)) { resources.put(item.get(KIND).toString(), new Yaml().dump(item)); } } else { resources.put(map.get(KIND).toString(), new Yaml().dump(map)); } return resources; }

Target:
private Map<String, String> fetchResources(String path) throws DeploymentEnvironmentException { Map<String, String> resources = new HashMap<String, String>(); Map<String, Object> map; FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream(new File(path)); map = (Map<String, Object>) new Yaml().load(fileInputStream); } catch (FileNotFoundException e) { throw new DeploymentEnvironmentException("Unable to find the profile for the given product", e); } finally { if (fileInputStream != null) { try { fileInputStream.close(); } catch (IOException ignore) { } } } String kindValue = (map.get(KIND) != null) ? map.get(KIND).toString() : null; if (kindValue == null) { throw new DeploymentEnvironmentException("Kind property not found in Kubernetes resource: " + path); } if (kindValue.equalsIgnoreCase(LIST)) { List<LinkedHashMap> items = (List<LinkedHashMap>) map.get(ITEMS); for (LinkedHashMap item : items) { resources.put(item.get(KIND).toString(), new Yaml().dump(item)); } } else { resources.put(kindValue, new Yaml().dump(map)); } return resources; }
Source:
private void validateNodeSourceNameOrFail(String nodeSourceName) { if (nodeSourceName.length() == 0) { throw new IllegalArgumentException("Node Source Name cannot be empty"); } if (undeployedNodeSources.containsKey(nodeSourceName) || deployedNodeSources.containsKey(nodeSourceName)) { throw new NodeSourceNameAlreadyExistException("Node Source name " + nodeSourceName + " already exist"); } Pattern pattern = Pattern.compile("[^-\\w]"); Matcher matcher = pattern.matcher(nodeSourceName); if (matcher.find()) { throw new IllegalArgumentException("Node Source name \"" + nodeSourceName + "\" is invalid because it contains invalid characters. Only [-a-zA-Z_0-9] are valid."); } }

Target:
private void validateNodeSourceNameOrFail(String nodeSourceName) { if (nodeSourceName.length() == 0) { throw new IllegalArgumentException("Node Source Name cannot be empty"); } if (this.undeployedNodeSources.containsKey(nodeSourceName) || this.deployedNodeSources.containsKey(nodeSourceName)) { throw new NodeSourceNameAlreadyExistException("Node Source name " + nodeSourceName + " already exist"); } Pattern pattern = Pattern.compile("[^-\\w]"); Matcher matcher = pattern.matcher(nodeSourceName); if (matcher.find()) { throw new IllegalArgumentException("Node Source name \"" + nodeSourceName + "\" is invalid because it contains invalid characters. Only [-a-zA-Z_0-9] are valid."); } }
Source:
public void getCohortsContainingPatient_shouldReturnCohortsThatHaveGivenPatient() throws Exception { executeDataSet(COHORT_XML); Patient patientToAdd = new Patient(7); service.addPatientToCohort(service.getCohort(2), patientToAdd); assertTrue(service.getCohort(2).contains(patientToAdd)); List<Cohort> cohortsWithGivenPatient = service.getCohortsContainingPatient(patientToAdd); assertTrue(cohortsWithGivenPatient.contains(service.getCohort(2))); }

Target:
public void getCohortsContainingPatient_shouldReturnCohortsThatHaveGivenPatient() throws Exception { executeDataSet(COHORT_XML); Patient patientToAdd = new Patient(7); service.addPatientToCohort(service.getCohort(2), patientToAdd); assertTrue(service.getCohort(2).contains(patientToAdd.getPatientId())); List<Cohort> cohortsWithGivenPatient = service.getCohortsContainingPatient(patientToAdd); assertTrue(cohortsWithGivenPatient.contains(service.getCohort(2))); }
Source:
public Entitlement ueberCertEntitlement(Consumer consumer, Pool pool) throws EntitlementRefusedException { Map<String, Integer> poolQuantities = new HashMap<String, Integer>(); poolQuantities.put(pool.getId(), 1); List<Entitlement> result = addOrUpdateEntitlements(consumer, poolQuantities, null, true, CallerType.UNKNOWN); if (result != null && !result.isEmpty()) { return result.get(0); } return null; }

Target:
public Entitlement ueberCertEntitlement(Consumer consumer, Pool pool) throws EntitlementRefusedException { Map<String, Integer> poolQuantities = new HashMap<String, Integer>(); poolQuantities.put(pool.getId(), 1); List<Entitlement> result = addOrUpdateEntitlements(consumer, poolQuantities, null, true, CallerType.UNKNOWN); if (CollectionUtils.isNotEmpty(result)) { return result.get(0); } return null; }
Source:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); step.setJobRepository(jobRepository); if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); jobRepository.saveStep(step); jobRepository.updateJobLastUpdateTime(id, lastUpdateTime); return step; }

Target:
public Step addStep(Step step) { lastUpdateTime = new Date(); step.setJobId(id); step.setStepNumber(steps.size()); if (step.getDescription() == null) { step.setDescription(step.getStepName()); } step.setCorrelationId(correlationId); steps.add(step); return step; }
Source:
public boolean onHttpResponseReceive(HttpMessage msg) { if (frontEndScannerEnabled && msg.getResponseHeader().isHtml()) { try { String html = msg.getResponseBody().toString(); Source document = new Source(html); List<Element> heads = document.getAllElements("head"); Element head = heads.isEmpty() ? null : heads.get(0); if (head != null && msg.getHistoryRef() != null) { String host = msg.getRequestHeader().getHeader("host"); String frontEndApiUrl = API .getInstance() .getCallBackUrl(this.api, "https://" + host); int historyReferenceId = msg.getHistoryRef().getHistoryId(); StringBuilder injectedContentBuilder = new StringBuilder() .append("<script type='text/javascript'>") .append("var frontEndScanner=(function() {") .append("const HISTORY_REFERENCE_ID = " + historyReferenceId + ";") .append("const CALLBACK_ENDPOINT = '" + frontEndApiUrl + "';"); appendUserScriptsTo(injectedContentBuilder); appendFrontEndScannerCodeTo(injectedContentBuilder); injectedContentBuilder .append("})();") .append("</script>"); OutputDocument newResponseBody = new OutputDocument(document); int insertPosition = head.getChildElements().get(0).getBegin(); newResponseBody.insert(insertPosition, injectedContentBuilder.toString()); msg.getResponseBody() .setBody(newResponseBody.toString()); int newLength = msg.getResponseBody().length(); msg.getResponseHeader().setContentLength(newLength); } else { LOGGER.debug("<head></head> is missing in the response"); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } return true; }

Target:
public boolean onHttpResponseReceive(HttpMessage msg) { if (frontEndScannerEnabled && msg.getResponseHeader().isHtml()) { try { String html = msg.getResponseBody().toString(); Source document = new Source(html); List<Element> heads = document.getAllElements("head"); Element head = heads.isEmpty() ? null : heads.get(0); if (head != null && msg.getHistoryRef() != null) { String host = msg.getRequestHeader().getHeader("host"); String frontEndApiUrl = API .getInstance() .getCallBackUrl(this.api, "https://" + host); int historyReferenceId = msg.getHistoryRef().getHistoryId(); StringBuilder injectedContentBuilder = new StringBuilder(67000) .append("<script type='text/javascript'>") .append("var frontEndScanner=(function() {") .append("const HISTORY_REFERENCE_ID = " + historyReferenceId + ";") .append("const CALLBACK_ENDPOINT = '" + frontEndApiUrl + "';"); appendUserScriptsTo(injectedContentBuilder); appendFrontEndScannerCodeTo(injectedContentBuilder); injectedContentBuilder .append("})();") .append("</script>"); OutputDocument newResponseBody = new OutputDocument(document); int insertPosition = head.getChildElements().get(0).getBegin(); newResponseBody.insert(insertPosition, injectedContentBuilder.toString()); msg.getResponseBody() .setBody(newResponseBody.toString()); int newLength = msg.getResponseBody().length(); msg.getResponseHeader().setContentLength(newLength); } else { LOGGER.debug("<head></head> is missing in the response"); } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } } return true; }
Source:
public void testGetValidSafeHTML() throws Exception { System.out.println("getValidSafeHTML"); Validator instance = ESAPI.validator(); ValidationErrorList errors = new ValidationErrorList(); HTMLValidationRule rule = new HTMLValidationRule("test"); ESAPI.validator().addRule(rule); assertEquals("Test.", ESAPI.validator().getRule("test").getValid("test", "Test. <script>alert(document.cookie)</script>")); String test1 = "<b>Jeff</b>"; String result1 = instance.getValidSafeHTML("test", test1, 100, false, errors); assertEquals(test1, result1); String test2 = "<a href=\"<LINK_0>\">Aspect Security</a>"; String result2 = instance.getValidSafeHTML("test", test2, 100, false, errors); assertEquals(test2, result2); String test3 = "Test. <script>alert(document.cookie)</script>"; assertEquals("Test.", rule.getSafe("test", test3)); assertEquals("Test. &lt;<div>load=alert()</div>", rule.getSafe("test", "Test. <<div on<script></script>load=alert()")); assertEquals("Test. <div>b</div>", rule.getSafe("test", "Test. <div style={xss:expression(xss)}>b</div>")); assertEquals("Test.", rule.getSafe("test", "Test. <script>alert(document.cookie)</script>")); assertEquals("Test. alert(document.cookie)", rule.getSafe("test", "Test. <s\tcript>alert(document.cookie)</script>")); assertEquals("Test. alert(document.cookie)", rule.getSafe("test", "Test. <s\tcript>alert(document.cookie)</script>")); }

Target:
public void testGetValidSafeHTML() throws Exception { System.out.println("getValidSafeHTML"); Validator instance = ESAPI.validator(); ValidationErrorList errors = new ValidationErrorList(); HTMLValidationRule rule = new HTMLValidationRule("test"); ESAPI.validator().addRule(rule); assertEquals("Test.", ESAPI.validator().getRule("test").getValid("test", "Test. <script>alert(document.cookie)</script>")); String test1 = "<b>Jeff</b>"; String result1 = instance.getValidSafeHTML("test", test1, 100, false, errors); assertEquals(test1, result1); String test2 = "<a href=\"<LINK_0>\">Aspect Security</a>"; String result2 = instance.getValidSafeHTML("test", test2, 100, false, errors); assertEquals(test2, result2); String test3 = "Test. <script>alert(document.cookie)</script>"; assertEquals("Test.", rule.getSafe("test", test3)); assertEquals("Test. &lt;<div>load=alert()</div>", rule.getSafe("test", "Test. <<div on<script></script>load=alert()")); assertEquals("Test. <div>b</div>", rule.getSafe("test", "Test. <div style={xss:expression(xss)}>b</div>")); assertEquals("Test. alert(document.cookie)", rule.getSafe("test", "Test. <s%00cript>alert(document.cookie)</script>")); assertEquals("Test. alert(document.cookie)", rule.getSafe("test", "Test. <s\tcript>alert(document.cookie)</script>")); assertEquals("Test. alert(document.cookie)", rule.getSafe("test", "Test. <s\tcript>alert(document.cookie)</script>")); }
Source:
void appendOp(String op, boolean binOp) { if (binOp) { if (getLastChar() != ' ' && op.charAt(0) != ',') { append(" "); } append(op); append(" "); } else { append(" "); append(op); } }

Target:
void appendOp(String op, boolean binOp) { if (getLastChar() != ' ' && op.charAt(0) != ',') { append(" "); } append(op); if (binOp) { append(" "); } }
Source:
public Flux<RemoveResult> all() { return Flux.defer(() -> { String statement = assembleDeleteQuery(); return template.getCouchbaseClientFactory().getCluster().reactive().query(statement, buildQueryOptions()) .onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }).flatMapMany(ReactiveQueryResult::rowsAsObject) .map(row -> new RemoveResult(row.getString("__id"), row.getLong("__cas"), Optional.empty())); }); }

Target:
public Flux<RemoveResult> all() { return Flux.defer(() -> { String statement = assembleDeleteQuery(); return template.getCouchbaseClientFactory().getCluster().reactive().query(statement, buildQueryOptions()) .onErrorMap(throwable -> { if (throwable instanceof RuntimeException) { return template.potentiallyConvertRuntimeException((RuntimeException) throwable); } else { return throwable; } }).flatMapMany(ReactiveQueryResult::rowsAsObject) .map(row -> new RemoveResult(row.getString(TemplateUtils.SELECT_ID), row.getLong(TemplateUtils.SELECT_CAS), Optional.empty())); }); }
Source:
@Override protected Object newModule() { try { Constructor<?> constructor = moduleClass.getDeclaredConstructor(); constructor.setAccessible(true); return constructor.newInstance(); } catch (InvocationTargetException e) { throw new IllegalArgumentException(e.getCause()); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Could not construct " + moduleClass.getName() + " as it lacks a no-args constructor. If this was an upstream module of an extension" + " graph then it should be noted by \"addsTo=\" and not \"includes=\". Otherwise," + " this module must be passed in as an instance, or a no-args constructor must be" + " added.", e); } catch (InstantiationException e) { throw new IllegalArgumentException("Failed to construct " + moduleClass.getName(), e); } catch (IllegalAccessException e) { throw new AssertionError(); } }

Target:
@Override protected Object newModule() { try { Constructor<?> constructor = moduleClass.getDeclaredConstructor(); constructor.setAccessible(true); return constructor.newInstance(); } catch (InvocationTargetException e) { throw new IllegalArgumentException(e.getCause()); } catch (NoSuchMethodException e) { throw new IllegalArgumentException("Could not construct " + moduleClass.getName() + " as it lacks an accessible no-args constructor. This module must be passed" + " in as an instance, or an accessible no-args constructor must be added.", e); } catch (InstantiationException e) { throw new IllegalArgumentException("Failed to construct " + moduleClass.getName(), e); } catch (IllegalAccessException e) { throw new AssertionError(); } }
Source:
S3GuardFsck(S3AFileSystem fs, MetadataStore ms) throws InvalidParameterException { this.rawFS = fs; if (ms == null) { throw new InvalidParameterException("S3AFileSystem should be guarded by" + " a " + DynamoDBMetadataStore.class.getCanonicalName()); } this.metadataStore = (DynamoDBMetadataStore) ms; if (rawFS.hasMetadataStore()) { throw new InvalidParameterException("Raw fs should not have a " + "metadatastore."); } }

Target:
public S3GuardFsck(S3AFileSystem fs, MetadataStore ms) throws InvalidParameterException { this.rawFS = fs; if (ms == null) { throw new InvalidParameterException("S3A Bucket " + fs.getBucket() + " should be guarded by a " + DynamoDBMetadataStore.class.getCanonicalName()); } this.metadataStore = (DynamoDBMetadataStore) ms; Preconditions.checkArgument(!rawFS.hasMetadataStore(), "Raw fs should not have a metadatastore."); }
Source:
ILogData read(long address, @NonNull ReadOptions options) { int count = 0; while (true) { try { return readNative (address, options); } catch (InterruptedException e) { if (++count == MAX_RETRIES) { log.error ("It has retried times, throw an exception {}", MAX_RETRIES, e); throw new UnrecoverableCorfuInterruptedError (e); } } } }

Target:
ILogData read(long address, @NonNull ReadOptions options) { int count = 0; while (true) { try { return readInner (address, options); } catch (InterruptedException e) { if (++count == MAX_RETRIES) { log.error ("It has retried times, throw an exception ", MAX_RETRIES, e); throw new UnrecoverableCorfuInterruptedError (e); } } } }
Source:
public static IPersistableElement createPersistableElement( final IExternalSourceModule module) { final IPersistableElement element = (IPersistableElement) ADAPTER_MANAGER .getAdapter(module, IPersistableElement.class); if (element != null) return element; return new IPersistableElement() { public String getFactoryId() { return FACTORY_ID; } public void saveState(IMemento memento) { memento.putString(KEY, module.getHandleIdentifier()); } }; }

Target:
public static IPersistableElement createPersistableElement( final IExternalSourceModule module) { IAdapterManager ADAPTERS = Platform.getAdapterManager(); final IPersistableElement element = (IPersistableElement) ADAPTERS .getAdapter(module, IPersistableElement.class); if (element != null) return element; return new IPersistableElement() { public String getFactoryId() { return FACTORY_ID; } public void saveState(IMemento memento) { memento.putString(KEY, module.getHandleIdentifier()); } }; }
Source:
public ARXClassificationConfiguration getCurrentConfiguration(){ return configCurrent; }

Target:
public ARXClassificationConfiguration getCurrentConfiguration(){ if (this.configCurrent == null) { this.configCurrent = getLogisticRegressionConfiguration(); } return configCurrent; }
Source:
public <T> T getData(Class<T> clazz, JsonSerializer dataDeserializer) { if (!parsed) { throw new IllegalStateException("This method should only be called on events created through the parse method"); } return dataDeserializer.deserialize(new ByteArrayInputStream((byte[]) this.event.getData()), TypeReference.createInstance(clazz)); }

Target:
public <T> T getData(Class<T> clazz, JsonSerializer dataDeserializer) { return getDataAsync(clazz, dataDeserializer).block(); }
Source:
public void testTimerBoundaryEventInterruptingOnTaskCancelTimer() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-TimerBoundaryEventInterruptingOnTaskCancelTimer.bpmn2"); ksession = createKnowledgeSession(kbase); TestWorkItemHandler handler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent"); assertProcessInstanceActive(processInstance); Collection<TimerInstance> timers = getTimerManager(ksession).getTimers(); assertEquals(1, timers.size()); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); timers = getTimerManager(ksession).getTimers(); assertEquals(1, timers.size()); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); timers = getTimerManager(ksession).getTimers(); assertTrue(timers == null || timers.isEmpty()); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); assertProcessInstanceFinished(processInstance, ksession); }

Target:
public void testTimerBoundaryEventInterruptingOnTaskCancelTimer() throws Exception { KieBase kbase = createKnowledgeBase("BPMN2-TimerBoundaryEventInterruptingOnTaskCancelTimer.bpmn2"); ksession = createKnowledgeSession(kbase); TestWorkItemHandler handler = new TestWorkItemHandler(); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); ProcessInstance processInstance = ksession.startProcess("TimerBoundaryEvent"); assertProcessInstanceActive(processInstance); Collection<TimerInstance> timers = getTimerManager(ksession).getTimers(); assertEquals(1, timers.size()); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); timers = getTimerManager(ksession).getTimers(); assertEquals(1, timers.size()); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); ksession = restoreSession(ksession, true); ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler); timers = getTimerManager(ksession).getTimers(); Assertions.assertThat(timers).isNullOrEmpty(); ksession.getWorkItemManager().completeWorkItem(handler.getWorkItem().getId(), null); assertProcessInstanceFinished(processInstance, ksession); }
Source:
public void setXValues(String... values) { if (xValues == null) { xValues = new ArrayList<>(); } xValues.clear(); xValues.addAll(Arrays.asList(values)); }

Target:
public void setXValues(String... values) { if (xValues == null) { xValues = new ArrayList<>(); } else { xValues.clear(); } xValues.addAll(Arrays.asList(values)); }
Source:
static final public String[] fromBoolean(Boolean[] values) { return (Stream.of(values).map(value->ValueConverter.BooleanToString(value)).toArray(String[]::new)); }

Target:
static final public String[] fromBoolean(Boolean[] values) { return ValueConverter.convert(values, ValueConverter::BooleanToString); }
Source:
private void createDoseUnitsWidget(FormEntryContext context) { doseUnitsWidget = new DropdownWidget(); List<Concept> concepts = Context.getOrderService().getDrugDosingUnits(); List<Option> options = new ArrayList<Option>(); if (context.getMode() != Mode.VIEW) { for (Concept concept : concepts) { options.add(new Option(concept.getName().getName(), concept.getId().toString(), false)); } if (!concepts.isEmpty()) { doseUnitsWidget.setInitialValue(concepts.get(0).getId()); } } doseUnitsWidget.setOptions(options); context.registerWidget(doseUnitsWidget); }

Target:
private void createDoseUnitsWidget(FormEntryContext context) { doseUnitsWidget = new DropdownWidget(); List<Concept> concepts = Context.getOrderService().getDrugDosingUnits(); List<Option> options = new ArrayList<Option>(); for (Concept concept : concepts) { options.add(new Option(concept.getName().getName(), concept.getId().toString(), false)); } setupDropdownWidget(context, doseUnitsWidget, options); }
Source:
public boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { Log_OC.d(TAG, "File NOT deleted " + children[i]); return false; } else { Log_OC.d(TAG, "File deleted " + children[i]); } } } return dir.delete(); }

Target:
public boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); if (children != null) { for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { Log_OC.w(TAG, "File NOT deleted " + children[i]); return false; } else { Log_OC.d(TAG, "File deleted " + children[i]); } } } else { return false; } } return dir.delete(); }
Source:
public Query toQuery(Set<ValueIndexTerm> terms) { ValueSharedPartIndexTerm sharedPartIndexTerm = null; ValueModuleRootPathIndexTerm moduleRootPathIndexTerm = null; ValuePackageNameIndexTerm packageNameIndexTerm = null; for (ValueIndexTerm term : terms) { if (term instanceof ValueSharedPartIndexTerm) { sharedPartIndexTerm = (ValueSharedPartIndexTerm) term; } else if (term instanceof ValueModuleRootPathIndexTerm) { moduleRootPathIndexTerm = (ValueModuleRootPathIndexTerm) term; } else if (term instanceof ValuePackageNameIndexTerm) { packageNameIndexTerm = (ValuePackageNameIndexTerm) term; } } final SearchEmptyQueryBuilder queryBuilder = new SearchEmptyQueryBuilder() .addTerm(sharedPartIndexTerm); if (moduleRootPathIndexTerm != null) { queryBuilder.addTerm(moduleRootPathIndexTerm); } if (packageNameIndexTerm != null) { queryBuilder.addTerm(packageNameIndexTerm); } return queryBuilder.build(); }

Target:
public Query toQuery(Set<ValueIndexTerm> terms) { final SearchEmptyQueryBuilder queryBuilder = new SearchEmptyQueryBuilder(); for (ValueIndexTerm term : terms) { if (term instanceof ValueSharedPartIndexTerm) { queryBuilder.addTerm(term); } else if (term instanceof ValueModuleRootPathIndexTerm) { queryBuilder.addTerm(term); } else if (term instanceof ValuePackageNameIndexTerm) { queryBuilder.addTerm(term); } } return queryBuilder.build(); }
Source:
private static HashMap<String, LinkedHashMap<String, String>> getCommonScopeByDomain(HashMap<String, Set<String>> beanKeysByDomain, HashMap<String, LinkedList<Filter>> filtersByDomain){ HashMap<String, LinkedHashMap<String, String>> commonScopeByDomain = new HashMap<String, LinkedHashMap<String, String>>(); Iterator<Entry<String, Set<String>>> commonParametersByDomainItr = beanKeysByDomain.entrySet().iterator(); while(commonParametersByDomainItr.hasNext()){ Entry<String, Set<String>> commonParametersByDomainEntry = commonParametersByDomainItr.next(); String domainName = (String) commonParametersByDomainEntry.getKey(); Set<String> commonParameters = (Set<String>) commonParametersByDomainEntry.getValue(); LinkedList<Filter> filters = filtersByDomain.get(domainName); LinkedHashMap<String, String> commonScope = new LinkedHashMap<String, String>(); for (String parameter : commonParameters) { String commonValue = null; Boolean hasCommonValue = true; Iterator<Filter> filtersItr = filters.iterator(); while(filtersItr.hasNext() && hasCommonValue){ Filter f = filtersItr.next(); ArrayList<String> parameterValues = f.getParameterValues(parameter); if (parameterValues.size() != 1 || (commonValue != null && !commonValue.equals(parameterValues.get(0)))) { hasCommonValue = false; continue; } commonValue = parameterValues.get(0); } if (hasCommonValue) { commonScope.put(parameter, commonValue); } } commonScopeByDomain.put(domainName, commonScope); } return commonScopeByDomain; }

Target:
private static HashMap<String, LinkedHashMap<String, String>> getCommonScopeByDomain(HashMap<String, Set<String>> beanKeysByDomain, HashMap<String, LinkedList<Filter>> filtersByDomain){ HashMap<String, LinkedHashMap<String, String>> commonScopeByDomain = new HashMap<String, LinkedHashMap<String, String>>(); for (Entry<String, Set<String>> commonParametersByDomainEntry : beanKeysByDomain.entrySet()) { String domainName = commonParametersByDomainEntry.getKey(); Set<String> commonParameters = commonParametersByDomainEntry.getValue(); LinkedList<Filter> filters = filtersByDomain.get(domainName); LinkedHashMap<String, String> commonScope = new LinkedHashMap<String, String>(); for (String parameter : commonParameters) { String commonValue = null; Boolean hasCommonValue = true; for (Filter f : filters) { ArrayList<String> parameterValues = f.getParameterValues(parameter); if (parameterValues.size() != 1 || (commonValue != null && !commonValue.equals(parameterValues.get(0)))) { hasCommonValue = false; break; } commonValue = parameterValues.get(0); } if (hasCommonValue) { commonScope.put(parameter, commonValue); } } commonScopeByDomain.put(domainName, commonScope); } return commonScopeByDomain; }
Source:
public void shouldRejectRequestWithInvalidTokenFormat() throws IOException, ServletException { when(request.getHeader(eq("Authentication"))).thenReturn("xxx"); filter.doFilter(request, response, filterChain); assertNotNull(capturedContext.get()); assertNull(capturedContext.get().getAuthentication()); }

Target:
public void shouldRejectRequestWithInvalidTokenFormat() throws IOException, ServletException { when(request.getServletPath()).thenReturn("/actuator/prometheus"); when(request.getHeader(eq("Authorization"))).thenReturn("xxx"); filter.doFilter(request, response, filterChain); assertNull(capturedAuthentication.get()); }
Source:
private QueryRequest createQueryRequestForSubscribedToWorkspaces() { Set<String> ids = new HashSet<>(); try { List<Map<String, Object>> subscriptions = persistentStore.get(SubscriptionsPersistentStore.SUBSCRIPTIONS_TYPE); ids = subscriptions .stream() .map(subscription -> subscription.get(ID_FIELD)) .filter(Objects::nonNull) .map(Object::toString) .collect(Collectors.toSet()); } catch (PersistenceException e) { LOGGER.debug("Failed to get subscriptions for workspaces: {}", e.getMessage(), e); } if (ids.isEmpty()) { return null; } return createQueryRequest(workspaceQueryBuilder.createFilter(ids)); }

Target:
private Optional<QueryRequest> createQueryRequestForSubscribedToWorkspaces() { final List<Map<String, Object>> subscriptions = findSubscriptions(); if (subscriptions.isEmpty()) { return Optional.empty(); } final Set<String> ids = getIdsFromSubscriptions(subscriptions); return Optional.of(getQueryRequestFromIds(ids)); }
Source:
public void searchPayments_withMandateId_whenCardPayment_shouldReturnABadRequestResponse() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.of("agreement_id", "my_agreement")) .statusCode(400) .contentType(JSON).extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: agreement_id=my_agreement. See Public API documentation for the correct data formats")); }

Target:
public void searchPayments_withMandateId_whenCardPayment_shouldReturnABadRequestResponse() throws Exception { InputStream body = searchPayments(API_KEY, ImmutableMap.of("agreement_id", "my_agreement")) .statusCode(400) .contentType(JSON).extract() .body().asInputStream(); JsonAssert.with(body) .assertThat("$.*", hasSize(2)) .assertThat("$.code", is("P0401")) .assertThat("$.description", is("Invalid parameters: agreement_id. See Public API documentation for the correct data formats")); }
Source:
private String resolveStringWithSymbols(String originalCellText) throws NoSuchSymbolException { Pattern p = Pattern.compile(REGEX_STRING_WITH_SYMBOL); Matcher m = p.matcher(originalCellText); String newText = null; while (m.matches()) { String symbolValue = getSymbolValue(m.group(3)); newText = m.group(1) + symbolValue + m.group(5); m = p.matcher(newText); } return newText; }

Target:
private String resolveStringWithSymbols(String originalCellText) throws NoSuchSymbolException { Matcher m = STRING_WITH_SYMBOL_PATTERN.matcher(originalCellText); String newText = null; while (m.matches()) { String symbolValue = getSymbolValue(m.group(3)); newText = m.group(1) + symbolValue + m.group(5); m = STRING_WITH_SYMBOL_PATTERN.matcher(newText); } return newText; }
Source:
public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { log.info("Waiting on SPM availability to confirm image removal (timeout is minutes)", LIFETIME); setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }

Target:
public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { log.info("Waiting on SPM availability to confirm image removal (timeout is minutes)", getParameters().getLifeInMinutes()); setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }
Source:
TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator( CommonApplicationProperties commonApplicationProperties, ApplicationConfigurationMetadataResolver metadataResolver) { return new TaskAppDeploymentRequestCreator(commonApplicationProperties, metadataResolver, null); }

Target:
public TaskAppDeploymentRequestCreator taskAppDeploymentRequestCreator( CommonApplicationProperties commonApplicationProperties, ApplicationConfigurationMetadataResolver metadataResolver) { return new TaskAppDeploymentRequestCreator(commonApplicationProperties, metadataResolver, null); }
Source:
public void onResume() { super.onResume(); RecyclerView recyclerView = getListView(); for (int i = 0; i <= recyclerView.getChildCount(); i++) { View child = recyclerView.getChildAt(i); if (child != null) { mAdapter.updatePlusOne((NewsAdapter.ViewHolder) recyclerView.getChildViewHolder(child)); } } }

Target:
public void onResume() { super.onResume(); RecyclerView recyclerView = getListView(); for (int i = 0, size = recyclerView.getChildCount(); i <= size; i++) { View child = recyclerView.getChildAt(i); if (child != null) { mAdapter.updatePlusOne((NewsAdapter.ViewHolder) recyclerView.getChildViewHolder(child)); } } }
Source:
public DefaultHttpContent(ByteBuf content) { ObjectUtil.checkNotNull(content, "content"); this.content = content; }

Target:
public DefaultHttpContent(ByteBuf content) { this.content = ObjectUtil.checkNotNull(content, "content"); }
Source:
public void dragEnter(DropTargetDragEvent dragEvent) { NlDropEvent event = new NlDropEvent(dragEvent); if (myCurrentInteraction == null) { Point location = event.getLocation(); myLastMouseX = location.x; myLastMouseY = location.y; ScreenView screenView = mySurface.getScreenView(myLastMouseX, myLastMouseY); if (screenView == null) { event.reject(); return; } NlModel model = screenView.getModel(); DnDTransferItem item = NlModel.getTransferItem(event.getTransferable(), true ); if (item == null) { event.reject(); return; } DragType dragType = event.getDropAction() == DnDConstants.ACTION_COPY ? DragType.COPY : DragType.MOVE; InsertType insertType = model.determineInsertType(dragType, item, true ); List<NlComponent> dragged = model.createComponents(screenView, item, insertType); if (dragged == null) { event.reject(); return; } int yOffset = 0; for (NlComponent component : dragged) { component.x = Coordinates.getAndroidX(screenView, myLastMouseX) - component.w / 2; component.y = Coordinates.getAndroidY(screenView, myLastMouseY) - component.h / 2 + yOffset; yOffset += component.h; } DragDropInteraction interaction = new DragDropInteraction(mySurface, dragged); interaction.setType(dragType); interaction.setTransferItem(item); startInteraction(myLastMouseX, myLastMouseY, interaction, 0); event.accept(insertType.isCreate() ? DnDConstants.ACTION_COPY : event.getDropAction()); } }

Target:
public void dragEnter(DropTargetDragEvent dragEvent) { if (myCurrentInteraction == null) { NlDropEvent event = new NlDropEvent(dragEvent); Point location = event.getLocation(); myLastMouseX = location.x; myLastMouseY = location.y; ScreenView screenView = mySurface.getScreenView(myLastMouseX, myLastMouseY); if (screenView == null) { event.reject(); return; } NlModel model = screenView.getModel(); DnDTransferItem item = NlModel.getTransferItem(event.getTransferable(), true ); if (item == null) { event.reject(); return; } DragType dragType = event.getDropAction() == DnDConstants.ACTION_COPY ? DragType.COPY : DragType.MOVE; InsertType insertType = model.determineInsertType(dragType, item, true ); List<NlComponent> dragged = model.createComponents(screenView, item, insertType); if (dragged == null) { event.reject(); return; } int yOffset = 0; for (NlComponent component : dragged) { component.x = Coordinates.getAndroidX(screenView, myLastMouseX) - component.w / 2; component.y = Coordinates.getAndroidY(screenView, myLastMouseY) - component.h / 2 + yOffset; yOffset += component.h; } DragDropInteraction interaction = new DragDropInteraction(mySurface, dragged); interaction.setType(dragType); interaction.setTransferItem(item); startInteraction(myLastMouseX, myLastMouseY, interaction, 0); event.accept(insertType.isCreate() ? DnDConstants.ACTION_COPY : event.getDropAction()); } }
Source:
protected boolean validate() { return super.validate() && isImageExist() && checkOperationIsCorrect() && checkOperationAllowedOnDiskContentType() && isImageNotLocked() && isSourceAndDestTheSame() && validateSourceStorageDomain() && validateDestStorage() && checkTemplateInDestStorageDomain() && validateSpaceRequirements() && validateVmSnapshotStatus() && checkCanBeMoveInVm() && checkIfNeedToBeOverride() && setAndValidateDiskProfiles() && validatePassDiscardSupportedForDestinationStorageDomain() && isDiskInBackupDomain(); }

Target:
protected boolean validate() { return super.validate() && isImageExist() && checkOperationIsCorrect() && checkOperationAllowedOnDiskContentType() && isImageNotLocked() && isSourceAndDestTheSame() && validateSourceStorageDomain() && validateDestStorage() && checkTemplateInDestStorageDomain() && validateSpaceRequirements() && validateVmSnapshotStatus() && checkCanBeMoveInVm() && checkIfNeedToBeOverride() && setAndValidateDiskProfiles() && validatePassDiscardSupportedForDestinationStorageDomain(); }