auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry codecRegistry) { int size = Header.lengthFor(protocolVersion); try { switch (protocolVersion) { case V1: size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel()); break; case V2: case V3: case V4: case V5: size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel()); size += QueryFlag.serializedSize(protocolVersion); if (hasValues()) { if (usesNamedValues()) { size += CBUtil.sizeOfNamedValueList(getNamedValues(protocolVersion, codecRegistry)); } else { size += CBUtil.sizeOfValueList(Arrays.asList(getValues(protocolVersion, codecRegistry))); } } if (getFetchSize() > 0) { size += 4; } if (getPagingState() != null) { size += CBUtil.sizeOfValue(getPagingState()); } if (getSerialConsistencyLevel() != null) { size += CBUtil.sizeOfConsistencyLevel(getSerialConsistencyLevel()); } if (getDefaultTimestamp() > Long.MIN_VALUE) { size += 8; } if (ProtocolFeature.CUSTOM_PAYLOADS.isSupportedBy(protocolVersion) && getOutgoingPayload() != null) { size += CBUtil.sizeOfBytesMap(getOutgoingPayload()); } break; default: throw protocolVersion.unsupported(); } } catch (Exception e) { size = -1; } return size; }

Target:
public int requestSizeInBytes(ProtocolVersion protocolVersion, CodecRegistry codecRegistry) { int size = Header.lengthFor(protocolVersion); try { size += CBUtil.sizeOfLongString(getQueryString(codecRegistry)); switch (protocolVersion) { case V1: size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel()); break; case V2: case V3: case V4: case V5: size += CBUtil.sizeOfConsistencyLevel(getConsistencyLevel()); size += QueryFlag.serializedSize(protocolVersion); if (hasValues()) { if (usesNamedValues()) { size += CBUtil.sizeOfNamedValueList(getNamedValues(protocolVersion, codecRegistry)); } else { size += CBUtil.sizeOfValueList(Arrays.asList(getValues(protocolVersion, codecRegistry))); } } size += 4; if (getPagingState() != null) { size += CBUtil.sizeOfValue(getPagingState()); } size += CBUtil.sizeOfConsistencyLevel(getSerialConsistencyLevel()); if (ProtocolFeature.CLIENT_TIMESTAMPS.isSupportedBy(protocolVersion)) { size += 8; } if (ProtocolFeature.CUSTOM_PAYLOADS.isSupportedBy(protocolVersion) && getOutgoingPayload() != null) { size += CBUtil.sizeOfBytesMap(getOutgoingPayload()); } break; default: throw protocolVersion.unsupported(); } } catch (Exception e) { size = -1; } return size; }
Source:
static public LocalDateTime stringToLocalDate(String s) { if (s.endsWith("Z")) { Instant instant = Instant.parse(s); return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); } else return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME); }

Target:
static public LocalDateTime stringToLocalDate(String s) { if (s.endsWith("Z")) { Instant instant = Instant.parse(s); return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); } else { return LocalDateTime.parse(s, DateTimeFormatter.ISO_LOCAL_DATE_TIME); } }
Source:
private void updateRwtEligiblityYear(CertifiedProductSearchDetails detail) { try { CertifiedProductDTO dto = certifiedProductDAO.getById(detail.getId()); dto.setRwtEligiblityYear(getEligibilityYear()); certifiedProductDAO.update(dto); LOGGER.info("Listing: " + detail.getId() + " - Added eligibility"); } catch (EntityRetrievalException e) { LOGGER.error("Listing: " + detail.getId() + " - Error setting eligibility", e); } }

Target:
private void updateRwtEligiblityYear(CertifiedProductSearchDetails detail) { try { rwtEligibilityYearDAO.updateRwtEligibilityYear(detail.getId(), getEligibilityYear()); LOGGER.info("Listing: " + detail.getId() + " - Added eligibility"); } catch (EntityRetrievalException e) { LOGGER.error("Listing: " + detail.getId() + " - Error setting eligibility", e); } }
Source:
public void canDeserializeTimeLockServerConfiguration() throws IOException { File testConfigFile = new File( PaxosConfigDeserializationTest.class.getResource(getConfigFileName()).getPath()); TimeLockServerConfiguration configuration = OBJECT_MAPPER.readValue(testConfigFile, TimeLockServerConfiguration.class); assertThat(configuration.cluster().localServer()).isEqualTo("localhost:8080"); assertThat(configuration.cluster().servers()).containsExactlyInAnyOrder( "localhost:8080", "localhost:8081", "localhost:8082"); assertThat(configuration.clients()).containsExactlyInAnyOrder("test", "test2", "test3", "acceptor", "learner"); assertAlgorithmConfigurationCorrect(configuration.algorithm()); assertThat(configuration.useClientRequestLimit()).isTrue(); assertThat(configuration.timeLimiterConfiguration().enableTimeLimiting()).isTrue(); assertThat(configuration.timeLimiterConfiguration().blockingTimeoutErrorMargin()).isEqualTo(0.03); assertThat(configuration.asyncLockConfiguration().useAsyncLockService()).isTrue(); assertThat(configuration.asyncLockConfiguration().disableLegacySafetyChecksWarningPotentialDataCorruption()) .isFalse(); }

