auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean isDebugViewActive(DebugContextEvent event) { if (isDisposed()) { return false; } IWorkbenchPage activePage = fWindow.getActivePage(); if (activePage != null) { IWorkbenchPart part = event.getDebugContextProvider().getPart(); if (part != null) { <START> return activePage.findView(part.getSite().getId()) != null; <END> } return activePage.findView(IDebugUIConstants.ID_DEBUG_VIEW) != null; } return false; }</code><technical_language>this return null, while debug view is active? situation me. If of views (default debug vs. custom debug view) is visible, do stuff</technical_language>

Target:
private boolean isDebugViewActive(DebugContextEvent event) { if (isDisposed()) { return false; } IWorkbenchPage activePage = fWindow.getActivePage(); if (activePage != null) { IViewPart debugView = null; IWorkbenchPart part = event.getDebugContextProvider().getPart(); if (part != null) { debugView = activePage.findView(part.getSite().getId()); } if (debugView == null) { debugView = activePage.findView(IDebugUIConstants.ID_DEBUG_VIEW); } return debugView != null; } return false; }
Source:
<code>public BaseTestClass() { prism = new PrismHelper(MERLIN_PROPERTIES, PRISM_PREFIX); servers = getServers(); serverFS = new ArrayList<FileSystem>(); serverOC = new ArrayList<OozieClient>(); for (ColoHelper server : servers) { try { serverFS.add(server.getClusterHelper().getHadoopFS()); } catch (IOException e) { e.printStackTrace(); System.exit(0); } serverOC.add(server.getClusterHelper().getOozieClient()); <START> try { <END> HadoopUtil.createDir(baseHDFSDir, serverFS.get(serverFS.size() - 1)); } catch (IOException e) { e.printStackTrace(); System.exit(0); } } }</code><technical_language>try catch loop, is need for 2</technical_language>

Target:
public BaseTestClass() { prism = new PrismHelper(MERLIN_PROPERTIES, PRISM_PREFIX); servers = getServers(); serverFS = new ArrayList<FileSystem>(); serverOC = new ArrayList<OozieClient>(); for (ColoHelper server : servers) { try { serverFS.add(server.getClusterHelper().getHadoopFS()); serverOC.add(server.getClusterHelper().getOozieClient()); HadoopUtil.createDir(baseHDFSDir, serverFS.get(serverFS.size ()-1)); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } }
Source:
<code>public boolean hideDisplayNameInVanish() { <START> return config.getBoolean("hide-displayname-in-vanish", true); <END> }</code><technical_language>This check a default of false, configs this option behaviour change unexpectedly. New configs this option set true in config.yml, is fine</technical_language>

Target:
public boolean hideDisplayNameInVanish() { return config.getBoolean("hide-displayname-in-vanish", false); }
Source:
<code>public void tableCellSelected(String columnId, int rowIndex) { DataSet ds = processesTable.getDataSetHandler().getLastDataSet(); String deploymentId = ds.getValueAt(rowIndex, COLUMN_PROCESS_EXTERNAL_ID).toString(); Long processInstanceId = Double.valueOf(ds.getValueAt(rowIndex, COLUMN_PROCESS_INSTANCE_ID).toString()).longValue(); String processDefId = ds.getValueAt(rowIndex, COLUMN_PROCESS_ID).toString(); String processDefName = ds.getValueAt(rowIndex, COLUMN_PROCESS_NAME).toString(); Integer processInstanceStatus = Double.valueOf(ds.getValueAt(rowIndex, COLUMN_PROCESS_STATUS).toString()).intValue(); specManagementService.call((ServerTemplate serverTemplate) -> { <START> if (serverTemplate.getContainerSpec(deploymentId).getStatus().equals(KieContainerStatus.STARTED)) { <END> openProcessDetailsScreen(); setupDetailBreadcrumb(i18n.processDashboardName(), i18n.ProcessInstanceBreadcrumb(processInstanceId), PROCESS_INSTANCE_DETAILS_SCREEN); instanceSelectionEvent.fire(new ProcessInstanceSelectionEvent( deploymentId, processInstanceId, processDefId, processDefName, processInstanceStatus, true, serverTemplateSelectorMenuBuilder.getSelectedServerTemplate())); } else { displayWarningNotification(i18n.processDetailsNotAvailable()); tableRedraw(); } }).getServerTemplate(serverTemplateSelectorMenuBuilder.getSelectedServerTemplate()); }</code><technical_language>containerspec is null in case container removed/deleted? In chase check access container status</technical_language>

Target:
public void tableCellSelected(String columnId, int rowIndex) { DataSet ds = processesTable.getDataSetHandler().getLastDataSet(); String deploymentId = ds.getValueAt(rowIndex, COLUMN_PROCESS_EXTERNAL_ID).toString(); Long processInstanceId = Double.valueOf(ds.getValueAt(rowIndex, COLUMN_PROCESS_INSTANCE_ID).toString()).longValue(); String processDefId = ds.getValueAt(rowIndex, COLUMN_PROCESS_ID).toString(); String processDefName = ds.getValueAt(rowIndex, COLUMN_PROCESS_NAME).toString(); Integer processInstanceStatus = Double.valueOf(ds.getValueAt(rowIndex, COLUMN_PROCESS_STATUS).toString()).intValue(); specManagementService.call((ServerTemplate serverTemplate) -> { if (serverTemplate != null && serverTemplate.getContainerSpec(deploymentId) != null && serverTemplate.getContainerSpec(deploymentId).getStatus().equals(KieContainerStatus.STARTED)) { openProcessDetailsScreen(); setupDetailBreadcrumb(i18n.processDashboardName(), i18n.ProcessInstanceBreadcrumb(processInstanceId), PROCESS_INSTANCE_DETAILS_SCREEN); instanceSelectionEvent.fire(new ProcessInstanceSelectionEvent( deploymentId, processInstanceId, processDefId, processDefName, processInstanceStatus, true, serverTemplateSelectorMenuBuilder.getSelectedServerTemplate())); } else { displayNotification(i18n.processDetailsNotAvailableContainerNotStarted(deploymentId)); tableRedraw(); } }).getServerTemplate(serverTemplateSelectorMenuBuilder.getSelectedServerTemplate()); }
Source:
<code>private void initKBases(final String currentKSession) { final ArrayList<String> kbaseNames = new ArrayList<>(); if (kmodule.getKBases().isEmpty()) { addMockKBaseModel(DEFAULT_KIE_BASE, DEFAULT_KIE_SESSION); kbaseNames.add(DEFAULT_KIE_BASE); } else { for (KBaseModel kBase : kmodule.getKBases().values()) { kbaseNames.add(kBase.getName()); } } Collections.sort(kbaseNames, new Comparator<String>() { @Override public int compare(final String first, final String other) { return first.compareToIgnoreCase(other); } <START> }); <END> if (isNotNullOrEmpty(currentKSession) && !kmoduleContainsCurrentKSession(currentKSession)) { addMockKBaseModel(NON_EXISTING_KBASE, currentKSession); kbaseNames.add(NON_EXISTING_KBASE); view.showWarningSelectedKSessionDoesNotExist(); } view.addKBases(kbaseNames.toArray(new String[kbaseNames.size()])); }</code><technical_language>Minor thing, shortened line: java Collections.sort(kbaseNames, (first, other) -> first.compareToIgnoreCase(other));</technical_language>

Target:
private void initKBases(final String currentKSession) { final ArrayList<String> kbaseNames = new ArrayList<>(); if (kmodule.getKBases().isEmpty()) { addMockKBaseModel(DEFAULT_KIE_BASE, DEFAULT_KIE_SESSION); kbaseNames.add(DEFAULT_KIE_BASE); } else { for (KBaseModel kBase : kmodule.getKBases().values()) { kbaseNames.add(kBase.getName()); } } Collections.sort(kbaseNames, (first, other) -> first.compareToIgnoreCase(other)); if (isNotNullOrEmpty(currentKSession) && !kmoduleContainsCurrentKSession(currentKSession)) { addMockKBaseModel(NON_EXISTING_KBASE, currentKSession); kbaseNames.add(NON_EXISTING_KBASE); view.showWarningSelectedKSessionDoesNotExist(); } view.addKBases(kbaseNames.toArray(new String[kbaseNames.size()])); }
Source:
<code>private final void fillMenu(final MenuManager manager) { manager.removeAll(); final List<IPerspectiveDescriptor> persps = getPerspectiveItems(); Collections.sort(persps, comparator); final List<IAction> actions = new ArrayList<>(persps.size()); for (IPerspectiveDescriptor descriptor : persps) { final IAction action = getAction(descriptor.getId()); if (action != null) { if (WorkbenchActivityHelper.filterItem(action)) { continue; } actions.add(action); } } for (IAction <START> iAction : <END> actions) { manager.add(iAction); } if (PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU)) { if (actions.size() > 0) { manager.add(new Separator()); } manager.add(openOtherAction); } }</code><technical_language>rename action</technical_language>

