auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Set<SSTableReader> snapshotWithoutFlush(String snapshotName, Predicate<SSTableReader> predicate, boolean ephemeral, RateLimiter rateLimiter) { if (rateLimiter == null) <START> rateLimiter = RateLimiter.create(DatabaseDescriptor.getSnapshotLinksPerSecond() == 0 ? <END> Double.MAX_VALUE : DatabaseDescriptor.getSnapshotLinksPerSecond()); Set<SSTableReader> snapshottedSSTables = new HashSet<>(); for (ColumnFamilyStore cfs : concatWithIndexes()) { final JSONArray filesJSONArr = new JSONArray(); try (RefViewFragment currentView = cfs.selectAndReference(View.select(SSTableSet.CANONICAL, (x) -> predicate == null || predicate.apply(x)))) { for (SSTableReader ssTable : currentView.sstables) { File snapshotDirectory = Directories.getSnapshotDirectory(ssTable.descriptor, snapshotName); rateLimiter.acquire(SSTableReader.componentsFor(ssTable.descriptor).size()); ssTable.createLinks(snapshotDirectory.getPath()); filesJSONArr.add(ssTable.descriptor.relativeFilenameFor(Component.DATA)); if (logger.isTraceEnabled()) logger.trace("Snapshot for keyspace data file created in {}", keyspace, ssTable.getFilename(), snapshotDirectory); snapshottedSSTables.add(ssTable); } writeSnapshotManifest(filesJSONArr, snapshotName); if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) && !SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace)) writeSnapshotSchema(snapshotName); } } if (ephemeral) createEphemeralSnapshotMarkerFile(snapshotName); return snapshottedSSTables; }</code><technical_language>Pull this logic out, next DatabaseDescriptor#{get,set}SnapshotLinksPerSecond? special meaning of 0 is apparent logic copied extra times</technical_language>

Target:
public Set<SSTableReader> snapshotWithoutFlush(String snapshotName, Predicate<SSTableReader> predicate, boolean ephemeral, RateLimiter rateLimiter) { if (rateLimiter == null) rateLimiter = DatabaseDescriptor.getSnapshotRateLimiter(); Set<SSTableReader> snapshottedSSTables = new HashSet<>(); for (ColumnFamilyStore cfs : concatWithIndexes()) { final JSONArray filesJSONArr = new JSONArray(); try (RefViewFragment currentView = cfs.selectAndReference(View.select(SSTableSet.CANONICAL, (x) -> predicate == null || predicate.apply(x)))) { for (SSTableReader ssTable : currentView.sstables) { File snapshotDirectory = Directories.getSnapshotDirectory(ssTable.descriptor, snapshotName); rateLimiter.acquire(SSTableReader.componentsFor(ssTable.descriptor).size()); ssTable.createLinks(snapshotDirectory.getPath()); filesJSONArr.add(ssTable.descriptor.relativeFilenameFor(Component.DATA)); if (logger.isTraceEnabled()) logger.trace("Snapshot for keyspace data file created in {}", keyspace, ssTable.getFilename(), snapshotDirectory); snapshottedSSTables.add(ssTable); } writeSnapshotManifest(filesJSONArr, snapshotName); if (!SchemaConstants.isLocalSystemKeyspace(metadata.keyspace) && !SchemaConstants.isReplicatedSystemKeyspace(metadata.keyspace)) writeSnapshotSchema(snapshotName); } } if (ephemeral) createEphemeralSnapshotMarkerFile(snapshotName); return snapshottedSSTables; }
Source:
<code>public void init(Database database) throws AuthConfigException { if (skipDefaultInitialization) { return; } if (initialized) { return; } synchronized (this) { if (initialized) { return; } Trace trace=database.getTrace(Trace.DATABASE); URL h2AuthenticatorConfigurationUrl = null; try { String configFile = System.getProperty("h2auth.configurationFile", null); if (configFile != null) { if (trace.isDebugEnabled()) { trace.debug("DefaultAuthenticator.config: configuration read from system property h2auth.configurationfile={0}", configFile); } h2AuthenticatorConfigurationUrl = new URL(configFile); } if (h2AuthenticatorConfigurationUrl == null) { <START> h2AuthenticatorConfigurationUrl = Thread.currentThread().getContextClassLoader() <END> .getResource("h2auth.xml"); if (h2AuthenticatorConfigurationUrl!=null) { if (trace.isDebugEnabled()) { trace.debug("DefaultAuthenticator.config: configuration read from classpath {0}", h2AuthenticatorConfigurationUrl); } } } if (h2AuthenticatorConfigurationUrl == null) { if (trace.isDebugEnabled()) { trace.debug("DefaultAuthenticator.config: default configuration"); } defaultConfiguration(); } else { configureFromUrl(h2AuthenticatorConfigurationUrl); } } catch (Exception e) { trace.error(e, "DefaultAuthenticator.config: an error occurred during configuration from {0} ", h2AuthenticatorConfigurationUrl); throw new AuthConfigException("Failed to configure authentication from " + h2AuthenticatorConfigurationUrl, e); } initialized=true; } }</code><technical_language>I this is a good idea. Application application / web server in other complex environment. Thread pool shared applications, classloader different</technical_language>

