auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void connectionStateListener_OnConnectionEvent(boolean isTcpConnectionEndpointRediscoveryEnabled, RequestResponseType responseType, int times) { TcpServer server = TcpServerFactory.startNewRntbdServer(port); server.injectServerResponse(responseType); ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig()); connectionPolicy.setTcpConnectionEndpointRediscoveryEnabled(isTcpConnectionEndpointRediscoveryEnabled); GlobalAddressResolver addressResolver = Mockito.mock(GlobalAddressResolver.class); SslContext sslContext = SslContextUtils.CreateSslContext("client.jks", false); Configs config = Mockito.mock(Configs.class); Mockito.doReturn(sslContext).when(config).getSslContext(); RntbdTransportClient client = new RntbdTransportClient( config, connectionPolicy, new UserAgentContainer(), addressResolver); RxDocumentServiceRequest req = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(), OperationType.Create, ResourceType.Document, "dbs/fakedb/colls/fakeColls", getDocumentDefinition(), new HashMap<>()); req.setPartitionKeyRangeIdentity(new PartitionKeyRangeIdentity("fakeCollectionId","fakePartitionKeyRangeId")); Uri targetUri = new Uri(serverUriString); try { client.invokeStoreAsync(targetUri, req).block(); } catch (Exception e) { e.printStackTrace(); } finally { Mockito.verify(addressResolver, Mockito.times(times)).updateAddresses(Mockito.any(), Mockito.any()); } TcpServerFactory.shutdownRntbdServer(server); }

Target:
public void connectionStateListener_OnConnectionEvent( boolean isTcpConnectionEndpointRediscoveryEnabled, RequestResponseType responseType, int times) throws ExecutionException, InterruptedException { TcpServer server = TcpServerFactory.startNewRntbdServer(port); server.injectServerResponse(responseType); ConnectionPolicy connectionPolicy = new ConnectionPolicy(DirectConnectionConfig.getDefaultConfig()); connectionPolicy.setTcpConnectionEndpointRediscoveryEnabled(isTcpConnectionEndpointRediscoveryEnabled); GlobalAddressResolver addressResolver = Mockito.mock(GlobalAddressResolver.class); SslContext sslContext = SslContextUtils.CreateSslContext("client.jks", false); Configs config = Mockito.mock(Configs.class); Mockito.doReturn(sslContext).when(config).getSslContext(); RntbdTransportClient client = new RntbdTransportClient( config, connectionPolicy, new UserAgentContainer(), addressResolver); RxDocumentServiceRequest req = RxDocumentServiceRequest.create(mockDiagnosticsClientContext(), OperationType.Create, ResourceType.Document, "dbs/fakedb/colls/fakeColls", getDocumentDefinition(), new HashMap<>()); req.setPartitionKeyRangeIdentity(new PartitionKeyRangeIdentity("fakeCollectionId","fakePartitionKeyRangeId")); Uri targetUri = new Uri(serverUriString); try { client.invokeStoreAsync(targetUri, req).block(); } catch (Exception e) { logger.info("expected failed request with reason {}", e); } finally { Mockito.verify(addressResolver, Mockito.times(times)).updateAddresses(Mockito.any(), Mockito.any()); } TcpServerFactory.shutdownRntbdServer(server); }
Source:
String getAgentStatusReportRequestBody(JobIdentifier identifier, String elasticAgentId, Map<String, String> clusterProfile) { JsonObject jsonObject = new JsonObject(); if (identifier != null) { jsonObject.add("job_identifier", jobIdentifierJson(identifier)); } if (clusterProfile != null) { jsonObject.add("cluster_profile_properties", mapToJsonObject(clusterProfile)); } jsonObject.addProperty("elastic_agent_id", elasticAgentId); return GSON.toJson(jsonObject); }

Target:
String getAgentStatusReportRequestBody(JobIdentifier identifier, String elasticAgentId, Map<String, String> clusterProfile) { JsonObject jsonObject = new JsonObject(); if (identifier != null) { jsonObject.add("job_identifier", jobIdentifierJson(identifier)); } jsonObject.add("cluster_profile_properties", mapToJsonObject(clusterProfile)); jsonObject.addProperty("elastic_agent_id", elasticAgentId); return GSON.toJson(jsonObject); }
Source:
public PowerMaxState handleMessage() { if (isAckRequired()) { PowerMaxCommDriver.getTheCommDriver().sendAck(this, (byte) 0x02); } logger.debug("{}message handled by class {}: {}", (receiveType == null) ? "Unsupported " : "", this.getClass().getSimpleName(), this.toString()); return null; }

Target:
public PowerMaxState handleMessage() { if (isAckRequired()) { PowerMaxCommDriver.getTheCommDriver().sendAck(this, (byte) 0x02); } if (logger.isDebugEnabled()) { logger.debug("{}message handled by class {}: {}", (receiveType == null) ? "Unsupported " : "", this.getClass().getSimpleName(), this.toString()); } return null; }
Source:
public void testNegativeAggregateAgainstInverse() throws Exception { UseRestriction consent = new Not(new Named("<LINK_1>")); Boolean b = ONT_MODEL_CACHE.matchPurpose(new MatchWorkerMessage(resources, new MatchPair(aggregatePurpose, consent))); Assert.assertFalse(b); }