Target:
private final void fillMenu(final MenuManager manager) { manager.removeAll(); final List<IPerspectiveDescriptor> persps = getPerspectiveItems(); Collections.sort(persps, comparator); final List<IAction> actions = new ArrayList<>(persps.size()); for (IPerspectiveDescriptor descriptor : persps) { final IAction action = getAction(descriptor.getId()); if (action != null) { if (WorkbenchActivityHelper.filterItem(action)) { continue; } actions.add(action); } } for (IAction action : actions) { manager.add(action); } if (PrefUtil.getAPIPreferenceStore().getBoolean(IWorkbenchPreferenceConstants.SHOW_OTHER_IN_PERSPECTIVE_MENU)) { if (actions.size() > 0) { manager.add(new Separator()); } manager.add(openOtherAction); } }
Source:
<code>private static String cssStyleTheme() { <START> if (K9.getK9MessageViewTheme() == K9.Theme.DARK) { <END> return "<style type=\"text/css\">" + "* { background: black ! important; color: #F3F3F3 !important }" + ":link, :link * { color: #CCFF33 !important }" + ":visited, :visited * { color: #551A8B !important }</style> "; } return ""; }</code><technical_language>If want exit-early "pattern", invert if condition. please else statement</technical_language>

Target:
private static String cssStyleTheme() { if (K9.getK9MessageViewTheme() == K9.Theme.DARK) { return "<style type=\"text/css\">" + "* { background: black ! important; color: #F3F3F3 !important }" + ":link, :link * { color: #CCFF33 !important }" + ":visited, :visited * { color: #551A8B !important }</style> "; } else { return ""; } }
Source:
<code>public Token<OzoneTokenIdentifier> getDelegationToken(Text renewer) throws IOException { Token<OzoneTokenIdentifier> token = ozoneManagerClient.getDelegationToken(renewer); if (token != null) { Text dtService = getOMProxyProvider().getProxy().getDelegationTokenService(); token.setService(dtService); LOG.info("Created " + token.toString()); } else { <START> LOG.info("Cannot get ozone delegation token from " + renewer); <END> } return token; }</code><technical_language>replace "Cannot get ozone delegation token from" "Cannot get ozone delegation token for {}, renewer"</technical_language>

Target:
public Token<OzoneTokenIdentifier> getDelegationToken(Text renewer) throws IOException { Token<OzoneTokenIdentifier> token = ozoneManagerClient.getDelegationToken(renewer); if (token != null) { Text dtService = getOMProxyProvider().getProxy().getDelegationTokenService(); token.setService(dtService); LOG.debug("Created token {}", token); } else { LOG.debug("Cannot get ozone delegation token from {}", renewer); } return token; }
Source:
<code><START> public List<AtlasObjectId> getItemsToExport(AtlasReplInfo atlasReplInfo, String srcAtlasServerName) { <END> List<AtlasObjectId> atlasObjectIds = new ArrayList<>(); final String qualifiedName = getQualifiedName(srcAtlasServerName, atlasReplInfo.getSrcDB()); atlasObjectIds.add(new AtlasObjectId(ATLAS_TYPE_HIVE_DB, ATTRIBUTE_QUALIFIED_NAME, qualifiedName)); return atlasObjectIds; }</code><technical_language>Do need methods public</technical_language>

