auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void applyLocalVariableQualifierParameterDefaults( Element elt, AnnotatedTypeMirror type) { if (elt.getKind() != ElementKind.LOCAL_VARIABLE || getQualifierParameterHierarchies(type).isEmpty() || variablesUnderInitialization.contains(elt)) { return; } Tree declTree = declarationFromElement(elt); if (declTree == null || declTree.getKind() != Kind.VARIABLE) { return; } ExpressionTree initializer = ((VariableTree) declTree).getInitializer(); if (initializer == null) { return; } variablesUnderInitialization.add(elt); AnnotatedTypeMirror initializerType; if (shouldCache && initializerCache.containsKey(initializer)) { initializerType = initializerCache.get(initializer); } else { boolean oldUseFlow = useFlow; useFlow = everUseFlow; initializerType = getAnnotatedType(initializer); useFlow = oldUseFlow; } Set<AnnotationMirror> qualParamTypes = AnnotationUtils.createAnnotationSet(); for (AnnotationMirror initializerAnnotation : initializerType.getAnnotations()) { if (hasQualifierParameterInHierarchy( type, qualHierarchy.getTopAnnotation(initializerAnnotation))) { qualParamTypes.add(initializerAnnotation); } } type.addMissingAnnotations(qualParamTypes); variablesUnderInitialization.remove(elt); if (shouldCache) { initializerCache.put(initializer, initializerType); } }

Target:
private void applyLocalVariableQualifierParameterDefaults( Element elt, AnnotatedTypeMirror type) { if (elt.getKind() != ElementKind.LOCAL_VARIABLE || getQualifierParameterHierarchies(type).isEmpty() || variablesUnderInitialization.contains(elt)) { return; } Tree declTree = declarationFromElement(elt); if (declTree == null || declTree.getKind() != Kind.VARIABLE) { return; } ExpressionTree initializer = ((VariableTree) declTree).getInitializer(); if (initializer == null) { return; } VariableElement variableElt = (VariableElement) elt; variablesUnderInitialization.add(variableElt); AnnotatedTypeMirror initializerType; if (shouldCache && initializerCache.containsKey(initializer)) { initializerType = initializerCache.get(initializer); } else { boolean oldUseFlow = useFlow; useFlow = everUseFlow; try { initializerType = getAnnotatedType(initializer); } finally { useFlow = oldUseFlow; } } Set<AnnotationMirror> qualParamTypes = AnnotationUtils.createAnnotationSet(); for (AnnotationMirror initializerAnnotation : initializerType.getAnnotations()) { if (hasQualifierParameterInHierarchy( type, qualHierarchy.getTopAnnotation(initializerAnnotation))) { qualParamTypes.add(initializerAnnotation); } } type.addMissingAnnotations(qualParamTypes); variablesUnderInitialization.remove(variableElt); if (shouldCache) { initializerCache.put(initializer, initializerType); } }
Source:
private String startedStateString(final int state) { switch (state) { case NOT_STARTED : return "NOT_STARTED"; case STARTING : return "STARTING"; case STARTED : return "STARTED"; } return "UNKNOWN"; }

Target:
private String startedStateString(final int state) { switch (state) { case NOT_STARTED : return "NOT_STARTED"; case STARTING : return "STARTING"; case STARTED : return "STARTED"; } throw new IllegalArgumentException("Unknown state"); }
Source:
public void save(String id) { context.saveStyle(); HashMap<String, String> map = new HashMap<>(); Optional.ofNullable(id).ifPresent(node -> map.put(DEFAULT_NODE_ID, id)); context.addAttributes(map); }

Target:
public void save(String id) { context.saveStyle(); HashMap<String, String> map = new HashMap<>(); if (id != null) { map.put(DEFAULT_NODE_ID, id); } context.addAttributes(map); }
Source:
private void addSelfToCC(List<TaskAttribute> attributes) { TaskRepository repository = this.getTaskEditorPage().getTaskRepository(); if (repository.getUserName() == null) { return; } TaskAttribute root = getTaskData().getRoot(); TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED); if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER); if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC); if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) { return; } TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC); if (attrAddToCC == null) { attrAddToCC = getTaskData().getRoot().createMappedAttribute(TaskAttribute.ADD_SELF_CC); } attributes.add(attrAddToCC); }

