auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void pushReset() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); <START> HttpFields.Mutable requestHeaders = HttpFields.build() <END> .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); CompletableFuture<Stream> streamCF = session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public Stream.Listener onPush(Stream pushedStream, PushPromiseFrame frame) { pushedStream.reset(new ResetFrame(pushedStream.getId(), ErrorCode.CANCEL_STREAM_ERROR.code), Callback.NOOP); return null; } }); }</code><technical_language>Remove .Mutable</technical_language>

Target:
public void pushReset() throws Exception { HTTP2Client http2Client = new HTTP2Client(); http2Client.start(); SocketAddress serverAddress = new InetSocketAddress("localhost", 8080); CompletableFuture<Session> sessionCF = http2Client.connect(serverAddress, new Session.Listener.Adapter()); Session session = sessionCF.get(); HttpFields requestHeaders = HttpFields.build() .put(HttpHeader.USER_AGENT, "Jetty HTTP2Client {version}"); MetaData.Request request = new MetaData.Request("GET", HttpURI.from("http://localhost:8080/path"), HttpVersion.HTTP_2, requestHeaders); HeadersFrame headersFrame = new HeadersFrame(request, null, true); CompletableFuture<Stream> streamCF = session.newStream(headersFrame, new Stream.Listener.Adapter() { @Override public Stream.Listener onPush(Stream pushedStream, PushPromiseFrame frame) { pushedStream.reset(new ResetFrame(pushedStream.getId(), ErrorCode.CANCEL_STREAM_ERROR.code), Callback.NOOP); return null; } }); }
Source:
<code>public void testExecuteNonNullRunnable() throws Exception { FutureTask<Void> task = new FutureTask<Void>(new Runnable() { @Override public void run() { <START> <END> } }, null); ImmediateExecutor.INSTANCE.execute(task); assertTrue(task.isDone()); assertFalse(task.isCancelled()); assertTrue(task.get() == null); }</code><technical_language>add // NOOP syntax: new Runnable() { }</technical_language>

Target:
public void testExecuteNonNullRunnable() throws Exception { FutureTask<Void> task = new FutureTask<Void>(new Runnable() { @Override public void run() { } }, null); ImmediateExecutor.INSTANCE.execute(task); assertTrue(task.isDone()); assertFalse(task.isCancelled()); assertNull(task.get()); }
Source:
<code>public void beginMetaData(MetaData metadata) { <START> Map<String, String> parameters = new HashMap<>(); <END> for (Map.Entry<String, Object> metadaPair : metadata.getMetaData().entrySet()) { parameters.put(metadaPair.getKey(), metadaPair.getValue().toString()); } parameters.put("class", "xwiki-metadata-block"); this.getXHTMLWikiPrinter().printXMLStartElement(METADATA_BLOCK_ELEMENT, parameters); }</code><technical_language>I call attributes referred in XML / HTML world</technical_language>

Target:
public void beginMetaData(MetaData metadata) { Map<String, String> attributes = new LinkedHashMap<>(); for (Map.Entry<String, Object> metadataPair : metadata.getMetaData().entrySet()) { attributes.put(XHTMLXWikiGeneratorListener.METADATA_ATTRIBUTE_PREFIX + metadataPair.getKey(), metadataPair.getValue().toString()); } attributes.put("class", XHTMLXWikiGeneratorListener.METADATA_CONTAINER_CLASS); this.getXHTMLWikiPrinter().printXMLStartElement(getMetadataContainerElement(), attributes); }
Source:
<code>public PatternLatencyTableView() { this.addPartPropertyListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); <START> loadNewLatencyView(); <END> } } } }); }</code><technical_language>remove New method name, loading latency view, new</technical_language>

Target:
public PatternLatencyTableView() { this.addPartPropertyListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) { Object newValue = event.getNewValue(); if (newValue instanceof String) { String data = (String) newValue; fViewInfo.setViewData(data); loadLatencyView(); } } } }); }
Source:
<code>private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); ZKClientConfig conf = zooKeeper.getClientConfig(); if (conf.isSaslClientEnabled()) { try { String principalUserName = conf.getProperty(ZKClientConfig.ZK_SASL_CLIENT_USERNAME, ZKClientConfig.ZK_SASL_CLIENT_USERNAME_DEFAULT); String serverPrincipal = principalUserName + "/" + addr.getHostString(); String loginContext = conf.getProperty(ZKClientConfig.LOGIN_CONTEXT_NAME_KEY, ZKClientConfig.LOGIN_CONTEXT_NAME_KEY_DEFAULT); <START> if (null != zooKeeperSaslClient && zooKeeperSaslClient.getSaslState() != SaslState.FAILED) { <END> zooKeeperSaslClient.reCreateSaslClient(serverPrincipal, loginContext); } else { if (null != zooKeeperSaslClient) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(serverPrincipal, conf); } } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }</code><technical_language>add this logic here</technical_language>

