auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void persistTimer() { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); try { transactionManager.begin(); timerPersistence.getValue().persistTimer(timer); transactionManager.commit(); } catch (Exception e) { try { transactionManager.rollback(); } catch (Exception ee) { } EJB3_TIMER_LOGGER.exceptionRunningTimerTask(timer, timer.getTimedObjectId(), e); Date nextExpiration = timer.getNextExpiration(); if( nextExpiration != null ){ int max = 10; <START> String pMax = System.getProperty("jboss.timer.TaskPostPersist.maxRetry"); <END> if( pMax != null ) { try { max = Integer.parseInt(pMax); } catch (NumberFormatException nfe ){ } } if( triesCounter++ < max ) { long nextTryDelay = nextExpiration.getTime() - System.currentTimeMillis() / 5; if (nextTryDelay <= 0 || nextTryDelay > 60000L) nextTryDelay = 5000L; timerInjectedValue.getValue().schedule( new TaskPostPersist(timer, triesCounter), nextTryDelay); } else { EJB3_TIMER_LOGGER.exceptionPersistPostTimerState(timer, e); } } } }</code><technical_language>This a static constant, get read time. Integer.getInteger()</technical_language>

Target:
void persistTimer() { final ContextTransactionManager transactionManager = ContextTransactionManager.getInstance(); try { transactionManager.begin(); timerPersistence.getValue().persistTimer(timer); transactionManager.commit(); } catch (Exception e) { try { transactionManager.rollback(); } catch (Exception ee) { } EJB3_TIMER_LOGGER.exceptionPersistTimerState(timer, e); long nextExpirationDelay; if (nextExpirationPristine > 0 && timer.timerState != TimerState.RETRY_TIMEOUT && (nextExpirationDelay = nextExpirationPristine - System.currentTimeMillis()) > delta) { if (delta == 0L) { delta = nextExpirationDelay / (1L + MAX_RETRY.longValue()); } timerInjectedValue .getValue() .schedule(new TaskPostPersist(timer, delta, nextExpirationPristine), delta); } else { EJB3_TIMER_LOGGER.exceptionPersistPostTimerState(timer, e); } } }
Source:
<code>@Test void testEqualAsMapSansNullability() { final SqlTypeFactoryImpl factory = new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT); <START> final RelDataType bigint = factory.createSqlType(SqlTypeName.BIGINT); <END> final RelDataType mapNullable = new MapSqlType(factory.createTypeWithNullability(bigint, true), factory.createTypeWithNullability(bigint, false), false); final RelDataType mapNotNull = new MapSqlType(factory.createTypeWithNullability(bigint, false), factory.createTypeWithNullability(bigint, true), false); assertThat(equalAsMapSansNullability(factory, mapNullable, mapNotNull), is(true)); }</code><technical_language>type SqlTypeFixture if possible</technical_language>

Target:
@Test void testEqualAsMapSansNullability() { assertThat( equalAsMapSansNullability(f.typeFactory, f.mapOfInt, f.mapOfIntNullable), is(true)); }
Source:
<code>private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) { json.prop("key", component.getKey()) .prop("organization", organizationDto.getKey()) .prop("id", component.uuid()) .prop("name", component.name()) .prop("description", component.description()) .prop("isFavorite", isFavourite(session, component)); String branch = component.getBranch(); if (branch != null) { <START> json.prop(PARAM_BRANCH, branch); <END> } if (QUALIFIERS_WITH_VISIBILITY.contains(component.qualifier())) { json.prop("visibility", Visibility.getLabel(component.isPrivate())); } List<Page> pages = pageRepository.getComponentPages(false, component.qualifier()); writeExtensions(json, component, pages); if (analysis != null) { json.prop("version", analysis.getProjectVersion()) .prop("analysisDate", formatDateTime(new Date(analysis.getCreatedAt()))); } }</code><technical_language>reuse constant</technical_language>

Target:
private void writeComponent(JsonWriter json, DbSession session, ComponentDto component, OrganizationDto organizationDto, @Nullable SnapshotDto analysis) { json.prop("key", component.getKey()) .prop("organization", organizationDto.getKey()) .prop("id", component.uuid()) .prop("name", component.name()) .prop("description", component.description()) .prop("isFavorite", isFavourite(session, component)); String branch = component.getBranch(); if (branch != null) { json.prop("branch", branch); } if (QUALIFIERS_WITH_VISIBILITY.contains(component.qualifier())) { json.prop("visibility", Visibility.getLabel(component.isPrivate())); } List<Page> pages = pageRepository.getComponentPages(false, component.qualifier()); writeExtensions(json, component, pages); if (analysis != null) { json.prop("version", analysis.getProjectVersion()) .prop("analysisDate", formatDateTime(new Date(analysis.getCreatedAt()))); } }
Source:
<code>public void shouldDeleteNetworkToPublicRouter() throws OpenStackException, InfrastructureException { String response = "{\"ports\": [ {\"status\": \"ACTIVE\",\"name\": \"\", \"admin_state_up\": true, \"network_id\": " + "\"6a609412-3f04-485c-b269-b1a9b9ecb6bf\", \"tenant_id\": \"08bed031f6c54c9d9b35b42aa06b51c0\",\"binding:vif_type\": \"ovs\"," + "\"device_owner\": \"network:dhcp\", \"binding:capabilities\": {\"port_filter\": true}, \"mac_address\": \"fa:16:3e:54:1a:40\"," + "\"fixed_ips\": [ {\"subnet_id\": \"601ec829-a166-4b39-9c74-166cc76f251b\", \"ip_address\": \"172.31.0.3\"}]," <START> + "\"id\": \"07fd27d2-9ce1-48f3-be83-c7d2b7041a1a\", \"security_groups\": [], \"device_id\": \"dhcpfa3e6aae-2140-5176-877a-2f67684a3165-6a609412-3f04-485c-b269-b1a9b9ecb6bf\"" <END> + "}]}"; when(openStackUtil.listPorts(any(PaasManagerUser.class), anyString())).thenReturn(response); NetworkInstance net = new NetworkInstance("router", "vdc", "region"); SubNetworkInstance subNet = new SubNetworkInstance("dd", "vdc", "region", "ID"); subNet.setIdSubNet("ID"); net.addSubNet(subNet); when(openStackUtil.deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString())).thenReturn(response); openStackNetworkImpl.deleteNetworkToPublicRouter(claudiaData, net, REGION); verify(openStackUtil).deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString()); }</code><technical_language>line > 120 chars</technical_language>

