auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void doNotVerifyHostnameWhenVerificationIsOff() throws Exception { Properties properties = new Properties(); properties.setProperty(GeneralOption.HOST.getKey(), "127.0.0.1"); properties.setProperty(GeneralOption.PORT.getKey(), Integer.toString(trustedService.httpsPort())); properties.setProperty(GeneralOption.USE_HTTPS.getKey(), "true"); properties.setProperty(GeneralOption.VERIFY_SSL.getKey(), "false"); ConnectorDetails connectorDetails = new ConnectorDetails(ConfigurationBuilder.initFromProperties(properties)); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }

Target:
public void doNotVerifyHostnameWhenVerificationIsOff() throws Exception { ConnectorDetails connectorDetails = buildConnectorDetails("127.0.0.1", trustedService.httpsPort(), "true", "false"); HttpHelper httpHelper = new HttpHelper(); HttpHost httpHost = httpHelper.buildHttpHost(connectorDetails); CloseableHttpClient closeableHttpClient = httpHelper.buildClient(httpHost, connectorDetails); CloseableHttpResponse response = closeableHttpClient.execute(httpHost, new HttpGet("/hello")); assertThat(response.getStatusLine().getStatusCode()).isEqualTo(200); }
Source:
public QuectelEC25(ModemDevice device, String platform, ConnectionFactory connectionFactory) { super(device, platform, connectionFactory); try { String atPort = getAtPort(); String gpsPort = getGpsPort(); if (atPort != null) { if (atPort.equals(getDataPort()) || atPort.equals(gpsPort)) { this.m_serialNumber = getSerialNumber(); this.m_imsi = getMobileSubscriberIdentity(); this.m_iccid = getIntegratedCirquitCardId(); this.m_model = getModel(); this.m_manufacturer = getManufacturer(); this.m_revisionId = getRevisionID(); this.m_gpsSupported = isGpsSupported(); this.m_rssi = getSignalStrength(); s_logger.trace("{} :: Serial Number={}", getClass().getName(), this.m_serialNumber); s_logger.trace("{} :: IMSI={}", getClass().getName(), this.m_imsi); s_logger.trace("{} :: ICCID={}", getClass().getName(), this.m_iccid); s_logger.trace("{} :: Model={}", getClass().getName(), this.m_model); s_logger.trace("{} :: Manufacturer={}", getClass().getName(), this.m_manufacturer); s_logger.trace("{} :: Revision ID={}", getClass().getName(), this.m_revisionId); s_logger.trace("{} :: GPS Supported={}", getClass().getName(), this.m_gpsSupported); s_logger.trace("{} :: RSSI={}", getClass().getName(), this.m_rssi); } } } catch (KuraException e) { e.printStackTrace(); } }

Target:
public QuectelEC25(ModemDevice device, String platform, ConnectionFactory connectionFactory) { super(device, platform, connectionFactory); try { String atPort = getAtPort(); String gpsPort = getGpsPort(); if (atPort != null) { if (atPort.equals(getDataPort()) || atPort.equals(gpsPort)) { this.m_serialNumber = getSerialNumber(); this.m_imsi = getMobileSubscriberIdentity(); this.m_iccid = getIntegratedCirquitCardId(); this.m_model = getModel(); this.m_manufacturer = getManufacturer(); this.m_revisionId = getRevisionID(); this.m_gpsSupported = isGpsSupported(); this.m_rssi = getSignalStrength(); logger.trace("{} :: Serial Number={}", getClass().getName(), this.m_serialNumber); logger.trace("{} :: IMSI={}", getClass().getName(), this.m_imsi); logger.trace("{} :: ICCID={}", getClass().getName(), this.m_iccid); logger.trace("{} :: Model={}", getClass().getName(), this.m_model); logger.trace("{} :: Manufacturer={}", getClass().getName(), this.m_manufacturer); logger.trace("{} :: Revision ID={}", getClass().getName(), this.m_revisionId); logger.trace("{} :: GPS Supported={}", getClass().getName(), this.m_gpsSupported); logger.trace("{} :: RSSI={}", getClass().getName(), this.m_rssi); } } } catch (KuraException e) { e.printStackTrace(); } }
Source:
protected void configure(HttpSecurity http) throws Exception { super.configure(http); http.addFilterBefore(aadAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); }

Target:
protected void configure(HttpSecurity http) { http.addFilterBefore(aadAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); }
Source:
private List<String> defaultIncludedModuleNamesForUnnamedModule() { if (fJavaElements != null) { List<IPackageFragmentRoot> roots= new ArrayList<>(); for (IJavaElement fJavaElement : fJavaElements) { if (fJavaElement instanceof IPackageFragmentRoot) { roots.add((IPackageFragmentRoot) fJavaElement); } } return JavaCore.defaultRootModules(roots); } return Collections.emptyList(); }

