auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public SliceArrayBlock(int positionCount, Slice[] values) { this.positionCount = positionCount; if (values.length < positionCount) { throw new IllegalArgumentException("values length is less than positionCount"); } this.values = values; sizeInBytes = getSliceArraySizeInBytes(values); retainedSizeInBytes = INSTANCE_SIZE + getSliceArrayRetainedSizeInBytes(values); }

Target:
public SliceArrayBlock(int positionCount, Slice[] values) { this.positionCount = positionCount; if (values.length < positionCount) { throw new IllegalArgumentException("values length is less than positionCount"); } this.values = values; sizeInBytes = getSliceArraySizeInBytes(values, 0, values.length); retainedSizeInBytes = INSTANCE_SIZE + getSliceArrayRetainedSizeInBytes(values); }
Source:
private WinRmClient(URL endpoint, String authenticationScheme) { this.authenticationScheme = authenticationScheme != null ? authenticationScheme : AuthSchemes.BASIC; this.endpoint = endpoint; if (this.authenticationScheme.equals(AuthSchemes.NTLM)) { Bus bus = BusFactory.getDefaultBus(); bus.getProperties().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bus.getProperties().put(AsyncHTTPConduitFactory.USE_POLICY, "ALWAYS"); } }

Target:
private WinRmClient(URL endpoint, String authenticationScheme) { this.authenticationScheme = authenticationScheme != null ? authenticationScheme : AuthSchemes.NTLM; this.endpoint = endpoint; if (!this.authenticationScheme.equals(AuthSchemes.BASIC)) { Bus bus = BusFactory.getDefaultBus(); bus.getProperties().put(AsyncHTTPConduit.USE_ASYNC, Boolean.TRUE); bus.getProperties().put(AsyncHTTPConduitFactory.USE_POLICY, "ALWAYS"); } }
Source:
private int updateInput(byte[] input, int offset, int len, boolean isFinal, byte[] output) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { int outputLen = 0; while (len > bufferSize) { updateData(input, offset, bufferSize, false); int remaining = outBuffer.remaining(); outBuffer.get(output, outputLen, remaining); outputLen += remaining; len -= bufferSize; offset += bufferSize; } updateData(input, offset, len, isFinal); return outputLen; }

Target:
private int updateInput(byte[] input, int offset, int len, boolean isFinal, byte[] output) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException { int outputLen = 0; while (len > bufferSize) { updateData(input, offset, bufferSize, false); int remaining = outBuffer.remaining(); outBuffer.get(output, outputLen, remaining); outputLen += remaining; len -= bufferSize; offset += bufferSize; } if (len > 0 || isFinal) { updateData(input, offset, len, isFinal); } return outputLen; }
Source:
private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final String nameOrEmail: reviewersToRemove) { final Account account = accountResolver.find(nameOrEmail); if (account == null) { writeError("error: reviewer does not exist \"" + nameOrEmail + "\"\n"); continue; } Account.Id accountId = account.getId(); final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { if (resultError.getType() == ReviewerResult.Error.Type.COULD_NOT_REMOVE) { final String message = resultError.getName(); String regex = accountId + "$"; if (message.matches("^.* " + regex)) { writeError("error: " + message.replaceAll(regex, "\"" + nameOrEmail + "\"\n")); } else { writeError("error: " + "\"" + nameOrEmail + "\" could not be removed\n"); } ok = false; } } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; String message; switch (resultError.getType()) { case ACCOUNT_NOT_FOUND: message = "account not found"; break; case ACCOUNT_INACTIVE: message = "account inactive"; break; case CHANGE_NOT_VISIBLE: message = "change is not visible to user"; break; default: message = "could not add reviewer"; } writeError("error: " + message + "\"" + resultError.getName() + "\"\n"); } return ok; }

Target:
private boolean modifyOne(final Change.Id changeId) throws NoSuchChangeException, UnloggedFailure, OrmException, EmailException, Exception { final ChangeControl changeControl = changeControlFactory.validateFor(changeId); boolean ok = true; for (final String nameOrEmail: reviewersToRemove) { final Account account = accountResolver.find(nameOrEmail); if (account == null) { writeError("error", "reviewer does not exist \"" + nameOrEmail + "\""); continue; } Account.Id accountId = account.getId(); final ReviewerResult result = removeReviewerFactory.create(changeId, accountId).call(); for (ReviewerResult.Error resultError : result.getErrors()) { String message; switch (resultError.getType()) { case REMOVE_NOT_PERMITTED: message = "Not permitted to remove"; case COULD_NOT_REMOVE: default: message = "Could not remove"; } writeError("error", message + " \"" + nameOrEmail + "\""); ok = false; } } final ReviewerResult result = addReviewerFactory.create(changeId, reviewersToAdd).call(); for (ReviewerResult.Error resultError : result.getErrors()) { ok = false; String message; switch (resultError.getType()) { case ACCOUNT_NOT_FOUND: message = "account not found"; break; case ACCOUNT_INACTIVE: message = "account inactive"; break; case CHANGE_NOT_VISIBLE: message = "change is not visible to user"; break; default: message = "could not add reviewer"; } writeError("error", message + "\"" + resultError.getName() + "\"\n"); } return ok; }
Source:
private void updateFavPointBox() { final int favCount = cache.getFavoritePoints(); if (favCount >= 0 && !cache.getType().isEvent()) { favoriteLine.left.setVisibility(View.VISIBLE); final int findsCount = cache.getFindsCount(); if (findsCount > 0) { favoriteLine.right.setText(res.getString(R.string.favorite_count_percent, favCount, (float) (favCount * 100) / findsCount)); } else { favoriteLine.right.setText(res.getString(R.string.favorite_count, favCount)); } } else { favoriteLine.left.setVisibility(View.GONE); } final LinearLayout layout = ButterKnife.findById(view, R.id.favpoint_box); final boolean supportsFavoritePoints = cache.supportsFavoritePoints(); layout.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE); if (!supportsFavoritePoints || cache.isOwner() || !Settings.isGCPremiumMember()) { return; } final ImageButton buttonAdd = ButterKnife.findById(view, R.id.add_to_favpoint); final ImageButton buttonRemove = ButterKnife.findById(view, R.id.remove_from_favpoint); final TextView text = ButterKnife.findById(view, R.id.favpoint_text); if (cache.isFavorite()) { buttonAdd.setVisibility(View.GONE); buttonRemove.setVisibility(View.VISIBLE); text.setText(R.string.cache_favpoint_on); } else { buttonAdd.setVisibility(View.VISIBLE); buttonRemove.setVisibility(View.GONE); text.setText(R.string.cache_favpoint_not_on); } if (!cache.isFound()) { buttonAdd.setEnabled(false); buttonAdd.setVisibility(View.GONE); buttonRemove.setEnabled(false); buttonRemove.setVisibility(View.GONE); } }

