auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int hashCode() { return Objects.hash( fieldNames, staticFields, this.keyBufferStaticPrefixLength, <START> this.keyBufferStaticPrefixLength); <END> }</code><technical_language>nit: remove this</technical_language>

Target:
public int hashCode() { return Objects.hash( delimiter, fieldNames, staticFields, keyBufferStaticPrefixLength, fieldNamesStaticPrefixLength); }
Source:
<code>public void initializeDataSource() { ITmfTrace trace = getTrace(); if (trace == null) { return; } if (fRoots.get(trace) != null) { return; } <START> TmfTreeViewerEntry root = new TmfTreeViewerEntry(StringUtils.EMPTY); <END> Iterable<@NonNull CounterAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CounterAnalysis.class); for (CounterAnalysis module : modules) { ITmfTrace moduleTrace = module.getTrace(); if (moduleTrace == null) { return; } TmfTreeViewerEntry rootBranch = new TmfTreeViewerEntry(moduleTrace.getName()); root.getChildren().add(rootBranch); module.schedule(); module.waitForCompletion(); ITmfStateSystem stateSystem = module.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); fRoots.put(trace, root); } } }</code><technical_language>add root fRoots map here, if module (then root children). way, switching trace repeat find modules</technical_language>

Target:
public void initializeDataSource() { ITmfTrace trace = getTrace(); if (trace == null) { return; } if (fRoots.containsKey(trace)) { return; } TmfTreeViewerEntry root = new TmfTreeViewerEntry(StringUtils.EMPTY); Iterable<@NonNull CounterAnalysis> modules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CounterAnalysis.class); for (CounterAnalysis module : modules) { ITmfTrace moduleTrace = module.getTrace(); if (moduleTrace == null) { return; } TmfTreeViewerEntry rootBranch = new TmfTreeViewerEntry(moduleTrace.getName()); root.getChildren().add(rootBranch); module.schedule(); module.waitForCompletion(); ITmfStateSystem stateSystem = module.getStateSystem(); if (stateSystem != null) { addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.GROUPED_COUNTER_ASPECTS_ATTRIB); addTreeViewerBranch(stateSystem, rootBranch, CounterAnalysis.UNGROUPED_COUNTER_ASPECTS_ATTRIB); fRoots.put(trace, root); } } }
Source:
<code>public final void fetchCommits() throws Exception { final Request request = new ApacheRequest( RtRepoCommitsITCase.REQUEST_URL); final Coordinates coordinates = new Coordinates.Simple(RtRepoCommitsITCase.USER, RtRepoCommitsITCase.REPO); <START> final RepoCommits repoCommits = new RtRepoCommits(request, <END> RtRepoCommitsITCase.github().repos().get(coordinates)); final Iterator<Commit> iterator = repoCommits.iterate().iterator(); final List<String> shas = new ArrayList<String>(); shas.add("1aa4af45aa2c56421c3d911a0a06da513a7316a0"); shas.add("940dd5081fada0ead07762933036bf68a005cc40"); shas.add("05940dbeaa6124e4a87d9829fb2fce80b713dcbe"); shas.add(RtRepoCommitsITCase.SHA); shas.add("11bd4d527236f9cb211bc6667df06fde075beded"); int existsCount = 0; while (iterator.hasNext()) { if (shas.contains(iterator.next().sha())) { existsCount += 1; } } MatcherAssert.assertThat( existsCount, Matchers.equalTo(shas.size()) ); }</code><technical_language>get instance of RtRepoCommits Repo, instead of instantiating</technical_language>

Target:
public final void fetchCommits() throws Exception { final Iterator<Commit> iterator = repo().commits().iterate().iterator(); final List<String> shas = new ArrayList<String>(); shas.add("1aa4af45aa2c56421c3d911a0a06da513a7316a0"); shas.add("940dd5081fada0ead07762933036bf68a005cc40"); shas.add("05940dbeaa6124e4a87d9829fb2fce80b713dcbe"); shas.add("51cabb8e759852a6a40a7a2a76ef0afd4beef96d"); shas.add("11bd4d527236f9cb211bc6667df06fde075beded"); int found = 0; while (iterator.hasNext()) { if (shas.contains(iterator.next().sha())) { found += 1; } } MatcherAssert.assertThat( found, Matchers.equalTo(shas.size()) ); }
Source:
<code>public static void assertEqualsDeep(Set<?> actual, Set<?> expected, String message) { if (actual == expected) { return; } if (actual == null || expected == null) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { failNotEquals(actual, expected, message); } } <START> if(expected.size()>actual.size()){ <END> if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { fail(format(actual,expected,message,true)); } } Iterator<?> actualIterator = actual.iterator(); Iterator<?> expectedIterator = expected.iterator(); while (expectedIterator.hasNext()) { Object expectedValue = expectedIterator.next(); Object value = actualIterator.next(); if (expectedValue.getClass().isArray()) { assertArrayEquals(value, expectedValue, message); } else { assertEqualsImpl(value, expectedValue, message); } } }</code><technical_language>I agree. 2 collections equals new test wrong</technical_language>

