auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ResultScanner<Row> streamRows(ReadRowsRequest request) { expandPoolIfNecessary(this.bigtableOptions.getChannelCount()); ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channelPool.newCall(BigtableGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); ResponseQueueReader<Row> responseQueueReader = new ResponseQueueReader<>( retryOptions.getReadPartialRowTimeoutMillis(), retryOptions.getStreamingBufferSize()); StreamObserver<ReadRowsResponse> rowMerger = new RowMerger(responseQueueReader); ClientCall.Listener<ReadRowsResponse> listener = new StreamObserverAdapter<>(readRowsCall, rowMerger); asyncUtilities.asyncServerStreamingCall(readRowsCall, request, listener); if (request.getRows().getRowKeysCount() > 1 || request.getRows().getRowRangesCount() > 0) { <START> readRowsCall.request(4); <END> } CancellationToken cancellationToken = createCancellationToken(readRowsCall); return new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); }</code><technical_language>4 from</technical_language>

Target:
private ResultScanner<Row> streamRows(ReadRowsRequest request) { expandPoolIfNecessary(this.bigtableOptions.getChannelCount()); ClientCall<ReadRowsRequest, ReadRowsResponse> readRowsCall = channelPool.newCall(BigtableGrpc.METHOD_READ_ROWS, CallOptions.DEFAULT); ResponseQueueReader<Row> responseQueueReader = new ResponseQueueReader<>( retryOptions.getReadPartialRowTimeoutMillis(), retryOptions.getStreamingBufferSize()); StreamObserver<ReadRowsResponse> rowMerger = new RowMerger(responseQueueReader); ClientCall.Listener<ReadRowsResponse> listener = new StreamObserverAdapter<>(readRowsCall, rowMerger); asyncUtilities.asyncServerStreamingCall(readRowsCall, request, listener); CancellationToken cancellationToken = createCancellationToken(readRowsCall); return new StreamingBigtableResultScanner(responseQueueReader, cancellationToken); }
Source:
<code>public void testRemapMissingDependencies() { String UUID = "uuid"; String NAME = "name"; String PAGE = "page"; DataSetDef def1 = new DataSetDef(); def1.setUUID(UUID); def1.setName(NAME); HashMap<String, List<String>> validation = new HashMap<>(); validation.put(PAGE, Collections.singletonList(UUID)); <START> ExportInfo assets = new ExportInfo(Collections.singletonList(def1), Collections.emptyList(), false); <END> exportWizardSummaryPage.setExportInfo(assets); exportWizardSummaryPage.remapMissingDependencies(validation); assertEquals(NAME, validation.get(PAGE).get(0)); }</code><technical_language>suggestion ExportInfo exportInfo = new ExportInfo(Collections.singletonList(def1), Collections.emptyList(), false);</technical_language>

Target:
public void testRemapMissingDependencies() { String UUID = "uuid"; String NAME = "name"; String PAGE = "page"; DataSetDef def1 = new DataSetDef(); def1.setUUID(UUID); def1.setName(NAME); HashMap<String, List<String>> validation = new HashMap<>(); validation.put(PAGE, Collections.singletonList(UUID)); ExportInfo exportInfo = new ExportInfo(Collections.singletonList(def1), Collections.emptyList(), false); exportWizardSummaryPage.setExportInfo(exportInfo); exportWizardSummaryPage.remapMissingDependencies(validation); assertEquals(NAME, validation.get(PAGE).get(0)); }
Source:
<code>private CompletableFuture<List<LogEntry>> fetchLogEntries() { return CompletableFuture.supplyAsync(() -> { <START> try { Thread.sleep(5000l); } catch (InterruptedException e) { e.printStackTrace(); } <END> List<LogEntry> result = new ArrayList<>(); LogSession lastLogSession = LogReader.parseLogFile(this.fInputFile, getLogMaxTailSize(), result, this.fMemento); if (lastLogSession != null && (lastLogSession.getDate() == null || isEclipseStartTime(lastLogSession.getDate()))) { currentSession = lastLogSession; } else { currentSession = null; } return result; }); }</code><technical_language>I assume this is left tests</technical_language>

Target:
private CompletableFuture<List<LogEntry>> fetchLogEntries() { return CompletableFuture.supplyAsync(() -> { List<LogEntry> result = new ArrayList<>(); LogSession lastLogSession = LogReader.parseLogFile(this.fInputFile, getLogMaxTailSize(), result, this.fMemento); if (lastLogSession != null && (lastLogSession.getDate() == null || isEclipseStartTime(lastLogSession.getDate()))) { currentSession = lastLogSession; } else { currentSession = null; } return result; }); }
Source:
<code>public void synchronizeToLocalDirectory(File localDirectory, String bucketName, String remoteFolder) { if(!lock.tryLock()) { if(logger.isInfoEnabled()) { logger.info("Sync already in progess"); } return; } if(logger.isInfoEnabled()) { logger.info("Starting sync with local directory"); } try { if(remoteFolder != null && "/".equals(remoteFolder)) { remoteFolder = null; } if(filter instanceof AbstractFileNameFilter) { ((AbstractFileNameFilter)filter).setFolderName(remoteFolder); } String nextMarker = null; do { PaginatedObjectsView paginatedView = client.listObjects(bucketName, remoteFolder,nextMarker,maxObjectsPerBatch); if(paginatedView == null) break; nextMarker = paginatedView.getNextMarker(); List<S3ObjectSummary> summaries = paginatedView.getObjectSummary(); for(S3ObjectSummary summary:summaries) { String key = summary.getKey(); if(key.endsWith("/")) { continue; } if(!filter.accept(key)) continue; AmazonS3Object s3Object = null; try { s3Object = client.getObject(bucketName, "/", key); synchronizeObjectWithFile(localDirectory,summary,s3Object); } finally { <START> if(s3Object.getInputStream() != null) { <END> s3Object.getInputStream().close(); } } } } while(nextMarker != null); } catch (IOException e) { logger.error("Caught Exception while trying to close s3object InputStream", e); } finally { lock.unlock(); if(logger.isInfoEnabled()) { logger.info("Sync completed"); } } }</code><technical_language>a null check s3Object input stream. chances slim, getObject returns null invalid key NPE in this case</technical_language>

