auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private TypedProperties getOrInitializeTypedProperties() { synchronized (this) { TypedProperties properties = this.properties; if (properties == null) { properties = createTypedProperties(); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return properties; } }

Target:
private synchronized TypedProperties getOrInitializeTypedProperties() { try { TypedProperties properties = this.properties; if (properties == null) { properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return properties; } catch (Throwable e) { throw onCheckPropertiesError(e); } }
Source:
public ImmutableSet<IdentifiableBean> search(Search search) { SearchResult searchResult = searchProvider.search(search); Collection<StandardId> matchingIds = searchResult.getMatchingIds(); Collection<IdentifiableBean> beans = sourceProvider.bulkGet(matchingIds).values(); if (beans.size() != matchingIds.size()) { log.warn("Received ids from search provider but source provider only returned of them", matchingIds.size(), beans.size()); } return searchResult.getMatchStatus() == FULL ? ImmutableSet.copyOf(beans) : beans.stream() .filter(search::validateItem) .collect(Guavate.<IdentifiableBean>toImmutableSet()); }

Target:
public ImmutableSet<IdentifiableBean> search(Search search) { SearchResult searchResult = searchProvider.search(search); Collection<StandardId> matchingIds = searchResult.getMatchingIds(); Collection<IdentifiableBean> beans = sourceProvider.bulkGet(matchingIds).values(); if (beans.size() != matchingIds.size()) { log.warn("Received ids from search provider but source provider only returned of them", matchingIds.size(), beans.size()); } return searchResult.getMatchStatus() == FULL ? ImmutableSet.copyOf(beans) : beans.stream() .filter(search::matches) .collect(Guavate.<IdentifiableBean>toImmutableSet()); }
Source:
public void testHasChangeid() throws Exception { assertEquals( "has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: I0123456789012345678901234567890123456789\n", call("has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: I0123456789012345678901234567890123456789\n")); }

Target:
public void testHasChangeid() throws Exception { assertEquals( "has changeid\nmore text\n\nBug: 33\nSigned-off-by: me@you.too\n" + "Change-Id: I0123456789012345678901234567890123456789\n", call("has changeid\nmore text\n\nBug: 33\nSigned-off-by: me@you.too\n" + "Change-Id: I0123456789012345678901234567890123456789\n")); }
Source:
public GetObjectResult call() throws Exception { try { if (!force) { BlackPearlUtils.checkBlackPearlForTapeFailure(getClient()); } final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && Utils.fileExists(filePath)) { if (SyncUtils.needToSync(helpers, bucketName, filePath, ds3Obj.getName(), false)) { Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch (final FailedRequestException e) { if (e.getStatusCode() == 500) { LOG.info(e.getMessage()); if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); } else if (e.getStatusCode() == 404) { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: " + e.getMessage(), e); } else { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: Encountered an unknown error of (" + e.getStatusCode() + ") while accessing the remote DS3 appliance.", e); } } }

Target:
public GetObjectResult call() throws Exception { try { if (!force) { BlackPearlUtils.checkBlackPearlForTapeFailure(getClient()); } final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && Utils.fileExists(filePath)) { if (SyncUtils.needToSync(helpers, bucketName, filePath, ds3Obj.getName(), false)) { Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch (final FailedRequestException e) { switch (e.getStatusCode()) { case 500: throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); case 404: throw new CommandException("Error: " + e.getMessage(), e); default: throw new CommandException("Error: Encountered an unknown error of (" + e.getStatusCode() + ") while accessing the remote DS3 appliance.", e); } } }
Source:
public <T> CompletableFuture<T> execute(String taskName, TaskContext context) { Cache<?, ?> masterCacheNode = context.getCache().get(); ClusterExecutor clusterExecutor = SecurityActions.getClusterExecutor(context.getCacheManager()); List<T> results = new ArrayList<>(); TriConsumer<Address, T, Throwable> triConsumer = (a, v, t) -> { if (t != null) { throw new CacheException(t); } synchronized (this) { results.add(v); } }; List<TaskParameter> taskParams = context.getParameters().orElse(Collections.emptyMap()).entrySet().stream().map(e -> new TaskParameter(e.getKey(), e.getValue().toString())).collect(Collectors.toList()); CompletableFuture<Void> future = clusterExecutor.submitConsumer(new DistributedServerTask<>(taskName, masterCacheNode.getName(), taskParams), triConsumer); return (CompletableFuture<T>) future.thenApply(ignore -> results); }

Target:
public <T> CompletableFuture<T> execute(String taskName, TaskContext context) { Cache<?, ?> masterCacheNode = context.getCache().get(); ClusterExecutor clusterExecutor = SecurityActions.getClusterExecutor(context.getCacheManager()); List<T> results = Collections.synchronizedList(new ArrayList<>()); TriConsumer<Address, T, Throwable> triConsumer = (a, v, t) -> { if (t != null) { throw new CacheException(t); } results.add(v); }; List<TaskParameter> taskParams = context.getParameters().orElse(Collections.emptyMap()) .entrySet().stream().map(e -> new TaskParameter(e.getKey(), e.getValue().toString())).collect(Collectors.toList()); CompletableFuture<Void> future = clusterExecutor.submitConsumer( new DistributedServerTask<>(taskName, masterCacheNode.getName(), taskParams), triConsumer ); return (CompletableFuture<T>) future.thenApply(ignore -> results); }
Source:
private void modifyMenu(ActionMode mode) { Menu menu = mode.getMenu(); ArrayList<MenuItem> menuItemsList = new ArrayList<>(); for (int i = 0; i < menu.size(); i++) { String title = menu.getItem(i).getTitle().toString(); if (!title.contains(getString(R.string.menu_text_select_share))) { menuItemsList.add(menu.getItem(i)); } } menu.clear(); mode.getMenuInflater().inflate(R.menu.menu_text_select, menu); for (MenuItem menuItem : menuItemsList) { menu.add(Menu.NONE, menuItem.getItemId(), Menu.NONE, menuItem.getTitle()).setIntent((menuItem.getIntent() == null) ? null : menuItem.getIntent().addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)).setIcon(menuItem.getIcon()); } }

Target:
private void modifyMenu(ActionMode mode) { Menu menu = mode.getMenu(); ArrayList<MenuItem> menuItemsList = new ArrayList<>(); for (int i = 0; i < menu.size(); i++) { String title = menu.getItem(i).getTitle().toString(); if (!title.contains(getString(R.string.search_hint)) && !title.contains(getString(R.string.menu_text_select_define))) { menuItemsList.add(menu.getItem(i)); } } menu.clear(); mode.getMenuInflater().inflate(R.menu.menu_text_select, menu); for (MenuItem menuItem : menuItemsList) { menu.add(menuItem.getGroupId(), menuItem.getItemId(), Menu.NONE, menuItem.getTitle()).setIntent(menuItem.getIntent()).setIcon(menuItem.getIcon()); } }
Source:
public static void methodInvoke(Method method, Object target) throws InvocationTargetException, IllegalAccessException { MethodHandle handler = methodHandlesMap.get(method); if (handler != null) { try { if (Modifier.isStatic(method.getModifiers())) { log.warn("static lifecycle method: " + method + ", target=" + target); handler.invoke(); } else { handler.invoke(target); } } catch (Throwable e) { throw new InvocationTargetException(e, "invokedynamic: method=" + method + ", target=" + target); } } else { method.invoke(target); } }

Target:
public static void methodInvoke(Method method, Object target) throws InvocationTargetException, IllegalAccessException { MethodHandle handler = methodHandlesMap.get(method); if (handler != null) { try { if (Modifier.isStatic(method.getModifiers())) { log.warn("static lifecycle method: {}, target={}", method, target); handler.invoke(); } else { handler.invoke(target); } } catch (Throwable e) { throw new InvocationTargetException(e, "invokedynamic: method=" + method + ", target=" + target); } } else { method.invoke(target); } }
Source:
public Optional<ReadMapping> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle) { if (typeHandle.getJdbcType() == microsoft.sql.Types.DATETIMEOFFSET) { return Optional.of(dateTimeOffsetReadMapping()); } return super.toPrestoType(session, typeHandle); }

Target:
public Optional<ReadMapping> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle) { if (typeHandle.getJdbcType() == DATETIMEOFFSET) { return Optional.of(dateTimeOffsetReadMapping()); } return super.toPrestoType(session, typeHandle); }
Source:
protected void addChangeRecord(ChangeRecord c) { LOG.info("addChangeRecord called"); synchronized (zks.getOutstandingChanges()) { zks.getOutstandingChanges().add(c); zks.getOutstandingChangesForPath().put(c.path, c); ServerMetrics.OUTSTANDING_CHANGES_QUEUED.add(1); } }