Target:
public void canDeserializeTimeLockServerConfiguration() throws IOException { File testConfigFile = new File( AbstractTimelockServerConfigDeserializationTest.class.getResource(getConfigFileName()).getPath()); TimeLockServerConfiguration configuration = OBJECT_MAPPER.readValue(testConfigFile, TimeLockServerConfiguration.class); assertThat(configuration.cluster().localServer()).isEqualTo("localhost:8080"); assertThat(configuration.cluster().servers()).containsExactlyInAnyOrder( "localhost:8080", "localhost:8081", "localhost:8082"); assertThat(configuration.clients()).containsExactlyInAnyOrder("test", "test2", "test3", "acceptor", "learner"); assertAlgorithmConfigurationCorrect(configuration.algorithm()); assertTimestampBoundPersisterConfigurationCorrect(configuration.getTsBoundPersisterConfiguration()); assertThat(configuration.useClientRequestLimit()).isTrue(); assertThat(configuration.timeLimiterConfiguration().enableTimeLimiting()).isTrue(); assertThat(configuration.timeLimiterConfiguration().blockingTimeoutErrorMargin()).isEqualTo(0.03); assertThat(configuration.asyncLockConfiguration().useAsyncLockService()).isTrue(); assertThat(configuration.asyncLockConfiguration().disableLegacySafetyChecksWarningPotentialDataCorruption()) .isFalse(); }
Source:
protected void updateData(double[] x, @NonNull AnalysisBaseQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { return; } ICommonXAxisResponse response = null; ICommonXAxisModel model = null; ICommonXAxisResponse.Status status; long currentEnd = 0; while (currentEnd < filters.getQueryInterval().getEndTime().toNanos()) { response = fXYDataProvider.fetch(x, filters, monitor); model = response.getModel(); if (model != null) { updateDisplay(model); } status = response.getStatus(); if (status == ICommonXAxisResponse.Status.COMPLETED) { return; } else if(status == ICommonXAxisResponse.Status.FAILED || status == ICommonXAxisResponse.Status.CANCELLED) { LOGGER.log(Level.WARNING, response.getStatusMessage()); return; } else { try { finishedLatch.await(BUILD_UPDATE_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOGGER.log(Level.INFO, e.getMessage()); return; } } } }

Target:
protected void updateData(double[] x, @NonNull AnalysisBaseQueryFilter filters, IProgressMonitor monitor) { if (fXYDataProvider == null) { LOGGER.log(Level.WARNING, "Data provider for this viewer is not available"); return; } long currentEnd = 0; while (currentEnd < filters.getQueryInterval().getEndTime().toNanos()) { ICommonXAxisResponse response = fXYDataProvider.fetch(x, filters, monitor); ICommonXAxisModel model = response.getModel(); if (model != null) { updateDisplay(model); } ICommonXAxisResponse.Status status = response.getStatus(); if (status == ICommonXAxisResponse.Status.COMPLETED) { return; } else if (status == ICommonXAxisResponse.Status.FAILED || status == ICommonXAxisResponse.Status.CANCELLED) { LOGGER.log(Level.WARNING, response.getStatusMessage()); return; } else { try { finishedLatch.await(BUILD_UPDATE_TIMEOUT, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOGGER.log(Level.INFO, e.getMessage()); return; } } } }
Source:
public PrimitiveLongIterator fuzzyQuery( String... terms ) { MultiFieldQueryParser multiFieldQueryParser = new MultiFieldQueryParser( properties, analyzer ); multiFieldQueryParser.setDefaultOperator( QueryParser.Operator.OR ); Query query; try { query = multiFieldQueryParser.parse( String.join( "~ ", terms ) + "~" ); } catch ( ParseException e ) { query = parseFallbackBooleanQuery( multiFieldQueryParser, terms ); } return query( query ); }

Target:
public PrimitiveLongIterator fuzzyQuery( String... terms ) { String concatenatedQuery = String.join( "~ ", terms ) + "~"; return innerQuery( concatenatedQuery ); }
Source:
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType ) { List<IBootstrapComponent> ret = this.bootstrapComponents.get( eventType ); if( ret == null ) { return Collections.emptyIterator(); } return (Iterator<T>) ret.iterator(); }

Target:
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType ) { return (Iterator<T>) this.bootstrapComponents.getOrDefault( eventType, Collections.emptyList() ).iterator(); }
Source:
protected void reestablishConnectionIfNeeded() { if (getVds().getProtocol() != VdsProtocol.STOMP && FeatureSupported.jsonProtocol(getVds().getVdsGroupCompatibilityVersion()) && getVds().getHostOs() != null) { getVds().setProtocol(VdsProtocol.STOMP); getVdsStaticDao().save(getVds().getStaticData()); initializeVds(); } }

Target:
protected void reestablishConnectionIfNeeded() { if (getVds().getProtocol() == VdsProtocol.XML && FeatureSupported.jsonProtocol(getVds().getVdsGroupCompatibilityVersion()) && getVds().getHostOs() != null) { getVds().setProtocol(VdsProtocol.STOMP); getVdsStaticDao().save(getVds().getStaticData()); initializeVds(); } }
Source:
private void checkActiveCqCount(MemberVM vm, int expectedResult) { vm.invoke(() -> { QueryService queryService = getCache().getQueryService(); CqServiceStatistics cqServiceStats = queryService.getCqStatistics(); await() .untilAsserted(() -> assertThat(cqServiceStats.numCqsActive()).isEqualTo(expectedResult)); }); }

Target:
private void checkActiveCqCount(MemberVM vm, int expectedResult) { vm.invoke(() -> { QueryService queryService = getCache().getQueryService(); CqServiceStatistics cqServiceStats = queryService.getCqStatistics(); await() .atMost(30, TimeUnit.SECONDS) .untilAsserted(() -> assertThat(cqServiceStats.numCqsActive()).isEqualTo(expectedResult)); }); }
Source:
public void onListItemClick(ListView listView, View view, int position, long id) { Log.i("list", "onListItemClick"); super.onListItemClick(listView, view, position, id); ATMItem item = (ATMItem) getListAdapter().getItem(position); mDataManager.setCurrentItem(item); mModeChangeRequester.onModeChange(ModesManager.ModeIndex.DETAIL); }

Target:
public void onListItemClick(ListView listView, View view, int position, long id) { super.onListItemClick(listView, view, position, id); ATMItem item = (ATMItem) getListAdapter().getItem(position); mDataManager.setCurrentItem(item); mModeChangeRequester.onModeChange(ModesManager.ModeIndex.DETAIL); }
Source:
private float calcSwapCost(final int idx, final EditDistItem otherItem, final int otherIdx) { float cost = swapCost; if (this.isDigit[idx] && otherItem.isDigit[otherIdx]) { cost += digitChangePenalty; } return cost; }