Target:
private void startConnect() throws IOException { if(!isFirstConnect){ try { Thread.sleep(r.nextInt(1000)); } catch (InterruptedException e) { LOG.warn("Unexpected exception", e); } } state = States.CONNECTING; InetSocketAddress addr; if (rwServerAddress != null) { addr = rwServerAddress; rwServerAddress = null; } else { addr = hostProvider.next(1000); } String hostPort = addr.getHostString() + ":" + addr.getPort(); MDC.put("myid", hostPort); setName(getName().replaceAll("\\(.*\\)", "(" + hostPort + ")")); if (clientConfig.isSaslClientEnabled()) { try { if (zooKeeperSaslClient != null) { zooKeeperSaslClient.shutdown(); } zooKeeperSaslClient = new ZooKeeperSaslClient(getServerPrincipal(addr), clientConfig); } catch (LoginException e) { LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without " + "SASL authentication, if Zookeeper server allows it."); eventThread.queueEvent(new WatchedEvent( Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null)); saslLoginFailed = true; } } logStartConnect(addr); clientCnxnSocket.connect(addr); }
Source:
<code>public IntervalListCodec(final SAMSequenceDictionary dict) { <START> this(); <END> dictionary = dict; }</code><technical_language>chaining constructors want chain arguments more arguments, chaining lets provide default values (or computed values) for arguments specified. In this case IMO no-arg constructor call this constructor this(null); this constructor call super(Interval.class);</technical_language>

Target:
public IntervalListCodec(final SAMSequenceDictionary dict) { super(Interval.class); dictionary = dict; }
Source:
<code>public void execution() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { final SphereRequest<List<ShippingMethod>> sphereRequest = <START> new VrapRequestDecorator<>(ShippingMethodsByLocationGet.of(CountryCode.DE).withExpansionPaths(m -> m.zones()), "response"); <END> final List<ShippingMethod> shippingMethodsByLocation = client().executeBlocking(sphereRequest); assertThat(shippingMethodsByLocation).isNotEmpty(); for (final ShippingMethod shippingMethodByLocation : shippingMethodsByLocation) { final List<ShippingRate> shippingRates = shippingMethodByLocation.getZoneRates().stream() .flatMap(zoneRate -> zoneRate.getShippingRates().stream()) .collect(Collectors.toList()); assertThat(shippingRates).areAtLeastOne(new Condition<>(ShippingRate::isMatching, "Shipping rate is matching")); } }); }</code><technical_language>fail if expansion path is recognized? In a normal situation I fails silently, returning query results happened, fail. wrapped in this VrapRequestDecorator checking RAML specification</technical_language>

Target:
public void execution() throws Exception { withShippingMethodForGermany(client(), shippingMethod -> { final SphereRequest<List<ShippingMethod>> sphereRequest = new VrapRequestDecorator<>(ShippingMethodsByLocationGet.of(CountryCode.DE).withExpansionPaths(m -> m.zones()), "response"); final List<ShippingMethod> shippingMethodsByLocation = client().executeBlocking(sphereRequest); assertThat(shippingMethodsByLocation).isNotEmpty(); for (final ShippingMethod shippingMethodByLocation : shippingMethodsByLocation) { final List<ShippingRate> shippingRates = shippingMethodByLocation.getZoneRates().stream() .flatMap(zoneRate -> zoneRate.getShippingRates().stream()) .collect(Collectors.toList()); assertThat(shippingRates).areAtLeastOne(new Condition<>(ShippingRate::isMatching, "Shipping rate is matching")); assertThat(shippingMethodByLocation.getZones()).isNotEmpty(); assertThat(shippingMethodByLocation.getZones().get(0).getObj()).isNotNull(); } }); }
Source:
<code>private Gauge<Number> makeZkQueueGauge(final String path){ return () -> { try { return curatorFramework.getChildren().forPath(path).size(); } catch (Exception e) { <START> return 0; <END> } }; }</code><technical_language>shallow exception</technical_language>

Target:
private Gauge<Number> makeZkQueueGauge(final String path){ return () -> { try { return curatorFramework.getChildren().forPath(path).size(); } catch (Exception e) { throw new RuntimeException(e); } }; }
Source:
<code>public void testGetProducerInfoPartialClient() { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("2"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("2"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span parentSpan = new Span(); parentSpan.setId("1"); parentSpan.setParentId("1"); try { spanCache.store(null, Arrays.asList(serverSpan, clientSpan, parentSpan), SpanUniqueIdGenerator::toUnique); <START> } catch (CacheException e) { <END> fail("Failed to store span"); } ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }</code><technical_language>I catch this test Error a failure</technical_language>

Target:
public void testGetProducerInfoPartialClient() throws CacheException { SpanCache spanCache = new TestSpanCache(); Span serverSpan = new Span(); serverSpan.setId("2"); serverSpan.setParentId("1"); serverSpan.setAnnotations(serverAnnotations()); Span clientSpan = new Span(); clientSpan.setId("2"); clientSpan.setParentId("1"); BinaryAnnotation ba = new BinaryAnnotation(); ba.setKey("http.url"); ba.setValue("http://myhost:8080/myuri"); clientSpan.setBinaryAnnotations(Arrays.asList(ba)); clientSpan.setAnnotations(clientAnnotations()); Span parentSpan = new Span(); parentSpan.setId("1"); parentSpan.setParentId("1"); spanCache.store(null, Arrays.asList(serverSpan, clientSpan, parentSpan), SpanUniqueIdGenerator::toUnique); ProducerInfo pi = ProducerInfoUtil.getProducerInfo(null, serverSpan, spanCache); assertNotNull(pi); assertEquals(Constants.URI_CLIENT_PREFIX + "/myuri", pi.getSourceUri()); }
Source:
<code>public void create(String stream) throws IOException { <START> HttpPut putRequest = new HttpPut(restClient.getBaseUrl() + String.format("streams/%s", stream)); <END> CloseableHttpResponse httpResponse = restClient.execute(putRequest); try { LOG.debug("Create Stream Response Code : {}", httpResponse.getStatusLine().getStatusCode()); RestClient.responseCodeAnalysis(httpResponse); } finally { httpResponse.close(); } }</code><technical_language>constructing new URL (URI) base, URI represents base URI.resolve resolve full path</technical_language>

Target:
public void create(String stream) throws IOException { HttpPut putRequest = new HttpPut(restClient.getBaseURL().resolve(String.format("/%s/streams/%s", restClient.getVersion(), stream))); CloseableHttpResponse httpResponse = restClient.execute(putRequest); try { LOG.debug("Create Stream Response Code : {}", httpResponse.getStatusLine().getStatusCode()); RestClient.responseCodeAnalysis(httpResponse); } finally { httpResponse.close(); } }
Source:
<code>public int compareTo(Result<T> tResult) { if (timestamp == null && tResult.timestamp == null) { return 0; } else if (timestamp == null) { <START> return 1; <END> } else if (tResult == null) { return -1; } else { return timestamp.compareTo(tResult.timestamp); } }</code><technical_language>1, if timestamp is null, assuming null is tResult.timestamp(which is supposedly non-null)</technical_language>

Target:
public int compareTo(Result<T> tResult) { return Comparator.nullsLast(DateTime::compareTo).compare(this.timestamp, tResult.timestamp); }
Source:
<code>private void getTasksRequest(){ Log.i("watasdfasdf", String.valueOf(mArgs.getInt(OPTION))); HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); TaskListRequest taskListRequest = new TaskListRequest(getActivity(), params, new Response.Listener<ArrayList<Task>>() { @Override public void onResponse(ArrayList<Task> tasks) { if (mArgs.getInt(OPTION) == USER) { tasks = getUserTasks(tasks); if (tasks.size() > 0) { showList(); setUserTasks(tasks); mUserTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mUserTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } else { if (tasks.size() > 0) { showList(); setAllTasks(tasks); mAllTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mAllTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } if (mSwipeLayout != null) mSwipeLayout.setRefreshing(false); } <START> }, mSwipeLayout); <END> mNetworkManager.getRequestQueue().add(taskListRequest); }</code><technical_language>this line do</technical_language>

Target:
private void getTasksRequest(){ mSwipeLayout.setRefreshing(true); HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); TaskListRequest taskListRequest = new TaskListRequest(getActivity(), params, new Response.Listener<ArrayList<Task>>() { @Override public void onResponse(ArrayList<Task> tasks) { if (mArgs.getInt(OPTION) == USER) { tasks = getUserTasks(tasks); if (tasks.size() > 0) { showList(); setUserTasks(tasks); mUserTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mUserTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } else { if (tasks.size() > 0) { showList(); setAllTasks(tasks); mAllTaskAdapter.notifyDataSetChanged(); for(int i=0; i < mAllTaskAdapter.getGroupCount(); i++) mListView.expandGroup(i); } else { hideList(); } } if (mSwipeLayout != null) mSwipeLayout.setRefreshing(false); } }, mSwipeLayout); mNetworkManager.getRequestQueue().add(taskListRequest); }
Source:
<code>private void syncObjectUnsafeInner(long timestamp) { if (optimisticallyOwnedByThreadUnsafe()) { if (optimisticStream.pos() == Address.NEVER_READ) { final WriteSetSMRStream currentOptimisticStream = optimisticStream; if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); } catch (NoRollbackException nre) { log.warn("SyncObjectUnsafe[{}] to failed {}", this, timestamp, nre); if (getCompactionMark() > timestamp) { <START> throw new TrimmedException(); <END> } resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); optimisticStream = currentOptimisticStream; } syncStreamUnsafe(optimisticStream, Address.OPTIMISTIC); } else { if (this.optimisticStream != null) { optimisticRollbackUnsafe(); this.optimisticStream = null; } if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); if (getVersionUnsafe() == timestamp) { return; } } catch (NoRollbackException nre) { log.warn("Rollback[{}] to failed {}", this, timestamp, nre); if (Address.isAddress(timestamp) && getCompactionMark() > timestamp) { throw new TrimmedException(); } resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); } }</code><technical_language>trimmedException message required timestamp actual compaction mark</technical_language>