Target:
public void synchronizeToLocalDirectory(File localDirectory, String bucketName, String remoteFolder) { if(!lock.tryLock()) { if(logger.isInfoEnabled()) { logger.info("Sync already in progess"); } return; } if(logger.isInfoEnabled()) { logger.info("Starting sync with local directory"); } try { if(remoteFolder != null && "/".equals(remoteFolder)) { remoteFolder = null; } if(filter instanceof AbstractFileNameFilter) { ((AbstractFileNameFilter)filter).setFolderName(remoteFolder); } String nextMarker = null; do { PaginatedObjectsView paginatedView = client.listObjects(bucketName, remoteFolder,nextMarker,maxObjectsPerBatch); if(paginatedView == null) break; nextMarker = paginatedView.getNextMarker(); List<S3ObjectSummary> summaries = paginatedView.getObjectSummary(); for(S3ObjectSummary summary:summaries) { String key = summary.getKey(); if(key.endsWith("/")) { continue; } if(!filter.accept(key)) continue; AmazonS3Object s3Object = null; try { s3Object = client.getObject(bucketName, "/", key); synchronizeObjectWithFile(localDirectory,summary,s3Object); } finally { if(s3Object != null && s3Object.getInputStream() != null) { s3Object.getInputStream().close(); } } } } while(nextMarker != null); } catch (IOException e) { logger.error("Caught Exception while trying to close s3object InputStream", e); } finally { lock.unlock(); if(logger.isInfoEnabled()) { logger.info("Sync completed"); } } }
Source:
<code>public VmGuestInfoModel() { <START> super(); <END> setTitle(ConstantsManager.getInstance().getConstants().sessionsTitle()); setHelpTag(HelpTag.guest_info); setHashName("guest_info"); guestOsType = OsType.Other; guestOsArch = ArchitectureType.undefined; guestOsCodename = ""; guestOsDistribution = ""; guestOsKernelVersion = ""; guestOsVersion = ""; guestOs = ""; guestOsTimezoneName = ""; guestOsTimezoneOffset = 0; guestOsNamedVersion = ""; guestOsTimezone = ""; }</code><technical_language>Explicit call super(); is redundant</technical_language>

Target:
public VmGuestInfoModel() { setTitle(ConstantsManager.getInstance().getConstants().guestInformationTitle()); setHelpTag(HelpTag.guest_info); setHashName("guest_info"); guestOsType = OsType.Other; guestOsArch = ArchitectureType.undefined; guestOsCodename = ""; guestOsDistribution = ""; guestOsKernelVersion = ""; guestOsVersion = ""; guestOs = ""; guestOsTimezoneName = ""; guestOsTimezoneOffset = 0; guestOsNamedVersion = ""; guestOsTimezone = ""; }
Source:
<code>public MethodBehavior execute(MethodTree methodTree) { try { Symbol.MethodSymbol methodSymbol = methodTree.symbol(); ExplodedGraphWalker walker = egwFactory.createWalker(behaviorCache, (SemanticModel) context.getSemanticModel()); if (methodCanNotBeOverriden(methodSymbol)) { MethodBehavior methodBehavior = new MethodBehavior(methodSymbol); behaviorCache.add(methodSymbol, methodBehavior); methodBehavior = walker.visitMethod(methodTree, methodBehavior); methodBehavior.completed(); return methodBehavior; } else { return walker.visitMethod(methodTree); } <START> } catch (ExplodedGraphWalker.MaximumStepsReachedException | ExplodedGraphWalker.ExplodedGraphTooBigException | TransitiveRelationExceededException exception) { <END> LOG.debug("Could not complete symbolic execution: ", exception); } return null; }</code><technical_language>RelationalSymbolicValue.TransitiveRelationExceededException</technical_language>

Target:
public MethodBehavior execute(MethodTree methodTree) { try { Symbol.MethodSymbol methodSymbol = methodTree.symbol(); ExplodedGraphWalker walker = egwFactory.createWalker(behaviorCache, (SemanticModel) context.getSemanticModel()); if (methodCanNotBeOverriden(methodSymbol)) { MethodBehavior methodBehavior = new MethodBehavior(methodSymbol); behaviorCache.add(methodSymbol, methodBehavior); methodBehavior = walker.visitMethod(methodTree, methodBehavior); methodBehavior.completed(); return methodBehavior; } else { return walker.visitMethod(methodTree); } } catch (ExplodedGraphWalker.MaximumStepsReachedException | ExplodedGraphWalker.ExplodedGraphTooBigException | RelationalSymbolicValue.TransitiveRelationExceededException exception) { LOG.debug("Could not complete symbolic execution: ", exception); } return null; }
Source:
<code>static Set<Type> getMajorPermissions() { <START> final Set<Type> majorTypes = new HashSet<>(); <END> for (final Type type : Type.values()) { if (type.isMajor()) { majorTypes.add(type); } } return majorTypes; }</code><technical_language>final Set<Type> majorTypes = EnumSet.noneOf(Type.class);</technical_language>

Target:
static Set<Type> getMajorPermissions() { final Set<Type> majorTypes = EnumSet.noneOf(Type.class); for (final Type type : Type.values()) { if (type.isMajor()) { majorTypes.add(type); } } return majorTypes; }
Source:
<code>private void copyPathOfSelectionToClipboard(final TreeViewer viewer) { Clipboard cb = new Clipboard(viewer.getControl().getDisplay()); TextTransfer t = TextTransfer.getInstance(); String text = getTextFrom( (IStructuredSelection) viewer.getSelection()); if (text == null) { <START> return; <END> } else { cb.setContents(new Object[] { text }, new Transfer[] { t }); } cb.dispose(); }</code><technical_language>No, dispose cb</technical_language>