Target:
protected void addChangeRecord(ChangeRecord c) { synchronized (zks.outstandingChanges) { zks.outstandingChanges.add(c); zks.outstandingChangesForPath.put(c.path, c); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_QUEUED.add(1); } }
Source:
protected void doInit() { super.doInit(); RSocketRequester.Builder builder = RSocketRequester.builder(); if (this.factoryConfigurer != null) { builder.rsocketFactory(this.factoryConfigurer); } if (this.strategiesConfigurer != null) { builder.rsocketStrategies(this.strategiesConfigurer); } this.rSocketRequesterMono = builder.connect(this.clientTransport, this.dataMimeType); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }

Target:
protected void doInit() { super.doInit(); this.rSocketRequesterMono = RSocketRequester.builder() .rsocketFactory(this.factoryConfigurer) .rsocketStrategies(this.strategiesConfigurer) .connect(this.clientTransport, this.dataMimeType); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }
Source:
public short sizeInBytes() { short sizeForBlobIdV1 = (short) (VERSION_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + uuid.getBytes().length); switch (version) { case BLOB_ID_V1: return sizeForBlobIdV1; case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: return (short) (FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + sizeForBlobIdV1); case BLOB_ID_V6: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + 16); default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } }

Target:
public short sizeInBytes() { switch (version) { case BLOB_ID_V1: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + getUuid().getBytes().length); case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + getUuid().getBytes().length); case BLOB_ID_V6: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UuidSerDe.SIZE_IN_BYTES); default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } }
Source:
public void factoryReset() { enforceConnectivityInternalPermission(); mLog.trace("factoryReset uid=%").c(Binder.getCallingUid()).flush(); if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { return; } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { setWifiApEnabled(null, false); } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI)) { try { setWifiEnabled(mContext.getOpPackageName(), true); } catch (RemoteException e) { } ParceledListSlice<WifiConfiguration> parceledList = getConfiguredNetworks(); if (parceledList != null) { List<WifiConfiguration> networks = parceledList.getList(); if (networks != null) { for (WifiConfiguration config : networks) { removeNetwork(config.networkId); } saveConfiguration(); } } } }