Target:
public static void assertEqualsDeep(Set<?> actual, Set<?> expected, String message) { if (actual == expected) { return; } if (actual == null || expected == null) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { failNotEquals(actual, expected, message); } } if (expected.size() != actual.size()) { if (message == null) { fail("Sets not equal: expected: " + expected + " and actual: " + actual); } else { fail(format(actual, expected, message, true)); } } Iterator<?> actualIterator = actual.iterator(); Iterator<?> expectedIterator = expected.iterator(); while (expectedIterator.hasNext()) { Object expectedValue = expectedIterator.next(); Object value = actualIterator.next(); if (expectedValue.getClass().isArray()) { assertArrayEquals(value, expectedValue, message); } else { assertEqualsImpl(value, expectedValue, message); } } }
Source:
<code>private void initSearchView(final Context context){ isExpanded = false; LinearLayout searchPlate = (LinearLayout)findViewById(R.id.search_plate); searchPlate.setBackgroundColor(Color.TRANSPARENT); final ImageView searchCloseButton = (ImageView) searchPlate.findViewById(R.id.search_close_btn); searchCloseButton.setImageResource(R.drawable.ic_clear_gray_24dp); <START> EditText editText = ((EditText)findViewById(R.id.search_src_text)); <END> editText.setTextColor(Color.BLACK); setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_SEARCH| EditorInfo.IME_FLAG_NO_FULLSCREEN); setQueryHint(context.getString(R.string.box_browsesdk_search_hint)); this.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mOnBoxSearchListener.onQueryTextSubmit(query); return true; } @Override public boolean onQueryTextChange(String newText) { mOnBoxSearchListener.onQueryTextChange(newText); return true; } }); this.setOnSearchClickListener(new OnClickListener() { @Override public void onClick(View v) { isExpanded = true; mOnBoxSearchListener.onSearchExpanded(); } }); this.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { isExpanded = false; mOnBoxSearchListener.onSearchCollapsed(); return false; } }); }</code><technical_language>Add version checking for kitkat only</technical_language>

Target:
private void initSearchView(final Context context){ isExpanded = false; LinearLayout searchPlate = (LinearLayout)findViewById(R.id.search_plate); searchPlate.setBackgroundColor(Color.TRANSPARENT); final ImageView searchCloseButton = (ImageView) searchPlate.findViewById(R.id.search_close_btn); searchCloseButton.setImageResource(R.drawable.ic_clear_gray_24dp); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { EditText editText = ((EditText) findViewById(R.id.search_src_text)); editText.setTextColor(Color.BLACK); } setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_ACTION_SEARCH| EditorInfo.IME_FLAG_NO_FULLSCREEN); setQueryHint(context.getString(R.string.box_browsesdk_search_hint)); this.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mOnBoxSearchListener.onQueryTextSubmit(query); return true; } @Override public boolean onQueryTextChange(String newText) { mOnBoxSearchListener.onQueryTextChange(newText); return true; } }); this.setOnSearchClickListener(new OnClickListener() { @Override public void onClick(View v) { isExpanded = true; mOnBoxSearchListener.onSearchExpanded(); } }); this.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { isExpanded = false; mOnBoxSearchListener.onSearchCollapsed(); return false; } }); }
Source:
<code>private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("usergroupEdit.jsf")) { <START> return "/pages/users.jsf?id=1&" + redirectParameter; <END> } else { return "/pages/BenutzergruppenAlle?" + redirectParameter; } } catch (NullPointerException e) { return "/pages/BenutzergruppenAlle?" + redirectParameter; } }</code><technical_language>adding a constant id URI</technical_language>

Target:
private String redirectToList() { try { String referrer = FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap() .get("referer"); String callerViewId = referrer.substring(referrer.lastIndexOf("/") + 1); if (!callerViewId.isEmpty() && callerViewId.contains("usergroupEdit.jsf")) { return "/pages/users.jsf?id=" + userForm.getActiveTabIndex() + "&" + REDIRECT_PARAMETER; } else { return "/pages/BenutzergruppenAlle?" + REDIRECT_PARAMETER; } } catch (NullPointerException e) { return "/pages/BenutzergruppenAlle?" + REDIRECT_PARAMETER; } }
Source:
<code>private String getStackTraceAsString(Throwable cause) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); cause.printStackTrace(new PrintStream(byteArrayOutputStream)); String exceptionAsString = byteArrayOutputStream.toString(); <START> return exceptionAsString; <END> }</code><technical_language>OutputStream, Apache Commons Writer: <LINK_0></technical_language>