Target:
private void addSelfToCC(List<TaskAttribute> attributes) { if (getTaskData().isNew()) { return; } TaskRepository repository = this.getTaskEditorPage().getTaskRepository(); if (repository.getUserName() == null) { return; } TaskAttribute root = getTaskData().getRoot(); TaskAttribute owner = root.getMappedAttribute(TaskAttribute.USER_ASSIGNED); if (owner != null && owner.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute reporter = root.getMappedAttribute(TaskAttribute.USER_REPORTER); if (reporter != null && reporter.getValue().indexOf(repository.getUserName()) != -1) { return; } TaskAttribute ccAttribute = root.getMappedAttribute(TaskAttribute.USER_CC); if (ccAttribute != null && ccAttribute.getValues().contains(repository.getUserName())) { return; } TaskAttribute attrAddToCC = getTaskData().getRoot().getMappedAttribute(TaskAttribute.ADD_SELF_CC); if (attrAddToCC == null) { attrAddToCC = getTaskData().getRoot().createMappedAttribute(TaskAttribute.ADD_SELF_CC); } attributes.add(attrAddToCC); }
Source:
public void handleEvent(HttpServletRequest request) throws GitLabApiException { if (!isValidSecretToken(request)) { String message = "X-Gitlab-Token mismatch!"; LOG.warning(message); throw new GitLabApiException(message); } String eventName = request.getHeader("X-Gitlab-Event"); LOG.info("handleEvent: X-Gitlab-Event=" + eventName); switch (eventName) { case BuildEvent.X_GITLAB_EVENT: case IssueEvent.X_GITLAB_EVENT: case MergeRequestEvent.X_GITLAB_EVENT: case NoteEvent.X_GITLAB_EVENT: case PipelineEvent.X_GITLAB_EVENT: case PushEvent.X_GITLAB_EVENT: case TagPushEvent.X_GITLAB_EVENT: case WikiPageEvent.X_GITLAB_EVENT: break; default: String message = "Unsupported X-Gitlab-Event, event Name=" + eventName; LOG.warning(message); throw new GitLabApiException(message); } try { Event event; if (LOG.isLoggable(Level.FINE)) { LOG.fine(HttpRequestUtils.getShortRequestDump(eventName + " webhook", true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOG.fine("Raw POST data:\n" + postData); event = jacksonJson.unmarshal(Event.class, postData); LOG.fine(event.getObjectKind() + " event:\n" + jacksonJson.marshal(event) + "\n"); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); event = jacksonJson.unmarshal(Event.class, reader); } fireEvent(event); } catch (IOException e) { LOG.warning("Error parsing JSON data, error=" + e.getMessage()); throw new GitLabApiException(e); } catch (Exception e) { LOG.warning("Unexpected error reading JSON data, error=" + e.getMessage()); throw new GitLabApiException(e); } }

Target:
public void handleEvent(HttpServletRequest request) throws GitLabApiException { if (!isValidSecretToken(request)) { String message = "X-Gitlab-Token mismatch!"; LOG.warning(message); throw new GitLabApiException(message); } String eventName = request.getHeader("X-Gitlab-Event"); LOG.info("handleEvent: X-Gitlab-Event=" + eventName); switch (eventName) { case BuildEvent.X_GITLAB_EVENT: case IssueEvent.X_GITLAB_EVENT: case MergeRequestEvent.X_GITLAB_EVENT: case NoteEvent.X_GITLAB_EVENT: case PipelineEvent.X_GITLAB_EVENT: case PushEvent.X_GITLAB_EVENT: case TagPushEvent.X_GITLAB_EVENT: case WikiPageEvent.X_GITLAB_EVENT: break; default: String message = "Unsupported X-Gitlab-Event, event Name=" + eventName; LOG.warning(message); throw new GitLabApiException(message); } try { Event event; if (LOG.isLoggable(Level.FINE)) { LOG.fine(HttpRequestUtils.getShortRequestDump(eventName + " webhook", true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOG.fine("Raw POST data:\n" + postData); event = jacksonJson.unmarshal(Event.class, postData); LOG.fine(event.getObjectKind() + " event:\n" + jacksonJson.marshal(event) + "\n"); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); event = jacksonJson.unmarshal(Event.class, reader); } fireEvent(event); } catch (Exception e) { LOG.warning("Error parsing JSON data, exception=" + e.getClass().getSimpleName() + ", error=" + e.getMessage()); throw new GitLabApiException(e); } }
Source:
public void test16ThreadsRateLimit20() throws ExecutionException, InterruptedException { Meter rate = new Meter(); List<ListenableFuture<?>> tasks = createWorkers(rate, 16, 20, Duration.ofMillis(100)) .map(executorService::submit) .collect(Collectors.toList()); ListenableFuture<?> task = Futures.allAsList(tasks); while (!task.isDone()) { sleep(1000); log.info("Average rate is {}, 1 minute rate is {}", rate.getMeanRate(), rate.getOneMinuteRate()); } task.get(); }

Target:
public void test16ThreadsRateLimit20() throws ExecutionException, InterruptedException { Meter rate = new Meter(); Histogram avgRetries = new Histogram(new ExponentiallyDecayingReservoir()); int rateLimit = 20; List<ListenableFuture<?>> tasks = createWorkers(rate, avgRetries, 16, rateLimit, Duration.ofMillis(50)) .map(executorService::submit) .collect(Collectors.toList()); ListenableFuture<?> task = Futures.allAsList(tasks); Instant start = Instant.now(); while (!task.isDone()) { sleep(1000); log.info("Average rate is {}, 1 minute rate is {}", rate.getMeanRate(), rate.getOneMinuteRate()); log.info("Average number of retries is {}, max is {}", avgRetries.getSnapshot().getMean(), avgRetries.getSnapshot().getMax()); if (Duration.between(start, Instant.now()).compareTo(GRACE) > 0) { assertThat(rate.getMeanRate()).isGreaterThan(0.75 * rateLimit); } } task.get(); }
Source:
public void before(){ browser.navigate().refresh(); Graphene.goTo(WebServiceEndpointsPage.class); browser.manage().window().maximize(); Console.withBrowser(browser).waitUntilLoaded(); }

Target:
public void before(){ browser.navigate().refresh(); Graphene.goTo(WebServiceEndpointsPage.class); Console.withBrowser(browser).maximizeWindow().waitUntilLoaded(); }
Source:
private List<TypeSpec> getSubTypes() { ArrayList<TypeSpec> results = new ArrayList(); results.add(getSharedTriggers()); results.add(getNullSharedTriggers(sharedTriggersType)); return results; }

Target:
private List<TypeSpec> getSubTypes() { ArrayList<TypeSpec> results = new ArrayList<>(); results.add(getSharedTriggers()); results.add(getNullSharedTriggers(sharedTriggersType)); return results; }
Source:
private boolean setSealedReplicas(List<String> sealedReplicas) { InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); if (instanceConfig == null) { throw new IllegalStateException( "No instance config found for cluster: \"" + clusterName + "\", instance: \"" + instanceName + "\""); } logger.trace("Setting InstanceConfig with list of sealed replicas: {}", Arrays.toString(sealedReplicas.toArray())); instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); return helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }

Target:
private boolean setSealedReplicas(List<String> sealedReplicas) { InstanceConfig instanceConfig = helixAdmin.getInstanceConfig(clusterName, instanceName); if (instanceConfig == null) { throw new IllegalStateException( "No instance config found for cluster: \"" + clusterName + "\", instance: \"" + instanceName + "\""); } logger.trace("Setting InstanceConfig with list of sealed replicas: {}", sealedReplicas.toArray()); instanceConfig.getRecord().setListField(ClusterMapUtils.SEALED_STR, sealedReplicas); return helixAdmin.setInstanceConfig(clusterName, instanceName, instanceConfig); }
Source:
public synchronized PageCursor openCursor( long pageId, PagedIndexInput owner ) throws IOException { assert owner.cursor == null : String.format( "Multiple cursors opened for the same input: %s", owner ); if ( clones == null ) { throw new IOException( "This index has been closed, cannot open more inputs" ); } PageCursor cursor = pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ); if ( owner.resources != this ) { clones.add( owner ); } return cursor; }