Target:
private void updateFavPointBox() { final int favCount = cache.getFavoritePoints(); if (favCount >= 0 && !cache.isEventCache()) { favoriteLine.left.setVisibility(View.VISIBLE); final int findsCount = cache.getFindsCount(); if (findsCount > 0) { favoriteLine.right.setText(res.getString(R.string.favorite_count_percent, favCount, (float) (favCount * 100) / findsCount)); } else { favoriteLine.right.setText(res.getString(R.string.favorite_count, favCount)); } } else { favoriteLine.left.setVisibility(View.GONE); } final LinearLayout layout = ButterKnife.findById(view, R.id.favpoint_box); final boolean supportsFavoritePoints = cache.supportsFavoritePoints(); layout.setVisibility(supportsFavoritePoints ? View.VISIBLE : View.GONE); if (!supportsFavoritePoints || cache.isOwner() || !Settings.isGCPremiumMember()) { return; } final ImageButton buttonAdd = ButterKnife.findById(view, R.id.add_to_favpoint); final ImageButton buttonRemove = ButterKnife.findById(view, R.id.remove_from_favpoint); final TextView text = ButterKnife.findById(view, R.id.favpoint_text); if (cache.isFavorite()) { buttonAdd.setVisibility(View.GONE); buttonRemove.setVisibility(View.VISIBLE); text.setText(R.string.cache_favpoint_on); } else { buttonAdd.setVisibility(View.VISIBLE); buttonRemove.setVisibility(View.GONE); text.setText(R.string.cache_favpoint_not_on); } if (!cache.isFound()) { buttonAdd.setEnabled(false); buttonAdd.setVisibility(View.GONE); buttonRemove.setEnabled(false); buttonRemove.setVisibility(View.GONE); } }
Source:
public AttributeSet filter(Attachment attachment) { List<Attribute> attrs = new ArrayList<>(); for (Attribute attr : getAttributes()) { if (attr.getAttachment() == attachment) { attrs.add(attr); } } return new AttributeSet(attrs.toArray(new Attribute[attrs.size()])); }

Target:
public AttributeSet filter(Attachment attachment) { List<Attribute> attrs = new ArrayList<>(); for (Attribute attr : getAttributes()) { if (attr.getAttachment() == attachment) { attrs.add(attr); } } return new AttributeSet(attrs); }
Source:
private void getClusterState( List<DiagnosticsReportSource> sources ) { if ( clusterStateDirectory == null ) { sources.add( DiagnosticsReportSources.newDiagnosticsString( "ccstate.txt", () -> "error creating ClusterStateDirectory: " + clusterStateException.getMessage() ) ); return; } for ( File file : fs.listFiles( clusterStateDirectory ) ) { if ( file.getName().equals( RAFT_LOG_DIRECTORY_NAME ) ) { continue; } addDirectory( "ccstate", file, sources ); } }

Target:
private void getClusterState( List<DiagnosticsReportSource> sources ) { if ( clusterStateDirectory == null ) { sources.add( DiagnosticsReportSources.newDiagnosticsString( "ccstate.txt", () -> "error creating ClusterStateDirectory: " + clusterStateException.getMessage() ) ); return; } for ( File file : fs.listFiles( clusterStateDirectory, ( dir, name ) -> !name.equals( RAFT_LOG_DIRECTORY_NAME ) ) ) { addDirectory( "ccstate", file, sources ); } }
Source:
public void onTrimMemory(int level) { if (level == ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { isInBackground = true; } if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE) { MemoryCacheHelper.trimMemory(); } }

Target:
public void onTrimMemory(int level) { if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_MODERATE) { MemoryCacheHelper.trimMemory(); } }
Source:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.raising.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); Elevator.raising.set(false); }

Target:
public void autonomousMain() throws AutonomousModeOverException, InterruptedException { Elevator.lowering.set(false); Elevator.raising.set(true); waitUntil(Elevator.topLimitSwitch); boolean r = Rollers.running.get(); boolean d = Rollers.direction.get(); boolean o = Rollers.open.get(); Rollers.direction.set(true); Rollers.running.set(true); Rollers.open.set(false); waitUntil(crateInPosition); Rollers.running.set(r); Rollers.direction.set(d); Rollers.open.set(o); Elevator.raising.set(false); Elevator.lowering.set(true); }
Source:
protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = null; Object retval = null; String methodName = method.getDeclaringClass().getName() + "." + MethodExecutionResult.methodToString(method) + "." + ((instance == null) ? "" : " On instance of: " + instance.getClass().getName()); Class<?> retType = method.getReturnType(); try { convertedArgs = convertArgs(method, args); } catch (SlimError e) { throw e; } catch (Exception e) { throw e; } try { retval = callMethod(instance, method, convertedArgs); } catch (Exception e) { System.out.println("InvokeMethod failed during invocation, you may want to check if the correct method signature has been identified by Slim: " + " : " + methodName); throw e; } return new MethodExecutionResult(retval, retType); }