Target:
public void init(Database database) throws AuthConfigException { if (skipDefaultInitialization) { return; } if (initialized) { return; } synchronized (this) { if (initialized) { return; } Trace trace=database.getTrace(Trace.DATABASE); URL h2AuthenticatorConfigurationUrl = null; try { String configFile = SysProperties.AUTH_CONFIG_FILE; if (configFile != null) { if (trace.isDebugEnabled()) { trace.debug("DefaultAuthenticator.config: configuration read from system property h2auth.configurationfile={0}", configFile); } h2AuthenticatorConfigurationUrl = new URL(configFile); } if (h2AuthenticatorConfigurationUrl == null) { if (trace.isDebugEnabled()) { trace.debug("DefaultAuthenticator.config: default configuration"); } defaultConfiguration(); } else { configureFromUrl(h2AuthenticatorConfigurationUrl); } } catch (Exception e) { trace.error(e, "DefaultAuthenticator.config: an error occurred during configuration from {0} ", h2AuthenticatorConfigurationUrl); throw new AuthConfigException("Failed to configure authentication from " + h2AuthenticatorConfigurationUrl, e); } initialized=true; } }
Source:
<code>public ImmutableSet<Channel> fetchServices() throws GlycerinException { ServicesQuery servicesQuery = ServicesQuery.builder() <START> .withPageSize(MAXIMUM_PAGE_SIZE) <END> .withServiceType(ServiceTypeOption.LOCAL_RADIO, ServiceTypeOption.NATIONAL_RADIO, ServiceTypeOption.REGIONAL_RADIO, ServiceTypeOption.TV) .build(); GlycerinResponse<Service> response = glycerin.execute(servicesQuery); ImmutableList<Service> results = response.getResults(); ImmutableSet.Builder<Channel> channels = ImmutableSet.builder(); for (Service result : results) { Channel channel = getChannel(result); channels.add(channel); } return channels.build(); }</code><technical_language>need paginate this request? this fetch page</technical_language>

Target:
public ImmutableSet<Channel> fetchServices() throws GlycerinException { return fetchServices(ImmutableMap.<String, Channel>of()); }
Source:
<code>private Object upsertObjects(Environment context) { if(context.ids.isPresent()) { throw new BadRequestException("UPSERT must not include ids"); } if(!context.data.isPresent()) { throw new BadRequestException("UPSERT must include data argument"); } Set<PersistentResource> upsertedObjects = new HashSet<>(); for(Map<String, Object> input : context.data.get()) { <START> EntityDictionary dictionary = context.requestScope.getDictionary(); <END> if(context.isRoot()) { String idFieldName = dictionary.getIdFieldName(dictionary.getEntityClass(context.field.getName())); upsertedObjects.add((PersistentResource) upsertObject(idFieldName, input, context.requestScope, context.field, context.outputType)); } else { String idFieldName = dictionary.getIdFieldName(context.parentResource.getResourceClass()); upsertedObjects.add((PersistentResource) upsertObject(idFieldName, input, dictionary, context.parentResource, context.field, context.outputType, context.requestScope)); } } return upsertedObjects; }</code><technical_language>do this loop</technical_language>

Target:
private Set<PersistentResource> upsertObjects(Environment context) { if(context.ids.isPresent()) { throw new BadRequestException("UPSERT must not include ids"); } if(!context.data.isPresent()) { throw new BadRequestException("UPSERT must include data argument"); } Set<PersistentResource> upsertedObjects = new HashSet(); for(Map<String, Object> input : context.data.get()) { upsertedObjects.addAll(graphWalker(input, this::upsertObject, Optional.ofNullable(context.parentResource), context.requestScope, context.field.getName())); } for(Map<String, Object> input : context.data.get()) { graphWalker(input, this::updateRelationship, Optional.ofNullable(context.parentResource), context.requestScope, context.field.getName()); } if(!context.isRoot()) { for(PersistentResource obj : upsertedObjects) { context.parentResource.addRelation(context.field.getName(), obj); } } return upsertedObjects; }
Source:
<code>private void setTimeStampState(String timeStamp) { logger.debug("setTimeStampState(): Time Stamp: {}", timeStamp); int state = 0; String itemName = ""; itemName = getItemName(DSCAlarmItemType.PANEL_TIME_STAMP, 0, 0); if (StringUtils.isNotEmpty(itemName)) { DSCAlarmBindingConfig config = getItemConfig(itemName); if (config != null) { Item item = getItem(itemName); if (item != null) { State onOffState = item.getState(); if (onOffState instanceof OnOffType) { OnOffType value = (OnOffType) onOffState; <START> if ((timeStamp == "" && value.equals(OnOffType.OFF)) || (timeStamp != "" && value.equals(OnOffType.ON))) { <END> logger.debug("setTimeStampState(): Already Set!", timeStamp); return; } else if (timeStamp != "") { state = 1; } } } } } updateItemByItemType(DSCAlarmItemType.PANEL_TIME_STAMP, 0, 0, state); logger.debug("setTimeStampState(): Changed state to '{}'.", state == 1 ? OnOffType.ON : OnOffType.OFF); }</code><technical_language>Please change instances of == "" != "" code a correct method of determining if left-hand side of expression is is empty string. possibility is StringUtils.isBlank StringUtils.isNotBlank. If statically import methods, reduced isBlank isNotBlank. Thank you</technical_language>