Target:
public PageCursor openCursor( long pageId, PagedIndexInput owner ) throws IOException { assert owner.cursor == null : String.format( "Multiple cursors opened for the same input: %s", owner ); if ( closed ) { throw new IOException( "This index has been closed, cannot open more inputs" ); } return pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ); }
Source:
public boolean updateConfiguration(File file) throws IOException, SAXException, ParserConfigurationException, TransformerException, XMLStreamException, ServletException { boolean success = false; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); if (file.exists()) { Document doc = docBuilder.parse(file); String fileContent = getStringFromDocument(doc); success = configServiceAdminStub.updateConfiguration(createOMElement(fileContent)); } return success; }

Target:
public boolean updateConfiguration(File file) throws IOException, SAXException, ParserConfigurationException, TransformerException, XMLStreamException { boolean success = false; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); if (file.exists()) { Document doc = docBuilder.parse(file); String fileContent = getStringFromDocument(doc); success = configServiceAdminStub.updateConfiguration(createOMElement(fileContent)); } return success; }
Source:
public String toString() { String str = "\n"; if (!fTracingSupported) { return "\nTracing is not supported\n"; } if (fBackend.getSessionType() == SessionType.CORE) { str += "Off-line trace visualization\n"; } else { str += "Tracing with live execution\n"; } if (fCurrentRecordDmc instanceof MITraceRecordDMContext) { str += "Looking at trace frame " + ((MITraceRecordDMContext)fCurrentRecordDmc).getRecordId() + ", tracepoint " + fTracepointIndexForTraceRecord + "\n\n"; } else { str += "Not currently looking at any trace frame\n\n"; } str += "Tracing is currently" + (!fTracingActive ? " not":"") + " active\n"; str += "Buffer contains " + fNumberOfCollectedFrames + " trace frame" + (fNumberOfCollectedFrames>1?"s":"") + "\n"; str += "Currently using " + (fTotalBufferSize - fFreeBufferSize) + " bytes out of " + fTotalBufferSize + "\n"; if (fStopReason != null) { assert !fTracingActive; str += "Tracing stopped because of"; if (fStopReason == STOP_REASON_ENUM.REQUEST) { str += " user request"; } else if (fStopReason == STOP_REASON_ENUM.PASSCOUNT) { str += " passcount"; if (fStoppingTracepoint != null) { str += " of tracepoint number " + fStoppingTracepoint; } } else if (fStopReason == STOP_REASON_ENUM.OVERFLOW) { str += " buffer full"; } else if (fStopReason == STOP_REASON_ENUM.DISCONNECTION) { str += " disconnection"; } else if (fStopReason == STOP_REASON_ENUM.ERROR) { str += " error"; } else { str += " unknow reason"; } str += "\n"; } return str; }

Target:
public String toString() { String str = "\n"; if (!fTracingSupported) { return "\nTracing is not supported\n"; } if (fBackend.getSessionType() == SessionType.CORE) { str += "Off-line trace visualization\n"; } else { str += "Tracing with live execution\n"; } str += "Tracing is currently" + (!isTracingActive() ? " not":"") + " active\n"; str += "Buffer contains " + getNumberOfCollectedFrame() + " trace frame" + (getNumberOfCollectedFrame() > 1 ? "s" : "") + "\n"; str += "Currently using " + (getTotalBufferSize() - getFreeBufferSize()) + " bytes out of " + getTotalBufferSize() + "\n"; if (getStopReason() != null) { assert !isTracingActive(); str += "Tracing stopped because of"; if (getStopReason() == STOP_REASON_ENUM.REQUEST) { str += " user request"; } else if (getStopReason() == STOP_REASON_ENUM.PASSCOUNT) { str += " passcount"; if (getStoppingTracepoint() != null) { str += " of tracepoint number " + getStoppingTracepoint(); } } else if (info.getStopReason() == STOP_REASON_ENUM.OVERFLOW) { str += " buffer full"; } else if (info.getStopReason() == STOP_REASON_ENUM.DISCONNECTION) { str += " disconnection"; } else if (info.getStopReason() == STOP_REASON_ENUM.ERROR) { str += " error"; } else { str += " unknow reason"; } str += "\n"; } return str; }
Source:
private static String propertiesAsString(Properties properties) { Stream<Entry<Object, Object>> stream = properties.entrySet().stream(); String propAsString = stream.map(e -> encodeEntry(e)).collect(Collectors.joining("|")); return propAsString; }

Target:
private static String propertiesAsString(Properties properties) { Stream<Entry<Object, Object>> stream = properties.entrySet().stream(); String propAsString = stream.map(e -> encodeEntry(e)).collect(Collectors.joining(PROPERTIES_SEPARATOR)); return propAsString; }
Source:
protected void executeCommand() { DiskImage diskImage = getDiskImage(); OpenStackImageProviderProxy proxy = getProviderProxy(); acquireImageDbLock(); String newImageId = proxy.createImageFromDiskImage(diskImage); getParameters().setParentCommand(ActionType.ExportRepoImage); Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupID())); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.UploadImage, new UploadImageVDSCommandParameters( getStorageDomain().getStoragePoolId(), getStorageDomain().getId(), diskImage.getId(), diskImage.getImageId(), new HttpLocationInfo( getProviderProxy().getImageUrl(getCluster().getCompatibilityVersion(), newImageId), getProviderProxy().getUploadHeaders() ) )); if (vdsReturnValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Disk, getParameters().getImageGroupID(), getParameters().getDestinationDomainId())); } getReturnValue().setActionReturnValue(newImageId); setSucceeded(true); }

