auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public TransactionTemplate( GraphDatabaseService gds, Monitor monitor, int retries, long backoff, Predicate<Throwable> retryPredicate ) { this.gds = gds; this.monitor = monitor; this.retries = retries; this.backoff = backoff; this.retryPredicate = retryPredicate; }

Target:
public TransactionTemplate( GraphDatabaseService gds, Monitor monitor, int retries, long backoff, Predicate<Throwable> retryPredicate ) { Objects.requireNonNull( gds ); Objects.requireNonNull( monitor ); if ( retries < 0 ) { throw new IllegalArgumentException( "Number of retries must be greater than or equal to 0" ); } if ( backoff < 0 ) { throw new IllegalArgumentException( "Backoff time must be a positive number" ); } Objects.requireNonNull( retryPredicate ); this.gds = gds; this.monitor = monitor; this.retries = retries; this.backoff = backoff; this.retryPredicate = retryPredicate; }
Source:
private DatanodeInfo chooseDatanode(final Router router, final String path, final HttpOpParam.Op op, final long openOffset, final String excludeDatanodes) throws IOException { DatanodeInfo[] dns = null; HashSet<Node> excludes = new HashSet<Node>(); if (op == GetOpParam.Op.OPEN || op == PostOpParam.Op.APPEND || op == GetOpParam.Op.GETFILECHECKSUM) { final ClientProtocol cp = getRpcClientProtocol(); final HdfsFileStatus status = cp.getFileInfo(path); if (status == null) { throw new FileNotFoundException("File " + path + " not found."); } final long len = status.getLen(); if (op == GetOpParam.Op.OPEN) { if (openOffset < 0L || (openOffset >= len && len > 0)) { throw new IOException("Offset=" + openOffset + " out of the range [0, " + len + "); " + op + ", path=" + path); } } if (len > 0) { final long offset = op == GetOpParam.Op.OPEN ? openOffset : len - 1; final LocatedBlocks locations = cp.getBlockLocations(path, offset, 1); final int count = locations.locatedBlockCount(); if (count > 0) { if (excludeDatanodes != null) { Collection<String> collection = getTrimmedStringCollection(excludeDatanodes); dns = getDatanodeReport(router); for (DatanodeInfo dn : dns) { if (collection.contains(dn.getName())) { excludes.add(dn); } } } LocatedBlock location0 = locations.get(0); return bestNode(location0.getLocations(), excludes); } } } if (dns == null) { dns = getDatanodeReport(router); } return getRandomDatanode(dns, excludes); }

Target:
private DatanodeInfo chooseDatanode(final Router router, final String path, final HttpOpParam.Op op, final long openOffset, final String excludeDatanodes) throws IOException { final RouterRpcServer rpcServer = getRPCServer(router); DatanodeInfo[] dns = null; try { dns = rpcServer.getCachedDatanodeReport(DatanodeReportType.LIVE); } catch (IOException e) { LOG.error("Cannot get the datanodes from the RPC server", e); } HashSet<Node> excludes = new HashSet<Node>(); if (excludeDatanodes != null) { Collection<String> collection = getTrimmedStringCollection(excludeDatanodes); for (DatanodeInfo dn : dns) { if (collection.contains(dn.getName())) { excludes.add(dn); } } } if (op == GetOpParam.Op.OPEN || op == PostOpParam.Op.APPEND || op == GetOpParam.Op.GETFILECHECKSUM) { final ClientProtocol cp = getRpcClientProtocol(); final HdfsFileStatus status = cp.getFileInfo(path); if (status == null) { throw new FileNotFoundException("File " + path + " not found."); } final long len = status.getLen(); if (op == GetOpParam.Op.OPEN) { if (openOffset < 0L || (openOffset >= len && len > 0)) { throw new IOException("Offset=" + openOffset + " out of the range [0, " + len + "); " + op + ", path=" + path); } } if (len > 0) { final long offset = op == GetOpParam.Op.OPEN ? openOffset : len - 1; final LocatedBlocks locations = cp.getBlockLocations(path, offset, 1); final int count = locations.locatedBlockCount(); if (count > 0) { LocatedBlock location0 = locations.get(0); return bestNode(location0.getLocations(), excludes); } } } return getRandomDatanode(dns, excludes); }
Source:
void check(CommandEnvelope envelope) { if (didHandleSinceLastSnapshot(envelope)) { final Command command = envelope.getOuterObject(); throw DuplicateCommandException.forAggregate(command); } }

Target:
void check(CommandEnvelope envelope) { if (didHandleSinceLastSnapshot(envelope)) { final Command command = envelope.getOuterObject(); throw DuplicateCommandException.of(command); } }
Source:
public void shouldMigrate() throws Exception { List<LogEntry> entries = new ArrayList<>(); for (int i = 0; i < 1000; i++) { entries.add(LogEntryGen.doCreateEntry("mydoc", "evt" + i, "cat" + i % 2)); } jpaBackend.addLogEntries(entries); txFeature.nextTransaction(); List<Long> res = (List<Long>) jpaBackend.nativeQuery("select count(*) from LogEntry", 1, 20); final long nbEntriesToMigrate = res.get(0).longValue(); Assert.assertEquals(1000, nbEntriesToMigrate); AuditBackend backend = (AuditBackend) Framework.getService(AuditLogger.class); Assert.assertNotNull(backend); Assert.assertTrue(backend instanceof ESAuditBackend); ESAuditBackend esBackend = (ESAuditBackend) backend; esBackend.migrate(100); Framework.getLocalService(WorkManager.class).awaitCompletion(1, TimeUnit.MINUTES); LogEntryGen.flushAndSync(); String singleQuery = " {\"query\": {\n" + " \"bool\" : {\n" + " \"must\" : {\n" + " \"match\" : {\n" + " \"docUUID\" : {\n" + " \"query\" : \"mydoc\",\n" + " \"type\" : \"boolean\"\n" + " }\n" + " }\n" + " }\n" + " }\n" + " }} \n" + ""; List<LogEntry> migratedEntries = (List<LogEntry>) backend.nativeQuery(singleQuery, 0, 1001); Assert.assertEquals(1000, migratedEntries.size()); }