Target:
private float calcSwapCost(final int idx, final EditDistItem otherItem, final int otherIdx) { if (this.isDigit[idx] && otherItem.isDigit[otherIdx]) { return edItemConfig.swapCost + edItemConfig.digitChangePenalty; } return edItemConfig.swapCost; }
Source:
public void testExecuteQueryWarnings() throws SQLException { try (ResultSet rs = statement.executeQuery("SELECT a FROM (VALUES 1, 2, 3) t(a)")) { assertNull(statement.getConnection().getWarnings()); assertNull(statement.getWarnings()); assertNull(rs.getWarnings()); Set<WarningEntry> currentWarnings = new HashSet<>(); while (rs.next()) { SQLWarning warning = statement.getConnection().getWarnings(); if (warning != null) { int previousSize = currentWarnings.size(); addWarnings(currentWarnings, warning); assertTrue(currentWarnings.size() >= previousSize); } warning = statement.getWarnings(); if (warning != null) { int previousSize = currentWarnings.size(); addWarnings(currentWarnings, warning); assertTrue(currentWarnings.size() >= previousSize); } warning = rs.getWarnings(); if (warning != null) { int previousSize = currentWarnings.size(); addWarnings(currentWarnings, warning); assertTrue(currentWarnings.size() >= previousSize); } } List<PrestoWarning> expectedWarnings = new TestingWarningCollector(new WarningCollectorConfig(), new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS).setAddWarnings(true)).getWarnings(); for (PrestoWarning prestoWarning : expectedWarnings) { assertTrue(currentWarnings.contains(new WarningEntry(new PrestoSqlWarning(prestoWarning)))); } } }

Target:
public void testExecuteQueryWarnings() throws SQLException { try (ResultSet rs = statement.executeQuery("SELECT a FROM (VALUES 1, 2, 3) t(a)")) { assertNull(statement.getConnection().getWarnings()); assertNull(statement.getWarnings()); assertNull(rs.getWarnings()); Set<WarningEntry> currentWarnings = new HashSet<>(); while (rs.next()) { assertWarnings(rs.getWarnings(), currentWarnings); } TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(PRELOADED_WARNINGS).setAddWarnings(true); TestingWarningCollector warningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig); List<PrestoWarning> expectedWarnings = warningCollector.getWarnings(); for (PrestoWarning prestoWarning : expectedWarnings) { assertTrue(currentWarnings.contains(new WarningEntry(new PrestoSqlWarning(prestoWarning)))); } } }
Source:
public void provision(KubernetesEnvironment k8sEnv, OpenShiftProject project) throws InfrastructureException { if (!trustedStoreInitialized) { return; } ConfigMap configMap = clientFactory .createOC() .configMaps() .inNamespace(cheInstallationLocation.getInstallationLocationNamespace()) .withName(caBundleConfigMap) .get(); if (configMap == null) { return; } Optional<ConfigMap> existing = project.configMaps().get(configMapName); if (!existing.isPresent() || !existing.get().getData().equals(configMap.getData())) { k8sEnv .getConfigMaps() .put( configMapName, new ConfigMapBuilder() .withMetadata( new ObjectMetaBuilder() .withName(configMapName) .withAnnotations(configMap.getMetadata().getAnnotations()) .withLabels(configMapLabelKeyValue) .build()) .withApiVersion(configMap.getApiVersion()) .withData(configMap.getData()) .build()); } for (PodData pod : k8sEnv.getPodsData().values()) { if (pod.getRole() == PodRole.DEPLOYMENT) { if (pod.getSpec() .getVolumes() .stream() .noneMatch(v -> v.getName().equals(CHE_TRUST_STORE_VOLUME))) { pod.getSpec() .getVolumes() .add( new VolumeBuilder() .withName(CHE_TRUST_STORE_VOLUME) .withConfigMap( new ConfigMapVolumeSourceBuilder().withName(configMapName).build()) .build()); } } for (Container container : pod.getSpec().getInitContainers()) { provisionTrustStoreVolumeMountIfNeeded(container); } for (Container container : pod.getSpec().getContainers()) { provisionTrustStoreVolumeMountIfNeeded(container); } } }

Target:
public void provision(KubernetesEnvironment k8sEnv, OpenShiftProject project) throws InfrastructureException { if (!trustedStoreInitialized) { return; } ConfigMap configMap = cheServerClientFactory .create() .configMaps() .inNamespace(installationLocationNamespace) .withName(caBundleConfigMap) .get(); if (configMap == null) { return; } Optional<ConfigMap> existing = project.configMaps().get(configMapName); if (!existing.isPresent() || !existing.get().getData().equals(configMap.getData())) { k8sEnv .getConfigMaps() .put( configMapName, new ConfigMapBuilder() .withMetadata( new ObjectMetaBuilder() .withName(configMapName) .withAnnotations(configMap.getMetadata().getAnnotations()) .withLabels(configMapLabelKeyValue) .build()) .withApiVersion(configMap.getApiVersion()) .withData(configMap.getData()) .build()); } for (PodData pod : k8sEnv.getPodsData().values()) { if (pod.getRole() == PodRole.DEPLOYMENT) { if (pod.getSpec() .getVolumes() .stream() .noneMatch(v -> v.getName().equals(CHE_TRUST_STORE_VOLUME))) { pod.getSpec() .getVolumes() .add( new VolumeBuilder() .withName(CHE_TRUST_STORE_VOLUME) .withConfigMap( new ConfigMapVolumeSourceBuilder().withName(configMapName).build()) .build()); } } for (Container container : pod.getSpec().getInitContainers()) { provisionTrustStoreVolumeMountIfNeeded(container); } for (Container container : pod.getSpec().getContainers()) { provisionTrustStoreVolumeMountIfNeeded(container); } } }
Source:
private void ensureClientCachesStarted() { GridCacheProcessor cacheProcessor = cctx.cache(); List<CacheConfiguration> notStartedCacheConfigs = new ArrayList<>(); for (CacheConfiguration cCfg : cctx.gridConfig().getCacheConfiguration()) { if (!cacheProcessor.cacheNames().contains(cCfg.getName())) { notStartedCacheConfigs.add(cCfg); } } if (!notStartedCacheConfigs.isEmpty()) { cacheProcessor.dynamicStartCaches(notStartedCacheConfigs, false, false); } }