Target:
public void testNegativeAggregateAgainstInverse() throws Exception { UseRestriction consent = new Not(new Named("<LINK_0>")); Boolean b = ONT_MODEL_CACHE.matchPurpose(new MatchWorkerMessage(resources, new MatchPair(aggregatePurpose, consent))); Assert.assertFalse(b); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CredentialsIdentityConfig other = (CredentialsIdentityConfig) obj; if (credentials == null) { if (other.credentials != null) { return false; } } else if (!credentials.equals(other.credentials)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CredentialsIdentityConfig other = (CredentialsIdentityConfig) obj; return Objects.equals(credentials, other.credentials); }
Source:
public void removeImportedTransaction (Xid xid) throws XAException { if (xid == null) throw new IllegalArgumentException(); AtomicReference<SubordinateTransaction> remove = _transactions.remove(new SubordinateXidImple(xid)); if (remove != null) { TransactionImple.removeTransaction((com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) remove.get()); } }

Target:
public void removeImportedTransaction (Xid xid) throws XAException { if (xid == null) throw new IllegalArgumentException(); AtomicReference<SubordinateTransaction> remove = _transactions.remove(new SubordinateXidImple(xid)); if (remove != null) { synchronized (remove) { com.arjuna.ats.internal.jta.transaction.jts.TransactionImple transactionImple = (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) remove.get(); while (transactionImple == null) { try { remove.wait(); transactionImple = (com.arjuna.ats.internal.jta.transaction.jts.TransactionImple) remove.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new XAException(XAException.XAER_RMFAIL); } } TransactionImple.removeTransaction(transactionImple); } } }
Source:
private static void levelStatus() { if (currentGame.getCurrentLevel().getNPCs().isEmpty() && currentGame.getCurrentLevel().getEnemyBubbles().isEmpty()) { if (endTimer <= 0) { if (currentGame.remainingLevels() == 0) { Logger.getInstance().log("Player completed the game successfully."); animationTimer.stop(); winDialog(); } else { Logger.getInstance().log("Player advanced to the next level."); staticContext.setFill(Color.WHITE); staticContext.fillText(Constants.ADVANCINGLABEL, (Constants.LEVELX / 2) - 100, (Constants.LEVELY / 2) - 130); currentGame.goToNextLevel(); GameDisplay.renderStatic(); } endTimer = Constants.REFRESH_RATE * 4; } endTimer--; } }

Target:
private static void levelStatus() { Level currentLevel = currentGame.getCurrentLevel(); if (currentLevel.getNPCs().isEmpty() && currentLevel.getEnemyBubbles().isEmpty()) { if (endStepsSnapShot == 0) { staticContext.setFill(Color.WHITE); staticContext.fillText(Constants.ADVANCINGLABEL, (Constants.LEVELX / 2) - 100, (Constants.LEVELY / 2) - 130); endStepsSnapShot = currentGame.getSteps(); } if (endStepsSnapShot + Constants.REFRESH_RATE * 4 < currentGame.getSteps()) { if (currentGame.remainingLevels() == 0) { Logger.getInstance().log("Player completed the game successfully."); animationTimer.stop(); winDialog(); } else { Logger.getInstance().log("Player advanced to the next level."); currentGame.goToNextLevel(); GameDisplay.renderStatic(); } endStepsSnapShot = 0; } } }
Source:
public void downloadAndReplaceSegment(String segmentName, LLCRealtimeSegmentZKMetadata llcSegmentMetadata, IndexLoadingConfig indexLoadingConfig, TableConfig tableConfig) { final String uri = llcSegmentMetadata.getDownloadUrl(); if (!"PEER".equalsIgnoreCase(uri)) { try { downloadSegmentFromDeepStore(segmentName, indexLoadingConfig, uri); } catch (Exception e) { if (isPeerSegmentDownloadEnabled(tableConfig)) { downloadSegmentFromPeer(segmentName, tableConfig.getValidationConfig().getPeerSegmentDownloadScheme(), indexLoadingConfig); } else { throw e; } } } else { if (isPeerSegmentDownloadEnabled(tableConfig)) { downloadSegmentFromPeer(segmentName, tableConfig.getValidationConfig().getPeerSegmentDownloadScheme(), indexLoadingConfig); } else { throw new RuntimeException("Peer segment download not enabled for segment " + segmentName); } } }

Target:
public void downloadAndReplaceSegment(String segmentName, LLCRealtimeSegmentZKMetadata llcSegmentMetadata, IndexLoadingConfig indexLoadingConfig, TableConfig tableConfig) { final String uri = llcSegmentMetadata.getDownloadUrl(); if (!METADATA_URI_FOR_PEER_DOWNLOAD.equals(uri)) { try { downloadSegmentFromDeepStore(segmentName, indexLoadingConfig, uri); } catch (Exception e) { _logger.warn("Download segment from deepstore uri failed.", segmentName, uri, e); if (isPeerSegmentDownloadEnabled(tableConfig)) { downloadSegmentFromPeer(segmentName, tableConfig.getValidationConfig().getPeerSegmentDownloadScheme(), indexLoadingConfig); } else { throw e; } } } else { if (isPeerSegmentDownloadEnabled(tableConfig)) { downloadSegmentFromPeer(segmentName, tableConfig.getValidationConfig().getPeerSegmentDownloadScheme(), indexLoadingConfig); } else { throw new RuntimeException("Peer segment download not enabled for segment " + segmentName); } } }
Source:
private void loadData( ) { for ( int i = 0; i < data.getTags().size(); i++ ) { final int idx = i; final String tag = data.getTags().get( idx ); Button fullTag = new Button( tag, IconType.TRASH ); fullTag.setType( ButtonType.INVERSE ); fullTag.setSize( ButtonSize.SMALL ); tags.add( fullTag ); if ( !readOnly ) { fullTag.addClickHandler( new ClickHandler() { public void onClick( final ClickEvent event ) { removeTag( idx ); } } ); } } }

Target:
public void loadData( ) { view.clear(); for (String tag : data.getTags()) { view.addTag( tag, readOnly ); } }
Source:
long getTotalNumberOfPages(final long totalElements) { return (long) Math.ceil((double) totalElements / pageSize); }

Target:
long getTotalNumberOfPages(final long totalElements) { return (totalElements - 1 + pageSize) / pageSize; }
Source:
public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory); BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; registry.registerBeanDefinition(JOB_LAUNCHER_TEST_UTILS_BEAN_NAME, new RootBeanDefinition(JobLauncherTestUtils.class)); registry.registerBeanDefinition(JOB_REPOSITORY_TEST_UTILS_BEAN_NAME, new RootBeanDefinition(JobRepositoryTestUtils.class)); }