Target:
private List<String> defaultIncludedModuleNamesForUnnamedModule() { if (fJavaElements != null) { List<IPackageFragmentRoot> roots= new ArrayList<>(); for (IJavaElement element : fJavaElements) { if (element instanceof IPackageFragmentRoot) { roots.add((IPackageFragmentRoot) element); } } return JavaCore.defaultRootModules(roots); } return Collections.emptyList(); }
Source:
@Override public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data) { if (data.joiningNodeData() == null) return; ServicesJoinNodeDiscoveryData joinData = (ServicesJoinNodeDiscoveryData)data.joiningNodeData(); for (ServiceInfo desc : joinData.services()) { assert desc.topologySnapshot().isEmpty(); ServiceInfo oldDesc = registeredServices.get(desc.serviceId()); if (oldDesc != null) { U.warn(log, "Failed to register service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "Service with the same service id already exists, cfg=" + oldDesc.configuration()); continue; } oldDesc = lookupInRegisteredServices(desc.name()); if (oldDesc == null) { registeredServices.put(desc.serviceId(), desc); continue; } if (oldDesc.configuration().equalsIgnoreNodeFilter(desc.configuration())) { U.warn(log, "Ignore service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "The same service configuration already registered."); } else { U.warn(log, "Failed to register service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "Service already exists with different configuration, cfg=" + desc.configuration()); } } }

Target:
@Override public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data) { if (data.joiningNodeData() == null) return; ServiceProcessorJoinNodeDiscoveryData joinData = (ServiceProcessorJoinNodeDiscoveryData)data.joiningNodeData(); for (ServiceInfo desc : joinData.services()) { assert desc.topologySnapshot().isEmpty(); ServiceInfo oldDesc = registeredServices.get(desc.serviceId()); if (oldDesc != null) { U.warn(log, "Failed to register service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "Service with the same service id already exists, cfg=" + oldDesc.configuration()); continue; } oldDesc = lookupInRegisteredServices(desc.name()); if (oldDesc == null) { registeredServices.put(desc.serviceId(), desc); continue; } if (oldDesc.configuration().equalsIgnoreNodeFilter(desc.configuration())) { if (log.isDebugEnabled()) { log.debug("Ignore service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "The same service configuration already registered."); } } else { U.warn(log, "Failed to register service configuration received from joining node : " + "[nodeId=" + data.joiningNodeId() + ", cfgName=" + desc.name() + "]. " + "Service already exists with different configuration, cfg=" + desc.configuration()); } } }
Source:
public Config load(ClassLoader loader, URL url, StrInterpolator strInterpolator, StrInterpolator.Lookup lookup) throws ConfigException { Properties props = new Properties(); URL urlToLoad = url; LinkedList<String> nextUrls = new LinkedList<>(); boolean loaded = false; do { try { Map<String, String> p = new URLConfigReader(urlToLoad).call().getToAdd(); loaded = true; for (Entry<String, String> entry : p.entrySet()) { props.put(entry.getKey(), entry.getValue()); } String next = p.get(includeKey); if (next != null) { nextUrls.addAll(new LinkedList<>(Arrays.asList(next.split(",")))); } } catch (IOException e) { if ( !loaded && nextUrls.isEmpty() ) { throw new ConfigException("Unable to load configuration " + url, e); } } finally { urlToLoad = nextUrls.isEmpty() ? null : getResource(loader, strInterpolator.create(lookup).resolve(nextUrls.remove())); } } while (urlToLoad != null); return new MapConfig(props); }

Target:
public Config load(ClassLoader loader, URL url, StrInterpolator strInterpolator, StrInterpolator.Lookup lookup) throws ConfigException { Properties props = new Properties(); URL urlToLoad = url; LinkedList<String> nextUrls = new LinkedList<>(); Set<String> existingUrls = new HashSet<>(); boolean loaded = false; do { try { Map<String, String> p = new URLConfigReader(urlToLoad).call().getToAdd(); loaded = true; for (Entry<String, String> entry : p.entrySet()) { props.put(entry.getKey(), entry.getValue()); } String next = p.get(includeKey); if (next != null) { String[] listOfAtNext = next.split(","); LinkedList<String> listToAdd = new LinkedList<>(); for (String urlString : listOfAtNext) { String extrapolatedForm = strInterpolator.create(lookup).resolve(urlString); if (!existingUrls.contains(extrapolatedForm)) { existingUrls.add(extrapolatedForm); listToAdd.add(extrapolatedForm); } } listToAdd.addAll(nextUrls); nextUrls = listToAdd; } } catch (IOException e) { if ( !loaded && nextUrls.isEmpty() ) { throw new ConfigException("Unable to load configuration " + url, e); } } finally { urlToLoad = nextUrls.isEmpty() ? null : getResource(loader, nextUrls.remove()); } } while (urlToLoad != null); return new MapConfig(props); }
Source:
public final void setPriority(int newPriority) { ThreadGroup g; checkAccess(); if (newPriority > MAX_PRIORITY || newPriority < MIN_PRIORITY) { throw new IllegalArgumentException("Priority out of range: " + newPriority); } if((g = getThreadGroup()) != null) { if (newPriority > g.getMaxPriority()) { newPriority = g.getMaxPriority(); } synchronized(this) { this.priority = newPriority; if (isAlive()) { ThreadPrioritySetter threadPrioritySetter = RuntimeHooks.getThreadPrioritySetter(); if (threadPrioritySetter != null) { threadPrioritySetter.setPriority(newPriority); } else { setPriority0(newPriority); } END Android-added: Customize behavior of Thread.setPriority(). http://b/139521784 } } } }

Target:
public final void setPriority(int newPriority) { ThreadGroup g; checkAccess(); if (newPriority > MAX_PRIORITY || newPriority < MIN_PRIORITY) { throw new IllegalArgumentException("Priority out of range: " + newPriority); } if((g = getThreadGroup()) != null) { if (newPriority > g.getMaxPriority()) { newPriority = g.getMaxPriority(); } synchronized(this) { this.priority = newPriority; if (isAlive()) { ThreadPrioritySetter threadPrioritySetter = RuntimeHooks.getThreadPrioritySetter(); if (threadPrioritySetter != null) { threadPrioritySetter.setPriority(newPriority); } else { setPriority0(newPriority); } END Android-added: Customize behavior of Thread.setPriority(). } } } }
Source:
public static void init(Context context) { if (App.isProFlavor()) { final Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); Fabric.with(context, crashlyticsKit); } }

Target:
public static void init(Context context) { final Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); Fabric.with(context, crashlyticsKit); }
Source:
private static Fragment createFragmentWithResources(String name, String content) { Renderable renderable = (model, l, rl, a) -> content + (model.toMap().isEmpty() ? "" : model.toMap()); return new Fragment(name, renderable, false) { @Override public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { requestLookup.addToPlaceholder(Placeholder.css, "CSS Content"); requestLookup.addToPlaceholder(Placeholder.js, "JS Content"); requestLookup.addToPlaceholder(Placeholder.headJs, "Head JS Content"); return content; } }; }

Target:
private static Fragment createFragmentWithResources(String name, String content) { return new Fragment(name, null, false) { @Override public String render(Model model, Lookup lookup, RequestLookup requestLookup, API api) { requestLookup.addToPlaceholder(Placeholder.css, "CSS Content"); requestLookup.addToPlaceholder(Placeholder.js, "JS Content"); requestLookup.addToPlaceholder(Placeholder.headJs, "Head JS Content"); return content; } }; }
Source:
private void createControlButtons() { Composite composite = new Composite(shell, SWT.NONE); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); Button okButton = new Button(composite, SWT.PUSH); okButton.setText(resAddressBook.getString("OK")); okButton.addSelectionListener(widgetSelectedAdapter(e -> { shell.close(); })); Button cancelButton = new Button(composite, SWT.PUSH); cancelButton.setText(resAddressBook.getString("Cancel")); cancelButton.addSelectionListener(widgetSelectedAdapter(e -> { values = null; shell.close(); })); shell.setDefaultButton(okButton); }

Target:
private void createControlButtons() { Composite composite = new Composite(shell, SWT.NONE); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); Button okButton = new Button(composite, SWT.PUSH); okButton.setText(resAddressBook.getString("OK")); okButton.addSelectionListener(widgetSelectedAdapter(e -> shell.close())); Button cancelButton = new Button(composite, SWT.PUSH); cancelButton.setText(resAddressBook.getString("Cancel")); cancelButton.addSelectionListener(widgetSelectedAdapter(e -> { values = null; shell.close(); })); shell.setDefaultButton(okButton); }
Source:
public void url() throws Exception { edit(InputType.TEXT, spAddress, URL, new ModelNode("")).andVerifyFailure(); edit(InputType.TEXT, spAddress, URL, new ModelNode(url)).andVerifySuccess(); }

Target:
public void url() throws Exception { edit(InputType.TEXT, spAddress, URL, "") .verifyFormNotSaved() .verifyAttribute(URL, name.get(Key.URL)); edit(InputType.TEXT, spAddress, URL, url) .verifyFormSaved() .verifyAttribute(URL, url); }
Source:
static public junit.framework.Test suite() { VoltServerConfig config = null; MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestSqlStartsWithRegressionSuite.class); VoltProjectBuilder project = new VoltProjectBuilder(); final String schema = "create table STRINGS (" + "ID int default 0 not null, " + "VAL varchar(32) default null," + "PAT varchar(32) default null," + "PRIMARY KEY(ID));"; try { project.addLiteralSchema(schema); } catch (IOException e) { e.printStackTrace(); } project.addPartitionInfo("STRINGS", "ID"); project.addStmtProcedure("Insert", "insert into strings values (?, ?, ?);"); project.addStmtProcedure("SelectStartsWith", "select * from strings where val starts with ?;"); project.addStmtProcedure("NotStartsWith", "select * from strings where val not starts with ?;"); config = new LocalCluster("sqllike-onesite.jar", 1, 1, 0, BackendTarget.NATIVE_EE_JNI); if (!config.compile(project)) fail(); builder.addServerConfig(config); config = new LocalCluster("sqllike-twosites.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI); if (!config.compile(project)) fail(); builder.addServerConfig(config); config = new LocalCluster("sqllike-twosites.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI); if (!config.compile(project)) fail(); builder.addServerConfig(config); return builder; }

Target:
static public junit.framework.Test suite() throws IOException { VoltServerConfig config = null; MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestSqlStartsWithRegressionSuite.class); VoltProjectBuilder project = new VoltProjectBuilder(); final String schema = "create table STRINGS (" + "ID int default 0 not null, " + "VAL varchar(32) default null," + "PAT varchar(32) default null," + "PRIMARY KEY(ID));"; project.addLiteralSchema(schema); project.addPartitionInfo("STRINGS", "ID"); project.addStmtProcedure("Insert", "insert into strings values (?, ?, ?);"); project.addStmtProcedure("SelectStartsWith", "select * from strings where val starts with ?;"); project.addStmtProcedure("NotStartsWith", "select * from strings where val not starts with ?;"); config = new LocalCluster("sqlstartswith-onesite.jar", 1, 1, 0, BackendTarget.HSQLDB_BACKEND); if (!config.compile(project)) fail(); builder.addServerConfig(config); config = new LocalCluster("sqlstartswith-twosites.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI); if (!config.compile(project)) fail(); builder.addServerConfig(config); config = new LocalCluster("sqlstartswith-twosites.jar", 2, 3, 1, BackendTarget.NATIVE_EE_JNI); if (!config.compile(project)) fail(); builder.addServerConfig(config); return builder; }
Source:
public void testRemoveSiteWithInvalidOxdId() throws Exception { final DevelopersApi api = Tester.api(); RemoveSiteParams params = new RemoveSiteParams(); final String someRandomId = UUID.randomUUID().toString(); params.setOxdId(someRandomId); ApiResponse<UpdateSiteResponse> removeSiteResponse = api.removeSiteWithHttpInfo(Tester.getAuthorization(), params); assertEquals(removeSiteResponse.getStatusCode(), 200); }

Target:
public void testRemoveSiteWithInvalidOxdId() throws Exception { final DevelopersApi api = Tester.api(); RemoveSiteParams params = new RemoveSiteParams(); final String someRandomId = UUID.randomUUID().toString(); params.setOxdId(someRandomId); ApiResponse<RemoveSiteResponse> apiResponse = api.removeSiteWithHttpInfo(Tester.getAuthorization(), params); assertEquals(apiResponse.getStatusCode(), 200); assertTrue("error".equalsIgnoreCase(apiResponse.getData().getStatus())); RemoveSiteResponse removeSiteResponse = apiResponse.getData(); assertNotNull(removeSiteResponse); assertNotNull(removeSiteResponse.getData()); final String error = removeSiteResponse.getData().getError(); assertEquals(error, ErrorResponseCode.INVALID_OXD_ID.getCode()); }
Source:
public void testSwallowedReadComplete() throws Exception { final long delayMillis = 100; final Queue<IdleStateEvent> userEvents = new LinkedBlockingQueue<IdleStateEvent>(); final EmbeddedChannel channel = new EmbeddedChannel(false, false, new FlowControlHandler(), new IdleStateHandler(delayMillis, 0, 0, MILLISECONDS), new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) { ctx.fireChannelActive(); ctx.read(); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { ctx.fireChannelRead(msg); ctx.read(); } @Override public void channelReadComplete(ChannelHandlerContext ctx) { ctx.fireChannelReadComplete(); ctx.read(); } @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof IdleStateEvent) { userEvents.add((IdleStateEvent) evt); } ctx.fireUserEventTriggered(evt); } } ); channel.config().setAutoRead(false); assertFalse(channel.config().isAutoRead()); channel.register(); assertTrue(channel.writeInbound(Unpooled.EMPTY_BUFFER)); channel.flushInbound(); assertEquals(Unpooled.EMPTY_BUFFER, channel.readInbound()); channel.flushInbound(); assertNull(channel.readInbound()); Thread.sleep(delayMillis); channel.runPendingTasks(); assertEquals(IdleStateEvent.FIRST_READER_IDLE_STATE_EVENT, userEvents.poll()); }