Target:
private List<AtlasObjectId> getItemsToExport(AtlasReplInfo atlasReplInfo, String srcAtlasServerName) { List<AtlasObjectId> atlasObjectIds = new ArrayList<>(); final String qualifiedName = getQualifiedName(srcAtlasServerName, atlasReplInfo.getSrcDB()); atlasObjectIds.add(new AtlasObjectId(ATLAS_TYPE_HIVE_DB, ATTRIBUTE_QUALIFIED_NAME, qualifiedName)); return atlasObjectIds; }
Source:
<code>public Object getItem(int position) { <START> if (position < 0 || position >= getCount()) <END> return ""; return mFilterValues[position]; }</code><technical_language>Returning empty string invalid position is passed hide some bugs. do skipping this position check ArrayIndexOutOfBoundsException occurs if invalid position is passed</technical_language>

Target:
public Object getItem(int position) { return mFilterValues[position]; }
Source:
<code>public boolean run() throws InterruptedException, TransformerException, ParserConfigurationException, IOException { boolean ret = true; List<TestCase> successfulTests; if (OS.current().isPosix) { successfulTests = runPosixOnlySteps(tests); } else { successfulTests = tests; } ret &= successfulTests.size() == tests.size(); if (!skips.contains(KTestStep.KOMPILE)) { List<TestCase> testsIn = successfulTests; successfulTests = runKompileSteps(filterSkips(testsIn, KTestStep.KOMPILE)); ret &= successfulTests.size() == testsIn.size(); } if (!skips.contains(KTestStep.PDF)) ret &= runPDFSteps(filterSkips(successfulTests, KTestStep.PDF)); if (!skips.contains(KTestStep.KRUN)) ret &= runKRunSteps(filterSkips(successfulTests, KTestStep.KRUN)); <START> String colorCode = ColorUtil.RgbToAnsi(ret ? "green" : "red", colorSetting, Color.BLACK); <END> String msg = ret ? "SUCCESS" : "FAIL (see details above)"; System.out.format("%n%s%s%s%n", colorCode, msg, ColorUtil.ANSI_NORMAL); printTimeInfo(); if (reportGen != null) reportGen.save(); return ret; }</code><technical_language>Again, I understand terminal color is assumed black</technical_language>