Target:
private void setTimeStampState(String timeStamp) { logger.debug("setTimeStampState(): Time Stamp: {}", timeStamp); int state = 0; String itemName = ""; itemName = getItemName(DSCAlarmItemType.PANEL_TIME_STAMP, 0, 0); if (StringUtils.isNotEmpty(itemName)) { DSCAlarmBindingConfig config = getItemConfig(itemName); if (config != null) { Item item = getItem(itemName); if (item != null) { State onOffState = item.getState(); if (onOffState instanceof OnOffType) { OnOffType value = (OnOffType) onOffState; if ((StringUtils.isEmpty(timeStamp) && value.equals(OnOffType.OFF)) || (StringUtils.isNotEmpty(timeStamp) && value.equals(OnOffType.ON))) { logger.debug("setTimeStampState(): Already Set!", timeStamp); return; } else if (StringUtils.isNotEmpty(timeStamp)) { state = 1; } } } } } updateItemByItemType(DSCAlarmItemType.PANEL_TIME_STAMP, 0, 0, state); logger.debug("setTimeStampState(): Changed state to '{}'.", state == 1 ? OnOffType.ON : OnOffType.OFF); }
Source:
<code>private JobValidatorRegistry() { <START> jobValidators = new HashMap<>(); <END> Iterator<JobValidatorService> loadedFactories = ServiceRegistry.lookupProviders(JobValidatorService.class); while (loadedFactories.hasNext()) { try { JobValidatorService validator = loadedFactories.next(); String validatorID = validator.getClass().getCanonicalName(); if (!jobValidators.containsKey(validator.getClass().getCanonicalName())) { logger.debug("Job Validator Factory provider <" + validatorID + "> found"); jobValidators.put(validatorID, validator); } } catch (Exception err) { logger.error("Failed to load job validator factory: " + err); } } if (logger.isInfoEnabled()) { logger.info("[JobValidatorRegistry] job validators registered : " + jobValidators.keySet()); } }</code><technical_language>Please extract code of this constructor in a protected method. For instance load, reload. This simplify unit testing of this part offer possibility reload</technical_language>

Target:
private JobValidatorRegistry() { load(); }
Source:
<code>public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL, <START> R.style.AppTheme_NoActionBar_Fullscreen); <END> setCancelable(false); }</code><technical_language>actual bug-fix: a style inherits AppCompat</technical_language>

Target:
public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme_NoActionBar); setCancelable(false); }
Source:
<code>public JSONObject toJSON() { JSONObject json = new JSONObject(); try { <START> if (version > MW_VERSION) { <END> json.putOpt("version", version); } json.putOpt("title", getTitle().toJSON()); JSONArray sectionsJSON = new JSONArray(); for (Section section : getSections()) { sectionsJSON.put(section.toJSON()); } json.putOpt("sections", sectionsJSON); json.putOpt("properties", pageProperties.toJSON()); if (galleryCollection != null) { json.put("gallery", galleryCollection.toJSON()); } return json; } catch (JSONException e) { throw new RuntimeException(e); } }</code><technical_language>Is this conditional necessary? store origin</technical_language>

Target:
public JSONObject toJSON() { JSONObject json = new JSONObject(); try { json.putOpt("version", version); json.putOpt("title", getTitle().toJSON()); JSONArray sectionsJSON = new JSONArray(); for (Section section : getSections()) { sectionsJSON.put(section.toJSON()); } json.putOpt("sections", sectionsJSON); json.putOpt("properties", pageProperties.toJSON()); if (galleryCollection != null) { json.put("gallery", galleryCollection.toJSON()); } return json; } catch (JSONException e) { throw new RuntimeException(e); } }
Source:
<code><START> private Date calculateNextUserFetch() { <END> int diff = HOURS_OF_DAY - Calendar.getInstance().get(Calendar.HOUR_OF_DAY); logger.debug("Still " + diff + " hours until midnight."); diff++; Date nextExecution = Date.from(Instant.now().plusSeconds(diff * 3600)); logger.debug("The next fetch of organization members from github will be at: " + DateFormat.getInstance().format(nextExecution)); return nextExecution; }</code><technical_language>Calendar is out. java.util.time is Dein Freund! Java8 und</technical_language>

Target:
private Date calculateNextUserFetch() { int diff = HOURS_OF_DAY - LocalTime.now().getHour(); logger.debug("Still " + diff + " hours until midnight."); diff++; Date nextExecution = Date.from(Instant.now().plusSeconds(diff * SECONDS_PER_HOUR)); logger.debug("The next fetch of organization members from github will be at: " + DateFormat.getInstance().format(nextExecution)); return nextExecution; }
Source:
<code>protected void onStart() { super.onStart(); <START> if (!AppPrefs.isSwipeToNavigateShown()) { <END> Snackbar.make(mViewPager, getString(R.string.notifications_label_swipe_for_more_snackbar), Snackbar.LENGTH_LONG).show(); } }</code><technical_language>situations note is shown, swiping? If so, show this snackbar in situations</technical_language>

Target:
protected void onStart() { super.onStart(); if (!AppPrefs.isSwipeToNavigateShown() && mAllowHorizontalNavigation && (mAdapter.getCount() > 1)) { Snackbar.make(mViewPager, getString(R.string.notifications_label_swipe_for_more_snackbar), Snackbar.LENGTH_LONG).show(); } }
Source:
<code>public void trackWifiInfo(final Map<String, WifiInfo> wifiInfoPerBatch) { final List<WifiInfo> wifiInfoList = Lists.newArrayList(wifiInfoPerBatch.values()); Collections.shuffle(wifiInfoList); if (wifiInfoList.isEmpty()) { return; } wifiInfoDAO.putBatch(wifiInfoList.subList(0, Math.min(WIFI_INFO_BATCH_MAX_SIZE, wifiInfoList.size()))); <START> LOGGER.debug("Tracked wifi info for senses: {}", wifiInfoPerBatch.size(), wifiInfoPerBatch.keySet()); <END> }</code><technical_language>I # of senses tracked INFO IDs of senses tracked TRACE</technical_language>