Target:
public void factoryReset() { enforceConnectivityInternalPermission(); mLog.trace("factoryReset uid=%").c(Binder.getCallingUid()).flush(); if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { return; } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { setWifiApEnabled(null, false); } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI)) { try { setWifiEnabled(mContext.getOpPackageName(), true); } catch (RemoteException e) { } List<WifiConfiguration> networks = mWifiStateMachine.syncGetConfiguredNetworks( Binder.getCallingUid(), mWifiStateMachineChannel); if (networks != null) { for (WifiConfiguration config : networks) { removeNetwork(config.networkId); } saveConfiguration(); } } }
Source:
public void updateAllInBatch(Collection<T> entities) { if (entities != null && entities.size() > 0) updateAllInBatch(getProcedureNameForUpdate(), entities, getBatchMapper()); }

Target:
public void updateAllInBatch(Collection<T> entities) { if (entities != null && entities.size() > 0) { updateAllInBatch(getProcedureNameForUpdate(), entities, getBatchMapper()); } }
Source:
private static URIBuilder getServiceUri(Project project, String baseUrl) { String urlString = project == null ? baseUrl : getServerUrl(project); if (urlString == null) { return null; } URIBuilder uri; try { uri = new URIBuilder(urlString); } catch (URISyntaxException e) { Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); return null; } String currentPath = Optional.ofNullable(uri.getPath()).orElse(""); uri.setPath(currentPath + (currentPath.endsWith("/") ? "" : "/") + "alfresco/service"); if (project != null && TicketUtils.isTicketSet(project)) { uri.setParameter("alf_ticket", TicketUtils.getTicket(project)); } return uri; }

Target:
private static URIBuilder getServiceUri(Project project, String baseUrl) { String urlString = project == null ? baseUrl : getServerUrl(project); if (urlString == null) { return null; } URIBuilder uri; try { uri = new URIBuilder(urlString); } catch (URISyntaxException e) { Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); return null; } String path = Optional.ofNullable(uri.getPath()).orElse(""); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } if (!path.endsWith("alfresco/service")) { path += "/alfresco/service"; } uri.setPath(path); if (project != null && TicketUtils.isTicketSet(project)) { uri.setParameter("alf_ticket", TicketUtils.getTicket(project)); } return uri; }
Source:
void addVolume(FsVolumeImpl volume) { String mount = volume.getMount(); if (!mount.isEmpty()) { Map<StorageType, VolumeInfo> storageTypeMap = mountVolumeMapping .getOrDefault(mount, new ConcurrentHashMap<>()); if (storageTypeMap.containsKey(volume.getStorageType())) { FsDatasetImpl.LOG.error("Found storage type already exist." + " Skipping for now. Please check disk configuration"); } else { VolumeInfo volumeInfo = new VolumeInfo(volume, 1); if (volume.getStorageType() == StorageType.ARCHIVE) { volumeInfo.setCapacityRatio(reservedForArchive); } else if (volume.getStorageType() == StorageType.DISK) { volumeInfo.setCapacityRatio(1 - reservedForArchive); } storageTypeMap.put(volume.getStorageType(), volumeInfo); mountVolumeMapping.put(mount, storageTypeMap); } } }

Target:
void addVolume(FsVolumeImpl volume) { String mount = volume.getMount(); if (!mount.isEmpty()) { MountVolumeInfo info; if (mountVolumeMapping.containsKey(mount)) { info = mountVolumeMapping.get(mount); } else { info = new MountVolumeInfo(conf); mountVolumeMapping.put(mount, info); } info.addVolume(volume); } }
Source:
private void bindView(ServerFile file, View view) { ImageView fileIconView = (ImageView) view.findViewById(R.id.icon); TextView fileTextView = (TextView) view.findViewById(R.id.text); TextView fileSize = (TextView) view.findViewById(R.id.file_size); TextView fileLastModified = (TextView) view.findViewById(R.id.last_modified); LinearLayout moreInfo = (LinearLayout) view.findViewById(R.id.more_info); fileTextView.setText(getFileName(file)); int size=getFileSize(file); if(size==0){ moreInfo.setVisibility(View.GONE); }else{ moreInfo.setVisibility(View.VISIBLE); double inMb=(size/1024.0)/1024.0; fileSize.setText(((int)(inMb*100))/100.0+"MB"); Date d=getLastModified(file); SimpleDateFormat dt = new SimpleDateFormat("EEE LLL dd yyyy"); fileLastModified.setText(dt.format(d)); } if (Mimes.match(file.getMime()) == Mimes.Type.IMAGE) { setUpImageIcon(file, fileIconView); } else { fileIconView.setImageResource(getFileIcon(file)); } }