Target:
public void shouldMigrate() throws Exception { List<LogEntry> entries = new ArrayList<>(); for (int i = 0; i < 1000; i++) { entries.add(LogEntryGen.doCreateEntry("mydoc", "evt" + i, "cat" + i % 2)); } jpaBackend.addLogEntries(entries); txFeature.nextTransaction(); List<Long> res = (List<Long>) jpaBackend.nativeQuery("select count(*) from LogEntry", 1, 20); final long nbEntriesToMigrate = res.get(0).longValue(); Assert.assertEquals(1000, nbEntriesToMigrate); AuditBackend backend = Framework.getService(AuditBackend.class); Assert.assertNotNull(backend); Assert.assertTrue(backend instanceof ESAuditBackend); ESAuditBackend esBackend = (ESAuditBackend) backend; esBackend.migrate(100); Framework.getLocalService(WorkManager.class).awaitCompletion(1, TimeUnit.MINUTES); LogEntryGen.flushAndSync(); String singleQuery = " {\"query\": {\n" + " \"bool\" : {\n" + " \"must\" : {\n" + " \"match\" : {\n" + " \"docUUID\" : {\n" + " \"query\" : \"mydoc\",\n" + " \"type\" : \"boolean\"\n" + " }\n" + " }\n" + " }\n" + " }\n" + " }} \n" + ""; List<LogEntry> migratedEntries = (List<LogEntry>) backend.nativeQuery(singleQuery, 0, 1001); Assert.assertEquals(1000, migratedEntries.size()); }
Source:
public final InetSocketAddress getSource() { return endpoint.getAddress(); }

Target:
public InetSocketAddress getSource() { return endpoint.getAddress(); }
Source:
private double calculateDistance(double lat1, double lng1, double lat2, double lng2, Metric metric) { if ((lat1 == lat2) && (lng1 == lng2)) { return 0; } else { double dLat = Math.toRadians(lat2 - lat1); double dLon = Math.toRadians(lng2 - lng1); lat1 = Math.toRadians(lat1); lat2 = Math.toRadians(lat2); double a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2); double c = 2 * Math.asin(Math.sqrt(a)); double dist = R * c; if (Metrics.MILES.equals(metric)) { dist = dist * KM_TO_MILES; } else if (Metrics.NEUTRAL.equals(metric)) { dist = dist * KM_TO_NEUTRAL; } return dist; } }

Target:
private double calculateDistance(double lat1, double lng1, double lat2, double lng2, Metric metric) { if ((lat1 == lat2) && (lng1 == lng2)) { return 0; } else { double dLat = Math.toRadians(lat2 - lat1); double dLon = Math.toRadians(lng2 - lng1); double lat1Radians = Math.toRadians(lat1); double lat2Radians = Math.toRadians(lat2); double a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1Radians) * Math.cos(lat2Radians); double c = 2 * Math.asin(Math.sqrt(a)); double dist = R * c; if (Metrics.MILES.equals(metric)) { dist = dist * KM_TO_MILES; } else if (Metrics.NEUTRAL.equals(metric)) { dist = dist * KM_TO_NEUTRAL; } return dist; } }
Source:
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { String clientRegistrationId = this.resolveClientRegistrationId(parameter); if (StringUtils.isEmpty(clientRegistrationId)) { throw new IllegalArgumentException("Unable to resolve the Client Registration Identifier. " + "It must be provided via @RegisteredOAuth2AuthorizedClient(\"client1\") or " + "@RegisteredOAuth2AuthorizedClient(registrationId = \"client1\")."); } Authentication principal = SecurityContextHolder.getContext().getAuthentication(); HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); OAuth2AuthorizedClient authorizedClient = this.authorizedClientRepository.loadAuthorizedClient( clientRegistrationId, principal, servletRequest); if (authorizedClient != null) { return authorizedClient; } ClientRegistration clientRegistration = this.clientRegistrationRepository.findByRegistrationId(clientRegistrationId); if (clientRegistration == null) { return null; } OAuth2AuthorizationContext.Builder contextBuilder = OAuth2AuthorizationContext.forAuthorization(clientRegistration); if (principal != null) { contextBuilder.principal(principal); } else { contextBuilder.principal("anonymousUser"); } OAuth2AuthorizationContext authorizationContext = contextBuilder.build(); authorizedClient = this.authorizedClientProvider.authorize(authorizationContext); HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class); this.authorizedClientRepository.saveAuthorizedClient( authorizedClient, authorizationContext.getPrincipal(), servletRequest, servletResponse); return authorizedClient; }

Target:
public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { String clientRegistrationId = this.resolveClientRegistrationId(parameter); if (StringUtils.isEmpty(clientRegistrationId)) { throw new IllegalArgumentException("Unable to resolve the Client Registration Identifier. " + "It must be provided via @RegisteredOAuth2AuthorizedClient(\"client1\") or " + "@RegisteredOAuth2AuthorizedClient(registrationId = \"client1\")."); } Authentication principal = SecurityContextHolder.getContext().getAuthentication(); if (principal == null) { principal = ANONYMOUS_AUTHENTICATION; } HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class); HttpServletResponse servletResponse = webRequest.getNativeResponse(HttpServletResponse.class); OAuth2AuthorizeRequest authorizeRequest = new OAuth2AuthorizeRequest( clientRegistrationId, principal, servletRequest, servletResponse); return this.authorizedClientManager.authorize(authorizeRequest); }
Source:
private int getDateTimeStyle() { EEF_DATE_DISPLAY display = this.description.getDisplay(); switch (display.getValue()) { case EEF_DATE_DISPLAY.CALENDAR_VALUE: return SWT.CALENDAR; case EEF_DATE_DISPLAY.DATE_VALUE: return SWT.DATE; case EEF_DATE_DISPLAY.TIME_VALUE: return SWT.TIME; default: return SWT.CALENDAR; } }

Target:
private int getDateTimeStyle() { EEF_DATE_DISPLAY display = this.description.getDisplay(); int style; switch (display.getValue()) { case EEF_DATE_DISPLAY.CALENDAR_VALUE: style = SWT.CALENDAR; break; case EEF_DATE_DISPLAY.DATE_VALUE: style = SWT.DATE; break; case EEF_DATE_DISPLAY.TIME_VALUE: style = SWT.TIME; break; default: style = SWT.CALENDAR; break; } return style; }
Source:
private void displayDetails(String period, String unit, String dataType) throws Exception { System.out.println("***********************************************"); System.out.println("executing for:"); System.out.println(unit + "(" + period + ")"); System.out.println("dataType=" + dataType); System.out.println("***********************************************"); }