Target:
public void trackWifiInfo(final Map<String, WifiInfo> wifiInfoPerBatch) { final List<WifiInfo> wifiInfoList = Lists.newArrayList(wifiInfoPerBatch.values()); Collections.shuffle(wifiInfoList); if (wifiInfoList.isEmpty()) { return; } wifiInfoDAO.putBatch(wifiInfoList.subList(0, Math.min(WIFI_INFO_BATCH_MAX_SIZE, wifiInfoList.size()))); LOGGER.info("Tracked wifi info for senses", wifiInfoPerBatch.size()); LOGGER.trace("Tracked wifi info for senses {}", wifiInfoPerBatch.keySet()); }
Source:
<code>public Responses(Collection<Address> dests, RspList<Response> results) { <START> if (dests != null && dests.size() < results.size()) { <END> int size = dests.size(); this.addresses = new Address[size]; this.responses = new AtomicReferenceArray<>(size); int i = 0; for (Address address : dests) { this.addresses[i] = address; Rsp<Response> rsp = results.get(address); if (rsp == null) { responses.set(i, SUSPECTED_RSP); } else if (rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable()) { responses.set(i, rsp); } ++i; } } else { int size = results.size(); this.addresses = new Address[size]; this.responses = new AtomicReferenceArray<>(size); int i = 0; for (Map.Entry<Address, Rsp<Response>> e : results.entrySet()) { addresses[i] = e.getKey(); Rsp<Response> rsp = e.getValue(); if (rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable()) { responses.set(i, rsp); } ++i; } } }</code><technical_language>I understand this happens: is dest strict subset of addresses in results? this is a result node message to? other hand, address dests missing in results I understand comparing size of sets this way..</technical_language>

Target:
public Responses(Collection<Address> dests, RspList<Response> results) { if (dests != null && results.size() < dests.size()) { int size = dests.size(); this.addresses = new Address[size]; this.responses = new AtomicReferenceArray<>(size); int i = 0; for (Address address : dests) { this.addresses[i] = address; Rsp<Response> rsp = results.get(address); if (rsp == null) { responses.set(i, SUSPECTED_RSP); } else if (rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable()) { responses.set(i, rsp); } ++i; } } else { int size = results.size(); this.addresses = new Address[size]; this.responses = new AtomicReferenceArray<>(size); int i = 0; for (Map.Entry<Address, Rsp<Response>> e : results.entrySet()) { addresses[i] = e.getKey(); Rsp<Response> rsp = e.getValue(); if (rsp.wasReceived() || rsp.wasSuspected() || rsp.wasUnreachable()) { responses.set(i, rsp); } ++i; } } }
Source:
<code>protected ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request) { ICommand defaultCommand = super.getAfterReorientRelationshipCommand(request); int reorientDirection = request.getDirection(); View newEndView = RequestParameterUtils.getReconnectedEndView(request); <START> if ((((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_ALLOCATE_ABSTRACTION)).getMatcher().matches(request.getRelationship())) || <END> (((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_REFINE_ABSTRACTION)).getMatcher().matches(request.getRelationship())) || (((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_TRACE_ABSTRACTION)).getMatcher().matches(request.getRelationship()))) { boolean isSource = true; if (ReorientRequest.REORIENT_SOURCE == reorientDirection) { isSource = true; } else { isSource = false; } if (newEndView.getElement() instanceof Property) { SetDirectedRelationshipPropertyPathCommand setPropertyPathCommand = new SetDirectedRelationshipPropertyPathCommand(request.getEditingDomain(), newEndView, isSource); EMFToIEditCommandWrapper editCommandWrapper = new EMFToIEditCommandWrapper(request.getRelationship(), request, setPropertyPathCommand); defaultCommand = CompositeCommand.compose(defaultCommand, editCommandWrapper); } } return defaultCommand; }</code><technical_language>hard read</technical_language>

Target:
protected ICommand getAfterReorientRelationshipCommand(ReorientRelationshipRequest request) { ICommand defaultCommand = super.getAfterReorientRelationshipCommand(request); int reorientDirection = request.getDirection(); View newEndView = RequestParameterUtils.getReconnectedEndView(request); if ((((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_ALLOCATE_ABSTRACTION)).getMatcher().matches(request.getRelationship())) || (((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_REFINE_ABSTRACTION)).getMatcher().matches(request.getRelationship())) || (((ISpecializationType) ElementTypeRegistry.getInstance().getType(SysMLServiceTypeUtil.ORG_ECLIPSE_PAPYRUS_SYSML14_TRACE_ABSTRACTION)).getMatcher().matches(request.getRelationship()))) { boolean isSource = true; if (ReorientRequest.REORIENT_SOURCE == reorientDirection) { isSource = true; } else { isSource = false; } if (newEndView.getElement() instanceof Property) { SetDirectedRelationshipPropertyPathCommand setPropertyPathCommand = new SetDirectedRelationshipPropertyPathCommand(request.getEditingDomain(), newEndView, isSource); EMFToIEditCommandWrapper editCommandWrapper = new EMFToReorientRelationshipEditCommandWrapper(request.getRelationship(), request, setPropertyPathCommand); defaultCommand = CompositeCommand.compose(defaultCommand, editCommandWrapper); } } return defaultCommand; }
Source:
<code><START> public long getMaxSamples() <END> { return maxSamples; }</code><technical_language>s/long/int public int getMaxSamples() { return maxSamples; }</technical_language>

Target:
public int getMaxSamples() { return samples.length; }
Source:
<code>public void targetPerspective() { String newUrl = Window.Location.createUrlBuilder() <START> .setParameter("perspective", dashboard) <END> .buildString(); DomGlobal.window.history.pushState(null, "Dashbuilder Runtime", newUrl); this.hideLoading(); }</code><technical_language>suggestion .setParameter(PERSPECTIVE_PARAM, dashboard)</technical_language>