Target:
private void syncObjectUnsafeInner(long timestamp) { if (optimisticallyOwnedByThreadUnsafe()) { if (optimisticStream.pos() == Address.NEVER_READ) { final WriteSetSMRStream currentOptimisticStream = optimisticStream; if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); } catch (NoRollbackException nre) { log.warn("SyncObjectUnsafe[{}] to failed {}", this, timestamp, nre); resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); optimisticStream = currentOptimisticStream; } syncStreamUnsafe(optimisticStream, Address.OPTIMISTIC); } else { if (this.optimisticStream != null) { optimisticRollbackUnsafe(); this.optimisticStream = null; } if (getVersionUnsafe() > timestamp) { try { rollbackObjectUnsafe(timestamp); if (getVersionUnsafe() == timestamp) { return; } } catch (NoRollbackException nre) { log.warn("Rollback[{}] to failed {}", this, timestamp, nre); resetUnsafe(); } } syncStreamUnsafe(smrStream, timestamp); } }
Source:
<code>public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Max abs example started."); <START> IgniteCache<Integer, Person> persons = createCache(ignite); <END> IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); IgniteBiFunction<Integer, Person, Vector> preprocessor = new MaxAbsScalerTrainer<Integer, Person>() .fit(ignite, persons, featureExtractor); try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) { double[] mean = dataset.mean(); System.out.println("Mean \n\t" + Arrays.toString(mean)); double[] std = dataset.std(); System.out.println("Standard deviation \n\t" + Arrays.toString(std)); double[][] cov = dataset.cov(); System.out.println("Covariance matrix "); for (double[] row : cov) System.out.println("\t" + Arrays.toString(row)); double[][] corr = dataset.corr(); System.out.println("Correlation matrix "); for (double[] row : corr) System.out.println("\t" + Arrays.toString(row)); } System.out.println(">>> Max abs example completed."); } }</code><technical_language>Please update this example changes in master (look another preprocessors)</technical_language>