Target:
protected MethodExecutionResult invokeMethod(Object instance, Method method, Object[] args) throws Throwable { Object[] convertedArgs = null; Object retval = null; Class<?> retType = method.getReturnType(); try { convertedArgs = convertArgs(method, args); } catch (Exception e) { String methodName = method.getDeclaringClass().getName() + "." + MethodExecutionResult.methodToString(method) + "." + ((instance == null) ? "" : " On instance of: " + instance.getClass().getName()); return new MethodExecutionResult.InvalidParameters(methodName, e); } retval = callMethod(instance, method, convertedArgs); return new MethodExecutionResult(retval, retType); }
Source:
public void close(int code, String reason) { if ((transportConnection.getConnection() != null) && (transportConnection.getConnection().isOpen())) { transportConnection.close(code, reason); try { this.webSocketClient.getFactory().stop(); } catch (Exception ex) { log.error("error while stopping websocketfactory", ex); } log.info("transport closed"); } }

Target:
public void close(int code, String reason) { if ((transportConnection.getConnection() != null) && (transportConnection.getConnection().isOpen())) { transportConnection.close(code, reason); try { this.webSocketClient.getFactory().stop(); } catch (Exception ex) { log.error("error while stopping websocketfactory", ex); } log.debug("transport closed"); } }
Source:
protected boolean canDoAction() { serverService = getGlusterServerServiceDao().get(getParameters().getServerServiceId()); if (serverService == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_SERVICE_NOT_FOUND); } if (serverService.getStatus() == manageActionDetailsMap.get(getParameters().getActionType()).getStatus()) { addCanDoActionMessage(manageActionDetailsMap.get(getParameters().getActionType()).getStatusMsg()); addCanDoActionMessage(String.format("$server %1$s", serverService.getHostName())); addCanDoActionMessage(String.format("$service %1$s", serverService.getServiceName())); return false; } return true; }

Target:
protected boolean canDoAction() { clusterId = getParameters().getClusterId(); serverId = getParameters().getServerId(); serviceType = getParameters().getServiceType(); actionType = getParameters().getActionType(); if (!actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_START) || !actionType.equalsIgnoreCase(ManageGlusterServiceCommand.MANAGE_GLUSTER_SERVICE_ACTION_TYPE_STOP)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_ACTION_TYPE); } if (serviceType != ServiceType.NFS && serviceType != ServiceType.SHD) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_INVALID_SERVICE_TYPE); } if (Guid.isNullOrEmpty(clusterId) && Guid.isNullOrEmpty(serverId)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTERID_AND_SERVERID_BOTH_NULL); } return true; }
Source:
public static String getValidReferenceId(Client client) throws AvroRemoteException { final SearchReferenceSetsRequest refSetsReq = SearchReferenceSetsRequest.newBuilder() .setAssemblyId(TestData.REFERENCESET_ASSEMBLY_ID) .build(); final SearchReferenceSetsResponse refSetsResp = client.references.searchReferenceSets(refSetsReq); final List<ReferenceSet> refSets = refSetsResp.getReferenceSets(); final SearchReferencesRequest refsReq = SearchReferencesRequest .newBuilder() .setReferenceSetId(refSets.get(0).getId()) .setMd5checksum(TestData.REFERENCE_BRCA1_MD5_CHECKSUM) .build(); final SearchReferencesResponse refsResp = client.references.searchReferences(refsReq); assertThat(refsResp).isNotNull(); final List<Reference> references = refsResp.getReferences(); assertThat(references).isNotNull().isNotEmpty(); assertThat(references).hasSize(1); return references.get(0).getId(); }

Target:
public static String getValidReferenceId(Client client) throws AvroRemoteException { final SearchReferencesRequest refsReq = SearchReferencesRequest .newBuilder() .setReferenceSetId(Utils.getReferenceSetIdByAssemblyId(client, TestData.REFERENCESET_ASSEMBLY_ID)) .setMd5checksum(TestData.REFERENCE_BRCA1_MD5_CHECKSUM) .build(); final SearchReferencesResponse refsResp = client.references.searchReferences(refsReq); assertThat(refsResp).isNotNull(); final List<Reference> references = refsResp.getReferences(); assertThat(references).isNotNull().isNotEmpty(); assertThat(references).hasSize(1); return references.get(0).getId(); }
Source:
public void testBasicAsync() throws IOException, InterruptedException, KeeperException { ZooKeeper zk = null; try { zk = createClient(new CountdownWatcher(), hostPort); final CountDownLatch latch = new CountDownLatch(1); AsyncCallback.VoidCallback cb = new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { if ( rc == 0 ) { latch.countDown(); } } }; zk.addPersistentWatch("/a/b", persistentWatcher, cb, null); Assert.assertTrue(latch.await(5, TimeUnit.SECONDS)); internalTestBasic(zk); } finally { if (zk != null) { zk.close(); } } }

Target:
public void testBasicAsync() throws IOException, InterruptedException, KeeperException { try ( ZooKeeper zk = createClient(new CountdownWatcher(), hostPort) ) { final CountDownLatch latch = new CountDownLatch(1); AsyncCallback.VoidCallback cb = new AsyncCallback.VoidCallback() { @Override public void processResult(int rc, String path, Object ctx) { if (rc == 0) { latch.countDown(); } } }; zk.addPersistentWatch("/a/b", persistentWatcher, false, cb, null); Assert.assertTrue(latch.await(5, TimeUnit.SECONDS)); internalTestBasic(zk); } }
Source:
public void read(BitBuffer input) throws CTFReaderException { alignRead(input, this.declaration); boolean signed = declaration.isSigned(); int length = declaration.getLength(); long bits = 0; ByteOrder previousByteOrder = input.getByteOrder(); if ((this.declaration.getByteOrder() != null) && (this.declaration.getByteOrder() != input.getByteOrder())) { input.setByteOrder(this.declaration.getByteOrder()); } if (length > 64) { throw new CTFReaderException("Cannot read an integer with over 64 bits. Length given: " + length); } else if (length > 32) { bits = input.get(length, signed); } else { bits = input.get(length, signed); if (!signed) { bits = bits & 0x00000000FFFFFFFFL; } } if (previousByteOrder != input.getByteOrder()) { input.setByteOrder(previousByteOrder); } value = bits; }