Target:
private String getStackTraceAsString(Throwable cause) { StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter, true); cause.printStackTrace(printWriter); return stringWriter.getBuffer().toString(); }
Source:
<code>private void changeLocalPlaylistName(long id, String name) { if (localPlaylistManager == null) { return; } Log.d(TAG, "Updating playlist id=[" + id + <START> "] with new name=[" + name + "] items"); <END> localPlaylistManager.renamePlaylist(id, name); final Disposable disposable = localPlaylistManager.renamePlaylist(id, name) .observeOn(AndroidSchedulers.mainThread()) .subscribe(longs -> { }, this::onError); disposables.add(disposable); }</code><technical_language>Please if (DEBUG) importing [here](<LINK_0> logging</technical_language>

Target:
private void changeLocalPlaylistName(long id, String name) { if (localPlaylistManager == null) { return; } if (DEBUG) { Log.d(TAG, "Updating playlist id=[" + id + "] with new name=[" + name + "] items"); } localPlaylistManager.renamePlaylist(id, name); final Disposable disposable = localPlaylistManager.renamePlaylist(id, name) .observeOn(AndroidSchedulers.mainThread()) .subscribe(longs -> { }, this::onError); disposables.add(disposable); }
Source:
<code>private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { ClusterFeatureDao clusterFeatureDao = getClusterFeatureDao(); <START> VdsDynamicDAO vdsDynamicDao = getVdsDynamicDao(); <END> Set<SupportedAdditionalClusterFeature> featuresSupportedByCluster = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> featuresSupportedByVds = vdsDynamicDao.getSupportedHostFeaturesByVdsId(vds.getId()); for (SupportedAdditionalClusterFeature feature : featuresSupportedByCluster) { if (feature.isEnabled() && !featuresSupportedByVds.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("FeaturesSupportedByHost", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.VDS_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }</code><technical_language>please replace 2 injection</technical_language>

Target:
private void checkClusterAdditionalFeaturesSupported(VDSGroup cluster, VDS vds) { Set<SupportedAdditionalClusterFeature> clusterSupportedFeatures = clusterFeatureDao.getSupportedFeaturesByClusterId(cluster.getId()); Set<String> hostSupportedFeatures = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); for (SupportedAdditionalClusterFeature feature : clusterSupportedFeatures) { if (feature.isEnabled() && !hostSupportedFeatures.contains(feature.getFeature().getName())) { Map<String, String> customLogValues = new HashMap<>(); customLogValues.put("FeaturesSupportedByHost", feature.getFeature().getName()); reportNonOperationReason(NonOperationalReason.VDS_FEATURES_INCOMPATIBILE_WITH_CLUSTER, customLogValues); return; } } return; }
Source:
<code>private void reloadConfig() { try { FileReader fr = new FileReader(configFile); Map<String, Object> newYamlConfig = (Map<String, Object>)new Yaml().load(fr); config = loadConfig(newYamlConfig); } catch (Exception e) { <START> LOGGER.severe("Configuration reload failed: " + e.toString()); <END> return; } }</code><technical_language>a increment a metric here</technical_language>

Target:
private void reloadConfig() { try { FileReader fr = new FileReader(configFile); try { Map<String, Object> newYamlConfig = (Map<String, Object>)new Yaml().load(fr); config = loadConfig(newYamlConfig); config.lastUpdate = configFile.lastModified(); configReloadSuccess.inc(); } catch (Exception e) { LOGGER.severe("Configuration reload failed: " + e.toString()); configReloadFailure.inc(); } finally { fr.close(); } } catch (IOException e) { LOGGER.severe("Configuration reload failed: " + e.toString()); configReloadFailure.inc(); } }
Source:
<code>private void maybeDelete(DocumentReference documentReference) { Boolean skipRecycleBin = this.getRequest().getProperty(SKIP_RECYCLE_BIN_PROPERTY); <START> boolean toRecycleBin = !this.configuration.canSkipRecycleBin() <END> || !this.documentAccessBridge.isAdvancedUser() || !ObjectUtils.defaultIfNull(skipRecycleBin, false); EntitySelection entitySelection = this.concernedEntities.get(documentReference); if (entitySelection != null && !entitySelection.isSelected()) { this.logger.info("Skipping because it has been unselected.", documentReference); } else if (!this.modelBridge.exists(documentReference)) { this.logger.warn("Skipping because it doesn't exist.", documentReference); } else if (!hasAccess(Right.DELETE, documentReference)) { this.logger.error("You are not allowed to delete [{}].", documentReference); } else if (toRecycleBin) { this.modelBridge.delete(documentReference); this.logger.debug("[{}] has been successfully moved to the recycle bin.", documentReference); } else { this.modelBridge.delete(documentReference, false); this.logger.debug("[{}] has been successfully removed.", documentReference); } }</code><technical_language>error prone mix "skipRecycleBin" "toRecycleBin" IMO</technical_language>

Target:
private void maybeDelete(DocumentReference documentReference) { Boolean skipRecycleBinProperty = this.getRequest().getProperty(SKIP_RECYCLE_BIN_PROPERTY); boolean skipRecycleBin = this.configuration.canSkipRecycleBin() && this.documentAccessBridge.isAdvancedUser() && ObjectUtils.defaultIfNull(skipRecycleBinProperty, false); EntitySelection entitySelection = this.concernedEntities.get(documentReference); if (entitySelection != null && !entitySelection.isSelected()) { this.logger.info("Skipping because it has been unselected.", documentReference); } else if (!this.modelBridge.exists(documentReference)) { this.logger.warn("Skipping because it doesn't exist.", documentReference); } else if (!hasAccess(Right.DELETE, documentReference)) { this.logger.error("You are not allowed to delete [{}].", documentReference); } else if (!skipRecycleBin) { this.modelBridge.delete(documentReference); this.logger.debug("[{}] has been successfully moved to the recycle bin.", documentReference); } else { this.modelBridge.delete(documentReference, true); this.logger.debug("[{}] has been successfully removed.", documentReference); } }
Source:
<code>public int start() throws Throwable { bossGroup = new NioEventLoopGroup( 1 ); workerGroup = new NioEventLoopGroup(); ServerBootstrap server = new ServerBootstrap(); server.group( bossGroup, workerGroup ).channel( NioServerSocketChannel.class ) .childHandler( new ChannelInitializer<SocketChannel>() { @Override public void initChannel( SocketChannel ch ) throws Exception { ChannelPipeline p = ch.pipeline(); <START> p.addLast( new ByteToMessageDecoder() <END> { @Override protected void decode( ChannelHandlerContext ctx, ByteBuf in, List<Object> list ) throws Exception { if ( in.readableBytes() < 5 ) { return; } checkClientSocketStatus( in ); ctx.close(); } @Override public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) { cause.printStackTrace(); ctx.close(); } } ); } } ); serverChannel = server.bind( 0 ).sync().channel(); return ((InetSocketAddress) serverChannel.localAddress()).getPort(); }</code><technical_language>ReplayingDecoder care reading 5 bytes</technical_language>

Target:
public int start() throws Throwable { workerGroup = new NioEventLoopGroup(); ServerBootstrap server = new ServerBootstrap(); server.group( workerGroup ).channel( NioServerSocketChannel.class ) .childHandler( new ChannelInitializer<SocketChannel>() { @Override public void initChannel( SocketChannel ch ) throws Exception { ChannelPipeline p = ch.pipeline(); p.addLast( new ByteToMessageDecoder() { @Override protected void decode( ChannelHandlerContext ctx, ByteBuf in, List<Object> list ) throws Exception { if ( in.readableBytes() < 5 ) { return; } checkClientSocketStatus( in ); ctx.pipeline().remove( this ); ctx.close(); } @Override public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) { cause.printStackTrace(); ctx.close(); } } ); } } ); serverChannel = server.bind( 0 ).sync().channel(); return ((InetSocketAddress) serverChannel.localAddress()).getPort(); }
Source:
<code>private void writeCombinedReportDocuments(Map<String, List<Report.Test>> testsByName) { for (List<String> combined : testReportConfig.combinedTests) { List<TestAggregations> testAggregations = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for (String testName : combined) { if (sb.length() != 0) sb.append('_'); sb.append(testName); List<Report.Test> reportedTests = testsByName.get(testName); if (reportedTests == null) { log.warn("Test " + testName + " was not found!"); continue; } TestAggregations ta = new TestAggregations(testName, reportedTests); testAggregations.add(ta); } if (testAggregations.isEmpty()) { log.warn("No tests to combine"); return; } CombinedReportDocument testReport = new CombinedReportDocument(testAggregations, sb.toString(), combined, targetDir, testReportConfig); freemarker.template.Configuration cfg = initConfig(); try { testReport.createReportDirectory(); testReport.calculateClusterSizes(); testReport.createTestCharts(); Template reportTemplate = cfg.getTemplate("testReport.ftl"); PrintWriter printWriter = new PrintWriter(targetDir + File.separator + "test_" + testReport.testName + ".html"); Map root = new HashMap(); root.put("testReport", testReport); root.put("enums", DefaultObjectWrapper.getDefaultInstance().getEnumModels()); reportTemplate.process(root, printWriter); <START> printWriter.close(); <END> } catch (Exception e) { log.error("Templating exception", e); } } }</code><technical_language>story, try-with-resources</technical_language>

Target:
private void writeCombinedReportDocuments(Map<String, List<Report.Test>> testsByName) { for (List<String> combined : testReportConfig.combinedTests) { List<TestAggregations> testAggregations = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for (String testName : combined) { if (sb.length() != 0) sb.append('_'); sb.append(testName); List<Report.Test> reportedTests = testsByName.get(testName); if (reportedTests == null) { log.warn("Test " + testName + " was not found!"); continue; } TestAggregations ta = new TestAggregations(testName, reportedTests); testAggregations.add(ta); } if (testAggregations.isEmpty()) { log.warn("No tests to combine"); return; } CombinedReportDocument testReport = new CombinedReportDocument(testAggregations, sb.toString(), combined, targetDir, testReportConfig); testReport.createReportDirectory(); testReport.calculateClusterSizes(); testReport.createTestCharts(); Map root = new HashMap(); root.put("testReport", testReport); root.put("enums", DefaultObjectWrapper.getDefaultInstance().getEnumModels()); processTemplate(root, targetDir, "test_" + testReport.testName + ".html", "testReport.ftl"); } }
Source:
<code>private I18n(InputStream stream, String fallbackId) { this.keys = new HashMap<String, String>(); if (stream == null) return; try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) <START> if (!line.isEmpty() && line.charAt(0) != 35) { <END> String[] values = line.split("=", 2); this.keys.put(values[0], values[1]); } } catch (IOException e) { Log.warn("Could not load all translation keys", e); } if (!keys.containsKey("language.name")) keys.put("language.name", fallbackId); }</code><technical_language>character literal '#' instead of 35</technical_language>