Target:
public boolean run() throws InterruptedException, TransformerException, ParserConfigurationException, IOException { boolean ret = true; List<TestCase> successfulTests; if (OS.current().isPosix) { successfulTests = runPosixOnlySteps(tests); } else { successfulTests = tests; } ret &= successfulTests.size() == tests.size(); if (!skips.contains(KTestStep.KOMPILE)) { List<TestCase> testsIn = successfulTests; successfulTests = runKompileSteps(filterSkips(testsIn, KTestStep.KOMPILE)); ret &= successfulTests.size() == testsIn.size(); } if (!skips.contains(KTestStep.PDF)) ret &= runPDFSteps(filterSkips(successfulTests, KTestStep.PDF)); if (!skips.contains(KTestStep.KRUN)) ret &= runKRunSteps(filterSkips(successfulTests, KTestStep.KRUN)); String colorCode = ColorUtil.RgbToAnsi(ret ? Color.GREEN : Color.RED, colorSetting, Color.BLACK); String msg = ret ? "SUCCESS" : "FAIL (see details above)"; System.out.format("%n%s%s%s%n", colorCode, msg, ColorUtil.ANSI_NORMAL); printTimeInfo(); if (reportGen != null) reportGen.save(); return ret; }
Source:
<code>public String name() { try { <START> return new JdkRequest(UriBuilder.fromUri(this.home).build()) <END> .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }</code><technical_language>need UriBuilder</technical_language>

Target:
public String name() { try { return new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .xml() .xpath("/page/rule/name/text()") .get(0); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
<code>public <T2> Tuple2<T1, T2> concat(Tuple1<T2> tuple) { <START> return Tuple.of(_1, tuple._1); <END> }</code><technical_language>check tuple for null deeper</technical_language>

Target:
public <T2> Tuple2<T1, T2> concat(Tuple1<T2> tuple) { Objects.requireNonNull(tuple, "tuple is null"); return Tuple.of(_1, tuple._1); }
Source:
<code><START> public static void setUpBeforeClass() throws Exception { <END> project = ResourcesPlugin.getWorkspace().getRoot().getProject("test"); project.create(new NullProgressMonitor()); project.open(new NullProgressMonitor()); file = project.getFile("foo.txt"); file.create(new ByteArrayInputStream("'test'".getBytes()), true, new NullProgressMonitor()); }</code><technical_language>code in CompletionTest. Consider pulling out a static util method</technical_language>

Target:
public static void setUpBeforeClass() throws Exception { GenericEditorTestUtils.setUpBeforeClass(); }
Source:
<code>public void testPutAll_with_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder .addServiceConfig(new CacheWriterConfiguration()) .buildCacheConfig(String.class, String.class); <START> CacheWriterFactoryHashMap cacheWriterFactoryHashMap = new CacheWriterFactoryHashMap(false); <END> CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder().using(cacheWriterFactoryHashMap); CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 100; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); Map<String, String> cacheWriterToHashMapMap = cacheWriterFactoryHashMap.getCacheWriterToHashMap().getMap(); for (int i = 0; i < 100; i++) { assertThat(myCache.get("key" + i), is("value" + i)); assertThat(cacheWriterToHashMapMap.get("key" + i), is("value" + i)); } }</code><technical_language>This declared CacheWriterFactory</technical_language>

Target:
public void testPutAll_with_cache_writer() throws Exception { CacheConfigurationBuilder cacheConfigurationBuilder = CacheConfigurationBuilder.newCacheConfigurationBuilder(); CacheConfiguration<String, String> cacheConfiguration = cacheConfigurationBuilder .addServiceConfig(new CacheWriterConfiguration()) .buildCacheConfig(String.class, String.class); CacheWriterFactory cacheWriterFactory = mock(CacheWriterFactory.class); CacheWriter cacheWriter = mock(CacheWriter.class); when(cacheWriter.write(Matchers.anyObject(), Matchers.anyObject(), Matchers.anyObject())).thenThrow(new RuntimeException("We should not have called .write() but .writeAll()")); when(cacheWriterFactory.createCacheWriter(anyString(), Matchers.any(CacheConfiguration.class))).thenReturn(cacheWriter); CacheManagerBuilder<CacheManager> managerBuilder = CacheManagerBuilder.newCacheManagerBuilder().using(cacheWriterFactory); CacheManager cacheManager = managerBuilder.withCache("myCache", cacheConfiguration).build(); Cache<String, String> myCache = cacheManager.getCache("myCache", String.class, String.class); HashMap<String, String> stringStringHashMap = new HashMap<String, String>(); for (int i = 0; i < 3; i++) { stringStringHashMap.put("key" + i, "value" + i); } myCache.putAll(stringStringHashMap.entrySet()); verify(cacheWriter, times(3)).writeAll(Matchers.any(Iterable.class)); Map iterable = new HashMap(){{put("key2", "value2");}}; verify(cacheWriter).writeAll(iterable.entrySet()); for (int i = 0; i < 3; i++) { assertThat(myCache.get("key" + i), is("value" + i)); } }
Source:
<code>private void setNameQualifierIfPersistent(NameIDType nameIDType) { if (nameIDType.getFormat() != null <START> && nameIDType.getFormat().toUpperCase().contains(PERSISTENT.toUpperCase())) <END> nameIDType.setNameQualifier(NAME_QUALIFIER); }</code><technical_language>I do equals instead of contains. this comparison case insensitive? If equalsIgnoreCase instead of changing values uppercase</technical_language>

Target:
private void setNameQualifierIfPersistent(NameIDType nameIDType) { if (nameIDType.getFormat() != null && nameIDType.getFormat().equalsIgnoreCase(PERSISTENT)) { nameIDType.setNameQualifier(NAME_QUALIFIER); } }
Source:
<code>void executeTask(String taskName, InterruptibleRangeTask task) throws InterruptedException { BlockingWorkerPool pool = new BlockingWorkerPool(exec, threadCount); for (final MutableRange range : getRanges(threadCount, batchSize)) { if (Thread.currentThread().isInterrupted()) { log.info("Thread interrupted. Cancelling of range {}", taskName, range); break; } pool.submitTask(() -> { do { if (Thread.currentThread().isInterrupted()) { log.info("Thread interrupted. Cancelling of range {}", taskName, range); break; } try { task.execute(range); } catch (InterruptedException e) { <START> throw Throwables.rewrapAndThrowUncheckedException(e); <END> } } while (!range.isComplete()); }); } pool.waitForSubmittedTasks(); }</code><technical_language>Generally speaking this suspicious (I realise copied original code) - throwing a non-InterruptedException interruption awkward. if task fails, waitForSubmittedTasks() throw a RuntimeException of ExecutionException of a RuntimeException of InterruptedException. _This is behaviour_, I block PR this, pretty weird</technical_language>

Target:
void executeTask(String taskName, InterruptibleRangeTask task) throws InterruptedException { BlockingWorkerPool pool = new BlockingWorkerPool(exec, threadCount); for (final MutableRange range : getRanges(threadCount, batchSize)) { if (Thread.currentThread().isInterrupted()) { log.info("Thread interrupted. Cancelling of range {}", SafeArg.of("taskName", taskName), UnsafeArg.of("range", range)); return; } pool.submitTask(() -> { do { if (Thread.currentThread().isInterrupted()) { log.info("Thread interrupted. Cancelling of range {}", SafeArg.of("taskName", taskName), UnsafeArg.of("range", range)); break; } try { task.execute(range); } catch (InterruptedException e) { throw Throwables.rewrapAndThrowUncheckedException(e); } } while (!range.isComplete()); }); } pool.waitForSubmittedTasks(); }
Source:
<code>public void toLower() { assertThat( value.apply( "HELLO" ).toLower(), equalTo( value.apply( "hello" ) ) ); assertThat( value.apply( "Hello" ).toLower(), equalTo( value.apply( "hello" ) ) ); <START> assertThat( value.apply( "hello" ).toLower(), equalTo( value.apply( "hello" ) ) ); <END> }</code><technical_language>try empty string</technical_language>

Target:
public void toLower() { assertThat( value.apply( "HELLO" ).toLower(), equalTo( value.apply( "hello" ) ) ); assertThat( value.apply( "Hello" ).toLower(), equalTo( value.apply( "hello" ) ) ); assertThat( value.apply( "hello" ).toLower(), equalTo( value.apply( "hello" ) ) ); assertThat( value.apply( "" ).toLower(), equalTo( value.apply( "" ) ) ); }
Source:
<code>public void onDataSetChanged() { SharedPreferences sharedprefs = PreferenceManager.getDefaultSharedPreferences(mContext); long noteID = sharedprefs.getLong(SingleNoteWidget.WIDGET_KEY + mAppWidgetId, -1); if (noteID >= 0) { if (db.getNote(noteID) == null) { Log.e(TAG, "Error: note not found"); note = null; } else { <START> note = db.getNote(noteID); <END> } } }</code><technical_language>If note exists (which is default scenario) db.getNote(noteID) is executed twice. database queries expensive, this optimized</technical_language>

Target:
public void onDataSetChanged() { SharedPreferences sharedprefs = PreferenceManager.getDefaultSharedPreferences(mContext); long noteID = sharedprefs.getLong(SingleNoteWidget.WIDGET_KEY + mAppWidgetId, -1); if (noteID >= 0) { note = db.getNote(noteID); if (note == null) { Log.e(TAG, "Error: note not found"); } } }
Source:
<code>public String render(Boolean vmMigrateEncrypted) { if (vmMigrateEncrypted == null) { if (getModel() == null || getModel().getSelectedCluster() == null) { return constants.clusterDefaultOption(); } Cluster cluster = getModel().getSelectedCluster(); boolean clusterMigrateEncrypted; if (cluster.getMigrateEncrypted() == null) { clusterMigrateEncrypted = AsyncDataProvider.getInstance().getMigrateEncrypted(); } else { clusterMigrateEncrypted = cluster.getMigrateEncrypted(); } String clusterMigrateEncryptedLabel = clusterMigrateEncrypted ? constants.encrypt() : constants.dontEncrypt(); return <START> constants.clusterDefaultOption() + " (" + clusterMigrateEncryptedLabel + ")"; END> } else if (vmMigrateEncrypted) { return constants.encrypt(); } else { return constants.dontEncrypt(); } }</code><technical_language>Please add a new message CommonApplicationMessages, instead of creating message in code</technical_language>

Target:
public String render(Boolean vmMigrateEncrypted) { if (vmMigrateEncrypted == null) { if (getModel() == null || getModel().getSelectedCluster() == null) { return constants.clusterDefaultOption(); } Cluster cluster = getModel().getSelectedCluster(); boolean clusterMigrateEncrypted; if (cluster.getMigrateEncrypted() == null) { clusterMigrateEncrypted = AsyncDataProvider.getInstance().getMigrateEncrypted(); } else { clusterMigrateEncrypted = cluster.getMigrateEncrypted(); } String clusterMigrateEncryptedLabel = clusterMigrateEncrypted ? constants.encrypt() : constants.dontEncrypt(); return messages.clusterDefaultOption(clusterMigrateEncryptedLabel); } else if (vmMigrateEncrypted) { return constants.encrypt(); } else { return constants.dontEncrypt(); } }
Source:
<code>public static boolean isCompressionCodecSupported(InputFormat inputFormat, Path path) { if (inputFormat instanceof TextInputFormat) { try { <START> Optional<CompressionCodec> compressionCodec = getCompressionCodec((TextInputFormat) inputFormat, path); <END> if (!compressionCodec.isPresent() || stream(S3SelectSupportedCompressionCodecs.values()) .anyMatch(codec -> codec.getCodecClass().isInstance(compressionCodec.get()))) { return true; } } catch (IllegalAccessException e) { LOG.error(e, "Failed to find compressionCodec for inputFormat: %s", inputFormat.getClass().getName()); return false; } } return false; }</code><technical_language>I simplify this java return getCompressionCodec((TextInputFormat) inputFormat, path) .map(fileCodec -> stream(S3SelectSupportedCompressionCodecs.values()) .anyMatch(codec -> codec.getCodecClass().isInstance(fileCodec))) .orElse(true);</technical_language>

Target:
public static boolean isCompressionCodecSupported(InputFormat inputFormat, Path path) { if (inputFormat instanceof TextInputFormat) { return getCompressionCodec((TextInputFormat) inputFormat, path) .map(codec -> (codec instanceof GzipCodec) || (codec instanceof BZip2Codec)) .orElse(true); } return false; }
Source:
<code>public Metadata loadMetadata(String name, String metadataName) throws EntityNotFoundException { Product product = null; try { product = productManager.load(name); if (product.getMetadata(metadataName) == null ) { log.warning("Metadata not found : " + metadataName); <START> throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadataName)); <END> } else { return product.getMetadata(metadataName); } } catch (EntityNotFoundException e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } }</code><technical_language>more 120 characters</technical_language>