Target:
public void targetPerspective() { String newUrl = Window.Location.createUrlBuilder() .setParameter(PERSPECTIVE_PARAM, dashboard) .buildString(); DomGlobal.window.history.pushState(null, "Dashbuilder Runtime", newUrl); this.hideLoading(); }
Source:
<code>public long get(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length - BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed) { int signExtendBits = BIT_LONG - length; retVal = (retVal << signExtendBits) >> signExtendBits; } return retVal; } <START> return getInt(length, signed); <END> }</code><technical_language>No, this is want. replace return getInt(length, signed); long tmp = getInt(length, false); // false true, effect. if (!signed) tmp &= 0xFFFFFFFFL; return tmp;</technical_language>

Target:
public long get(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length - BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed) { int signExtendBits = BIT_LONG - length; retVal = (retVal << signExtendBits) >> signExtendBits; } return retVal; } long signedRead = getInt(length, false); return (signed ? signedRead : (signedRead & 0xFFFFFFFFL)); }
Source:
<code>public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == SEARCH_REQUEST_ADD_A_LANGUAGE) { if (resultCode == Activity.RESULT_OK) { <START> if (app.language().getAppLanguageCodes().size() == 1) { languageScrollView.setVisibility(View.GONE); langButtonContainer.setVisibility(View.VISIBLE); initLangButton(); searchLanguageCode = app.language().getAppLanguageCode(); startSearch(query, true); return; } else { languageScrollView.setVisibility(View.VISIBLE); langButtonContainer.setVisibility(View.GONE); } <END> int position = data.getIntExtra(ACTIVITY_RESULT_LANG_POSITION_DATA, 0); languageScrollView.refreshLanguagesTabLayout(this, position); } } }</code><technical_language>This awful lot setUpLanguageScroll() function. DRY this up</technical_language>

Target:
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == SEARCH_REQUEST_ADD_A_LANGUAGE) { if (resultCode == Activity.RESULT_OK) { int position = data.getIntExtra(ACTIVITY_RESULT_LANG_POSITION_DATA, 0); setUpLanguageScroll(position); } } }
Source:
<code>LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); String text = getText (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { <START> String actText = text.substring (0, getCaretPosition ()); <END> java.util.regex.Matcher m = Text.CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }</code><technical_language>getText (0, getCaretPosition()) method call</technical_language>

Target:
LRESULT wmChar (long hwnd, long wParam, long lParam) { if (ignoreCharacter) return null; LRESULT result = super.wmChar (hwnd, wParam, lParam); if (result != null) return result; switch ((int) wParam) { case SWT.TAB: return LRESULT.ZERO; case SWT.CR: if (!ignoreDefaultSelection) sendSelectionEvent (SWT.DefaultSelection); ignoreDefaultSelection = false; if (getSelectionIndex() == -1) { if ((style & SWT.DROP_DOWN) != 0 && (style & SWT.READ_ONLY) == 0) { if (OS.SendMessage(handle, OS.CB_GETDROPPEDSTATE, 0, 0) != 0) { OS.SendMessage(handle, OS.CB_SHOWDROPDOWN, 0, 0); } return LRESULT.ZERO; } } case SWT.ESC: if ((style & SWT.DROP_DOWN) != 0) { if (OS.SendMessage (handle, OS.CB_GETDROPPEDSTATE, 0, 0) == 0) { return LRESULT.ZERO; } } case SWT.DEL: if (OS.GetKeyState (OS.VK_CONTROL) < 0) { if ((style & SWT.READ_ONLY) != 0) return LRESULT.ZERO; Point selection = getSelection (); long hwndText = OS.GetDlgItem (handle, CBID_EDIT); int x = selection.x; int y = selection.y; if (x == y) { String actText = getText ().substring (0, getCaretPosition ()); java.util.regex.Matcher m = Text.CTRL_BS_PATTERN.matcher (actText); if (m.find ()) { x = m.start (); y = m.end (); OS.SendMessage (hwndText, OS.EM_SETSEL, x, y); } } if (x < y) { OS.SendMessage (hwndText, OS.EM_REPLACESEL, 1, 0); } return LRESULT.ZERO; } } return result; }
Source:
<code>public T build(String configurationPath, InputStream inputStream) throws IOException, ConfigurationException { <START> final JsonNode node = mapper.readTree(inputStream); <END> return build(node, configurationPath != null ? configurationPath : "InputStream configuration"); }</code><technical_language>ensure stream is closed</technical_language>

Target:
public T build(String configurationPath, InputStream inputStream) throws IOException, ConfigurationException { T configuration = null; try { final JsonNode node = mapper.readTree(inputStream); configuration = build(node, configurationPath != null ? configurationPath : "InputStream configuration"); } finally { inputStream.close(); } return configuration; }
Source:
<code><START> public List<TopologySummary> getTopologySummaries() throws AuthorizationException, TException { <END> return getNimbus().getTopologySummaries(); }</code><technical_language>AuthorizationException removed</technical_language>

Target:
public List<TopologySummary> getTopologySummaries() throws TException { return getNimbus().getTopologySummaries(); }
Source:
<code>public static PersonFragment create(String personName) { PersonFragment personFragment = new PersonFragment(); Bundle bundle = new Bundle(); <START> bundle.putString("personName", personName); <END> personFragment.setArguments(bundle); return personFragment; }</code><technical_language>Extract "personName" a constant is multiple times</technical_language>

Target:
public static PersonFragment create(String personName) { PersonFragment personFragment = new PersonFragment(); Bundle bundle = new Bundle(); bundle.putString(ARG_PERSON_NAME, personName); personFragment.setArguments(bundle); return personFragment; }
Source:
<code>public AccountSettings getAccountSettings() { GetAccountSettingsRequest request = new GetAccountSettingsRequest(); <START> return api.getAccountSettings(request).getAccountSettings(); <END> }</code><technical_language>getAccountSettings() throw a NotFoundException is account configured for unmetered usage</technical_language>

Target:
public AccountSettings getAccountSettings() { try { GetAccountSettingsRequest request = new GetAccountSettingsRequest(); return api.getAccountSettings(request).getAccountSettings(); } catch (NotFoundException e) { return null; } }
Source:
<code>public void test() { connect(); JQuery toggleIndeterminate = findButtonByContent("toggleIndeterminate"); JQuery isIndeterminate = findButtonByContent("isIndeterminate"); JQuery isChecked = findButtonByContent("isChecked"); click(toggleIndeterminate); waitResponse(); clickAndVerifyLog(isIndeterminate, "true"); clickAndVerifyLog(isChecked, "false"); click(jq(".z-checkbox")); waitResponse(); clickAndVerifyLog(isIndeterminate, "false"); clickAndVerifyLog(isChecked, "true"); click(toggleIndeterminate); waitResponse(); <START> clickAndVerifyLog(isIndeterminate, "true"); <END> clickAndVerifyLog(isChecked, "false"); click(toggleIndeterminate); waitResponse(); clickAndVerifyLog(isIndeterminate, "false"); clickAndVerifyLog(isChecked, "false"); }</code><technical_language>toggle Indeterminate affect checked <LINK_0> > control is a true tri-state control, if element's indeterminate IDL attribute is set true. indeterminate IDL attribute appearance of a state</technical_language>

Target:
public void test() { connect(); isIndeterminate = findButtonByContent("isIndeterminate"); isChecked = findButtonByContent("isChecked"); JQuery toggleIndeterminate = findButtonByContent("toggleIndeterminate"); JQuery checkbox = jq(".z-checkbox"); verifyLogs(TRUE, TRUE); click(toggleIndeterminate); waitResponse(); verifyLogs(FALSE, TRUE); click(toggleIndeterminate); waitResponse(); verifyLogs(TRUE, TRUE); click(checkbox); waitResponse(); verifyLogs(FALSE, FALSE); click(toggleIndeterminate); waitResponse(); verifyLogs(TRUE, FALSE); click(checkbox); waitResponse(); verifyLogs(FALSE, TRUE); }
Source:
<code><START> private TransientStore getTransientStore() { <END> return Framework.getService(TransientStoreService.class).getStore(STATUS_STORE_NAME); }</code><technical_language>private methods protected</technical_language>

Target:
protected TransientStore getTransientStore() { return Framework.getService(TransientStoreService.class).getStore(STATUS_STORE_NAME); }
Source:
<code><START> public Process exec() throws IOException, InterruptedException { <END> String[] command = { "docker", "run", "-i", "-t", "-v", workDir + ":/kb/module/work", "test/" + moduleName.toLowerCase() + ":latest", "bash" }; ProcessBuilder pb = new ProcessBuilder(command); pb.redirectInput(ProcessBuilder.Redirect.INHERIT); pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); Process proc = pb.start(); proc.waitFor(); return proc; }</code><technical_language>Returning process weird me. I method void a good reason otherwise</technical_language>