Target:
private void displayDetails(String period, String unit, String dataType) throws Exception { logger.info("***********************************************"); logger.info("executing for:"); logger.info(unit + "(" + period + ")"); logger.info("dataType=" + dataType); logger.info("***********************************************"); }
Source:
public void setFeatureAttributeName(String featureAttributeName) { if (null == featureAttributeName) log.debug("WPS request process error: Feature Attribute Name was null. Can not process without the output column name."); this.featureAttributeName = featureAttributeName; }

Target:
public void setFeatureAttributeName(String featureAttributeName) { if (null == featureAttributeName) { log.debug("WPS request process error: Feature Attribute Name was null. Can not process without the output column name."); } this.featureAttributeName = featureAttributeName; }
Source:
void shouldReturnAllKeys() { final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory("keyA").build()); issues.add(builder.setCategory("keyB").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); Set<String> str = new HashSet(); str.add("keyA"); str.add("keyB"); Set<String> actualProperty = statistics.getKeys(); assertThat(actualProperty).isEqualTo(str); }

Target:
void shouldReturnAllKeys() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); issues.add(builder.setCategory("keyA").build()); issues.add(builder.setCategory("keyB").build()); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); Set<String> str = new HashSet(); str.add("keyA"); str.add("keyB"); Set<String> actualProperty = statistics.getKeys(); assertThat(actualProperty).isEqualTo(str); }
Source:
public boolean equals(Object o) { if (o instanceof MappedFieldType == false) { return false; } MappedFieldType fieldType = (MappedFieldType) o; return boost == fieldType.boost && docValues == fieldType.docValues && Objects.equals(name, fieldType.name) && Objects.equals(indexAnalyzer, fieldType.indexAnalyzer) && Objects.equals(searchAnalyzer, fieldType.searchAnalyzer) && Objects.equals(searchQuoteAnalyzer(), fieldType.searchQuoteAnalyzer()) && Objects.equals(eagerGlobalOrdinals, fieldType.eagerGlobalOrdinals) && Objects.equals(similarity, fieldType.similarity) && Objects.equals(meta, fieldType.meta); }

Target:
public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } MappedFieldType fieldType = (MappedFieldType) o; return boost == fieldType.boost && docValues == fieldType.docValues && Objects.equals(name, fieldType.name) && Objects.equals(indexAnalyzer, fieldType.indexAnalyzer) && Objects.equals(searchAnalyzer, fieldType.searchAnalyzer) && Objects.equals(searchQuoteAnalyzer(), fieldType.searchQuoteAnalyzer()) && Objects.equals(eagerGlobalOrdinals, fieldType.eagerGlobalOrdinals) && Objects.equals(similarity, fieldType.similarity) && Objects.equals(meta, fieldType.meta); }
Source:
public void loadModulesIntoClasspath() { Path pluginFolder = FileSystems.getDefault().getPath(ConfigMain.getParameter("pluginFolder")); URLClassLoader sysLoader = null; try { DirectoryStream<Path> stream = Files.newDirectoryStream(pluginFolder, "*.jar"); for (Path f : stream) { File loc = new File(f.toString()); sysLoader = (URLClassLoader) this.getClass().getClassLoader(); ArrayList<URL> urls = new ArrayList<>(Arrays.asList(sysLoader.getURLs())); URL udir = loc.toURI().toURL(); if (!urls.contains(udir)) { Class<URLClassLoader> sysClass = URLClassLoader.class; Method method = sysClass.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); method.invoke(sysLoader, udir); } } } catch (IOException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { e.printStackTrace(); } }