Target:
private I18n(InputStream stream, String fallbackId) { this.keys = new HashMap<String, String>(); if (stream == null) return; try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { if (!line.isEmpty() && line.charAt(0) != '#') { String[] values = line.split("=", 2); this.keys.put(values[0], values[1]); } } } catch (IOException e) { Log.warn("Could not load all translation keys", e); } if (!keys.containsKey("language.name")) keys.put("language.name", fallbackId.toLowerCase(Locale.ENGLISH)); }
Source:
<code>public Observable<List<GitHubRepository>> getRepositories() { <START> return repositories; <END> }</code><technical_language>hide()</technical_language>

Target:
public Observable<List<GitHubRepository>> getRepositories() { return repositories.hide(); }
Source:
<code>public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) { <START> throw new WrongAttributeValueException(attribute); <END> } if (!perunSession.getPerunBl().getModulesUtilsBl().isFQDNValid(perunSession, (String) attribute.getValue())) { throw new WrongAttributeValueException(attribute, "Bad replicaDestination attribute format " + attribute.getValue() + ". It should be" + "fully qualified domain name."); } }</code><technical_language>Please add some message. clear for user this attribute empty. add attribute holder exception - enables user attribute for object failed execute operation works multiple attributes</technical_language>

Target:
public void checkAttributeValue(PerunSessionImpl perunSession, Resource resource, Attribute attribute) throws WrongAttributeValueException { if(attribute.getValue() == null) { throw new WrongAttributeValueException(attribute, resource, "This attribute can't be empty"); } if (!perunSession.getPerunBl().getModulesUtilsBl().isFQDNValid(perunSession, (String) attribute.getValue())) { throw new WrongAttributeValueException(attribute, resource, "Bad replicaDestination attribute format " + attribute.getValue() + ". It should be" + "fully qualified domain name."); } }
Source:
<code>public void retrieveSubjectToken_noRegion_expectThrows() { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); IOException response = new IOException(); transportFactory.transport.addResponseErrorSequence(response); final AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); IOException e = assertThrows( IOException.class, new ThrowingRunnable() { @Override public void run() throws Throwable { awsCredential.retrieveSubjectToken(); } }); <START> assertThat(e.getMessage()).isEqualTo("Failed to retrieve AWS region."); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void retrieveSubjectToken_noRegion_expectThrows() { MockExternalAccountCredentialsTransportFactory transportFactory = new MockExternalAccountCredentialsTransportFactory(); IOException response = new IOException(); transportFactory.transport.addResponseErrorSequence(response); final AwsCredentials awsCredential = (AwsCredentials) AwsCredentials.newBuilder(AWS_CREDENTIAL) .setHttpTransportFactory(transportFactory) .setCredentialSource(buildAwsCredentialSource(transportFactory)) .build(); IOException e = assertThrows( IOException.class, new ThrowingRunnable() { @Override public void run() throws Throwable { awsCredential.retrieveSubjectToken(); } }); assertEquals("Failed to retrieve AWS region.", e.getMessage()); }
Source:
<code>public Map<String, String> getLabelsMap() { Set<LabelAtom> labelSet = getLabelSet(); ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder(); if (!labelSet.isEmpty()) { for (LabelAtom label : labelSet) { <START> builder.put("buildlabel",label == null ? DEFAULT_ID : "jenkins_" + label.getName()); <END> } } return builder.build(); }</code><technical_language>jenkins/label a key</technical_language>