Target:
public void shouldDeleteNetworkToPublicRouter() throws OpenStackException, InfrastructureException { String response = "{\"ports\": [ {\"status\": \"ACTIVE\",\"name\": \"\", \"admin_state_up\": true, " + "\"network_id\": \"ID2\", \"tenant_id\": \"08bed031f6c54c9d9b35b42aa06b51c0\"," + "\"device_owner\": \"compute:None\", \"binding:capabilities\": {\"port_filter\": true}, " + "\"fixed_ips\": [ {\"subnet_id\": \"ID2\", \"ip_address\": \"172.31.0.3\"}]," + "\"id\": \"07fd27d2-9ce1-48f3-be83-c7d2b7041a1a\", \"security_groups\": [], \"device_id\":" + " \"dhcpfa3e6aae-2140-5176-877a-2f67684a3165-6a609412-3f04-485c-b269-b1a9b9ecb6bf\"" + "}]}"; when(openStackUtil.listPorts(any(PaasManagerUser.class), anyString())).thenReturn(response); NetworkInstance net = new NetworkInstance("router", "vdc", "region"); SubNetworkInstance subNet = new SubNetworkInstance("dd", "vdc", "region", "ID"); subNet.setIdSubNet("ID"); net.addSubNet(subNet); when(openStackUtil.deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString())).thenReturn(response); openStackNetworkImpl.deleteNetworkToPublicRouter(claudiaData, net, REGION); verify(openStackUtil).deleteInterfaceToPublicRouter(any(PaasManagerUser.class), any(NetworkInstance.class), anyString()); }
Source:
<code>public void onStatusChanged(ManagerTypes managerType, ManagerStates state) { if (managerType.equals(ManagerTypes.deviceStatusManager)) { switch (state) { <START> case initialasing: <END> this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_PENDING, "Building digitalSTROM model."); break; case running: if (!getThing().getStatus().equals(ThingStatus.ONLINE)) { setStatus(ThingStatus.ONLINE); } break; case stopped: if (!getThing().getStatusInfo().equals(ThingStatusDetail.COMMUNICATION_ERROR) || !getThing().getStatusInfo().equals(ThingStatusDetail.CONFIGURATION_ERROR)) { this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Status-Manager is stopped."); } break; default: break; } } if (managerType.equals(ManagerTypes.sceneManager)) { switch (state) { case generatingScenes: generatingScenes = true; break; case scenesGenerated: if (unregisterSceneStatusListeners != null) { for (SceneStatusListener sceneListener : this.unregisterSceneStatusListeners) { sceneMan.registerSceneListener(sceneListener); } } if (sceneListener != null) { for (SceneStatusListener sceneListener : this.sceneListener) { sceneMan.registerSceneListener(sceneListener); } } generatingScenes = false; break; default: break; } } }</code><technical_language>typo: "initializing"</technical_language>

Target:
public void onStatusChanged(ManagerTypes managerType, ManagerStates state) { if (managerType.equals(ManagerTypes.DEVICE_STATUS_MANAGER)) { switch (state) { case INITIALIZING: logger.info("Building digitalSTROM model"); break; case RUNNING: if (devListener != null) { for (DeviceStatusListener deviceListener : devListener) { devStatMan.registerDeviceListener(deviceListener); } } setStatus(ThingStatus.ONLINE); break; case STOPPED: if (!getThing().getStatusInfo().equals(ThingStatusDetail.COMMUNICATION_ERROR) || !getThing().getStatusInfo().equals(ThingStatusDetail.CONFIGURATION_ERROR)) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "DeviceStatusManager is stopped."); } break; default: break; } } if (managerType.equals(ManagerTypes.SCENE_MANAGER)) { switch (state) { case GENERATING_SCENES: generatingScenes = true; break; case RUNNING: if (unregisterSceneStatusListeners != null) { for (SceneStatusListener sceneListener : this.unregisterSceneStatusListeners) { sceneMan.registerSceneListener(sceneListener); } } if (sceneListener != null) { for (SceneStatusListener sceneListener : this.sceneListener) { sceneMan.registerSceneListener(sceneListener); } } generatingScenes = false; break; default: break; } } }
Source:
<code>protected <T extends AppPage> T loginAdminToPage(AppUrl url, Class<T> typeOfPage) { if (!TestProperties.isDevServer()) { <START> return null; <END> } if (browser.isAdminLoggedIn) { browser.driver.get(url.toAbsoluteString()); try { return AppPage.getNewPageInstance(browser, typeOfPage); } catch (Exception e) { ignorePossibleException(); } } logout(); browser.driver.get(url.toAbsoluteString()); String adminUsername = TestProperties.TEST_ADMIN_ACCOUNT; String adminPassword = TestProperties.TEST_ADMIN_PASSWORD; String userId = url.get(Const.ParamsNames.USER_ID); if (userId != null) { adminUsername = userId; } LoginPage loginPage = AppPage.createCorrectLoginPageType(browser); loginPage.loginAsAdmin(adminUsername, adminPassword); return AppPage.getNewPageInstance(browser, typeOfPage); }</code><technical_language>this result in NPE</technical_language>

Target:
protected <T extends AppPage> T loginAdminToPage(AppUrl url, Class<T> typeOfPage) { if (!TestProperties.isDevServer()) { return AppPage.getNewPageInstance(browser, url, typeOfPage); } if (browser.isAdminLoggedIn) { browser.driver.get(url.toAbsoluteString()); try { return AppPage.getNewPageInstance(browser, typeOfPage); } catch (Exception e) { ignorePossibleException(); } } logout(); browser.driver.get(url.toAbsoluteString()); String adminUsername = TestProperties.TEST_ADMIN_ACCOUNT; String adminPassword = TestProperties.TEST_ADMIN_PASSWORD; String userId = url.get(Const.ParamsNames.USER_ID); if (userId != null) { adminUsername = userId; } LoginPage loginPage = AppPage.getNewPageInstance(browser, DevServerLoginPage.class); loginPage.loginAsAdmin(adminUsername, adminPassword); return AppPage.getNewPageInstance(browser, url, typeOfPage); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory) && Objects.equals(intermediateHandoffPeriod, that.intermediateHandoffPeriod) && Objects.equals(logParseExceptions, that.logParseExceptions) && Objects.equals(maxParseExceptions, that.maxParseExceptions) && <START> Objects.equals(maxSavedParseExceptions, that.maxSavedParseExceptions); <END> }</code><technical_language>New variables null</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } KafkaTuningConfig that = (KafkaTuningConfig) o; return maxRowsInMemory == that.maxRowsInMemory && maxRowsPerSegment == that.maxRowsPerSegment && maxPendingPersists == that.maxPendingPersists && reportParseExceptions == that.reportParseExceptions && handoffConditionTimeout == that.handoffConditionTimeout && resetOffsetAutomatically == that.resetOffsetAutomatically && Objects.equals(intermediatePersistPeriod, that.intermediatePersistPeriod) && Objects.equals(basePersistDirectory, that.basePersistDirectory) && Objects.equals(indexSpec, that.indexSpec) && Objects.equals(segmentWriteOutMediumFactory, that.segmentWriteOutMediumFactory) && Objects.equals(intermediateHandoffPeriod, that.intermediateHandoffPeriod) && logParseExceptions == that.logParseExceptions && maxParseExceptions == that.maxParseExceptions && maxSavedParseExceptions == that.maxSavedParseExceptions; }
Source:
<code>protected boolean checkExistence(String uid) { if (templateRegistry != null && templateRegistry.get(uid) != null) { <START> logger.error("Rule Template with UID \"{}\" already exists! Failed to create a second with the same UID!", <END> uid, new IllegalArgumentException()); return true; } return false; }</code><technical_language>error logging is unexpected. A method checkExistence simply return true false side effects</technical_language>