Target:
private void copyPathOfSelectionToClipboard(final TreeViewer viewer) { Clipboard cb = new Clipboard(viewer.getControl().getDisplay()); TextTransfer t = TextTransfer.getInstance(); String text = getTextFrom( (IStructuredSelection) viewer.getSelection()); try { if (text != null) { cb.setContents(new Object[] { text }, new Transfer[] { t }); } } finally { cb.dispose(); } }
Source:
<code>protected static void assertAccount(Account actualAccount, String expectedType, String expectedSubType, <START> Account.VerificationStatus expectedVerificationStatus, <END> Double expectedBalanceAvailable, Double expectedBalanceCurrent, Double expectedBalanceLimit, String expectedName, String expectedMask, String expectedOfficialName) { assertNotNull(actualAccount.getAccountId()); assertEquals(expectedType, actualAccount.getType()); assertEquals(expectedSubType, actualAccount.getSubtype()); assertEquals(expectedVerificationStatus, actualAccount.getVerificationStatus()) assertEquals(expectedBalanceAvailable, actualAccount.getBalances().getAvailable()); assertEquals(expectedBalanceCurrent, actualAccount.getBalances().getCurrent()); assertEquals(expectedBalanceLimit, actualAccount.getBalances().getLimit()); assertEquals(expectedName, actualAccount.getName()); assertEquals(expectedMask, actualAccount.getMask()); assertEquals(expectedOfficialName, actualAccount.getOfficialName()); }</code><technical_language>this other fail compile</technical_language>

Target:
protected static void assertAccount(Account actualAccount, String expectedType, String expectedSubType, Account.VerificationStatus expectedVerificationStatus, Double expectedBalanceAvailable, Double expectedBalanceCurrent, Double expectedBalanceLimit, String expectedName, String expectedMask, String expectedOfficialName) { assertNotNull(actualAccount.getAccountId()); assertEquals(expectedType, actualAccount.getType()); assertEquals(expectedSubType, actualAccount.getSubtype()); assertEquals(expectedVerificationStatus, actualAccount.getVerificationStatus()); assertEquals(expectedBalanceAvailable, actualAccount.getBalances().getAvailable()); assertEquals(expectedBalanceCurrent, actualAccount.getBalances().getCurrent()); assertEquals(expectedBalanceLimit, actualAccount.getBalances().getLimit()); assertEquals(expectedName, actualAccount.getName()); assertEquals(expectedMask, actualAccount.getMask()); assertEquals(expectedOfficialName, actualAccount.getOfficialName()); }
Source:
<code>public Encounter createEncounter(String configName, Encounter encounter) { validateEncounter(encounter); Encounter createdEncounter; Config config = configService.getConfigByName(configName); List<Observation> updatedObs = resolveConceptUuidForConceptNames(config, encounter.getObs()); try { encounter.setObs(updatedObs); createdEncounter = encounterResource.createEncounter(config, encounter); eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_ENCOUNTER_SUBJECT, EventHelper.encounterParameters(createdEncounter))); } catch (HttpClientErrorException e) { <START> throw new OpenMRSException("Could not create encounter with patient uuid: " + encounter.getPatient().getUuid(), e); <END> } return createdEncounter; }</code><technical_language>I if information need displayed here. verify this ? exact informaction is wrong 400 returned. I getResponseBodyAsString here</technical_language>

Target:
public Encounter createEncounter(String configName, Encounter encounter) { validateEncounter(encounter); Encounter createdEncounter; Config config = configService.getConfigByName(configName); try { createdEncounter = encounterResource.createEncounter(config, encounter); eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_ENCOUNTER_SUBJECT, EventHelper.encounterParameters(createdEncounter))); } catch (HttpClientErrorException e) { throw new OpenMRSException(String.format("Could not create encounter with patient uuid: %s. %s %s", encounter.getPatient().getUuid(), e.getMessage(), e.getResponseBodyAsString()), e); } return createdEncounter; }
Source:
<code>private List<CloudbreakEventV4Response> getLegacyStackType(Stack stack) { List<CloudbreakEventV4Response> events = cloudbreakEventsFacade .retrieveEventsByStack(stack.getId(), StackType.LEGACY, PageRequest.of(0, Integer.MAX_VALUE)).getContent(); if (events.isEmpty()) { LOGGER.info("Cannot find any legacy events for stack: {}, crn: {}", stack.getId(), stack.getResourceCrn()); } else { <START> LOGGER.info("{} egacy events for stack: {}, crn: {}", events.size(), stack.getId(), stack.getResourceCrn()); <END> } return events; }</code><technical_language>egacy -> legacy</technical_language>

Target:
private List<CloudbreakEventV4Response> getLegacyStackType(Stack stack) { List<CloudbreakEventV4Response> events = cloudbreakEventsFacade .retrieveEventsByStack(stack.getId(), StackType.LEGACY, PageRequest.of(0, Integer.MAX_VALUE)).getContent(); if (events.isEmpty()) { LOGGER.info("Cannot find any legacy events for stack: {}, crn: {}", stack.getId(), stack.getResourceCrn()); } else { LOGGER.info("{} legacy events for stack: {}, crn: {}", events.size(), stack.getId(), stack.getResourceCrn()); } return events; }
Source:
<code>public boolean hasAttribute(final String tag) { <START> return hasAttribute(SAMTagUtil.getSingleton().makeBinaryTag(tag))!=null; <END> }</code><technical_language>this getAttribute != null</technical_language>

Target:
public boolean hasAttribute(final String tag) { return getAttribute(tag)!=null; }
Source:
<code>private static boolean shouldSkipInputFileNameCheck(String path, String fileName) { return "package-info.java".equals(fileName) || "package.html".equals(fileName) || path.contains(File.separatorChar + "inputs" + File.separatorChar) || path.contains(File.separatorChar + "translation" + File.separatorChar) <START> || fileName.charAt(0) == '.'; <END> }</code><technical_language>I removed this change ... place files in repo, this if annoying</technical_language>

Target:
private static boolean shouldSkipInputFileNameCheck(String path, String fileName) { return "package-info.java".equals(fileName) || "package.html".equals(fileName) || path.contains(File.separatorChar + "inputs" + File.separatorChar) || path.contains(File.separatorChar + "translation" + File.separatorChar); }
Source:
<code>private ManagedThreadFactoryResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_THREAD_FACTORY), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_THREAD_FACTORY)) .setAddHandler(ManagedThreadFactoryAdd.INSTANCE) <START> .setRemoveHandler(ManagedThreadFactoryRemove.INSTANCE) <END> .addCapabilities(CAPABILITY)); }</code><technical_language>setRemoveHandler(new ServiceRemoveStepHandler(ManagedThreadFactoryAdd.INSTANCE))</technical_language>