Target:
private void ensureClientCachesStarted() { GridCacheProcessor cacheProcessor = cctx.cache(); Set<String> cacheNames = new HashSet<>(cacheProcessor.cacheNames()); List<CacheConfiguration> notStartedCacheConfigs = new ArrayList<>(); for (CacheConfiguration cCfg : cctx.gridConfig().getCacheConfiguration()) { if (!cacheNames.contains(cCfg.getName())) { notStartedCacheConfigs.add(cCfg); } } if (!notStartedCacheConfigs.isEmpty()) { cacheProcessor.dynamicStartCaches(notStartedCacheConfigs, false, false, false); } }
Source:
private void getMetaDataProperties(IMediaStream stream, HashMap<String,Object> streamHash){ WMSProperties props = stream.getProperties(); AMFDataObj obj; if (props == null){ logger.warn(httpSessionId+"[" + stream.getName() + "] Can't find properties"); return; } synchronized (props) { obj = (AMFDataObj) props.getProperty(Constants.AMFSETDATAFRAME); } if (obj == null) { logger.warn(httpSessionId+"[" + stream.getName() + "] Can't find meta data"); return; } logger.info(httpSessionId+"[" + stream.getName() + " ] Find property AMFDataObj for stream"); for (String streamParam : Constants.streamParams) { if (obj.containsKey(streamParam)) { if (streamParam.equals(Constants.ONMETADATA_VIDEOCODECIDSTR) || streamParam.equals(Constants.ONMETADATA_AUDIOCODECIDSTR)){ streamHash.put(streamParam, obj.getString(streamParam)); } else{ streamHash.put(streamParam, obj.getDouble(streamParam)); } } } }

Target:
private void getMetaDataProperties(IMediaStream stream, HashMap<String,Object> streamHash){ WMSProperties props = stream.getProperties(); AMFDataObj obj; if (props == null){ logger.warn(httpSessionId+"[" + stream.getName() + "] Can't find properties"); return; } synchronized (props) { obj = (AMFDataObj) props.getProperty(Constants.AMFSETDATAFRAME); } if (obj == null) { logger.warn(httpSessionId+"[" + stream.getName() + "] Can't find meta data"); return; } logger.info(httpSessionId+"[" + stream.getName() + " ] Find property AMFDataObj for stream"); for (String streamParam : Constants.streamParams) { if (obj.containsKey(streamParam)) { if (! streamParam.equals(Constants.ONMETADATA_VIDEOCODECIDSTR) && ! streamParam.equals(Constants.ONMETADATA_AUDIOCODECIDSTR)){ streamHash.put(streamParam, obj.getDouble(streamParam)); } } } }
Source:
public State merge(State s) { if (s instanceof Null) { return this; } if(!(s instanceof CloseableState)) { throw new IllegalStateException("Merging incompatible states"); } return s; }

Target:
public State merge(State s) { return s; }
Source:
protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { ServerErrorCode errorCode = super.validateRequest(partition, requestType, skipPartitionAndDiskAvailableCheck); if (errorCode != ServerErrorCode.No_Error) { return errorCode; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } errorCode = storeManager.checkLocalPartitionStatus(partition, localReplica); switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (requestType.equals(RequestOrResponseType.UndeleteRequest) && !serverConfig.serverHandleUndeleteRequestEnabled) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }

Target:
protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType, boolean skipPartitionAndDiskAvailableCheck) { ServerErrorCode errorCode = super.validateRequest(partition, requestType, skipPartitionAndDiskAvailableCheck); if (errorCode != ServerErrorCode.No_Error) { return errorCode; } if (!skipPartitionAndDiskAvailableCheck) { ReplicaId localReplica = localPartitionToReplicaMap.get(partition); if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) { metrics.diskUnavailableError.inc(); return ServerErrorCode.Disk_Unavailable; } errorCode = storeManager.checkLocalPartitionStatus(partition, localReplica); switch (errorCode) { case Disk_Unavailable: metrics.diskUnavailableError.inc(); localReplica.markDiskDown(); return errorCode; case Replica_Unavailable: metrics.replicaUnavailableError.inc(); return errorCode; case Partition_Unknown: metrics.partitionUnknownError.inc(); return errorCode; } } if (requestType.equals(RequestOrResponseType.PutRequest) && partition.getPartitionState() == PartitionState.READ_ONLY) { metrics.partitionReadOnlyError.inc(); return ServerErrorCode.Partition_ReadOnly; } if (!isRequestEnabled(requestType, partition)) { metrics.temporarilyDisabledError.inc(); return ServerErrorCode.Temporarily_Disabled; } return ServerErrorCode.No_Error; }
Source:
public Map<String, DbParameterAccessor> getAllColumns(String tableOrViewName) throws SQLException { String[] qualifiers = NameNormaliser.normaliseName(tableOrViewName) .split("\\."); String cols = " cname, coltype, length, 'OUT' As is_output, 0 As is_cursor_ref "; String qry = "select " + cols + " from sys.SYSCOLUMNS where 1=1 and "; if (qualifiers.length == 2) { qry += " (creator=? and tname=?) "; } else { qry += " (creator=user and tname=?)"; } return readIntoParams(tableOrViewName, qry); }

Target:
public Map<String, DbParameterAccessor> getAllColumns(String tableOrViewName) throws SQLException { String[] qualifiers = NameNormaliser.normaliseName(tableOrViewName) .split("\\."); String cols = " cname, coltype, length, 'IN' As is_output, 0 As is_cursor_ref "; String qry = "select " + cols + " from sys.SYSCOLUMNS where 1=1 and "; if (qualifiers.length == 2) { qry += " (creator=? and tname=?) "; } else { qry += " (creator=user and tname=?)"; } return readIntoParams(tableOrViewName, qry); }
Source:
public void testIscsiLunCannotBeAddedIfSgioIsFilteredAndScsiReservationEnabled() { LunDisk disk = createISCSILunDisk(ScsiGenericIO.FILTERED, true, DiskInterface.IDE); AddDiskParameters parameters = createParameters(); parameters.setDiskInfo(disk); initializeCommand(Guid.newGuid(), parameters); mockVm(); mockInterfaceList(); assertFalse("Lun disk added successfully WHILE sgio is filtered and scsi reservation is enabled", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk))); assertTrue(command.getReturnValue() .getCanDoActionMessages() .contains(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED.toString())); }