Target:
public void testSwallowedReadComplete() throws Exception { final long delayMillis = 100; final Queue<IdleStateEvent> userEvents = new LinkedBlockingQueue<IdleStateEvent>(); final EmbeddedChannel channel = new EmbeddedChannel(false, false, new FlowControlHandler(), new IdleStateHandler(delayMillis, 0, 0, MILLISECONDS), new ChannelInboundHandlerAdapter() { @Override public void channelActive(ChannelHandlerContext ctx) { ctx.fireChannelActive(); ctx.read(); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { ctx.fireChannelRead(msg); ctx.read(); } @Override public void channelReadComplete(ChannelHandlerContext ctx) { ctx.fireChannelReadComplete(); ctx.read(); } @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof IdleStateEvent) { userEvents.add((IdleStateEvent) evt); } ctx.fireUserEventTriggered(evt); } } ); channel.config().setAutoRead(false); assertFalse(channel.config().isAutoRead()); channel.register(); assertTrue(channel.writeInbound(Unpooled.EMPTY_BUFFER)); channel.flushInbound(); assertEquals(Unpooled.EMPTY_BUFFER, channel.readInbound()); channel.flushInbound(); assertNull(channel.readInbound()); Thread.sleep(delayMillis); channel.runPendingTasks(); assertEquals(IdleStateEvent.FIRST_READER_IDLE_STATE_EVENT, userEvents.poll()); assertFalse(channel.finish()); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { v = View.inflate(context, R.layout.app_title_view, null); } ApplicationRecord toDisplay = CommCareApplication._().getAppAtIndex(position); TextView appName = (TextView) v.findViewById(R.id.app_name); appName.setText(toDisplay.getDisplayName()); v.setContentDescription(toDisplay.getUniqueId()); return v; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { v = View.inflate(context, R.layout.app_title_view, null); } ApplicationRecord toDisplay = this.getItem(position); TextView appName = (TextView)v.findViewById(R.id.app_name); appName.setText(toDisplay.getDisplayName()); v.setContentDescription(toDisplay.getUniqueId()); return v; }
Source:
public synchronized CreateIndexResponse createIndex(final String indexName, String settings, int shards) throws ElasticsearchException, IOException { final ReplicasMode replicasMode = clusterAPI.getReplicasMode(); AdminLogger.log(this.getClass(), "createIndex", "Trying to create index: " + indexName + " with shards: " + shards); IndicesAdminClient iac = new ESClient().getClient().admin().indices(); if(shards <1){ try{ shards = Integer.parseInt(System.getProperty("es.index.number_of_shards")); }catch(Exception e){} } if(shards <1){ try{ shards = Config.getIntProperty("es.index.number_of_shards", 2); }catch(Exception e){} } if(shards <0){ shards=1; } if(settings ==null){ settings = getDefaultIndexSettings(shards); } Map map = new ObjectMapper().readValue(settings, LinkedHashMap.class); map.put("number_of_shards", shards); map.put("index.mapping.total_fields.limit", 5000); map.put("number_of_replicas",replicasMode.getNumberOfReplicas()); map.put("auto_expand_replicas",replicasMode.getAutoExpandReplicas()); CreateIndexRequestBuilder cirb = iac.prepareCreate(indexName).setSettings(map); CreateIndexResponse createIndexResponse = cirb.execute().actionGet(); AdminLogger.log(this.getClass(), "createIndex", "Index created: " + indexName + " with shards: " + shards); return createIndexResponse; }