Target:
private void loadModulesIntoClasspath() { Path pluginFolder = FileSystems.getDefault().getPath(ConfigMain.getParameter("pluginFolder")); URLClassLoader sysLoader = null; try { DirectoryStream<Path> stream = Files.newDirectoryStream(pluginFolder, "*.jar"); for (Path f : stream) { File loc = new File(f.toString()); sysLoader = (URLClassLoader) this.getClass().getClassLoader(); ArrayList<URL> urls = new ArrayList<>(Arrays.asList(sysLoader.getURLs())); URL udir = loc.toURI().toURL(); if (!urls.contains(udir)) { Class<URLClassLoader> sysClass = URLClassLoader.class; Method method = sysClass.getDeclaredMethod("addURL", URL.class); method.setAccessible(true); method.invoke(sysLoader, udir); } } } catch (IOException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { logger.error("Classpath could not be accessed", e.getMessage()); } }
Source:
private OpenFoodAPIService getApiServiceForProductType(int productType){ final int OPEN_FOOD_FACT = 5; final int OPEN_BEAUTY_FACTS = 6; final int OPEN_PET_FOOD_FACTS = 7; final int OPEN_PRODUCTS_FACTS = 8; switch (productType){ case OPEN_FOOD_FACT: return new OpenFoodAPIClient(getActivity(), "<LINK_4>").getAPIService(); case OPEN_BEAUTY_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_0>").getAPIService(); case OPEN_PET_FOOD_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_2>").getAPIService(); case OPEN_PRODUCTS_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_1>").getAPIService(); default: return CommonApiManager.getInstance().getOpenFoodApiService(); } }

Target:
private OpenFoodAPIService getApiServiceForProductType(int productType){ final int OPEN_FOOD_FACTS = 5; final int OPEN_BEAUTY_FACTS = 6; final int OPEN_PET_FOOD_FACTS = 7; final int OPEN_PRODUCTS_FACTS = 8; switch (productType){ case OPEN_FOOD_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_3>").getAPIService(); case OPEN_BEAUTY_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_0>").getAPIService(); case OPEN_PET_FOOD_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_2>").getAPIService(); case OPEN_PRODUCTS_FACTS: return new OpenFoodAPIClient(getActivity(), "<LINK_1>").getAPIService(); default: return CommonApiManager.getInstance().getOpenFoodApiService(); } }
Source:
public void afterPropertiesSet() throws Exception { ReflectionUtils.doWithMethods(this.type, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException { Assert.notNull(BindableProxyFactory.this.channelFactory, "Channel Factory cannot be null"); Input input = AnnotationUtils.findAnnotation(method, Input.class); if (input != null) { String name = BindingBeanDefinitionRegistryUtils.getChannelName(input, method); validateChannelType(method.getReturnType()); MessageChannel sharedChannel = locateSharedChannel(name); if (sharedChannel == null) { BindableProxyFactory.this.inputHolders.put(name, new ChannelHolder( BindableProxyFactory.this.channelFactory.createInputChannel(name), true)); } else { BindableProxyFactory.this.inputHolders.put(name, new ChannelHolder(sharedChannel, false)); } } } }); ReflectionUtils.doWithMethods(this.type, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException { Output output = AnnotationUtils.findAnnotation(method, Output.class); if (output != null) { String name = BindingBeanDefinitionRegistryUtils.getChannelName(output, method); validateChannelType(method.getReturnType()); MessageChannel sharedChannel = locateSharedChannel(name); if (sharedChannel == null) { BindableProxyFactory.this.outputHolders.put(name, new ChannelHolder( BindableProxyFactory.this.channelFactory.createOutputChannel(name), true)); } else { BindableProxyFactory.this.outputHolders.put(name, new ChannelHolder(sharedChannel, false)); } } } }); }

Target:
public void afterPropertiesSet() throws Exception { Assert.notNull(BindableProxyFactory.this.channelFactory, "Channel Factory cannot be null"); ReflectionUtils.doWithMethods(this.type, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException { Input input = AnnotationUtils.findAnnotation(method, Input.class); if (input != null) { String name = BindingBeanDefinitionRegistryUtils.getChannelName(input, method); validateChannelType(method.getReturnType()); MessageChannel sharedChannel = locateSharedChannel(name); if (sharedChannel == null) { BindableProxyFactory.this.inputHolders.put(name, new ChannelHolder( BindableProxyFactory.this.channelFactory.createInputChannel(name), true)); } else { BindableProxyFactory.this.inputHolders.put(name, new ChannelHolder(sharedChannel, false)); } } } }); ReflectionUtils.doWithMethods(this.type, new ReflectionUtils.MethodCallback() { @Override public void doWith(Method method) throws IllegalArgumentException { Output output = AnnotationUtils.findAnnotation(method, Output.class); if (output != null) { String name = BindingBeanDefinitionRegistryUtils.getChannelName(output, method); validateChannelType(method.getReturnType()); MessageChannel sharedChannel = locateSharedChannel(name); if (sharedChannel == null) { BindableProxyFactory.this.outputHolders.put(name, new ChannelHolder( BindableProxyFactory.this.channelFactory.createOutputChannel(name), true)); } else { BindableProxyFactory.this.outputHolders.put(name, new ChannelHolder(sharedChannel, false)); } } } }); }
Source:
public void verifyHttpsCiphers() throws Exception { brooklynProperties.put(BrooklynWebConfig.HTTPS_REQUIRED, true); brooklynProperties.put(BrooklynWebConfig.TRANSPORT_PROTOCOLS, "XXX"); brooklynProperties.put(BrooklynWebConfig.TRANSPORT_CIPHERS, "XXX"); try { verifyHttpsFromConfig(brooklynProperties); fail("Expected to fail due to to unsupported ciphers during connection negotiation"); } catch (Exception e) { assertTrue(Exceptions.getFirstThrowableOfType(e, SocketException.class) != null, "Expected to fail due to inability to negotiate"); } }

Target:
public void verifyHttpsCiphers() throws Exception { brooklynProperties.put(BrooklynWebConfig.HTTPS_REQUIRED, true); brooklynProperties.put(BrooklynWebConfig.TRANSPORT_PROTOCOLS, "XXX"); brooklynProperties.put(BrooklynWebConfig.TRANSPORT_CIPHERS, "XXX"); try { verifyHttpsFromConfig(brooklynProperties); fail("Expected to fail due to unsupported ciphers during connection negotiation"); } catch (Exception e) { assertTrue((Exceptions.getFirstThrowableOfType(e, SocketException.class) != null) || (Exceptions.getFirstThrowableOfType(e, SSLHandshakeException.class) != null), "Expected to fail due to inability to negotiate"); } }
Source:
public void init() throws IOException { monitor.init(); boolean storeExists = hasStore(); boolean isDirty; try { needsRebuild = !storeExists; if ( !storeExists ) { monitor.noIndex(); } isDirty = instantiateTree(); } catch ( MetadataMismatchException e ) { isDirty = true; } if ( isDirty ) { monitor.notValidIndex(); dropStrict(); instantiateTree(); } if ( isDirty || !storeExists ) { needsRebuild = true; } }

Target:
public void init() throws IOException { monitor.init(); boolean storeExists = hasStore(); boolean isDirty; try { needsRebuild = !storeExists; if ( !storeExists ) { monitor.noIndex(); } isDirty = instantiateTree(); } catch ( MetadataMismatchException e ) { isDirty = true; } if ( isDirty ) { monitor.notValidIndex(); dropStrict(); instantiateTree(); needsRebuild = true; } }
Source:
private boolean processMail(TaskMailbox mailbox, boolean singleStep) throws Exception { boolean processed = false; if (!mailbox.createBatch()) { return processed; } Optional<Mail> maybeMail; while (isMailboxLoopRunning() && (maybeMail = mailbox.tryTakeFromBatch()).isPresent()) { maybeMail.get().run(); processed = true; if (singleStep) { break; } } if (singleStep) { return processed; } while (isDefaultActionUnavailable() && isMailboxLoopRunning()) { maybeMail = mailbox.tryTake(MIN_PRIORITY); if (!maybeMail.isPresent()) { long start = System.currentTimeMillis(); maybeMail = Optional.of(mailbox.take(MIN_PRIORITY)); idleTime.markEvent(System.currentTimeMillis() - start); } maybeMail.get().run(); processed = true; } return processed; }