Target:
protected boolean checkExistence(String uid) { if (templateRegistry != null && templateRegistry.get(uid) != null) { return true; } return false; }
Source:
<code>private static Syntax createEnumField(Field e) { String name = e.getName(); String lead = null; String example = null; Pattern pattern = Pattern.compile(Pattern.quote(e.getName())); SyntaxAnnotation sa = e.getAnnotation(SyntaxAnnotation.class); if (sa != null) { if (!sa.name() .isEmpty()) name = sa.name(); if (!sa.lead() .isEmpty()) lead = sa.lead(); if (!sa.example() .isEmpty()) example = sa.example(); if (!sa.pattern() .isEmpty()) <START> pattern = Pattern.compile(Pattern.quote(sa.pattern())); <END> } return new Syntax(name, lead, example, name, pattern); }</code><technical_language>Pattern.compile(sa.pattern(), Pattern.LITERAL)</technical_language>

Target:
private static Syntax createEnumField(Field e) { String name = e.getName(); String lead = null; String example = null; Pattern pattern = Pattern.compile(Pattern.quote(e.getName())); SyntaxAnnotation sa = e.getAnnotation(SyntaxAnnotation.class); if (sa != null) { if (!sa.name() .isEmpty()) name = sa.name(); if (!sa.lead() .isEmpty()) lead = sa.lead(); if (!sa.example() .isEmpty()) example = sa.example(); if (!sa.pattern() .isEmpty()) pattern = Pattern.compile(sa.pattern(), Pattern.LITERAL); } return new Syntax(name, lead, example, name, pattern); }
Source:
<code>public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); <START> description.addProperty("value",findMethod("getValue")); <END> description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue")); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addProperty("auditInfo", findMethod("getAuditInfo")); description.addSelfLink(); return description; } return null; }</code><technical_language>able description.addProperty("value", findMethod("getValue"), Representation.REF)</technical_language>

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { if (rep instanceof DefaultRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue"),Representation.REF); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addSelfLink(); description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); return description; } else if (rep instanceof FullRepresentation) { DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("display", findMethod("getDisplayString")); description.addProperty("uuid"); description.addProperty("value",findMethod("getValue")); description.addProperty("attributeType", Representation.REF); description.addProperty("voided"); description.addProperty("auditInfo", findMethod("getAuditInfo")); description.addSelfLink(); return description; } return null; }
Source:
<code>public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { <START> accessRecord(record, Clock.currentTimeMillis()); <END> } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); return mapServiceContext.toData(value); }</code><technical_language>accessRecord works concurrent access, is a lot of non-volatile non-atomic operations it. I assume intentional compromise good enough for stats, right</technical_language>