Target:
public Map<String, String> getLabelsMap() { Set<LabelAtom> labelSet = getLabelSet(); ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String> builder(); if (!labelSet.isEmpty()) { for (LabelAtom label : labelSet) { builder.put("jenkins/label",label == null ? DEFAULT_ID : label.getName()); } } return builder.build(); }
Source:
<code>public List<String> getTableNames(String keySpace) { <START> return cluster.getMetadata().getKeyspace(keySpace).getTables().stream().map(TableMetadata::getName).collect(toList()); <END> }</code><technical_language>nit: add newlines this is more readable</technical_language>

Target:
public List<String> getTableNames(String keySpace) { Metadata clusterMetadata = cluster.getMetadata(); KeyspaceMetadata keyspaceMetadata = clusterMetadata.getKeyspace(keySpace); return keyspaceMetadata.getTables().stream() .map(TableMetadata::getName) .collect(toList()); }
Source:
<code>private void refreshUI() { <START> updateController.filterSortCountRefresh(getAllUIFilters()); <END> }</code><technical_language>Hmm, I need change this method name -- count is kind of a filter. growing add more features</technical_language>

Target:
private void refreshUI() { updateController.filterSortRefresh(getAllUIFilters()); }
Source:
<code>public void testGetTriggerTask() throws Exception { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertNotNull(caseId); assertTrue(caseId.startsWith(CASE_HR_ID_PREFIX)); List<TaskSummary> caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_YODA, 0, 10); assertNotNull(caseTasks); assertEquals(1, caseTasks.size()); TaskSummary task = caseTasks.get(0); assertNotNull(task); assertEquals(HELLO_1_TASK, task.getName()); assertEquals(USER_YODA, task.getActualOwner()); caseClient.triggerAdHocFragment(CONTAINER_ID, caseId, HELLO_2_TASK, Collections.EMPTY_MAP); changeUser(USER_JOHN); caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_JOHN, 0, 10); assertNotNull(caseTasks); <START> assertEquals(1, caseTasks.size()); <END> task = caseTasks.get(0); assertNotNull(task); assertEquals(HELLO_2_TASK, task.getName()); assertEquals(USER_JOHN, task.getActualOwner()); changeUser(USER_YODA); caseClient.destroyCaseInstance(CONTAINER_ID, caseId); }</code><technical_language>I check this task is is triggered</technical_language>

Target:
public void testGetTriggerTask() throws Exception { String caseId = startUserTaskCase(USER_YODA, USER_JOHN); assertNotNull(caseId); assertTrue(caseId.startsWith(CASE_HR_ID_PREFIX)); changeUser(USER_JOHN); List<TaskSummary> caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_JOHN, 0, 10); assertNotNull(caseTasks); assertEquals(0, caseTasks.size()); changeUser(USER_YODA); caseClient.triggerAdHocFragment(CONTAINER_ID, caseId, HELLO_2_TASK, Collections.EMPTY_MAP); changeUser(USER_JOHN); caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_JOHN, 0, 10); assertNotNull(caseTasks); assertEquals(1, caseTasks.size()); TaskSummary task = caseTasks.get(0); assertNotNull(task); assertEquals(HELLO_2_TASK, task.getName()); assertEquals(USER_JOHN, task.getActualOwner()); changeUser(USER_YODA); caseTasks = caseClient.findCaseTasksAssignedAsPotentialOwner(caseId, USER_YODA, 0, 10); assertNotNull(caseTasks); assertEquals(1, caseTasks.size()); task = caseTasks.get(0); assertNotNull(task); assertEquals(HELLO_1_TASK, task.getName()); assertEquals(USER_YODA, task.getActualOwner()); caseClient.destroyCaseInstance(CONTAINER_ID, caseId); }
Source:
<code>public AnnotationMirror greatestLowerBound( final AnnotationMirror a1, final AnnotationMirror a2) { if (AnnotationUtils.areSame(a1, BOTTOM) || AnnotationUtils.areSame(a2, BOTTOM)) { return BOTTOM; } <START> if (!AnnotationUtils.hasElementValue(a1, "value")) { <END> return a2; } if (!AnnotationUtils.hasElementValue(a2, "value")) { return a1; } if (isAccumulatorAnnotation(a1) && isAccumulatorAnnotation(a2)) { Set<String> a1Val = new LinkedHashSet<>( ValueCheckerUtils.getValueOfAnnotationWithStringArgument(a1)); Set<String> a2Val = new LinkedHashSet<>( ValueCheckerUtils.getValueOfAnnotationWithStringArgument(a2)); a1Val.addAll(a2Val); return createAccumulatorAnnotation(a1Val.toArray(new String[0])); } else { return BOTTOM; } }</code><technical_language>This is assumes TOP field, field. subtle. this (and other) code easier read, please create a method isTop it</technical_language>