Target:
private boolean processMail(TaskMailbox mailbox, boolean singleStep) throws Exception { if (!mailbox.createBatch()) { return false; } boolean processed = false; Optional<Mail> maybeMail; while (isMailboxLoopRunning() && (maybeMail = mailbox.tryTakeFromBatch()).isPresent()) { maybeMail.get().run(); processed = true; if (singleStep) { break; } } if (singleStep) { return processed; } while (isDefaultActionUnavailable() && isMailboxLoopRunning()) { maybeMail = mailbox.tryTake(MIN_PRIORITY); if (!maybeMail.isPresent()) { long start = System.currentTimeMillis(); maybeMail = Optional.of(mailbox.take(MIN_PRIORITY)); idleTime.markEvent(System.currentTimeMillis() - start); } maybeMail.get().run(); processed = true; } return processed; }
Source:
Mono<Response<DocumentResultCollection<DetectLanguageResult>>> detectBatchLanguagesWithResponse( List<DetectLanguageInput> textInputs, TextAnalyticsRequestOptions options, Context context) { final LanguageBatchInput languageBatchInput = new LanguageBatchInput().setDocuments(textInputs); return service.languagesWithRestResponseAsync( languageBatchInput, options == null ? null : options.getModelVersion(), options == null ? null : options.showStatistics(), context) .doOnSubscribe(ignoredValue -> logger.info("A batch of language input - {}", languageBatchInput)) .doOnSuccess(response -> logger.info("A batch of detected language output - {}", languageBatchInput)) .doOnError(error -> logger.warning("Failed to detected languages - {}", languageBatchInput)) .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); }

Target:
Mono<Response<DocumentResultCollection<DetectLanguageResult>>> detectBatchLanguagesWithResponse( List<DetectLanguageInput> textInputs, TextAnalyticsRequestOptions options, Context context) { Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); final LanguageBatchInput languageBatchInput = new LanguageBatchInput() .setDocuments(textInputs.stream().map(detectLanguageInput -> new LanguageInput() .setId(detectLanguageInput.getId()).setText(detectLanguageInput.getText()) .setCountryHint(detectLanguageInput.getCountryHint())).collect(Collectors.toList())); return service.languagesWithRestResponseAsync( languageBatchInput, options == null ? null : options.getModelVersion(), options == null ? null : options.showStatistics(), context) .doOnSubscribe(ignoredValue -> logger.info("A batch of language input - {}", textInputs.toString())) .doOnSuccess(response -> logger.info("A batch of detected language output - {}", response.getValue())) .doOnError(error -> logger.warning("Failed to detected languages - {}", error)) .map(response -> new SimpleResponse<>(response, toDocumentResultCollection(response.getValue()))); }
Source:
public CustomColumnNamesWidget(List<String> columnNames) { _innerPanel = new DCPanel(); _innerPanel.setLayout(new VerticalLayout(2)); final JButton addButton = WidgetFactory.createSmallButton(IconUtils.ACTION_ADD_DARK); addButton.addActionListener(e -> addColumnName("", true)); final JButton removeButton = WidgetFactory.createSmallButton(IconUtils.ACTION_REMOVE_DARK); removeButton.addActionListener(e -> { int componentCount = _innerPanel.getComponentCount(); if (componentCount > 0) { removeColumnName(); _innerPanel.updateUI(); } }); final DCPanel buttonPanel = new DCPanel(); buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0)); buttonPanel.setLayout(new VerticalLayout(2)); buttonPanel.add(addButton); buttonPanel.add(removeButton); _buttons = Arrays.asList(addButton, removeButton); if (columnNames != null) { columnNames.forEach(columnName -> addColumnName(columnName, false)); } _outerPanel = new DCPanel(); _outerPanel.setLayout(new BorderLayout()); _outerPanel.add(_innerPanel, BorderLayout.CENTER); _outerPanel.add(buttonPanel, BorderLayout.EAST); }

Target:
public CustomColumnNamesWidget(List<String> columnNames) { _innerPanel = new DCPanel(); _innerPanel.setLayout(new VerticalLayout(2)); final JButton addButton = WidgetFactory.createSmallButton(IconUtils.ACTION_ADD_DARK); addButton.addActionListener(e -> addColumnName("", true)); final JButton removeButton = WidgetFactory.createSmallButton(IconUtils.ACTION_REMOVE_DARK); removeButton.addActionListener(e -> { if (_innerPanel.getComponentCount() > 0) { removeColumnName(); _innerPanel.updateUI(); } }); final DCPanel buttonPanel = new DCPanel(); buttonPanel.setBorder(new EmptyBorder(0, 4, 0, 0)); buttonPanel.setLayout(new VerticalLayout(2)); buttonPanel.add(addButton); buttonPanel.add(removeButton); _buttons = Arrays.asList(addButton, removeButton); if (columnNames != null) { columnNames.forEach(columnName -> addColumnName(columnName, false)); } _outerPanel = new DCPanel(); _outerPanel.setLayout(new BorderLayout()); _outerPanel.add(_innerPanel, BorderLayout.CENTER); _outerPanel.add(buttonPanel, BorderLayout.EAST); }
Source:
public void readBadlyDistributedFileTest() throws Exception { HPCCFile file = new HPCCFile(datasets[1], connString , hpccUser, hpccPass); file.setProjectList(""); file.setFileAccessExpirySecs(10); List<HPCCRecord> records = readFile(file, connTO); assertEquals("Not all records loaded",expectedCounts[1], records.size()); }

Target:
public void readBadlyDistributedFileTest() throws Exception { HPCCFile file = new HPCCFile(datasets[1], connString , hpccUser, hpccPass); file.setProjectList(""); List<HPCCRecord> records = readFile(file, connTO); assertEquals("Not all records loaded",expectedCounts[1], records.size()); }
Source:
private byte[] configurePskCredentials(String identity, byte[] psk, byte[] otherSecret) throws HandshakeException { String virtualHost = null; if (indicatedServerNames == null) { LOGGER.debug("client uses PSK identity [{}]", getPeerAddress(), identity); } else { ServerName serverName = indicatedServerNames.getServerName(NameType.HOST_NAME); if (serverName == null) { LOGGER.debug("client provided invalid SNI extension which doesn't include a hostname", getPeerAddress()); } else { virtualHost = new String(serverName.getName(), ServerName.CHARSET); LOGGER.debug("client uses PSK identity for server [{}]", getPeerAddress(), identity, virtualHost); } } if (psk == null) { throw new HandshakeException( String.format("cannot authenticate client, identity [%s] is unknown for server [%s]", identity, virtualHost), new AlertMessage(AlertLevel.FATAL, AlertDescription.UNKNOWN_PSK_IDENTITY, session.getPeer())); } else { session.setPeerIdentity(new PreSharedKeyIdentity(virtualHost, identity)); if(otherSecret==null) { return generatePremasterSecretFromPSK(psk, null); }else { return generatePremasterSecretFromPSK(psk, otherSecret); } } }