Target:
public static void main(String[] args) throws Exception { try (Ignite ignite = Ignition.start("examples/config/example-ignite.xml")) { System.out.println(">>> Max abs example started."); IgniteCache<Integer, Person> persons = createCache(ignite); IgniteBiFunction<Integer, Person, Vector> featureExtractor = (k, v) -> VectorUtils.of( v.getAge(), v.getSalary() ); IgniteBiFunction<Integer, Person, Vector> preprocessor = new MaxAbsScalerTrainer<Integer, Person>() .fit(ignite, persons, featureExtractor); try (SimpleDataset<?> dataset = DatasetFactory.createSimpleDataset(ignite, persons, preprocessor)) { new DatasetHelper(dataset).describe(); } System.out.println(">>> Max abs example completed."); } }
Source:
<code>private Node valueMap( Node n ) { if (n.isVariable()) { Var v = Var.alloc(n); Node n2 = values.get( v ); <START> return n2==null?n:n2; <END> } return n; }</code><technical_language>lines return values.getOrDefault( v, n );</technical_language>

Target:
private Node valueMap( Node n ) { if (n.isVariable()) { Var v = Var.alloc(n); return values.getOrDefault(v, n); } return n; }
Source:
<code>public Object getAdapter(Class adapter) { <START> if (adapter == IResource.class || adapter == IContainer.class) { <END> return getContainer(); } else if (adapter == IPath.class) { return path; } return null; }</code><technical_language>style nit: braces single line blocks, more of</technical_language>

Target:
public Object getAdapter(Class adapter) { if (adapter == IResource.class || adapter == IContainer.class) return getContainer(); else if (adapter == IPath.class) return path; return null; }
Source:
<code>public Optional<Long> getFeeAmount() { <START> if (fee != null) { <END> return Optional.of(fee.getAmountCollected()); } else { return Optional.empty(); } }</code><technical_language>Optional.ofNullable used</technical_language>

Target:
public Optional<Long> getFeeAmount() { return Optional.ofNullable(fee).map(FeeEntity::getAmountCollected); }
Source:
<code>public void notifyHeartbeat(final String streamId, final String claimedJobId) { final AtomicBoolean isNew = new AtomicBoolean(false); final JobStreamsRecord jobStreamsRecord = this.jobStreamRecordsMap.computeIfAbsent( claimedJobId, jobId -> { isNew.set(true); return new JobStreamsRecord(jobId); } ); log.debug( "Received heartbeat for job using stream {}", <START> isNew.get() ? "new" : "existing", <END> claimedJobId, streamId ); jobStreamsRecord.updateActiveStream(streamId, timeSupplier.get()); if (isNew.get()) { log.debug("Notifying new agent connected executing job: {}", claimedJobId); this.agentRoutingService.handleClientConnected(claimedJobId); } }</code><technical_language>Couple of minor things. strings constants isNew.get() is called multiple. times in this method. unwrap compute if absent call</technical_language>

Target:
public void notifyHeartbeat(final String streamId, final String claimedJobId) { final AtomicBoolean atomicIsNew = new AtomicBoolean(false); final JobStreamsRecord jobStreamsRecord = this.jobStreamRecordsMap.computeIfAbsent( claimedJobId, jobId -> { atomicIsNew.set(true); return new JobStreamsRecord(jobId); } ); final boolean isNew = atomicIsNew.get(); log.debug( "Received heartbeat for job using stream {}", isNew ? "new" : "existing", claimedJobId, streamId ); jobStreamsRecord.updateActiveStream(streamId, timeSupplier.get()); if (isNew) { log.debug("Notifying new agent connected executing job: {}", claimedJobId); this.agentRoutingService.handleClientConnected(claimedJobId); } }
Source:
<code>default String getDynamicConfigPath() { <START> return "/models/"; <END> }</code><technical_language>File.Separator - "/"</technical_language>