Target:
public Metadata loadMetadata(String name, String metadataName) throws APIException { Product product = null; try { product = productManager.load(name); } catch (EntityNotFoundException e) { log.warning("EntityNotFoundException: " + e.getMessage()); throw new APIException(new EntityNotFoundException(Product.class,name, e)); } try { return product.getMetadata(metadataName); } catch (Exception e) { log.warning("Metadata not found : " + metadataName); throw new APIException(new EntityNotFoundException(Metadata.class, "Metadata not found : " + metadataName, metadataName)); } }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiLifecycleHelper = IUiLifecycleHelper.Factory.getInstance(getActivity(), callback); uiLifecycleHelper.onCreate(savedInstanceState); Context context = getActivity().getBaseContext(); socialPref = new PrefManager(context, PrefManager.Pref.FEATURES); pref = new PrefManager(context, PrefManager.Pref.LOGIN); profile = pref.getCurrentUserProfile(); if (config.isUserProfilesEnabled() && profile != null && profile.username != null) { getAccountTask = new GetAccountTask(getActivity(), profile.username) { @Override protected void onSuccess(Account account) throws Exception { final ProfileImage profileImage = account.getProfileImage(); Glide.with(NavigationFragment.this) <START> .load(profileImage.getImageUrlLarge()) <END> .skipMemoryCache(true) .into(imageView); } }; getAccountTask.execute(); } }</code><technical_language>Do need large image here</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiLifecycleHelper = IUiLifecycleHelper.Factory.getInstance(getActivity(), callback); uiLifecycleHelper.onCreate(savedInstanceState); Context context = getActivity().getBaseContext(); socialPref = new PrefManager(context, PrefManager.Pref.FEATURES); pref = new PrefManager(context, PrefManager.Pref.LOGIN); profile = pref.getCurrentUserProfile(); if (config.isUserProfilesEnabled() && profile != null && profile.username != null) { getAccountTask = new GetAccountTask(getActivity(), profile.username) { @Override protected void onSuccess(@NonNull Account account) throws Exception { NavigationFragment.this.profileImage = account.getProfileImage(); if (null != imageView) { loadProfileImage(account.getProfileImage(), imageView); } } }; getAccountTask.setTaskProcessCallback(null); getAccountTask.execute(); } }
Source:
<code>public void setLastSpTruncationHandle(long spHandle) { if (spHandle > m_lastSpTruncationHandle) { <START> m_lastSpTruncationHandle = spHandle; <END> } }</code><technical_language>check if more responses released this advances</technical_language>