Target:
private byte[] configurePskCredentials(String identity, byte[] psk, byte[] otherSecret) throws HandshakeException { String virtualHost = null; if (indicatedServerNames == null) { LOGGER.debug("client uses PSK identity [{}]", getPeerAddress(), identity); } else { ServerName serverName = indicatedServerNames.getServerName(NameType.HOST_NAME); if (serverName == null) { LOGGER.debug("client provided invalid SNI extension which doesn't include a hostname", getPeerAddress()); } else { virtualHost = new String(serverName.getName(), ServerName.CHARSET); LOGGER.debug("client uses PSK identity for server [{}]", getPeerAddress(), identity, virtualHost); } } if (psk == null) { throw new HandshakeException( String.format("cannot authenticate client, identity [%s] is unknown for server [%s]", identity, virtualHost), new AlertMessage(AlertLevel.FATAL, AlertDescription.UNKNOWN_PSK_IDENTITY, session.getPeer())); } else { session.setPeerIdentity(new PreSharedKeyIdentity(virtualHost, identity)); return generatePremasterSecretFromPSK(psk, otherSecret); } }
Source:
public static FormulaShifter createForRowShift(int externSheetIndex, String sheetName, int firstMovedRowIndex, int lastMovedRowIndex, int numberOfRowsToMove, SpreadsheetVersion version) { FormulaShifter instance = new FormulaShifter(externSheetIndex, sheetName, firstMovedRowIndex, lastMovedRowIndex, numberOfRowsToMove, ShiftMode.RowMove, version); return instance; }

Target:
public static FormulaShifter createForRowShift(int externSheetIndex, String sheetName, int firstMovedRowIndex, int lastMovedRowIndex, int numberOfRowsToMove, SpreadsheetVersion version) { return new FormulaShifter(externSheetIndex, sheetName, firstMovedRowIndex, lastMovedRowIndex, numberOfRowsToMove, ShiftMode.RowMove, version); }
Source:
public Void call(ApiCaller ac, Deserializer params) throws PerunException { ac.stateChangingCheck(); Member sponsoredMember = ac.getMemberById(params.readInt("sponsored")); User sponsorToRemove = ac.getUserById(params.readInt("sponsor")); ac.getMembersManager().removeSponsor(ac.getSession(), sponsoredMember, sponsorToRemove); return null; }

Target:
public RichMember call(ApiCaller ac, Deserializer params) throws PerunException { ac.stateChangingCheck(); String guestName = params.readString("guestName"); String password = params.readString("password"); Vo vo = ac.getVoById(params.readInt("vo")); String namespace = params.readString("namespace"); User sponsor = null; if(params.contains("sponsor")) { sponsor = ac.getUserById(params.readInt("sponsor")); } return ac.getMembersManager().createSponsoredMember(ac.getSession(), vo, namespace, guestName, password, sponsor); }
Source:
void assertMaxTaskConcurrency(LocalAwareExecutorService executor, int concurrency) throws InterruptedException { executor.setMaximumPoolSize(concurrency); CountDownLatch concurrencyGoal = new CountDownLatch(concurrency); for (int i = 0; i < concurrency; i++) { executor.execute(new LatchWaiter(concurrencyGoal, 5000L, TimeUnit.MILLISECONDS)); } Assert.assertEquals(true, concurrencyGoal.await(3000L, TimeUnit.MILLISECONDS)); }

Target:
void assertMaxTaskConcurrency(LocalAwareExecutorService executor, int concurrency) throws InterruptedException { executor.setMaximumPoolSize(concurrency); CountDownLatch concurrencyGoal = new CountDownLatch(concurrency); for (int i = 0; i < concurrency; i++) { executor.execute(new LatchWaiter(concurrencyGoal, 5L, TimeUnit.SECONDS)); } Assert.assertEquals("Test tasks did not hit max concurrency goal", true, concurrencyGoal.await(3L, TimeUnit.SECONDS)); }
Source:
private static String getHBaseDownloadUrl() { return "<LINK_0>"; }

Target:
private static String getHBaseDownloadUrl() { return "<LINK_1>"; }
Source:
public void initialize(Map<String, Param> params) throws TikaConfigException { try { DefaultHttpClient client = new DefaultHttpClient(); HttpResponse response = client.execute(new HttpGet(healthUri)); available = response.getStatusLine().getStatusCode() == 200; LOG.info("Available = {}, API Status = {}", available, response.getStatusLine()); apiUri = URI.create(String.format( "http://localhost:8764/inception/v3/captions?beam_size=%1$d&max_caption_length=%2$d", captions, maxCaptionLength)); LOG.info("Captions = {}, MaxCaptionLength = {}", captions, maxCaptionLength); } catch (Exception e) { available = false; throw new TikaConfigException(e.getMessage(), e); } }

Target:
public void initialize(Map<String, Param> params) throws TikaConfigException { try { healthUri = URI.create(apiBaseUri + "/ping"); apiUri = URI.create(apiBaseUri + String.format("/captions?beam_size=%1$d&max_caption_length=%2$d", captions, maxCaptionLength)); DefaultHttpClient client = new DefaultHttpClient(); HttpResponse response = client.execute(new HttpGet(healthUri)); available = response.getStatusLine().getStatusCode() == 200; LOG.info("Available = {}, API Status = {}", available, response.getStatusLine()); LOG.info("Captions = {}, MaxCaptionLength = {}", captions, maxCaptionLength); } catch (Exception e) { available = false; throw new TikaConfigException(e.getMessage(), e); } }
Source:
private boolean isValidComponentInfo(ComponentInfo componentInfo) { return componentInfo != null && componentInfo.applicationInfo != null && componentInfo.applicationInfo.packageName != null && componentInfo.name != null; }