Target:
public void exec() throws IOException, InterruptedException { final String[] command = { "docker", "run", "--interactive", "--tty=true", "--volume=" + moduleInfo.workDir + ":/kb/module/work", "test/" + moduleInfo.moduleName.toLowerCase() + ":latest", "bash" }; final ProcessBuilder pb = new ProcessBuilder(command); pb.redirectInput(ProcessBuilder.Redirect.INHERIT); pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); final Process proc = pb.start(); proc.waitFor(); }
Source:
<code>public void testCrossesFilter() throws Exception { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); GeometryFactory gf = new GeometryFactory(); PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory(); <START> LineString ls = gf.createLineString(sf.create(new double[] {2, 3, 4, 3}, 2, 0)); <END> Crosses cs = ff.crosses(ff.property(aname("geom")), ff.literal(ls)); FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(cs); checkSingleResult(features, "r2"); }</code><technical_language>Hum... ouch? this required? JTS break compatibility methods</technical_language>

Target:
public void testCrossesFilter() throws Exception { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); GeometryFactory gf = new GeometryFactory(); PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory(); LineString ls = gf.createLineString(sf.create(new double[] {2, 3, 4, 3}, 2)); Crosses cs = ff.crosses(ff.property(aname("geom")), ff.literal(ls)); FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(cs); checkSingleResult(features, "r2"); }
Source:
<code>public void cleanUp() throws Exception { if (!isWindows) { ProcessBuilder builder = new ProcessBuilder(); builder.directory(tempProj); String processCommand = "mvn liberty:stop-server"; <START> String os = System.getProperty("os.name"); <END> if (os != null && os.toLowerCase().startsWith("windows")) { builder.command("CMD", "/C", processCommand); } else { builder.command("bash", "-c", processCommand); } Process process = builder.start(); if (tempProj != null && tempProj.exists()) { FileUtils.deleteDirectory(tempProj); } if (logFile != null && logFile.exists()) { logFile.delete(); } } }</code><technical_language>This section of code is a times this file. move a method</technical_language>

Target:
public void cleanUp() throws Exception { if (!isWindows) { ProcessBuilder builder = buildProcess("mvn liberty:stop-server"); Process process = builder.start(); if (tempProj != null && tempProj.exists()) { FileUtils.deleteDirectory(tempProj); } if (logFile != null && logFile.exists()) { logFile.delete(); } } }
Source:
<code>protected void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final String entityName, final String entityValue) { AuditLogDirector.log(new AuditLogableBase() { @Override protected VDS getVds() { return server; } @Override public Guid getVdsGroupId() { return clusterId; } @Override protected GlusterVolumeEntity getGlusterVolume() { return volume; } @Override public AuditLogType getAuditLogTypeValue() { return logType; } @Override public Map<String, String> getCustomValues() { <START> Map<String, String> customValues = new HashMap<String, String>(); <END> if (entityName != null && entityValue != null) { customValues.put(entityName, entityValue); } return customValues; } }); }</code><technical_language>Please Collections.singletonMap here</technical_language>