Target:
public void read(BitBuffer input) throws CTFReaderException { alignRead(input, this.declaration); boolean signed = declaration.isSigned(); int length = declaration.getLength(); long bits = 0; ByteOrder previousByteOrder = input.getByteOrder(); if ((this.declaration.getByteOrder() != null) && (this.declaration.getByteOrder() != input.getByteOrder())) { input.setByteOrder(this.declaration.getByteOrder()); } if (length > 64) { throw new CTFReaderException("Cannot read an integer with over 64 bits. Length given: " + length); } bits = input.get(length, signed); if (previousByteOrder != input.getByteOrder()) { input.setByteOrder(previousByteOrder); } value = bits; }
Source:
public void testRetainedSizeInBytes() { final int expectedEntries = 1000; BlockBuilder arrayBlockBuilder = new ArrayBlockBuilder(BIGINT, new BlockBuilderStatus(), expectedEntries); long initialRetainedSize = arrayBlockBuilder.getRetainedSizeInBytes(); for (int i = 0; i < expectedEntries; i++) { BlockBuilder arrayElementBuilder = arrayBlockBuilder.beginBlockEntry(); BIGINT.writeLong(arrayElementBuilder, i); arrayBlockBuilder.closeEntry(); } assertTrue(arrayBlockBuilder.getRetainedSizeInBytes() >= (expectedEntries * Long.BYTES + ClassLayout.parseClass(LongArrayBlockBuilder.class).instanceSize() + initialRetainedSize)); }

Target:
public void testRetainedSizeInBytes() { int expectedEntries = 1000; BlockBuilder arrayBlockBuilder = new ArrayBlockBuilder(BIGINT, new BlockBuilderStatus(), expectedEntries); long initialRetainedSize = arrayBlockBuilder.getRetainedSizeInBytes(); for (int i = 0; i < expectedEntries; i++) { BlockBuilder arrayElementBuilder = arrayBlockBuilder.beginBlockEntry(); BIGINT.writeLong(arrayElementBuilder, i); arrayBlockBuilder.closeEntry(); } assertTrue(arrayBlockBuilder.getRetainedSizeInBytes() >= (expectedEntries * Long.BYTES + ClassLayout.parseClass(LongArrayBlockBuilder.class).instanceSize() + initialRetainedSize)); }
Source:
public StructureData copy() { return new SpongeStructureData(); }

Target:
public StructureData copy() { return new SpongeStructureData(this.author, this.ignoreEntities, this.integrity, this.mode, this.position, this.powered, this.showAir, this.showBoundingBox, this.seed, this.size); }
Source:
public void rxFactory_nullThrows() { try { configFactory.createConfigurationBuilder() .rxFactory(null); fail("Setting a null factory from Java should fail."); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().contains("null")); } }

Target:
public void rxFactory_nullThrows() { RealmConfiguration.Builder builder = configFactory.createConfigurationBuilder(); try { builder.rxFactory(null); fail("Setting a null factory from Java should fail."); } catch (IllegalArgumentException e) { assertTrue(e.getMessage().contains("null")); } }
Source:
public X509Certificate[] getAcceptedIssuers() { X509Certificate[] X509Certs = null; try { int numberOfEntry = allStore.size(); if (numberOfEntry > 0) { X509Certs = new X509Certificate[numberOfEntry]; Enumeration<String> aliases = allStore.aliases(); int i = 0; while (aliases.hasMoreElements()) { X509Certs[i] = (X509Certificate) allStore.getCertificate((String) aliases.nextElement()); i++; } } } catch (Exception e) { Log.error(e.getMessage(), e); X509Certs = null; } return X509Certs; }

Target:
public X509Certificate[] getAcceptedIssuers() { X509Certificate[] X509Certs = null; try { int numberOfEntry = allStore.size(); if (numberOfEntry > 0) { X509Certs = new X509Certificate[numberOfEntry]; Enumeration<String> aliases = allStore.aliases(); int i = 0; while (aliases.hasMoreElements()) { X509Certs[i] = (X509Certificate) allStore.getCertificate((String) aliases.nextElement()); i++; } } } catch (KeyStoreException e) { Log.error("Cannot create accepted issuers list", e); X509Certs = null; } return X509Certs; }
Source:
static int dropAllExpiredRecords(@NonNull final SQLiteDatabase db) { final Cursor cursor = db.query(NetworkAttributesContract.TABLENAME, null, null, null, null, null, null); if (cursor == null || cursor.getCount() <= 0) return Status.ERROR_STORAGE; cursor.moveToFirst(); final ArrayList<String> l2Keys = new ArrayList<>(); while (!cursor.isAfterLast()) { final long expiry = getLong(cursor, NetworkAttributesContract.COLNAME_EXPIRYDATE, 0); final int relevance = expiry < 0 ? (int) expiry : RelevanceUtils.computeRelevanceForNow(expiry); if (relevance <= 0) { l2Keys.add(getString(cursor, NetworkAttributesContract.COLNAME_L2KEY)); } cursor.moveToNext(); } cursor.close(); int result = Status.SUCCESS; for (String key : l2Keys) { if (delteData(db, key) != Status.SUCCESS) { result = Status.ERROR_GENERIC; } } return result; }

Target:
static int dropAllExpiredRecords(@NonNull final SQLiteDatabase db) { final Cursor cursor = db.query(NetworkAttributesContract.TABLENAME, L2KEY_AND_EXPIRYDATE_COLUMN, null, null, null, null, NetworkAttributesContract.COLNAME_EXPIRYDATE); if (cursor == null || cursor.getCount() <= 0) return Status.ERROR_STORAGE; cursor.moveToFirst(); final ArrayList<String> l2Keys = new ArrayList<>(); while (!cursor.isAfterLast()) { final long expiry = getLong(cursor, NetworkAttributesContract.COLNAME_EXPIRYDATE, 0); final int relevance = RelevanceUtils.computeRelevanceForNow(expiry); if (relevance <= 0) { final String key = getString(cursor, NetworkAttributesContract.COLNAME_L2KEY); if (relevance < 0) Log.wtf(TAG, "Relevance is lower than 0 for L2key=" + key); l2Keys.add(key); } else { break; } cursor.moveToNext(); } cursor.close(); return deleteData(db, l2Keys); }
Source:
private static SortedSet<MediaType> parse(final String text) { final SortedSet<MediaType> list = new TreeSet<MediaType>(); final String[] split = new EnglishLowerCase(text).string().split(","); for (final String name : split) { if (!name.isEmpty()) { list.add(new MediaType(name)); } } return list; }