Target:
public void testIscsiLunCannotBeAddedIfSgioIsFilteredAndScsiReservationEnabled() { LunDisk disk = createISCSILunDisk(ScsiGenericIO.FILTERED, true, DiskInterface.IDE); AddDiskParameters parameters = createParameters(); parameters.setDiskInfo(disk); initializeCommand(Guid.newGuid(), parameters); mockVm(); mockInterfaceList(); assertFalse("Lun disk added successfully WHILE sgio is filtered and scsi reservation is enabled", command.checkIfLunDiskCanBeAdded(spyDiskValidator(disk))); verifyCanDoActionMessagesContainMessage(VdcBllMessages.ACTION_TYPE_FAILED_SGIO_IS_FILTERED); }
Source:
public <Z, D extends Database<Z>> void restore(D database, Decoder decoder, File file, boolean dataOnly) throws Exception { try (Connection c = database.connect(decoder)) { try (Statement s = c.createStatement()) { if (!s.execute("set EXCLUSIVE 1;")) { try { s.execute("DROP ALL OBJECTS;"); s.execute("RUNSCRIPT FROM '" + file.getAbsolutePath() + "';"); } finally { s.execute("set EXCLUSIVE 0;"); } } } } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); throw e; } }

Target:
public <Z, D extends Database<Z>> void restore(D database, Decoder decoder, File file, boolean dataOnly) throws Exception { try (Connection c = database.connect(decoder)) { try (Statement s = c.createStatement()) { if (!s.execute("set EXCLUSIVE 1;")) { try { s.execute("DROP ALL OBJECTS;"); s.execute("RUNSCRIPT FROM '" + file.getAbsolutePath() + "';"); } finally { s.execute("set EXCLUSIVE 0;"); } } } } }
Source:
private void populateCPUList(List<ServerCpu> cpus, boolean canChangeArchitecture) { getArchitecture().getSelectedItemChangedEvent().removeListener(this); ServerCpu oldSelectedCpu = getCPU().getSelectedItem(); ArchitectureType oldSelectedArch = getArchitecture().getSelectedItem(); getCPU().setItems(cpus); initSupportedArchitectures(); try { getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrNull(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); } catch (JavaScriptException e) { logger.log(Level.WARNING, "Failed setting the ServerCpu. Exception message: " + e.getMessage()); } if (getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (getIsEdit()) { if (!canChangeArchitecture) { getArchitecture().setItems(new ArrayList<>(Collections.singletonList(getEntity().getArchitecture()))); } if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { if (getEntity() != null) { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } } } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } initCpuArchTypeFiltering(); }

Target:
private void populateCPUList(List<ServerCpu> cpus, boolean canChangeArchitecture) { getArchitecture().getSelectedItemChangedEvent().removeListener(this); ServerCpu oldSelectedCpu = getCPU().getSelectedItem(); ArchitectureType oldSelectedArch = getArchitecture().getSelectedItem(); getCPU().setItems(cpus); initSupportedArchitectures(); getCPU().setSelectedItem(oldSelectedCpu != null ? Linq.firstOrNull(cpus, new Linq.ServerCpuPredicate(oldSelectedCpu.getCpuName())) : null); if (getCPU().getSelectedItem() == null || !isCPUinitialized) { initCPU(); } if (getIsEdit()) { if (!canChangeArchitecture) { getArchitecture().setItems(new ArrayList<>(Collections.singletonList(getEntity().getArchitecture()))); } if (oldSelectedArch != null) { getArchitecture().setSelectedItem(oldSelectedArch); } else { if (getEntity() != null) { getArchitecture().setSelectedItem(getEntity().getArchitecture()); } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } } } else { getArchitecture().setSelectedItem(ArchitectureType.undefined); } initCpuArchTypeFiltering(); }
Source:
private String[] rootArgumentsOnly() throws BadArgumentException { List<String> rootArguments = new ArrayList<String>(); for (int i = 0; i < this.args.length; i++) { final String token = this.args[i]; if (token.equals("-c")) { rootArguments.add(token); if (i < this.args.length) { rootArguments.add(this.args[++i]); } else { throw new BadArgumentException("No argument supplied for option: " + token); } } if (token.equals("--help")) { rootArguments.add(token); if ((i < this.args.length) && (!this.args[i + 1].startsWith("-"))) { rootArguments.add(this.args[++i]); } } if ((token.equals("--version")) || (token.equals("-h"))) { rootArguments.add(token); } if ((token.equals("--trace")) || (token.equals("--debug")) || (token.equals("--verbose")) || (token.equals("--log-trace")) || (token.equals("--log-debug")) || (token.equals("--logverbose"))) { rootArguments.add(token); } } String[] ret = new String[rootArguments.size()]; ret = rootArguments.toArray(ret); return ret; }

Target:
private String[] rootArgumentsOnly() throws BadArgumentException { List<String> rootArguments = new ArrayList<String>(); for (int i = 0; i < this.args.length; i++) { final String token = this.args[i]; if (matchesOption(COMMAND, token) || matchesOption(VIEW_TYPE, token) || matchesOption(ACCESS_KEY, token) || matchesOption(SECRET_KEY, token) || matchesOption(ENDPOINT, token) || matchesOption(PROXY, token)) { rootArguments.add(token); if (i < this.args.length) { rootArguments.add(this.args[++i]); } else { throw new BadArgumentException("No argument supplied for option: " + token); } } if (matchesOption(COMMAND_HELP, token)) { rootArguments.add(token); if ((i < this.args.length) && (!this.args[i + 1].startsWith("-"))) { rootArguments.add(this.args[++i]); } } if ((matchesOption(VERBOSE, token)) || (matchesOption(PRINT_HELP, token)) || (matchesOption(TRACE, token)) || (matchesOption(DEBUG, token)) || (matchesOption(VERBOSE, token)) || (matchesOption(LOG_TRACE, token)) || (matchesOption(LOG_DEBUG, token)) || (matchesOption(LOG_VERBOSE, token))) { rootArguments.add(token); } } String[] ret = new String[rootArguments.size()]; ret = rootArguments.toArray(ret); return ret; }
Source:
private String getText(final EObject element) { ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory); String text = adapterFactoryItemDelegator.getText(element); adapterFactory.dispose(); return text; }