Target:
private ManagedThreadFactoryResourceDefinition() { super(new SimpleResourceDefinition.Parameters(PathElement.pathElement(EESubsystemModel.MANAGED_THREAD_FACTORY), EeExtension.getResourceDescriptionResolver(EESubsystemModel.MANAGED_THREAD_FACTORY)) .setAddHandler(ManagedThreadFactoryAdd.INSTANCE) .setRemoveHandler(new ServiceRemoveStepHandler(ManagedThreadFactoryAdd.INSTANCE)) .addCapabilities(CAPABILITY)); }
Source:
<code>public IndexedKeyFormatMapper(Collection<? extends KeyFormat<?>> keyFormats) { <START> List<KeyFormat<Object>> list = new ArrayList<>(); <END> for (KeyFormat<?> format : keyFormats) { KeyFormat<Object> objectKeyFormat = (KeyFormat<Object>) format; list.add(objectKeyFormat); } this.keyFormats = list; for (int i = 0; i < this.keyFormats.size(); ++i) { this.indexes.put(this.keyFormats.get(i).getTargetClass(), i); } this.padding = (int) (Math.log(this.keyFormats.size() - 1) / Math.log(HEX_RADIX)) + 1; }</code><technical_language>ArrayList constructed fixed capacity</technical_language>

Target:
public IndexedKeyFormatMapper(Collection<? extends KeyFormat<?>> keyFormats) { List<KeyFormat<Object>> list = new ArrayList<>(keyFormats.size()); for (KeyFormat<?> format : keyFormats) { list.add((KeyFormat<Object>) format); } this.keyFormats = list; for (int i = 0; i < this.keyFormats.size(); ++i) { this.indexes.put(this.keyFormats.get(i).getTargetClass(), i); } this.padding = (int) (Math.log(this.keyFormats.size() - 1) / Math.log(HEX_RADIX)) + 1; }
Source:
<code>protected void doStart() { try { configure(); Instant startedAt = Instant.now(); logger().debug("Trying to start container: {}", getDockerImageName()); <START> <END> AtomicInteger attempt = new AtomicInteger(0); Unreliables.retryUntilSuccess(startupAttempts, () -> { logger().debug("Trying to start container: (attempt {}/{})", getDockerImageName(), attempt.incrementAndGet(), startupAttempts); tryStart(startedAt); return true; }); } catch (Exception e) { throw new ContainerLaunchException("Container startup failed", e); } }</code><technical_language>I remove "Trying start container"</technical_language>

Target:
protected void doStart() { try { configure(); Instant startedAt = Instant.now(); logger().debug("Starting container: {}", getDockerImageName()); AtomicInteger attempt = new AtomicInteger(0); Unreliables.retryUntilSuccess(startupAttempts, () -> { logger().debug("Trying to start container: (attempt {}/{})", getDockerImageName(), attempt.incrementAndGet(), startupAttempts); tryStart(startedAt); return true; }); } catch (Exception e) { throw new ContainerLaunchException("Container startup failed", e); } }
Source:
<code>public void testManualIncrementing() throws Exception { expectInitializeNoOffsets(Arrays.asList( SINGLE_TABLE_PARTITION, <START> SINGLE_TABLE_PARTITION_WITH_VERSION)); <END> PowerMock.replayAll(); db.createTable(SINGLE_TABLE_NAME, "id", "INT NOT NULL"); db.insert(SINGLE_TABLE_NAME, "id", 1); startTask(null, "id", null); verifyIncrementingFirstPoll(TOPIC_PREFIX + SINGLE_TABLE_NAME); db.insert(SINGLE_TABLE_NAME, "id", 2); db.insert(SINGLE_TABLE_NAME, "id", 3); verifyPoll(2, "id", Arrays.asList(2, 3), false, true, false, TOPIC_PREFIX + SINGLE_TABLE_NAME); PowerMock.verifyAll(); }</code><technical_language>nit: ); next line. multiple occurrences in this file</technical_language>

Target:
public void testManualIncrementing() throws Exception { expectInitializeNoOffsets(Arrays.asList( SINGLE_TABLE_PARTITION_WITH_VERSION, SINGLE_TABLE_PARTITION) ); PowerMock.replayAll(); db.createTable(SINGLE_TABLE_NAME, "id", "INT NOT NULL"); db.insert(SINGLE_TABLE_NAME, "id", 1); startTask(null, "id", null); verifyIncrementingFirstPoll(TOPIC_PREFIX + SINGLE_TABLE_NAME); db.insert(SINGLE_TABLE_NAME, "id", 2); db.insert(SINGLE_TABLE_NAME, "id", 3); verifyPoll(2, "id", Arrays.asList(2, 3), false, true, false, TOPIC_PREFIX + SINGLE_TABLE_NAME); PowerMock.verifyAll(); }
Source:
<code><START> public OpaqueTokenConfigurer(ApplicationContext context) { <END> this.context = context; }</code><technical_language>Please remove public modifier</technical_language>

Target:
OpaqueTokenConfigurer(ApplicationContext context) { this.context = context; }
Source:
<code>public Product(String productId, String name, Owner owner, Long multiplier) { setId(productId); setName(name); <START> setOwners(new HashSet<Owner>()); <END> setMultiplier(multiplier); setAttributes(new HashSet<ProductAttribute>()); setProductContent(new LinkedList<ProductContent>()); setDependentProductIds(new HashSet<String>()); }</code><technical_language>passing owner here, adding collection</technical_language>

Target:
public Product(String productId, String name, Owner owner, Long multiplier) { setId(productId); setName(name); setOwners(new HashSet<Owner>()); setMultiplier(multiplier); setAttributes(new HashSet<ProductAttribute>()); setProductContent(new LinkedList<ProductContent>()); setDependentProductIds(new HashSet<String>()); this.addOwner(owner); }
Source:
<code>public void cannotPlayAGuessTwice() { Observable<Output> result = hangman.play( Observable.fromArray("secret"), Observable.fromArray("e", "c", "s", "c")); <START> expectedException.expect(IllegalArgumentException.class); <END> expectedException.expectMessage("Letter c was already played"); result.blockingLast(); }</code><technical_language>assertThrows instead. Also, optionally AssertJ improve assertions returned IAE</technical_language>