Target:
public synchronized CreateIndexResponse createIndex(final String indexName, String settings, int shards) throws ElasticsearchException, IOException { final ReplicasMode replicasMode = clusterAPI.getReplicasMode(); AdminLogger.log(this.getClass(), "createIndex", "Trying to create index: " + indexName + " with shards: " + shards); IndicesAdminClient iac = new ESClient().getClient().admin().indices(); if(shards <1){ try{ shards = Integer.parseInt(System.getProperty("es.index.number_of_shards")); }catch(Exception e){} } if(shards <1){ try{ shards = Config.getIntProperty("es.index.number_of_shards", 2); }catch(Exception e){} } if(shards <0){ shards=1; } if(settings ==null){ settings = getDefaultIndexSettings(shards); } Map map = new ObjectMapper().readValue(settings, LinkedHashMap.class); map.put("number_of_shards", shards); map.put("index.mapping.total_fields.limit", Config.getIntProperty("ES_INDEX_MAPPING_TOTAL_FIELD_LIMITS", 5000)); map.put("number_of_replicas",replicasMode.getNumberOfReplicas()); map.put("auto_expand_replicas",replicasMode.getAutoExpandReplicas()); CreateIndexRequestBuilder cirb = iac.prepareCreate(indexName).setSettings(map); CreateIndexResponse createIndexResponse = cirb.execute().actionGet(); AdminLogger.log(this.getClass(), "createIndex", "Index created: " + indexName + " with shards: " + shards); return createIndexResponse; }
Source:
public void testDynamicTaskLoading() throws Exception { String workflowName = TestHelper.getTestMethodName(); TaskDriver driver = new TaskDriver(_manager); JobConfig.Builder job = new JobConfig.Builder(); job.setJobCommandConfigMap(Collections.singletonMap(MockTask.JOB_DELAY, "100")); Workflow.Builder workflow = new Workflow.Builder(workflowName); job.setWorkflow(workflowName); TaskConfig taskConfig = new TaskConfig(MockTask.TASK_COMMAND, new HashMap<String, String>(), null, null); job.addTaskConfigMap(Collections.singletonMap(taskConfig.getId(), taskConfig)); job.setJobId(TaskUtil.getNamespacedJobName(workflowName, "JOB")); workflow.addJob("JOB", job); driver.start(workflow.build()); Thread.sleep(2000); }