Target:
protected void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final String entityName, final String entityValue) { AuditLogDirector.log(new AuditLogableBase() { @Override protected VDS getVds() { return server; } @Override public Guid getVdsGroupId() { return clusterId; } @Override protected GlusterVolumeEntity getGlusterVolume() { return volume; } @Override public AuditLogType getAuditLogTypeValue() { return logType; } @Override public Map<String, String> getCustomValues() { if (entityName != null && entityValue != null) { return Collections.singletonMap(entityName, entityValue); } else { return new HashMap<String, String>(); } } }); }
Source:
<code>private void sendGapQuery() { if (m_mastershipAccepted.get() && m_gapTracker.getFirstGap() != null) { <START> if (m_gapTracker.isEmpty()) { <END> return; } m_queryResponses.clear(); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); Mailbox mbx = p.getFirst(); m_currentRequestId = System.nanoTime(); if (mbx != null && p.getSecond().size() > 0) { final int msgLen = 1 + 4 + 4 + m_signatureBytes.length + 8 + 8; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.GAP_QUERY); buf.putInt(m_partitionId); buf.putInt(m_signatureBytes.length); buf.put(m_signatureBytes); buf.putLong(m_currentRequestId); buf.putLong(m_gapTracker.getSafePoint() + 1); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); for( Long siteId: p.getSecond()) { mbx.send(siteId, bpm); } if (exportLog.isDebugEnabled()) { exportLog.debug("Send GAP_QUERY message(" + m_currentRequestId + "," + (m_gapTracker.getSafePoint() + 1) + ") for partition " + m_partitionId + "source signature " + m_tableName + " from " + CoreUtils.hsIdToString(mbx.getHSId()) + " to " + CoreUtils.hsIdCollectionToString(p.getSecond())); } } else { setStatus(StreamStatus.BLOCKED); Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(toString() + " is blocked because of data from sequence number " + gap.getFirst() + " to " + gap.getSecond() + " is missing."); } } }</code><technical_language>m_gapTracker empty if non-null gap</technical_language>

Target:
private void sendGapQuery() { if (m_mastershipAccepted.get() && m_gapTracker.getFirstGap() != null) { m_queryResponses.clear(); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); Mailbox mbx = p.getFirst(); m_currentRequestId = System.nanoTime(); if (mbx != null && p.getSecond().size() > 0) { final int msgLen = 1 + 4 + 4 + m_signatureBytes.length + 8 + 8; ByteBuffer buf = ByteBuffer.allocate(msgLen); buf.put(ExportManager.GAP_QUERY); buf.putInt(m_partitionId); buf.putInt(m_signatureBytes.length); buf.put(m_signatureBytes); buf.putLong(m_currentRequestId); buf.putLong(m_gapTracker.getSafePoint() + 1); BinaryPayloadMessage bpm = new BinaryPayloadMessage(new byte[0], buf.array()); for( Long siteId: p.getSecond()) { mbx.send(siteId, bpm); } if (exportLog.isDebugEnabled()) { exportLog.debug("Send GAP_QUERY message(" + m_currentRequestId + "," + (m_gapTracker.getSafePoint() + 1) + ") from " + CoreUtils.hsIdToString(mbx.getHSId()) + " to " + CoreUtils.hsIdCollectionToString(p.getSecond())); } } else { setStatus(StreamStatus.BLOCKED); Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn("Stream is blocked because of data from sequence number " + gap.getFirst() + " to " + gap.getSecond() + " is missing."); } } }
Source:
<code>protected Map<String, String> build( String localModuleId, Node moduleBody, Set<String> googProvides) { Map<String, String> reexportMap = new HashMap<>(); if (localModuleId == null) { return reexportMap; } if (!isLegacyNamespaceModule(moduleBody)) { return reexportMap; } for (Node statement : moduleBody.children()) { <START> if (isWholeModuleExportAssignment(statement)) { <END> String localVariableName = statement.getFirstChild().getChildAtIndex(1).getString(); reexportMap.put( buildWholeModuleExportSymbolName(localModuleId), buildLocalSymbolName(localModuleId, localVariableName)); } else if (isNamedExportAssignment(statement)) { String localVariableName = statement.getFirstChild().getChildAtIndex(1).getString(); String exportName = statement.getFirstChild().getFirstChild().getChildAtIndex(1).getString(); reexportMap.put( buildNamedExportSymbolName(localModuleId, exportName), buildLocalSymbolName(localModuleId, localVariableName)); } } return reexportMap; }</code><technical_language>I feel I this code in AliasMapBuilder, is refactoring commonalities feasable</technical_language>

