auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void shouldDecodeTwoCommands() throws IOException { TestLessInputStreamBuilder builder = new TestLessInputStreamBuilder(); final TestLessInputStream pluginIs = builder.build(); InputStream is = new InputStream() { private byte[] buffer; private int idx; @Override public int read() throws IOException { if ( buffer == null ) { idx = 0; Command cmd = pluginIs.readNextCommand(); if ( cmd == null ) { <START> buffer = null; <END> } else { MasterProcessCommand cmdType = cmd.getCommandType(); buffer = cmdType.hasDataType() ? cmdType.encode( cmd.getData() ) : cmdType.encode(); } } if ( buffer != null ) { byte b = buffer[idx++]; if ( idx == buffer.length ) { buffer = null; idx = 0; } return b; } throw new IOException(); } }; MasterProcessChannelDecoder decoder = new LegacyMasterProcessChannelDecoder( is ); builder.getImmediateCommands().shutdown( KILL ); builder.getImmediateCommands().noop(); Command bye = decoder.decode(); assertThat( bye, is( notNullValue() ) ); assertThat( bye.getCommandType(), is( SHUTDOWN ) ); assertThat( bye.getData(), is( KILL.name() ) ); Command noop = decoder.decode(); assertThat( noop, is( notNullValue() ) ); assertThat( noop.getCommandType(), is( MasterProcessCommand.NOOP ) ); }</code><technical_language>Buffer is null</technical_language>

Target:
public void shouldDecodeTwoCommands() throws IOException { TestLessInputStreamBuilder builder = new TestLessInputStreamBuilder(); final TestLessInputStream pluginIs = builder.build(); InputStream is = new InputStream() { private byte[] buffer; private int idx; @Override public int read() throws IOException { if ( buffer == null ) { idx = 0; Command cmd = pluginIs.readNextCommand(); if ( cmd != null ) { MasterProcessCommand cmdType = cmd.getCommandType(); buffer = cmdType.hasDataType() ? encode( cmdType, cmd.getData() ) : encode( cmdType ); } } if ( buffer != null ) { byte b = buffer[idx++]; if ( idx == buffer.length ) { buffer = null; idx = 0; } return b; } throw new IOException(); } }; MasterProcessChannelDecoder decoder = new LegacyMasterProcessChannelDecoder( newChannel( is ) ); builder.getImmediateCommands().shutdown( KILL ); builder.getImmediateCommands().noop(); Command bye = decoder.decode(); assertThat( bye, is( notNullValue() ) ); assertThat( bye.getCommandType(), is( SHUTDOWN ) ); assertThat( bye.getData(), is( KILL.name() ) ); Command noop = decoder.decode(); assertThat( noop, is( notNullValue() ) ); assertThat( noop.getCommandType(), is( MasterProcessCommand.NOOP ) ); }
Source:
<code>public GenericParser(Class... classes) { Collections.addAll(this.classes, classes); this.classes.addAll(CustomTagService.getInstance().getImplementations()); this.classes.addAll(CustomRepositoryConfigurationTagService.getInstance().getImplementations()); <START> this.classes.addAll(RemoteRepositoryConfigurationTagService.getInstance().getImplementations()); <END> }</code><technical_language>extract extra method for of this.classes.addAll instead of repeating this 4 times</technical_language>

Target:
public GenericParser(Class... classes) { Collections.addAll(this.classes, classes); init(); }
Source:
<code>public void sendSuccessEdgeNotification(final MonitoredMessage trackMessage) { LOG.debug("Inside Message Monitoring API sendSuccessEdgeNotification() method."); final String subject = MessageMonitoringUtil.getSuccessfulMessageSubjectPrefix() + trackMessage.getSubject(); final String emailText = MessageMonitoringUtil.getSuccessfulMessageEmailText() + trackMessage.getRecipients(); final String postmasterEmailId = MessageMonitoringUtil.getDomainPostmasterEmailId() + "@" + MessageMonitoringUtil.getDomainFromEmail(trackMessage.getSenderemailid()); final DirectEdgeProxy proxy = MessageMonitoringUtil.getDirectEdgeProxy(); MimeMessage message = null; String errorMsg = null; try { message = MessageMonitoringUtil.createMimeMessage(postmasterEmailId, subject, trackMessage.getSenderemailid(), emailText, trackMessage.getMessageid()); proxy.provideAndRegisterDocumentSetB(message); getDirectEventLogger().log(DirectEventType.DIRECT_EDGE_NOTIFICATION_SUCCESSFUL, message); } catch (final AddressException ex) { errorMsg = ex.getLocalizedMessage(); LOG.error("Unknown email address {}",errorMsg,ex); <START> } catch (final MessagingException ex) { <END> errorMsg = ex.getLocalizedMessage(); LOG.error(errorMsg,ex); } LOG.debug("Exiting Message Monitoring API sendSuccessEdgeNotification() method."); }</code><technical_language>Optional: combine multiple catch 1</technical_language>

Target:
public void sendSuccessEdgeNotification(final MonitoredMessage trackMessage) { LOG.debug("Inside Message Monitoring API sendSuccessEdgeNotification() method."); final String subject = MessageMonitoringUtil.getSuccessfulMessageSubjectPrefix() + trackMessage.getSubject(); final String emailText = MessageMonitoringUtil.getSuccessfulMessageEmailText() + trackMessage.getRecipients(); final String postmasterEmailId = MessageMonitoringUtil.getDomainPostmasterEmailId() + "@" + MessageMonitoringUtil.getDomainFromEmail(trackMessage.getSenderemailid()); final DirectEdgeProxy proxy = MessageMonitoringUtil.getDirectEdgeProxy(); MimeMessage message = null; String errorMsg = null; try { message = MessageMonitoringUtil.createMimeMessage(postmasterEmailId, subject, trackMessage.getSenderemailid(), emailText, trackMessage.getMessageid()); proxy.provideAndRegisterDocumentSetB(message); getDirectEventLogger().log(DirectEventType.DIRECT_EDGE_NOTIFICATION_SUCCESSFUL, message); } catch (MessagingException ex) { errorMsg = ex.getLocalizedMessage(); LOG.error(errorMsg,ex); } LOG.debug("Exiting Message Monitoring API sendSuccessEdgeNotification() method."); }
Source:
<code>private static String buildMessage(String prefix, String format, Object... args) { String sessionPostfix = ""; Session currentSession = <START> null; END> sSessionMapper.get(getCallingThreadId()); if (currentSession != null) { sessionPostfix = ": " + currentSession.toString(); } String msg; try { msg = (args == null || args.length == 0) ? format : String.format(Locale.US, format, args); } catch (IllegalFormatException ife) { e("Log", ife, "IllegalFormatException: formatString='%s' numArgs=%d", format, args.length); msg = format + " (An error occurred while formatting the message.)"; } return String.format(Locale.US, "%s: %s%s", prefix, msg, sessionPostfix); }</code><technical_language>want check this in TODO</technical_language>