Target:
public void testDynamicTaskLoading() throws Exception { String taskCommand = "Reindex"; String taskJarPath = "src/test/resources/Reindex.jar"; String taskVersion = "1.0.0"; String fullyQualifiedTaskClassName = "com.mycompany.mocktask.MockTask"; String fullyQualifiedTaskFactoryClassName = "com.mycompany.mocktask.MockTaskFactory"; List<String> taskClasses = new ArrayList(); taskClasses.add(fullyQualifiedTaskClassName); DynamicTaskConfig taskConfig = new DynamicTaskConfig(taskCommand, taskJarPath, taskVersion, taskClasses, fullyQualifiedTaskFactoryClassName); String path = TaskConstants.DYNAMICALLY_LOADED_TASK_PATH + "/" + taskCommand; removePathIfExists(path); _manager.getHelixDataAccessor().getBaseDataAccessor() .create(path, taskConfig.getTaskConfigZNRecord(), AccessOption.PERSISTENT); TaskDriver driver = new TaskDriver(_manager); String workflowName = TestHelper.getTestMethodName(); submitWorkflow(workflowName, driver); TaskState finalState = driver.pollForWorkflowState(workflowName, TaskState.COMPLETED, TaskState.FAILED); Assert.assertEquals(finalState, TaskState.COMPLETED); }
Source:
public Enchantment.Builder from(final Enchantment value) { this.enchantmentType = value.getType(); this.level = value.getLevel(); return this; }

Target:
public Enchantment.Builder from(final Enchantment value) { checkNotNull(value, "The enchantment to create a builder from cannot be null!"); this.enchantmentType = value.getType(); this.level = value.getLevel(); return this; }
Source:
public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(new RepositoryKey(repository)) == null) { getClient(repository); } try { return configurationCache.get(new RepositoryKey(repository)); } catch (UncheckedExecutionException e) { if (!e.getMessage().startsWith( "com.google.common.cache.CacheLoader$InvalidCacheLoadException: CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } else { return null; } } catch (ExecutionException e) { if (!e.getMessage().startsWith("CacheLoader returned null for key")) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } } return null; }

Target:
public BugzillaRestConfiguration getRepositoryConfiguration(TaskRepository repository) throws CoreException { if (clientCache.getIfPresent(new RepositoryKey(repository)) == null) { getClient(repository); } try { Optional<BugzillaRestConfiguration> configurationOptional = configurationCache.get(new RepositoryKey( repository)); return configurationOptional.isPresent() ? configurationOptional.get() : null; } catch (UncheckedExecutionException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } catch (ExecutionException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } }
Source:
public Tool getExecutable() { for (Tool t : Tool.EMULATORS) { if (t.getExecutable(true).equals(executable)) { return t; } } return Tool.EMULATOR; }

Target:
public Tool getExecutable() { for (Tool t : Tool.EMULATORS) { if (t.executable.equals(executable)) { return t; } } return Tool.EMULATOR; }
Source:
public Blob convertBlobToPDF(Blob blob) throws IOException { String mimetype = blob.getMimeType(); if (MimetypeRegistry.PDF_MIMETYPE.equals(mimetype)) { return blob; } Blob result; if (MediaType.TEXT_PLAIN.equals(mimetype)) { result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); } else { if (!MediaType.TEXT_HTML.equals(mimetype)) { String filename = blob.getFilename(); blob = convertBlobToMimeType(blob, MediaType.TEXT_HTML); blob.setFilename(filename); } Path tempDirectory = Framework.createTempDirectory("blobs"); DownloadService downloadService = Framework.getService(DownloadService.class); blob = replaceURLsByAbsolutePaths(blob, tempDirectory, downloadService::resolveBlobFromDownloadUrl); result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); org.apache.commons.io.FileUtils.deleteQuietly(tempDirectory.toFile()); } if (result != null) { adjustPDFBlobName(blob, result); } return result; }

Target:
public Blob convertBlobToPDF(Blob blob) throws IOException { String mimetype = blob.getMimeType(); String filename = blob.getFilename(); if (MimetypeRegistry.PDF_MIMETYPE.equals(mimetype)) { return blob; } Blob result; if (MediaType.TEXT_PLAIN.equals(mimetype)) { result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); } else { if (!MediaType.TEXT_HTML.equals(mimetype)) { blob = convertBlobToMimeType(blob, MediaType.TEXT_HTML); blob.setFilename(filename); } Path tempDirectory = Framework.createTempDirectory("blobs"); try { DownloadService downloadService = Framework.getService(DownloadService.class); blob = replaceURLsByAbsolutePaths(blob, tempDirectory, downloadService::resolveBlobFromDownloadUrl); result = convertBlobToMimeType(blob, MimetypeRegistry.PDF_MIMETYPE); } finally { org.apache.commons.io.FileUtils.deleteQuietly(tempDirectory.toFile()); } } if (result != null) { adjustPDFBlobName(filename, result); } return result; }
Source:
public V put(@NonNull K key, @NonNull V value) { map.put(key, new Entry<>(key, value, ++time)); if (map.size() >= maximumSize) { purge(); } return value; }

Target:
public V put(@NonNull K key, @NonNull V value) { map.put(key, new Entry<>(key, value, ++time)); if (map.size() > maximumSize) { purge(); } return value; }
Source:
public static List<Stereotype> findSubstereotypes(Element umlElement, String stereotypeName) { if (umlElement == null || stereotypeName == null) { return null; } Set<Stereotype> stereotypes = new HashSet<>(); org.eclipse.uml2.uml.Package umlPackage = umlElement.getNearestPackage(); if (umlPackage == null) { Stereotype stereotype = umlElement.getApplicableStereotype(stereotypeName); if (stereotype != null) { stereotypes.add(stereotype); } } else { for (Profile profile : umlPackage.getAllAppliedProfiles()) { Set<Stereotype> ownedStereotypes = getAllStereotypes(profile); for (Stereotype ownedStereotype : ownedStereotypes) { for (Stereotype superStereotype : getAllSuperStereotypes(ownedStereotype)) { if (stereotypeName.equals(superStereotype.getQualifiedName())) { stereotypes.add(ownedStereotype); } } } } } return new LinkedList<>(stereotypes); }