Target:
public void cannotPlayAGuessTwice() { Observable<Output> result = hangman.play( Observable.fromArray("secret"), Observable.fromArray("e", "c", "s", "c")); assertThatThrownBy(() -> result.blockingLast()) .isInstanceOf(IllegalArgumentException.class) .hasMessageContaining("Letter c was already played"); }
Source:
<code>public StateItem[] getStateTable() { if (fStateTable == null) { Map<@NonNull String, @NonNull OutputElementStyle> styles = getStyles(); if (styles == null || styles.isEmpty()) { return new StateItem[0]; } List<StateItem> stateItemList = new ArrayList<>(); int tableIndex = 0; for (Entry<@NonNull String, @NonNull OutputElementStyle> styleEntry : fStylesMap.entrySet()) { @NonNull Map<@NonNull String, @NonNull Object> elementStyle = styleEntry.getValue().getStyleValues(); fLabelToIndex.put(styleEntry.getKey(), tableIndex); tableIndex++; <START> Map<String, Object> styleMap = new HashMap<>(elementStyle); <END> styleMap.put(StyleProperties.STYLE_NAME, styleEntry.getKey()); stateItemList.add(new StateItem(styleMap)); } fStateTable = stateItemList.toArray(new StateItem[stateItemList.size()]); return fStateTable; } return fStateTable; }</code><technical_language>need 'flatten' style map. A property exist in a parent style</technical_language>

Target:
public StateItem[] getStateTable() { if (fStateTable == null) { Map<@NonNull String, @NonNull OutputElementStyle> styles = fetchStyles(); if (styles.isEmpty()) { return new StateItem[0]; } List<StateItem> stateItemList = new ArrayList<>(); int tableIndex = 0; for (Entry<@NonNull String, @NonNull OutputElementStyle> styleEntry : fStylesMap.entrySet()) { String styleKey = styleEntry.getKey(); fKeyToIndex.put(styleKey, tableIndex++); OutputElementStyle elementStyle = styleEntry.getValue(); Map<String, Object> styleMap = new HashMap<>(); RGBAColor rgba = getColorStyle(elementStyle, StyleProperties.BACKGROUND_COLOR); RGB rgb = (rgba != null) ? new RGB(rgba.getRed(), rgba.getGreen(), rgba.getBlue()) : new RGB(0, 0, 0); styleMap.put(StyleProperties.BACKGROUND_COLOR, ColorUtils.toHexColor(rgb)); Object styleName = getStyle(elementStyle, StyleProperties.STYLE_NAME); if (styleName instanceof String) { styleMap.put(StyleProperties.STYLE_NAME, styleName); } else { styleMap.put(StyleProperties.STYLE_NAME, styleEntry.getKey()); } Float height = getFloatStyle(elementStyle, StyleProperties.HEIGHT); if (height != null) { styleMap.put(StyleProperties.HEIGHT, height); } Object symbolType = getStyle(elementStyle, StyleProperties.SYMBOL_TYPE); if (symbolType instanceof String) { styleMap.put(StyleProperties.SYMBOL_TYPE, symbolType); } Object styleGroup = getStyle(elementStyle, StyleProperties.STYLE_GROUP); if (styleGroup != null) { styleMap.put(StyleProperties.STYLE_GROUP, styleGroup); } stateItemList.add(new StateItem(styleMap)); } fStateTable = stateItemList.toArray(new StateItem[stateItemList.size()]); return fStateTable; } return fStateTable; }
Source:
<code>public void setVoiceCallForwardingFlag(int line, boolean enable) { if (line != 1) return; callForwardingEnabled = enable; phone.setSystemProperty(PROPERTY_LINE1_VOICE_CALL_FORWARDING, (callForwardingEnabled ? "true" : "false")); <START> ((GSMPhone) phone).notifyCallForwardingIndicator(); <END> try { if (mEfCfis != null) { if (enable) { mEfCfis[1] |= 1; } else { mEfCfis[1] &= 0xfe; } ((SIMFileHandler)phone.getIccFileHandler()).updateEFLinearFixed( EF_CFIS, 1, mEfCfis, null, obtainMessage (EVENT_UPDATE_DONE, EF_CFIS)); } if (mEfCff != null) { if (enable) { mEfCff[0] = (byte) ((mEfCff[0] & CFF_LINE1_RESET) | CFF_UNCONDITIONAL_ACTIVE); } else { mEfCff[0] = (byte) ((mEfCff[0] & CFF_LINE1_RESET) | CFF_UNCONDITIONAL_DEACTIVE); } ((SIMFileHandler)phone.getIccFileHandler()).updateEFTransparent( EF_CFF_CPHS, mEfCff, obtainMessage (EVENT_UPDATE_DONE, EF_CFF_CPHS)); } } catch (ArrayIndexOutOfBoundsException ex) { Log.w(LOG_TAG, "Error saving call fowarding flag to SIM. " + "Probably malformed SIM record", ex); } }</code><technical_language>Cast necessary</technical_language>

Target:
public void setVoiceCallForwardingFlag(int line, boolean enable) { if (line != 1) return; callForwardingEnabled = enable; phone.setSystemProperty(PROPERTY_LINE1_VOICE_CALL_FORWARDING, (callForwardingEnabled ? "true" : "false")); ((GSMPhone) phone).notifyCallForwardingIndicator(); try { if (mEfCfis != null) { if (enable) { mEfCfis[1] |= 1; } else { mEfCfis[1] &= 0xfe; } phone.getIccFileHandler().updateEFLinearFixed( EF_CFIS, 1, mEfCfis, null, obtainMessage (EVENT_UPDATE_DONE, EF_CFIS)); } if (mEfCff != null) { if (enable) { mEfCff[0] = (byte) ((mEfCff[0] & CFF_LINE1_RESET) | CFF_UNCONDITIONAL_ACTIVE); } else { mEfCff[0] = (byte) ((mEfCff[0] & CFF_LINE1_RESET) | CFF_UNCONDITIONAL_DEACTIVE); } phone.getIccFileHandler().updateEFTransparent( EF_CFF_CPHS, mEfCff, obtainMessage (EVENT_UPDATE_DONE, EF_CFF_CPHS)); } } catch (ArrayIndexOutOfBoundsException ex) { Log.w(LOG_TAG, "Error saving call fowarding flag to SIM. " + "Probably malformed SIM record", ex); } }
Source:
<code>private void registerMacerator(int id) { int subId, completId; String name; { subId = 0; name = TR_NAME(Type.NONE, "50V Macerator"); MaceratorDescriptor desc = new MaceratorDescriptor(name, "maceratora", LVU, 200, LVU * 1.25, new ThermalLoadInitializer(80, -100, 10, 100000.0), lowVoltageCableDescriptor, maceratorRecipes); transparentNodeItem.addDescriptor(subId + (id << 6), desc); desc.setRunningSound("eln:macerator"); } { subId = 4; name = TR_NAME(Type.NONE, "200V Macerator"); MaceratorDescriptor desc = new MaceratorDescriptor(name, <START> "maceratorb", MVU, 1000, <END> MVU * 1.25, new ThermalLoadInitializer(80, -100, 10, 100000.0), meduimVoltageCableDescriptor, maceratorRecipes); transparentNodeItem.addDescriptor(subId + (id << 6), desc); desc.setRunningSound("eln:macerator"); } }</code><technical_language>this. change is fine, needs included in descripotion</technical_language>