Target:
public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) { ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); Assert.isInstanceOf(BeanDefinitionRegistry.class, beanFactory, "The bean factory must be an instance of BeanDefinitionRegistry"); BeanDefinitionRegistry registry = (BeanDefinitionRegistry) beanFactory; registry.registerBeanDefinition(JOB_LAUNCHER_TEST_UTILS_BEAN_NAME, new RootBeanDefinition(JobLauncherTestUtils.class)); registry.registerBeanDefinition(JOB_REPOSITORY_TEST_UTILS_BEAN_NAME, new RootBeanDefinition(JobRepositoryTestUtils.class)); }
Source:
public void testRange() throws Exception { Jhob[] jobs = new Jhob[100]; for (int i=0; i<jobs.length; i++) jobs[i] = new Jhob("job"+i,"aaa","bbb"); Vhew v = new Vhew("view","aaa",jobs); assertResult("{_class:Vhew,jobs:[{_class:Jhob,name:job0},{_class:Jhob,name:job1},{_class:Jhob,name:job2}]}", v, "jobs[name]{,3}"); assertResult("{_class:Vhew,jobs:[{_class:Jhob,name:job3},{_class:Jhob,name:job4},{_class:Jhob,name:job5}]}", v, "jobs[name]{3,6}"); assertResult("{_class:Vhew,jobs:[{_class:Jhob,name:job38}]}", v, "jobs[name]{38}"); assertResult("{_class:Vhew,jobs:[{_class:Jhob,name:job97},{_class:Jhob,name:job98},{_class:Jhob,name:job99}]}", v, "jobs[name]{97,}"); }

Target:
public void testRange() throws Exception { Jhob[] jobs = new Jhob[100]; for (int i=0; i<jobs.length; i++) jobs[i] = new Jhob("job"+i,"aaa","bbb"); Vhew v = new Vhew("view","aaa",jobs); assertResult("{_class:Vhew,jobs:[{name:job0},{name:job1},{name:job2}]}", v, "jobs[name]{,3}"); assertResult("{_class:Vhew,jobs:[{name:job3},{name:job4},{name:job5}]}", v, "jobs[name]{3,6}"); assertResult("{_class:Vhew,jobs:[{name:job38}]}", v, "jobs[name]{38}"); assertResult("{_class:Vhew,jobs:[{name:job97},{name:job98},{name:job99}]}", v, "jobs[name]{97,}"); }
Source:
public void PutUnProcessableEntityIfIncorrectSettings() throws Exception { String token = getAuthToken(admin.getEmail(), password); JSONObject json = createHarvestSettingsJson("METADATA_ONLY", "<LINK_0>", "col_1721.1_114174", "bc"); getClient(token).perform( put("/api/core/collections/" + collection.getID() + "/harvester") .contentType("application/json") .content(json.toString())) .andExpect(status().isUnprocessableEntity()); }

Target:
public void PutUnProcessableEntityIfIncorrectSettings() throws Exception { String token = getAuthToken(admin.getEmail(), password); JSONObject json = createHarvestSettingsJson("METADATA_ONLY", "<LINK_1>", "col_1721.1_114174", "bc"); getClient(token).perform( put("/api/core/collections/" + collection.getID() + "/harvester") .contentType("application/json") .content(json.toString())) .andExpect(status().isUnprocessableEntity()); }
Source:
private String resolveFile(Bundle bundle, String path) { String prefixedPath = getThemePrefixedPath(path); try { URL url = null; if (prefixedPath != null) { url = bundle.getEntry(prefixedPath); } if (url == null) { url = bundle.getEntry(path); } if (url != null) { URL localURL = FileLocator.toFileURL(url); return localURL.toString(); } } catch (IOException e) { } return null; }

Target:
private String resolveFile(Bundle bundle, String path) throws IOException { String prefixedPath = getThemePrefixedPath(path); URL url = null; if (prefixedPath != null) { url = bundle.getEntry(prefixedPath); } if (url == null) { url = bundle.getEntry(path); } if (url != null) { URL localURL = FileLocator.toFileURL(url); return localURL.toString(); } return null; }
Source:
default B with(double data) { return with( ByteBuffer.allocate(Double.BYTES).putDouble( data ).array()); }

Target:
default B with(double data) { return with( Double.doubleToRawLongBits(data) ); }
Source:
public boolean isNonRefAllele() { return this.equals(Allele.NON_REF_ALLELE) || this.equals(Allele.UNSPECIFIED_ALTERNATE_ALLELE); }

Target:
public boolean isNonRefAllele() { return equals(NON_REF_ALLELE) || equals(UNSPECIFIED_ALTERNATE_ALLELE); }
Source:
public ElasticsearchSplit( @JsonProperty("table") ElasticsearchTableDescription table, @JsonProperty("index") String index, @JsonProperty("shard") int shard, @JsonProperty("searchNode") String searchNode, @JsonProperty("port") int port, @JsonProperty("tupleDomain") TupleDomain<ColumnHandle> tupleDomain) { this.shard = shard; this.table = requireNonNull(table, "table is null"); this.index = requireNonNull(index, "index is null"); this.searchNode = requireNonNull(searchNode, "searchNode is null"); this.port = requireNonNull(port, "port is null"); this.tupleDomain = requireNonNull(tupleDomain, "tupleDomain is null"); }

Target:
public ElasticsearchSplit( @JsonProperty("table") ElasticsearchTableDescription table, @JsonProperty("index") String index, @JsonProperty("shard") int shard, @JsonProperty("searchNode") String searchNode, @JsonProperty("port") int port, @JsonProperty("tupleDomain") TupleDomain<ColumnHandle> tupleDomain) { this.shard = shard; this.table = requireNonNull(table, "table is null"); this.index = requireNonNull(index, "index is null"); this.searchNode = requireNonNull(searchNode, "searchNode is null"); this.port = port; this.tupleDomain = requireNonNull(tupleDomain, "tupleDomain is null"); }
Source:
public List<File> readKnownWorkspacesPath() { List<File> knownPath = new ArrayList<File>(); File currentWK = new File(applicationFolder + File.separator + ALL_WORKSPACE_FILENAME); if(currentWK.exists()) { BufferedReader fileReader=null; try { fileReader = new BufferedReader(new FileReader( currentWK)); String line; while((line = fileReader.readLine())!=null){ File currentDir = new File(line); if(currentDir.exists()) { knownPath.add(currentDir); } } } catch (IOException e) { throw new RuntimeException("Cannot read the workspace location", e); } finally{ try { if(fileReader!=null) { fileReader.close(); } } catch (IOException e) { throw new RuntimeException("Cannot read the workspace location", e); } } } return knownPath; }