Target:
public static List<Stereotype> findSubstereotypes(Element umlElement, String stereotypeName) { if (umlElement == null || stereotypeName == null) { return null; } Set<Stereotype> stereotypes = new HashSet<>(); org.eclipse.uml2.uml.Package umlPackage = umlElement.getNearestPackage(); if (umlPackage == null) { Stereotype stereotype = umlElement.getApplicableStereotype(stereotypeName); if (stereotype != null) { stereotypes.add(stereotype); } } else { for (Profile profile : umlPackage.getAllAppliedProfiles()) { Set<Stereotype> ownedStereotypes = getAllStereotypes(profile); for (Stereotype ownedStereotype : ownedStereotypes) { for (Stereotype superStereotype : getAllSuperStereotypes(ownedStereotype)) { if (stereotypeName.equals(superStereotype.getQualifiedName())) { stereotypes.add(ownedStereotype); } } } } } return new LinkedList<Stereotype>(stereotypes); }
Source:
protected void startGravatarUpload(final String filePath) { if (!TextUtils.isEmpty(filePath)) { final File file = new File(filePath); if (file.exists()) { startProgress(); GravatarApi.uploadGravatar(file, mAccountStore.getAccount().getEmail(), mAccountStore.getAccessToken(), new GravatarApi.GravatarUploadListener() { @Override public void onSuccess() { endProgress(); mPhotoUrl = GravatarUtils.fixGravatarUrl(mAccount.getAccount().getAvatarUrl(), getResources().getDimensionPixelSize(R.dimen.avatar_sz_login_epilogue)); loadAvatar(mPhotoUrl, filePath); mHeaderAvatarAdd.setVisibility(View.GONE); mIsAvatarAdded = true; } @Override public void onError() { endProgress(); showErrorDialogAvatar(); AppLog.e(T.NUX, "Uploading image to Gravatar failed"); } }); } else { ToastUtils.showToast(getActivity(), R.string.error_locating_image, ToastUtils.Duration.SHORT); } } else { ToastUtils.showToast(getActivity(), R.string.error_locating_image, ToastUtils.Duration.SHORT); } }

Target:
protected void startGravatarUpload(final String filePath) { if (!TextUtils.isEmpty(filePath)) { final File file = new File(filePath); if (file.exists()) { startProgress(); GravatarApi.uploadGravatar(file, mAccountStore.getAccount().getEmail(), mAccountStore.getAccessToken(), new GravatarApi.GravatarUploadListener() { @Override public void onSuccess() { endProgress(); mPhotoUrl = GravatarUtils.fixGravatarUrl(mAccount.getAccount().getAvatarUrl(), getResources().getDimensionPixelSize(R.dimen.avatar_sz_large)); loadAvatar(mPhotoUrl, filePath); mHeaderAvatarAdd.setVisibility(View.GONE); mIsAvatarAdded = true; } @Override public void onError() { endProgress(); showErrorDialogAvatar(); AppLog.e(T.NUX, "Uploading image to Gravatar failed"); } }); } else { ToastUtils.showToast(getActivity(), R.string.error_locating_image, ToastUtils.Duration.SHORT); } } else { ToastUtils.showToast(getActivity(), R.string.error_locating_image, ToastUtils.Duration.SHORT); } }
Source:
public void testEvent() { EventGateway gateway = new EventGateway(); gateway.getGeneral().getName().setValue(NAME); gateway.getGeneral().getDocumentation().setValue(DOCUMENTATION); Node<View<BaseGateway>, ?> node = mockNode(UUID, gateway); when(propertyWriterFactory.of(any(org.eclipse.bpmn2.EventBasedGateway.class))).thenReturn(gatewayPropertyWriter); assertEquals(gatewayPropertyWriter, converter.toFlowElement(node)); verifyCommonValues(gatewayPropertyWriter, node); }

Target:
public void testEvent() { EventGateway gateway = new EventGateway(); gateway.getGeneral().getName().setValue(NAME); gateway.getGeneral().getDocumentation().setValue(DOCUMENTATION); Node<View<BaseGateway>, ?> node = newNode(UUID, gateway); when(propertyWriterFactory.of(any(org.eclipse.bpmn2.EventBasedGateway.class))).thenReturn(gatewayPropertyWriter); assertEquals(gatewayPropertyWriter, converter.toFlowElement(node)); verifyCommonValues(gatewayPropertyWriter, node); }
Source:
protected void executeQueryCommand() { if (!isSystemSuperUser()) { getQueryReturnValue().setReturnValue(getDbFacade().getRoleDao().getAllNonAdmin()); } else { getQueryReturnValue().setReturnValue(getDbFacade().getRoleDao().getAll()); } }

Target:
protected void executeQueryCommand() { if (!isAdminUser()) { setReturnValue(getDbFacade().getRoleDao().getAllNonAdmin()); } else { setReturnValue(getDbFacade().getRoleDao().getAll()); } }
Source:
private Collection<IdAttrs> getIdAttrsList( Collection<? extends Entity> other) { Collection<IdAttrs> idAttrsList = Lists.newArrayList(); for (Entity en : other) { if (Strings.isNullOrEmpty(en.getIdentity())) { IdAttrs at = new IdAttrs(); en.populateIdAttrs(at); idAttrsList.add(at); } } return idAttrsList; }

Target:
private Collection<Map<String, String>> getIdAttrsList( Collection<? extends Entity> other) { Collection<Map<String, String>> idAttrsList = Lists.newArrayList(); for (Entity en : other) { if (Strings.isNullOrEmpty(en.getIdentity())) { idAttrsList.add(en.getIdAttrsMap()); } } return idAttrsList; }
Source:
public void afterSuccessObserverIsNotNotifiedAfterTxRollBack() throws SystemException { ActionSequence.reset(); ejbTestBean.initTransaction(); Assert.assertFalse(ActionSequence.getSequenceData().isEmpty()); Assert.assertFalse(ActionSequence.getSequenceData().contains(TransactionPhase.AFTER_SUCCESS.toString())); }