Target:
private void bindView(ServerFile file, View view) { ImageView fileIconView = (ImageView) view.findViewById(R.id.icon); TextView fileTextView = (TextView) view.findViewById(R.id.text); TextView fileSize = (TextView) view.findViewById(R.id.file_size); TextView fileLastModified = (TextView) view.findViewById(R.id.last_modified); LinearLayout moreInfo = (LinearLayout) view.findViewById(R.id.more_info); fileTextView.setText(getFileName(file)); long size=getFileSize(file); if(file.getMime().equals("text/directory")){ moreInfo.setVisibility(View.GONE); }else{ moreInfo.setVisibility(View.VISIBLE); fileSize.setText(Formatter.formatFileSize(context, size)); Date d=getLastModified(file); SimpleDateFormat dt = new SimpleDateFormat("EEE LLL dd yyyy"); fileLastModified.setText(dt.format(d)); } if (Mimes.match(file.getMime()) == Mimes.Type.IMAGE) { setUpImageIcon(file, fileIconView); } else { fileIconView.setImageResource(getFileIcon(file)); } }
Source:
public void insertHeaderWithTimestampValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); props.put("literal.value", "2019-08-23T14\\:34\\:54.346Z"); xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Timestamp.SCHEMA, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2019-08-23T14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }

Target:
public void insertHeaderWithTimestampValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); props.put("literal.value", "2019-08-23T14:34:54.346Z"); xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Timestamp.SCHEMA, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2019-08-23T14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }
Source:
public void onResume() { Log.i(LOG_TAG, "Called SetupSyncActivity.onResume."); super.onResume(); if (!hasInternet()) { setContentView(R.layout.sync_setup_nointernet); return; } Account[] accts = mAccountManager.getAccountsByType(Constants.ACCOUNTTYPE_SYNC); if (accts.length == 0) { Log.d(LOG_TAG, "No accounts; starting J-PAKE receiver."); displayReceiveNoPin(); if (jClient != null) { jClient.finished = true; } jClient = new JPakeClient(this); jClient.receiveNoPin(); return; } Bundle extras = this.getIntent().getExtras(); if (extras != null) { Log.d(LOG_TAG, "SetupSync with extras."); boolean isSetup = extras.getBoolean(Constants.INTENT_EXTRA_IS_SETUP); if (!isSetup) { Log.d(LOG_TAG, "Account exists; Pair a Device started."); pairWithPin = true; displayPairWithPin(); return; } } Log.d(LOG_TAG, "Only one account supported. Redirecting."); Toast toast = Toast.makeText(mContext, R.string.sync_notification_oneaccount, Toast.LENGTH_LONG); toast.show(); Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS); intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); startActivity(intent); finish(); }

Target:
public void onResume() { Logger.info(LOG_TAG, "Called SetupSyncActivity.onResume."); super.onResume(); if (!hasInternet()) { setContentView(R.layout.sync_setup_nointernet); return; } Account[] accts = mAccountManager.getAccountsByType(Constants.ACCOUNTTYPE_SYNC); if (accts.length == 0) { Logger.debug(LOG_TAG, "No accounts; starting J-PAKE receiver."); displayReceiveNoPin(); if (jClient != null) { jClient.finished = true; } jClient = new JPakeClient(this); jClient.receiveNoPin(); return; } Bundle extras = this.getIntent().getExtras(); if (extras != null) { Logger.debug(LOG_TAG, "SetupSync with extras."); boolean isSetup = extras.getBoolean(Constants.INTENT_EXTRA_IS_SETUP); if (!isSetup) { Logger.debug(LOG_TAG, "Account exists; Pair a Device started."); pairWithPin = true; displayPairWithPin(); return; } } Logger.debug(LOG_TAG, "Only one account supported. Redirecting."); Toast toast = Toast.makeText(mContext, R.string.sync_notification_oneaccount, Toast.LENGTH_LONG); toast.show(); Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS); intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); startActivity(intent); finish(); }
Source:
private Integer getMetadataSizeLimit() { String sizeLimit = System.getProperty("metadata.size.limit"); if (StringUtils.isNumeric(sizeLimit)) { if (Integer.parseInt(sizeLimit) * 1000000 < Integer.MAX_VALUE) { METADATA_MAXIMUM_BYTES = Integer.parseInt(sizeLimit) * 1000000; return METADATA_MAXIMUM_BYTES; } } METADATA_MAXIMUM_BYTES = 5000000; return METADATA_MAXIMUM_BYTES; }

Target:
static Integer getMetadataSizeLimit() { String sizeLimit = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(METADATA_SIZE_LIMIT, String.valueOf(FIVE_MEGABYTES))); if (StringUtils.isNumeric(sizeLimit)) { try { return Integer.parseInt(sizeLimit); } catch (NumberFormatException e) { LOGGER.info("Metadata size limit set in system properties is out of range: {}", sizeLimit); } } else { LOGGER.info("User set metadata size limit is not numeric: {}", sizeLimit); } return FIVE_MEGABYTES; }
Source:
public Optional<Long> getTotalEstimatedTime() { boolean isAnyActionEstimated = false; Long total = 0L; for (ScriptGeneratorAction action : actions) { if (action.getEstimatedTime().isPresent()) { isAnyActionEstimated = true; total += action.getEstimatedTime().get().longValue(); } } return isAnyActionEstimated ? Optional.of(total) : Optional.empty(); }

Target:
public Optional<Long> getTotalEstimatedTime() { List<Number> actualEstimates = actions.stream().map(action -> action.getEstimatedTime()).flatMap(Optional::stream).collect(Collectors.toList()); Long total = actualEstimates.stream().map(x -> x.longValue()).reduce(0L, Long::sum); return actualEstimates.size() == 0 ? Optional.empty() : Optional.of(total); }
Source:
public void testSpawnFragmentSameTraceId() { DefaultTraceCollector collector = new DefaultTraceCollector(); FragmentBuilder parent = new FragmentBuilder(); FragmentBuilder spawned = new FragmentBuilder(); Trace parentBTxn = parent.getTrace(); Trace spawnedBTxn = spawned.getTrace(); parentBTxn.setTraceId(TRACE_ID); Consumer parentConsumer = new Consumer(); collector.push(null, parent, parentConsumer); collector.spawnFragment(parent, parentConsumer, -1, spawned); assertEquals(TRACE_ID, spawnedBTxn.getTraceId()); }