Target:
private String getText(final EObject element) { String text = null; ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory); try { text = adapterFactoryItemDelegator.getText(element); } finally { adapterFactory.dispose(); } return text; }
Source:
private Map<String, List<String>> getCallsToDependencies(String mainDescriptor) { Map<String, List<String>> map = new HashMap<>(); try (InputStream stream = IOUtils.toInputStream(mainDescriptor, StandardCharsets.UTF_8)) { GroovyRecognizer make = GroovyRecognizer.make(new GroovyLexer(stream)); make.compilationUnit(); GroovySourceAST ast = (GroovySourceAST)make.getAST(); List<GroovySourceAST> processList = getSubtreesOfKeyword(ast, "process"); Map<String, List<String>> processNameToInputChannels = new HashMap<>(); Map<String, List<String>> processNameToOutputChannels = new HashMap<>(); for (GroovySourceAST processAST : processList) { String processName = getProcessValue(processAST); List<String> inputs = getInputDependencyList(processAST); processNameToInputChannels.put(processName, inputs); List<String> outputs = getOutputDependencyList(processAST); processNameToOutputChannels.put(processName, outputs); } for (String processName : processNameToInputChannels.keySet()) { List<String> dependencies = new ArrayList<>(); for (String channelRead : processNameToInputChannels.get(processName)) { for (String dependentProcessName : processNameToOutputChannels.keySet()) { for (String channelWrite : processNameToOutputChannels.get(dependentProcessName)) { if (Objects.equals(channelRead, channelWrite)) { dependencies.add(dependentProcessName); break; } } } } map.put(processName, dependencies); } } catch (IOException | TokenStreamException | RecognitionException e) { LOG.warn("could not parse", e); } return map; }

Target:
private Map<String, List<String>> getCallsToDependencies(String mainDescriptor) { Map<String, List<String>> map = new HashMap<>(); try (InputStream stream = IOUtils.toInputStream(mainDescriptor, StandardCharsets.UTF_8)) { GroovyRecognizer make = GroovyRecognizer.make(new GroovyLexer(stream)); make.compilationUnit(); GroovySourceAST ast = (GroovySourceAST)make.getAST(); List<GroovySourceAST> processList = getSubtreesOfKeyword(ast, "process"); Map<String, List<String>> processNameToInputChannels = new HashMap<>(); Map<String, List<String>> processNameToOutputChannels = new HashMap<>(); processList.forEach((GroovySourceAST processAST) -> { String processName = getProcessValue(processAST); List<String> inputs = getInputDependencyList(processAST); processNameToInputChannels.put(processName, inputs); List<String> outputs = getOutputDependencyList(processAST); processNameToOutputChannels.put(processName, outputs); }); processNameToInputChannels.keySet().forEach((String processName) -> { List<String> dependencies = new ArrayList<>(); processNameToInputChannels.get(processName).forEach((String channelRead) -> { processNameToOutputChannels.keySet().forEach((String dependentProcessName) -> { Optional<String> temp = processNameToOutputChannels.get(dependentProcessName) .stream() .filter(channelWrite -> Objects.equals(channelRead, channelWrite)) .findFirst(); if (temp.isPresent()) { dependencies.add(dependentProcessName); } }); }); map.put(processName, dependencies); }); } catch (IOException | TokenStreamException | RecognitionException e) { LOG.warn("could not parse", e); } return map; }
Source:
private static DetailAST findWarningsHolder(final DetailAST annotation) { DetailAST warningsHolder = annotation; final DetailAST annValuePair = annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); final DetailAST annArrayInit; if (annValuePair == null) { annArrayInit = annotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); } else { annArrayInit = annValuePair.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); } if (annArrayInit != null) { warningsHolder = annArrayInit; } return warningsHolder; }

Target:
private static DetailAST findWarningsHolder(final DetailAST annotation) { final DetailAST annValuePair = annotation.findFirstToken(TokenTypes.ANNOTATION_MEMBER_VALUE_PAIR); final DetailAST annArrayInit; if (annValuePair == null) { annArrayInit = annotation.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); } else { annArrayInit = annValuePair.findFirstToken(TokenTypes.ANNOTATION_ARRAY_INIT); } DetailAST warningsHolder = annotation; if (annArrayInit != null) { warningsHolder = annArrayInit; } return warningsHolder; }
Source:
public int createAndLinkVertex (double lat, double lon) { int stopVertex = vertexStore.addVertex(lat, lon); int streetVertex = getOrCreateVertexNear(lat, lon, StreetMode.WALK); if (streetVertex == -1) { return -1; } double streetVertexLat = vertexStore.fixedLats.get(streetVertex)/FIXED_FACTOR; double streetVertexLon = vertexStore.fixedLons.get(streetVertex)/FIXED_FACTOR; ArrayList<Node> edgeNodes = new ArrayList<>(); edgeNodes.add(new Node(lat, lon)); edgeNodes.add(new Node(streetVertexLat,streetVertexLon)); int length = getEdgeLengthMillimeters(edgeNodes); Edge e = edgeStore.addStreetPair(stopVertex, streetVertex, length, -1); e.allowAllModes(); e.setFlag(EdgeStore.EdgeFlag.LINK); e.advance(); e.allowAllModes(); e.setFlag(EdgeStore.EdgeFlag.LINK); return stopVertex; }