Target:
private void registerMacerator(int id) { int subId, completId; String name; { subId = 0; name = TR_NAME(Type.NONE, "50V Macerator"); MaceratorDescriptor desc = new MaceratorDescriptor(name, "maceratora", LVU, 200, LVU * 1.25, new ThermalLoadInitializer(80, -100, 10, 100000.0), lowVoltageCableDescriptor, maceratorRecipes); transparentNodeItem.addDescriptor(subId + (id << 6), desc); desc.setRunningSound("eln:macerator"); } { subId = 4; name = TR_NAME(Type.NONE, "200V Macerator"); MaceratorDescriptor desc = new MaceratorDescriptor(name, "maceratorb", MVU, 2000, MVU * 1.25, new ThermalLoadInitializer(80, -100, 10, 100000.0), mediumVoltageCableDescriptor, maceratorRecipes); transparentNodeItem.addDescriptor(subId + (id << 6), desc); desc.setRunningSound("eln:macerator"); } }
Source:
<code>public ResultSet executeQuery() throws SQLException { result = null; try { if (eclQuery == null) { String message = "HPCCPreparedStatement: Cannot execute SQL command"; <START> if (warnings != null) <END> { SQLException w = warnings.getNextException(); if(w != null) { message += "\n\t"; message += w.getLocalizedMessage(); } } throw new SQLException(message); } ArrayList dsList = eclQuery.execute(parameters); if (dsList != null) result = new HPCCResultSet(this, dsList, eclQuery.getExpectedRetCols(), "HPCC Result"); } catch (Exception e) { SQLException sqlexcept = new SQLException(e.getLocalizedMessage()); sqlexcept.setStackTrace(e.getStackTrace()); if (warnings == null) warnings = new SQLWarning(); warnings.setNextException(sqlexcept); throw sqlexcept; } return result; }</code><technical_language>report exception message for warnings</technical_language>

Target:
public ResultSet executeQuery() throws SQLException { result = null; try { if (!this.closed) { if (eclQuery == null) { String message = "HPCCPreparedStatement: Cannot execute SQL command"; if (warnings != null) { SQLException w = warnings.getNextException(); if(w != null) { message += "\n\t"; message += w.getLocalizedMessage(); } } throw new SQLException(message); } ArrayList dsList = eclQuery.execute(parameters); if (dsList != null) result = new HPCCResultSet(this, dsList, eclQuery.getExpectedRetCols(), "HPCC Result"); } else throw new SQLException("HPCCPreparedStatement closed, cannot execute query"); } catch (Exception e) { SQLException sqlexcept = new SQLException(e.getLocalizedMessage()); sqlexcept.setStackTrace(e.getStackTrace()); if (warnings == null) warnings = new SQLWarning(); warnings.setNextException(sqlexcept); throw sqlexcept; } return result; }
Source:
<code>private static byte[] generateHmacSha256Bytes(String key, String valueToEncrypt) { try { SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(secretKey); mac.update(valueToEncrypt.getBytes("UTF-8")); byte[] hmacData = mac.doFinal(); return hmacData; } <START> catch (UnsupportedEncodingException | IllegalStateException | InvalidKeyException | NoSuchAlgorithmException e) { <END> throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>this is a private method, invoke in public method generateHmacSha256(), is need catch exceptions here. handle in public method a throws declaration for private method. prevent unnecessary wrapping of exceptions</technical_language>

Target:
private static byte[] generateHmacSha256Bytes(String key, String valueToEncrypt) throws UnsupportedEncodingException, IllegalStateException, InvalidKeyException, NoSuchAlgorithmException { SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(secretKey); mac.update(valueToEncrypt.getBytes("UTF-8")); byte[] hmacData = mac.doFinal(); return hmacData; }
Source:
<code>public void setServerNames(String[] serverNames) { if (serverNames == null || serverNames.length == 0 || serverNames[0].equals("")) { <START> this.serverNames = new String[] {"localhost"}; <END> } else { this.serverNames = serverNames; } }</code><technical_language>above; allocate a new array</technical_language>

Target:
public void setServerNames(String[] serverNames) { if (serverNames == null || serverNames.length == 0) { this.serverNames = new String[] {"localhost"}; } else { serverNames = Arrays.copyOf(serverNames, serverNames.length); for (int i = 0; i < serverNames.length; i++) { if (serverNames[i] == null || serverNames[i].equals("")) { serverNames[i] = "localhost"; } } this.serverNames = serverNames; } }
Source:
<code>public void afterPropertiesSet() throws Exception { <START> this.sslContext = this.sslContextSupport.getSSLContext(); <END> Assert.notNull(this.sslContext, "SSLContext must not be null"); }</code><technical_language>related this fix, get rid of this extra InitializingBean operation getSSLContext() in ctor</technical_language>

Target:
public void afterPropertiesSet() throws Exception { }
Source:
<code>protected View onCreateDialogView() { <START> ScrollView outterView = new ScrollView(getContext()); <END> outterView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); LinearLayout innerView = new LinearLayout(getContext()); innerView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); innerView.setOrientation(LinearLayout.VERTICAL); View spacerView = new View(getContext()); int spacerHeight = getContext().getResources().getDimensionPixelSize(R.dimen.margin_medium); spacerView.setLayoutParams(new ViewGroup.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, spacerHeight)); innerView.addView(spacerView); outterView.addView(innerView); configureLayoutForView(innerView); return outterView; }</code><technical_language>a minor spelling thing, t in outer</technical_language>