Target:
public AnnotationMirror greatestLowerBound( final AnnotationMirror a1, final AnnotationMirror a2) { if (AnnotationUtils.areSame(a1, bottom) || AnnotationUtils.areSame(a2, bottom)) { return bottom; } List<String> a1Val = getAccumulatedValues(a1); List<String> a2Val = getAccumulatedValues(a2); if (a1Val.containsAll(a2Val)) { return a1; } if (a2Val.containsAll(a1Val)) { return a2; } a1Val.addAll(a2Val); return createAccumulatorAnnotation(a1Val); }
Source:
<code>public FeedbackResponseAttributes(String feedbackSessionName, String courseId, String feedbackQuestionId, FeedbackQuestionType feedbackQuestionType, String giverEmail, String giverSection, String recipientEmail, String recipientSection, Text responseMetaData) { this.feedbackSessionName = Sanitizer.sanitizeTitle(feedbackSessionName); this.courseId = Sanitizer.sanitizeTitle(courseId); this.feedbackQuestionId = feedbackQuestionId; this.feedbackQuestionType = feedbackQuestionType; this.giverEmail = Sanitizer.sanitizeEmail(giverEmail); this.giverSection = giverSection; this.recipientEmail = recipientEmail; this.recipientSection = recipientSection; this.responseMetaData = responseMetaData; this.createdAt = new Date(); <START> this.updatedAt = new Date(); <END> }</code><technical_language>Is a need set date here</technical_language>

Target:
public FeedbackResponseAttributes(String feedbackSessionName, String courseId, String feedbackQuestionId, FeedbackQuestionType feedbackQuestionType, String giverEmail, String giverSection, String recipientEmail, String recipientSection, Text responseMetaData) { this.feedbackSessionName = Sanitizer.sanitizeTitle(feedbackSessionName); this.courseId = Sanitizer.sanitizeTitle(courseId); this.feedbackQuestionId = feedbackQuestionId; this.feedbackQuestionType = feedbackQuestionType; this.giverEmail = Sanitizer.sanitizeEmail(giverEmail); this.giverSection = giverSection; this.recipientEmail = recipientEmail; this.recipientSection = recipientSection; this.responseMetaData = responseMetaData; }
Source:
<code>public void apply(final Task task, final String action, final ActionRequest request, final ActionListener listener, final ActionFilterChain chain) { chain.proceed(task, action, request, new ActionListener<ActionResponse>() { @SuppressWarnings("unchecked") @Override public void onResponse(ActionResponse response) { <START> if(INDICES_FIELD_STATS_READ_ACTION.equals(action) && response instanceof FieldStatsResponse) { <END> if(((FieldStatsResponse)response).getIndicesMergedFieldStats().size() == 0) { LOGGER.trace("Modifying the response to be {}", RestStatus.NOT_FOUND); Throwable err = new ElasticsearchException("The index is empty. This could mean data has not yet been collected.\n" + "You can use the Time Picker to change the time filter or select a higher time interval", RestStatus.NO_CONTENT); listener.onFailure(err); } } listener.onResponse(response); } @Override public void onFailure(Throwable e) { LOGGER.trace("Evaluating failure for action '{}' to see if we need to change from a 403", action); Throwable err = e; if( INDICES_FIELD_STATS_READ_ACTION.equals(action) && request instanceof FieldStatsRequest) { for (String index : ((FieldStatsRequest)request).indices()) { if(!client.indexExists(index)) { LOGGER.trace("Modifying the response to be {}", RestStatus.NOT_FOUND); err = new ElasticsearchException("The index '" + index + "' was not found. This could mean data has not yet been collected.", RestStatus.NOT_FOUND); break; } } } listener.onFailure(err); } }); }</code><technical_language>is a refactoring opportunity this onFailure checking</technical_language>

Target:
public void apply(final Task task, final String action, final ActionRequest request, final ActionListener listener, final ActionFilterChain chain) { chain.proceed(task, action, request, new ActionListener<ActionResponse>() { @SuppressWarnings("unchecked") @Override public void onResponse(ActionResponse response) { if(INDICES_FIELD_STATS_READ_ACTION.equals(action) && response instanceof FieldStatsResponse) { if(((FieldStatsResponse)response).getIndicesMergedFieldStats().isEmpty()) { LOGGER.trace("Modifying the response to be {}", RestStatus.NO_CONTENT); Throwable err = new ElasticsearchException("The index returned an empty result. " + "You can use the Time Picker to change the time filter or select a higher time interval", RestStatus.NO_CONTENT); listener.onFailure(err); return; } } listener.onResponse(response); } @Override public void onFailure(Throwable e) { LOGGER.trace("Evaluating failure for action '{}' to see if we need to change from a 403", action); Throwable err = e; if( INDICES_FIELD_STATS_READ_ACTION.equals(action) && request instanceof FieldStatsRequest) { for (String index : ((FieldStatsRequest)request).indices()) { if(!client.indexExists(index)) { LOGGER.trace("Modifying the response to be {}", RestStatus.NOT_FOUND); err = new ElasticsearchException("The index '" + index + "' was not found. This could mean data has not yet been collected.", RestStatus.NOT_FOUND); break; } } } listener.onFailure(err); } }); }
Source:
<code>static int startIndex(String ref) { if (ref == null || !ref.startsWith(REFS_CHANGES)) { return -1; } int ls = REFS_CHANGES.length(); int le = nextNonDigit(ref, ls); if (le - ls != 2 || le >= ref.length() || ref.charAt(le) != '/') { return -1; } int cs = le + 1; if (cs >= ref.length() || ref.charAt(cs) == '0') { return -1; } int ce = nextNonDigit(ref, cs); if (ce >= <START> ref.length() || ref.charAt(le) != '/') { <END> return -1; } switch (ce - cs) { case 0: return -1; case 1: if (ref.charAt(ls) != '0' || ref.charAt(ls + 1) != ref.charAt(cs)) { return -1; } break; default: if (ref.charAt(ls) != ref.charAt(ce - 2) || ref.charAt(ls + 1) != ref.charAt(ce - 1)) { return -1; } break; } return cs; }</code><technical_language>This part copied/pasted previous check line 154 is needed of le changed then</technical_language>