Target:
public Data readBackupData(Data key) { Record record = getRecord(key); if (record == null) { return null; } else { if (partitionService.isPartitionOwner(partitionId)) { record.setLastAccessTime(Clock.currentTimeMillis()); } } Object value = record.getValue(); mapServiceContext.interceptAfterGet(name, value); return mapServiceContext.toData(value); }
Source:
<code>public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = Collections.synchronizedList(new ArrayList<>()); AtomicReference<Throwable> throwable = new AtomicReference<>(); try { <START> cacheManager.executor().submitConsumer(m -> { <END> Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); category.map(c -> filter.and(queryFactory.having("category").eq(c))); level.map(l -> filter.and(queryFactory.having("level").eq(l))); List<EventLog> nodeEvents = filter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwable.set(t); } }).get(1, TimeUnit.MINUTES); Throwable th = throwable.get(); if (th != null) { throw new CacheException(th); } } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }</code><technical_language>throwable is wrapped in a CacheException thrown. outer try-catch(Exception) wrap again. I a separate catch for CacheException Exception avoid double wrapping</technical_language>

Target:
public List<EventLog> getEvents(Instant start, int count, Optional<EventLogCategory> category, Optional<EventLogLevel> level) { List<EventLog> events = Collections.synchronizedList(new ArrayList<>()); AtomicReference<Throwable> throwable = new AtomicReference<>(); try { cacheManager.executor().submitConsumer(m -> { Cache<Object, Object> cache = m.getCache(EVENT_LOG_CACHE); QueryFactory queryFactory = Search.getQueryFactory(cache); QueryBuilder query = queryFactory.from(ServerEventImpl.class).orderBy("when", SortOrder.DESC).maxResults(count); FilterConditionContext filter = query.having("when").lte(start); category.map(c -> filter.and(queryFactory.having("category").eq(c))); level.map(l -> filter.and(queryFactory.having("level").eq(l))); List<EventLog> nodeEvents = filter.toBuilder().build().list(); return nodeEvents; }, (address, nodeEvents, t) -> { if (t == null) { events.addAll(nodeEvents); } else { throwable.set(t); } }).get(1, TimeUnit.MINUTES); Throwable th = throwable.get(); if (th != null) { throw new CacheException(th); } } catch (CacheException e) { log.debug("Could not retrieve events", e); throw e; } catch (Exception e) { log.debug("Could not retrieve events", e); throw new CacheException(e); } Collections.sort(events); return events.subList(0, Math.min(events.size(), count)); }
Source:
<code>public final void setCustomImportOrderRules(final String inputCustomImportOrder) { <START> if (!inputCustomImportOrder.isEmpty()) { <END> for (String currentState : GROUP_SEPARATOR_PATTERN.split(inputCustomImportOrder)) { addRulesToList(currentState); } customImportOrderRules.add(NON_GROUP_RULE_GROUP); } }</code><technical_language>do need this condition ? is side effect if do it</technical_language>

Target:
public final void setCustomImportOrderRules(final String inputCustomImportOrder) { if (!customImportOrderRules.equals(inputCustomImportOrder)) { for (String currentState : GROUP_SEPARATOR_PATTERN.split(inputCustomImportOrder)) { addRulesToList(currentState); } customOrderRules.add(NON_GROUP_RULE_GROUP); } customImportOrderRules = inputCustomImportOrder; }
Source:
<code>private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllHandlers().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } <START> for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllInterceptors().entrySet()) { <END> Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { addHandler(allCommandHandlerInterceptors, type, handler); } } validateCommandHandlers(); }</code><technical_language>I this piece of code is slightly clearer if rename handlersPerType interceptorsPerType</technical_language>