Target:
protected View onCreateDialogView() { ScrollView outerView = new ScrollView(getContext()); outerView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT)); LinearLayout innerView = new LinearLayout(getContext()); innerView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); innerView.setOrientation(LinearLayout.VERTICAL); View spacerView = new View(getContext()); int spacerHeight = getContext().getResources().getDimensionPixelSize(R.dimen.margin_medium); spacerView.setLayoutParams(new ViewGroup.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, spacerHeight)); innerView.addView(spacerView); outerView.addView(innerView); configureLayoutForView(innerView); return outerView; }
Source:
<code>public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { if (!sealed) { int size = (int)ExtUtil.readNumeric(in); try { <START> List<Object> l = listImplementation.newInstance(); <END> for (int i = 0; i < size; i++) { l.add(ExtUtil.read(in, type, pf)); } val = l; } catch (InstantiationException e) { throw new DeserializationException(e.getMessage()); } catch (IllegalAccessException e) { throw new DeserializationException(e.getMessage()); } } else { int size = (int)ExtUtil.readNumeric(in); Object[] theval = new Object[size]; for (int i = 0; i < size; i++) { theval[i] = ExtUtil.read(in, type, pf); } val = theval; } }</code><technical_language>Initializing list/vector size is a pretty serious performance win in serialization layer, prevents alloc/gc's needing occur. fine (just for preventing performance regressions) check if listImplemenation is a vector, if allocating new Vector(size), argumentless newInstance() otherwise. other types of lists performance gain, prevent existing code accidentally running slower, Vectors hood for anyway</technical_language>

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { if (!sealed) { int size = (int)ExtUtil.readNumeric(in); try { List<Object> l; if (listImplementation.equals(Vector.class)) { l = new Vector<>(size); } else { l = listImplementation.newInstance(); } for (int i = 0; i < size; i++) { l.add(ExtUtil.read(in, type, pf)); } val = l; } catch (InstantiationException e) { throw new DeserializationException(e.getMessage()); } catch (IllegalAccessException e) { throw new DeserializationException(e.getMessage()); } } else { int size = (int)ExtUtil.readNumeric(in); Object[] theval = new Object[size]; for (int i = 0; i < size; i++) { theval[i] = ExtUtil.read(in, type, pf); } val = theval; } }
Source:
<code>public List<LifeCycle> getLifecycle() { if (null == lifecycle) { <START> this.lifecycle = new ArrayList<>(); <END> } return lifecycle; }</code><technical_language>Is do this in a constructor get</technical_language>

Target:
public List<LifeCycle> getLifecycle() { return lifecycle; }
Source:
<code>public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); <START> progress.addFlag(OperationFlag.BACKGROUND); <END> return client.postTaskData(taskData, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }</code><technical_language>add this flag here, I think. Currently a submit is a background operation, is initiated a user</technical_language>

Target:
public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskData, Set<TaskAttribute> oldAttributes, IProgressMonitor monitor) throws CoreException { monitor = Policy.monitorFor(monitor); try { monitor.beginTask("Submitting_task", IProgressMonitor.UNKNOWN); BugzillaRestClient client = connector.getClient(repository); try { IOperationMonitor progress = OperationUtil.convert(monitor, "post taskdata", 3); return client.postTaskData(taskData, progress); } catch (BugzillaRestException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, 2, "Error post taskdata.\n\n" + e.getMessage(), e)); } } finally { monitor.done(); } }
Source:
<code>public void close() { if (this.closed) { return; } assign(ImmutableSet.of()); scheduledExec.shutdown(); try { if (!scheduledExec.awaitTermination(EXCEPTION_RETRY_DELAY_MS, TimeUnit.MILLISECONDS)) { scheduledExec.shutdownNow(); } } catch (InterruptedException e) { <START> log.info(e, "InterruptedException while shutting down"); <END> } this.closed = true; }</code><technical_language>warn least</technical_language>

Target:
public void close() { if (this.closed) { return; } assign(ImmutableSet.of()); scheduledExec.shutdown(); try { if (!scheduledExec.awaitTermination(EXCEPTION_RETRY_DELAY_MS, TimeUnit.MILLISECONDS)) { scheduledExec.shutdownNow(); } } catch (InterruptedException e) { log.warn(e, "InterruptedException while shutting down"); throw new RuntimeException(e); } this.closed = true; }
Source:
<code>public void setsVisibility() throws Exception { final File dir = Files.createTempDir(); final Base base = new MkBase(dir); final String name = "setsVisibility.txt"; final Docs docs = base.user("urn:test:1").docs(); final Doc doc = docs.doc(name); <START> final File file = dir.toPath().resolve(Paths.get("urn/test/1", name)) <END> .toFile(); file.getParentFile().mkdirs(); file.createNewFile(); MatcherAssert.assertThat( doc.attributes().visible(), Matchers.is(false) ); MatcherAssert.assertThat( new RsPrint( new TkSetVisibility(base).act( new RqWithTester( new RqFake( TkSetVisibilityTest.POST, new Href() .with(TkSetVisibilityTest.FILE, name) .with(TkSetVisibilityTest.VISIBILITY, "Public") ) ) ) ).print(), Matchers.containsString("document+visibility+set+to") ); MatcherAssert.assertThat( doc.attributes().visible(), Matchers.is(true) ); }</code><technical_language>@carlosmiranda doc.write</technical_language>