Target:
static int startIndex(String ref) { if (ref == null || !ref.startsWith(REFS_CHANGES)) { return -1; } int ls = REFS_CHANGES.length(); int le = nextNonDigit(ref, ls); if (le - ls != 2 || le >= ref.length() || ref.charAt(le) != '/') { return -1; } int cs = le + 1; if (cs >= ref.length() || ref.charAt(cs) == '0') { return -1; } int ce = nextNonDigit(ref, cs); if (ce >= ref.length() || ref.charAt(ce) != '/') { return -1; } switch (ce - cs) { case 0: return -1; case 1: if (ref.charAt(ls) != '0' || ref.charAt(ls + 1) != ref.charAt(cs)) { return -1; } break; default: if (ref.charAt(ls) != ref.charAt(ce - 2) || ref.charAt(ls + 1) != ref.charAt(ce - 1)) { return -1; } break; } return cs; }
Source:
<code>private void bindGpioPin(MCP23017BindingProvider provider, String itemName) { try { int address = provider.getBusAddress(itemName); MCP23017GpioProvider mcp = mcpProviders.get(address); if(mcp == null) { try { mcp = new MCP23017GpioProvider(I2CBus.BUS_1, address); mcp.setPollingTime(pollingInterval); } catch (UnsupportedBusNumberException ex) { throw new IllegalArgumentException("Tried to access not available I2C bus"); } mcpProviders.put(address, mcp); } Pin pin = provider.getPin(itemName); PinMode mode = provider.getPinMode(itemName); if (mode.equals(PinMode.DIGITAL_OUTPUT)) { GpioPinDigitalOutput output = gpio.provisionDigitalOutputPin(mcp, pin, itemName, provider.getDefaultState(itemName)); gpioPins.put(itemName, output); <START> logger.debug("Provisioned Digital Output for " + itemName); <END> } else if (mode.equals(PinMode.DIGITAL_INPUT)) { GpioPinDigitalInput input = gpio.provisionDigitalInputPin(mcp, pin, itemName, PinPullResistance.OFF); input.setDebounce(20); input.addListener(this); gpioPins.put(itemName, input); logger.debug("Provisioned Digital Input for " + itemName); } else { throw new IllegalArgumentException("Invalid Pin Mode in config " + mode.name()); } } catch (IOException e) { logger.error("IO ERROR " + e.getMessage()); } }</code><technical_language>parameterized logging instead of string concatenation</technical_language>

Target:
private void bindGpioPin(MCP23017BindingProvider provider, String itemName) { try { int address = provider.getBusAddress(itemName); MCP23017GpioProvider mcp = mcpProviders.get(address); if (mcp == null) { try { mcp = new MCP23017GpioProvider(I2CBus.BUS_1, address); mcp.setPollingTime(pollingInterval); } catch (UnsupportedBusNumberException ex) { throw new IllegalArgumentException("Tried to access not available I2C bus"); } mcpProviders.put(address, mcp); } Pin pin = provider.getPin(itemName); PinMode mode = provider.getPinMode(itemName); if (mode.equals(PinMode.DIGITAL_OUTPUT)) { GpioPinDigitalOutput output = gpio.provisionDigitalOutputPin(mcp, pin, itemName, provider.getDefaultState(itemName)); gpioPins.put(itemName, output); logger.debug("Provisioned digital output for {}", itemName); } else if (mode.equals(PinMode.DIGITAL_INPUT)) { GpioPinDigitalInput input = gpio.provisionDigitalInputPin(mcp, pin, itemName, PinPullResistance.OFF); input.setDebounce(20); input.addListener(this); gpioPins.put(itemName, input); logger.debug("Provisioned digital input for {}", itemName); } else { throw new IllegalArgumentException("Invalid Pin Mode in config " + mode.name()); } } catch (IOException exception) { logger.error("I/O error {}", exception.getMessage()); } }
Source:
<code>private Anchor createConfigureMenuItem(String title, String id) { Anchor itemAnchor; <START> itemAnchor = configureLink; <END> Span titleSpan = new Span(); titleSpan.addStyleName(PatternflyStyles.LIST_GROUP_ITEM_VALUE); titleSpan.setText(title); itemAnchor.add(titleSpan); itemAnchor.setId(id); itemAnchor.addClickHandler(e -> { e.preventDefault(); }); return itemAnchor; }</code><technical_language>line</technical_language>