Target:
protected Map<String, String> build( String localModuleId, Node moduleBody, Set<String> googProvides) { Map<String, String> reexportMap = new HashMap<>(); if (localModuleId == null) { return reexportMap; } if (!isLegacyNamespaceModule(moduleBody)) { return reexportMap; } for (Node statement : moduleBody.children()) { if (isWholeModuleExportAssignment(statement)) { String localVariableName = getExportsAssignmentRHS(statement); reexportMap.put( buildWholeModuleExportSymbolName(localModuleId), buildLocalSymbolName(localModuleId, localVariableName)); } else if (isNamedExportAssignment(statement)) { String localVariableName = getExportsAssignmentRHS(statement); String exportName = getNamedExportName(statement); reexportMap.put( buildNamedExportSymbolName(localModuleId, exportName), buildLocalSymbolName(localModuleId, localVariableName)); } } return reexportMap; }
Source:
<code>private void impl$callSaveChunkEventPost(ChunkPos pos, NBTTagCompound compound, CallbackInfo ci) { <START> if (ShouldFire.SAVE_CHUNK_EVENT || ShouldFire.SAVE_CHUNK_EVENT_POST) { <END> final Cause cause = Cause.of(EventContext.empty(), Collections.singleton(SpongeImpl.getServer())); SpongeImpl.postEvent(SpongeEventFactory.createSaveChunkEventPost(cause, VecHelper.toVec3i(pos))); } }</code><technical_language>suggestion if (ShouldFire.SAVE_CHUNK_EVENT_POST) {</technical_language>

Target:
private void impl$callSaveChunkEventPost(ChunkPos pos, NBTTagCompound compound, CallbackInfo ci) { if (ShouldFire.SAVE_CHUNK_EVENT_POST) { final Cause cause = Cause.of(EventContext.empty(), Collections.singleton(SpongeImpl.getServer())); SpongeImpl.postEvent(SpongeEventFactory.createSaveChunkEventPost(cause, VecHelper.toVec3i(pos))); } }
Source:
<code>Mono<Response<AreaCodes>> getAllAreaCodesWithResponse( String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context) { try { if (locationOptions == null) { Mono.error(new NullPointerException("'locationType' cannot be null.")); } if (countryCode == null) { Mono.error(new NullPointerException("'countryCode' cannot be null.")); } if (phonePlanId == null) { Mono.error(new NullPointerException("'phonePlanId' cannot be null.")); <START> } <END> LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); if (context == null) { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } else { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries, context); } } catch (RuntimeException ex) { return monoError(logger, ex); } }</code><technical_language>need put Mono.error try block.. simply Objects.requireNonNull statements if throw caught returned Mono errors</technical_language>

Target:
Mono<Response<AreaCodes>> getAllAreaCodesWithResponse( String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context) { if (locationOptions == null) { Mono.error(new NullPointerException("'locationType' cannot be null.")); } if (countryCode == null) { Mono.error(new NullPointerException("'countryCode' cannot be null.")); } if (phonePlanId == null) { Mono.error(new NullPointerException("'phonePlanId' cannot be null.")); } LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); try { if (context == null) { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } else { return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries, context); } } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>public DatasetWriter<E> newWriter() { checkSchemaForWrite(); AbstractDatasetWriter<E> writer; if (dataset.getDescriptor().isPartitioned()) { writer = PartitionedDatasetWriter.newWriter(this); } else { writer = FileSystemWriter.newWriter( <START> fs, root, -1, -1 , dataset.getDescriptor(), this.getSchema()); <END> } writer.initialize(); return writer; }</code><technical_language>AbstractRefinableView#getSchema method returns accessor's read schema. useful for callers, writers initialized getAccessor().getWriteSchema(). schemas differ slightly for reflected records</technical_language>

Target:
public DatasetWriter<E> newWriter() { checkSchemaForWrite(); AbstractDatasetWriter<E> writer; if (dataset.getDescriptor().isPartitioned()) { writer = PartitionedDatasetWriter.newWriter(this); } else { writer = FileSystemWriter.newWriter( fs, root, -1, -1 , dataset.getDescriptor(), this.getAccessor().getWriteSchema()); } writer.initialize(); return writer; }
Source:
<code>public void TopWamWikisWhereIsMyExtension_GeoEdgeFree() { <START> String whereIsExtensionUrl = urlBuilder.getUrlForPath("community", URLsContent.specialWhereIsExtension); <END> whereIsExtensionUrl = urlBuilder.appendQueryStringToURL(whereIsExtensionUrl, extensionURL); WikiBasePageObject wikiPage = new WikiBasePageObject(driver); wikiPage.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); wikiPage.getUrl(whereIsExtensionUrl); wikiPage.verifyNumberOfTop1kWikis(numberOfTop1kWikis); }</code><technical_language>move "community" URLsContent store a String constant</technical_language>

Target:
public void TopWamWikisWhereIsMyExtension_GeoEdgeFree() { String whereIsExtensionUrl = urlBuilder.getUrlForPath(URLsContent.communityWiki, URLsContent.specialWhereIsExtension); whereIsExtensionUrl = urlBuilder.appendQueryStringToURL(whereIsExtensionUrl, extensionURL); WikiBasePageObject wikiPage = new WikiBasePageObject(driver); wikiPage.logInCookie(credentials.userNameStaff, credentials.passwordStaff, wikiURL); wikiPage.getUrl(whereIsExtensionUrl); wikiPage.verifyNumberOfTop1kWikis(numberOfTop1kWikis); }
Source:
<code>private static void redirectOutput() { File jrLogFile = new File(FileSystemUtils.getBriefcaseFolder(), ".briefcase-javarosa.log"); try { final PrintStream jrOut = new PrintStream(jrLogFile); Std.setOut(jrOut); Std.setErr(jrOut); <START> Runtime.getRuntime().addShutdownHook(new Thread() { <END> public void run() { jrOut.close(); } }); } catch (FileNotFoundException e) { log.warn("failed to redirect javarosa output to " + jrLogFile); } }</code><technical_language>I question need for shutdown hook. Is reason PrintStream closed properly application exit. I removed hook ran application, log created</technical_language>

Target:
private static void redirectOutput() { File jrLogFile = new File(FileSystemUtils.getBriefcaseFolder(), ".briefcase-javarosa.log"); try { PrintStream jrOut = new PrintStream(jrLogFile); Std.setOut(jrOut); Std.setErr(jrOut); } catch (FileNotFoundException e) { log.warn("failed to redirect javarosa output to " + jrLogFile); } }