Target:
private void prepareHandlers() { for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> handlersPerType : handlerInspector.getAllHandlers().entrySet()) { Class<?> type = handlersPerType.getKey(); for (MessageHandlingMember<? super T> handler : handlersPerType.getValue()) { if (handler.unwrap(CommandMessageHandlingMember.class).isPresent()) { if (Modifier.isAbstract(type.getModifiers()) && handler.unwrap(Constructor.class).isPresent()) { throw new AggregateModellingException(format( "An abstract aggregate %s cannot have @CommandHandler on constructor.", type)); } addHandler(allCommandHandlers, type, handler); } else { addHandler(allEventHandlers, type, handler); } } } for (Map.Entry<Class<?>, SortedSet<MessageHandlingMember<? super T>>> interceptorsPerType : handlerInspector.getAllInterceptors().entrySet()) { Class<?> type = interceptorsPerType.getKey(); for (MessageHandlingMember<? super T> handler : interceptorsPerType.getValue()) { addHandler(allCommandHandlerInterceptors, type, handler); } } validateCommandHandlers(); }
Source:
<code>public static Intent createScanIntent(Context context, String... formats) { if (MainConfigurablePreferences.useIntentCalloutForScanner()) { Intent scanIntent = new Intent(Intents.Scan.ACTION); if (scanIntent.resolveActivity(context.getPackageManager()) != null) { if (formats != null) { <START> StringBuilder joinedByComma = new StringBuilder(); <END> for (String format : formats) { if (joinedByComma.length() > 0) { joinedByComma.append(','); } joinedByComma.append(format); } scanIntent.putExtra(Intents.Scan.FORMATS, joinedByComma.toString()); } return scanIntent; } } return new IntentIntegrator((AppCompatActivity) context) .setDesiredBarcodeFormats(formats) .createScanIntent(); }</code><technical_language>[String.join](<LINK_0></technical_language>

Target:
public static Intent createScanIntent(Context context, String... formats) { if (MainConfigurablePreferences.useIntentCalloutForScanner()) { Intent scanIntent = new Intent(Intents.Scan.ACTION); if (scanIntent.resolveActivity(context.getPackageManager()) != null) { if (formats != null) { scanIntent.putExtra(Intents.Scan.FORMATS, TextUtils.join(",", formats)); } return scanIntent; } } IntentIntegrator intentIntegrator = new IntentIntegrator((AppCompatActivity) context); if (formats != null) { intentIntegrator.setDesiredBarcodeFormats(formats); } return intentIntegrator.createScanIntent(); }
Source:
<code>public boolean isLogin() { Set<String> cookies = getCookies(); <START> return cookies != null && !cookies.isEmpty(); <END> }</code><technical_language>condition "cookies != null" is redundant</technical_language>

Target:
public boolean isLogin() { return !getCookies().isEmpty(); }
Source:
<code>public String acquireLock(final String key, final int expireInSeconds) { checkNotNull(key); checkArgument(expireInSeconds > 0); final String lock = UUID.randomUUID().toString(); final Long result = ops.setnx(key, lock); if (result != 1L) { final Long expire = ops.ttl(key); if (expire < 0L || expire > expireInSeconds) { expire(key, expireInSeconds); <START> } <END> throw new LockNotAvailableException(key); } expire(key, expireInSeconds); return lock; }</code><technical_language>original logic in RedisLockDao expire < 0L clause (for if lock expired). this expire lock if another thread acquired lock. Is this want do? I misreading this</technical_language>

Target:
public String acquireLock(final String key, final int expireInSeconds) { checkNotNull(key); checkArgument(expireInSeconds > 0); final String lock = UUID.randomUUID().toString(); final Long result = ops.setnx(key, lock); if (result != 1L) { if (ops.ttl(key) == -1L) { expire(key, expireInSeconds); } throw new LockNotAvailableException(key); } expire(key, expireInSeconds); return lock; }
Source:
<code>private int findNextEOL(int oldPos, String message) { <START> int pos = message.indexOf("\n", oldPos + 1); END> if (pos > -1) return pos; return message.indexOf(Text.DELIMITER, oldPos + 1); }</code><technical_language>Is reason Text.DELIMITER instead of "\n"</technical_language>

Target:
private int findNextEOL(int oldPos, String message) { return message.indexOf(Text.DELIMITER, oldPos + 1); }
Source:
<code>private static <M extends Message> OperatorImpl<M, ? extends Message> createAndRegisterOperatorImpl(OperatorSpec operatorSpec, MessageStream source, TaskContext context) { if (!OPERATOR_IMPLS.containsKey(operatorSpec)) { OperatorImpl<M, ? extends Message> operatorImpl = createOperatorImpl(operatorSpec); if (OPERATOR_IMPLS.putIfAbsent(operatorSpec, operatorImpl) == null) { MessageStream<? extends Message> outStream = operatorSpec.getOutputStream(); Collection<OperatorSpec> registeredSpecs = ((MessageStreamImpl) outStream).getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl subImpl = createAndRegisterOperatorImpl(registeredSpec, outStream, context); operatorImpl.registerNextOperator(subImpl); }); <START> operatorImpl.init(source, context); <END> return operatorImpl; } } return OPERATOR_IMPLS.get(operatorSpec); }</code><technical_language>I discussed this before. remove init() method OperatorImpl if pass source context parameters constructor of OperatorImpl. i.e. change createOperatorImpl(operatorSpec) createOperatorImpl(operatorSpec, source, context). planning fix in another PR</technical_language>

Target:
private static <M extends MessageEnvelope> OperatorImpl<M, ? extends MessageEnvelope> createAndRegisterOperatorImpl(OperatorSpec operatorSpec, MessageStream source, TaskContext context) { if (!OPERATOR_IMPLS.containsKey(operatorSpec)) { OperatorImpl<M, ? extends MessageEnvelope> operatorImpl = createOperatorImpl(operatorSpec); if (OPERATOR_IMPLS.putIfAbsent(operatorSpec, operatorImpl) == null) { MessageStream<? extends MessageEnvelope> outStream = operatorSpec.getOutputStream(); Collection<OperatorSpec> registeredSpecs = ((MessageStreamImpl) outStream).getRegisteredOperatorSpecs(); registeredSpecs.forEach(registeredSpec -> { OperatorImpl subImpl = createAndRegisterOperatorImpl(registeredSpec, outStream, context); operatorImpl.registerNextOperator(subImpl); }); operatorImpl.init(source, context); return operatorImpl; } } return OPERATOR_IMPLS.get(operatorSpec); }
Source:
<code>public Organisation rejectOrganisation(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long id) { Organisation organisation = organisationDAO.findById(id); if (organisation == null) { String msg = "Organisation not found"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } <START> if (!Objects.equals(organisation.getStatus(), Organisation.ApplicationState.APPROVED)) { <END> organisation.setStatus(Organisation.ApplicationState.REJECTED); Event rejectOrgEvent = new Event.Builder() .withOrganisation(organisation) .withInitiatorUser(user) .withType(Event.EventType.REJECT_ORG) .build(); eventDAO.create(rejectOrgEvent); } return organisationDAO.findById(id); }</code><technical_language>1. I if allow rejecting of approved organization. if some org inadvertently incorrectly approved? 2. If decide this way, I else for this if return a 400 bad request</technical_language>