Target:
public void testSpawnFragmentSameTraceId() { DefaultTraceCollector collector = new DefaultTraceCollector(); FragmentBuilder parent = new FragmentBuilder(); FragmentBuilder spawned = new FragmentBuilder(); Trace parentTrace = parent.getTrace(); Trace spawnedTrace = spawned.getTrace(); parentTrace.setTraceId(TRACE_ID); Consumer parentConsumer = new Consumer(); collector.push(null, parent, parentConsumer); collector.spawnFragment(parent, parentConsumer, -1, spawned); assertEquals(TRACE_ID, spawnedTrace.getTraceId()); }
Source:
public CalcSubscription build() { return new CalcSubscription(amount, discountAmount, discountPercent, endTime, period, price, resource , startTime); }

Target:
public CalcSubscription build() { return new CalcSubscription(amount, discountAmount, discountPercent, period, price, resource, startTime, endTime); }
Source:
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> { if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes[1] == (byte) 255) { return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16BE); } else if (bytes.length >= 2 && bytes[0] == (byte) 255 && bytes[1] == (byte) 254) { return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16LE); } else { try { String contentType = reactorNettyResponse.responseHeaders() .get("Content-Type", "charset=UTF-8"); Matcher charsetMatcher = CHARSET_PATTERN.matcher(contentType); if (charsetMatcher.find()) { return new String(bytes, Charset.forName(charsetMatcher.group(1))); } else { return new String(bytes, StandardCharsets.UTF_8); } } catch (IllegalCharsetNameException | UnsupportedCharsetException ex) { return new String(bytes, StandardCharsets.UTF_8); } } }); }

Target:
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, reactorNettyResponse.responseHeaders().get("Content-Type"))); }
Source:
public InputStream read(IFile target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); if (lightweightAutoRefreshEnabled || !force) { final IFileInfo fileInfo = store.fetchInfo(); if (!fileInfo.exists()) { asyncRefresh(target); String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, null); } ResourceInfo info = ((Resource) target).getResourceInfo(true, false); int flags = ((Resource) target).getFlags(info); ((Resource) target).checkExists(flags, true); if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { asyncRefresh(target); if (!force) { String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null); } } } try { return store.openInputStream(EFS.NONE, monitor); } catch (CoreException e) { if (e.getStatus().getCode() == EFS.ERROR_NOT_EXISTS) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, null); } throw e; } }

Target:
public InputStream read(IFile target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); if (lightweightAutoRefreshEnabled || !force) { final IFileInfo fileInfo = store.fetchInfo(); if (!fileInfo.exists()) { asyncRefresh(target); String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, null); } ResourceInfo info = ((Resource) target).getResourceInfo(true, false); int flags = ((Resource) target).getFlags(info); ((Resource) target).checkExists(flags, true); if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { asyncRefresh(target); if (!force) { String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null); } } } try { return store.openInputStream(EFS.NONE, monitor); } catch (CoreException e) { if (e.getStatus().getCode() == EFS.ERROR_NOT_EXISTS) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, e); } throw e; } }
Source:
public void close() { if (file.exists() && getCompactionState().equals(State.DONE)) { File savedLog = new File(file.getAbsolutePath() + "_" + startTime); if (!file.renameTo(savedLog)) { throw new IllegalStateException("Compaction log could not be renamed after completion of compaction"); } } }

Target:
public void close() { if (file.exists() && getCompactionPhase().equals(Phase.DONE)) { String dateString = new Date(startTime).toString(); File savedLog = new File(file.getAbsolutePath() + BlobStore.SEPARATOR + startTime + BlobStore.SEPARATOR + dateString); if (!file.renameTo(savedLog)) { throw new IllegalStateException("Compaction log could not be renamed after completion of compaction"); } } }
Source:
public static void deleteAll(Context c) { try { FileUtils.cleanDirectory(Measurement.createMeasurementDir(c)); } catch (Exception e) { e.printStackTrace(); } Delete.tables(Measurement.class, Result.class); }

Target:
public static void deleteAll(Context c) { try { FileUtils.cleanDirectory(Measurement.getMeasurementDir(c)); } catch (Exception e) { e.printStackTrace(); } Delete.tables(Measurement.class, Result.class); }
Source:
private HashSet<Object> getCheckedProjects() { HashSet<Object> ret = new HashSet<Object>(); for (TreeItem item : projectsList.getTree().getItems()) { if (item.getChecked()) { ret.add(item.getData()); } } return ret; }