Target:
private Anchor createConfigureMenuItem(String title, String id) { Anchor itemAnchor = configureLink; Span titleSpan = new Span(); titleSpan.addStyleName(PatternflyStyles.LIST_GROUP_ITEM_VALUE); titleSpan.setText(title); itemAnchor.add(titleSpan); itemAnchor.setId(id); itemAnchor.addClickHandler(e -> { e.preventDefault(); }); return itemAnchor; }
Source:
<code>public String toString() { StringBuilder result = new StringBuilder(); <START> if (!getLang().equals("und") && getLang() != null) { <END> result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); result.append(", Bitrate: ").append(getBitRate()); if (getBitsperSample() != 16) { result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); } if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }</code><technical_language>@Sami32 move null check first, get NPE: java if (getLang() != null && !getLang().equals("und")) { checked in order..</technical_language>

Target:
public String toString() { StringBuilder result = new StringBuilder(); if (getLang() != null && !getLang().equals("und")) { result.append("Id: ").append(getId()); result.append(", Language Code: ").append(getLang()); } if (isNotBlank(getAudioTrackTitleFromMetadata())) { if (result.length() > 0) { result.append(", "); } result.append("Audio Track Title From Metadata: ").append(getAudioTrackTitleFromMetadata()); } if (result.length() > 0) { result.append(", "); } result.append("Audio Codec: ").append(getAudioCodec()); result.append(", Bitrate: ").append(getBitRate()); if (getBitsperSample() != 16) { result.append(", Bits per Sample: ").append(getBitsperSample()); } if (getAudioProperties() != null) { result.append(", ").append(getAudioProperties()); } if (isNotBlank(getArtist())) { result.append(", Artist: ").append(getArtist()); } if (isNotBlank(getAlbum())) { result.append(", Album: ").append(getAlbum()); } if (isNotBlank(getSongname())) { result.append(", Track Name: ").append(getSongname()); } if (getYear() != 0) { result.append(", Year: ").append(getYear()); } if (getTrack() != 0) { result.append(", Track: ").append(getTrack()); } if (isNotBlank(getGenre())) { result.append(", Genre: ").append(getGenre()); } if (isNotBlank(getMuxingModeAudio())) { result.append(", Muxing Mode: ").append(getMuxingModeAudio()); } return result.toString(); }
Source:
<code>private void writeHttpResponse(HttpServletResponse response, Map<String, Object> outputMessage) throws IOException { <START> response.setContentType("org/apache/tajo/storage/text/html"); <END> OutputStream out = response.getOutputStream(); out.write(om.writeValueAsBytes(outputMessage)); out.flush(); out.close(); }</code><technical_language>intend change it</technical_language>

Target:
private void writeHttpResponse(HttpServletResponse response, Map<String, Object> outputMessage) throws IOException { response.setContentType("text/html"); OutputStream out = response.getOutputStream(); out.write(om.writeValueAsBytes(outputMessage)); out.flush(); out.close(); }
Source:
<code><START> public Map<String, String> getSmallRowRangeColumn2(RangeRequest rangeRequest) { <END> ColumnSelection colSelection = ColumnSelection.create(ImmutableList.of(PtBytes.toCachedBytes("d"))); rangeRequest = rangeRequest.getBuilder().retainColumns(colSelection).build(); Preconditions.checkArgument(rangeRequest.getColumnNames().size() <= 1, "Must not request columns other than Column2."); Map<String, String> resultsMap = new LinkedHashMap<>(); BatchingVisitableView.of(t.getRange(tableRef, rangeRequest)) .immutableCopy().forEach(entry -> { SchemaApiTestTable.SchemaApiTestRowResult resultEntry = SchemaApiTestTable.SchemaApiTestRowResult.of(entry); resultsMap.put(resultEntry.getRowName().getComponent1(), resultEntry.getColumn2()); }); return resultsMap; }</code><technical_language>is row component here, nice a method getSmallRangeColumn2(String component1StartIndlusive, String component1EndExclusive, int limit) (which call one)</technical_language>

Target:
public LinkedHashMap<String, String> getSmallRowRangeColumn2(RangeRequest rangeRequest) { ColumnSelection colSelection = ColumnSelection.create(ImmutableList.of(PtBytes.toCachedBytes("d"))); rangeRequest = rangeRequest.getBuilder().retainColumns(colSelection).build(); Preconditions.checkArgument(rangeRequest.getColumnNames().size() <= 1, "Must not request columns other than Column2."); LinkedHashMap<String, String> resultsMap = new LinkedHashMap<>(); BatchingVisitableView.of(t.getRange(tableRef, rangeRequest)) .immutableCopy().forEach(entry -> { SchemaApiTestTable.SchemaApiTestRowResult resultEntry = SchemaApiTestTable.SchemaApiTestRowResult.of(entry); resultsMap.put(resultEntry.getRowName().getComponent1(), resultEntry.getColumn2()); }); return resultsMap; }
Source:
<code>private static Optional<JsonObject> readJson(String path) { final Optional<JsonElement> e = read(path).map(bytes -> parser.parse(new String(bytes, StandardCharsets.UTF_8))); <START> return e.isPresent() && !e.get().isJsonNull() ? e.map(o -> o.getAsJsonObject()) : Optional.empty(); <END> }</code><technical_language>replaced e.filter(o -> !o.isJsonNull()).map(JsonElement::getAsJsonObject)</technical_language>

Target:
private static Optional<JsonObject> readJson(String path) { final Optional<JsonElement> e = read(path).map(bytes -> parser.parse(new String(bytes, StandardCharsets.UTF_8))); return e.filter(o -> !o.isJsonNull()).map(JsonElement::getAsJsonObject); }
Source:
<code>public CommentBodyWrapperEditor(Composite parent, int style) { if <START> (Platform.getPreferencesService().getBoolean("org.eclipse.papyrus.infra.ui", <END> RichtextPreferencePage.USE_CK_EDITOR, false, null)) { richTextEditor = new CommentBodyRichTextEditor(parent, style); normalEditor = null; } else { normalEditor = new CommentBodyEditor(parent, style); richTextEditor = null; } if (richTextEditor == null && normalEditor == null) { normalEditor = new CommentBodyEditor(parent, style); } }</code><technical_language>Activator.getPLuginID else ? (NON-NLS</technical_language>

Target:
public CommentBodyWrapperEditor(Composite parent, int style) { if (Platform.getPreferencesService().getBoolean(Activator.PLUGIN_ID, RichtextPreferencePage.USE_CK_EDITOR, false, null)) { richTextEditor = new CommentBodyRichTextEditor(parent, style); normalEditor = null; } else { normalEditor = new CommentBodyEditor(parent, style); richTextEditor = null; } if (richTextEditor == null && normalEditor == null) { normalEditor = new CommentBodyEditor(parent, style); } }
Source:
<code>protected void setStudy(Study study, HttpSession session) { String boardUrl = study.getBoardUrl(); if (boardUrl == null) { String accessToken = (String) session.getAttribute("accessToken"); if (accessToken != null) { try { boardUrl = getStudyBuildService().getCurrentBoardUrl(accessToken, study); study.setBoardUrl(boardUrl); try { getStudyDao().update(study); } <START> catch (StaleStateException e) { <END> } } catch (Exception e) { logger.error(e.getMessage(), e); } } } session.setAttribute("study", study); }</code><technical_language>need understand this exception is thrown. is a good idea catch this exception ignore</technical_language>

Target:
protected void setStudy(Study study, HttpSession session) { getCurrentBoardUrl(study, session); session.setAttribute("study", study); }