Target:
public void setsVisibility() throws Exception { final Base base = new MkBase(); final String name = "setsVisibility.txt"; final Doc doc = base.user("urn:test:1").docs().doc(name); doc.write(new ByteArrayInputStream(new byte[1]), 1); MatcherAssert.assertThat( doc.attributes().visible(), Matchers.is(false) ); MatcherAssert.assertThat( new RsPrint( new TkSetVisibility(base).act( new RqWithTester( new RqFake( TkSetVisibilityTest.POST, new Href() .with(TkSetVisibilityTest.FILE, name) .with(TkSetVisibilityTest.VISIBILITY, "Public") ) ) ) ).print(), Matchers.containsString("document+visibility+set+to") ); MatcherAssert.assertThat( doc.attributes().visible(), Matchers.is(true) ); }
Source:
<code>private static boolean proposePaxos(Commit proposal, ReplicaList replicas, int requiredParticipants, boolean timeoutIfPartial, ConsistencyLevel consistencyLevel, long queryStartNanoTime) throws WriteTimeoutException { ProposeCallback callback = new ProposeCallback(replicas.size(), requiredParticipants, !timeoutIfPartial, consistencyLevel, queryStartNanoTime); MessageOut<Commit> message = new MessageOut<Commit>(MessagingService.Verb.PAXOS_PROPOSE, proposal, Commit.serializer); <START> for (InetAddressAndPort target : replicas.asEndpoints()) <END> { if (canDoLocalRequest(target)) { StageManager.getStage(MessagingService.verbStages.get(MessagingService.Verb.PAXOS_PROPOSE)).execute(new Runnable() { public void run() { try { MessageIn<Boolean> message = MessageIn.create(FBUtilities.getBroadcastAddressAndPort(), ProposeVerbHandler.doPropose(proposal), Collections.emptyMap(), MessagingService.Verb.INTERNAL_RESPONSE, MessagingService.current_version); callback.response(message); } catch (Exception ex) { logger.error("Failed paxos propose locally", ex); } } }); } else { MessagingService.instance().sendRR(message, target, callback); } } callback.await(); if (callback.isSuccessful()) return true; if (timeoutIfPartial && !callback.isFullyRefused()) throw new WriteTimeoutException(WriteType.CAS, consistencyLevel, callback.getAcceptCount(), requiredParticipants); return false; }</code><technical_language>Another candidate for manually unwrapping</technical_language>

Target:
private static boolean proposePaxos(Commit proposal, ReplicaList replicas, int requiredParticipants, boolean timeoutIfPartial, ConsistencyLevel consistencyLevel, long queryStartNanoTime) throws WriteTimeoutException { ProposeCallback callback = new ProposeCallback(replicas.size(), requiredParticipants, !timeoutIfPartial, consistencyLevel, queryStartNanoTime); MessageOut<Commit> message = new MessageOut<Commit>(MessagingService.Verb.PAXOS_PROPOSE, proposal, Commit.serializer); for (Replica replica : replicas) { if (canDoLocalRequest(replica.getEndpoint())) { StageManager.getStage(MessagingService.verbStages.get(MessagingService.Verb.PAXOS_PROPOSE)).execute(new Runnable() { public void run() { try { MessageIn<Boolean> message = MessageIn.create(FBUtilities.getBroadcastAddressAndPort(), ProposeVerbHandler.doPropose(proposal), Collections.emptyMap(), MessagingService.Verb.INTERNAL_RESPONSE, MessagingService.current_version); callback.response(message); } catch (Exception ex) { logger.error("Failed paxos propose locally", ex); } } }); } else { MessagingService.instance().sendRR(message, replica.getEndpoint(), callback); } } callback.await(); if (callback.isSuccessful()) return true; if (timeoutIfPartial && !callback.isFullyRefused()) throw new WriteTimeoutException(WriteType.CAS, consistencyLevel, callback.getAcceptCount(), requiredParticipants); return false; }
Source:
<code>protected BuyClient getBuyClient(String shopDomain, String apiKey, String appId, String applicationName) { final BuyClientBuilder buyClientBuilder = new BuyClientBuilder() .shopDomain(shopDomain) .apiKey(apiKey) .appId(appId) .applicationName(applicationName) .callbackScheduler(Schedulers.immediate()) <START> .productPageSize(PRODUCT_PAGE_SIZE) <END> .collectionPageSize(COLLECTION_PAGE_SIZE) .productTagPageSize(PRODUCT_TAG_PAGE_SIZE) .httpTimeout(TimeUnit.SECONDS.toMillis(60), TimeUnit.SECONDS.toMillis(60)) .networkRequestRetryPolicy(1, 100, 1); if (USE_MOCK_RESPONSES) { buyClientBuilder.httpInterceptors(new MockResponder(context), new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } else if (GENERATE_MOCK_RESPONSES) { buyClientBuilder.httpInterceptors(new MockResponseGenerator(context), new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } else { buyClientBuilder.httpInterceptors(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } buyClient = buyClientBuilder.build(); return buyClient; }</code><technical_language>deprecate this function, add a new productPageRequestSize affect collection tag sizes</technical_language>

Target:
protected BuyClient getBuyClient(String shopDomain, String apiKey, String appId, String applicationName) { final BuyClientBuilder buyClientBuilder = new BuyClientBuilder() .shopDomain(shopDomain) .apiKey(apiKey) .appId(appId) .applicationName(applicationName) .callbackScheduler(Schedulers.immediate()) .productRequestPageSize(PRODUCT_PAGE_SIZE) .collectionRequestPageSize(COLLECTION_PAGE_SIZE) .productTagRequesPageSize(PRODUCT_TAG_PAGE_SIZE) .httpTimeout(TimeUnit.SECONDS.toMillis(60), TimeUnit.SECONDS.toMillis(60)) .networkRequestRetryPolicy(1, 100, 1); if (USE_MOCK_RESPONSES) { buyClientBuilder.httpInterceptors(new MockResponder(context), new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } else if (GENERATE_MOCK_RESPONSES) { buyClientBuilder.httpInterceptors(new MockResponseGenerator(context), new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } else { buyClientBuilder.httpInterceptors(new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)); } buyClient = buyClientBuilder.build(); return buyClient; }
Source:
<code>private static void tryCatchLog(Callable<Void> callable) { try { callable.call(); <START> } catch (Throwable th) { <END> logger.error("Error in unmarshalling the object:", th); } }</code><technical_language>Catch Exception instead</technical_language>

Target:
private static void tryCatchLog(Callable<Void> callable) { try { callable.call(); } catch (Exception ex) { logger.error("Error in unmarshalling the object:", ex); } }