Target:
private HashSet<Object> getCheckedProjects() { HashSet<Object> ret = new HashSet<Object>(); for (TreeItem item : projectsList.getTree().getItems()) if (item.getChecked()) ret.add(item.getData()); return ret; }
Source:
public void configureChannels() { Thing thing = callback.getThing(); Channel humidityChannel = thing.getChannel(CHANNEL_HUMIDITY); if (humidityChannel != null) { Configuration channelConfiguration = humidityChannel.getConfiguration(); if (channelConfiguration.get(CONFIG_HUMIDITY) != null) { HUMIDITY_PARAMETER.replace(THING_TYPE_OWSERVER, channelConfiguration.get(CONFIG_HUMIDITY)); } else { HUMIDITY_PARAMETER.replace(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/humidity")); } } Channel temperatureChannel = thing.getChannel(CHANNEL_TEMPERATURE); if (temperatureChannel != null) { Configuration channelConfiguration = temperatureChannel.getConfiguration(); if (channelConfiguration.get(CONFIG_OFFSET) != null) { temperatureOffset = new QuantityType<Temperature>((String) channelConfiguration.get(CONFIG_OFFSET)); } else { temperatureOffset = new QuantityType<Temperature>("0 K"); } } isConfigured = true; }

Target:
public void configureChannels() { Thing thing = callback.getThing(); Channel humidityChannel = thing.getChannel(CHANNEL_HUMIDITY); if (humidityChannel != null) { Configuration channelConfiguration = humidityChannel.getConfiguration(); if (channelConfiguration.get(CONFIG_HUMIDITY) != null) { HUMIDITY_PARAMETER.set(THING_TYPE_OWSERVER, channelConfiguration.get(CONFIG_HUMIDITY)); } else { HUMIDITY_PARAMETER.set(THING_TYPE_OWSERVER, new OwserverDeviceParameter("/humidity")); } } isConfigured = true; }
Source:
private AdminMonitors getAdminMonitors(Map<String, AdministrativeMonitor> activated) { AdminMonitors monitors = new AdminMonitors(); for (AdministrativeMonitor monitor : activated.values()) { if (monitor instanceof OldDataMonitor) { AdminMonitors.OldDataMonitor olddm = new AdminMonitors.OldDataMonitor(); OldDataMonitor odm = (OldDataMonitor) monitor; for (Map.Entry<Saveable,OldDataMonitor.VersionRange> entry : odm.getData().entrySet()) { AdminMonitors.OldDataMonitor.OldData data = new AdminMonitors.OldDataMonitor.OldData(); data.setProblematicObject(entry.getKey().toString()); OldDataMonitor.VersionRange value = entry.getValue(); data.setRange(value.toString()); data.setExtra(value.extra); } olddm.setActive(true); monitors.addMonitor(olddm); } else { AdminMonitors.AdminMonitor mon = new AdminMonitors.AdminMonitor(); mon.setId(monitor.id); mon.setActive(true); monitors.addMonitor(mon); } } return monitors; }

Target:
private AdminMonitors getAdminMonitors(Map<String, AdministrativeMonitor> activated) { AdminMonitors monitors = new AdminMonitors(); for (AdministrativeMonitor monitor : activated.values()) { if (monitor instanceof OldDataMonitor) { AdminMonitors.OldDataMonitor olddm = new AdminMonitors.OldDataMonitor(); OldDataMonitor odm = (OldDataMonitor) monitor; for (Map.Entry<Saveable,OldDataMonitor.VersionRange> entry : odm.getData().entrySet()) { AdminMonitors.OldDataMonitor.OldData data = new AdminMonitors.OldDataMonitor.OldData(); data.setProblematicObject(entry.getKey().toString()); OldDataMonitor.VersionRange value = entry.getValue(); data.setRange(value.toString()); data.setExtra(StringUtils.isNotBlank(value.extra) ? value.extra : ""); olddm.addOldData(data); } olddm.setActive(true); monitors.addMonitor(olddm); } else { AdminMonitors.AdminMonitor mon = new AdminMonitors.AdminMonitor(); mon.setId(monitor.id); mon.setActive(true); monitors.addMonitor(mon); } } return monitors; }
Source:
protected Warning createWarning(final Matcher matcher) { String category = matcher.group(1).trim(); String message = matcher.group(3).trim(); Priority priority = Priority.NORMAL; if (category.equals("FATAL")) priority = Priority.HIGH; return createWarning("Nil", 0, category, message, priority); }

Target:
protected Warning createWarning(final Matcher matcher) { String category = StringUtils.trim(matcher.group(1)); String message = StringUtils.trim(matcher.group(3)); Priority priority = Priority.NORMAL; if (category == null | message == null) { return FALSE_POSITIVE; } if ("FATAL".equals(category)) { priority = Priority.HIGH; } return createWarning("Nil", 0, category, message, priority); }
Source:
private List<DirectoryUser> searchDirectoryUsers() { String searchPattern = getParameters().getSearchPattern(); int atIndex = searchPattern.lastIndexOf("@"); int eqIndex = searchPattern.indexOf("="); if (atIndex > eqIndex) { searchPattern = searchPattern.substring(0, atIndex); } getParameters().setSearchPattern(searchPattern); QueryData data = initQueryData(true); if (data == null) { return Collections.emptyList(); } ExtensionProxy authz = AuthenticationProfileRepository.getInstance().getProfile(data.getDomain()).getAuthz(); List<DirectoryUser> results = new ArrayList<>(); for (String namespace : authz.getContext().<List<String>> get(Authz.ContextKeys.AVAILABLE_NAMESPACES)) { results.addAll(AuthzUtils.findPrincipalsByQuery(authz, namespace, data.getQuery())); } return results; }

Target:
private List<DirectoryUser> searchDirectoryUsers() { QueryData data = initQueryData(true); if (data == null) { return Collections.emptyList(); } ExtensionProxy authz = AuthenticationProfileRepository.getInstance().getProfile(data.getDomain()).getAuthz(); List<DirectoryUser> results = new ArrayList<>(); for (String namespace : authz.getContext().<List<String>> get(Authz.ContextKeys.AVAILABLE_NAMESPACES)) { results.addAll(AuthzUtils.findPrincipalsByQuery(authz, namespace, data.getQuery())); } return results; }
Source:
private static InstallerData parse() { Properties properties = readProperties(); if (properties == null) { return null; } return new InstallerData(getIfExists(properties, "jdk.dir"), getIfExists(properties, "androidsdk.repo"), new File(properties.getProperty("androidsdk.dir"))); }

Target:
private static InstallerData parse() { Properties properties = readProperties(); if (properties == null) { return null; } String androidSdkPath = properties.getProperty("androidsdk.dir"); File androidDest = StringUtil.isEmptyOrSpaces(androidSdkPath) ? null : new File(androidSdkPath); return new InstallerData(getIfExists(properties, "jdk.dir"), getIfExists(properties, "androidsdk.repo"), androidDest); }
Source:
public void doNonBlindForcesBatch() { Assert.assertTrue(batcher.isEmpty()); List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null)); ((ArrayList<CommandAndHandler>) list).add(new CommandAndHandler(null, new OnFinishedHandler() { @Override public void onFinished() { } })); for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } Assert.assertEquals(4, ((ArrayList<CommandAndHandler>) list).size()); try { Assert.assertEquals(((ArrayList<CommandAndHandler>) list).subList(0, 3), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } try { Assert.assertEquals(Collections.singletonList(((ArrayList<CommandAndHandler>) list).get(3)), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }

Target:
public void doNonBlindForcesBatch() { Assert.assertTrue(batcher.isEmpty()); List<CommandAndHandler> list = new ArrayList<CommandAndHandler>(); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null)); list.add(new CommandAndHandler(null, new OnFinishedHandler() { @Override public void onFinished() { } })); for (CommandAndHandler commandAndHandler : list) { batcher.batch(commandAndHandler); } Assert.assertEquals(4, ((ArrayList<CommandAndHandler>) list).size()); try { Assert.assertEquals(list.subList(0, 3), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } try { Assert.assertEquals(Collections.singletonList(list.get(3)), batcher.getWaitingBatches().getVal()); } catch (InterruptedException e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
Source:
private List<PrintLayer> getLayers(ActionParameters params) throws ActionException { String mapLayers = params.getRequiredParam(PARM_MAPLAYERS); User user = params.getUser(); LayerProperties[] requestedLayers = parseLayersProperties(mapLayers); List<PrintLayer> printLayers = new ArrayList<>(); int zIndex = 0; for (LayerProperties requestedLayer : requestedLayers) { try { printLayers.add(getPrintLayer(zIndex++, requestedLayer, user)); } catch (ActionException ex) { LOG.debug("Failed to add print layer:", requestedLayer.id); } } printLayers.removeIf(layer -> layer.getOpacity() <= 0); if (params.getRequest().getMethod().equals("POST")) { JSONObject payload = params.getPayLoadJSON(); JSONObject customStyles = payload.optJSONObject(PARM_CUSTOM_STYLES); if (customStyles != null) { printLayers.forEach(l -> { String id = l.getLayerId(); if (customStyles.has(id)) { l.setCustomStyle(JSONHelper.getJSONObject(customStyles, id)); } }); } } return printLayers; }

Target:
private List<PrintLayer> getLayers(ActionParameters params) throws ActionException { String mapLayers = params.getRequiredParam(PARM_MAPLAYERS); User user = params.getUser(); LayerProperties[] requestedLayers = parseLayersProperties(mapLayers); List<PrintLayer> printLayers = new ArrayList<>(); int zIndex = 0; for (LayerProperties requestedLayer : requestedLayers) { try { printLayers.add(getPrintLayer(zIndex++, requestedLayer, user)); } catch (ActionException ex) { LOG.debug("Failed to add print layer:", requestedLayer.id); } } printLayers.removeIf(layer -> layer.getOpacity() <= 0); JSONObject customStyles = getCustomStyles(params); if (customStyles != null) { printLayers.forEach(l -> { String id = l.getLayerId(); if (customStyles.has(id)) { l.setCustomStyle(JSONHelper.getJSONObject(customStyles, id)); } }); } return printLayers; }
Source:
public void testApplicationWithPortEndpoint() throws Exception { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new KafkaPortApplication(kafka.getBroker(), testTopicData0, testTopicResult), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); kafka.publish(testTopicData0, Arrays.asList("15/02/2016 10:15:00 +0000,1,paint1,11", "15/02/2016 10:16:00 +0000,2,paint2,12", "15/02/2016 10:17:00 +0000,3,paint3,13", "15/02/2016 10:18:00 +0000,4,paint4,14", "15/02/2016 10:19:00 +0000,5,paint5,15", "15/02/2016 10:10:00 +0000,6,abcde6,16")); String[] expectedLines = new String[] {"15/02/2016 10:18:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT4\r\n", "15/02/2016 10:19:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT5\r\n"}; List<String> consume = kafka.consume(testTopicResult, 30000); Assert.assertTrue(Arrays.deepEquals(consume.toArray(new String[consume.size()]), expectedLines)); lc.shutdown(); } catch (Exception e) { e.printStackTrace(); Assert.fail("constraint violations: " + e); } }

Target:
public void testApplicationWithPortEndpoint() { try { LocalMode lma = LocalMode.newInstance(); Configuration conf = new Configuration(false); lma.prepareDAG(new KafkaPortApplication(kafka.getBroker(), testTopicData0, testTopicResult), conf); LocalMode.Controller lc = lma.getController(); lc.runAsync(); kafka.publish(testTopicData0, Arrays.asList("15/02/2016 10:15:00 +0000,1,paint1,11", "15/02/2016 10:16:00 +0000,2,paint2,12", "15/02/2016 10:17:00 +0000,3,paint3,13", "15/02/2016 10:18:00 +0000,4,paint4,14", "15/02/2016 10:19:00 +0000,5,paint5,15", "15/02/2016 10:10:00 +0000,6,abcde6,16")); String[] expectedLines = new String[] {"15/02/2016 10:18:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT4\r\n", "15/02/2016 10:19:00 +0000,15/02/2016 00:00:00 +0000,OILPAINT5\r\n"}; List<String> consume = kafka.consume(testTopicResult, 30000); Assert.assertTrue(Arrays.deepEquals(consume.toArray(new String[consume.size()]), expectedLines)); lc.shutdown(); } catch (ConstraintViolationException e) { Assert.fail("constraint violations: " + e.getConstraintViolations()); } catch (Exception e) { Assert.fail("Exception: " + e); } }
Source:
public static <T> T create(Class<T> serviceClass, String userAgent, ServiceConfiguration config) { ClientBuilder client = jaxrs().ssl(config.security()); if (config.connectTimeout().isPresent()) { client.connectTimeout(config.connectTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } if (config.readTimeout().isPresent()) { client.readTimeout(config.readTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } return client.build(serviceClass, userAgent, config.uris()); }

Target:
public static <T> T create(Class<T> serviceClass, String userAgent, ServiceConfiguration config) { ClientBuilder client = builder().ssl(config.security()); if (config.connectTimeout().isPresent()) { client.connectTimeout(config.connectTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } if (config.readTimeout().isPresent()) { client.readTimeout(config.readTimeout().get().toMilliseconds(), TimeUnit.MILLISECONDS); } return client.build(serviceClass, userAgent, config.uris()); }
Source:
private String getResourcePath() { String serverUrl = "<LINK_0>"; return serverUrl + String.format(FormConstants.URL_TEMPLATE, formInstanceId); }

Target:
private String getResourcePath() { String serverUrl = getResources().getString(R.string.liferay_server); Long formInstanceId = Long.valueOf(getResources().getString(R.string.liferay_form_instance_id)); return serverUrl + String.format(FormConstants.URL_TEMPLATE, formInstanceId); }
Source:
private static void showOfflineMenu(final Geocache cache, final Activity activity) { final LogEntry currentLog = DataStore.loadLogOffline(cache.getGeocode()); final LogType currentLogType = currentLog == null ? null : currentLog.type; final List<LogType> logTypes = cache.getPossibleLogTypes(); final ArrayList<LogTypeEntry> list = new ArrayList<>(); for (final LogType logType : logTypes) { list.add(new LogTypeEntry(logType, null, logType == currentLogType)); } if (cache.isLogOffline()) { list.add(new LogTypeEntry(null, SpecialLogType.CLEAR_LOG, false)); } list.add(new LogTypeEntry(null, SpecialLogType.LOG_CACHE, false)); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_visit_offline); final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, list); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { final LogTypeEntry logTypeEntry = adapter.getItem(item); if (logTypeEntry.logType == null) { switch (logTypeEntry.specialLogType) { case LOG_CACHE: cache.logVisit(activity); break; case CLEAR_LOG: cache.clearOfflineLog(); break; } } else { cache.logOffline(activity, logTypeEntry.logType); } if (selectedView != null) { final ViewHolder holder; holder = (ViewHolder) selectedView.getTag(); if (holder != null) { CacheListAdapter.updateViewHolder(holder, cache, res); } } } }); builder.create().show(); }

Target:
private static void showOfflineMenu(final Geocache cache, final Activity activity) { final LogEntry currentLog = DataStore.loadLogOffline(cache.getGeocode()); final LogType currentLogType = currentLog == null ? null : currentLog.type; final List<LogType> logTypes = cache.getPossibleLogTypes(); final ArrayList<LogTypeEntry> list = new ArrayList<>(); for (final LogType logType : logTypes) { list.add(new LogTypeEntry(logType, null, logType == currentLogType)); } if (cache.isLogOffline()) { list.add(new LogTypeEntry(null, SpecialLogType.CLEAR_LOG, false)); } list.add(new LogTypeEntry(null, SpecialLogType.LOG_CACHE, false)); final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_visit_offline); final ArrayAdapter<LogTypeEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, list); builder.setAdapter(adapter, new DialogInterface.OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int item) { final LogTypeEntry logTypeEntry = adapter.getItem(item); if (logTypeEntry.logType == null) { switch (logTypeEntry.specialLogType) { case LOG_CACHE: cache.logVisit(activity); break; case CLEAR_LOG: cache.clearOfflineLog(); break; } } else { cache.logOffline(activity, logTypeEntry.logType); } if (selectedView != null) { final ViewHolder holder = (ViewHolder) selectedView.getTag(); if (holder != null) { CacheListAdapter.updateViewHolder(holder, cache, res); } } } }); builder.create().show(); }