Target:
default String getDynamicConfigPath() { return File.separator + "models" + File.separator; }
Source:
<code>public ResponseEntity setModelVersion(String version) { boolean validRequest = !StringUtils.isEmpty(version); if (validRequest) { try { if (version.equals(configurationService.getModelRepositoryVersion())) { return new ResponseEntity(HttpStatus.NO_CONTENT); } if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { LOGGER.info(LOG_REJECTING_MODEL_VERSION); return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { LOGGER.info(LOG_FAILED_TO_GET_LIST_OF_VERSIONS); LOGGER.info(LOG_VERSION_CONFIGURATION_NOT_UPDATED); <START> LOGGER.error(e); <END> return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }</code><technical_language>above. unusual 3 separate log entries, message i.e. consider replacing 3 lines LOGGER.error(my message, e)</technical_language>

Target:
public ResponseEntity setModelVersion(String version) { boolean validRequest = !StringUtils.isEmpty(version); if (validRequest) { try { if (version.equals(configurationService.getModelRepositoryVersion())) { return new ResponseEntity(HttpStatus.NO_CONTENT); } if (sourceCodeManager.getAvailableVersions().contains(version)) { configurationService.setModelRepositoryVersion(version); } else { LOGGER.info(LOG_REJECTING_MODEL_VERSION); return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.NO_CONTENT); } catch (Exception e) { LOGGER.error(LOG_FAILED_TO_GET_LIST_OF_VERSIONS, e); LOGGER.info(LOG_VERSION_CONFIGURATION_NOT_UPDATED); return new ResponseEntity(HttpStatus.BAD_REQUEST); } } return new ResponseEntity(HttpStatus.BAD_REQUEST); }
Source:
<code>public void executeScriptFile() throws IOException { <START> String hiveSql = "use default"; <END> File file = new File(tempFolder.getRoot(), "script.hiveSql"); Files.write(hiveSql, file, UTF_8); HiveShell shell = createHiveCliShell(); shell.start(); shell.execute(file); verify(container).executeStatement(hiveSql); }</code><technical_language>I this earlier, is longer necessary put ";" end? if do</technical_language>

Target:
public void executeScriptFile() throws IOException { String hiveSql = "use default"; File file = new File(tempFolder.getRoot(), "script.sql"); Files.write(hiveSql, file, UTF_8); HiveShell shell = createHiveCliShell(); shell.start(); shell.execute(file); verify(container).executeStatement(hiveSql); }
Source:
<code>private static String buildColumns(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return EMPTY_STRING; } <START> return columns.stream().map(HiveColumnHandle::getName).collect(Collectors.joining(",")); <END> }</code><technical_language>return columns.stream() .map(HiveColumnHandle::getName) .collect(Collectors.joining(","));</technical_language>

Target:
private static String buildColumns(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return ""; } return columns.stream() .map(HiveColumnHandle::getName) .collect(Collectors.joining(",")); }
Source:
<code>private void showPrepublishingNudgeBottomSheet() { mViewPager.setCurrentItem(PAGE_CONTENT); ActivityUtils.hideKeyboard(this); Fragment fragment = getSupportFragmentManager().findFragmentByTag( PrepublishingBottomSheetFragment.TAG); if (fragment == null) { PrepublishingBottomSheetFragment prepublishingFragment = PrepublishingBottomSheetFragment.newInstance(getSite(), mIsPage); long delayMs = 100; <START> new Handler().postDelayed( <END> () -> prepublishingFragment.show(getSupportFragmentManager(), PrepublishingBottomSheetFragment.TAG), delayMs); } }</code><technical_language>happen (probably never), I this lead a leak of EditPostActivity. want consider creating handler a field canceling in onDestroy. Wdyt</technical_language>

Target:
private void showPrepublishingNudgeBottomSheet() { mViewPager.setCurrentItem(PAGE_CONTENT); ActivityUtils.hideKeyboard(this); long delayMs = 100; mShowPrepublishingBottomSheetHandler.postDelayed(mShowPrepublishingBottomSheetRunnable, delayMs); }
Source:
<code>public List<String> getFieldValues() throws IOException { if (values == null) { List<Object> objs = HighlightUtils.loadFieldValues(context.field, context.mapper, context.context, context.hitContext); <START> values = objs.stream().map(Object::toString).collect(toList()); <END> } return values; }</code><technical_language>90% of time a single element, meaning allocate array of 10 elements. This code runs field highlight * 20 results display search + another small fields highlight source string. I idea if this noticeable I other parts of code this optimization : (e.g. if size() == 1) sense switch : values = objs.stream().map(Object::toString).collect(Collectors.toCollection(() -> new ArrayList(objs.size)));</technical_language>

Target:
public List<String> getFieldValues() throws IOException { if (values == null) { List<Object> objs = HighlightUtils.loadFieldValues(context.field, context.mapper, context.context, context.hitContext); values = objs.stream().map(Object::toString).collect(toCollection(() -> new ArrayList<>(objs.size()))); } return values; }
Source:
<code>public WordsStorage(Context context) { mContext = context; if (!checkBaseDBExist()) { mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); try { InputStream input = mContext.getAssets().open("base.sqlite3"); OutputStream output = new FileOutputStream( mContext.getDatabasePath("base.sqlite3")); <START> IOUtils.copy(input, output); <END> } catch (IOException e) { e.printStackTrace(); } } }</code><technical_language>aware of close() issue, ie: input.close(), output.close(). I remember if need do that. Please check IOUtils.copy() do so</technical_language>

Target:
public WordsStorage(Context context) { mContext = context; if (!checkBaseDBExist()) { mContext.openOrCreateDatabase("base.sqlite3", Context.MODE_PRIVATE, null); InputStream input = null; OutputStream output = null; try { input = mContext.getAssets().open("base.sqlite3"); output = new FileOutputStream(mContext.getDatabasePath("base.sqlite3")); IOUtils.copy(input, output); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(input); IOUtils.closeQuietly(output); } } }
Source:
<code>public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } DateTime createdLocal; try { <START> int foundCreatedLocal = r.findColumn("nameOfColumn"); <END> createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.valueOf(r.getString("response_type").toUpperCase()), Question.FREQUENCY.valueOf(r.getString("frequency").toUpperCase()), Question.ASK_TIME.valueOf(r.getString("ask_time").toUpperCase()), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices ); return question; }</code><technical_language>right</technical_language>