Target:
public Organisation rejectOrganisation(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long id) { Organisation organisation = organisationDAO.findById(id); if (organisation == null) { String msg = "Organisation not found"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } if (Objects.equals(organisation.getStatus(), Organisation.ApplicationState.PENDING)) { organisation.setStatus(Organisation.ApplicationState.REJECTED); Event rejectOrgEvent = new Event.Builder() .withOrganisation(organisation) .withInitiatorUser(user) .withType(Event.EventType.REJECT_ORG) .build(); eventDAO.create(rejectOrgEvent); } else if (Objects.equals(organisation.getStatus(), Organisation.ApplicationState.APPROVED)) { String msg = "The organization is already approved"; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } return organisationDAO.findById(id); }
Source:
<code><START> protected GuiScrollbar getScrollBar() <END> { return this.myScrollBar; }</code><technical_language>is final, subclasses override this method. This method is called in constructor potentially dangerous</technical_language>

Target:
protected GuiScrollbar getScrollBar() { return this.scrollBar; }
Source:
<code>private static Expression updateComparisonPredicate(Expression expression) { Function functionCall = expression.getFunctionCall(); if (functionCall != null) { SqlKind sqlKind = SqlKind.OTHER_FUNCTION; try { sqlKind = SqlKind.valueOf(functionCall.getOperator().toUpperCase()); } catch (Exception e) { } switch (sqlKind) { case EQUALS: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: if (functionCall.getOperands().get(0).getLiteral() != null) { functionCall.setOperator(getOppositeOperator(functionCall.getOperator())); List<Expression> oldOperands = functionCall.getOperands(); Expression tempExpr = oldOperands.get(0); oldOperands.set(0, oldOperands.get(1)); oldOperands.set(1, tempExpr); } if (functionCall.getOperands().get(1).getLiteral() != null) { return expression; } Expression comparisonFunction = RequestUtils.getFunctionExpression(functionCall.getOperator()); List<Expression> exprList = new ArrayList<>(); exprList.add(getLeftOperand(functionCall)); exprList.add(RequestUtils.getLiteralExpression(0)); comparisonFunction.getFunctionCall().setOperands(exprList); return comparisonFunction; default: List<Expression> operands = functionCall.getOperands(); List<Expression> newOperands = new ArrayList<>(); if (operands != null) { <START> for (int i = 0; i < operands.size(); i++) { <END> newOperands.add(updateComparisonPredicate(operands.get(i))); } } functionCall.setOperands(newOperands); } } return expression; }</code><technical_language>related this PR -- JVM inline this. do int size = operands.size() loop i < size</technical_language>

Target:
private static Expression updateComparisonPredicate(Expression expression) { Function functionCall = expression.getFunctionCall(); if (functionCall != null) { SqlKind sqlKind = SqlKind.OTHER_FUNCTION; try { sqlKind = SqlKind.valueOf(functionCall.getOperator().toUpperCase()); } catch (Exception e) { } switch (sqlKind) { case EQUALS: case NOT_EQUALS: case GREATER_THAN: case GREATER_THAN_OR_EQUAL: case LESS_THAN: case LESS_THAN_OR_EQUAL: if (functionCall.getOperands().get(0).getLiteral() != null) { functionCall.setOperator(getOppositeOperator(functionCall.getOperator())); List<Expression> oldOperands = functionCall.getOperands(); Expression tempExpr = oldOperands.get(0); oldOperands.set(0, oldOperands.get(1)); oldOperands.set(1, tempExpr); } if (functionCall.getOperands().get(1).getLiteral() != null) { return expression; } Expression comparisonFunction = RequestUtils.getFunctionExpression(functionCall.getOperator()); List<Expression> exprList = new ArrayList<>(); exprList.add(getLeftOperand(functionCall)); exprList.add(RequestUtils.getLiteralExpression(0)); comparisonFunction.getFunctionCall().setOperands(exprList); return comparisonFunction; default: List<Expression> newOperands = new ArrayList<>(); int operandsSize = functionCall.getOperandsSize(); for (int i = 0; i < operandsSize; i++) { Expression operand = functionCall.getOperands().get(i); newOperands.add(updateComparisonPredicate(operand)); } functionCall.setOperands(newOperands); } } return expression; }
Source:
<code>public Roles list() { MultilevelAdministrationByAdElementIdParameters params = new MultilevelAdministrationByAdElementIdParameters(principalId); <START> params.setFiltered(SessionUtils.isFiltered()); <END> return mapCollection(getBackendCollection(VdcQueryType.GetPermissionsByAdElementId, params)); }</code><technical_language>this is in getBackendCollection()? solve this in generic way..</technical_language>

Target:
public Roles list() { return mapCollection(getBackendCollection(VdcQueryType.GetPermissionsByAdElementId, new MultilevelAdministrationByAdElementIdParameters(principalId))); }
Source:
<code>public void validate(OrcDataSource input) throws OrcCorruptionException { checkState(validationBuilder != null, "validation is not enabled"); validateFile( validationBuilder.build(), input, types, hiveStorageTimeZone, orcEncoding, <START> new OrcReaderConfig(false)); <END> }</code><technical_language>worry decompressor for orc writer validation</technical_language>