Target:
private static String buildMessage(String prefix, String format, Object... args) { String sessionName = getSessionId(); String sessionPostfix = TextUtils.isEmpty(sessionName) ? "" : ": " + sessionName; String msg; try { msg = (args == null || args.length == 0) ? format : String.format(Locale.US, format, args); } catch (IllegalFormatException ife) { e("Log", ife, "IllegalFormatException: formatString='%s' numArgs=%d", format, args.length); msg = format + " (An error occurred while formatting the message.)"; } return String.format(Locale.US, "%s: %s%s", prefix, msg, sessionPostfix); }
Source:
<code>public static List<String> getDisplayedLocales(List<String> allLocales, List<String> unsupportedLocalesFilterOverrides, List<String> unsupportedLocalesFilter) { <START> List<String> result = allLocales; <END> unsupportedLocalesFilter.removeAll(unsupportedLocalesFilterOverrides); result.removeAll(unsupportedLocalesFilter); Collections.sort(result); return result; }</code><technical_language>Small - I do: List<String> result = new ArrayList<String>(allLocales); original code: List<String> result = allLocales; modification of "result" modify "allLocales" input parameter. In other words, OK modifying method input parameters? (I'd avoid this.)</technical_language>

Target:
public static List<String> getDisplayedLocales(List<String> allLocales, List<String> unsupportedLocalesFilterOverrides, List<String> unsupportedLocalesFilter) { List<String> result = new ArrayList<String>(allLocales); List<String> unsupportedLocalesTemp = new ArrayList<String>(unsupportedLocalesFilter); unsupportedLocalesTemp.removeAll(unsupportedLocalesFilterOverrides); result.removeAll(unsupportedLocalesTemp); Collections.sort(result); return result; }
Source:
<code>IndexValue(String logSegmentName, ByteBuffer value, short version) { this.version = version; <START> if (version == PersistentIndex.VERSION_0) { <END> indexValueSizeInBytes = BLOB_SIZE_IN_BYTES + OFFSET_SIZE_IN_BYTES + FLAG_SIZE_IN_BYTES + EXPIRES_AT_MS_SIZE_IN_BYTES_V0 + ORIGINAL_MESSAGE_OFFSET_SIZE_IN_BYTES; if (value.capacity() != indexValueSizeInBytes) { throw new IllegalArgumentException("Invalid buffer size for version 0"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); expiresAtMs = value.getLong(); originalMessageOffset = value.getLong(); operationTimeInSecs = (int) Utils.Infinite_Time; serviceId = 0; containerId = 0; } else if (version == PersistentIndex.VERSION_1) { indexValueSizeInBytes = BLOB_SIZE_IN_BYTES + OFFSET_SIZE_IN_BYTES + FLAG_SIZE_IN_BYTES + EXPIRES_AT_SECS_SIZE_IN_BYTES_V1 + ORIGINAL_MESSAGE_OFFSET_SIZE_IN_BYTES + OPERATION_TIME_SECS_SIZE_IN_BYTES + SERVICE_ID_SIZE_IN_BYTES + CONTAINER_ID_SIZE_IN_BYTES; if (value.capacity() != indexValueSizeInBytes) { throw new IllegalArgumentException("Invalid buffer size for version 1"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); int expiresAt = value.getInt(); expiresAtMs = expiresAt != Utils.Infinite_Time ? (expiresAt * Time.MsPerSec) : Utils.Infinite_Time; originalMessageOffset = value.getLong(); operationTimeInSecs = value.getInt(); serviceId = value.getShort(); containerId = value.getShort(); } else { throw new IllegalArgumentException("Unsupported version " + version + " passed in for IndexValue "); } }</code><technical_language>switch instead of if else</technical_language>

Target:
IndexValue(String logSegmentName, ByteBuffer value, short version) { this.version = version; switch (version) { case PersistentIndex.VERSION_0: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V0) { throw new IllegalArgumentException("Invalid buffer size for version 0"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); expiresAtMs = value.getLong(); originalMessageOffset = value.getLong(); operationTimeInMs = (int) Utils.Infinite_Time; serviceId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; containerId = SERVICE_CONTAINER_ID_DEFAULT_VALUE; break; case PersistentIndex.VERSION_1: if (value.capacity() != INDEX_VALUE_SIZE_IN_BYTES_V1) { throw new IllegalArgumentException("Invalid buffer size for version 1"); } size = value.getLong(); offset = new Offset(logSegmentName, value.getLong()); flags = value.get(); int expiresAt = value.getInt(); expiresAtMs = expiresAt != Utils.Infinite_Time ? (expiresAt * Time.MsPerSec) : Utils.Infinite_Time; originalMessageOffset = value.getLong(); int operationTimeInSecs = value.getInt(); operationTimeInMs = operationTimeInSecs != Utils.Infinite_Time ? (operationTimeInSecs * Time.MsPerSec) : Utils.Infinite_Time; serviceId = value.getShort(); containerId = value.getShort(); break; default: throw new IllegalArgumentException("Unsupported version " + version + " passed in for IndexValue "); } }
Source:
<code>protected String getId() { <START> return "GNU C compiler 4 (gcc)"; <END> }</code><technical_language>ID is restore files (from older release) this changed</technical_language>

Target:
protected String getId() { return "GNU compiler 4 (gcc)"; }
Source:
<code>public void postProcessorsAreMergedDuringMockMvcPerform() throws Exception { RequestBuilder requestBuilder = formLogin() .user("my-user") .password("my-password") .loginProcessingUrl("/my-path"); RequestBuilder defaultRequestBuilder = MockMvcRequestBuilders.get("/"); if (defaultRequestBuilder instanceof ConfigurableSmartRequestBuilder) { ((ConfigurableSmartRequestBuilder) defaultRequestBuilder).with(new MockPostProcessor()); } if (defaultRequestBuilder != null && requestBuilder instanceof Mergeable ) { requestBuilder = (RequestBuilder) ((Mergeable) requestBuilder).merge(defaultRequestBuilder); } MockHttpServletRequest request = requestBuilder.buildRequest(this.servletContext); <START> Assert.isInstanceOf(ConfigurableSmartRequestBuilder.class, requestBuilder); <END> Assert.isTrue(request.equals(((SmartRequestBuilder) requestBuilder).postProcessRequest(request)), "Postprocessing failed."); }</code><technical_language>Please assertj</technical_language>

Target:
public void postProcessorsAreMergedDuringMockMvcPerform() throws Exception { RequestPostProcessor postProcessor = mock(RequestPostProcessor.class); when(postProcessor.postProcessRequest(any())).thenAnswer(i -> i.getArgument(0)); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new Object()) .defaultRequest(MockMvcRequestBuilders.get("/").with(postProcessor)) .build(); MvcResult mvcResult = mockMvc.perform(formLogin()).andReturn(); assertThat(mvcResult.getRequest().getMethod()).isEqualTo(HttpMethod.POST.name()); assertThat(mvcResult.getRequest().getHeader("Accept")) .isEqualTo(MediaType.toString(Arrays.asList(MediaType.APPLICATION_FORM_URLENCODED))); assertThat(mvcResult.getRequest().getParameter("username")).isEqualTo("user"); assertThat(mvcResult.getRequest().getParameter("password")).isEqualTo("password"); assertThat(mvcResult.getRequest().getRequestURI()).isEqualTo("/login"); assertThat(mvcResult.getRequest().getParameter("_csrf")).isNotEmpty(); verify(postProcessor).postProcessRequest(any()); }
Source:
<code>public Observable<ObservableConnection<I, O>> acquire() { <START> if (isShutdownRequested.get()) { <END> return Observable.error(new IllegalStateException("Connection pool is already shutdown.")); } return Observable.create(new Observable.OnSubscribe<ObservableConnection<I, O>>() { @Override public void call(final Subscriber<? super ObservableConnection<I, O>> subscriber) { Lock lock = shutdownLock.readLock(); boolean lockRetrieved = lock.tryLock(); try { if (!lockRetrieved || isShutdownRequested.get()) { subscriber.onError(new IllegalStateException("Connection pool is already shutdown.")); return; } performAquire(subscriber); } finally { lock.unlock(); } } }); }</code><technical_language>This moved call method below, checked for subscription of returned Observable</technical_language>

Target:
public Observable<ObservableConnection<I, O>> acquire() { return Observable.create(new Observable.OnSubscribe<ObservableConnection<I, O>>() { @Override public void call(final Subscriber<? super ObservableConnection<I, O>> subscriber) { Lock lock = shutdownLock.readLock(); boolean lockRetrieved = lock.tryLock(); if (!lockRetrieved) { subscriber.onError(new IllegalStateException("Connection pool is already shutdown.")); return; } try { if (isShutdownRequested.get()) { subscriber.onError(new IllegalStateException("Connection pool is already shutdown.")); return; } performAquire(subscriber); } finally { lock.unlock(); } } }); }
Source:
<code>private UsbControllerModel getUsbControllerModel(VmBase vmBase) { Supplier<Cluster> <START> clusterSupplier = <END> () -> getCluster(vmBase.getClusterId()); Version version = CompatibilityVersionUtils.getEffective(vmBase, clusterSupplier); BiosType biosType = BiosTypeUtils.getEffective(vmBase, clusterSupplier); return osRepository.getOsUsbControllerModel(vmBase.getOsId(), version, biosType.getChipsetType()); }</code><technical_language>This supplier is potentially called twice, data is fetched DB twice. MemoizingSupplier here</technical_language>

Target:
private UsbControllerModel getUsbControllerModel(VmBase vmBase) { MemoizingSupplier<Cluster> clusterSupplier = new MemoizingSupplier<>(() -> getCluster(vmBase.getClusterId())); Version version = CompatibilityVersionUtils.getEffective(vmBase, clusterSupplier); BiosType biosType = BiosTypeUtils.getEffective(vmBase, clusterSupplier); return osRepository.getOsUsbControllerModel(vmBase.getOsId(), version, biosType.getChipsetType()); }
Source:
<code>private ISeries getSeries() { AbstractSegmentStoreDensityViewer densityViewer = fFuncDensityView.getDensityViewer(); <START> assertNotNull(densityViewer); <END> ISeries[] serieses = densityViewer.getControl().getSeriesSet().getSeries(); assertNotNull(serieses); assertTrue(serieses.length > 0); ISeries series = serieses[0]; assertNotNull(series); return series; }</code><technical_language>fDensityViewer get</technical_language>

Target:
private ISeries getSeries() { AbstractSegmentStoreDensityViewer densityViewer = fDensityViewer; assertNotNull(densityViewer); ISeries[] serieses = densityViewer.getControl().getSeriesSet().getSeries(); assertNotNull(serieses); assertTrue(serieses.length > 0); ISeries series = serieses[0]; assertNotNull(series); return series; }
Source:
<code>public void testNoSelfSuppression() throws IOException { AsyncWriterPool pool = new AsyncWriterPool(4); <START> File file = File.createTempFile("AsyncPoolWriterTest", ".tmp"); <END> TestWriter writer = new TestWriter(file.toPath()); Writer<String> pooledWriter = pool.pool(writer, new LinkedBlockingQueue<>(), 1); writer.close(); try { pooledWriter.write("Exception"); pooledWriter.close(); Assert.fail("Expected exception"); } catch (Exception e) { } try { pooledWriter.write("Third Exception"); Assert.fail("Expected exception"); } catch (RuntimeIOException e) { } }</code><technical_language>Please delete temp files create, easiest is IOUtils.newTempFile</technical_language>

Target:
public void testNoSelfSuppression() throws IOException { AsyncWriterPool pool = new AsyncWriterPool(4); File file = File.createTempFile("AsyncPoolWriterTest", ".tmp"); file.deleteOnExit(); TestWriter writer = new TestWriter(file.toPath()); Writer<String> pooledWriter = pool.pool(writer, new LinkedBlockingQueue<>(), 1); writer.close(); try { pooledWriter.write("Exception"); pooledWriter.close(); Assert.fail("Expected exception"); } catch (Exception e) { } try { pooledWriter.write("Third Exception"); Assert.fail("Expected exception"); } catch (RuntimeIOException e) { } }
Source:
<code>MatchResults matchIndexEntry(ExpressionOrColumn indexEntry) { if (isDead() || isDone()) { return MatchResults.DONE_OR_DEAD; } else if ( ! m_partitionByExprs.isEmpty() ) { List<AbstractExpression> moreBindings = null; for (ExpressionOrColumn eorc : m_partitionByExprs) { moreBindings = ExpressionOrColumn.findBindingsForOneIndexedExpression(eorc, indexEntry); if (moreBindings != null) { m_orderedMatchingExpressions.add(eorc.m_expr); <START> while (m_partitionByExprs.remove(eorc)) { <END> ; } m_bindings.addAll(moreBindings); return MatchResults.MATCHED; } } markDead(); return MatchResults.DONE_OR_DEAD; } else { ExpressionOrColumn nextStatementEOC = m_unmatchedOrderByExprs.get(0); if (m_sortDirection == SortDirectionType.INVALID) { m_sortDirection = nextStatementEOC.sortDirection(); } if (nextStatementEOC.sortDirection() != m_sortDirection) { markDead(); return MatchResults.DONE_OR_DEAD; } final List<AbstractExpression> moreBindings = ExpressionOrColumn.findBindingsForOneIndexedExpression(nextStatementEOC, indexEntry); if (moreBindings != null) { m_orderedMatchingExpressions.add(nextStatementEOC.m_expr); m_bindings.addAll(moreBindings); while (m_unmatchedOrderByExprs.remove(nextStatementEOC)) { ; } return MatchResults.MATCHED; } else { assert 0 <= indexEntry.m_indexKeyComponentPosition; if (isWindowFunction()) { markDead(); return MatchResults.DONE_OR_DEAD; } else { return MatchResults.POSSIBLE_ORDER_SPOILER; } } } }</code><technical_language>if this is is a bit more clear if this m_partitionByExprs.removeIf(eorc::equals) guarantees iteration. Another option m_partitionByExprs.removeAll(Collections.singleton(eorc))</technical_language>

Target:
MatchResults matchIndexEntry(ExpressionOrColumn indexEntry) { if (isDead() || isDone()) { return MatchResults.DONE_OR_DEAD; } else if ( ! m_partitionByExprs.isEmpty()) { List<AbstractExpression> moreBindings = null; for (ExpressionOrColumn eorc : m_partitionByExprs) { moreBindings = ExpressionOrColumn.findBindingsForOneIndexedExpression(eorc, indexEntry); if (moreBindings != null) { m_orderedMatchingExpressions.add(eorc.m_expr); m_partitionByExprs.removeAll(Collections.singleton(eorc)); m_bindings.addAll(moreBindings); return MatchResults.MATCHED; } } markDead(); return MatchResults.DONE_OR_DEAD; } else { ExpressionOrColumn nextStatementEOC = m_unmatchedOrderByExprs.get(0); if (m_sortDirection == SortDirectionType.INVALID) { m_sortDirection = nextStatementEOC.sortDirection(); } if (nextStatementEOC.sortDirection() != m_sortDirection) { markDead(); return MatchResults.DONE_OR_DEAD; } final List<AbstractExpression> moreBindings = ExpressionOrColumn.findBindingsForOneIndexedExpression(nextStatementEOC, indexEntry); if (moreBindings != null) { m_orderedMatchingExpressions.add(nextStatementEOC.m_expr); m_bindings.addAll(moreBindings); m_unmatchedOrderByExprs.removeAll(Collections.singleton(nextStatementEOC)); return MatchResults.MATCHED; } else { assert 0 <= indexEntry.m_indexKeyComponentPosition; if (isWindowFunction()) { markDead(); return MatchResults.DONE_OR_DEAD; } else { return MatchResults.POSSIBLE_ORDER_SPOILER; } } } }
Source:
<code>public XWikiAttachment setAttachment(XWikiAttachment attachment) { attachment.setDoc(this); <START> XWikiAttachmentList list = getAttachmentList(); <END> XWikiAttachment currentAttachment = list.getByFilename(attachment.getFilename()); list.set(attachment); return currentAttachment; }</code><technical_language>need for this step, this.attachmentList directly</technical_language>

Target:
public XWikiAttachment setAttachment(XWikiAttachment attachment) { return this.attachmentList.set(attachment); }
Source:
<code>protected Class<?> getCommandType() { <START> return IChangeReverseMethodHandler.class; <END> }</code><technical_language>This class is meant allow 'retarget' a target. If done already, change longer find class. leave line returning IReverseToggleHandler</technical_language>

Target:
protected Class<?> getCommandType() { return IReverseToggleHandler.class; }
Source:
<code>public void start(Xid xid, int flags) throws XAException { <START> log.infof("start xid: [%s], flags: %s", xid, flags); <END> }</code><technical_language>tracef</technical_language>

Target:
public void start(Xid xid, int flags) throws XAException { log.tracef("start xid: [%s], flags: %s", xid, flags); }
Source:
<code>private void assertMapper(Optional<RowMapper<?>> mapper, Tuple expected) throws SQLException { assertTrue(mapper.isPresent()); assertThat(mapper.get(), isA(RowMapper.class)); <START> assertThat(mapper.get().map(null, null), is(expected)); <END> }</code><technical_language>In AssertJ: java assertThat(mapper) .containsInstanceOf(RowMapper.class) .map(m -> m.map(null, null)).hasValue(expected);</technical_language>

Target:
private void assertMapper(Optional<RowMapper<?>> mapper, Tuple expected) throws SQLException { assertThat(mapper.isPresent()); assertThat(mapper.get()).isInstanceOf(RowMapper.class); assertThat(mapper.get().map(null, null)).isEqualTo(expected); }
Source:
<code>public final void configure(final MapperFactory mapperFactory) { <START> mapperFactory.getConverterFactory().registerConverter(new AlarmRegisterConverter()); <END> mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(ActualMeterReadsConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(ActualMeterReadsGasConverter.class)); mapperFactory.getConverterFactory().registerConverter(new PeriodicMeterReadsRequestConverter()); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(PeriodicMeterReadsResponseConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(PeriodicMeterReadsGasResponseConverter.class)); mapperFactory.getConverterFactory().registerConverter(new AmrProfileStatusCodeConverter()); }</code><technical_language>Suggestion: I nice beans in this mapper, consistent</technical_language>

Target:
public final void configure(final MapperFactory mapperFactory) { mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(AlarmRegisterConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(ActualMeterReadsConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(ActualMeterReadsGasConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(PeriodicMeterReadsRequestConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(PeriodicMeterReadsResponseConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(PeriodicMeterReadsGasResponseConverter.class)); mapperFactory.getConverterFactory().registerConverter( this.applicationContext.getBean(AmrProfileStatusCodeConverter.class)); }
Source:
<code>public ZombieType getType() { <START> return type; <END> }</code><technical_language>this</technical_language>

Target:
private ZombieType getType() { return this.type; }
Source:
<code>private ClassName(List<String> names) { for (int i = 1; i < names.size(); i++) { checkArgument(SourceVersion.isName(names.get(i)), "part '%s' is keyword", names.get(i)); } this.names = Util.immutableList(names); <START> this.canonicalName = (names.get(0) == null || names.get(0).isEmpty()) <END> ? Util.join(".", names.subList(1, names.size())) : Util.join(".", names); }</code><technical_language>Eep, null happen? figure out coming replace ""</technical_language>

Target:
private ClassName(List<String> names) { for (int i = 1; i < names.size(); i++) { checkArgument(SourceVersion.isName(names.get(i)), "part '%s' is keyword", names.get(i)); } this.names = Util.immutableList(names); this.canonicalName = names.get(0).isEmpty() ? Util.join(".", names.subList(1, names.size())) : Util.join(".", names); }
Source:
<code>private void _preparePeriod() { Clock pc = getClock(Clock.ID_PERIOD); Clock jc = getClock(Clock.ID_JAM); requestBatchStart(); set(Value.CURRENT_PERIOD, getOrCreatePeriod(getCurrentPeriodNumber()+1)); if (getRulesets().getBoolean(Rule.JAM_NUMBER_PER_PERIOD)) { getUpcomingJam().set(IValue.NUMBER, 1, Flag.INTERNAL); scoreBoardChange(new ScoreBoardEvent(jc,Clock.Value.NUMBER, 0, jc.getNumber())); } pc.resetTime(); jc.resetTime(); restartPcAfterTimeout = false; for (ValueWithId t : getAll(Child.TEAM)) { <START> ((Team)t).recountTimeouts(); <END> } requestBatchEnd(); }</code><technical_language>Hmm, this happen automatically a changedValue</technical_language>

Target:
private void _preparePeriod() { Clock pc = getClock(Clock.ID_PERIOD); Clock jc = getClock(Clock.ID_JAM); requestBatchStart(); set(Value.CURRENT_PERIOD, getOrCreatePeriod(getCurrentPeriodNumber()+1)); if (getRulesets().getBoolean(Rule.JAM_NUMBER_PER_PERIOD)) { getUpcomingJam().set(IValue.NUMBER, 1, Flag.INTERNAL); scoreBoardChange(new ScoreBoardEvent(jc,Clock.Value.NUMBER, 0, jc.getNumber())); } pc.resetTime(); jc.resetTime(); restartPcAfterTimeout = false; requestBatchEnd(); }
Source:
<code>private static List<String> list(String... values) { <START> return new LinkedList<>(Arrays.asList(values)); <END> }</code><technical_language>this improved Arrays.asList(values)</technical_language>

Target:
private static List<String> list(String... values) { return Arrays.asList(values); }
Source:
<code>private boolean shouldRefresh(EObject instance) { boolean shouldRefresh = instance != null && part.isActive() && part.resolveSemanticElement() instanceof DSemanticDecorator; DSemanticDecorator semanticDecorator = (DSemanticDecorator) part.resolveSemanticElement(); <START> EObject target = semanticDecorator.getTarget(); <END> boolean isConcerningEditPart = shouldRefresh && (instance.equals(target) || instance.equals(semanticDecorator)); boolean isConcerningDiagramEditPart = shouldRefresh && semanticDecorator instanceof DDiagramElement && target != null && instance.equals(((DDiagramElement) semanticDecorator).getParentDiagram()); return shouldRefresh && (isConcerningEditPart || isConcerningDiagramEditPart); }</code><technical_language>Warning: if shouldRefresh is false call part.resolveSemanticElement() exception if EditPart is active. move variables init conditions in a if block</technical_language>

Target:
private boolean shouldRefresh(EObject instance) { boolean shouldRefresh = instance != null && part.isActive() && part.resolveSemanticElement() instanceof DSemanticDecorator; if (shouldRefresh) { DSemanticDecorator semanticDecorator = (DSemanticDecorator) part.resolveSemanticElement(); EObject target = semanticDecorator.getTarget(); boolean isConcerningEditPart = instance.equals(target) || instance.equals(semanticDecorator); boolean isConcerningDiagramEditPart = semanticDecorator instanceof DDiagramElement && target != null && instance.equals(((DDiagramElement) semanticDecorator).getParentDiagram()); shouldRefresh = isConcerningEditPart || isConcerningDiagramEditPart; } return shouldRefresh; }
Source:
<code>public void initialize() throws InitializationException { boqa = new BOQA(); boqa.setConsiderFrequenciesOnly(false); boqa.setPrecalculateScoreDistribution(false); boqa.setCacheScoreDistribution(false); boqa.setPrecalculateItemMaxs(false); boqa.setPrecalculateMaxICs(false); boqa.setMaxFrequencyTerms(2); boqa.setPrecalculateJaccard(false); GlobalPreferences.setProxyPort(888); <START> GlobalPreferences.setProxyHost("realproxy.charite.de"); <END> String annotationPath = null; String ontologyPath = null; try { annotationPath = stream2file(BOQA.class.getClassLoader().getResourceAsStream("new_phenotype.gz")).getPath(); ontologyPath = stream2file(BOQA.class.getClassLoader().getResourceAsStream("hp.obo.gz")).getPath(); } catch (IOException e) { throw new InitializationException(e.getMessage()); } Datafiles df = null; try { df = new Datafiles(ontologyPath, annotationPath); } catch (InterruptedException e) { throw new InitializationException(e.getMessage()); } catch (IOException e) { throw new InitializationException(e.getMessage()); } boqa.setup(df.graph, df.assoc); Set<Map.Entry<ByteString, Integer>> omimtonum = boqa.item2Index.entrySet(); this.omimMap = new HashMap<Integer, ByteString>(omimtonum.size()); for (Map.Entry<ByteString, Integer> item : omimtonum) { this.omimMap.put(item.getValue(), item.getKey()); } }</code><technical_language>this is right..</technical_language>

Target:
public void initialize() throws InitializationException { boqa = new BOQA(); boqa.setConsiderFrequenciesOnly(false); boqa.setPrecalculateScoreDistribution(false); boqa.setCacheScoreDistribution(false); boqa.setPrecalculateItemMaxs(false); boqa.setPrecalculateMaxICs(false); boqa.setMaxFrequencyTerms(2); boqa.setPrecalculateJaccard(false); String annotationPath = null; String ontologyPath = null; try { annotationPath = stream2file(BOQA.class.getClassLoader().getResourceAsStream("new_phenotype.gz")).getPath(); ontologyPath = stream2file(BOQA.class.getClassLoader().getResourceAsStream("hp.obo.gz")).getPath(); } catch (IOException e) { throw new InitializationException(e.getMessage()); } Datafiles df = null; try { df = new Datafiles(ontologyPath, annotationPath); } catch (InterruptedException e) { throw new InitializationException(e.getMessage()); } catch (IOException e) { throw new InitializationException(e.getMessage()); } boqa.setup(df.graph, df.assoc); Set<Map.Entry<ByteString, Integer>> omimtonum = boqa.item2Index.entrySet(); this.omimMap = new HashMap<Integer, ByteString>(omimtonum.size()); for (Map.Entry<ByteString, Integer> item : omimtonum) { this.omimMap.put(item.getValue(), item.getKey()); } }
Source:
<code>protected void setCanceled(boolean canceled) { this.canceled = canceled; if (this.canceled) { setReregistrationHandle(null); } <START> if (this.canceled && notificationListener != null) { <END> endpoint.removeNotificationListener(notificationListener); } }</code><technical_language>Move lines of existing if (this.canceled) { setRegistrationhandle(null) } block</technical_language>

Target:
protected void setCanceled(boolean canceled) { this.canceled = canceled; if (this.canceled) { setReregistrationHandle(null); if (notificationListener != null) { endpoint.removeNotificationListener(notificationListener); } } }
Source:
<code>public void onMetricMsg(final String srcId, final MetricMsg metricMsg) { if (metricMsg.getTableToNumBlocks().isEmpty()) { return; } if (isServerMetrics(metricMsg)) { final String hostname = metricMsg.getHostname(); final ServerMetrics serverMetrics = ServerMetrics.newBuilder() .setNumModelBlocks(metricMsg.getTableToNumBlocks().getOrDefault(MODEL_TABLE_ID, 0)) .setHostname(hostname) .build(); <START> metricManager.storeServerMetrics(srcId, serverMetrics); <END> } else { processWorkerMetrics(srcId, metricMsg); } }</code><technical_language>introduce a method processServerMetrics() processWorkerMetrics()</technical_language>

Target:
public void onMetricMsg(final String srcId, final MetricMsg metricMsg) { if (metricMsg.getTableToNumBlocks().isEmpty()) { return; } if (isServerMetrics(metricMsg)) { processServerMetrics(srcId, metricMsg); } else { processWorkerMetrics(srcId, metricMsg); } }
Source:
<code>public static DocumentModel moveContentToColdStorage(CoreSession session, DocumentRef documentRef) { DocumentModel documentModel = session.getDocument(documentRef); Serializable mainContent = documentModel.getPropertyValue(FILE_CONTENT_PROPERTY); log.debug("Move to cold storage the main content of document: {}", documentModel); if (!session.getPrincipal().isAdministrator() <START> && !session.hasPermission(documentRef, SecurityConstants.WRITE_COLD_STORAGE)) { <END> throw new NuxeoException(String.format("The document cannot be moved to cold storage", documentRef), SC_FORBIDDEN); } else if (documentModel.hasFacet(FacetNames.COLD_STORAGE) && documentModel.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY) != null) { throw new NuxeoException( String.format("The main content for document: %s is already in cold storage.", documentModel), SC_CONFLICT); } else if (mainContent == null) { throw new NuxeoException(String.format("There is no main content for document: %s.", documentModel), SC_NOT_FOUND); } documentModel.addFacet(FacetNames.COLD_STORAGE); documentModel.setPropertyValue(COLD_STORAGE_CONTENT_PROPERTY, mainContent); documentModel.setPropertyValue(FILE_CONTENT_PROPERTY, null); return documentModel; }</code><technical_language>need check session.getPrincipal().isAdministrator(), hasPermission takes administrators account</technical_language>

Target:
public static DocumentModel moveContentToColdStorage(CoreSession session, DocumentRef documentRef) { DocumentModel documentModel = session.getDocument(documentRef); log.debug("Move to cold storage the main content of document: {}", documentModel); if (!session.hasPermission(documentRef, SecurityConstants.WRITE_COLD_STORAGE)) { log.debug("The user does not have the right permissions to move the content of document {}", session::getPrincipal, () -> documentModel); throw new NuxeoException(String.format("The document: %s cannot be moved to cold storage", documentRef), SC_FORBIDDEN); } if (documentModel.hasFacet(FacetNames.COLD_STORAGE) && documentModel.getPropertyValue(COLD_STORAGE_CONTENT_PROPERTY) != null) { throw new NuxeoException( String.format("The main content for document: %s is already in cold storage.", documentModel), SC_CONFLICT); } Serializable mainContent = documentModel.getPropertyValue(FILE_CONTENT_PROPERTY); if (mainContent == null) { throw new NuxeoException(String.format("There is no main content for document: %s.", documentModel), SC_NOT_FOUND); } documentModel.addFacet(FacetNames.COLD_STORAGE); documentModel.setPropertyValue(COLD_STORAGE_CONTENT_PROPERTY, mainContent); documentModel.setPropertyValue(FILE_CONTENT_PROPERTY, null); return documentModel; }
Source:
<code>public boolean containsOperator(final CigarOperator operator) { <START> for(final CigarElement cigarElement : this.cigarElements) { <END> if( cigarElement.getOperator() == operator) return true; } return false; }</code><technical_language>care java8-ify this function? cigarElements.stream().anyMatch(el->el.getOperator()==op);</technical_language>

Target:
public boolean containsOperator(final CigarOperator operator) { return this.cigarElements.stream().anyMatch( element -> element.getOperator() == operator); }
Source:
<code>static Expr parse(String in, ExprMacroTable macroTable, boolean withFlatten) { <START> if (log.isDebugEnabled()) { <END> log.debug("parse expression [" + in + "]"); } ExprLexer lexer = new ExprLexer(new ANTLRInputStream(in)); CommonTokenStream tokens = new CommonTokenStream(lexer); ExprParser parser = new ExprParser(tokens); parser.setBuildParseTree(true); ParseTree parseTree = parser.expr(); ParseTreeWalker walker = new ParseTreeWalker(); ExprListenerImpl listener = new ExprListenerImpl(parseTree, macroTable); walker.walk(listener, parseTree); return withFlatten ? flatten(listener.getAST()) : listener.getAST(); }</code><technical_language>log.debug(..) this check , string format instead of string concatenation remove this check</technical_language>

Target:
static Expr parse(String in, ExprMacroTable macroTable, boolean withFlatten) { ExprLexer lexer = new ExprLexer(new ANTLRInputStream(in)); CommonTokenStream tokens = new CommonTokenStream(lexer); ExprParser parser = new ExprParser(tokens); parser.setBuildParseTree(true); ParseTree parseTree = parser.expr(); ParseTreeWalker walker = new ParseTreeWalker(); ExprListenerImpl listener = new ExprListenerImpl(parseTree, macroTable); walker.walk(listener, parseTree); return withFlatten ? flatten(listener.getAST()) : listener.getAST(); }
Source:
<code>private void createConstructorAndBuilder() { List<ExecutableElement> constructors = new ArrayList<>(); for (Element e : annotatedElement.getEnclosedElements()) { if (e.getKind() == CONSTRUCTOR) { constructors.add((ExecutableElement) e); } } for (ExecutableElement userConstructor : constructors) { JMethod copyConstructor = generatedClass.constructor(PUBLIC); JMethod staticHelper = generatedClass.method(PUBLIC | STATIC, generatedClass._extends(), "build"); codeModelHelper.generify(staticHelper, getAnnotatedElement()); JBlock body = copyConstructor.body(); JInvocation superCall = body.invoke("super"); AbstractJClass narrowedGeneratedClass = narrow(generatedClass); JInvocation newInvocation = JExpr._new(narrowedGeneratedClass); for (VariableElement param : userConstructor.getParameters()) { String paramName = param.getSimpleName().toString(); AbstractJClass paramType = codeModelHelper.typeMirrorToJClass(param.asType()); copyConstructor.param(paramType, paramName); staticHelper.param(paramType, paramName); superCall.arg(JExpr.ref(paramName)); newInvocation.arg(JExpr.ref(paramName)); } JVar newCall = staticHelper.body().decl(narrowedGeneratedClass, "instance", newInvocation); <START> OnFinishInflateCallBlock callBlock = new OnFinishInflateCallBlock(staticHelper.body().blockSimple(), body.blockSimple(), newCall); <END> staticHelper.body()._return(newCall); onFinishInflateCallBlock.add(callBlock); } }</code><technical_language>I blockVirtual() avoid unnecessary braces blocks</technical_language>

Target:
private void createConstructorAndBuilder() { List<ExecutableElement> constructors = new ArrayList<>(); for (Element e : annotatedElement.getEnclosedElements()) { if (e.getKind() == CONSTRUCTOR) { constructors.add((ExecutableElement) e); } } for (ExecutableElement userConstructor : constructors) { JMethod copyConstructor = generatedClass.constructor(PUBLIC); JMethod staticHelper = generatedClass.method(PUBLIC | STATIC, generatedClass._extends(), "build"); codeModelHelper.generify(staticHelper, getAnnotatedElement()); JBlock body = copyConstructor.body(); JInvocation superCall = body.invoke("super"); AbstractJClass narrowedGeneratedClass = narrow(generatedClass); JInvocation newInvocation = JExpr._new(narrowedGeneratedClass); for (VariableElement param : userConstructor.getParameters()) { String paramName = param.getSimpleName().toString(); AbstractJClass paramType = codeModelHelper.typeMirrorToJClass(param.asType()); copyConstructor.param(paramType, paramName); staticHelper.param(paramType, paramName); superCall.arg(JExpr.ref(paramName)); newInvocation.arg(JExpr.ref(paramName)); } JVar newCall = staticHelper.body().decl(narrowedGeneratedClass, "instance", newInvocation); OnFinishInflateCallBlock callBlock = new OnFinishInflateCallBlock(staticHelper.body().blockVirtual(), newCall); onFinishInflateCallBlocks.add(callBlock); staticHelper.body()._return(newCall); body.invoke(getInit()); } }
Source:
<code>protected void onHandleIntent(Intent intent) { SharedPreferences prefs; boolean bg_missed_alerts; Context context; int bg_missed_minutes; context = getApplicationContext(); prefs = PreferenceManager.getDefaultSharedPreferences(context); bg_missed_alerts = prefs.getBoolean("bg_missed_alerts", false); bg_missed_minutes = Integer.parseInt(prefs.getString("bg_missed_minutes", "30")); otherAlertSnooze = Integer.parseInt(prefs.getString("other_alerts_snooze", "20")); long now = new Date().getTime(); if (!bg_missed_alerts) { Log.d(TAG, "Setting timer to 5 minutes from now" ); <START> checkBackAfterMissedTime(now + 5 * 60 *1000); <END> return; } if (BgReading.getTimeSinceLastReading() >= (bg_missed_minutes * 1000 * 60) && prefs.getLong("alerts_disabled_until", 0) <= now) { Notifications.bgMissedAlert(context); checkBackAfterSnoozeTime(); } else { long disabletime = prefs.getLong("alerts_disabled_until", 0) - now; long missedTime = Long.parseLong(prefs.getString("bg_missed_minutes", "30"))* 1000 * 60 - BgReading.getTimeSinceLastReading(); long alarmIn = Math.max(disabletime, missedTime); Log.d(TAG, "Setting timer to " + alarmIn / 60000 + " minutes from now" ); checkBackAfterMissedTime(alarmIn); } }</code><technical_language>parameter of checkBackAfterMissedTime "in time check occur" , "when" If call + 5 \* 6 \* 1000, alarm set calendar.getTimeInMillis() + + 5 \* 6 \* 1000 checkBackAfterMissedTime(5 \* 60 *1000);</technical_language>

Target:
protected void onHandleIntent(Intent intent) { SharedPreferences prefs; boolean bg_missed_alerts; Context context; int bg_missed_minutes; context = getApplicationContext(); prefs = PreferenceManager.getDefaultSharedPreferences(context); bg_missed_alerts = prefs.getBoolean("bg_missed_alerts", false); bg_missed_minutes = Integer.parseInt(prefs.getString("bg_missed_minutes", "30")); otherAlertSnooze = Integer.parseInt(prefs.getString("other_alerts_snooze", "20")); long now = new Date().getTime(); Log.d(TAG, "MissedReadingService onHandleIntent"); if (!bg_missed_alerts) { return; } if (BgReading.getTimeSinceLastReading() >= (bg_missed_minutes * 1000 * 60) && prefs.getLong("alerts_disabled_until", 0) <= now) { Notifications.bgMissedAlert(context); checkBackAfterSnoozeTime(now); } else { long disabletime = prefs.getLong("alerts_disabled_until", 0) - now; long missedTime = bg_missed_minutes* 1000 * 60 - BgReading.getTimeSinceLastReading(); long alarmIn = Math.max(disabletime, missedTime); checkBackAfterMissedTime(alarmIn); } }
Source:
<code>public void shouldClearLocations() throws Exception { double[] loc1 = { 1.0, 2.0 }; double[] loc2 = { 3.0, 4.0 }; double[] loc3 = { 5.0, 6.0 }; Router router = Router.getRouter() .setLocation(loc1) .setLocation(loc2); router.clearLocations(); router.setLocation(loc2); router.setLocation(loc3); URL url = router.getRouteUrl(); assertThat(url.toString()).doesNotContain("1.0,2.0"); assertThat(url.toString()).contains("3.0,4.0"); <START> } <END></code><technical_language>Minor note, assert for loc3 for sake of completeness? assertThat(url.toString()).contains("5.0,6.0");</technical_language>

Target:
public void shouldClearLocations() throws Exception { double[] loc1 = { 1.0, 2.0 }; double[] loc2 = { 3.0, 4.0 }; double[] loc3 = { 5.0, 6.0 }; Router router = Router.getRouter() .setLocation(loc1) .setLocation(loc2); router.clearLocations(); router.setLocation(loc2); router.setLocation(loc3); URL url = router.getRouteUrl(); assertThat(url.toString()).doesNotContain("1.0,2.0"); assertThat(url.toString()).contains("3.0,4.0"); assertThat(url.toString()).contains("5.0,6.0"); }
Source:
<code>public boolean checkSpriteReplaceInBackpack(List<Sprite> currentSpriteList) { <START> boolean spritesAlreadyInBackpack; <END> for (Sprite sprite : currentSpriteList) { spritesAlreadyInBackpack = checkSpriteReplaceInBackpack(sprite); if (spritesAlreadyInBackpack) { return true; } } return false; }</code><technical_language>Please inline remove</technical_language>

Target:
public boolean checkSpriteReplaceInBackpack(List<Sprite> currentSpriteList) { for (Sprite sprite : currentSpriteList) { if (checkSpriteReplaceInBackpack(sprite)) { return true; } } return false; }
Source:
<code>protected void appendFieldStart(StringBuffer buffer, String fieldName) { if (fieldName == null) { <START> throw new UnsupportedOperationException("FieldName cannot be null"); <END> } super.appendFieldStart(buffer, FIELD_NAME_PREFIX + fieldName + FIELD_NAME_PREFIX); }</code><technical_language>easier debug if change message "Field names mandatory JsonToStringStyle"</technical_language>

Target:
protected void appendFieldStart(StringBuffer buffer, String fieldName) { if (fieldName == null) { throw new UnsupportedOperationException( "Field names are mandatory when using JsonToStringStyle"); } super.appendFieldStart(buffer, FIELD_NAME_PREFIX + fieldName + FIELD_NAME_PREFIX); }
Source:
<code>public void notAddChildren() throws Exception { JenkinsRule.WebClient client = r.createWebClient(); SampleComputedFolder s = r.jenkins.createProject(SampleComputedFolder.class, "s"); <START> assertThat(client.getPage(s).getByXPath(" END> s.kids.add("A"); s.recompute(Result.SUCCESS); assertThat(client.getPage(s).getByXPath(" }</code><technical_language>assertEquals suffices</technical_language>

Target:
public void notAddChildren() throws Exception { JenkinsRule.WebClient client = r.createWebClient(); SampleComputedFolder s = r.jenkins.createProject(SampleComputedFolder.class, "s"); assertEquals(client.getPage(s).getByXPath(" s.kids.add("A"); s.recompute(Result.SUCCESS); assertEquals(client.getPage(s).getByXPath(" }
Source:
<code>public void process(CAS cas) { <START> double[] result = <END> mCategorizer.categorize(WhitespaceTokenizer.INSTANCE.tokenize(cas.getDocumentText())); String bestCategory = mCategorizer.getBestCategory(result); setBestCategory(cas, bestCategory); }</code><technical_language>CAS tokens, passed categorize method</technical_language>

Target:
public void process(CAS cas) { FSIterator<AnnotationFS> tokenAnnotations = cas.getAnnotationIndex(mTokenType).iterator(); List<String> tokensList = new ArrayList<>(); while (tokenAnnotations.hasNext()) { tokensList.add(tokenAnnotations.next().getCoveredText()); } double[] result = mCategorizer.categorize(tokensList.toArray(new String[tokensList.size()])); String bestCategory = mCategorizer.getBestCategory(result); setBestCategory(cas, bestCategory); }
Source:
<code>public void setQueueNames(String... queueName) { Assert.noNullElements(queueName, "Queue name(s) cannot be null"); setQueues(Arrays.stream(queueName) .map(n -> new Queue(n)) .collect(Collectors.toList()) <START> .toArray(new Queue[0])); <END> }</code><technical_language>guys, replaced a single toArray(Queue[]::new) map() a method reference: map(Queue::new)</technical_language>

Target:
public void setQueueNames(String... queueName) { Assert.noNullElements(queueName, "Queue name(s) cannot be null"); setQueues(Arrays.stream(queueName) .map(n -> new Queue(n)) .toArray(Queue[]::new)); }
Source:
<code><START> public ResponseEntity<Object> getResponseForException(OpenClinicaSystemException e, String studyOid, String siteOid) { <END> String errorMsg = e.getErrorCode(); HashMap<String, String> map = new HashMap<>(); map.put("studyOid", studyOid); map.put("siteOid", siteOid); org.akaza.openclinica.service.rest.errors.ParameterizedErrorVM responseDTO = new ParameterizedErrorVM(errorMsg, map); return new ResponseEntity(responseDTO, HttpStatus.BAD_REQUEST); }</code><technical_language>If possible, move this a common controller</technical_language>

Target:
public ParameterizedErrorVM getResponseForException(OpenClinicaSystemException e, String studyOid, String siteOid) { String errorMsg = e.getErrorCode(); HashMap<String, String> map = new HashMap<>(); map.put("studyOid", studyOid); map.put("siteOid", siteOid); return new ParameterizedErrorVM(errorMsg, map); }