Target:
private static boolean isValidComponentInfo(ComponentInfo componentInfo) { return componentInfo != null && componentInfo.applicationInfo != null && componentInfo.applicationInfo.packageName != null && componentInfo.name != null; }
Source:
public List<ResourceEntry> removeAndGet(ScalarResourceEntry scalarResourceEntry, ReservationType reservationType) throws ResourceNotAvailabeException { ScalarResourceEntry availableResource = availableResourcesByReservationType.get(reservationType); List<ResourceEntry> reservedResources = new ArrayList<>(); if (scalarResourceEntry.getValue() < availableResource.getValue()) { availableResourcesByReservationType.put(reservationType, availableResource.remove(scalarResourceEntry)); totalAvailableResource -= scalarResourceEntry.getValue(); reservedResources.add(new ScalarResourceEntry(scalarResourceEntry.getReservationType(), scalarResourceEntry.getValue())); return reservedResources; } String message = String.format("ResourceType '%s' of reservationType '%s' is not available. Requested value: %s Available: %s", resourceType, reservationType.toString(), scalarResourceEntry.getValue(), availableResourcesByReservationType.get(reservationType)); throw new ResourceNotAvailabeException(message); }

Target:
public List<ResourceEntry> removeAndGet(ScalarResourceEntry scalarResourceEntry, ReservationType reservationType) throws ResourceNotAvailableException { ScalarResourceEntry availableResource = availableResourcesByReservationType.get(reservationType); List<ResourceEntry> reservedResources = new ArrayList<>(); if (scalarResourceEntry.getValue() <= availableResource.getValue()) { availableResourcesByReservationType.put(reservationType, availableResource.remove(scalarResourceEntry)); totalAvailableResource -= scalarResourceEntry.getValue(); reservedResources.add(new ScalarResourceEntry(scalarResourceEntry.getReservationType(), scalarResourceEntry.getValue())); return reservedResources; } String message = String.format("ResourceType '%s' of reservationType '%s' is not available. Requested value: %s Available: %s", resourceType, reservationType.toString(), scalarResourceEntry.getValue(), availableResourcesByReservationType.get(reservationType)); throw new ResourceNotAvailableException(message); }
Source:
public static Boolean isVUS(Alteration alteration) { List<Evidence> evidenceList = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); for (Evidence evidence : evidenceList) { if (evidence.getEvidenceType().equals(EvidenceType.VUS)) { return true; } } return false; }

Target:
public static Boolean isVUS(Alteration alteration) { List<Evidence> evidenceList = EvidenceUtils.getEvidence(Collections.singletonList(alteration), Collections.singleton(EvidenceType.VUS), null); return !(evidenceList == null || evidenceList.isEmpty()); }
Source:
private static String getHost(Configuration configuration, String key, String defaultVal, String type) { String hostName = configuration.get(key, defaultVal); Preconditions.checkArgument( !Strings.isNullOrEmpty(hostName), String.format("%s endpoint host must be supplied via %s", type, key)); LOG.debug("%s endpoint host %s. Using override IP address.", type, hostName); return hostName; }

Target:
private static String getHost(Configuration configuration, String key, String defaultVal, String type) { String hostName = configuration.get(key, defaultVal); LOG.debug("%s endpoint host %s.", type, hostName); return hostName; }
Source:
private String getIsoPrefix() { Guid storagePoolId = getParameters().getStoragePoolId(); synchronized(getLockObjForStoragePool(storagePoolId)) { if (!storagePoolId2IsoPrefix.containsKey(storagePoolId)) { try { StoragePoolInfoReturnForXmlRpc returnValue = getBroker().getStoragePoolInfo(storagePoolId.toString()); storagePoolId2IsoPrefix.put(storagePoolId, returnValue.mStoragePoolInfo.containsKey(IrsProperties.isoPrefix) ? returnValue.mStoragePoolInfo.get(IrsProperties.isoPrefix).toString() : StringUtils.EMPTY); } catch (Exception ex) { log.errorFormat("IsoPrefix Failed to get storage pool info (vds {0}).", getParameters().getVdsId()); return StringUtils.EMPTY; } } return storagePoolId2IsoPrefix.get(storagePoolId); } }