Target:
private static SortedSet<MediaType> parse(final String text) { final SortedSet<MediaType> list = new TreeSet<MediaType>(); for (final String name : new EnglishLowerCase(text).string().split(",")) { if (!name.isEmpty()) { list.add(new MediaType(name)); } } return list; }
Source:
public Set<String> getAlternativeSequenceNames() { final String anTag = getAttribute(ALTERNATIVE_SEQUENCE_NAME_TAG); return (anTag == null) ? Collections.emptySet() : Collections.unmodifiableSet(new HashSet<>(Arrays.asList(anTag.split(ALTERNATIVE_SEQUENCE_NAME_SEPARATOR)))); }

Target:
public Set<String> getAlternativeSequenceNames() { final String anTag = getAttribute(ALTERNATIVE_SEQUENCE_NAME_TAG); return (anTag == null) ? Collections.emptySet() : Collections.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(anTag.split(ALTERNATIVE_SEQUENCE_NAME_SEPARATOR)))); }
Source:
private void finishClose() { shutdown.set(true); synchronized (shutdown) { shutdown.notifyAll(); } }

Target:
private synchronized void finishClose() { stateMachine.setState(STATE_CLOSED); notifyAll(); }
Source:
public boolean test() { List<Shell> s2List = new ArrayList<Shell>(Arrays.asList(ShellLookup.getInstance().getShells())); if (!s2List.contains(oldShell)) { return true; } s2List.removeAll(previousShells); if (s2List.size() == 1) { newShell = s2List.get(0); return true; } return false; }

Target:
public boolean test() { List<Shell> currentShells = new ArrayList<Shell>(Arrays.asList(ShellLookup.getInstance().getShells())); if (!currentShells.contains(oldShell)) { return true; } currentShells.removeAll(previousShells); if (currentShells.size() == 1) { newShell = currentShells.get(0); return true; } return false; }
Source:
public Map<Integer, Map<Version, Boolean>> getSoundDeviceSupportMap() { Map<Integer, Map<Version, Boolean>> soundDeviceSupportMap = new HashMap<Integer, Map<Version, Boolean>>(); Set<Version> versionsWithNull = new HashSet<Version>(Version.ALL); versionsWithNull.add(null); Set<Integer> osIds = new HashSet<Integer>(getOsIds()); for (Integer osId : osIds) { soundDeviceSupportMap.put(osId, new HashMap<Version, Boolean>()); for (Version ver : versionsWithNull) { soundDeviceSupportMap.get(osId).put(ver, isSoundDeviceEnabled(osId, ver)); } } return soundDeviceSupportMap; }

Target:
public Map<Integer, Map<Version, Boolean>> getSoundDeviceSupportMap() { Map<Integer, Map<Version, Boolean>> soundDeviceSupportMap = new HashMap<>(); Set<Version> versionsWithNull = new HashSet<>(Version.ALL); versionsWithNull.add(null); for (Integer osId : getOsIds()) { soundDeviceSupportMap.put(osId, new HashMap<Version, Boolean>()); for (Version ver : versionsWithNull) { soundDeviceSupportMap.get(osId).put(ver, isSoundDeviceEnabled(osId, ver)); } } return soundDeviceSupportMap; }
Source:
public void renderFrame(int frameNumber, Bitmap bitmap) { Canvas canvas = new Canvas(bitmap); canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.SRC); int nextIndex; if (!isKeyFrame(frameNumber)) { nextIndex = prepareCanvasWithClosestCachedFrame(frameNumber - 1, canvas); } else { nextIndex = frameNumber; } for (int index = nextIndex; index < frameNumber; index++) { AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(index); DisposalMethod disposalMethod = frameInfo.disposalMethod; if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) { continue; } if (frameInfo.blendOperation == BlendOperation.NO_BLEND) { disposeToBackground(canvas, frameInfo); } mAnimatedDrawableBackend.renderFrame(index, canvas); mCallback.onIntermediateResult(index, bitmap); if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) { disposeToBackground(canvas, frameInfo); } } AnimatedDrawableFrameInfo frameInfo = mAnimatedDrawableBackend.getFrameInfo(frameNumber); if (frameInfo.blendOperation == BlendOperation.NO_BLEND) { disposeToBackground(canvas, frameInfo); } mAnimatedDrawableBackend.renderFrame(frameNumber, canvas); }

Target:
public void renderFrame(int frameNumber, Bitmap bitmap) { Canvas canvas = new Canvas(bitmap); canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.SRC); int nextIndex; if (!isKeyFrame(frameNumber)) { nextIndex = prepareCanvasWithClosestCachedFrame(frameNumber - 1, canvas); } else { nextIndex = frameNumber; } AnimatedDrawableFrameInfo frameInfo; for (int index = nextIndex; index < frameNumber; index++) { frameInfo = mAnimatedDrawableBackend.getFrameInfo(index); DisposalMethod disposalMethod = frameInfo.disposalMethod; if (disposalMethod == DisposalMethod.DISPOSE_TO_PREVIOUS) { continue; } if (frameInfo.blendOperation == BlendOperation.NO_BLEND) { disposeToBackground(canvas, frameInfo); } mAnimatedDrawableBackend.renderFrame(index, canvas); mCallback.onIntermediateResult(index, bitmap); if (disposalMethod == DisposalMethod.DISPOSE_TO_BACKGROUND) { disposeToBackground(canvas, frameInfo); } } frameInfo = mAnimatedDrawableBackend.getFrameInfo(frameNumber); if (frameInfo.blendOperation == BlendOperation.NO_BLEND) { disposeToBackground(canvas, frameInfo); } mAnimatedDrawableBackend.renderFrame(frameNumber, canvas); }
Source:
void apply(T t) throws Exception; } protected final void run(final Application app, final String url, final CheckedConsumer<WSRequest> test) { running(testServer(3333, app), () -> { try { test.apply(WS.url("http://localhost:3333" + url)); } catch (Throwable t) { throw new RuntimeException(t); } }); }