Target:
public void afterSuccessObserverIsNotNotifiedAfterTxRollBack() throws SystemException { reset(); ejbTestBean.initTransaction(); assertSequenceDataContainsAll( Arrays.asList(TransactionPhase.IN_PROGRESS.toString(), TransactionPhase.BEFORE_COMPLETION.toString(), TransactionPhase.AFTER_COMPLETION.toString(), TransactionPhase.AFTER_FAILURE.toString())); assertTrue(getSequenceData().indexOf(TransactionPhase.BEFORE_COMPLETION.toString()) < getSequenceData() .indexOf(TransactionPhase.AFTER_COMPLETION.toString())); assertFalse(getSequenceData().contains(TransactionPhase.AFTER_SUCCESS.toString())); }
Source:
public void testAssociationLnListTypeMappingWithEmptyLists() { final List<AssociationLnListElement> associationLnListElement = new ArrayList<>(); final AssociationLnListType associationLnListType = new AssociationLnListTypeBuilder() .withEmptyLists(associationLnListElement).build(); final AssociationLnListTypeDto associationLnListTypeDto = this.mapperFactory.getMapperFacade() .map(associationLnListType, AssociationLnListTypeDto.class); this.checkAssociationLnListElementMapping(associationLnListType.getAssociationLnListElement(), associationLnListTypeDto.getAssociationLnListElement()); assertNotNull(associationLnListTypeDto); }

Target:
public void testAssociationLnListTypeMappingWithEmptyLists() { final AssociationLnListType associationLnListType = new AssociationLnListTypeBuilder().withEmptyLists().build(); final AssociationLnListTypeDto associationLnListTypeDto = this.configurationMapper.map(associationLnListType, AssociationLnListTypeDto.class); assertNotNull(associationLnListTypeDto); this.checkAssociationLnListElementMapping(associationLnListType.getAssociationLnListElement(), associationLnListTypeDto.getAssociationLnListElement()); }
Source:
private PatchSet getBasePatchSet(Change change, Ref ref) throws IOException, InvalidChangeOperationException { try { int pos = ref.getName().lastIndexOf("/"); String psId = ref.getName().substring(++pos); return db.get().patchSets().get(new PatchSet.Id( change.getId(), Integer.valueOf(psId))); } catch (OrmException e) { throw new IOException(e); } }

Target:
private PatchSet getBasePatchSet(Change change, Ref ref) throws IOException, InvalidChangeOperationException { try { int pos = ref.getName().lastIndexOf("/"); String psId = ref.getName().substring(pos + 1); return db.get().patchSets().get(new PatchSet.Id( change.getId(), Integer.valueOf(psId))); } catch (OrmException e) { throw new IOException(e); } }
Source:
private static ProviderParameters providerParametersMock(Class<?>... testClasses) { TestsToRun testsToRun = newTestsToRun(testClasses); ScanResult scanResult = mock(ScanResult.class); when(scanResult.applyFilter(any(), any())).thenReturn(testsToRun); RunOrderCalculator runOrderCalculator = mock(RunOrderCalculator.class); when(runOrderCalculator.orderTestClasses(any())).thenReturn(testsToRun); ReporterFactory reporterFactory = mock(ReporterFactory.class); RunListener runListener = mock(ForkingRunListener.class); when(reporterFactory.createReporter()).thenReturn(runListener); ProviderParameters providerParameters = mock(ProviderParameters.class); when(providerParameters.getScanResult()).thenReturn(scanResult); when(providerParameters.getRunOrderCalculator()).thenReturn(runOrderCalculator); when(providerParameters.getReporterFactory()).thenReturn(reporterFactory); return providerParameters; }

Target:
private static ProviderParameters providerParametersMock(Class<?>... testClasses) { TestsToRun testsToRun = newTestsToRun(testClasses); ScanResult scanResult = mock(ScanResult.class); when(scanResult.applyFilter(any(), any())).thenReturn(testsToRun); RunOrderCalculator runOrderCalculator = mock(RunOrderCalculator.class); when(runOrderCalculator.orderTestClasses(any())).thenReturn(testsToRun); ReporterFactory reporterFactory = mock(ReporterFactory.class); RunListener runListener = mock(ForkingRunListener.class, withSettings().extraInterfaces(ConsoleOutputReceiver.class)); when(reporterFactory.createReporter()).thenReturn(runListener); ProviderParameters providerParameters = mock(ProviderParameters.class); when(providerParameters.getScanResult()).thenReturn(scanResult); when(providerParameters.getRunOrderCalculator()).thenReturn(runOrderCalculator); when(providerParameters.getReporterFactory()).thenReturn(reporterFactory); return providerParameters; }
Source:
private static boolean responseOk(final int status) { switch (status) { case HttpStatus.SC_CREATED: case HttpStatus.SC_OK: return true; default: return false; } }

Target:
private static boolean responseOk(final int status) { return status / 100 == 2; }
Source:
private void startClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, UnknownHostException { if (client == null) { LOG.info("Connecting to the ElasticSearch cluster: " + configuration.getClusterName()); if (configuration.getHostAddressesList() != null && !configuration.getHostAddressesList().isEmpty()) { client = createClient(); } else { LOG.info("Incorrect ip address and port parameters settings for ElasticSearch cluster"); } } }

Target:
private void startClient() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, UnknownHostException { if (client == null) { LOG.info("Connecting to the ElasticSearch cluster: " + configuration.getClusterName()); if (configuration.getHostAddressesList() != null && !configuration.getHostAddressesList().isEmpty()) { client = createClient(); } else { LOG.warn("Incorrect ip address and port parameters settings for ElasticSearch cluster"); } } }
Source:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit c = pending.next(); if (c == null) return null; if (c.inDegree > 0) { continue; } if ((c.flags & TOPO_QUEUED) == 0) { continue; } for (RevCommit p : c.parents) { if (--p.inDegree == 0 && (p.flags & TOPO_QUEUED) != 0) { pending.unpop(p); } if (firstParent) { break; } } c.flags &= ~TOPO_QUEUED; return c; } }