Target:
public List<File> readKnownWorkspacesPath() { List<File> knownPath = new ArrayList<File>(); File currentWK = new File(applicationFolder + File.separator + ALL_WORKSPACE_FILENAME); if(currentWK.exists()) { BufferedReader fileReader=null; try { fileReader = new BufferedReader(new FileReader( currentWK)); String line; while((line = fileReader.readLine())!=null){ File currentDir = new File(line); if(currentDir.exists()) { knownPath.add(currentDir); } } } catch (IOException e) { throw new RuntimeException("Cannot read the workspace location "+currentWK+" .", e); } finally{ try { if(fileReader!=null) { fileReader.close(); } } catch (IOException e) { throw new RuntimeException("Cannot close the file at location"+currentWK+" .", e); } } } if(knownPath.isEmpty() && workspaceFolder!=null) { knownPath.add(new File(workspaceFolder)); } if(knownPath.isEmpty()) { knownPath.add(new File(System.getProperty("user.home"),"OrbisGIS"+File.separator)); } return knownPath; }
Source:
public XmlStateProvider(ITmfTrace trace, @NonNull String stateid, IPath file) { super(trace, ITmfEvent.class, stateid); fStateId = stateid; fFilePath = file; Element doc = XmlUtils.getElementInFile(fFilePath.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, fStateId); if (doc == null) { fLocations = new HashSet<>(); return; } ITmfXmlModelFactory modelFactory = TmfXmlModelFactoryReadWrite.getInstance(); NodeList definedStateNodes = doc.getElementsByTagName(TmfXmlStrings.DEFINED_VALUE); for (int i = 0; i < definedStateNodes.getLength(); i++) { Element element = (Element) definedStateNodes.item(i); fDefinedValues.put(element.getAttribute(TmfXmlStrings.NAME), element.getAttribute(TmfXmlStrings.VALUE)); } NodeList locationNodes = doc.getElementsByTagName(TmfXmlStrings.LOCATION); Set<TmfXmlLocation> locations = new HashSet<>(); for (int i = 0; i < locationNodes.getLength(); i++) { Element element = (Element) locationNodes.item(i); TmfXmlLocation location = modelFactory.createLocation(element, this); locations.add(location); } fLocations = Collections.unmodifiableSet(locations); NodeList nodes = doc.getElementsByTagName(TmfXmlStrings.EVENT_HANDLER); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); TmfXmlEventHandler handler = modelFactory.createEventHandler(element, this); fEventHandlers.add(handler); } }

Target:
public XmlStateProvider(ITmfTrace trace, @NonNull String stateid, IPath file) { super(trace, ITmfEvent.class, stateid); fStateId = stateid; fFilePath = file; Element doc = XmlUtils.getElementInFile(fFilePath.makeAbsolute().toOSString(), TmfXmlStrings.STATE_PROVIDER, fStateId); if (doc == null) { fLocations = new HashSet<>(); return; } ITmfXmlModelFactory modelFactory = TmfXmlModelFactoryReadWrite.getInstance(); NodeList definedStateNodes = doc.getElementsByTagName(TmfXmlStrings.DEFINED_VALUE); for (int i = 0; i < definedStateNodes.getLength(); i++) { Element element = (Element) definedStateNodes.item(i); fDefinedValues.put(element.getAttribute(TmfXmlStrings.NAME), element.getAttribute(TmfXmlStrings.VALUE)); } NodeList locationNodes = doc.getElementsByTagName(TmfXmlStrings.LOCATION); Set<TmfXmlLocation> locations = new HashSet<>(); for (int i = 0; i < locationNodes.getLength(); i++) { Element element = (Element) locationNodes.item(i); TmfXmlLocation location = modelFactory.createLocation(element, this); locations.add(location); } fLocations = Collections.unmodifiableSet(locations); NodeList nodes = doc.getElementsByTagName(TmfXmlStrings.EVENT_HANDLER); for (int i = 0; i < nodes.getLength(); i++) { Element element = (Element) nodes.item(i); TmfXmlEventHandler handler = modelFactory.createEventHandler(element, this); fEventHandlers.add(handler); } }
Source:
public void onCreate() { super.onCreate(); ACRA.init(this); if (BuildConfig.DEBUG) { Traceur.enableLogging(); } ApplicationlessInjection .getInstance(this) .getCommonsApplicationComponent() .inject(this); initTimber(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setDownsampleEnabled(true) .build(); try { Fresco.initialize(this, config); } catch (Exception e) { Timber.e(e); } ContributionUtils.emptyTemporaryDirectory(); initAcra(); if (BuildConfig.DEBUG) { Stetho.initializeWithDefaults(this); } createNotificationChannel(this); if (setupLeakCanary() == RefWatcher.DISABLED) { return; } System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); }

Target:
public void onCreate() { super.onCreate(); ACRA.init(this); if (BuildConfig.DEBUG) { Traceur.enableLogging(); } ApplicationlessInjection .getInstance(this) .getCommonsApplicationComponent() .inject(this); initTimber(); ImagePipelineConfig config = ImagePipelineConfig.newBuilder(this) .setDownsampleEnabled(true) .build(); try { Fresco.initialize(this, config); } catch (Exception e) { Timber.e(e); } ContributionUtils.emptyTemporaryDirectory(); if (BuildConfig.DEBUG && !isRoboUnitTest()) { Stetho.initializeWithDefaults(this); } createNotificationChannel(this); if (setupLeakCanary() == RefWatcher.DISABLED) { return; } System.setProperty("in.yuvi.http.fluent.PROGRESS_TRIGGER_THRESHOLD", "3.0"); }
Source:
protected void delete(Context context, Integer id) throws AuthorizeException { Relationship relationship = null; try { relationship = relationshipService.find(context, id); if (relationship != null) { if (authorizeService.authorizeActionBoolean(context, relationship.getLeftItem(), Constants.WRITE) && authorizeService.authorizeActionBoolean(context, relationship.getRightItem(), Constants.WRITE)) { relationshipService.delete(context, relationship); } else { throw new AccessDeniedException("You do not have write rights on this relationship's items"); } } } catch (SQLException e) { log.error(e.getMessage(), e); } }