Target:
void apply(T t) throws Exception; } protected static void run(final Application app, final String url, final CheckedConsumer<WSRequest> test) { final int port = 3333; running(testServer(port, app), () -> { try { test.apply(WS.url("http://localhost:" + port + url)); } catch (Exception e) { throw new RuntimeException(e); } }); }
Source:
public boolean applyDetermination(ScriptContainer container, String determination) { Element mana = new Element(determination); if (!mana.isInt()) { dB.echoError("Determination for 'mana' must be a valid number."); return false; } new_mana = mana.asInt(); return super.applyDetermination(container, determination); }

Target:
public boolean applyDetermination(ScriptContainer container, String determination) { if (determination.length() > 0 && !isDefaultDetermination(determination)) { Element mana = new Element(determination); if (!mana.isInt()) { dB.echoError("Determination for 'mana' must be a valid number."); return false; } new_mana = mana.asInt(); } return super.applyDetermination(container, determination); }
Source:
public void setIsTable(String table) { if ("true".equalsIgnoreCase(table)) { this.m_isTable = true; } else { this.m_isTable = false; } }

Target:
public void setIsTable(String table) { m_isTable = "true".equalsIgnoreCase(table); }
Source:
private Repository createNestedRepo() throws IOException { File gitdir = createUniqueTestGitDir(false); FileRepositoryBuilder builder = new FileRepositoryBuilder(); builder.setGitDir(gitdir); Repository nestedRepo = builder.build(); nestedRepo.create(); FileUtils.mkdir(new File(nestedRepo.getWorkTree(), "sub")); File file = new File(nestedRepo.getWorkTree(), "sub/a.txt"); FileUtils.createNewFile(file); PrintWriter writer = new PrintWriter(file); writer.print("content"); writer.close(); File nestedRepoPath = new File(nestedRepo.getWorkTree(), "sub/nested"); FileRepositoryBuilder nestedBuilder = new FileRepositoryBuilder(); nestedBuilder.setWorkTree(nestedRepoPath); nestedBuilder.build().create(); File file2 = new File(nestedRepo.getWorkTree(), "sub/nested/b.txt"); FileUtils.createNewFile(file2); writer = new PrintWriter(file2); writer.print("content b"); writer.close(); return nestedRepo; }

Target:
private Repository createNestedRepo() throws IOException { File gitdir = createUniqueTestGitDir(false); FileRepositoryBuilder builder = new FileRepositoryBuilder(); builder.setGitDir(gitdir); Repository nestedRepo = builder.build(); nestedRepo.create(); JGitTestUtil.writeTrashFile(nestedRepo, "sub", "a.txt", "content"); File nestedRepoPath = new File(nestedRepo.getWorkTree(), "sub/nested"); FileRepositoryBuilder nestedBuilder = new FileRepositoryBuilder(); nestedBuilder.setWorkTree(nestedRepoPath); nestedBuilder.build().create(); JGitTestUtil.writeTrashFile(nestedRepo, "sub/nested", "b.txt", "content b"); return nestedRepo; }
Source:
public RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType batchSubmitTransaction(RespondingGatewayCrossGatewayBatchSubmissionSecuredRequestType body, WebServiceContext context) { RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType oResponse = null; try { AssertionType assertion = getAssertion(context, null); COREEnvelopeBatchSubmissionResponse oBatchSubmissionResponse = outboundCORE_X12DSGenericBatchRequest.batchSubmitTransaction(body.getCOREEnvelopeBatchSubmission(), assertion, body.getNhinTargetCommunities(), null); oResponse = new RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType(); oResponse.setCOREEnvelopeBatchSubmissionResponse(oBatchSubmissionResponse); oResponse.setNhinTargetCommunities(body.getNhinTargetCommunities()); } catch (Exception e) { e.printStackTrace(); LOG.error("Failed to send X12DS request to Nwhin. " + e); } return oResponse; }

Target:
public RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType batchSubmitTransaction(RespondingGatewayCrossGatewayBatchSubmissionSecuredRequestType body, WebServiceContext context) { RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType oResponse = null; try { AssertionType assertion = getAssertion(context, null); COREEnvelopeBatchSubmissionResponse oBatchSubmissionResponse = outboundCORE_X12DSGenericBatchRequest.batchSubmitTransaction(body.getCOREEnvelopeBatchSubmission(), assertion, body.getNhinTargetCommunities(), null); oResponse = new RespondingGatewayCrossGatewayBatchSubmissionResponseMessageSecuredRequestType(); oResponse.setCOREEnvelopeBatchSubmissionResponse(oBatchSubmissionResponse); oResponse.setNhinTargetCommunities(body.getNhinTargetCommunities()); } catch (Exception e) { LOG.error("Failed to send X12DS request to Nwhin. " + e); } return oResponse; }
Source:
protected ShardConsumer buildConsumer(@NonNull final ShardInfo shardInfo, @NonNull final ShardRecordProcessorFactory shardRecordProcessorFactory) { RecordsPublisher cache = retrievalConfig.retrievalFactory().createGetRecordsCache(shardInfo, metricsFactory); ShardRecordProcessorCheckpointer checkpointer = coordinatorConfig.coordinatorFactory().createRecordProcessorCheckpointer(shardInfo, checkpoint); ShardConsumerArgument argument = new ShardConsumerArgument(shardInfo, streamName, leaseRefresher, executorService, cache, shardRecordProcessorFactory.shardRecordProcessor(), checkpoint, checkpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeMillis, maxListShardsRetryAttempts, processorConfig.callProcessRecordsEvenForEmptyRecordList(), shardConsumerDispatchPollIntervalMillis, initialPosition, cleanupLeasesUponShardCompletion, ignoreUnexpetedChildShards, shardDetector, metricsFactory, aggregatorUtil); return new ShardConsumer(cache, executorService, shardInfo, lifecycleConfig.logWarningForTaskAfterMillis(), argument, lifecycleConfig.taskExecutionListener()); }