Target:
public void setLastSpTruncationHandle(long spHandle) { if (spHandle > m_lastSpTruncationHandle) { m_lastSpTruncationHandle = spHandle; releaseShortCircuitRead(m_lastSpTruncationHandle, IS_SP); } }
Source:
<code>public UnionOperatorStream<T> union(final ContinuousStream<T> inputStream) throws IOException{ final Type inputStreamDataType = ((ParameterizedType)inputStream.getClass().getGenericSuperclass()).getActualTypeArguments()[0]; final Type thisStreamDataType = ((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0]; if (inputStreamDataType.equals(thisStreamDataType)) { Set<ContinuousStream<T>> unifiedStream = new HashSet<>(); unifiedStream.add(this); unifiedStream.add(inputStream); return new UnionOperatorStream<>(unifiedStream); } else { <START> throw new IOException("Cannot perform union between streams having different data type!"); <END> } }</code><technical_language>good throw another exception, instead of IOException, is related I/O</technical_language>

Target:
public UnionOperatorStream<T> union(final ContinuousStream<T> inputStream) throws StreamTypeMismatchException { if (TypeChecker.checkTypesEqual(this, inputStream)) { final Set<ContinuousStream<T>> unifiedStream = new HashSet<>(); unifiedStream.add(this); unifiedStream.add(inputStream); return new UnionOperatorStream<>(unifiedStream); } else { throw new StreamTypeMismatchException("Cannot perform union between streams having different data types!"); } }
Source:
<code>public static Properties defaultProperties() { Properties properties = OneAndOneApiMetadata.defaultProperties(); properties.setProperty(PROPERTY_REGIONS, "de,us,es,gb"); properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-DEU"); properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-USA"); properties.setProperty(PROPERTY_REGION + ".es." + ISO3166_CODES, "ES-ESP"); properties.setProperty(PROPERTY_REGION + ".gb." + ISO3166_CODES, "GB-GBR"); properties.put("jclouds.ssh.max-retries", "7"); properties.put("jclouds.ssh.retry-auth", "true"); long defaultTimeout = 60L * 60L; properties.put(POLL_TIMEOUT, defaultTimeout); properties.put(POLL_PERIOD, 2L); properties.put(POLL_MAX_PERIOD, 2L * 10L); properties.put(PROPERTY_SO_TIMEOUT, 60000 * 5); properties.put(PROPERTY_CONNECTION_TIMEOUT, 60000 * 5); <START> properties.put(PROPERTY_MAX_RATE_LIMIT_WAIT, 20); <END> return properties; }</code><technical_language>Note is in milliseconds, a rate limited environment this is effect</technical_language>

Target:
public static Properties defaultProperties() { Properties properties = OneAndOneApiMetadata.defaultProperties(); properties.put("jclouds.ssh.max-retries", "7"); properties.put("jclouds.ssh.retry-auth", "true"); long defaultTimeout = 60L * 60L; properties.put(POLL_TIMEOUT, defaultTimeout); properties.put(POLL_INITIAL_PERIOD, 5L * 10); properties.put(POLL_MAX_PERIOD, 7L * 10L); properties.put(PROPERTY_SO_TIMEOUT, 6000 * 5); properties.put(PROPERTY_CONNECTION_TIMEOUT, 60000 * 5); properties.put(PROPERTY_MAX_RATE_LIMIT_WAIT, 330000); return properties; }
Source:
<code>public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toUri().toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { IOUtil.assertFileIsReadable(p); try { Files.lines(p).forEach(s -> { <START> if (!s.trim().isEmpty()) { <END> final Path innerPath; try { innerPath = getPath(s.trim()); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s.trim() + " to a Path."); } } }); } catch (IOException e) { throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString()); } } } Collections.reverse(output); return output; }</code><technical_language>instead of calling String.trim() multiple times map(), e.g. Files.lines(p).map(String::trim).forEach(...) filter too, e.g. .map(...).filter(s -> !s.isEmpty()).forEach()</technical_language>

Target:
public static List<Path> unrollPaths(final Collection<Path> inputs, final String... extensions) { if (extensions.length < 1) throw new IllegalArgumentException("Must provide at least one extension."); final Stack<Path> stack = new Stack<>(); final List<Path> output = new ArrayList<>(); stack.addAll(inputs); while (!stack.empty()) { final Path p = stack.pop(); final String name = p.toString(); boolean matched = false; for (final String ext : extensions) { if (!matched && name.endsWith(ext)) { output.add(p); matched = true; } } if (!matched) { IOUtil.assertFileIsReadable(p); try { Files.lines(p) .map(String::trim) .filter(s -> !s.isEmpty()) .forEach(s -> { final Path innerPath; try { innerPath = getPath(s); stack.push(innerPath); } catch (IOException e) { throw new IllegalArgumentException("cannot convert " + s + " to a Path."); } } ); } catch (IOException e) { throw new IllegalArgumentException("had trouble reading from " + p.toUri().toString()); } } } Collections.reverse(output); return output; }
Source:
<code>private void loadDictionary() { final String language = userPrefs_.spellingDictionaryLanguage().getValue(); if (!userPrefs_.realTimeSpellchecking().getValue() || typoLoaded_ && loadedDict_.equals(language)) return; if (!canRealtimeSpellcheckDict(language)) { <START> userPrefs_.realTimeSpellchecking().setGlobalValue(false); <END> return; } if (activeRequest_ != null && activeRequest_.isAlive()) { if (StringUtil.equals(activeRequest_.getLanguage(), language)) return; activeRequest_.cancel(); activeRequest_ = null; } activeRequest_ = new TypoDictionaryRequest(language); activeRequest_.send(); }</code><technical_language>I avoid committing a pref change extremely implicit -- prefs generally change due a user gesture intent users diff prefs. bailing check do job here</technical_language>

Target:
private void loadDictionary() { final String language = userPrefs_.spellingDictionaryLanguage().getValue(); if (!userPrefs_.realTimeSpellchecking().getValue() || typoLoaded_ && loadedDict_.equals(language)) return; if (!canRealtimeSpellcheckDict(language)) return; if (activeRequest_ != null && activeRequest_.isAlive()) { if (StringUtil.equals(activeRequest_.getLanguage(), language)) return; activeRequest_.cancel(); activeRequest_ = null; } activeRequest_ = new TypoDictionaryRequest(language); activeRequest_.send(); }
Source:
<code>public void doesNotComplainAboutConstantsInInnerClasses() throws Exception { final Environment env = new Environment.Mock().withFile( "src/main/java/foo/Foo.java", Joiner.on('\n').join( "package foo;", "interface Foo {", " final class Bar implements Foo {", " private static final Pattern TEST =", " Pattern.compile(\"hey\");", " public String doSomething() {", " return Foo.Bar.TEST.toString();", " }", " }", "}" ) ); final StringWriter writer = new StringWriter(); Logger.getRootLogger().addAppender( new WriterAppender(new SimpleLayout(), writer) ); <START> final Validator validator = new PMDValidator(); <END> validator.validate(env); MatcherAssert.assertThat( writer.toString(), Matchers.allOf( Matchers.not(Matchers.containsString("UnusedPrivateMethod")), Matchers.containsString("No PMD violations found in 1 files") ) ); }</code><technical_language>@mkordas inline this variable</technical_language>