Target:
protected void delete(Context context, Integer id) throws AuthorizeException { Relationship relationship = null; try { relationship = relationshipService.find(context, id); if (relationship != null) { try { relationshipService.delete(context, relationship); } catch (AuthorizeException e) { throw new AccessDeniedException("You do not have write rights on this relationship's items"); } } } catch (SQLException e) { log.error("Error deleting Relationship specified by ID:" + id, e); } }
Source:
public void put(PageId pageId, byte[] page) throws IOException { Path p = getFilePath(pageId); if (!Files.exists(p)) { Path parent = Preconditions.checkNotNull(p.getParent(), "parent of cache file should not be null"); Files.createDirectories(parent); Files.createFile(p); } try { try (FileOutputStream fos = new FileOutputStream(p.toFile(), false)) { fos.write(page); } } catch (IOException e) { LOG.error("Failed to create file for page {}", p, pageId); Files.delete(p); } }

Target:
public void put(PageId pageId, byte[] page) throws IOException { Path p = getFilePath(pageId); if (!Files.exists(p)) { Path parent = Preconditions.checkNotNull(p.getParent(), "parent of cache file should not be null"); Files.createDirectories(parent); Files.createFile(p); } try { try (FileOutputStream fos = new FileOutputStream(p.toFile(), false)) { fos.write(page); } } catch (Exception e) { Files.deleteIfExists(p); throw new IOException("Failed to write file " + p + " for page " + pageId); } }
Source:
public String getSocatContainerImage() { return String.valueOf(properties.getOrDefault("socat.container.image", "alpine/socat:latest")); }

Target:
public String getSocatContainerImage() { return (String) properties.getOrDefault("socat.container.image", "alpine/socat:latest"); }
Source:
@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { final Message message = (Message) methodInvocation.getArguments()[1]; final TraceContextOrSamplingFlags extracted = extractTraceContextAndRemoveHeaders(message); final Span consumerSpan = tracer.nextSpan(extracted).kind(CONSUMER).start(); tagReceivedMessageProperties(consumerSpan, message.getMessageProperties()); consumerSpan.finish(); final Span serverSpan = tracer.newChild(consumerSpan.context()).kind(SERVER).start(); tagReceivedMessageProperties(serverSpan, message.getMessageProperties()); try (SpanInScope ws = tracer.withSpanInScope(serverSpan)) { return methodInvocation.proceed(); } catch (Throwable t) { tagErrorSpan(serverSpan, t); throw t; } finally { serverSpan.finish(); } }

Target:
@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { final Message message = (Message) methodInvocation.getArguments()[1]; final TraceContextOrSamplingFlags extracted = extractTraceContextAndRemoveHeaders(message); final Span consumerSpan = tracer.nextSpan(extracted).kind(CONSUMER).start(); tagReceivedMessageProperties(consumerSpan, message.getMessageProperties()); String consumerQueue = message.getMessageProperties().getConsumerQueue(); if (consumerQueue != null) consumerSpan.name(consumerQueue); consumerSpan.finish(); final Span listenerSpan = tracer.newChild(consumerSpan.context()).name("on-message").start(); try (SpanInScope ws = tracer.withSpanInScope(listenerSpan)) { return methodInvocation.proceed(); } catch (Throwable t) { tagErrorSpan(listenerSpan, t); throw t; } finally { listenerSpan.finish(); } }
Source:
private boolean allowedNetworkLabelManipulation() { Network oldNetwork = getOldNetwork(); Network newNetwork = getNetwork(); boolean labelNotChanged = Objects.equals(oldNetwork.getLabel(), newNetwork.getLabel()); boolean newLabelAssigned = oldNetwork.getLabel() == null && newNetwork.getLabel() != null; return labelNotChanged || newLabelAssigned; }

Target:
private boolean allowedNetworkLabelManipulation() { boolean labelNotChanged = !new SyncNetworkParametersBuilder(getContext()).labelChanged(); boolean newLabelAssigned = !new SyncNetworkParametersBuilder(getContext()).labelAdded(); return !getNetwork().isExternal() && (labelNotChanged || newLabelAssigned); }
Source:
private void startTrace(BuildData buildData){ if(buildData == null){ return; } Tracer tracer = GlobalTracer.get(); try (Scope scope = tracer.buildSpan("JenkinsBuild").startActive(false)) { final Span span = scope.span(); span.setTag(DDTags.SERVICE_NAME, "jenkins"); DatadogUtilities.severe(logger, null, "startTrace - Cache key: " + buildData.getBuildId(null)); DatadogTraceCache.cache.put(buildData.getBuildId(null), span); } }

Target:
private void startTrace(BuildData buildData){ if(buildData == null){ return; } Tracer tracer = GlobalTracer.get(); Span span = tracer.buildSpan("JenkinsBuild").withTag(DDTags.SERVICE_NAME, "jenkins").start(); String traceId = CorrelationIdentifier.getTraceId(); String spanId = CorrelationIdentifier.getSpanId(); DatadogUtilities.severe(logger, null, "traceId: " + traceId + " | spanId: " + spanId); span.setTag(DDTags.SERVICE_NAME, "jenkins"); DatadogUtilities.severe(logger, null, "startTrace - Cache key: " + buildData.getBuildId(null)); DatadogTraceCache.cache.put(buildData.getBuildId(null), new DatadogTraceCache.AugmentedSpan(span, traceId, spanId)); }
Source:
private static String checkDescription(final String description) { if (description == null || description.isEmpty()) { return ""; } else { for (int i = 0; i < description.length(); i++) { final char c = description.charAt(i); if (Character.isISOControl(c) && c != '\t') { throw new IllegalArgumentException("the input name contains non-tab control characters: '" + description + "'"); } } return description; } }

Target:
private static String checkDescription(final String description) { if (description == null || description.isEmpty()) { return ""; } for (int i = 0; i < description.length(); i++) { final char c = description.charAt(i); if (Character.isISOControl(c) && c != '\t') { throw new IllegalArgumentException("the input name contains non-tab control characters: '" + description + "'"); } } return description; }
Source:
private void runScanner(Runnable action, JavaFileScanner scanner, AnalysisError.Kind kind) throws CheckFailureException { try { action.run(); } catch (IllegalRuleParameterException e) { throw new AnalysisException("Bad configuration of rule parameter", e); } catch (Exception e) { Throwable rootCause = Throwables.getRootCause(e); if (rootCause instanceof InterruptedIOException || rootCause instanceof InterruptedException) { throw e; } String ruleKey = ruleKey(scanner); String message = String.format( "Unable to run check %s - %s on file '%s', To help improve SonarJava, please report this problem to SonarSource : see <LINK_0>", scanner.getClass(), ruleKey, currentFile); LOG.error(message, e); addAnalysisError(e, currentFile, kind); throw new CheckFailureException(message, e); } }