Target:
RevCommit next() throws MissingObjectException, IncorrectObjectTypeException, IOException { for (;;) { final RevCommit c = pending.next(); if (c == null) return null; if (c.inDegree > 0) { continue; } if ((c.flags & TOPO_QUEUED) == 0) { continue; } for (RevCommit p : c.parents) { if ((c.flags & UNINTERESTING) == 0) { p.inDegree--; } if (p.inDegree == 0 && (p.flags & TOPO_QUEUED) != 0) { pending.unpop(p); } if (firstParent) { break; } } c.flags &= ~TOPO_QUEUED; return c; } }
Source:
protected List<PacketHandler> getHandlers() { synchronized (this.handlers) { return this.handlers; } }

Target:
protected List<PacketHandler> getHandlers() { return this.handlers; }
Source:
public long getSendCount() { return sendCount.get(); }

Target:
public int getSendCount() { return (int) sendCount.get(); }
Source:
public static void takeScreenshotOfElement(IElement element, File toSaveAs) throws IOException, WidgetException { for(int i = 0; i < 10; i++) { log.info("Taking screen shot of locator " + element.getLocator() + " ... attempt #" + (i+1)); element.scrollTo(); WebDriver wd = SessionManager.getInstance().getCurrentSession().getWrappedDriver(); File screenshot; boolean isRemote = false; if(!(wd instanceof RemoteWebDriver)) { screenshot = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE); } else { Augmenter augmenter = new Augmenter(); screenshot = ((TakesScreenshot) augmenter.augment(wd)).getScreenshotAs(OutputType.FILE); isRemote = true; } BufferedImage fullImage = ImageIO.read(screenshot); element.waitForElementPresent(); WebElement ele = element.getWebElement(); Point point = ele.getLocation(); int eleWidth = ele.getSize().getWidth(); int eleHeight = ele.getSize().getHeight(); int x; int y; if(isRemote) { x = ((Locatable)ele).getCoordinates().inViewPort().getX(); y = ((Locatable)ele).getCoordinates().inViewPort().getY(); } else { x = point.getX(); y = point.getY(); } log.debug("Screenshot coordinates x: "+x+", y: "+y); BufferedImage eleScreenshot = fullImage.getSubimage(x, y, eleWidth, eleHeight); ImageIO.write(eleScreenshot, "png", screenshot); if(!isBlack(ImageIO.read(screenshot))) { FileUtils.copyFile(screenshot, toSaveAs); break; } } }

Target:
public static void takeScreenshotOfElement(IElement element, File toSaveAs) throws IOException, WidgetException { for(int i = 0; i < 10; i++) { log.info("Taking screen shot of locator " + element.getLocator() + " ... attempt #" + (i+1)); element.scrollTo(); WebDriver wd = SessionManager.getInstance().getCurrentSession().getWrappedDriver(); File screenshot; boolean isRemote = false; if(!(wd instanceof RemoteWebDriver)) { screenshot = ((TakesScreenshot) wd).getScreenshotAs(OutputType.FILE); } else { Augmenter augmenter = new Augmenter(); screenshot = ((TakesScreenshot) augmenter.augment(wd)).getScreenshotAs(OutputType.FILE); isRemote = true; } BufferedImage fullImage = ImageIO.read(screenshot); WebElement ele = element.getWebElement(); Point point = ele.getLocation(); int eleWidth = ele.getSize().getWidth(); int eleHeight = ele.getSize().getHeight(); int x; int y; if(isRemote) { x = ((Locatable)ele).getCoordinates().inViewPort().getX(); y = ((Locatable)ele).getCoordinates().inViewPort().getY(); } else { x = point.getX(); y = point.getY(); } log.debug("Screenshot coordinates x: "+x+", y: "+y); BufferedImage eleScreenshot = fullImage.getSubimage(x, y, eleWidth, eleHeight); ImageIO.write(eleScreenshot, "png", screenshot); if(!isBlack(ImageIO.read(screenshot))) { FileUtils.copyFile(screenshot, toSaveAs); break; } } }
Source:
private String buildIncrementalLookupQuery( final CacheScheduler.EntryImpl<JdbcExtractionNamespace> key, final JdbcExtractionNamespace namespace, String tsColumn, Long lastLoadTs) { final DBI dbi = ensureDBI(key, namespace); final String table = namespace.getTable(); final String filter = namespace.getFilter(); final String valueColumn = namespace.getValueColumn(); final String keyColumn = namespace.getKeyColumn(); if (Strings.isNullOrEmpty(filter)) { return StringUtils.format( "SELECT %s, %s FROM %s WHERE %s >= '%s' AND %s IS NOT NULL", keyColumn, valueColumn, table, tsColumn, new Timestamp(lastLoadTs).toString(), valueColumn ); } return StringUtils.format( "SELECT %s, %s FROM %s WHERE %s%s IS NOT NULL", keyColumn, valueColumn, table, Strings.isNullOrEmpty(filter) ? "" : filter + " AND ", valueColumn ); }

Target:
private String buildIncrementalLookupQuery( final CacheScheduler.EntryImpl<JdbcExtractionNamespace> key, final JdbcExtractionNamespace namespace, String tsColumn, Long lastLoadTs) { final String table = namespace.getTable(); final String filter = namespace.getFilter(); final String valueColumn = namespace.getValueColumn(); final String keyColumn = namespace.getKeyColumn(); if (Strings.isNullOrEmpty(filter)) { return StringUtils.format( "SELECT %s, %s FROM %s WHERE %s >= '%s' AND %s IS NOT NULL", keyColumn, valueColumn, table, tsColumn, new Timestamp(lastLoadTs).toString(), valueColumn ); } return StringUtils.format( "SELECT %s, %s FROM %s WHERE %s%s IS NOT NULL", keyColumn, valueColumn, table, Strings.isNullOrEmpty(filter) ? "" : filter + " AND ", valueColumn ); }
Source:
public String normalize(String value) { String filteredValue = StringUtils.replacePattern(value, "\\(.*?\\)", ""); return stringNormalizer.normalize(filteredValue); }

Target:
public String normalize(String value) { String filteredValue = StringUtils.removePattern(value, "\\(.*?\\)"); return stringNormalizer.normalize(filteredValue); }