Target:
public Question map(int index, ResultSet r, StatementContext ctx) throws SQLException { final Integer[] response_ids = (Integer []) r.getArray("responses_ids").getArray(); final String[] response_text = (String []) r.getArray("responses").getArray(); final Integer question_id = r.getInt("id"); final List<Choice> choices = new ArrayList<>(); for (int i = 0; i < response_ids.length; i++) { choices.add(new Choice(response_ids[i], response_text[i], question_id)); } DateTime createdLocal; try { int foundCreatedLocal = r.findColumn("created_local_utc_ts"); createdLocal = new DateTime(r.getTimestamp("created_local_utc_ts"), DateTimeZone.UTC); } catch (SQLException error) { createdLocal = DateTime.now(DateTimeZone.UTC); } Long accountQuestionId = 0L; final Question question = new Question(question_id, accountQuestionId, r.getString("question_text"), r.getString("lang"), Question.Type.valueOf(r.getString("response_type").toUpperCase()), Question.FREQUENCY.valueOf(r.getString("frequency").toUpperCase()), Question.ASK_TIME.valueOf(r.getString("ask_time").toUpperCase()), r.getInt("dependency"), r.getInt("parent_id"), createdLocal, choices ); return question; }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } long start = 0; long end = 0; do { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); <START> } while (!ss.waitUntilBuilt(LIVE_UPDATE_DELAY)); <END> Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }</code><technical_language>this way, a chance time start/end now, time range updated trace finished building, out of loop some final values missed? I need a boolean complete = ss.waitUntilBuilt(LIVE_UPDATE_DELAY) higher a while (!complete) here</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { fStatsMod.waitForInitialization(); ITmfStatistics stats = fStatsMod.getStatistics(); if (stats == null) { throw new IllegalStateException(); } ITmfStateSystem ss = fStatsMod.getStateSystem(TmfStatisticsEventTypesModule.ID); if (ss == null) { throw new IllegalStateException(); } long start = 0; long end = 0; boolean finished = false; do { if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } finished = ss.waitUntilBuilt(LIVE_UPDATE_DELAY); TmfTimeRange localtimeRange = fIsGlobal ? fTimeRange : fTimeRangePartial; start = localtimeRange.getStartTime().normalize(0, TIME_SCALE).getValue(); end = localtimeRange.getEndTime().normalize(0, TIME_SCALE).getValue(); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); } while (!finished); Map<String, Long> map = stats.getEventTypesInRange(start, end); updateStats(map); return Status.OK_STATUS; }
Source:
<code>public String toString() { <START> return String.format("%s: %s", key, value); <END> }</code><technical_language>I know, class of interest</technical_language>

Target:
public String toString() { return String.format("%s: %s (%s)", key, value, type); }
Source:
<code>public void testRewritePOMs() throws Exception { URL resource = PomIOTest.class.getResource( filename ); assertNotNull( resource ); File pom = new File( resource.getFile() ); assertTrue( pom.exists() ); File targetFile = folder.newFile( "target.xml" ); FileUtils.writeStringToFile( targetFile, FileUtils.readFileToString( pom, Charset.defaultCharset() ).replaceAll( "dospom", "newdospom" ), Charset.defaultCharset() ); FileUtils.copyFile( pom, targetFile ); List<Project> projects = pomIO.parseProject( targetFile ); Model model = projects.get( 0 ).getModel(); model.setGroupId( "org.commonjava.maven.ext.versioning.test" ); model.setArtifactId( "dospom" ); model.setVersion( "1.0" ); model.setPackaging( "pom" ); model.setModelVersion( "4.0.0" ); Project p = new Project( targetFile, model ); HashSet<Project> changed = new HashSet<>(); changed.add( p ); pomIO.rewritePOMs( changed ); <START> assertTrue( FileUtils.contentEqualsIgnoreEOL( pom, targetFile, StandardCharsets.UTF_8.toString() ) ); <END> assertTrue( FileUtils.contentEquals( targetFile, pom ) ); }</code><technical_language>Charset Charset.forName( model.getModelEncoding() ) ;</technical_language>