Target:
public int createAndLinkVertex (double lat, double lon) { int stopVertex = vertexStore.addVertex(lat, lon); int streetVertexIndex = getOrCreateVertexNear(lat, lon, StreetMode.WALK); if (streetVertexIndex == -1) { return -1; } VertexStore.Vertex streetVertex = vertexStore.getCursor(streetVertexIndex); int length_mm = (int) (GeometryUtils.distance(lat,lon, streetVertex.getLat(), streetVertex.getLon())*1000); Edge e = edgeStore.addStreetPair(stopVertex, streetVertexIndex, length_mm, -1); e.allowAllModes(); e.setFlag(EdgeStore.EdgeFlag.LINK); e.advance(); e.allowAllModes(); e.setFlag(EdgeStore.EdgeFlag.LINK); return stopVertex; }
Source:
private void initMember(HazelcastInstanceType instanceType, boolean reInitialize) { if (_memberInstances.get(instanceType) == null || reInitialize) { long start = System.currentTimeMillis(); synchronized (syncMe) { if (_memberInstances.get(instanceType) == null || reInitialize) { Logger.info(this, "Setting Up HazelCast ("+ instanceType +")"); HazelcastInstance memberInstance = _memberInstances.remove(instanceType); if (memberInstance != null) { try { Thread.sleep(1000); } catch (InterruptedException e) { Logger.error(this, "Error waiting instance to become vacant", e); } finally { memberInstance.shutdown(); } } if (instanceType == HazelcastInstanceType.EMBEDDED) { memberInstance = newHazelcastInstanceEmbedded(instanceType.getPath()); } else if (instanceType == HazelcastInstanceType.CLIENT) { memberInstance = newHazelcastInstanceClient(instanceType.getPath()); } _memberInstances.put(instanceType, memberInstance); Logger.info(this, "Initialized Hazelcast member "+ memberInstance); } } System.setProperty(WebKeys.DOTCMS_STARTUP_TIME_HAZEL, String.valueOf(System.currentTimeMillis() - start)); } }

Target:
private void initMember(HazelcastInstanceType instanceType, boolean reInitialize) { if (_memberInstances.get(instanceType) == null || reInitialize) { long start = System.currentTimeMillis(); synchronized (this) { if (_memberInstances.get(instanceType) == null || reInitialize) { Logger.info(this, "Setting Up HazelCast ("+ instanceType +")"); HazelcastInstance memberInstance = _memberInstances.remove(instanceType); if (memberInstance != null) { try { Thread.sleep(1000); } catch (InterruptedException e) { Logger.error(this, "Error waiting instance to become vacant", e); } finally { memberInstance.shutdown(); } } memberInstance = _memberFactory.createHazelcastInstance(instanceType); _memberInstances.put(instanceType, memberInstance); Logger.info(this, "Initialized Hazelcast member "+ memberInstance); } } System.setProperty(WebKeys.DOTCMS_STARTUP_TIME_HAZEL, String.valueOf(System.currentTimeMillis() - start)); } }
Source:
public final EmailConfiguration build() { Preconditions.checkArgument(!Strings.isNullOrEmpty(host), "host can not be empty."); Preconditions.checkArgument(port > 0 && port < 65535, "port should larger than 0 and small than 65535."); Preconditions.checkArgument(!Strings.isNullOrEmpty(username), "username can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(password), "password can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(from), "from can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(to), "to can not be empty."); return new EmailConfiguration(host, port, username, password, useSsl, subject, from, to, cc, bcc, debug); }

Target:
public final EmailConfiguration build() { Preconditions.checkArgument(!Strings.isNullOrEmpty(host), "host can not be empty."); Preconditions.checkArgument(0 < port && 65535 > port, "port should larger than 0 and small than 65535."); Preconditions.checkArgument(!Strings.isNullOrEmpty(username), "username can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(password), "password can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(from), "from can not be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(to), "to can not be empty."); return new EmailConfiguration(host, port, username, password, useSsl, subject, from, to, cc, bcc, debug); }
Source:
public static <T> ReplaySubject<T> create(int capacity) { final UnboundedReplayState<T> state = new UnboundedReplayState<T>(capacity); SubjectSubscriptionManager<T> ssm = new SubjectSubscriptionManager<T>(); ssm.onStart = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { int lastIndex = state.replayObserverFromIndex(0, o); o.index(lastIndex); } }; ssm.onAdded = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { synchronized (o) { if (!o.first || o.emitting) { return; } o.first = false; o.emitting = true; } boolean skipFinal = false; try { for (;;) { int idx = o.<Integer>index(); int sidx = state.index.get(); if (idx != sidx) { Integer j = state.replayObserverFromIndex(idx, o); o.index(j); } synchronized (o) { if (sidx == state.index.get()) { o.emitting = false; skipFinal = true; break; } } } } finally { if (!skipFinal) { synchronized (o) { o.emitting = false; } } } } }; ssm.onTerminated = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { Integer idx = o.index(); if (idx == null) { idx = 0; } state.replayObserverFromIndex(idx, o); } }; return new ReplaySubject<T>(ssm, ssm, state); }

Target:
public static <T> ReplaySubject<T> create(int capacity) { final UnboundedReplayState<T> state = new UnboundedReplayState<T>(capacity); SubjectSubscriptionManager<T> ssm = new SubjectSubscriptionManager<T>(); ssm.onStart = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { int lastIndex = state.replayObserverFromIndex(0, o); o.index(lastIndex); } }; ssm.onAdded = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { synchronized (o) { if (!o.first || o.emitting) { return; } o.first = false; o.emitting = true; } boolean skipFinal = false; try { final UnboundedReplayState<T> localState = state; for (;;) { int idx = o.<Integer>index(); int sidx = localState.get(); if (idx != sidx) { Integer j = localState.replayObserverFromIndex(idx, o); o.index(j); } synchronized (o) { if (sidx == localState.get()) { o.emitting = false; skipFinal = true; break; } } } } finally { if (!skipFinal) { synchronized (o) { o.emitting = false; } } } } }; ssm.onTerminated = new Action1<SubjectObserver<T>>() { @Override public void call(SubjectObserver<T> o) { Integer idx = o.index(); if (idx == null) { idx = 0; } state.replayObserverFromIndex(idx, o); } }; return new ReplaySubject<T>(ssm, ssm, state); }
Source:
public void unregisterJob(final String groupName) throws SchedulerException { if(!ifJobExist(groupName)) { logger.warn("can not find job with " + groupName + " in quartz."); } else { this.scheduler.deleteJob(new JobKey("job1", groupName)); } }

Target:
public void unregisterJob(final String groupName) throws SchedulerException { if(!ifJobExist(groupName)) { logger.warn("can not find job with " + groupName + " in quartz."); } else { this.scheduler.deleteJob(new JobKey(DEFAULT_JOB_NAME, groupName)); } }
Source:
public Set<String> fetchSpecies(SemanticQueryTerm geneQueryTerm) { SolrQuery query = new SolrQuery(); query.setRows(1); query.setQuery( geneQueryTerm.hasNoCategory() ? MessageFormat.format("bioentity_identifier:\"{0}\"", geneQueryTerm.value()) : geneQueryTerm.asGxaIndexQueryLiteral()); return solrClient.query(query, false, "species"); }