Target:
protected void executeCommand() { DiskImage diskImage = getDiskImage(); OpenStackImageProviderProxy proxy = getProviderProxy(); acquireImageDbLock(); String newImageId = proxy.createImageFromDiskImage(diskImage); getParameters().setParentCommand(ActionType.ExportRepoImage); Guid taskId = persistAsyncTaskPlaceHolder(getParameters().getParentCommand()); getParameters().setEntityInfo(new EntityInfo(VdcObjectType.Disk, getParameters().getImageGroupID())); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.UploadImage, new UploadImageVDSCommandParameters( getStorageDomain().getStoragePoolId(), getStorageDomain().getId(), diskImage.getId(), diskImage.getImageId(), new HttpLocationInfo( getProviderProxy().getImageUrl(getSpmCompatibilityVersion(diskImage.getStoragePoolId()), newImageId), getProviderProxy().getUploadHeaders() ) )); if (vdsReturnValue.getSucceeded()) { getReturnValue().getVdsmTaskIdList().add( createTask(taskId, vdsReturnValue.getCreationInfo(), getParameters().getParentCommand(), VdcObjectType.Disk, getParameters().getImageGroupID(), getParameters().getDestinationDomainId())); } getReturnValue().setActionReturnValue(newImageId); setSucceeded(true); }
Source:
public void closeNewWikiCongratulationsLightBox() { scrollAndClick(welcomeLightBoxCloseButton); PageObjectLogging.log("waitForCongratulationsLightBox ", "Congratulations lightbox verified", true, driver); }

Target:
public void closeNewWikiCongratulationsLightBox() { scrollAndClick(welcomeLightBoxCloseButton); PageObjectLogging.log("closeNewWikiCongratulationsLightBox ", "congratulations lightbox closed", true); }
Source:
public static boolean installable() { return true; }

Target:
public boolean installable() { return installable; }
Source:
public void fireChanged() { SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection()); for (ISelectionChangedListener fListener : fListeners) { fListener.selectionChanged(evt); } }

Target:
public void fireChanged() { SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection()); for (ISelectionChangedListener listener : fListeners) { listener.selectionChanged(evt); } }
Source:
public UnifyResult apply(UnifyRuleCall call) { final MutableUnion query = (MutableUnion) call.query; final MutableUnion target = (MutableUnion) call.target; List<MutableRel> queryInputs = query.getInputs(); List<MutableRel> targetInputs = target.getInputs(); if (queryInputs.size() == targetInputs.size()) { while (!queryInputs.isEmpty()) { int index = targetInputs.indexOf(queryInputs.get(0)); if (index != -1) { targetInputs.remove(index); queryInputs.remove(0); } else { return null; } } return call.result(target); } return null; }