Target:
private void runScanner(Runnable action, JavaFileScanner scanner, AnalysisError.Kind kind) throws CheckFailureException { try { action.run(); } catch (IllegalRuleParameterException e) { throw new AnalysisException("Bad configuration of rule parameter", e); } catch (Exception e) { Throwable rootCause = Throwables.getRootCause(e); if (rootCause instanceof InterruptedIOException || rootCause instanceof InterruptedException) { throw e; } String message = String.format( "Unable to run check %s - %s on file '%s', To help improve SonarJava, please report this problem to SonarSource : see <LINK_0>", scanner.getClass(), ruleKey(scanner), currentFile); LOG.error(message, e); addAnalysisError(e, currentFile, kind); throw new CheckFailureException(message, e); } }
Source:
public static TicketUtils getInstanceForEngineStoreSigning() throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { File store = EngineLocalConfig.getInstance().getPKIEngineStore(); String password = EngineLocalConfig.getInstance().getPKIEngineStorePassword(); String alias = EngineLocalConfig.getInstance().getPKIEngineStoreAlias(); return new TicketUtils(store, password, alias, 120); }

Target:
public static TicketUtils getInstanceForEngineStoreSigning() throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { File store = EngineLocalConfig.getInstance().getPKIEngineStore(); String password = EngineLocalConfig.getInstance().getPKIEngineStorePassword(); String alias = EngineLocalConfig.getInstance().getPKIEngineStoreAlias(); Integer lifetime = Config.<Integer> GetValue (ConfigValues.WebSocketProxyTicketValiditySeconds); return new TicketUtils(store, password, alias, lifetime); }
Source:
private Logger getLogger(final ClassLoader resolvedCtxClassLoader) { if (useThisLoggerContextClassLoader(resolvedCtxClassLoader)) { return originalLogger; } Reference<Logger> loggerReference = loggerCache.get(resolvedCtxClassLoader); Logger logger = loggerReference.get(); if (logger == null) { synchronized (loggerReference) { logger = loggerReference.get(); if (logger == null) { try { logger = resolveLogger(resolvedCtxClassLoader); } catch (RecursiveLoggerContextInstantiationException rle) { return resolveLogger(ClassLoader.getSystemClassLoader()); } loggerReference.set(logger); } } } return logger; }

Target:
private Logger getLogger(final ClassLoader resolvedCtxClassLoader) { if (useThisLoggerContextClassLoader(resolvedCtxClassLoader)) { return originalLogger; } Reference<Logger> loggerReference = loggerCache.get(resolvedCtxClassLoader); Logger logger = loggerReference.get(); if (logger == null) { synchronized (loggerReference) { logger = loggerReference.get(); if (logger == null) { try { logger = resolveLogger(resolvedCtxClassLoader); } catch (RecursiveLoggerContextInstantiationException rle) { return resolveLogger(this.getClass().getClassLoader()); } loggerReference.set(logger); } } } return logger; }
Source:
public void afterBeanDiscovery(@Observes ExperimentalAfterBeanDiscovery event, BeanManager beanManager) { AnnotatedType<Foo> annotatedType = beanManager.createAnnotatedType(Foo.class); event.<Foo> addBean().read(annotatedType).name("bar"); BeanBuilder<Foo> builder = event.<Foo> beanBuilder().read(annotatedType); builder.id("BAZinga").addQualifier(Juicy.Literal.INSTANCE); event.addBean(builder.build()); event.<Integer> addBean().addType(Integer.class).addQualifier(Random.Literal.INSTANCE) .produceWith(() -> new java.util.Random().nextInt(1000)).disposeWith((i) -> DISPOSED.set(true)); event.<Long> addBean().addType(Long.class).addQualifier(AnotherRandom.Literal.INSTANCE) .produceWith((i) -> i.select(Foo.class, Juicy.Literal.INSTANCE).get().getId() * 2); }

Target:
public void afterBeanDiscovery(@Observes ExperimentalAfterBeanDiscovery event, BeanManager beanManager) { AnnotatedType<Foo> annotatedType = beanManager.createAnnotatedType(Foo.class); event.<Foo> addBean().beanClass(Foo.class).read(beanManager.createBeanAttributes(annotatedType)).name("bar") .stereotypes(Collections.emptySet()).scope(Dependent.class).produceWith(() -> { Foo foo = new Foo(); foo.postConstruct(); return foo; }); BeanBuilder<Foo> builder = event.<Foo> beanBuilder().read(annotatedType); builder.id("BAZinga").addQualifier(Juicy.Literal.INSTANCE); event.addBean(builder.build()); event.<Integer> addBean().addType(Integer.class).addQualifier(Random.Literal.INSTANCE) .produceWith(() -> new java.util.Random().nextInt(1000)).disposeWith((i) -> DISPOSED.set(true)); event.<Long> addBean().addType(Long.class).addQualifier(AnotherRandom.Literal.INSTANCE) .produceWith((i) -> i.select(Foo.class, Juicy.Literal.INSTANCE).get().getId() * 2); }
Source:
private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { pos--; return documentation; } } if (pos == data.length || data[pos] != '/') { throw unexpected("expected '/'"); } pos++; if (pos < data.length && data[pos] == ' ') { pos++; } int start = pos; while (pos < data.length) { char c = data[pos++]; if (c == '\n') { newline(); break; } } if (start == pos - 1) { return documentation; } String trailingDocumentation = new String(data, start, pos - 1 - start); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + "\n" + trailingDocumentation; }