Target:
public void testRewritePOMs() throws Exception { URL resource = PomIOTest.class.getResource( filename ); assertNotNull( resource ); File pom = new File( resource.getFile() ); assertTrue( pom.exists() ); File targetFile = folder.newFile( "target.xml" ); FileUtils.writeStringToFile( targetFile, FileUtils.readFileToString( pom, StandardCharsets.UTF_8 ) .replaceAll( "dospom", "newdospom" ), StandardCharsets.UTF_8 ); FileUtils.copyFile( pom, targetFile ); List<Project> projects = pomIO.parseProject( targetFile ); Model model = projects.get( 0 ).getModel(); model.setGroupId( "org.commonjava.maven.ext.versioning.test" ); model.setArtifactId( "dospom" ); model.setVersion( "1.0" ); model.setPackaging( "pom" ); model.setModelVersion( "4.0.0" ); Project p = new Project( targetFile, model ); HashSet<Project> changed = new HashSet<>(); changed.add( p ); pomIO.rewritePOMs( changed ); assertTrue( FileUtils.contentEqualsIgnoreEOL( pom, targetFile, StandardCharsets.UTF_8.toString() ) ); assertTrue( FileUtils.contentEquals( targetFile, pom ) ); }
Source:
<code>public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws AuthenticationException { String user = req.getParameter("user"); String password = req.getParameter("password"); try { return authenticationManager.authenticate( new DSpaceAuthentication( user, password, new ArrayList<>() ) ); } catch(BadCredentialsException e) { DSpace dspace = new DSpace(); ConfigurationService configurationService = dspace.getConfigurationService(); <START> String[] authMethods = configurationService.getArrayProperty("plugin.sequence.org.dspace.authenticate.AuthenticationMethod", new String[0]); <END> for(String method: authMethods) { if (method.equals("org.dspace.authenticate.ShibAuthentication")) { String shibLoginUrl = configurationService.getProperty("authentication-shibboleth.lazysession.loginurl", ""); if (!shibLoginUrl.isEmpty()) { res.addHeader("Location", String.format("https://%s%s?target=%s", req.getHeader("Host"), shibLoginUrl, req.getHeader("Referer"))); } break; } } throw e; } }</code><technical_language>Please replace this AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService(); Iterator<AuthenticationMethod> authenticationMethodIterator = authenticationService.authenticationMethodIterator(); (we'll fix auto-wiring later)</technical_language>

Target:
public Authentication attemptAuthentication(HttpServletRequest req, HttpServletResponse res) throws AuthenticationException { String user = req.getParameter("user"); String password = req.getParameter("password"); try { return authenticationManager.authenticate( new DSpaceAuthentication( user, password, new ArrayList<>() ) ); } catch(BadCredentialsException e) { AuthenticationService authenticationService = AuthenticateServiceFactory.getInstance().getAuthenticationService(); Iterator<AuthenticationMethod> authenticationMethodIterator = authenticationService.authenticationMethodIterator(); while (authenticationMethodIterator.hasNext()) { AuthenticationMethod authenticationMethod = authenticationMethodIterator.next(); Context context = ContextUtil.obtainContext(req); String loginPageURL = authenticationMethod.loginPageURL(context, req, res); if (StringUtils.isNotBlank(loginPageURL)) { res.addHeader("Location", loginPageURL); } } throw e; } }
Source:
<code>public Location getByRef(String ref) { Matcher matcher = refPattern.matcher(ref); <START> checkArgument(matcher.matches()); <END> return get(Integer.parseInt(matcher.group(1))); }</code><technical_language>Include message wrong if check fails? e.g. including original ref argument passed in</technical_language>

Target:
public Location getByRef(String ref) { Matcher matcher = refPattern.matcher(ref); checkArgument(matcher.matches(), "URI '%s' does not match pattern '%s'", ref, refPattern); return get(Integer.parseInt(matcher.group(1))); }
Source:
<code>private boolean isEmbeddedIn(String classOrEnumName) { FieldFrame currentFrame = this; boolean isEmbeddedIn = false; while (currentFrame != null) { if (Objects.equals(currentFrame.frameName, classOrEnumName)) { <START> isEmbeddedIn = true; <END> } currentFrame = currentFrame.parent; } return isEmbeddedIn; }</code><technical_language>missing break assignment</technical_language>

Target:
private boolean isEmbeddedIn(String classOrEnumName) { FieldFrame currentFrame = this; boolean isEmbeddedIn = false; while (currentFrame != null) { if (Objects.equals(currentFrame.frameName, classOrEnumName)) { isEmbeddedIn = true; break; } currentFrame = currentFrame.parent; } return isEmbeddedIn; }
Source:
<code>private Artifact resolveArtifact(Artifact artifact) { final ArtifactResolutionResult result = request(artifact, remoteRepositories); if (!result.isSuccess()) { result.getExceptions().forEach(e -> { LOG.warn("Failed to resolve {}: {}", artifact.getId(), e.getMessage()); <START> LOG.debug("Exceptions in artifact resolution.", e); <END> }); } return artifact; }</code><technical_language>Remove duplicate logging in debug level</technical_language>

Target:
private Artifact resolveArtifact(Artifact artifact) { final ArtifactResolutionResult result = request(artifact, remoteRepositories); if (!result.isSuccess()) { result.getExceptions().forEach(e -> LOG.warn("Failed to resolve {}: {}", artifact.getId(), e.getMessage())); } return artifact; }
Source:
<code>public void testCreateDistroXWithEncryptedVolume(TestContext testContext) { String externalDB = resourcePropertyProvider().getName(); List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext) .defaultHostGroup() .withDiskEncryption() .build(); testContext.given(externalDB, DistroXExternalDatabaseTestDto.class) .withAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA) .given(DistroXTestDto.class) .withInstanceGroupsEntity(distroXInstanceGroupTestDtos) .withExternalDatabase(externalDB) .when(distroXTestClient.create()) .await(STACK_AVAILABLE) <START> .then(validateTemplateContainsExternalDatabaseHostname(Actor.defaultUser(testParameter))) <END> .then((context, distrox, client) -> { distrox.getResponse(); return distrox; }) .validate(); }</code><technical_language>default user test context</technical_language>