Target:
public UnifyResult apply(UnifyRuleCall call) { final MutableUnion query = (MutableUnion) call.query; final MutableUnion target = (MutableUnion) call.target; List<MutableRel> queryInputs = query.getInputs(); List<MutableRel> targetInputs = target.getInputs(); if (queryInputs.size() == targetInputs.size()) { for (MutableRel rel: queryInputs) { int index = targetInputs.indexOf(rel); if (index == -1) { return null; } else { targetInputs.remove(index); } } return call.result(target); } return null; }
Source:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); if (!isImageProvided()) { listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } else { listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> listPermissionSubjects = new ArrayList<>(); if (isImageProvided()) { listPermissionSubjects.add(new PermissionSubject(getParameters().getImageId(), VdcObjectType.Disk, ActionGroup.CREATE_DISK)); } else { listPermissionSubjects.add(new PermissionSubject(getParameters().getStorageDomainId(), VdcObjectType.Storage, ActionGroup.CREATE_DISK)); } return listPermissionSubjects; }
Source:
protected UnrankedScientificName findPrincipal(Taxonomy taxonomy) { List<UnrankedScientificName> names = this.getConcepts(); if (names.isEmpty()) return null; if (names.size() == 1) return names.get(0); names.sort((tc1, tc2) -> tc2.getProviderScore() - tc1.getProviderScore()); final int cutoff = taxonomy.getAcceptedCutoff(); List<UnrankedScientificName> coded = names.stream().filter(sn -> !sn.getKey().isUncoded() && sn.getPrincipal() != null && sn.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (coded.size() == 0) return names.get(0); if (coded.size() == 1) { return coded.get(0); } taxonomy.report(IssueType.COLLISION, "uncodedScientificName.collision", this,coded.get(0), coded.get(1)); final int score = coded.stream().mapToInt(UnrankedScientificName::getPrincipalScore).max().orElse(Integer.MIN_VALUE); List<UnrankedScientificName> candidates = coded.stream().filter(sn -> sn.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "uncodedScientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }

Target:
protected UnrankedScientificName findPrincipal(Taxonomy taxonomy) { List<UnrankedScientificName> names = this.getConcepts(); if (names.isEmpty()) return null; if (names.size() == 1) return names.get(0); names.sort(REVERSE_PROVIDER_SCORE_COMPARATOR); final int cutoff = taxonomy.getAcceptedCutoff(); List<UnrankedScientificName> coded = names.stream().filter(sn -> !sn.getKey().isUncoded() && sn.getPrincipal() != null && sn.getPrincipalScore() > cutoff).collect(Collectors.toList()); if (coded.size() == 0) return names.get(0); if (coded.size() == 1) { return coded.get(0); } taxonomy.report(IssueType.COLLISION, "uncodedScientificName.collision", this,coded.get(0), coded.get(1)); final int score = coded.stream().mapToInt(UnrankedScientificName::getPrincipalScore).max().orElse(TaxonomicElement.MIN_SCORE); List<UnrankedScientificName> candidates = coded.stream().filter(sn -> sn.getPrincipalScore() == score).collect(Collectors.toList()); if (candidates.size() > 1) taxonomy.report(IssueType.PROBLEM, "uncodedScientificName.collision.match", this, candidates.get(0), candidates.get(1)); return candidates.get(0); }
Source:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() .typeDefinition(TypeCriteria.is("java.util.Hashtable")) .name("put") .withAnyParameters()); }

Target:
protected List<MethodMatcher> getMethodInvocationMatchers() { return Collections.singletonList( MethodMatcher.create() .typeDefinition(TypeCriteria.subtypeOf("java.util.Map")) .name("put") .withAnyParameters()); }
Source:
public double reidentificationPotential(long threshold) { int highlyUniqueValues = 0; for (HyperLogLog hll : minhash.values()) { if (hll.cardinality() <= threshold) { highlyUniqueValues++; } } return (double) highlyUniqueValues / minhash.size(); }

Target:
public double reidentificationPotential(long threshold) { long highlyUniqueValues = minhash.values().stream() .map(HyperLogLog::cardinality) .filter(cardinality -> cardinality <= threshold) .count(); return (double) highlyUniqueValues / minhash.size(); }
Source:
public void shouldObtainSecret() throws Exception { PlainTextVaultProvider provider = new PlainTextVaultProvider(Scenario.EXISTING.getPath()); Optional<byte[]> secret1 = provider.obtainSecret("key1"); assertNotNull(secret1); assertNotNull(secret1.orElse(null)); assertEquals("secret1", new String(secret1.get())); }

Target:
public void shouldObtainSecret() throws Exception { PlainTextVaultProvider provider = new PlainTextVaultProvider(Scenario.EXISTING.getPath(), "test"); VaultRawSecret secret1 = provider.obtainSecret("key1"); assertNotNull(secret1); assertNotNull(secret1.getRawSecret().get()); assertThat(secret1, secretContains("secret1")); }
Source:
public Map<String, String> getCustomAttributes() { requireCustomAttributesEnabled("getCustomAttributes"); synchronized (customAttributes) { return customAttributes; } }

Target:
public Map<String, String> getCustomAttributes() { requireCustomAttributesEnabled(); requireCustomAttributes(); return Collections.unmodifiableMap(customAttributes); }
Source:
public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(new Object[]{commandId}); return Injector.injectMembers(cmd); } catch (Exception e) { log.error("CommandsFactory : Failed to get type information using reflection for Class '{}', Command Id '{}': {}", className, commandId, e.getMessage()); log.debug("Exception", e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }

Target:
public static CommandBase<?> createCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } CommandBase<?> cmd = (CommandBase<?>) constructor.newInstance(new Object[]{commandId}); return Injector.injectMembers(cmd); } catch (Exception e) { log.error("CommandsFactory : Failed to get type information using reflection for Class '{}', Command Id '{}': {}", className, commandId, e.getMessage()); log.error("Exception", e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }
Source:
private String resolveDockerfileLocation(Class<? extends DockerContainer> fixture, DockerFixture f) { String prefix = null; if(isSpecificDockerfileLocationSet(f)) { prefix = f.dockerfile().replace('.', '/').replace('$', '/'); } else { prefix = fixture.getName().replace('.', '/').replace('$', '/'); } return prefix; }

Target:
private String resolveDockerfileLocation(Class<? extends DockerContainer> fixture, DockerFixture f) { String prefix = null; if(isSpecificDockerfileLocationSet(f)) { prefix = f.dockerfileFolder(); } else { prefix = fixture.getName(); } return prefix.replace('.', '/').replace('$', '/'); }
Source:
private Module installModule(Collection<Module> modules, String installUri, ServletContext servletContext) { List<Module> moduleList = new ArrayList<Module>(modules); Module existingModule = moduleList.get(0); Module tempModule = null; File moduleFile = null; try { if (existingModule != null) { List<Module> dependentModulesStopped = moduleFactoryWrapper.stopModuleAndGetDependent(existingModule); for (Module depMod : dependentModulesStopped) { moduleFactoryWrapper.stopModuleSkipRefresh(depMod, servletContext); } moduleFactoryWrapper.stopModuleSkipRefresh(existingModule, servletContext); moduleFactoryWrapper.unloadModule(existingModule); } URL downloadUrl = new URL(installUri); String fileName = FilenameUtils.getName(downloadUrl.getPath()); InputStream inputStream = ModuleUtil.getURLStream(downloadUrl); moduleFile = ModuleUtil.insertModuleFile(inputStream, fileName); tempModule = moduleFactoryWrapper.loadModule(moduleFile); moduleFactoryWrapper.startModule(tempModule, servletContext); return tempModule; } catch (MalformedURLException e) { throw new RuntimeException(e.getMessage()); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } finally { if (tempModule == null && moduleFile != null) { FileUtils.deleteQuietly(moduleFile); } } }

Target:
private Module installModule(Collection<Module> modules, String installUri, ServletContext servletContext) { List<Module> moduleList = new ArrayList<Module>(modules); Module existingModule = moduleList.get(0); Module tempModule = null; File moduleFile = null; try { if (existingModule != null) { List<Module> dependentModulesStopped = moduleFactoryWrapper.stopModuleAndGetDependent(existingModule); for (Module depMod : dependentModulesStopped) { moduleFactoryWrapper.stopModuleSkipRefresh(depMod, servletContext); } moduleFactoryWrapper.stopModuleSkipRefresh(existingModule, servletContext); moduleFactoryWrapper.unloadModule(existingModule); } URL downloadUrl = new URL(installUri); String fileName = FilenameUtils.getName(downloadUrl.getPath()); InputStream inputStream = ModuleUtil.getURLStream(downloadUrl); moduleFile = ModuleUtil.insertModuleFile(inputStream, fileName); tempModule = moduleFactoryWrapper.loadModule(moduleFile); moduleFactoryWrapper.startModule(tempModule, servletContext); return tempModule; } catch (MalformedURLException e) { throw new APIException(e.getMessage(), e); } catch (IOException e) { throw new APIException(e.getMessage(), e); } finally { if (moduleFile != null) { FileUtils.deleteQuietly(moduleFile); } } }
Source:
public void testMultipleFeatures() throws InterruptedException, JSONException { final BackendSupplier backendSupplier = new BackendSupplier() { @Override public Collection<? extends Backend> get() { Backend backend = mock(Backend.class); when(backend.getSnippet(any(PickleStep.class), anyString(), any(FunctionNameGenerator.class))).thenReturn("TEST SNIPPET"); return singletonList(backend); } }; StringBuilder stringBuilderA = new StringBuilder(); Runtime.builder() .withArgs("--threads", "3", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(stringBuilderA)) .withBackendSupplier(backendSupplier) .build() .run(); StringBuilder stringBuilderB = new StringBuilder(); Runtime.builder() .withArgs("--threads", "1", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(stringBuilderB)) .withBackendSupplier(backendSupplier) .build() .run(); System.out.println(stringBuilderA.toString()); System.out.println("==================="); System.out.println(stringBuilderB.toString()); JSONAssert.assertEquals(stringBuilderB.toString(), new JSONArray(new JSONTokener(stringBuilderA.toString())), false); }

Target:
public void testMultipleFeatures() { StringBuilder parallel = new StringBuilder(); Runtime.builder() .withArgs("--threads", "3", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(parallel)) .build() .run(); StringBuilder serial = new StringBuilder(); Runtime.builder() .withArgs("--threads", "1", "src/test/resources/cucumber/runtime/formatter/JSONPrettyFormatterTest.feature", "src/test/resources/cucumber/runtime/formatter/FormatterInParallel.feature") .withAdditionalPlugins(new JSONFormatter(serial)) .build() .run(); assertThat(parallel.toString(), sameJSONAs(serial.toString()).allowingAnyArrayOrdering()); }
Source:
public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GoloFunction other = (GoloFunction) obj; if (!Objects.equals(this.name, other.name)) { return false; } if (this.getArity() != other.getArity()) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final GoloFunction other = (GoloFunction) obj; if (!Objects.equals(this.name, other.name)) { return false; } if (this.varargs != other.varargs) { return false; } return this.getArity() == other.getArity(); }
Source:
public ObexTime(String time) { Pattern p = Pattern.compile( "(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})(([+-])(\\d{2})(\\d{2})" + ")?"); Matcher m = p.matcher(time); if (m.matches()) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.setTimeZone(TimeZone.getDefault()); cal.set(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)) - 1, Integer.parseInt(m.group(3)), Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)), Integer.parseInt(m.group(6))); if (m.group(7) != null) { int ohh = Integer.parseInt(m.group(9)); int omm = Integer.parseInt(m.group(10)); int offset = (ohh * 60 + omm) * 60 * 1000; if (m.group(8).equals("-")) { offset = -offset; } TimeZone tz = TimeZone.getTimeZone("UTC"); tz.setRawOffset(offset); cal.setTimeZone(tz); } mDate = cal.getTime(); } }