Target:
private String tryAppendTrailingDocumentation(String documentation) { while (pos < data.length) { char c = data[pos]; if (c == ' ' || c == '\t') { pos++; } else if (c == '/') { pos++; break; } else { return documentation; } } if (pos == data.length || data[pos] != '/') { throw unexpected("expected '/'"); } pos++; if (pos < data.length && data[pos] == ' ') { pos++; } int start = pos; while (pos < data.length) { char c = data[pos++]; if (c == '\n') { newline(); break; } } String trailingDocumentation = new String(data, start, pos - 1 - start); if (documentation.isEmpty()) { return trailingDocumentation; } return documentation + '\n' + trailingDocumentation; }
Source:
public void updateAndRetrieveEmail() throws Exception { final MkBase base = new MkBase(); final User user = NbRule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final String verified; if (alias.email().contains("!")) { verified = alias.email().substring(0, alias.email().indexOf('!')); } else { verified = alias.email(); } final String unverified = base.randomAlias().email(); alias.email(unverified); MatcherAssert.assertThat( alias.email(), Matchers.is(String.format("%s!%s", verified, unverified)) ); }

Target:
public void updateAndRetrieveEmail() throws Exception { final MkBase base = new MkBase(); final User user = NbRule.get(); final Alias alias = user.aliases().iterate().iterator().next(); final String email = base.randomAlias().email(); alias.email(email); MatcherAssert.assertThat(alias.email(), Matchers.is(email)); }
Source:
public Resource getConfigurationResource() throws IOException { return null; }

Target:
public Resource getConfigurationResource() throws IOException { return configurationResourceResolver.getConfigurationResource("repository.config.xml", "etc/conf/strongbox.xml"); }
Source:
public BlockPos getPosition() { return new BlockPos(0, 0, 0); }

Target:
public BlockPos getPosition() { return BlockPos.ORIGIN; }
Source:
public String toString() { return parsedPath.toString(); }

Target:
public String toString() { return Joiner.on(", ").join(getParsedPath()); }
Source:
public boolean canHandle(Object object) { return ResourceAttachmentChangeMergeViewerItem.class.isInstance(object); }