Target:
public void testCreateDistroXWithEncryptedVolume(TestContext testContext) { String externalDatabaseName = resourcePropertyProvider().getName(); List<DistroXInstanceGroupTestDto> distroXInstanceGroupTestDtos = new DistroXInstanceGroupsBuilder(testContext) .defaultHostGroup() .withDiskEncryption() .build(); testContext.given(externalDatabaseName, DistroXExternalDatabaseTestDto.class) .withAvailabilityType(DistroXDatabaseAvailabilityType.NON_HA) .given(DistroXTestDto.class) .withInstanceGroupsEntity(distroXInstanceGroupTestDtos) .withExternalDatabase(externalDatabaseName) .when(distroXTestClient.create()) .await(STACK_AVAILABLE) .then(validateTemplateContainsExternalDatabaseHostname()) .then((context, distrox, client) -> { distrox.getResponse(); return distrox; }) .validate(); }
Source:
<code>protected void saveElement(final EObject o, final EStructuralFeature f) { if (f.getContainerClass().equals(EMapPropertyHolder.class)) { <START> if (o instanceof ElkPropertyToValueMapEntryImpl) { <END> IProperty<?> property = ((ElkPropertyToValueMapEntryImpl) o).getKey(); LayoutOptionData optionData = LayoutMetaDataService.getInstance().getOptionData(property.getId()); if (optionData != null && !optionData.canParseValue()) { return; } } } super.saveElement(o, f); }</code><technical_language>if (f.equals(ElkGraphPackage.Literals.EMAP_PROPERTY_HOLDER__PROPERTIES) && o instanceof Map.Entry<?, ?>) { ..</technical_language>

Target:
protected void saveElement(final EObject o, final EStructuralFeature f) { if (f.equals(ElkGraphPackage.Literals.EMAP_PROPERTY_HOLDER__PROPERTIES) && o instanceof ElkPropertyToValueMapEntryImpl) { IProperty<?> property = ((ElkPropertyToValueMapEntryImpl) o).getKey(); LayoutOptionData optionData = LayoutMetaDataService.getInstance().getOptionData(property.getId()); if (optionData != null && !optionData.canParseValue()) { return; } } super.saveElement(o, f); }
Source:
<code>private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); <START> ExtensionEntry alreadyLoaded = loadedEntries.get(entry.getName()); <END> if (alreadyLoaded != null) { throw new ConfigurationException(String.format("Could not load the configuration %1$s. %2$s", String.format("'%1$s' %2$s", entry.getName(), entry.file != null ? "from file " + entry.file.getAbsolutePath(): ""), alreadyLoaded.file != null ? String.format("The already loaded file %1$s contains a configuration with the same name", alreadyLoaded.file.getAbsolutePath()) : "")); } loadedEntries.put(entry.getName(), entry); activate(entry); }</code><technical_language>alreadyLoaded implies boolean... please rename alreadyLoadedEntry that</technical_language>

Target:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); entry.enabled = EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (entry.enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { entry.enabled = false; log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof CommentAnnotation)) { return false; } final CommentAnnotation other = (CommentAnnotation) obj; if (comment == null) { if (other.comment != null) { return false; } } else if (!comment.equals(other.comment)) { IUser author = comment.getAuthor(); <START> IUser otherAuthor = other.comment.getAuthor(); <END> if (author == null) { if (otherAuthor != null) { return false; } } else if (!author.getId().equals(otherAuthor.getId())) { return false; } Date creationDate = comment.getCreationDate(); Date otherCreationDate = other.comment.getCreationDate(); if (creationDate == null) { if (otherCreationDate != null) { return false; } } else if (creationDate.getTime() != otherCreationDate.getTime()) { return false; } String description = comment.getDescription(); String otherDescription = other.comment.getDescription(); if (description == null) { if (otherDescription != null) { return false; } } else if (!description.equals(otherDescription)) { return false; } } if (position == null) { if (other.position != null) { return false; } } else if (!position.equals(other.position)) { return false; } return true; }</code><technical_language>Yeah, consider ObjectUtils.equals line 80. takes care of null cases</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } CommentAnnotation other = (CommentAnnotation) obj; if (position == null) { if (other.position != null) { return false; } } else if (!position.equals(other.position)) { return false; } if (commentEquality == null) { if (other.commentEquality != null) { return false; } } else if (!commentEquality.equals(other.commentEquality)) { return false; } return true; }