Target:
public void validate(OrcDataSource input) throws OrcCorruptionException { checkState(validationBuilder != null, "validation is not enabled"); validateFile( validationBuilder.build(), input, types, hiveStorageTimeZone, orcEncoding, new OrcReaderOptions(new DataSize(1, MEGABYTE), new DataSize(8, MEGABYTE), new DataSize(16, MEGABYTE), false)); }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.friends_fragment, container, false); recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(true); recyclerView.addItemDecoration(new FeedAdapter.FeedOffsetDecorator( getResources().getDimensionPixelSize(R.dimen.default_padding))); recyclerView.addItemDecoration(new FeedAdapter.FeedShadowDecorator( <START> getActivity().getResources().getDrawable(R.drawable.show_screen_shadow))); <END> if (typeface == null) { typeface = Typeface.createFromAsset(getActivity().getAssets(), "Roboto-Medium.ttf"); } loadData(); return view; }</code><technical_language>getResources()</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.friends_fragment, container, false); recyclerView = (RecyclerView) view.findViewById(R.id.recycler_view); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setHasFixedSize(true); recyclerView.addItemDecoration(new FeedAdapter.FeedOffsetDecorator( getResources().getDimensionPixelSize(R.dimen.default_padding))); recyclerView.addItemDecoration(new FeedAdapter.FeedShadowDecorator( getResources().getDrawable(R.drawable.show_screen_shadow))); loadData(); return view; }
Source:
<code>private void setGlobalHaMaintenance(boolean enabled) { VM vm = (VM) getSelectedItem(); if (vm == null) { return; } if (!vm.isHostedEngine()) { return; } SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vm.getRunOnVds(), HaMaintenanceMode.GLOBAL, enabled); <START> Frontend.getInstance().runAction(VdcActionType.SetHaMaintenance, params, null, this); <END> }</code><technical_language>minor: runAction overload type params</technical_language>

Target:
private void setGlobalHaMaintenance(boolean enabled) { VM vm = (VM) getSelectedItem(); if (vm == null) { return; } if (!vm.isHostedEngine()) { return; } SetHaMaintenanceParameters params = new SetHaMaintenanceParameters(vm.getRunOnVds(), HaMaintenanceMode.GLOBAL, enabled); Frontend.getInstance().runAction(VdcActionType.SetHaMaintenance, params); }
Source:
<code><START> public static ByteSource serializeImage( final BufferedImage bufferedImage, final String mimeType, final int quality ) <END> throws IOException { final byte[] serializedImage; final String format = getFormatByMimeType( mimeType ); if ( quality != 0 ) { serializedImage = writeImage( bufferedImage, format, quality ); } else { serializedImage = writeImage( bufferedImage, format ); } return ByteSource.wrap( serializedImage ); }</code><technical_language>Avoid ByteSource in API. byte[] is ok</technical_language>

Target:
public static byte[] serializeImage( final BufferedImage bufferedImage, final String mimeType, final int quality ) throws IOException { final byte[] serializedImage; final String format = getFormatByMimeType( mimeType ); if ( quality != 0 ) { serializedImage = writeImage( bufferedImage, format, quality ); } else { serializedImage = writeImage( bufferedImage, format ); } return serializedImage; }
Source:
<code>public IntegrationFlow build() { <START> Assert.notNull(itemWriter, "An ItemWriter must be provided"); <END> if(this.itemProcessor == null) { this.itemProcessor = new PassThroughItemProcessor(); } SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<>(itemProcessor, itemWriter); ChunkProcessorChunkHandler<I> chunkProcessorChunkHandler = new ChunkProcessorChunkHandler<>(); chunkProcessorChunkHandler.setChunkProcessor(chunkProcessor); return IntegrationFlows .from(inputChannel) .handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME) .channel(outputChannel) .get(); }</code><technical_language>assertions channels</technical_language>

Target:
public IntegrationFlow build() { Assert.notNull(this.itemWriter, "An ItemWriter must be provided"); Assert.notNull(this.inputChannel, "An InputChannel must be provided"); Assert.notNull(this.outputChannel, "An OutputChannel must be provided"); if(this.itemProcessor == null) { this.itemProcessor = new PassThroughItemProcessor(); } SimpleChunkProcessor<I, O> chunkProcessor = new SimpleChunkProcessor<>(this.itemProcessor, this.itemWriter); ChunkProcessorChunkHandler<I> chunkProcessorChunkHandler = new ChunkProcessorChunkHandler<>(); chunkProcessorChunkHandler.setChunkProcessor(chunkProcessor); return IntegrationFlows .from(this.inputChannel) .handle(chunkProcessorChunkHandler, SERVICE_ACTIVATOR_METHOD_NAME) .channel(this.outputChannel) .get(); }
Source:
<code>public List<PsiElement> getGroovyElements(@NotNull GroovyPsiElementFactory factory) { String extraGroovyCode; switch (type) { case EXTERNAL: <START> extraGroovyCode = " '" + data + "'"; <END> break; case MODULE: extraGroovyCode = " project('" + data + "')"; break; case FILES: extraGroovyCode = " files('" + data + "')"; break; case FILETREE: extraGroovyCode = " fileTree(" + GradleGroovyFile.convertMapToGroovySource((Map<String, Object>)data) + ")"; break; default: extraGroovyCode = ""; break; } return ImmutableList.of( (PsiElement)factory.createStatementFromText(scope.getGroovyMethodCall() + extraGroovyCode) ); }</code><technical_language>More escaping opportunities here</technical_language>