Target:
protected ShardConsumer buildConsumer(@NonNull final ShardInfo shardInfo, @NonNull final ShardRecordProcessorFactory shardRecordProcessorFactory) { RecordsPublisher cache = retrievalConfig.retrievalFactory().createGetRecordsCache(shardInfo, metricsFactory); ShardRecordProcessorCheckpointer checkpointer = coordinatorConfig.coordinatorFactory().createRecordProcessorCheckpointer(shardInfo, checkpoint); ShardConsumerArgument argument = new ShardConsumerArgument(shardInfo, streamName, leaseRefresher, executorService, cache, shardRecordProcessorFactory.shardRecordProcessor(), checkpoint, checkpointer, parentShardPollIntervalMillis, taskBackoffTimeMillis, skipShardSyncAtWorkerInitializationIfLeasesExist, listShardsBackoffTimeMillis, maxListShardsRetryAttempts, processorConfig.callProcessRecordsEvenForEmptyRecordList(), shardConsumerDispatchPollIntervalMillis, initialPosition, cleanupLeasesUponShardCompletion, ignoreUnexpetedChildShards, shardDetector, aggregatorUtil, hierarchicalShardSyncer, metricsFactory); return new ShardConsumer(cache, executorService, shardInfo, lifecycleConfig.logWarningForTaskAfterMillis(), argument, lifecycleConfig.taskExecutionListener()); }
Source:
public Resource getResource(String resourceUri) { Assert.isTrue(StringUtils.hasText(resourceUri), "Resource URI must not be empty"); try { URI uri = new URI(resourceUri); String scheme = uri.getScheme(); Assert.notNull(scheme, "a scheme (prefix) is required"); if (scheme.equals("maven")) { String coordinates = resourceUri.replaceFirst("maven:\\/*", ""); MavenResource mavenResource = MavenResource.parse(coordinates, mavenProperties); return mavenResource; } else if (scheme.equals("docker")) { String dockerUri = resourceUri.replaceFirst("docker:\\/*", ""); return new DockerResource(dockerUri); } else { ResourceLoader resourceLoader = null; if (!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https")) { resourceLoader = new DefaultResourceLoader(); } else { resourceLoader = new DownloadingUrlResourceLoader(); } return resourceLoader.getResource(resourceUri); } } catch (URISyntaxException e) { throw new RuntimeException(e); } }

Target:
public Resource getResource(String resourceUri) { Assert.isTrue(StringUtils.hasText(resourceUri), "Resource URI must not be empty"); try { String scheme = new URI(resourceUri).getScheme().toLowerCase(); Assert.notNull(scheme, "a scheme (prefix) is required"); switch (scheme) { case "maven": String coordinates = resourceUri.replaceFirst("maven:\\/*", ""); return MavenResource.parse(coordinates, mavenProperties); case "docker": String dockerUri = resourceUri.replaceFirst("docker:\\/*", ""); return new DockerResource(dockerUri); case "http": case "https": return new DownloadingUrlResourceLoader().getResource(resourceUri); default: return new DefaultResourceLoader().getResource(resourceUri); } } catch (URISyntaxException e) { throw new RuntimeException(e); } }
Source:
public void run() { try { synchronized (lock) { final LeaderLatch latch = leaderLatch.get(); if (latch == null || !latch.hasLeadership()) { log.info("LEGGO MY EGGO. [%s] is master.", latch == null ? null : latch.getLeader().getId()); stopBeingMaster(); return; } } List<Boolean> allStarted = Arrays.asList( databaseSegmentManager.isStarted(), serverInventoryView.isStarted() ); for (Boolean aBoolean : allStarted) { if (!aBoolean) { log.error("InventoryManagers not started[%s]", allStarted); stopBeingMaster(); return; } } DruidMasterRuntimeParams params = DruidMasterRuntimeParams.newBuilder() .withStartTime(startTime) .withDatasources(databaseSegmentManager.getInventory()) .withMillisToWaitBeforeDeleting(config.getMillisToWaitBeforeDeleting()) .withEmitter(emitter) .withMergeBytesLimit(config.getMergeBytesLimit()) .withMergeSegmentsLimit(config.getMergeSegmentsLimit()) .withMaxSegmentsToMove(config.getMaxSegmentsToMove()) .withEmitBalancingCostParams(config.getEmitStats()) .build(); for (DruidMasterHelper helper : helpers) { params = helper.run(params); } } catch (Exception e) { log.makeAlert(e, "Caught exception, ignoring so that schedule keeps going.").emit(); } }

Target:
public void run() { try { synchronized (lock) { final LeaderLatch latch = leaderLatch.get(); if (latch == null || !latch.hasLeadership()) { log.info("LEGGO MY EGGO. [%s] is master.", latch == null ? null : latch.getLeader().getId()); stopBeingMaster(); return; } } List<Boolean> allStarted = Arrays.asList( databaseSegmentManager.isStarted(), serverInventoryView.isStarted() ); for (Boolean aBoolean : allStarted) { if (!aBoolean) { log.error("InventoryManagers not started[%s]", allStarted); stopBeingMaster(); return; } } DruidMasterRuntimeParams params = DruidMasterRuntimeParams.newBuilder() .withStartTime(startTime) .withDatasources(databaseSegmentManager.getInventory()) .withMasterSegmentSettings(segmentSettingsAtomicReference.get()) .withEmitter(emitter) .build(); for (DruidMasterHelper helper : helpers) { params = helper.run(params); } } catch (Exception e) { log.makeAlert(e, "Caught exception, ignoring so that schedule keeps going.").emit(); } }
Source:
public String getAccountSid() throws UnknownHostException{ RCLogger.v(TAG, "getAccountSid method started"); String accountSid = null; HttpURLConnection connection = null; try { String encodedEmail = URLEncoder.encode(accountEmail, "UTF-8"); String url = "https://" + restcommDomain + ACCOUNT_SID_URL + "/" + encodedEmail; RCLogger.v(TAG, "calling url: " + url); connection = createUrlRequestWithUrl(url); connection.setRequestMethod("GET"); int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { String jsonString = getJsonFromStream(connection.getInputStream()); if (jsonString.length() > 0) { JSONObject inputJson = new JSONObject(jsonString); accountSid = inputJson.getString("sid"); } } } catch (Exception ex){ RCLogger.e(TAG, ex.toString()); if (ex instanceof UnknownHostException){ throw (UnknownHostException)ex; } } finally { if (connection != null) { connection.disconnect(); } } RCLogger.v(TAG, "getAccountSid method ended; returning account sid: " + accountSid); return accountSid; }

Target:
public String getAccountSid() throws RCException{ RCLogger.v(TAG, "getAccountSid method started"); String accountSid = null; HttpURLConnection connection = null; try { String encodedEmail = URLEncoder.encode(accountEmail, "UTF-8"); String url = "https://" + restcommDomain + ACCOUNT_SID_URL + "/" + encodedEmail; RCLogger.v(TAG, "calling url: " + url); connection = createUrlRequestWithUrl(url); connection.setRequestMethod("GET"); checkStatusCode(connection); String jsonString = getJsonFromStream(connection.getInputStream()); if (jsonString.length() > 0) { JSONObject inputJson = new JSONObject(jsonString); accountSid = inputJson.getString("sid"); } } catch (Exception ex){ handleException(ex, false); } finally { if (connection != null) { connection.disconnect(); } } RCLogger.v(TAG, "getAccountSid method ended; returning account sid: " + accountSid); return accountSid; }
Source:
private static void logMasterConfiguration(JobManagerProcessSpec spec) { JobManagerFlinkMemory flinkMemory = spec.getFlinkMemory(); LOG.info("Final Master Memory configuration:"); LOG.info(" Total Process Memory: {}", spec.getTotalProcessMemorySize().toHumanReadableString()); LOG.info(" Total Flink Memory: {}", flinkMemory.getTotalFlinkMemorySize().toHumanReadableString()); LOG.info(" Heap: {}", flinkMemory.getJvmHeapMemorySize().toHumanReadableString()); LOG.info(" Off-heap: {}", flinkMemory.getJvmDirectMemorySize().toHumanReadableString()); LOG.info(" JVM Metaspace: {}", spec.getJvmMetaspaceSize().toHumanReadableString()); LOG.info(" JVM Overhead: {}", spec.getJvmOverheadSize().toHumanReadableString()); }

Target:
private static void logMasterConfiguration(JobManagerProcessSpec spec) { JobManagerFlinkMemory flinkMemory = spec.getFlinkMemory(); LOG.info("Final Master Memory configuration:"); LOG.info(" Total Process Memory: {}", spec.getTotalProcessMemorySize().toHumanReadableString()); LOG.info(" Total Flink Memory: {}", flinkMemory.getTotalFlinkMemorySize().toHumanReadableString()); LOG.info(" JVM Heap: {}", flinkMemory.getJvmHeapMemorySize().toHumanReadableString()); LOG.info(" Off-heap: {}", flinkMemory.getJvmDirectMemorySize().toHumanReadableString()); LOG.info(" JVM Metaspace: {}", spec.getJvmMetaspaceSize().toHumanReadableString()); LOG.info(" JVM Overhead: {}", spec.getJvmOverheadSize().toHumanReadableString()); }
Source:
public void suggestArticleTypeIntoWhatVideoField(String text) { suggestArticleWhatInput.sendKeys(text); PageObjectLogging.log("SuggestArticleTypeIntoWhatVideoField", "Type '"+text+"' into 'What Video' field on 'Suggest Article Modal'", true, driver); }

Target:
public void suggestArticleTypeIntoWhatVideoField(String text) { suggestArticleWhatInput.sendKeys(text); PageObjectLogging.log( "suggestArticleTypeIntoWhatVideoField", "Type '"+text+"' into 'What Video' field on 'Suggest Article Modal'", true ); }
Source:
private void resolveSecretParams(Material material) { if ((material instanceof SecretParamAware) && ((SecretParamAware) material).hasSecretParams()) { if (material instanceof ScmMaterial) { this.secretParamResolver.resolve((ScmMaterial) material); } else if (material instanceof PluggableSCMMaterial) { this.secretParamResolver.resolve((PluggableSCMMaterial) material); } } }

Target:
private void resolveSecretParams(Material material) { if ((material instanceof SecretParamAware)) { this.secretParamResolver.resolve(material); } }
Source:
public DecimalDataRandomGenerator(int precision, int scale, double min, double max) { double largest = largestValue(precision, scale); this.precision = precision; this.scale = scale; this.min = Math.min(-1 * largest, min); this.max = Math.min(largest, max); this.fmt = "%" + precision + "." + scale + "f"; }

Target:
public DecimalDataRandomGenerator(int precision, int scale, double min, double max) { Preconditions.checkState(min < max, String.format("min bound must be less than max [%f, %f]", min, max)); double largest = Math.pow(10, precision - scale) - Math.pow(10, -scale); this.precision = precision; this.scale = scale; this.min = Math.max(-1 * largest, min); this.max = Math.min(largest, max); }
Source:
public Observable<List<Product>> getProducts(final int page, final Set<String> tags) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } final String tagsQueryStr = tags != null && !tags.isEmpty() ? TextUtils.join(",", tags.toArray()) : null; return retrofitService .getProducts(appId, null, tagsQueryStr, null, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductListings, List<Product>>()) .onErrorResumeNext(new BuyClientExceptionHandler<List<Product>>()) .observeOn(callbackScheduler); }

Target:
public Observable<List<Product>> getProducts(final int page, final Set<String> tags) { if (page < 1) { throw new IllegalArgumentException("page is a 1-based index, value cannot be less than 1"); } final String tagsQueryStr = formatQueryString(tags); return retrofitService .getProducts(appId, null, tagsQueryStr, null, page, pageSize) .retryWhen(networkRetryPolicyProvider.provide()) .doOnNext(new RetrofitSuccessHttpStatusCodeHandler<>()) .compose(new UnwrapRetrofitBodyTransformer<ProductListings, List<Product>>()) .onErrorResumeNext(new BuyClientExceptionHandler<List<Product>>()) .observeOn(callbackScheduler); }