Target:
public boolean canHandle(Object object) { return object instanceof ResourceAttachmentChangeMergeViewerItem; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (isNullOrEmpty(token)) { chain.doFilter(request, response); return; } try { HttpSession session = ((HttpServletRequest) request).getSession(true); Subject sessionSubject = (Subject) session.getAttribute("che_subject"); if (sessionSubject == null || !sessionSubject.getToken().equals(token)) { try { sessionSubject = extractSubject(token); session.setAttribute("che_subject", sessionSubject); } catch (NotFoundException e) { sendErr( response, SC_UNAUTHORIZED, "Authentication with machine token failed because user for this token no longer exist."); return; } } try { EnvironmentContext.getCurrent().setSubject(sessionSubject); chain.doFilter(addUserInRequest(httpRequest, sessionSubject), response); } finally { EnvironmentContext.reset(); } } catch (NotMachineTokenJwtException ex) { chain.doFilter(request, response); } catch (ServerException | JwtException e) { LOG.error(e.getMessage(), e); sendErr( response, SC_UNAUTHORIZED, format("Authentication with machine token failed cause: %s", e.getMessage())); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { final HttpServletRequest httpRequest = (HttpServletRequest) request; final String token = tokenExtractor.getToken(httpRequest); if (isNullOrEmpty(token)) { chain.doFilter(request, response); return; } try { HttpSession session = ((HttpServletRequest) request).getSession(true); Subject sessionSubject = (Subject) session.getAttribute("che_subject"); if (sessionSubject == null || !sessionSubject.getToken().equals(token)) { try { sessionSubject = extractSubject(token); session.setAttribute("che_subject", sessionSubject); } catch (NotFoundException e) { sendErr( response, SC_UNAUTHORIZED, "Authentication with machine token failed because user for this token no longer exist."); return; } } try { EnvironmentContext.getCurrent().setSubject(sessionSubject); chain.doFilter(addUserInRequest(httpRequest, sessionSubject), response); } finally { EnvironmentContext.reset(); } } catch (NotMachineTokenJwtException ex) { chain.doFilter(request, response); } catch (ServerException | JwtException e) { sendErr( response, SC_UNAUTHORIZED, format("Authentication with machine token failed cause: %s", e.getMessage())); } }
Source:
public static OfflinePlayer deserialize(Map<String, Object> val) { if (val.get("name") != null) { return Bukkit.getServer().getOfflinePlayer(val.get("name").toString()); } else { return Bukkit.getServer().getOfflinePlayer(UUID.fromString(val.get("uuid").toString())); } }

Target:
public static OfflinePlayer deserialize(Map<String, Object> val) { if (val.get("name") != null) { return Bukkit.getServer().getOfflinePlayer(val.get("name").toString()); } else { return Bukkit.getServer().getOfflinePlayer(UUID.fromString(val.get("UUID").toString())); } }
Source:
public static void deleteTagsForId(Context context, String record) { SQLiteDatabase db = getDatabase(context); db.delete("tags", "record = '"+record+"'", null); db.close(); }

Target:
public static void deleteTagsForId(Context context, String record) { SQLiteDatabase db = getDatabase(context); db.delete("tags", "record = ?", new String[] {record}); db.close(); }
Source:
public KuduEndpoint(String uri, KuduComponent component) { super(uri, component); this.setUri(uri); this.setEndpointUri(uri); Pattern p = Pattern.compile("^(\\S+)\\:(\\d+)\\/(\\S+)$"); Matcher m = p.matcher(uri); if (!m.matches()) { throw new RuntimeException("Unrecognizable url: " + uri); } this.setHost(m.group(1)); this.setPort(m.group(2)); this.setTableName(m.group(3)); }

Target:
public KuduEndpoint(String uri, KuduComponent component) { super(uri, component); Pattern p = Pattern.compile("^(\\S+)\\:(\\d+)\\/(\\S+)$"); Matcher m = p.matcher(uri); if (!m.matches()) { throw new RuntimeException("Unrecognizable url: " + uri); } this.setHost(m.group(1)); this.setPort(m.group(2)); this.setTableName(m.group(3)); }
Source:
public CosmosClientException setRequestTimeline(RequestTimeline requestTimeline) { this.requestTimeline = requestTimeline; return this; }

Target:
CosmosClientException setRequestTimeline(RequestTimeline requestTimeline) { this.requestTimeline = requestTimeline; return this; }
Source:
public void requestStop() { try { this.server.stop(); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void requestStop() throws Exception { this.server.stop(); }
Source:
public void setConfigAttributes(Object attributes) { Map attributeMap = (Map) attributes; if (attributeMap.containsKey(TYPE)) { type = (String) attributeMap.get(TYPE); } if (type.equals(Approval.MANUAL) && attributeMap.containsKey("allowOnlyOnSuccess")) { this.allowOnlyOnSuccess = attributeMap.get("allowOnlyOnSuccess").equals("1"); } }

Target:
public void setConfigAttributes(Object attributes) { Map attributeMap = (Map) attributes; if (attributeMap.containsKey(TYPE)) { type = (String) attributeMap.get(TYPE); } if (attributeMap.containsKey("allowOnlyOnSuccess")) { this.allowOnlyOnSuccess = attributeMap.get("allowOnlyOnSuccess").equals("true"); } }
Source:
public Response remove() { get(); return performAction(VdcActionType.RemoveMacPool, new RemoveMacPoolByIdParameters(asGuid(id))); }

Target:
public Response remove() { get(); return performAction(VdcActionType.RemoveMacPool, new RemoveMacPoolByIdParameters(guid)); }
Source:
public void recordScheduleCreate(ScheduleRequest scheduleRequest) { Assert.notNull(scheduleRequest, "scheduleRequest must not be null"); Assert.hasText(scheduleRequest.getScheduleName(), "The scheduleName of the scheduleRequest must not be null or empty"); Assert.notNull(scheduleRequest.getDefinition(), "The appDefinition of the scheduleRequest must not be null"); final Map<String, Object> auditedData = new HashMap<>(3); auditedData.put(TASK_DEFINITION_NAME, scheduleRequest.getDefinition().getName()); if (scheduleRequest.getDefinition().getProperties() != null) { auditedData.put(TASK_DEFINITION_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDefinition().getProperties())); } if (scheduleRequest.getDeploymentProperties() != null) { auditedData.put(DEPLOYMENT_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDeploymentProperties())); } if (scheduleRequest.getCommandlineArguments() != null) { auditedData.put(COMMANDLINE_ARGUMENTS, argumentSanitizer.sanitizeArguments(scheduleRequest.getCommandlineArguments())); } this.populateAndSaveAuditRecordUsingMapData(AuditOperationType.SCHEDULE, AuditActionType.CREATE, scheduleRequest.getScheduleName(), auditedData); }

Target:
public void recordScheduleCreate(ScheduleRequest scheduleRequest) { Assert.notNull(scheduleRequest, "scheduleRequest must not be null"); Assert.hasText(scheduleRequest.getScheduleName(), "The scheduleName of the scheduleRequest must not be null or empty"); Assert.notNull(scheduleRequest.getDefinition(), "The task definition of the scheduleRequest must not be null"); final Map<String, Object> auditedData = new HashMap<>(3); auditedData.put(TASK_DEFINITION_NAME, scheduleRequest.getDefinition().getName()); if (scheduleRequest.getDefinition().getProperties() != null) { auditedData.put(TASK_DEFINITION_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDefinition().getProperties())); } if (scheduleRequest.getDeploymentProperties() != null) { auditedData.put(DEPLOYMENT_PROPERTIES, argumentSanitizer.sanitizeProperties(scheduleRequest.getDeploymentProperties())); } if (scheduleRequest.getCommandlineArguments() != null) { auditedData.put(COMMANDLINE_ARGUMENTS, argumentSanitizer.sanitizeArguments(scheduleRequest.getCommandlineArguments())); } this.populateAndSaveAuditRecordUsingMapData(AuditOperationType.SCHEDULE, AuditActionType.CREATE, scheduleRequest.getScheduleName(), auditedData); }
Source:
private boolean checkMinCardinality(Context context, Item item, Relationship relationship, Integer minCardinality, boolean isLeft) throws SQLException { List<Relationship> list = this.findByItemAndRelationshipType(context, item, relationship.getRelationshipType(), -1, -1, isLeft); if (minCardinality != null && !(list.size() > minCardinality)) { return false; } return true; }

Target:
private boolean checkMinCardinality(Context context, Item item, Relationship relationship, Integer minCardinality, boolean isLeft) throws SQLException { List<Relationship> list = this.findByItemAndRelationshipType(context, item, relationship.getRelationshipType(), isLeft, -1, -1); if (minCardinality != null && !(list.size() > minCardinality)) { return false; } return true; }
Source:
public Constraint baseConstraint(ProgramState state) { final Constraint leftConstraint = state.getConstraint(leftOperand); final Constraint rightConstraint = state.getConstraint(rightOperand); if (leftConstraint.isIncompatibleWith(rightConstraint)) { if (kind == Kind.STRICT_EQUAL_TO) { return Constraint.FALSE; } if (kind == Kind.STRICT_NOT_EQUAL_TO) { return Constraint.TRUE; } } if (isExactValueConstraint(leftConstraint) && isExactValueConstraint(rightConstraint)) { Constraint exactValueConstraint = resolveExactValueEqualityConstraint(leftConstraint, rightConstraint); if (exactValueConstraint != null) { return exactValueConstraint; } } return super.baseConstraint(state); }

Target:
public Constraint baseConstraint(ProgramState state) { final Constraint leftConstraint = state.getConstraint(leftOperand); final Constraint rightConstraint = state.getConstraint(rightOperand); if (leftConstraint.isIncompatibleWith(rightConstraint)) { if (kind == Kind.STRICT_EQUAL_TO) { return Constraint.FALSE; } if (kind == Kind.STRICT_NOT_EQUAL_TO) { return Constraint.TRUE; } } Constraint singleValueEqualityConstraint = resolveSingleValueEqualityConstraint(leftConstraint, rightConstraint); if (singleValueEqualityConstraint != null) { return singleValueEqualityConstraint; } return super.baseConstraint(state); }
Source:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj instanceof BaseEntity)) { return false; } if (getId() == null) { return super.equals(obj); } BaseEntity other = (BaseEntity) obj; return getId().equals(other.getId()); }

Target:
public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null) { return false; } if (!(obj.getClass().equals(getClass()))) { return false; } if (getId() == null) { return super.equals(obj); } BaseEntity other = (BaseEntity) obj; return getId().equals(other.getId()); }