Target:
public List<PsiElement> getGroovyElements(@NotNull GroovyPsiElementFactory factory) { String extraGroovyCode; switch (type) { case EXTERNAL: extraGroovyCode = " '" + escapeLiteralString(data) + "'"; break; case MODULE: extraGroovyCode = " project('" + escapeLiteralString(data) + "')"; break; case FILES: extraGroovyCode = " files('" + escapeLiteralString(data) + "')"; break; case FILETREE: extraGroovyCode = " fileTree(" + GradleGroovyFile.convertMapToGroovySource((Map<String, Object>)data) + ")"; break; default: extraGroovyCode = ""; break; } return ImmutableList.of( (PsiElement)factory.createStatementFromText(scope.getGroovyMethodCall() + extraGroovyCode) ); }
Source:
<code>public void updateStatus(String url, PluginSettings pluginSettings, String prIdStr, String revision, String pipelineStage, String result, String trackbackURL) throws Exception { <START> LOGGER.info(String.format("GitHubProvider.updateStatus(): '%s' -> %s", result, url)); <END> String repository = getRepository(url); GHCommitState state = getState(result); String endPointToUse = pluginSettings.getEndPoint(); String usernameToUse = pluginSettings.getUsername(); String passwordToUse = pluginSettings.getPassword(); String oauthAccessTokenToUse = pluginSettings.getOauthToken(); if (StringUtils.isEmpty(endPointToUse)) { endPointToUse = System.getProperty("go.plugin.build.status.github.endpoint"); } if (StringUtils.isEmpty(usernameToUse)) { usernameToUse = System.getProperty("go.plugin.build.status.github.username"); } if (StringUtils.isEmpty(passwordToUse)) { passwordToUse = System.getProperty("go.plugin.build.status.github.password"); } if (StringUtils.isEmpty(oauthAccessTokenToUse)) { oauthAccessTokenToUse = System.getProperty("go.plugin.build.status.github.oauth"); } updateCommitStatus(revision, pipelineStage, trackbackURL, repository, state, usernameToUse, passwordToUse, oauthAccessTokenToUse, endPointToUse); }</code><technical_language>this others more readable? is say, understandable for a user familiar backend For example, this change LOGGER.info("Updating status for '%s' %s", url, result) lines. Also, need String.format there. LOGGER.info("sting %s", value) work</technical_language>

Target:
public void updateStatus(String url, PluginSettings pluginSettings, String prIdStr, String revision, String pipelineStage, String result, String trackbackURL) throws Exception { LOGGER.info("Updating status for '%s' to %s", url, result); String repository = getRepository(url); GHCommitState state = getState(result); String endPointToUse = pluginSettings.getEndPoint(); String usernameToUse = pluginSettings.getUsername(); String passwordToUse = pluginSettings.getPassword(); String oauthAccessTokenToUse = pluginSettings.getOauthToken(); if (StringUtils.isEmpty(endPointToUse)) { endPointToUse = System.getProperty("go.plugin.build.status.github.endpoint"); } if (StringUtils.isEmpty(usernameToUse)) { usernameToUse = System.getProperty("go.plugin.build.status.github.username"); } if (StringUtils.isEmpty(passwordToUse)) { passwordToUse = System.getProperty("go.plugin.build.status.github.password"); } if (StringUtils.isEmpty(oauthAccessTokenToUse)) { oauthAccessTokenToUse = System.getProperty("go.plugin.build.status.github.oauth"); } updateCommitStatus(revision, pipelineStage, trackbackURL, repository, state, usernameToUse, passwordToUse, oauthAccessTokenToUse, endPointToUse); }
Source:
<code>private String toVarcharValue(Object value) { if (value instanceof Collection<?>) { <START> return "[" + String.join(", ", ((Collection<?>) value).stream().map(this::toVarcharValue).collect(toList())) + "]"; <END> } if (value instanceof Document) { return ((Document) value).toJson(); } return value.toString(); }</code><technical_language>I if break some existing users cases this change... I guess useful before. @miniway</technical_language>

Target:
private String toVarcharValue(Object value) { if (value instanceof Collection<?>) { return "[" + String.join(", ", ((Collection<?>) value).stream().map(this::toVarcharValue).collect(toList())) + "]"; } if (value instanceof Document) { return ((Document) value).toJson(); } return String.valueOf(value); }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); checkFirstRun(); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(true); Tab tab = actionBar.newTab() <START> .setText("Claims") <END> .setTabListener(new ClaimTabListener<ClaimTabFragment>(this, "Claims", ClaimTabFragment.class)); actionBar.addTab(tab); tab = actionBar.newTab() .setText("Approval") .setTabListener(new ClaimTabListener<ApprovalTabFragment>(this, "Approval", ApprovalTabFragment.class)); actionBar.addTab(tab);; }</code><technical_language>Claims text strings.xml</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); userManager = new UserManager(this); if (userManager.getActiveUser() == null) { promptForUserInformation(); } else { loadSession(); } ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(true); Tab tab = actionBar.newTab() .setText(R.string.title_tab_claims) .setTabListener(new ClaimTabListener<ClaimTabFragment>(this, "Claims", ClaimTabFragment.class)); actionBar.addTab(tab); tab = actionBar.newTab() .setText(R.string.title_tab_approval) .setTabListener(new ClaimTabListener<ApprovalTabFragment>(this, "Approval", ApprovalTabFragment.class)); actionBar.addTab(tab); }
Source:
<code>private static String getStringFromInputStream(InputStream is) { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { <START> sb.append(line); <END> } } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } return sb.toString(); }</code><technical_language>This include line break. append('\n')</technical_language>

Target:
private static String getStringFromInputStream(InputStream is) throws IOException { BufferedReader br = null; StringBuilder sb = new StringBuilder(); String line; try { br = new BufferedReader(new InputStreamReader(is)); while ((line = br.readLine()) != null) { sb.append(line); sb.append("\n"); } } finally { if (br != null) { br.close(); } } return sb.toString(); }