Target:
public ObexTime(String time) { Pattern p = Pattern.compile( "(\\d{4})(\\d{2})(\\d{2})T(\\d{2})(\\d{2})(\\d{2})(([+-])(\\d{2})(\\d{2})" + ")?"); Matcher m = p.matcher(time); if (m.matches()) { Calendar.Builder builder = new Calendar.Builder(); builder.setDate(Integer.parseInt(m.group(1)), Integer.parseInt(m.group(2)) - 1, Integer.parseInt(m.group(3))); builder.setTimeOfDay(Integer.parseInt(m.group(4)), Integer.parseInt(m.group(5)), Integer.parseInt(m.group(6)), 0); if (m.group(7) != null) { int ohh = Integer.parseInt(m.group(9)); int omm = Integer.parseInt(m.group(10)); int offset = (ohh * 60 + omm) * 60 * 1000; if (m.group(8).equals("-")) { offset = -offset; } TimeZone tz = TimeZone.getTimeZone("UTC"); tz.setRawOffset(offset); builder.setTimeZone(tz); } mDate = builder.build().getTime(); } }
Source:
public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); DefaultBHttpClientConnection conn = getConnection(); HttpEntity response = executeRequest(request, conn); String responseContent = null; try { BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); return ImageTicketInformationHelper.fromJson(responseContent); } catch (com.google.gson.JsonSyntaxException e) { throw new RuntimeException(responseContent, e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } finally { finalize(response, conn); } }

Target:
public ImageTicketInformation getTicket(Guid ticketUUID) { BasicHttpRequest request = new BasicHttpRequest( "GET", TICKETS_URI + ticketUUID, HttpVersion.HTTP_1_1); String responseContent; try (DefaultBHttpClientConnection conn = getConnection()) { HttpEntity response = executeRequest(request, conn); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getContent())); responseContent = reader.lines().collect(Collectors.joining()); consumeResponse(response); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e); } return ImageTicketInformationHelper.fromJson(responseContent); }
Source:
static String getConsumerGroupId(Config config) { JobConfig jobConfig = new JobConfig(config); Option<String> jobIdOption = jobConfig.getJobId(); Option<String> jobNameOption = jobConfig.getName(); return (jobNameOption.isDefined() ? jobNameOption.get() : "undefined_job_name") + "-" + (jobIdOption.isDefined() ? jobIdOption.get() : "undefined_job_id"); }