Target:
public void doesNotComplainAboutConstantsInInnerClasses() throws Exception { final Environment env = new Environment.Mock().withFile( "src/main/java/foo/Foo.java", Joiner.on('\n').join( "package foo;", "interface Foo {", " final class Bar implements Foo {", " private static final Pattern TEST =", " Pattern.compile(\"hey\");", " public String doSomething() {", " return Foo.Bar.TEST.toString();", " }", " }", "}" ) ); final StringWriter writer = new StringWriter(); final Appender appender = new WriterAppender( new SimpleLayout(), writer ); try { Logger.getRootLogger().addAppender(appender); new PMDValidator().validate(env); writer.flush(); MatcherAssert.assertThat( writer.toString(), Matchers.allOf( Matchers.not(Matchers.containsString("UnusedPrivateField")), Matchers.containsString("No PMD violations found") ) ); } finally { Logger.getRootLogger().removeAppender(appender); } }
Source:
<code>private String getCurrentUsername() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String username; if (Objects.nonNull(authentication) && authentication.isAuthenticated()) { username = authentication.getName(); } else { username = "Unauthenticated User"; } return username; <START> } <END></code><technical_language>Mann knnte das auch ohne "username" machen: java if(...) return authentication.getName(); return "...";</technical_language>

Target:
private String getCurrentUsername() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); return (Objects.nonNull(authentication) && authentication.isAuthenticated()) ? authentication.getName() : "Unauthenticated User"; }
Source:
<code>public File getFile10(String taskId, String repositoryUrl) { try { String pathName = URLEncoder.encode(repositoryUrl, ENCODING_UTF_8); String fileName = taskId; File path = new File(dataPath + File.separator + FOLDER_TASKS_1_0, pathName); File file = new File(path, fileName + EXTENSION); <START> if (file.exists()) { <END> return file; } fileName = getFileName(taskId, path); return new File(path, fileName + EXTENSION); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }</code><technical_language>algorithm is: * if unencoded file exists, return * if encoded file exists, return * encode filename if required * trim filename return file I right</technical_language>

Target:
public File getFile10(String taskId, String repositoryUrl) { try { String pathName = URLEncoder.encode(repositoryUrl, ENCODING_UTF_8); String fileName = taskId; File path = new File(dataPath + File.separator + FOLDER_TASKS_1_0, pathName); if (!fileExists(fileName, path)) { fileName = getFileName(taskId, path); } return new File(path, fileName + EXTENSION); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
Source:
<code>static CharSequence toLowerCase(CharSequence s) { <START> return AsciiString.of(s).toLowerCase(); <END> }</code><technical_language>this creates extra AsciiString object</technical_language>

Target:
static CharSequence toLowerCase(CharSequence s) { if (s instanceof AsciiString) { return ((AsciiString) s).toLowerCase(); } else { byte[] bytes = new byte[s.length()]; int len = s.length(); for (int index = 0; index < len; index++) { char c = s.charAt(index); if (AsciiString.isUpperCase(c)) { bytes[index] = AsciiString.c2b((char)(c + ('a' - 'A'))); } else { bytes[index] = AsciiString.c2b(c); } } return new AsciiString(bytes); } }
Source:
<code>public List<Trigger> handle(ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.<Trigger>emptyList(); } ArrayList<Trigger> triggers = new ArrayList<Trigger>(); do { int triggerId = rs.getInt(1); int encodingType = rs.getInt(4); byte[] data = rs.getBytes(5); Object jsonObj = null; if (data != null) { EncodingType encType = EncodingType.fromInteger(encodingType); try { if (encType == EncodingType.GZIP) { String jsonString = GZIPUtils.unGzipString(data, "UTF-8"); jsonObj = JSONUtils.parseJSONFromString(jsonString); } else { String jsonString = new String(data, "UTF-8"); jsonObj = JSONUtils.parseJSONFromString(jsonString); } } catch (IOException e) { <START> throw new SQLException("Error reconstructing trigger data "); <END> } } Trigger t = null; try { t = Trigger.fromJson(jsonObj); triggers.add(t); } catch (Exception e) { e.printStackTrace(); logger.error("Failed to load trigger " + triggerId); } } while (rs.next()); return triggers; }</code><technical_language>i exception sql exception</technical_language>

Target:
public List<Trigger> handle(ResultSet rs) throws SQLException { if (!rs.next()) { return Collections.<Trigger>emptyList(); } ArrayList<Trigger> triggers = new ArrayList<Trigger>(); do { int triggerId = rs.getInt(1); int encodingType = rs.getInt(4); byte[] data = rs.getBytes(5); Object jsonObj = null; if (data != null) { EncodingType encType = EncodingType.fromInteger(encodingType); try { jsonObj = JSONUtils.parseJSONFromString(encType == EncodingType.GZIP ? GZIPUtils.unGzipString(data, "UTF-8") : new String(data, "UTF-8")); } catch (IOException e) { throw new SQLException("Error reconstructing trigger data "); } } Trigger t = null; try { t = Trigger.fromJson(jsonObj); triggers.add(t); } catch (Exception e) { logger.error("Failed to load trigger " + triggerId, e); } } while (rs.next()); return triggers; }
Source:
<code>public void close() { if (updateScoresScheduler != null) updateScoresScheduler.cancel(false); if (updateSamplesScheduler != null) <START> updateSamplesScheduler.cancel(false); <END> for (AnnotatedMeasurement measurement : samples.values()) { if (measurement.probeFuture != null) measurement.probeFuture.cancel(false); measurement.millisSinceLastMeasure.set(0); measurement.millisSinceLastRequest.set(MAX_PROBE_INTERVAL_MS); measurement.probeTimerMillis = 0; } MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); try { if (mbeanRegistered) mbs.unregisterMBean(new ObjectName(mbeanName)); } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>want race this wait completed get()</technical_language>

Target:
public synchronized void close() { ensureCancelled(updateScoresScheduler); ensureCancelled(updateSamplesScheduler); updateScoresScheduler = null; updateSamplesScheduler = null; List<ScheduledFuture> probesToCancel = new ArrayList<>(); for (AnnotatedMeasurement measurement : samples.values()) { probesToCancel.add(measurement.probeFuture); measurement.millisSinceLastMeasure.set(0); measurement.millisSinceLastRequest.set(0); measurement.nextProbeDelayMillis = 0; measurement.probeFuture = null; } ensureCancelled(probesToCancel); if (mbeanRegistered) MBeanWrapper.instance.unregisterMBean(mbeanName); MessagingService.instance().unregisterLatencySubscriber(this); mbeanRegistered = false; }
Source:
<code>private void loadAttributeWasValues(BranchId sourceBranch, TransactionToken transactionId, Set<ArtifactId> artIds, IProgressMonitor monitor, Map<Integer, ChangeBuilder> attributesWasValueCache, boolean hasBranch) { if (!artIds.isEmpty()) { Id sqlParamter; BranchId wasValueBranch; String sql; if (hasBranch) { wasValueBranch = sourceBranch; sql = ServiceUtil.getSql(OseeSql.CHANGE_BRANCH_ATTRIBUTE_WAS); sqlParamter = wasValueBranch; } else { wasValueBranch = transactionId.getBranch(); sql = ServiceUtil.getSql(OseeSql.CHANGE_TX_ATTRIBUTE_WAS); sqlParamter = transactionId; } try (Id4JoinQuery joinQuery = JoinUtility.createId4JoinQuery()) { for (ArtifactId artId : artIds) { <START> joinQuery.add(wasValueBranch, ArtifactId.valueOf(artId), TransactionId.SENTINEL, <END> wasValueBranch.getViewId()); } joinQuery.store(); previousAttrId = -1; ConnectionHandler.getJdbcClient().runQuery(this::buildAttributeChange, sql, sqlParamter, joinQuery.getQueryId()); } if (getMonitor() != null) { monitor.worked(12); } } }</code><technical_language>recreate Id: replace ArtifactId.valueOf(artId) artId</technical_language>

Target:
private void loadAttributeWasValues(BranchId sourceBranch, TransactionToken transactionId, Set<ArtifactId> artIds, IProgressMonitor monitor, Map<Integer, ChangeBuilder> attributesWasValueCache, boolean hasBranch) { if (!artIds.isEmpty()) { Id sqlParamter; BranchId wasValueBranch; String sql; if (hasBranch) { wasValueBranch = sourceBranch; sql = ServiceUtil.getSql(OseeSql.CHANGE_BRANCH_ATTRIBUTE_WAS); sqlParamter = wasValueBranch; } else { wasValueBranch = transactionId.getBranch(); sql = ServiceUtil.getSql(OseeSql.CHANGE_TX_ATTRIBUTE_WAS); sqlParamter = transactionId; } try (Id4JoinQuery joinQuery = JoinUtility.createId4JoinQuery()) { for (ArtifactId artId : artIds) { joinQuery.add(wasValueBranch, artId, TransactionId.SENTINEL, wasValueBranch.getViewId()); } joinQuery.store(); previousAttrId = -1; ConnectionHandler.getJdbcClient().runQuery(this::buildAttributeChange, sql, sqlParamter, joinQuery.getQueryId()); } if (getMonitor() != null) { monitor.worked(12); } } }
Source:
<code>private SubPillarConfigPolicy(int minimumSubPillarSize, int maximumSubPillarSize, Comparator<?> entityComparator) { this.subPillarEnabled = true; this.minimumSubPillarSize = minimumSubPillarSize; this.maximumSubPillarSize = maximumSubPillarSize; validateSizes(); if (entityComparator == null) { <START> throw new IllegalStateException("entityComparator must not be null."); <END> } this.entityComparator = entityComparator; }</code><technical_language>error messages start a capital error messages sentances "The" "A" etc. => "The entityComparator null.")</technical_language>

Target:
private SubPillarConfigPolicy(int minimumSubPillarSize, int maximumSubPillarSize, Comparator<?> entityComparator) { this.subPillarEnabled = true; this.minimumSubPillarSize = minimumSubPillarSize; this.maximumSubPillarSize = maximumSubPillarSize; validateSizes(); if (entityComparator == null) { throw new IllegalStateException("The entityComparator must not be null."); } this.entityComparator = entityComparator; }
Source:
<code>getResponsesSortedByGiverQuestionRecipient(boolean sortByTeam) { Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); if (sortByTeam) { responses.sort(compareByTeamGiverQuestionTeamRecipient); } else { responses.sort(compareByGiverQuestionTeamRecipient); } for (FeedbackResponseAttributes response : responses) { String giverEmail = response.giver; Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesFromOneGiver = sortedMap.computeIfAbsent(giverEmail, (String key) -> <START> new LinkedHashMap<>()); <END> FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); responsesFromOneGiver.computeIfAbsent(question, (FeedbackQuestionAttributes key) -> new ArrayList<>()) .add(response); } return sortedMap; }</code><technical_language>is need explicitly define type of key benefit type inference, i.e. sortedMap.computeIfAbsent(giverEmail, key -> new LinkedHashMap<>()) compile problem. - This line short enough put previous line. Applies other parts of this PR</technical_language>

Target:
getResponsesSortedByGiverQuestionRecipient(boolean sortByTeam) { Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedMap = new LinkedHashMap<>(); if (sortByTeam) { responses.sort(compareByTeamGiverQuestionTeamRecipient); } else { responses.sort(compareByGiverQuestionTeamRecipient); } for (FeedbackResponseAttributes response : responses) { String giverEmail = response.giver; Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> responsesFromOneGiver = sortedMap.computeIfAbsent(giverEmail, key -> new LinkedHashMap<>()); FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); responsesFromOneGiver.computeIfAbsent(question, key -> new ArrayList<>()) .add(response); } return sortedMap; }