auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void applyMigrationTasks(final ImportItem importItem, final IProgressMonitor monitor) { try { getItem(importItem).ifPresent(connectionItem -> { final TaCoKitConfigurationModel configuration = new TaCoKitConfigurationModel(connectionItem.getConnection()); if (configuration.needsMigration()) { try { manager().migrate(configuration, monitor); importItem.setProperty(connectionItem.getProperty()); final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance(); factory.save(connectionItem); final String version = RelationshipItemBuilder.LATEST_VERSION; RepositoryUpdateManager.updateDBConnection(connectionItem, version, false, false); } catch (Exception e) { logError(e); } } }); } catch (Exception e) { logError(e); } }

Target:
protected void applyMigrationTasks(final ImportItem importItem, final IProgressMonitor monitor) { try { getItem(importItem).ifPresent(connectionItem -> { final TaCoKitConfigurationModel configuration = new TaCoKitConfigurationModel(connectionItem.getConnection()); if (configuration.needsMigration()) { try { manager().migrate(configuration, monitor); importItem.setProperty(connectionItem.getProperty()); final IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance(); factory.save(connectionItem); } catch (Exception e) { logError(e); } } }); } catch (Exception e) { logError(e); } }
Source:
public final CTFClock getClock() { if (clocks.size() == 1) { if (singleClock == null) { singleClock = clocks.get(clocks.keySet().toArray()[0]); if (singleClock.getProperty(OFFSET) != null) { singleOffset = (Long) getClock().getProperty(OFFSET); } else { singleClock.addAttribute(OFFSET, 0); } if (singleClock.getProperty(FREQ) != null) { singleScale = 1000000000.0 / ((Long) singleClock.getProperty(FREQ)).doubleValue(); antiScale = 1.0 / singleScale; } } return singleClock; } return null; }

Target:
public final CTFClock getClock() { if (clocks.size() == 1) { singleClock = clocks.get(clocks.keySet().iterator().next()); return singleClock; } return null; }
Source:
public Binary completeHttpUpload(String uploadToken) throws RepositoryException { return sd.perform(new ReadOperation<Binary>("completeHttpUpload") { @Nonnull @Override public Binary perform() throws RepositoryException { HttpBlobProvider httpBlobProvider = getHttpBlobProvider(); if (httpBlobProvider == null) { throw new RepositoryException("HTTP binary upload not supported"); } Blob blob = httpBlobProvider.completeHttpUpload(uploadToken); if (blob == null) { throw new RepositoryException("HTTP binary upload could not be completed"); } ValueFactoryImpl vf = (ValueFactoryImpl) sessionContext.getValueFactory(); return vf.createBinary(blob); } }); }

Target:
public Binary completeHttpUpload(String uploadToken) throws RepositoryException { return sd.perform(new ReadOperation<Binary>("completeHttpUpload") { @Nonnull @Override public Binary perform() throws RepositoryException { HttpBlobProvider httpBlobProvider = getHttpBlobProvider(); if (httpBlobProvider == null) { throw new RepositoryException("HTTP binary upload not supported"); } Blob blob; try { blob = httpBlobProvider.completeHttpUpload(uploadToken); } catch (IllegalArgumentException e) { throw new InvalidHttpUploadTokenException(e); } if (blob == null) { throw new RepositoryException("HTTP binary upload could not be completed"); } ValueFactoryImpl vf = (ValueFactoryImpl) sessionContext.getValueFactory(); return vf.createBinary(blob); } }); }
Source:
@Override public void lock() { delegate.readLock().lock(); inc(); }