Target:
static String getConsumerGroupId(Config config) { JobConfig jobConfig = new JobConfig(config); Option jobNameOption = jobConfig.getName(); if (jobNameOption.isEmpty()) { throw new ConfigException("Missing job name"); } String jobName = (String) jobNameOption.get(); Option jobIdOption = jobConfig.getJobId(); String jobId = "1"; if (! jobIdOption.isEmpty()) { jobId = (String) jobIdOption.get(); } return String.format("%s-%s", jobName, jobId); }
Source:
private static void set(Material material, String stat, float accuracy) { IMaterialStats oldStat = material.getStats(stat); if (oldStat instanceof FletchingMaterialStats) { FletchingMaterialStats fletchingStat = (FletchingMaterialStats) oldStat; FletchingMaterialStats newFletching = new FletchingMaterialStats(accuracy, fletchingStat.modifier); material.addStats(newFletching); } }

Target:
private void set(Material material, String stat, float accuracy) { IMaterialStats oldStat = material.getStats(stat); if (oldStat instanceof FletchingMaterialStats) { FletchingMaterialStats fletchingStat = (FletchingMaterialStats) oldStat; FletchingMaterialStats newFletching = new FletchingMaterialStats(accuracy, fletchingStat.modifier); material.addStats(newFletching); } }
Source:
public KeyValueServiceStatus getKeyValueServiceStatus() { NodeAvailabilityStatus nodeAvailabilityStatus = keyValueService.getNodeAvailabilityStatus(); switch (nodeAvailabilityStatus) { case TERMINAL: return KeyValueServiceStatus.TERMINAL; case ALL_AVAILABLE: return KeyValueServiceStatus.HEALTHY_ALL_OPERATIONS; case QUORUM_AVAILABLE: return KeyValueServiceStatus.HEALTHY_BUT_NO_SCHEMA_MUTATIONS_OR_DELETES; case NO_QUORUM_AVAILABLE: default: return KeyValueServiceStatus.UNHEALTHY; } }

Target:
public KeyValueServiceStatus getKeyValueServiceStatus() { ClusterAvailabilityStatus clusterAvailabilityStatus = keyValueService.getClusterAvailabilityStatus(); switch (clusterAvailabilityStatus) { case TERMINAL: return KeyValueServiceStatus.TERMINAL; case ALL_AVAILABLE: return KeyValueServiceStatus.HEALTHY_ALL_OPERATIONS; case QUORUM_AVAILABLE: return KeyValueServiceStatus.HEALTHY_BUT_NO_SCHEMA_MUTATIONS_OR_DELETES; case NO_QUORUM_AVAILABLE: default: return KeyValueServiceStatus.UNHEALTHY; } }
Source:
protected <T> T get(String artifactId, Class<T> clazz) { return get(clazz,uri(ClientConstants.PATH_ARTIFACTS+ClientConstants.URI_SEP+ artifactType.value()+"/%s",artifactId)).execute(); }

Target:
protected <T> T get(String artifactId, Class<T> clazz) { return get(clazz,uri(PATH_ARTIFACTS+URI_SEP+ artifactType.value()+"/%s",artifactId)).execute(); }
Source:
public void statusRedundancyWithIncludeRegionArgumentReturnsStatusForOnlyThatRegion() { createAndPopulateRegions(); String command = new CommandStringBuilder(COMMAND_NAME) .addOption(INCLUDE_REGION, SATISFIED_REGION) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command); commandResult.statusIsSuccess() .hasNoSection(ZERO_REDUNDANCY_SECTION) .hasNoSection(UNDER_REDUNDANCY_SECTION) .doesNotContainOutput(UNSATISFIED_REGION) .doesNotContainOutput(ZERO_COPIES_REGION) .doesNotContainOutput(NO_CONFIGURED_REDUNDANCY_REGION); verifySummarySection(commandResult, 0, 0, 1); InfoResultModelAssert satisfiedRedundancy = commandResult.hasInfoSection(SATISFIED_REDUNDANCY_SECTION); satisfiedRedundancy.hasHeader().isEqualTo(REDUNDANCY_SATISFIED_FOR_REGIONS); satisfiedRedundancy.hasOutput().contains(SATISFIED_REGION); }

Target:
public void statusRedundancyWithIncludeRegionArgumentReturnsStatusForOnlyThatRegion() { createAndPopulateRegions(); String includedRegion = SATISFIED_REGION; List<String> nonIncludedRegions = new ArrayList<>(regionNames); nonIncludedRegions.remove(includedRegion); String command = new CommandStringBuilder(STATUS_REDUNDANCY) .addOption(REDUNDANCY_INCLUDE_REGION, includedRegion) .getCommandString(); CommandResultAssert commandResult = gfsh.executeAndAssertThat(command).statusIsSuccess() .doesNotContainOutput(nonIncludedRegions.toArray(new String[0])); verifyGfshOutput(commandResult, new ArrayList<>(), new ArrayList<>(), Collections.singletonList(includedRegion)); }
Source:
public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastore, ConnectorTableHandle tableHandle, List<List<String>> partitionValuesList) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = getTable(metastore, tableName); List<HiveColumnHandle> partitionColumns = getPartitionKeyColumnHandles(table); List<Type> partitionColumnTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toList()); Iterable<HivePartition> partitionsIterable = () -> partitionValuesList.stream() .map(partitionValues -> getPartitionNameByNonNullParts(table.getPartitionColumns(), partitionValues)) .map(partitionName -> parseValuesAndFilterPartition(tableName, partitionName, partitionColumns, partitionColumnTypes, alwaysTrue())) .peek(partition -> verify(partition.isPresent(), "partition must exist")) .map(Optional::get) .iterator(); return new HivePartitionResult(partitionColumns, partitionsIterable, all(), all(), none(), getHiveBucketHandle(table), Optional.empty()); }