Target:
private String getIsoPrefix() { Guid storagePoolId = getParameters().getStoragePoolId(); if (!storagePoolIdToIsoPrefix.containsKey(storagePoolId)) { synchronized(getLockObjForStoragePool(storagePoolId)) { if (!storagePoolIdToIsoPrefix.containsKey(storagePoolId)) { try { StoragePoolInfoReturnForXmlRpc returnValue = getBroker().getStoragePoolInfo(storagePoolId.toString()); storagePoolIdToIsoPrefix.put(storagePoolId, returnValue.mStoragePoolInfo.containsKey(IrsProperties.isoPrefix) ? returnValue.mStoragePoolInfo.get(IrsProperties.isoPrefix).toString() : StringUtils.EMPTY); } catch (Exception ex) { log.errorFormat("IsoPrefix Failed to get storage pool info (vds {0}).", getParameters().getVdsId()); return StringUtils.EMPTY; } } } } return storagePoolIdToIsoPrefix.get(storagePoolId); }
Source:
protected CommunityRest createAndReturn(Context context) throws AuthorizeException { HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); CommunityRest communityRest; try { ServletInputStream input = req.getInputStream(); communityRest = mapper.readValue(input, CommunityRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body: " + e1.toString()); } Community community; try { Community parent = null; if (StringUtils.isNotBlank(req.getParameter("parentCommunity"))) { UUID owningCommunityUuid = UUIDUtils.fromString(req.getParameter("parentCommunity")); if (owningCommunityUuid == null) { throw new BadRequestException("The given owningCommunityUuid was invalid: " + req.getParameter("parentCommunity")); } parent = cs.find(context, owningCommunityUuid); if (parent == null) { throw new ResourceNotFoundException("Parent community for id: " + owningCommunityUuid + " not found"); } } community = cs.create(parent, context); cs.update(context, community); if (communityRest.getMetadata() != null) { for (MetadataEntryRest mer : communityRest.getMetadata()) { String[] metadatakey = mer.getKey().split("\\."); cs.addMetadata(context, community, metadatakey[0], metadatakey[1], metadatakey.length == 3 ? metadatakey[2] : null, mer.getLanguage(), mer.getValue()); } } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } return converter.convert(community); }

Target:
protected CommunityRest createAndReturn(Context context) throws AuthorizeException { HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest(); ObjectMapper mapper = new ObjectMapper(); CommunityRest communityRest; try { ServletInputStream input = req.getInputStream(); communityRest = mapper.readValue(input, CommunityRest.class); } catch (IOException e1) { throw new UnprocessableEntityException("Error parsing request body: " + e1.toString()); } Community community; try { Community parent = null; String parentCommunityString = req.getParameter("parent"); if (StringUtils.isNotBlank(parentCommunityString)) { UUID parentCommunityUuid = UUIDUtils.fromString(parentCommunityString); if (parentCommunityUuid == null) { throw new BadRequestException("The given parent parameter was invalid: " + parentCommunityString); } parent = cs.find(context, parentCommunityUuid); if (parent == null) { throw new UnprocessableEntityException("Parent community for id: " + parentCommunityUuid + " not found"); } } community = cs.create(parent, context); cs.update(context, community); if (communityRest.getMetadata() != null) { for (MetadataEntryRest mer : communityRest.getMetadata()) { String[] metadatakey = mer.getKey().split("\\."); cs.addMetadata(context, community, metadatakey[0], metadatakey[1], metadatakey.length == 3 ? metadatakey[2] : null, mer.getLanguage(), mer.getValue()); } } } catch (SQLException e) { throw new RuntimeException(e.getMessage(), e); } return converter.convert(community); }
Source:
public boolean removeParent(Set<Context> contexts, Subject parent) { contexts = ImmutableSet.copyOf(contexts); while (true) { Map.Entry<String, String> removeEnt = new AbstractMap.SimpleEntry<String, String>(parent.getContainingCollection().getIdentifier(), parent.getIdentifier()); List<Map.Entry<String, String>> oldParents = parents.get(contexts); List<Map.Entry<String, String>> newParents; if (oldParents == null || !oldParents.contains(removeEnt)) { return false; } newParents = new ArrayList<Map.Entry<String, String>>(oldParents); newParents.remove(removeEnt); if (updateCollection(parents, contexts, oldParents, Collections.unmodifiableList(newParents))) { return true; } } }

Target:
public boolean removeParent(Set<Context> contexts, Subject parent) { contexts = ImmutableSet.copyOf(contexts); while (true) { Map.Entry<String, String> removeEnt = Maps.immutableEntry(parent.getContainingCollection().getIdentifier(), parent.getIdentifier()); List<Map.Entry<String, String>> oldParents = parents.get(contexts); List<Map.Entry<String, String>> newParents; if (oldParents == null || !oldParents.contains(removeEnt)) { return false; } newParents = new ArrayList<Map.Entry<String, String>>(oldParents); newParents.remove(removeEnt); if (updateCollection(parents, contexts, oldParents, Collections.unmodifiableList(newParents))) { return true; } } }
Source:
public void onClose(Client client) { synchronized(clients) { clients.remove(client); } }

Target:
public void onClose(Client client) { clients.remove(client); }
Source:
public static int searchAndReplace(File fDirToLook, File fFileName) throws Throwable { if (fDirToLook == null) { return 0; } if (fDirToLook.isDirectory()) { int iCopies = 0; File[] faFilesInDir = fDirToLook.listFiles(); if (faFilesInDir != null && faFilesInDir.length > 0) { for (File fFile : faFilesInDir) { iCopies += searchAndReplace(fFile, fFileName); } } return iCopies; } else if (fDirToLook.isFile()) { if (fDirToLook.getCanonicalPath().equalsIgnoreCase(fFileName.getCanonicalPath())) { return 0; } else if (fDirToLook.getName().equalsIgnoreCase(fFileName.getName())) { try { boolean bCopied = copy(fFileName, fDirToLook); if (bCopied) { LOG.debug("Replaced file: " + fDirToLook.getCanonicalPath()); return 1; } else { return 0; } } catch (Exception e) { LOG.error("Failed to replace file {}: {}", fDirToLook.getCanonicalPath(), e.getLocalizedMessage(), e); } } } return 0; }

Target:
public static int searchAndReplace(File fDirToLook, File fFileName) throws Throwable { if (fDirToLook == null) { return 0; } if (fDirToLook.isDirectory()) { int iCopies = 0; File[] faFilesInDir = fDirToLook.listFiles(); if (faFilesInDir != null && faFilesInDir.length > 0) { for (File fFile : faFilesInDir) { iCopies += searchAndReplace(fFile, fFileName); } } return iCopies; } else if (fDirToLook.isFile()) { if (fDirToLook.getCanonicalPath().equalsIgnoreCase(fFileName.getCanonicalPath())) { return 0; } else if (fDirToLook.getName().equalsIgnoreCase(fFileName.getName())) { try { boolean bCopied = copy(fFileName, fDirToLook); if (bCopied) { LOG.debug("Replaced file: {}" , fDirToLook.getCanonicalPath()); return 1; } else { return 0; } } catch (Exception e) { LOG.error("Failed to replace file {}: {}", fDirToLook.getCanonicalPath(), e.getLocalizedMessage(), e); } } } return 0; }
Source:
public List<EventTypeSchema> getSchemas(final String name, final int offset, final int limit) { return jdbcTemplate.query( "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? ORDER BY ets_schema_object->>'version' DESC LIMIT ? OFFSET ? ", new Object[]{name, limit, offset}, new SchemaRowMapper()); }

Target:
public List<EventTypeSchema> getSchemas(final String name, final int offset, final int limit) { return jdbcTemplate.query( "SELECT ets_schema_object FROM zn_data.event_type_schema " + "WHERE ets_event_type_name = ? ORDER BY ets_schema_object->>'created_at' DESC LIMIT ? OFFSET ? ", new Object[]{name, limit, offset}, new SchemaRowMapper()); }