Target:
public Set<String> fetchSpecies(SemanticQueryTerm geneQueryTerm) { SolrQuery query = new SolrQuery(); query.setRows(1); if (geneQueryTerm.hasNoCategory()) { query.setQuery(MessageFormat.format("bioentity_identifier:\"{0}\"", geneQueryTerm.value())); } Set<String> queryResults = solrClient.query(query, false, "species"); if (!queryResults.isEmpty()) { return queryResults; } query.setQuery(geneQueryTerm.asBioentitiesIndexQueryLiteral()); return solrClient.query(query, false, "species"); }
Source:
public void visitMethodInvocation(MethodInvocationTree syntaxNode) { for (MethodMatcher matcher : CLOSEABLE_EXCEPTIONS) { if (matcher.matches(syntaxNode)) { return; } } if (syntaxNode.methodSelect().is(Tree.Kind.MEMBER_SELECT) && needsClosing(syntaxNode.symbolType())) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) syntaxNode.methodSelect()).expression(); boolean jdbcResourceCreation = isJdbcResourceCreation(syntaxNode); if (targetExpression.is(Tree.Kind.IDENTIFIER) && !isWithinTryHeader(syntaxNode) && (syntaxNode.symbol().isStatic() || jdbcResourceCreation)) { SymbolicValue peekedValue = programState.peekValue(); programState = programState.addConstraintTransitively(peekedValue, OPEN); if (jdbcResourceCreation) { programState = programState.addConstraint(peekedValue, ObjectConstraint.NOT_NULL); } } } }

Target:
public void visitMethodInvocation(MethodInvocationTree syntaxNode) { for (MethodMatcher matcher : CLOSEABLE_EXCEPTIONS) { if (matcher.matches(syntaxNode)) { return; } } if (syntaxNode.methodSelect().is(Tree.Kind.MEMBER_SELECT) && needsClosing(syntaxNode.symbolType())) { final ExpressionTree targetExpression = ((MemberSelectExpressionTree) syntaxNode.methodSelect()).expression(); boolean jdbcResourceCreation = JDBC_RESOURCE_CREATIONS.anyMatch(syntaxNode); if (targetExpression.is(Tree.Kind.IDENTIFIER) && !isWithinTryHeader(syntaxNode) && (syntaxNode.symbol().isStatic() || jdbcResourceCreation)) { SymbolicValue peekedValue = programState.peekValue(); programState = programState.addConstraintTransitively(peekedValue, OPEN); if (jdbcResourceCreation) { programState = programState.addConstraint(peekedValue, ObjectConstraint.NOT_NULL); } } } }
Source:
public static SupportedAdditionalClusterFeature getEnabledFeature(BackendResource resource, Guid clusterId, Guid id) { Set<SupportedAdditionalClusterFeature> addlFeatures = resource.getOptionalEntity(Set.class, QueryType.GetClusterFeaturesByClusterId, new IdQueryParameters(clusterId), clusterId.toString(), false); SupportedAdditionalClusterFeature feature = addlFeatures .stream() .filter(f -> f.getFeature().getId().equals(id) && f.isEnabled()) .findFirst() .orElseThrow(() -> new WebApplicationException(Response.Status.NOT_FOUND)); return feature; }

Target:
public static SupportedAdditionalClusterFeature getEnabledFeature(BackendResource resource, Guid clusterId, Guid id) { Set<SupportedAdditionalClusterFeature> addlFeatures = resource.getOptionalEntity(Set.class, QueryType.GetClusterFeaturesByClusterId, new IdQueryParameters(clusterId), clusterId.toString(), false); SupportedAdditionalClusterFeature feature = addlFeatures .stream() .filter(f -> f.getFeature().getId().equals(id) && f.isEnabled()) .findFirst() .orElse(null); return feature; }
Source:
public List<RefundHistory> searchAllHistoryByChargeExternalId(String chargeExternalId) { String query = "SELECT r.id, r.external_id, r.amount, r.status, charge_id, r.created_date, r.version, " + "r.reference, history_start_date, history_end_date, user_external_id, r.gateway_transaction_id, " + "c.external_id AS charge_external_id, c.gateway_account_id, r.user_email " + " FROM refunds_history r , charges c" + " WHERE charge_external_id = ?1" + " and r.charge_external_id = c.external_id"; return entityManager.get() .createNativeQuery(query, "RefundEntityHistoryMapping") .setParameter(1, chargeExternalId) .getResultList(); }

Target:
public List<RefundHistory> searchAllHistoryByChargeExternalId(String chargeExternalId) { String query = "SELECT r.id, r.external_id, r.amount, r.status, r.charge_id, r.created_date, r.version, " + "r.reference, history_start_date, history_end_date, user_external_id, r.gateway_transaction_id, " + "r.charge_external_id AS charge_external_id, r.user_email " + " FROM refunds_history r " + " WHERE charge_external_id = ?1"; return entityManager.get() .createNativeQuery(query, "RefundEntityHistoryMapping") .setParameter(1, chargeExternalId) .getResultList(); }
Source:
private Acl createAcl(DocId docId, Permissions.Acl permissions, PermissionSource permSrc, String parentFragment) { return createAcl(docId, parentFragment, Acl.InheritanceType.CHILD_OVERRIDES, options.getGlobalNamespace(), permissions.getAllowUsers(permSrc), permissions.getDenyUsers(permSrc), permissions.getAllowGroups(permSrc), permissions.getDenyGroups(permSrc)); }

Target:
private Acl createAcl(DocId docId, Permissions.Acl permissions, PermissionSource permSrc, String parentFragment) { return createAcl(docId, parentFragment, Acl.InheritanceType.CHILD_OVERRIDES, permissions.getAllowUsers(permSrc), permissions.getDenyUsers(permSrc), permissions.getAllowGroups(permSrc), permissions.getDenyGroups(permSrc)); }