Target:
public HivePartitionResult getPartitions(SemiTransactionalHiveMetastore metastore, ConnectorTableHandle tableHandle, List<List<String>> partitionValuesList) { HiveTableHandle hiveTableHandle = (HiveTableHandle) tableHandle; SchemaTableName tableName = hiveTableHandle.getSchemaTableName(); Table table = getTable(metastore, tableName); List<HiveColumnHandle> partitionColumns = getPartitionKeyColumnHandles(table); List<Type> partitionColumnTypes = partitionColumns.stream() .map(column -> typeManager.getType(column.getTypeSignature())) .collect(toImmutableList()); List<HivePartition> partitionList = partitionValuesList.stream() .map(partitionValues -> makePartName(table.getPartitionColumns(), partitionValues)) .map(partitionName -> parseValuesAndFilterPartition(tableName, partitionName, partitionColumns, partitionColumnTypes, alwaysTrue())) .map(partition -> partition.orElseThrow(() -> new VerifyException("partition must exist"))) .collect(toImmutableList()); return new HivePartitionResult(partitionColumns, partitionList, all(), all(), none(), getHiveBucketHandle(table), Optional.empty()); }
Source:
public void removeTask() { try { this.process.getTasks().remove(this.task); List<User> users = this.task.getUsers(); for (User user : users) { user.getTasks().remove(this.task); } List<UserGroup> userGroups = this.task.getUserGroups(); for (UserGroup userGroup : userGroups) { userGroup.getTasks().remove(this.task); } deleteSymlinksFromUserHomes(); serviceManager.getTaskService().remove(this.task); } catch (DataException e) { logger.error(e); } }

Target:
public void removeTask() { try { this.process.getTasks().remove(this.task); List<User> users = this.task.getUsers(); for (User user : users) { user.getTasks().remove(this.task); } List<UserGroup> userGroups = this.task.getUserGroups(); for (UserGroup userGroup : userGroups) { userGroup.getTasks().remove(this.task); } deleteSymlinksFromUserHomes(); serviceManager.getTaskService().remove(this.task); } catch (DataException e) { Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); } }
Source:
private static boolean isEntityColumn(Method getter) { final boolean isAnnotated = getter.isAnnotationPresent(javax.persistence.Column.class); if (isAnnotated) { return true; } final Class<?> declaringClass = getter.getDeclaringClass(); final Iterable<Class<?>> ascendants = getSuperClassesAndInterfaces(declaringClass); for (Class<?> ascendant : ascendants) { final Optional<Method> optional = getMethod(getter, ascendant); if (optional.isPresent()) { final Method ascendantMethod = optional.get(); if (ascendantMethod.isAnnotationPresent(javax.persistence.Column.class)) { return true; } } } return false; }

Target:
private static boolean isEntityColumn(Method getter) { final boolean isAnnotated = getter.isAnnotationPresent(javax.persistence.Column.class); if (isAnnotated) { return true; } final Class<?> declaringClass = getter.getDeclaringClass(); final Iterable<Class<?>> ascendants = getSuperClassesAndInterfaces(declaringClass); for (Class<?> ascendant : ascendants) { final Optional<Method> optional = getMethod(ascendant, getter); if (optional.isPresent()) { final Method ascendantMethod = optional.get(); if (ascendantMethod.isAnnotationPresent(javax.persistence.Column.class)) { return true; } } } return false; }
Source:
public static boolean validateBinding( ComputedColumnHandle column, String columnName ) { if( column == null ) { return false; } if( columnName == null || columnName.isEmpty() ) { columnName = "[^\\]]+"; } else { columnName = processSpecialCharacters( columnName ); } ExpressionHandle expr = column .getExpressionProperty( ComputedColumn.EXPRESSION_MEMBER ); String expression = expr.getStringExpression( ); if( expression != null ) { if( ExpressionType.JAVASCRIPT.equalsIgnoreCase( expr.getType( ) ) ) { Pattern p = Pattern.compile( "\\[\\s*\\\"" + columnName + "\\\"\\s*\\]" ); return p.matcher( expression ).find( ); } else { Pattern p = Pattern.compile( "\\[\\s*" + columnName + "\\s*\\]" ); return p.matcher( expression ).find( ); } } return false; }

Target:
public static boolean validateBinding( ComputedColumnHandle column, String columnName ) { if( column == null ) { return false; } if( columnName == null || columnName.isEmpty() ) { columnName = "[^\\]]+"; } else { columnName = Pattern.quote( columnName ); } ExpressionHandle expr = column .getExpressionProperty( ComputedColumn.EXPRESSION_MEMBER ); String expression = expr.getStringExpression( ); if( expression != null ) { if( ExpressionType.JAVASCRIPT.equalsIgnoreCase( expr.getType( ) ) ) { Pattern p = Pattern.compile( "\\[\\s*\\\"" + columnName + "\\\"\\s*\\]" ); return p.matcher( expression ).find( ); } else { Pattern p = Pattern.compile( "\\[\\s*" + columnName + "\\s*\\]" ); return p.matcher( expression ).find( ); } } return false; }
Source:
private DbPlatformType getJsonType(DbType type, boolean withScale) { DbPlatformType dbType = get(type); if (JHelper.objectSameReference(dbType, JSON_CLOB_PLACEHOLDER)) { return withScale ? get(DbType.VARCHAR) : get(DbType.CLOB); } if (JHelper.objectSameReference(dbType, JSON_BLOB_PLACEHOLDER)) { return get(DbType.BLOB); } if (JHelper.objectSameReference(dbType, JSON_VARCHAR_PLACEHOLDER)) { return get(DbType.VARCHAR); } return get(type); }

Target:
private DbPlatformType getJsonType(DbType type, boolean withScale) { DbPlatformType dbType = get(type); if (dbType == JSON_CLOB_PLACEHOLDER) { return withScale ? get(DbType.VARCHAR) : get(DbType.CLOB); } if (dbType == JSON_BLOB_PLACEHOLDER) { return get(DbType.BLOB); } if (dbType == JSON_VARCHAR_PLACEHOLDER) { return get(DbType.VARCHAR); } return get(type); }