Target:
@Override public void lock() { super.lock(); inc(); }
Source:
public SimpleFeatureCollection parse(File file, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws ServiceException { OGRDataStoreFactory factory = new BridjOGRDataStoreFactory(); Map<String, String> connectionParams = new HashMap<String, String>(); connectionParams.put("DriverName", "MapInfo File"); connectionParams.put("DatasourceName", file.getAbsolutePath()); DataStore store = null; try { store = factory.createDataStore(connectionParams); String typeName = store.getTypeNames()[0]; SimpleFeatureSource source = store.getFeatureSource(typeName); CoordinateReferenceSystem crs = source.getSchema() .getGeometryDescriptor() .getCoordinateReferenceSystem(); if (crs != null) { sourceCRS = crs; } if (sourceCRS == null) { throw new ServiceException("Failed to parse MIF", JSONHelper.createJSONObject("cause", "no_source_crs")); } return FeatureCollectionParsers.read(source, sourceCRS, targetCRS); } catch (Exception e) { throw new ServiceException("Failed to parse MIF", e); } finally { if (store != null) { store.dispose(); } } }

Target:
public SimpleFeatureCollection parse(File file, CoordinateReferenceSystem sourceCRS, CoordinateReferenceSystem targetCRS) throws ServiceException { OGRDataStoreFactory factory = new BridjOGRDataStoreFactory(); Map<String, String> connectionParams = new HashMap<String, String>(); connectionParams.put("DriverName", "MapInfo File"); connectionParams.put("DatasourceName", file.getAbsolutePath()); DataStore store = null; try { store = factory.createDataStore(connectionParams); String typeName = store.getTypeNames()[0]; SimpleFeatureSource source = store.getFeatureSource(typeName); CoordinateReferenceSystem crs = source.getSchema() .getGeometryDescriptor() .getCoordinateReferenceSystem(); if (crs != null) { sourceCRS = crs; } return FeatureCollectionParsers.read(source, sourceCRS, targetCRS); } catch (ServiceException e) { throw e; } catch (Exception e) { throw new UserLayerException("Failed to parse MIF: " + e.getMessage(), UserLayerException.ErrorType.PARSER, UserLayerException.ErrorType.INVALID_FORMAT); } finally { if (store != null) { store.dispose(); } } }
Source:
public boolean isValid(Object obj) { switch (nativeValue) { case CORE_TYPE_VALUE_INTEGER: return (obj instanceof Long || obj instanceof Integer || obj instanceof Short || obj instanceof Byte); case CORE_TYPE_VALUE_BOOLEAN: return (obj instanceof Boolean); case CORE_TYPE_VALUE_STRING: return (obj instanceof String); case CORE_TYPE_VALUE_BINARY: return (obj instanceof byte[] || obj instanceof ByteBuffer); case CORE_TYPE_VALUE_DATE: return (obj instanceof java.util.Date); case CORE_TYPE_VALUE_FLOAT: return (obj instanceof Float); case CORE_TYPE_VALUE_DOUBLE: return (obj instanceof Double); case CORE_TYPE_VALUE_DECIMAL128: return (obj instanceof Decimal128); case CORE_TYPE_VALUE_OBJECT: return(obj instanceof ObjectId); case CORE_TYPE_VALUE_LIST: case CORE_TYPE_VALUE_LINKING_OBJECTS: case CORE_TYPE_VALUE_INTEGER + LIST_OFFSET: case CORE_TYPE_VALUE_BOOLEAN + LIST_OFFSET: case CORE_TYPE_VALUE_STRING + LIST_OFFSET: case CORE_TYPE_VALUE_BINARY + LIST_OFFSET: case CORE_TYPE_VALUE_DATE + LIST_OFFSET: case CORE_TYPE_VALUE_FLOAT + LIST_OFFSET: case CORE_TYPE_VALUE_DOUBLE + LIST_OFFSET: case CORE_TYPE_VALUE_DECIMAL128 + LIST_OFFSET: case CORE_TYPE_VALUE_OBJECTID + LIST_OFFSET: return false; default: throw new RuntimeException("Unsupported Realm type: " + this); } }

Target:
public boolean isValid(Object obj) { switch (nativeValue) { case CORE_TYPE_VALUE_INTEGER: return (obj instanceof Long || obj instanceof Integer || obj instanceof Short || obj instanceof Byte); case CORE_TYPE_VALUE_BOOLEAN: return (obj instanceof Boolean); case CORE_TYPE_VALUE_STRING: return (obj instanceof String); case CORE_TYPE_VALUE_BINARY: return (obj instanceof byte[] || obj instanceof ByteBuffer); case CORE_TYPE_VALUE_DATE: return (obj instanceof java.util.Date); case CORE_TYPE_VALUE_FLOAT: return (obj instanceof Float); case CORE_TYPE_VALUE_DOUBLE: return (obj instanceof Double); case CORE_TYPE_VALUE_DECIMAL128: return (obj instanceof Decimal128); case CORE_TYPE_VALUE_OBJECTID: return (obj instanceof ObjectId); case CORE_TYPE_VALUE_OBJECT: return false; case CORE_TYPE_VALUE_LIST: case CORE_TYPE_VALUE_LINKING_OBJECTS: case CORE_TYPE_VALUE_INTEGER + LIST_OFFSET: case CORE_TYPE_VALUE_BOOLEAN + LIST_OFFSET: case CORE_TYPE_VALUE_STRING + LIST_OFFSET: case CORE_TYPE_VALUE_BINARY + LIST_OFFSET: case CORE_TYPE_VALUE_DATE + LIST_OFFSET: case CORE_TYPE_VALUE_FLOAT + LIST_OFFSET: case CORE_TYPE_VALUE_DOUBLE + LIST_OFFSET: case CORE_TYPE_VALUE_DECIMAL128 + LIST_OFFSET: case CORE_TYPE_VALUE_OBJECTID + LIST_OFFSET: return false; default: throw new RuntimeException("Unsupported Realm type: " + this); } }
Source:
public Iterator iterator() { return new Iterator() { Integer cursor = 0; @Override public boolean hasNext() { return cursor != nodeList.getLength() - 1; } @Override public Node next() { cursor = new Integer(cursor + 1); if (cursor >= nodeList.getLength()) { throw new NoSuchElementException(); } else return nodeList.item(cursor); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }

Target:
public Iterator iterator() { return new Iterator() { private Integer cursor = 0; @Override public boolean hasNext() { return cursor != nodeList.getLength() - 1; } @Override public Node next() { cursor++; if (cursor >= nodeList.getLength()) { throw new NoSuchElementException(); } else { return nodeList.item(cursor); } } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
Source:
protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<MetricAttribute> disabledMetricAttributes) { if (registry == null) { throw new IllegalArgumentException("MetricRegistry must not be null !!!"); } this.registry = registry; this.filter = filter; this.executor = executor == null ? createDefaultExecutor(name) : executor; this.shutdownExecutorOnStop = shutdownExecutorOnStop; this.rateFactor = rateUnit.toSeconds(1); this.rateUnit = calculateRateUnit(rateUnit); this.durationFactor = durationUnit.toNanos(1); this.durationUnit = durationUnit.toString().toLowerCase(Locale.US); this.disabledMetricAttributes = disabledMetricAttributes != null ? disabledMetricAttributes : Collections.emptySet(); }

Target:
protected ScheduledReporter(MetricRegistry registry, String name, MetricFilter filter, TimeUnit rateUnit, TimeUnit durationUnit, ScheduledExecutorService executor, boolean shutdownExecutorOnStop, Set<MetricAttribute> disabledMetricAttributes) { if (registry == null) { throw new NullPointerException("registry == null"); } this.registry = registry; this.filter = filter; this.executor = executor == null ? createDefaultExecutor(name) : executor; this.shutdownExecutorOnStop = shutdownExecutorOnStop; this.rateFactor = rateUnit.toSeconds(1); this.rateUnit = calculateRateUnit(rateUnit); this.durationFactor = durationUnit.toNanos(1); this.durationUnit = durationUnit.toString().toLowerCase(Locale.US); this.disabledMetricAttributes = disabledMetricAttributes != null ? disabledMetricAttributes : Collections.emptySet(); }
Source:
private static IndexStore getIndexStore( final IndexSettings indexSettings, final Map<String, Function<IndexSettings, IndexStore>> indexStoreFactories) { final String storeType = indexSettings.getValue(INDEX_STORE_TYPE_SETTING); final Type type; final Boolean allowMmap = NODE_STORE_ALLOW_MMAP.get(indexSettings.getNodeSettings(), Settings.EMPTY); if (storeType.isEmpty() || Type.FS.getSettingsKey().equals(storeType)) { type = defaultStoreType(allowMmap); } else { if (isBuiltinType(storeType)) { type = Type.fromSettingsKey(storeType); } else { type = null; } } if (allowMmap == false && (type == Type.MMAPFS || type == Type.HYBRIDFS)) { throw new IllegalArgumentException("store type [" + storeType + "] is not allowed because mmap is disabled"); } final IndexStore store; if (storeType.isEmpty() || isBuiltinType(storeType)) { store = new IndexStore(indexSettings); } else { Function<IndexSettings, IndexStore> factory = indexStoreFactories.get(storeType); if (factory == null) { throw new IllegalArgumentException("Unknown store type [" + storeType + "]"); } store = factory.apply(indexSettings); if (store == null) { throw new IllegalStateException("store must not be null"); } } return store; }

Target:
private static IndexStore getIndexStore( final IndexSettings indexSettings, final Map<String, Function<IndexSettings, IndexStore>> indexStoreFactories) { final String storeType = indexSettings.getValue(INDEX_STORE_TYPE_SETTING); final Type type; final Boolean allowMmap = NODE_STORE_ALLOW_MMAP.getWithFallback(indexSettings.getNodeSettings()); if (storeType.isEmpty() || Type.FS.getSettingsKey().equals(storeType)) { type = defaultStoreType(allowMmap); } else { if (isBuiltinType(storeType)) { type = Type.fromSettingsKey(storeType); } else { type = null; } } if (allowMmap == false && (type == Type.MMAPFS || type == Type.HYBRIDFS)) { throw new IllegalArgumentException("store type [" + storeType + "] is not allowed because mmap is disabled"); } final IndexStore store; if (storeType.isEmpty() || isBuiltinType(storeType)) { store = new IndexStore(indexSettings); } else { Function<IndexSettings, IndexStore> factory = indexStoreFactories.get(storeType); if (factory == null) { throw new IllegalArgumentException("Unknown store type [" + storeType + "]"); } store = factory.apply(indexSettings); if (store == null) { throw new IllegalStateException("store must not be null"); } } return store; }
Source:
public double getFractionTransferred() { if (transferableBytes == 0) { return 1.0D; } else { double percentage = (double) transferredBytes / (double) transferableBytes; return percentage > 1.0D ? 1.0D : percentage; } }

Target:
public double getFractionTransferred() { if (transferableBytes == 0) { return 1.0D; } else { double percentage = (double) transferredBytes / (double) transferableBytes; if (percentage > 1.0D) { RealmLog.error("Invalid progress state: %s", this); return 1.0D; } else { return percentage; } } }
Source:
public void testOnStartCommandStartReplicationCommandsQueuedBeforeSetReplicators() { PeriodicReplicationService service = new TestReplicationService(mMockContext); Intent startIntent = new Intent(mMockContext, TestReplicationService.class); startIntent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService.COMMAND_START_REPLICATION); Intent stopIntent = new Intent(mMockContext, TestReplicationService.class); stopIntent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService .COMMAND_STOP_REPLICATION); service.setReplicationPolicyManager(mMockReplicationPolicyManager); service.onCreate(); final CountDownLatch latch = new CountDownLatch(2); service.setOperationStartedListener(new PeriodicReplicationService .OperationStartedListener() { @Override public void operationStarted(int operationId) { if (operationId == PeriodicReplicationService.COMMAND_START_REPLICATION) { latch.countDown(); } else if (operationId == PeriodicReplicationService.COMMAND_STOP_REPLICATION) { latch.countDown(); } } }); service.onStartCommand(startIntent, 0, 0); service.onStartCommand(stopIntent, 0, 0); service.setReplicators(mMockReplicators); try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public void testOnStartCommandStartReplicationCommandsQueuedBeforeSetReplicators() { PeriodicReplicationService service = new TestReplicationService(mMockContext); Intent startIntent = new Intent(mMockContext, TestReplicationService.class); startIntent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService.COMMAND_START_REPLICATION); Intent stopIntent = new Intent(mMockContext, TestReplicationService.class); stopIntent.putExtra(PeriodicReplicationService.EXTRA_COMMAND, PeriodicReplicationService .COMMAND_STOP_REPLICATION); service.setReplicationPolicyManager(mMockReplicationPolicyManager); service.onCreate(); final CountDownLatch latch = new CountDownLatch(2); service.setOperationStartedListener(new PeriodicReplicationService .OperationStartedListener() { @Override public void operationStarted(int operationId) { if (latch.getCount() == 2 && operationId == PeriodicReplicationService .COMMAND_START_REPLICATION) { latch.countDown(); } else if (latch.getCount() == 1 && operationId == PeriodicReplicationService .COMMAND_STOP_REPLICATION) { latch.countDown(); } else { fail("Unexpected command or commands received in incorrect order"); } } }); service.onStartCommand(startIntent, 0, 0); service.onStartCommand(stopIntent, 0, 0); service.setReplicators(mMockReplicators); try { assertTrue("The countdown should reach zero", latch.await(DEFAULT_WAIT_SECONDS, TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); } }
Source:
public static <T> void generateJSON(ChoiceProvider<T> provider, OutputStream outputStream) { Request request = RequestCycle.get().getRequest(); IRequestParameters params = request.getRequestParameters(); String term = params.getParameterValue("q").toOptionalString(); int page = params.getParameterValue("page").toInt(1); page -= 1; Response<T> response = new Response<>(); provider.query(term, page, response); OutputStreamWriter out = new OutputStreamWriter(outputStream, request.getCharset()); JSONWriter json = new JSONWriter(out); try { json.object(); json.key("items").array(); for (T item : response) { json.object(); provider.toJson(item, json); json.endObject(); } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } try { out.flush(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } }

Target:
public static <T> void generateJSON(ChoiceProvider<T> provider, OutputStream outputStream) { Request request = RequestCycle.get().getRequest(); IRequestParameters params = request.getRequestParameters(); String term = params.getParameterValue("q").toOptionalString(); int page = params.getParameterValue("page").toInt(1); page -= 1; Response<T> response = new Response<>(); provider.query(term, page, response); OutputStreamWriter out = new OutputStreamWriter(outputStream, request.getCharset()); JSONWriter json = new JSONWriter(out); try { json.object(); json.key("items").array(); for (T item : response) { json.object(); provider.toJson(item, json); json.endObject(); } json.endArray(); json.key("more").value(response.getHasMore()).endObject(); } catch (JSONException e) { throw new RuntimeException("Could not write Json response", e); } try { out.flush(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } try { out.close(); } catch (IOException e) { throw new RuntimeException("Could not write Json to servlet response", e); } }
Source:
public Class<? extends Permission> getPermissionClass(String className) { try { return (Class<? extends Permission>) this.getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e) { LOGGER.warn("permission class not found: ", e); return null; } }

Target:
public Class<? extends Permission> getPermissionClass(String className) throws ClassNotFoundException { if (supported.containsKey(className)) { return supported.get(className); } LOGGER.warn("permission class not found: {}", className); throw new ClassNotFoundException("PermissionType " + className + " not found in this provider"); }
Source:
private void notifyFilteredOut(Object[] rawResult, Object[] filteredResult) { int rawIndex = 0; int filteredIndex = 0; for (; filteredIndex < filteredResult.length; ) { if (!rawResult[rawIndex].equals(filteredResult[filteredIndex])) { associateListener.filteredOut(rawResult[rawIndex++]); continue; } rawIndex++; filteredIndex++; } for (; rawIndex < rawResult.length; rawIndex++) { associateListener.filteredOut(rawResult[rawIndex]); } }

Target:
private void notifyFilteredOut(Object[] rawResult, Object[] filteredResult) { int rawIndex = 0; int filteredIndex = 0; for (; filteredIndex < filteredResult.length; ) { if (rawIndex < rawResult.length && rawResult[rawIndex] != filteredResult[filteredIndex]) { associateListener.filteredOut(rawResult[rawIndex++]); continue; } rawIndex++; filteredIndex++; } for (; rawIndex < rawResult.length; rawIndex++) { associateListener.filteredOut(rawResult[rawIndex]); } }
Source:
private static boolean isAcceptableDumpingDatabase(String databaseName) { return (databaseName == null || !databaseName.equalsIgnoreCase("information_schema")); }

Target:
private static boolean isAcceptableDumpingDatabase(String databaseName) { return (databaseName == null || !databaseName.equalsIgnoreCase(CatalogConstants.INFORMATION_SCHEMA_DB_NAME)); }
Source:
private <T extends BaseResourceIndex> void tryToReuseIndexEntities(List<T> theIndexesToRemove, List<T> theIndexesToAdd) { for (int addIndex = 0; addIndex < theIndexesToAdd.size(); addIndex++) { if (theIndexesToRemove.isEmpty()) { break; } T entityToReuse = theIndexesToRemove.remove(theIndexesToRemove.size() - 1); entityToReuse.populateFrom(theIndexesToAdd.get(addIndex)); theIndexesToAdd.set(addIndex, entityToReuse); } }

Target:
private <T extends BaseResourceIndex> void tryToReuseIndexEntities(List<T> theIndexesToRemove, List<T> theIndexesToAdd) { for (int addIndex = 0; addIndex < theIndexesToAdd.size(); addIndex++) { if (theIndexesToRemove.isEmpty()) { break; } T targetEntity = theIndexesToAdd.get(addIndex); if (targetEntity.getId() != null) { continue; } T entityToReuse = theIndexesToRemove.remove(theIndexesToRemove.size() - 1); targetEntity.setId(entityToReuse.getId()); } }
Source:
private Map<String, Object> extractCoreGeneralInfo(XmlNode domain) { Map<String, Object> info = new HashMap<>(); info.put(VdsProperties.vm_name, domain.selectSingleNode("name").innerText); info.put(VdsProperties.vm_guid, domain.selectSingleNode("uuid").innerText); XmlNode cpusTopology = domain.selectSingleNode("cpu").selectSingleNode("topology"); if (cpusTopology != null) { info.put(VdsProperties.num_of_cpus, cpusTopology.attributes.get("sockets").innerText); } else { info.put(VdsProperties.num_of_cpus, domain.selectSingleNode("vcpu").innerText); } info.put(VdsProperties.mem_size_mb, domain.selectSingleNode("memory").innerText); XmlNode maxMemory = domain.selectSingleNode("maxMemory"); if (maxMemory == null) { maxMemory = domain.selectSingleNode("memory"); } info.putAll(DomainXmlUtils.parseMaxMemSize(maxMemory)); info.put(VdsProperties.emulatedMachine, DomainXmlUtils.parseEmulatedMachine(domain.selectSingleNode("os"))); return info; }

Target:
private Map<String, Object> extractCoreGeneralInfo(XmlNode domain) { Map<String, Object> info = new HashMap<>(); info.put(VdsProperties.vm_name, domain.selectSingleNode("name").innerText); info.put(VdsProperties.vm_guid, domain.selectSingleNode("uuid").innerText); XmlNode cpusTopology = domain.selectSingleNode("cpu").selectSingleNode("topology"); if (cpusTopology != null) { info.put(VdsProperties.num_of_cpus, cpusTopology.attributes.get("sockets").innerText); } else { info.put(VdsProperties.num_of_cpus, domain.selectSingleNode("vcpu").innerText); } info.put(VdsProperties.mem_size_mb, domain.selectSingleNode("memory").innerText); info.putAll(DomainXmlUtils.parseMaxMemSize(domain.selectSingleNode("maxMemory"))); info.put(VdsProperties.emulatedMachine, DomainXmlUtils.parseEmulatedMachine(domain.selectSingleNode("os"))); return info; }
Source:
public void testInvalidateAll() throws InterruptedException, ExecutionException, TimeoutException, NetworkException, InjectionException { setup(0); final BlockingQueue<EncodedKey<Integer>> pullKeyToReplyQueue = new LinkedBlockingQueue<>(); final ExecutorService executorService = ParameterWorkerTestUtil.setupPullReplyingThread(pullKeyToReplyQueue, workerHandler); ParameterWorkerTestUtil.setupSenderToEnqueuePullOps(pullKeyToReplyQueue, mockSender); final int numPulls = 1000; final CountDownLatch countDownLatch = new CountDownLatch(1); final ExecutorService pool = Executors.newSingleThreadExecutor(); final AsyncParameterWorker<Integer, Integer, Integer> asyncParameterWorker = (AsyncParameterWorker<Integer, Integer, Integer>) parameterWorker; pool.submit(() -> { for (int pull = 0; pull < numPulls; ++pull) { asyncParameterWorker.pull(0); asyncParameterWorker.invalidateAll(); } countDownLatch.countDown(); }); pool.shutdown(); final boolean allThreadsFinished = countDownLatch.await(10, TimeUnit.SECONDS); asyncParameterWorker.close(ParameterWorkerTestUtil.CLOSE_TIMEOUT); assertTrue(ParameterWorkerTestUtil.MSG_THREADS_SHOULD_FINISH, allThreadsFinished); verify(mockSender, times(numPulls)).sendPullMsg(anyString(), anyObject()); executorService.shutdown(); }

Target:
public void testInvalidateAll() throws InterruptedException, ExecutionException, TimeoutException, NetworkException, InjectionException { prepare(Long.MAX_VALUE); final BlockingQueue<EncodedKey<Integer>> pullKeyToReplyQueue = new LinkedBlockingQueue<>(); final ExecutorService executorService = ParameterWorkerTestUtil.startPullReplyingThreads(pullKeyToReplyQueue, workerHandler); ParameterWorkerTestUtil.setupSenderToEnqueuePullOps(pullKeyToReplyQueue, mockSender); final int numPulls = 1000; final CountDownLatch countDownLatch = new CountDownLatch(1); final ExecutorService pool = Executors.newSingleThreadExecutor(); final AsyncParameterWorker<Integer, Integer, Integer> asyncParameterWorker = (AsyncParameterWorker<Integer, Integer, Integer>) parameterWorker; pool.submit(() -> { for (int pull = 0; pull < numPulls; ++pull) { asyncParameterWorker.pull(0); asyncParameterWorker.invalidateAll(); } countDownLatch.countDown(); }); pool.shutdown(); final boolean allThreadsFinished = countDownLatch.await(10, TimeUnit.SECONDS); asyncParameterWorker.close(ParameterWorkerTestUtil.CLOSE_TIMEOUT); assertTrue(ParameterWorkerTestUtil.MSG_THREADS_SHOULD_FINISH, allThreadsFinished); verify(mockSender, times(numPulls)).sendPullMsg(anyString(), anyObject()); executorService.shutdown(); }
Source:
public int getInstanceCap() { return instanceCap; }

Target:
public Integer getInstanceCap() { return instanceCap; }
Source:
public void onLocationChanged(Location location) { if (location != null) { if (target != null) { String result = GeoUtils.locationToString(location); TreeReference qualifiedReference = mContextRef == null ? target : target.contextualize(mContextRef); EvaluationContext context = new EvaluationContext(mModel.getEvaluationContext(), qualifiedReference); AbstractTreeElement node = context.resolveReference(qualifiedReference); if(node == null) { Context applicationContext = CommCareApplication._(); Intent xpathErrorIntent = new Intent(XPATH_ERROR_ACTION); xpathErrorIntent.putExtra(KEY_UNRESOLVED_XPATH, qualifiedReference.toString(true)); applicationContext.sendStickyBroadcast(xpathErrorIntent); } else { int dataType = node.getDataType(); IAnswerData val = Recalculate.wrapData(result, dataType); mModel.setValue(val == null ? null: AnswerDataFactory.templateByDataType(dataType).cast(val.uncast()), qualifiedReference); } } Context context = CommCareApplication._().getApplicationContext(); if (location.getAccuracy() <= GeoUtils.GOOD_ACCURACY && (ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED)) { mLocationManager.removeUpdates(this); } } }

Target:
public void onLocationChanged(Location location) { if (location != null) { if (target != null) { String result = GeoUtils.locationToString(location); TreeReference qualifiedReference = mContextRef == null ? target : target.contextualize(mContextRef); EvaluationContext context = new EvaluationContext(mModel.getEvaluationContext(), qualifiedReference); AbstractTreeElement node = context.resolveReference(qualifiedReference); if(node == null) { Context applicationContext = CommCareApplication._(); Intent xpathErrorIntent = new Intent(XPATH_ERROR_ACTION); xpathErrorIntent.putExtra(KEY_UNRESOLVED_XPATH, qualifiedReference.toString(true)); applicationContext.sendStickyBroadcast(xpathErrorIntent); } else { int dataType = node.getDataType(); IAnswerData val = Recalculate.wrapData(result, dataType); mModel.setValue(val == null ? null: AnswerDataFactory.templateByDataType(dataType).cast(val.uncast()), qualifiedReference); } } if (location.getAccuracy() <= GeoUtils.GOOD_ACCURACY && hasLocationPerms()) { mLocationManager.removeUpdates(this); } } }
Source:
public Iterator<Path> iterator() { List<Path> result = new ArrayList<>(); virtualFile.children(FileSearch.iterateAll(child -> result.add(new BridgePath(child, fs)))); return result.iterator(); }

Target:
public Iterator<Path> iterator() { List<Path> result = new ArrayList<>(); virtualFile.children(FileSearch.iterateAll(child -> result.add(new BridgePath(child, fileSystem)))); return result.iterator(); }
Source:
public byte[] encode(final List<Vector> list) { int totalLength = 0; Vector e; for (Iterator baos = list.iterator(); baos.hasNext();) { e = (Vector)baos.next(); totalLength += 32 + 64 * e.length(); } final ByteArrayOutputStream var20 = new ByteArrayOutputStream(32 + totalLength); try { final DataOutputStream var21 = new DataOutputStream(var20); Throwable var5 = null; try { var21.writeInt(list.size()); final Iterator var6 = list.iterator(); while (var6.hasNext()) { final Vector vector = (Vector)var6.next(); final int length = vector.length(); var21.writeInt(length); for (int i = 0; i < length; ++i) { var21.writeDouble(vector.get(i)); } } } catch (Throwable var17) { var5 = var17; throw var17; } finally { if (var21 != null) { if (var5 != null) { try { var21.close(); } catch (Throwable var16) { var5.addSuppressed(var16); } } else { var21.close(); } } } } catch (IOException var19) { throw new RuntimeException(var19.getCause()); } return var20.toByteArray(); }

Target:
public byte[] encode(final List<Vector> list) { int vectorLength = 0; for (final Vector vector : list) { vectorLength = vector.length(); } try (ByteArrayOutputStream baos = new ByteArrayOutputStream(Integer.SIZE + Integer.SIZE + Double.SIZE * vectorLength * list.size())) { try (DataOutputStream dos = new DataOutputStream(baos)) { dos.writeInt(list.size()); dos.writeInt(vectorLength); for (final Vector vector : list) { for (int i = 0; i < vectorLength; ++i) { dos.writeDouble(vector.get(i)); } } } return baos.toByteArray(); } catch (final IOException e) { throw new RuntimeException(e); } }
Source:
public Class<? extends ColumnHandle> getColumnHandleClass() { return TestingMetadata.TestingColumnHandle.class; }

Target:
public Class<? extends ColumnHandle> getColumnHandleClass() { return TestingColumnHandle.class; }
Source:
private void createSchema() { Connection conn = null; try { conn = provider.getConnection(); conn.setAutoCommit(false); Statement stmt = conn.createStatement(); stmt.addBatch("create table if not exists rp(id varchar(36) primary key, data varchar(65534))"); stmt.addBatch("create table if not exists expired_objects( key varchar(50), value varchar(50), type varchar(5), iat TIMESTAMP, exp TIMESTAMP)"); stmt.executeBatch(); stmt.close(); conn.commit(); LOG.debug("Schema created successfully."); } catch (Exception e) { LOG.error("Failed to create schema. Error: " + e.getMessage(), e); rollbackSilently(conn); throw new RuntimeException(e); } finally { IOUtils.closeSilently(conn); } }

Target:
private void createSchema() { Connection conn = null; try { conn = provider.getConnection(); conn.setAutoCommit(false); Statement stmt = conn.createStatement(); stmt.addBatch("create table if not exists rp(id varchar(36) primary key, data varchar(65534))"); stmt.addBatch("create table if not exists expired_objects( key varchar(50), value varchar(65534), type varchar(20), iat TIMESTAMP, exp TIMESTAMP)"); stmt.executeBatch(); stmt.close(); conn.commit(); LOG.debug("Schema created successfully."); } catch (Exception e) { LOG.error("Failed to create schema. Error: " + e.getMessage(), e); rollbackSilently(conn); throw new RuntimeException(e); } finally { IOUtils.closeSilently(conn); } }
Source:
protected void executeCommand() { setGlusterVolumeId(option.getVolumeId()); setGlusterVolumeName(getGlusterVolume().getName()); executeVdsCommand(VDSCommandType.SetGlusterVolumeOption, new GlusterVolumeOptionVDSParameters(getUpServer().getId(), getGlusterVolumeName(), getParameters().getVolumeOption())); if (getSucceeded()) { updateOptionInDb(getParameters().getVolumeOption()); } }

Target:
protected void executeCommand() { setGlusterVolumeId(option.getVolumeId()); setGlusterVolumeName(getGlusterVolume().getName()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.SetGlusterVolumeOption, new GlusterVolumeOptionVDSParameters(getUpServer().getId(), getGlusterVolumeName(), getParameters().getVolumeOption())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { updateOptionInDb(getParameters().getVolumeOption()); } }
Source:
public static BluetoothGattDescriptor getCharacteristicUserDescriptionDescriptor(String defaultValue) { BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor( CHARACTERISTIC_USER_DESCRIPTION_UUID, (BluetoothGattDescriptor.PERMISSION_READ | BluetoothGattDescriptor.PERMISSION_WRITE)); try { descriptor.setValue(defaultValue.getBytes("UTF-8")); } finally { return descriptor; } }

Target:
public static BluetoothGattDescriptor getCharacteristicUserDescriptionDescriptor(String defaultValue) { BluetoothGattDescriptor descriptor = new BluetoothGattDescriptor( CHARACTERISTIC_USER_DESCRIPTION_UUID, (BluetoothGattDescriptor.PERMISSION_READ)); try { descriptor.setValue(defaultValue.getBytes("UTF-8")); } finally { return descriptor; } }
Source:
public String create(final String path, byte data[], List<ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException { final String clientPath = path; PathUtils.validatePath(clientPath, createMode.isSequential()); EphemeralType.validateTTL(createMode, -1); final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(createMode.isContainer() ? ZooDefs.OpCode.createContainer : ZooDefs.OpCode.create); CreateRequest request = new CreateRequest(); CreateResponse response = new CreateResponse(); request.setData(data); request.setFlags(createMode.toFlag()); request.setPath(serverPath); if (acl == null || acl.size() == 0) { throw new KeeperException.InvalidACLException(); } request.setAcl(acl); ReplyHeader r = cnxn.submitRequest(h, request, response, null); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (cnxn.chrootPath == null) { return response.getPath(); } else { return response.getPath().substring(cnxn.chrootPath.length()); } }

Target:
public String create(final String path, byte data[], List<ACL> acl, CreateMode createMode) throws KeeperException, InterruptedException { final String clientPath = path; PathUtils.validatePath(clientPath, createMode.isSequential()); EphemeralType.validateTTL(createMode, -1); validateACL(acl); final String serverPath = prependChroot(clientPath); RequestHeader h = new RequestHeader(); h.setType(createMode.isContainer() ? ZooDefs.OpCode.createContainer : ZooDefs.OpCode.create); CreateRequest request = new CreateRequest(); CreateResponse response = new CreateResponse(); request.setData(data); request.setFlags(createMode.toFlag()); request.setPath(serverPath); request.setAcl(acl); ReplyHeader r = cnxn.submitRequest(h, request, response, null); if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } if (cnxn.chrootPath == null) { return response.getPath(); } else { return response.getPath().substring(cnxn.chrootPath.length()); } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((date == null) ? 0 : date.hashCode()); result = prime * result + desc.hashCode(); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hash(date, desc, type); }
Source:
public PartBuilder part( String name, @Nullable String filename, Object part, @Nullable MediaType contentType) { Assert.hasLength(name, "'name' must not be empty"); Assert.notNull(part, "'part' must not be null"); if (part instanceof Publisher) { throw new IllegalArgumentException("Use publisher(String, Publisher, Class) or " + "publisher(String, Publisher, ParameterizedTypeReference) for adding Publisher parts"); } if (part instanceof PublisherEntity<?,?>) { PublisherPartBuilder<?, ?> builder = new PublisherPartBuilder<>((PublisherEntity<?, ?>) part); this.parts.add(name, builder); return builder; } Object partBody; HttpHeaders partHeaders = new HttpHeaders(); if (filename != null) { partHeaders.setContentDispositionFormData(name, filename); } if (part instanceof HttpEntity) { HttpEntity<?> httpEntity = (HttpEntity<?>) part; partBody = httpEntity.getBody(); partHeaders.addAll(httpEntity.getHeaders()); } else { partBody = part; } if (contentType != null) { partHeaders.setContentType(contentType); } DefaultPartBuilder builder = new DefaultPartBuilder(partHeaders, partBody); this.parts.add(name, builder); return builder; }

Target:
public PartBuilder part( String name, @Nullable String filename, Object part, @Nullable MediaType contentType) { Assert.hasLength(name, "'name' must not be empty"); Assert.notNull(part, "'part' must not be null"); if (part instanceof Publisher) { throw new IllegalArgumentException("Use publisher(String, Publisher, Class) or " + "publisher(String, Publisher, ParameterizedTypeReference) for adding Publisher parts"); } if (part instanceof PublisherEntity<?,?>) { PublisherPartBuilder<?, ?> builder = new PublisherPartBuilder<>((PublisherEntity<?, ?>) part); this.parts.add(name, builder); return builder; } Object partBody; HttpHeaders partHeaders = new HttpHeaders(); if (StringUtils.hasLength(filename)) { partHeaders.setContentDispositionFormData(name, filename); } if (part instanceof HttpEntity) { HttpEntity<?> httpEntity = (HttpEntity<?>) part; partBody = httpEntity.getBody(); partHeaders.addAll(httpEntity.getHeaders()); } else { partBody = part; } if (contentType != null) { partHeaders.setContentType(contentType); } DefaultPartBuilder builder = new DefaultPartBuilder(partHeaders, partBody); this.parts.add(name, builder); return builder; }
Source:
public NamedComponentsSearchingTestCDI11() { CDIVersion = "1.1"; }

Target:
public NamedComponentsSearchingTestCDI11() { CDIVersion = "1.2"; }
Source:
private List<Map<String, Object>> getListActions(Metacard workspaceMetacard) { final String host = SystemBaseUrl.getProtocol() + SystemBaseUrl.getHost() + ":" + SystemBaseUrl.getPort(); return actionRegistry .list(workspaceMetacard) .stream() .filter(action -> action.getId().startsWith(LIST_ACTION_PREFIX)) .map( action -> { final String url = action.getUrl().toString().replaceFirst(host, ""); final Map<String, Object> actionMap = new HashMap<>(); actionMap.put("id", action.getId()); actionMap.put("url", url); actionMap.put("title", action.getTitle()); actionMap.put("description", action.getDescription()); return actionMap; }) .collect(toList()); }

Target:
private List<Map<String, Object>> getListActions(Metacard workspaceMetacard) { final String host = SystemBaseUrl.getBaseUrl(); return actionRegistry .list(workspaceMetacard) .stream() .filter(action -> action.getId().startsWith(LIST_ACTION_PREFIX)) .map( action -> { final String url = action.getUrl().toString().replaceFirst(host, ""); final Map<String, Object> actionMap = new HashMap<>(); actionMap.put("id", action.getId()); actionMap.put("url", url); actionMap.put("title", action.getTitle()); actionMap.put("description", action.getDescription()); return actionMap; }) .collect(toList()); }
Source:
private void assertRegionBucketsConsistency() throws ForceReattemptException { List<BucketDump> bucketDumps; PartitionedRegion region = (PartitionedRegion) cacheRule.getCache().getRegion(REGION_NAME); int expectedCopies = region.getRedundantCopies() + 1; for (int bucketId = 0; bucketId < BUCKETS; bucketId++) { bucketDumps = region.getAllBucketEntries(bucketId); assertThat(bucketDumps.size()) .as("Bucket " + bucketId + " should have " + expectedCopies + " copies, but has " + bucketDumps.size()) .isEqualTo(expectedCopies); if (bucketDumps.size() > 1) { BucketDump firstDump = bucketDumps.get(0); for (int j = 1; j < bucketDumps.size(); j++) { BucketDump otherDump = bucketDumps.get(j); assertThat(otherDump.getRvv()) .as("RegionVersionVector for bucket " + bucketId + " on member " + otherDump.getMember() + " is not consistent with member " + firstDump.getMember()) .isEqualTo(firstDump.getRvv()); assertThat(otherDump.getValues()) .as("Values for bucket " + bucketId + " on member " + otherDump.getMember() + " are not consistent with member " + firstDump.getMember()) .isEqualTo(firstDump.getValues()); assertThat(otherDump.getVersions()) .as("Versions for bucket " + bucketId + " on member " + otherDump.getMember() + " are not consistent with member " + firstDump.getMember()) .isEqualTo(firstDump.getVersions()); } } } }

Target:
private void assertRegionBucketsConsistency() throws ForceReattemptException { List<BucketDump> bucketDumps; PartitionedRegion region = (PartitionedRegion) cacheRule.getCache().getRegion(REGION_NAME); int expectedCopies = region.getRedundantCopies() + 1; for (int bId = 0; bId < BUCKETS; bId++) { final int bucketId = bId; bucketDumps = region.getAllBucketEntries(bucketId); assertThat(bucketDumps.size()) .as("Bucket " + bucketId + " should have " + expectedCopies + " copies, but has " + bucketDumps.size()) .isEqualTo(expectedCopies); if (bucketDumps.size() > 1) { BucketDump firstDump = bucketDumps.get(0); for (int j = 1; j < bucketDumps.size(); j++) { BucketDump otherDump = bucketDumps.get(j); assertRegionVersionVectorsConsistency(bucketId, firstDump, otherDump); await().untilAsserted(() -> assertThat(otherDump.getValues()) .as("Values for bucket " + bucketId + " on member " + otherDump.getMember() + " are not consistent with member " + firstDump.getMember()) .isEqualTo(firstDump.getValues())); await().untilAsserted(() -> assertThat(otherDump.getVersions()) .as("Versions for bucket " + bucketId + " on member " + otherDump.getMember() + " are not consistent with member " + firstDump.getMember()) .isEqualTo(firstDump.getVersions())); } } } }
Source:
protected void minify(BufferedReader in, BufferedWriter out, String filename, String type) throws IOException { try { if (JS_TYPE.equals(type)) { jsMinificationService.minifyJs(filename, in, out); } else if (CSS_TYPE.equals(type)) { cssMinificationService.minifyCss(filename, in, out); } else { throw new ResourceMinificationException("Minification is not supported for file: " + filename); } } catch (ResourceMinificationException e) { throw new RuntimeException(e); } }

Target:
protected void minify(BufferedReader in, BufferedWriter out, String filename, String type) throws IOException { try { if (JS_TYPE.equals(type)) { jsMinificationService.minifyJs(filename, in, out); } else if (CSS_TYPE.equals(type)) { cssMinificationService.minifyCss(filename, in, out); } else { throw new ResourceMinificationException("Minification is not supported for file: " + filename); } } catch (ResourceMinificationException e) { throw new IOException(e); } }
Source:
private Optional<CertificationResult> getF3Criterion(CertifiedProductSearchDetails listing) { return listing.getCertificationResults().stream() .filter(crit -> crit.getCriterion().getNumber().equals(certificationCriterionService.get(Criteria2015.F_3).getNumber())) .findAny(); }

Target:
private Optional<CertificationResult> getF3Criterion(CertifiedProductSearchDetails listing) { return listing.getCertificationResults().stream() .filter(crit -> crit.getCriterion().getId().equals(certificationCriterionService.get(Criteria2015.F_3).getId())) .findAny(); }
Source:
public void testNoExceptionEmptyPayload() { utils.logger = mock(Logger.class); utils.logger.warn(anyObject(Throwable.class), anyString()); expectLastCall().andThrow(new IllegalStateException("log spam")); replay(utils.logger); HttpResponse response = HttpResponse.builder().statusCode(NOT_FOUND.getStatusCode()).payload(new StringPayload("")).build(); response.getPayload().getContentMetadata().setContentType("application/unknown"); assertNull(utils.parseAWSErrorFromContent(command.getCurrentRequest(), response)); }

Target:
public void testNoExceptionEmptyPayload() { RequestSigner requestSigner = createMock(RequestSigner.class); ParseSax.Factory factory = createMock(ParseSax.Factory.class); Provider provider = createMock(Provider.class); replay(requestSigner, factory, provider); AWSUtils riggedUtil = new AWSUtils( "ignore", requestSigner, factory, provider ); HttpResponse response = HttpResponse.builder().statusCode(NOT_FOUND.getStatusCode()).payload(new StringPayload("")).build(); response.getPayload().getContentMetadata().setContentType("application/unknown"); assertNull(riggedUtil.parseAWSErrorFromContent(command.getCurrentRequest(), response)); }
Source:
public void doProcessBatch(CoreSession session, List<String> ids, Map<String, Serializable> properties) { ids.forEach(id -> { properties.forEach((e, s) -> session.setDocumentSystemProp(new IdRef(id), e, s)); }); session.save(); }

Target:
public void doProcessBatch(CoreSession session, List<String> ids, Map<String, Serializable> properties) { ids.forEach(id -> properties.forEach((k, v) -> session.setDocumentSystemProp(new IdRef(id), k, v))); session.save(); }
Source:
public static void removeReactorsMap(String vmId){ reactorsMap.remove(vmId); }

Target:
public void removeReactorsMap(String vmId){ clientMap.remove(vmId); }
Source:
public RealmResults<DynamicRealmObject> linkingObjects(String srcClassName, String srcFieldName) { final DynamicRealm realm = (DynamicRealm) proxyState.getRealm$realm(); realm.checkIfValid(); proxyState.getRow$realm().checkIfAttached(); final RealmSchema schema = realm.getSchema(); final RealmObjectSchema realmObjectSchema = schema.get(srcClassName); if (realmObjectSchema == null) { throw new IllegalArgumentException("Class not found: " + srcClassName); } if (srcFieldName != null && srcFieldName.contains(".")) { throw new IllegalArgumentException(MSG_LINK_QUERY_NOT_SUPPORTED); } final RealmFieldType fieldType = realmObjectSchema.getFieldType(srcFieldName); if (fieldType != RealmFieldType.OBJECT && fieldType != RealmFieldType.LIST) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Unexpected field type: %1$s. Field type should be either %2$s.%3$s or %2$s.%4$s.", fieldType.name(), RealmFieldType.class.getSimpleName(), RealmFieldType.OBJECT.name(), RealmFieldType.LIST.name())); } return RealmResults.createBacklinkResults(realm, proxyState.getRow$realm(), realmObjectSchema.getTable(), srcFieldName); }

Target:
public RealmResults<DynamicRealmObject> linkingObjects(String srcClassName, String srcFieldName) { final DynamicRealm realm = (DynamicRealm) proxyState.getRealm$realm(); realm.checkIfValid(); proxyState.getRow$realm().checkIfAttached(); final RealmSchema schema = realm.getSchema(); final RealmObjectSchema realmObjectSchema = schema.get(srcClassName); if (realmObjectSchema == null) { throw new IllegalArgumentException("Class not found: " + srcClassName); } if (srcFieldName == null) { throw new IllegalArgumentException("Non-null 'srcFieldName' required."); } if (srcFieldName.contains(".")) { throw new IllegalArgumentException(MSG_LINK_QUERY_NOT_SUPPORTED); } final RealmFieldType fieldType = realmObjectSchema.getFieldType(srcFieldName); if (fieldType != RealmFieldType.OBJECT && fieldType != RealmFieldType.LIST) { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Unexpected field type: %1$s. Field type should be either %2$s.%3$s or %2$s.%4$s.", fieldType.name(), RealmFieldType.class.getSimpleName(), RealmFieldType.OBJECT.name(), RealmFieldType.LIST.name())); } return RealmResults.createBacklinkResults(realm, (CheckedRow) proxyState.getRow$realm(), realmObjectSchema.getTable(), srcFieldName); }
Source:
void ReplayFormOrientation() { Log.d(LOG_TAG, "ReplayFormOrientation()"); LinkedHashMap<Integer, PercentStorageRecord> temp = (LinkedHashMap<Integer, PercentStorageRecord>) dimChanges.clone(); dimChanges.clear(); for (Integer key : temp.keySet()) { PercentStorageRecord r = temp.get(key); if (r.dim == PercentStorageRecord.Dim.HEIGHT) { r.component.Height(r.length); } else { r.component.Width(r.length); } } }

Target:
void ReplayFormOrientation() { Log.d(LOG_TAG, "ReplayFormOrientation()"); LinkedHashMap<Integer, PercentStorageRecord> temp = (LinkedHashMap<Integer, PercentStorageRecord>) dimChanges.clone(); dimChanges.clear(); for (PercentStorageRecord r : temp.values()) { if (r.dim == PercentStorageRecord.Dim.HEIGHT) { r.component.Height(r.length); } else { r.component.Width(r.length); } } }