auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JSONObject searchProjectsByCreationDateandString(HttpSession session, JSONObject json) { String searchStr = json.getString("str"); String from = json.getString("from"); String to = json.getString("to"); String progress = json.getString("progress"); JSONArray jsonArray = new JSONArray(); JSONObject jsonObject = new JSONObject(); try { Collection<Project> projects = null; if (searchStr != null && !isStringEmptyOrNull(searchStr)) { projects = requestManager.listAllProjectsBySearch(searchStr); } else { projects = requestManager.listAllProjects(); } for (Project project : projects) { if (progress.equals("all") || progress.equals(project.getProgress().getKey())) { if (!isStringEmptyOrNull(from) && !isStringEmptyOrNull(to)) { if (project.getCreationDate() != null) { DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date startDate = df.parse(from); Date endDate = df.parse(to); Date creationDate = project.getCreationDate(); if ((creationDate.after(startDate) && creationDate.before(endDate)) || creationDate.equals(startDate) || creationDate.equals(endDate)) { jsonArray.add(projectRowBuilder(project)); } } } else { jsonArray.add(projectRowBuilder(project)); } } } jsonObject.put("html", jsonArray); return jsonObject; } catch (Exception e) { log.error("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }

Target:
public JSONObject searchProjectsByCreationDateandString(HttpSession session, JSONObject json) { String searchStr = json.getString("str"); String from = json.getString("from"); String to = json.getString("to"); String progress = json.getString("progress"); JSONArray jsonArray = new JSONArray(); JSONObject jsonObject = new JSONObject(); try { Collection<Project> projects = null; if (!isStringEmptyOrNull(searchStr)) { projects = requestManager.listAllProjectsBySearch(searchStr); } else { projects = requestManager.listAllProjects(); } for (Project project : projects) { if (progress.equals("all") || progress.equals(project.getProgress().getKey())) { if (!isStringEmptyOrNull(from) && !isStringEmptyOrNull(to)) { if (project.getCreationDate() != null) { DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); Date startDate = df.parse(from); Date endDate = df.parse(to); Date creationDate = project.getCreationDate(); if ((creationDate.after(startDate) && creationDate.before(endDate)) || creationDate.equals(startDate) || creationDate.equals(endDate)) { jsonArray.add(projectRowBuilder(project)); } } } else { jsonArray.add(projectRowBuilder(project)); } } } jsonObject.put("html", jsonArray); return jsonObject; } catch (Exception e) { log.error("Failed", e); return JSONUtils.SimpleJSONError("Failed: " + e.getMessage()); } }
Source:
public void canSerializeWithSubstudy() throws Exception { ExternalIdentifierInfo info = new ExternalIdentifierInfo("AAA", "oneSubstudy", false); JsonNode node = BridgeObjectMapper.get().valueToTree(info); assertEquals("AAA", node.get("identifier").asText()); assertEquals(false, node.get("assigned").asBoolean()); assertEquals("oneSubstudy", node.get("substudyId").asText()); assertEquals("ExternalIdentifier", node.get("type").asText()); assertEquals(4, node.size()); ExternalIdentifierInfo resInfo = BridgeObjectMapper.get().treeToValue(node, ExternalIdentifierInfo.class); assertEquals(info, resInfo); }

Target:
public void canSerializeWithSubstudy() throws Exception { ExternalIdentifierInfo info = new ExternalIdentifierInfo("AAA", "oneSubstudy", false); JsonNode node = BridgeObjectMapper.get().valueToTree(info); assertEquals("AAA", node.get("identifier").textValue()); assertEquals(false, node.get("assigned").booleanValue()); assertEquals("oneSubstudy", node.get("substudyId").textValue()); assertEquals("ExternalIdentifier", node.get("type").textValue()); assertEquals(4, node.size()); ExternalIdentifierInfo resInfo = BridgeObjectMapper.get().treeToValue(node, ExternalIdentifierInfo.class); assertEquals(info, resInfo); }
Source:
public void testAutoReconnect() throws Exception { ClientConfig config = new ClientConfig(); config.setReconnectOnConnectionLoss(true); Client client = ClientFactory.createClient(config); client.createConnection("localhost"); tearDown(); for (int i = 0; (i < 40) && (client.getConnectedHostList().size() > 0); i++) { Thread.sleep(500); } assertTrue(client.getConnectedHostList().isEmpty()); Thread.sleep(2000); setUp(); boolean failed = true; for (int i = 0; i < 40; i++) { if (client.getConnectedHostList().size() > 0) { failed = false; break; } Thread.sleep(500); } if (failed) { fail("Client should have been reconnected"); } tearDown(); for (int i = 0; (i < 40) && (client.getConnectedHostList().size() > 0); i++) { Thread.sleep(500); } assertTrue(client.getConnectedHostList().isEmpty()); client.close(); Map<Thread, StackTraceElement[]> stMap = Thread.getAllStackTraces(); for (StackTraceElement[] st : stMap.values()) { for (StackTraceElement ste : st) { if (ste.getMethodName().contains("connectToOneServerWithRetry")) { fail("Client reconnect thread didn't die."); } } } }

Target:
public void testAutoReconnect() throws Exception { ClientConfig config = new ClientConfig(); config.setReconnectOnConnectionLoss(true); Client client = ClientFactory.createClient(config); client.createConnection("localhost"); tearDown(); for (int i = 0; (i < 40) && (client.getConnectedHostList().size() > 0); i++) { Thread.sleep(500); } assertTrue(client.getConnectedHostList().isEmpty()); Thread.sleep(2000); setUp(); boolean failed = true; for (int i = 0; i < 40; i++) { if (client.getConnectedHostList().size() > 0) { failed = false; break; } Thread.sleep(500); } if (failed) { fail("Client should have been reconnected"); } tearDown(); for (int i = 0; (i < 40) && (client.getConnectedHostList().size() > 0); i++) { Thread.sleep(500); } assertTrue(client.getConnectedHostList().isEmpty()); client.close(); Map<Thread, StackTraceElement[]> stMap = Thread.getAllStackTraces(); for (Entry<Thread, StackTraceElement[]> e : stMap.entrySet()) { StackTraceElement[] st = e.getValue(); Thread t = e.getKey(); if (t == Thread.currentThread()) { continue; } for (StackTraceElement ste : st) { if (ste.getClassName().toLowerCase().contains("voltdb.client")) { System.err.println(ste.getClassName().toLowerCase()); fail("Something failed to clean up."); } } } }
Source:
public String resolve() { if (applicationContext == null) { log.error("ApplicationContext has not been set: Cannot determine service version"); return UNKNOWN_VERSION; } if (resolvedServiceVersion == null) { for (VersionResolver resolver : resolvers) { final String resolverName = resolver.getClass().getSimpleName(); log.trace("Attempting to resolve service version: {}", resolverName); try { String version = resolver.resolve(applicationContext.getApplicationName()); if (version != null) { resolvedServiceVersion = version; break; } } catch (Exception e) { log.error("Failed while resolving version: {}", resolverName, e); } } if (resolvedServiceVersion == null) { return UNKNOWN_VERSION; } } return resolvedServiceVersion; }

Target:
public String resolve() { if (resolvedServiceVersion == null) { for (VersionResolver resolver : resolvers) { final String resolverName = resolver.getClass().getSimpleName(); log.trace("Attempting to resolve service version: {}", resolverName); try { String version = resolver.resolve(applicationContext.getApplicationName()); if (version != null) { resolvedServiceVersion = version; break; } } catch (Exception e) { log.error("Failed while resolving version: {}", resolverName, e); } } resolvedServiceVersion = UNKNOWN_VERSION; } return resolvedServiceVersion; }
Source:
private void createImageForVmMetaData() { VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, vmConfImageGroupId, MemoryUtils.METADATA_SIZE_IN_BYTES, getVolumeTypeForDomain(), VolumeFormat.RAW, vmConfVolumeId, "")); if (!retVal.getSucceeded()) { throw new EngineException(EngineError.VolumeCreationError, "Failed to create image for vm configuration!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_VM_TASK_KEY); Guid guid = enclosingCommand.createTask( taskId, retVal.getCreationInfo(), enclosingCommand.getActionType()); enclosingCommand.getTaskIdList().add(guid); }

Target:
private void createImageForVmMetaData() { VDSReturnValue retVal = Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.CreateImage, new CreateImageVDSCommandParameters( storagePool.getId(), storageDomainId, vmConfImageGroupId, MemoryUtils.METADATA_SIZE_IN_BYTES, VolumeType.Preallocated, VolumeFormat.RAW, vmConfVolumeId, "")); if (!retVal.getSucceeded()) { throw new EngineException(EngineError.VolumeCreationError, "Failed to create image for vm configuration!"); } Guid taskId = enclosingCommand.persistAsyncTaskPlaceHolder(CREATE_IMAGE_FOR_VM_TASK_KEY); Guid guid = enclosingCommand.createTask( taskId, retVal.getCreationInfo(), enclosingCommand.getActionType()); enclosingCommand.getTaskIdList().add(guid); }
Source:
void resolvingUniqueIdWithWrongParamsResolvesNothing(LogRecordListener listener) { UniqueId uniqueId = uniqueIdForMethod(HerTestClass.class, "test7(java.math.BigDecimal)"); EngineDiscoveryRequest request = request().selectors(selectUniqueId(uniqueId)).build(); resolver.resolveSelectors(request, engineDescriptor); assertTrue(engineDescriptor.getDescendants().isEmpty()); assertThat(listener.stream() .filter(logRecord -> logRecord.getLevel() == Level.WARNING) .filter(logRecord -> JavaElementsResolver.class.getName().equals(logRecord.getLoggerName())) .map(LogRecord::getMessage) .filter(isEqual("Unique ID '" + uniqueId + "' could only be partially resolved. " + "All resolved segments will be executed; however, the following segments " + "could not be resolved: [Segment [type = 'method', value = 'test7(java.math.BigDecimal)']]")) ).hasSize(1); }

Target:
void resolvingUniqueIdWithWrongParamsResolvesNothing(LogRecordListener listener) { UniqueId uniqueId = uniqueIdForMethod(HerTestClass.class, "test7(java.math.BigDecimal)"); EngineDiscoveryRequest request = request().selectors(selectUniqueId(uniqueId)).build(); resolver.resolveSelectors(request, engineDescriptor); assertTrue(engineDescriptor.getDescendants().isEmpty()); assertThat(listener.stream(JavaElementsResolver.class, Level.WARNING).map(LogRecord::getMessage)) .contains("Unique ID '" + uniqueId + "' could only be partially resolved. " + "All resolved segments will be executed; however, the following segments " + "could not be resolved: [Segment [type = 'method', value = 'test7(java.math.BigDecimal)']]"); }
Source:
private static String normalizeIfCommaSeparated(String value) { String integerPart; String decimalPart; int decimalIndex = value.indexOf("."); if (decimalIndex < 0) { integerPart = value; decimalPart = ""; } else { integerPart = value.substring(0, decimalIndex); decimalPart = value.substring(decimalIndex); } String normalizedIntegerPart = integerPart.replaceAll("(?<=\\d),(?=\\d{3}(,|$))", ""); return normalizedIntegerPart + decimalPart; }

Target:
private static String normalizeIfCommaSeparated(String value) { if (!value.startsWith(",") && !value.startsWith("-,") && !value.endsWith(",") && !value.contains(",,")) { List<String> parts = ImmutableList.copyOf(DOT_SPLITTER.split(value)); if (parts.size() == 1 || (parts.size() == 2 && !parts.get(1).contains(","))) { return value.replace(",", ""); } } return value; }
Source:
public TimeLockServices createInvalidatingTimeLockServices(String client) { ManagedTimestampService timestampService = instrument( ManagedTimestampService.class, leadershipAgent.wrapInLeadershipProxy( timestampCreator.createPaxosBackedTimestampService(client), ManagedTimestampService.class), client); RemoteLockService lockService = instrument( RemoteLockService.class, leadershipAgent.wrapInLeadershipProxy( lockCreator::createThreadPoolingLockService, RemoteLockService.class), client); return TimeLockServices.create(timestampService, lockService, timestampService); }

Target:
protected TimeLockServices createInvalidatingTimeLockServices(String client) { ManagedTimestampService timestampService = instrument( ManagedTimestampService.class, leadershipAgent.wrapInLeadershipProxy( timestampCreator.createPaxosBackedTimestampService(client), ManagedTimestampService.class), client); RemoteLockService lockService = instrument( RemoteLockService.class, leadershipAgent.wrapInLeadershipProxy( lockCreator::createThreadPoolingLockService, RemoteLockService.class), client); return TimeLockServices.create(timestampService, lockService, timestampService); }
Source:
public List<Properties> getTaskConfigs(int maxTasks) { List<Properties> taskConfigs = new ArrayList<Properties>(); for(int i = 0; i < maxTasks; i++) { Properties taskProps = new Properties(); taskProps.putAll(configProperties); taskConfigs.add(taskProps); } return taskConfigs; }

Target:
public List<Properties> getTaskConfigs(int maxTasks) { List<Properties> taskConfigs = new ArrayList<Properties>(); Properties taskProps = new Properties(); taskProps.putAll(configProperties); for (int i = 0; i < maxTasks; i++) { taskConfigs.add(taskProps); } return taskConfigs; }
Source:
public BinaryData getBody() { final AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: final Optional<byte[]> payload = amqpAnnotatedMessage.getBody().getData().stream().findFirst(); return payload.isPresent() ? BinaryData.fromBytes(payload.get()) : BinaryData.fromBytes(new byte[0]); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException( "This body type not is supported: " + bodyType)); default: throw logger.logExceptionAsError(new IllegalStateException("Body type not valid: " + bodyType)); } }

Target:
public BinaryData getBody() { final AmqpMessageBodyType bodyType = amqpAnnotatedMessage.getBody().getBodyType(); switch (bodyType) { case DATA: final byte[] payload = amqpAnnotatedMessage.getBody().getFirstData(); return BinaryData.fromBytes(payload); case SEQUENCE: case VALUE: throw logger.logExceptionAsError(new UnsupportedOperationException( "This body type not is supported: " + bodyType)); default: throw logger.logExceptionAsError(new IllegalStateException("Body type not valid: " + bodyType)); } }
Source:
public void search() { String organization = randomAlphanumeric(20); int page = 17; int pageSize = 39; String textQuery = randomAlphanumeric(20); underTest.search(new SearchWsRequest() .setOrganization(organization) .setQualifiers(asList("q1", "q2")) .setPage(page) .setPageSize(pageSize) .setQuery(textQuery) ); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search") .hasParam("organization", organization) .hasParam("qualifiers", "q1,q2") .hasParam("p", page) .hasParam("ps", pageSize) .hasParam("q", textQuery) .andNoOtherParam(); }

Target:
public void search() { String organization = randomAlphanumeric(20); int page = 17; int pageSize = 39; String textQuery = randomAlphanumeric(20); underTest.search(new SearchWsRequest() .setOrganization(organization) .setQualifiers(asList("q1", "q2")) .setPage(page) .setPageSize(pageSize) .setQuery(textQuery) ); assertThat(serviceTester.getGetParser()).isSameAs(WsComponents.SearchWsResponse.parser()); serviceTester.assertThat(serviceTester.getGetRequest()) .hasPath("search") .hasParam("organization", organization) .hasParam("qualifiers", "q1,q2") .hasParam("p", page) .hasParam("ps", pageSize) .hasParam("q", textQuery) .andNoOtherParam(); }
Source:
public void testTypedHandleResponse() throws IllegalAccessException, InstantiationException { expect(response.getStatus()).andReturn(responseStatusCode); expect(response.readEntity(eq(String.class))).andReturn(""); expect(statusType.getFamily()).andReturn(Response.Status.Family.SUCCESSFUL); expectedParsedResponse = new HashMap<String, Object>(); expect(response.readEntity(anyObject(GenericType.class))).andReturn(expectedParsedResponse); replay(response, statusType); assertThat(new DefaultResponseHandler().handleResponse(response, new ParameterizedTypeImpl(Map.class, String.class, Object.class)), instanceOf(Map.class)); }

Target:
public void testTypedHandleResponse() throws IllegalAccessException, InstantiationException { expect(response.getStatus()).andReturn(responseStatusCode); expect(response.readEntity(eq(String.class))).andReturn(""); expect(statusType.getFamily()).andReturn(Response.Status.Family.SUCCESSFUL); expectedParsedResponse = new HashMap<String, Object>(); expect(response.readEntity(anyObject(GenericType.class))).andReturn(expectedParsedResponse); replay(response, statusType); assertThat(new DefaultResponseHandler().handleResponse(response, new ParameterizedTypeImpl(Map.class, String.class, Object.class)), instanceOf(Map.class)); verify(response, statusType); }
Source:
public KubernetesBase() { String endpointIP = System.getenv(KUBERNETES_MASTER_IP_ENV); String endpointPort = System.getenv(KUBERNETES_MASTER_PORT_ENV); if (endpointIP == null || endpointIP.isEmpty()) { endpointIP = DEFAULT_KUBERNETES_MASTER_IP; } if (endpointPort == null || endpointPort.isEmpty()) { endpointPort = DEFAULT_KUBERNETES_MASTER_PORT; } this.client = new DefaultKubernetesClient("http://" + endpointIP + ":" + endpointPort); }

Target:
public KubernetesBase() { String endpointIP = System.getenv(KUBERNETES_MASTER_IP_ENV); String endpointPort = System.getenv(KUBERNETES_MASTER_PORT_ENV); if (endpointIP == null || endpointIP.isEmpty()) { endpointIP = DEFAULT_KUBERNETES_MASTER_IP; } if (endpointPort == null || endpointPort.isEmpty()) { endpointPort = DEFAULT_KUBERNETES_MASTER_PORT; } URL url; try { url = new URL("http", endpointIP, Integer.parseInt(endpointPort), ""); this.client = new DefaultKubernetesClient(url.toString()); } catch (MalformedURLException e) { LOGGER.error("Unable to identify the Kubernetes master node.", e); } catch (NullPointerException e) { LOGGER.error("Unable to identify the Kubernetes master node.", e); } }
Source:
public void verifyService() { assertNotNull(atomClientService); atomClientService.fetch(); atomClientService.fetch(); atomClientService.fetch(); }

Target:
public void verifyService() { assertNotNull(atomClientService); }
Source:
public void testDropViewIndexColumn() throws Exception { String table = generateUniqueName(); String view = generateUniqueName(); String index = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.setAutoCommit(true); try (Statement stmt = conn.createStatement()) { stmt.execute("CREATE TABLE IF NOT EXISTS " + table + " (ID CHAR(10) NOT NULL,KEY_PREFIX CHAR(3) NOT NULL," + " CONSTRAINT PK PRIMARY KEY (ID,KEY_PREFIX))"); stmt.execute( "CREATE VIEW IF NOT EXISTS " + view + " (PK1 DATE NOT NULL,PK2 CHAR(15) NOT NULL," + "NON_PK1 CHAR(15),NON_PK2 CHAR(15) CONSTRAINT PKVIEW PRIMARY KEY (PK1,PK2)) " + "AS SELECT * FROM " + table + " WHERE KEY_PREFIX = '123'"); stmt.execute("CREATE INDEX " + index + " ON " + view + " (PK2, PK1) INCLUDE (NON_PK1, NON_PK2)"); stmt.execute("ALTER VIEW " + view + " DROP COLUMN NON_PK1"); } } catch (Exception e) { fail(); } }

Target:
public void testDropViewIndexColumn() throws Exception { String table = generateUniqueName(); String view = generateUniqueName(); String index = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.setAutoCommit(true); try (Statement stmt = conn.createStatement()) { stmt.execute("CREATE TABLE IF NOT EXISTS " + table + " (ID CHAR(10) NOT NULL,KEY_PREFIX CHAR(3) NOT NULL," + " CONSTRAINT PK PRIMARY KEY (ID,KEY_PREFIX))"); stmt.execute( "CREATE VIEW IF NOT EXISTS " + view + " (PK1 DATE NOT NULL,PK2 CHAR(15) NOT NULL," + "NON_PK1 CHAR(15),NON_PK2 CHAR(15) CONSTRAINT " + "PKVIEW PRIMARY KEY (PK1,PK2)) " + "AS SELECT * FROM " + table + " WHERE KEY_PREFIX = '123'"); stmt.execute("CREATE INDEX " + index + " ON " + view + " (PK2, PK1) INCLUDE (NON_PK1, NON_PK2)"); stmt.execute("ALTER VIEW " + view + " DROP COLUMN NON_PK1"); } } }
Source:
public void onLiveStreamPacketizerCreate(ILiveStreamPacketizer liveStreamPacketizer, String streamName) { logger.debug("onLiveStreamPacketizerCreate. stream: " + streamName); if (!(liveStreamPacketizer instanceof LiveStreamPacketizerCupertino)) return; LiveStreamPacketizerCupertino cupertinoPacketizer = (LiveStreamPacketizerCupertino) liveStreamPacketizer; IMediaStream stream = appInstance.getStreams().getStream(streamName); KalturaLiveEntry entry = null; try { Pair<Object, KalturaEntryIdKey> entryPair = KalturaStreamsDataPersistence.getEntry(Constants.CLIENT_PROPERTY_KALTURA_LIVE_ENTRY, streamName); entry = (KalturaLiveEntry) entryPair.getLeft(); WMSProperties properties = stream.getProperties(); synchronized (properties) { properties.setProperty(Constants.KALTURA_ENTRY_DATA_PERSISTENCY_KEY, entryPair.getRight()); } } catch(Exception e) { logger.error("(" + streamName + ") failed to get entry."); } streamSettings.onStreamCreate(cupertinoPacketizer, stream, streamName, entry); logger.info("Create [" + streamName + "]: " + liveStreamPacketizer.getClass().getSimpleName()); cupertinoPacketizer.setDataHandler(new LiveStreamPacketizerDataHandler(cupertinoPacketizer, streamName)); }

Target:
public void onLiveStreamPacketizerCreate(ILiveStreamPacketizer liveStreamPacketizer, String streamName) { logger.debug("onLiveStreamPacketizerCreate. stream: " + streamName); if (!(liveStreamPacketizer instanceof LiveStreamPacketizerCupertino)) return; LiveStreamPacketizerCupertino cupertinoPacketizer = (LiveStreamPacketizerCupertino) liveStreamPacketizer; IMediaStream stream = appInstance.getStreams().getStream(streamName); streamSettings.onStreamCreate(cupertinoPacketizer, stream, streamName); logger.info("Create [" + streamName + "]: " + liveStreamPacketizer.getClass().getSimpleName()); cupertinoPacketizer.setDataHandler(new LiveStreamPacketizerDataHandler(cupertinoPacketizer, streamName)); }
Source:
public void deleteSubscription(@PathParam("subscription_id") String subscriptionId) { Pool master = this.poolManager.getMasterPoolBySubscriptionId(subscriptionId); if (master == null) { throw new NotFoundException( i18n.tr("A subscription with the ID \"{0}\" could not be found.", subscriptionId)); } this.poolManager.deletePools(Collections.singletonList(master), null); }

Target:
public void deleteSubscription(@PathParam("subscription_id") String subscriptionId) { Pool master = this.poolManager.getMasterPoolBySubscriptionId(subscriptionId); if (master == null) { throw new NotFoundException( i18n.tr("A subscription with the ID \"{0}\" could not be found.", subscriptionId)); } this.poolManager.deletePools(Collections.singletonList(master)); }
Source:
public boolean isConcreteStorageType() { return this.getValue() > 0; }

Target:
public boolean isConcreteStorageType() { return this != UNKNOWN; }
Source:
public SqlSystemViewColumns(GridKernalContext ctx, SchemaManager schemaMgr) { super("COLUMNS", "Ignite columns", ctx, new String[] {TABLE_NAME, COLUMN_NAME}, newColumn("SCHEMA_NAME"), newColumn(TABLE_NAME), newColumn(COLUMN_NAME), newColumn("COLUMN_ID", Value.INT), newColumn("DATA_TYPE"), newColumn("SQL_TYPE", Value.INT), newColumn("IS_NULLABLE", Value.BOOLEAN), newColumn("DISPLAY_SIZE", Value.INT), newColumn("PRECISION", Value.INT), newColumn("SCALE", Value.INT), newColumn("AFFINITY_KEY", Value.BOOLEAN) ); this.schemaMgr = schemaMgr; }

Target:
public SqlSystemViewColumns(GridKernalContext ctx, SchemaManager schemaMgr) { super("COLUMNS", "Ignite columns", ctx, new String[] {TABLE_NAME, COLUMN_NAME}, newColumn("SCHEMA_NAME"), newColumn(TABLE_NAME), newColumn(COLUMN_NAME), newColumn("ORDINAL_POSITION", Value.INT), newColumn("DEFAULT_VALUE"), newColumn("IS_NULLABLE", Value.BOOLEAN), newColumn("DATA_TYPE"), newColumn("CHARACTER_LENGTH", Value.INT), newColumn("NUMERIC_PRECISION", Value.INT), newColumn("NUMERIC_SCALE", Value.INT), newColumn("IS_AFFINITY_KEY", Value.BOOLEAN) ); this.schemaMgr = schemaMgr; }
Source:
public static void setAuthorAttributionText(@NonNull TextView textView, @StringRes final int stringRes, @NonNull final IAuthorData authorData, long initialTimeStampMs, @NonNull final Runnable onAuthorClickListener) { final CharSequence text; { final Context context = textView.getContext(); final CharSequence formattedTime = getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); final String authorLabel = authorData.getAuthorLabel(); final SpannableString authorSpan = new SpannableString(authorData.getAuthor()); if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { authorSpan.setSpan(new ClickableSpan() { @Override public void onClick(View widget) { onAuthorClickListener.run(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); } }, 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); authorSpan.setSpan(new StyleSpan(Typeface.BOLD), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } text = trim(ResourceUtil.getFormattedString(context.getResources(), stringRes, new HashMap<String, CharSequence>() {{ put("time", formattedTime); put("author", authorSpan); put("author_label", null == authorLabel ? "" : authorLabel); }})); } textView.setText(text); textView.setMovementMethod(new LinkMovementMethod()); }

Target:
public static void setAuthorAttributionText(@NonNull TextView textView, @StringRes final int stringRes, @NonNull final IAuthorData authorData, long initialTimeStampMs, @NonNull final Runnable onAuthorClickListener) { final CharSequence text; { final Context context = textView.getContext(); final CharSequence formattedTime = getRelativeTimeSpanString(context, initialTimeStampMs, authorData.getCreatedAt().getTime()); final String authorLabel = authorData.getAuthorLabel(); final SpannableString authorSpan = new SpannableString(authorData.getAuthor()); if (config.isUserProfilesEnabled() && !authorData.isAuthorAnonymous()) { authorSpan.setSpan(new ClickableSpan() { @Override public void onClick(View widget) { onAuthorClickListener.run(); } @Override public void updateDrawState(TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); } }, 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); authorSpan.setSpan(new StyleSpan(Typeface.BOLD), 0, authorSpan.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } text = trim(ResourceUtil.getFormattedString(context.getResources(), stringRes, new HashMap<String, CharSequence>() {{ put("time", formattedTime); put("author", authorSpan); put("author_label", authorLabel); }})); } textView.setText(text); textView.setMovementMethod(new LinkMovementMethod()); }
Source:
public void setTaskRetries(Map<String, String> taskRetries) { if (this.taskRetries == null) { this.taskRetries = new HashMap<String, String>(); } else { this.taskRetries = taskRetries; } }

Target:
public void setTaskRetries(Map<String, String> taskRetries) { this.taskRetries = taskRetries; }
Source:
private HeaderEntry getEntryInsensitive(CharSequence name, CharSequence value) { if (length() == 0 || name == null || value == null) { return null; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { if (e.hash == h && equalsVariableTime(name, e.name) && equalsVariableTime(value, e.value)) { return e; } } return null; }

Target:
private HeaderEntry getEntryInsensitive(CharSequence name, CharSequence value) { if (length() == 0 || name == null || value == null) { return null; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { if (e.hash == h && equalsVariableTime(value, e.value) && equalsVariableTime(name, e.name)) { return e; } } return null; }
Source:
public Response install(Action action) { VDS vds = getEntity(); UpdateVdsActionParameters params = new UpdateVdsActionParameters(vds.getStaticData(), action.getRootPassword(), true); params.setFenceAgents(vds.getFenceAgents()); params = (UpdateVdsActionParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, params); if (vds.isOvirtNode()) { params.setReinstallOrUpgrade(true); if (action.isSetImage()) { params.setoVirtIsoFile(action.getImage()); return doAction(VdcActionType.UpgradeOvirtNode, params, action); } } return doAction(VdcActionType.UpdateVds, params, action); }

Target:
public Response install(Action action) { VDS vds = getEntity(); UpdateVdsActionParameters params = new UpdateVdsActionParameters(vds.getStaticData(), action.getRootPassword(), true); params.setFenceAgents(null); params = (UpdateVdsActionParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, params); if (vds.isOvirtNode()) { params.setReinstallOrUpgrade(true); if (action.isSetImage()) { params.setoVirtIsoFile(action.getImage()); return doAction(VdcActionType.UpgradeOvirtNode, params, action); } } return doAction(VdcActionType.UpdateVds, params, action); }
Source:
private String evaluateFormattedFilterDate(int calendarUnit, int amount) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); ISO8601DateSerde serde = (ISO8601DateSerde) elide.getElideSettings().getSerdes().get(Date.class); Format dateFormat = new SimpleDateFormat(serde.getFormat()); String filterDateFormatted = dateFormat.format(filterDate); log.debug("FilterDateFormatted = {}", filterDateFormatted); return filterDateFormatted; }

Target:
private String evaluateFormattedFilterDate(int calendarUnit, int amount) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(calendarUnit, -(amount)); Date filterDate = cal.getTime(); Format dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'"); String filterDateFormatted = dateFormat.format(filterDate); log.debug("FilterDateFormatted = {}", filterDateFormatted); return filterDateFormatted; }
Source:
public void logAuditEvent(AuditEvent auditEvent) { if (AuditConstants.FAILURE.equals(auditEvent.getValue(AuditEvent.FieldName.RESULT))) { LOG.error(auditEvent.toString()); } else { LOG.info(auditEvent.toString()); } }

Target:
public void logAuditEvent(AuditEvent auditEvent) { if (auditEvent.getResult() == Result.FAILURE) { LOG.error(auditEvent.toString()); } else { LOG.info(auditEvent.toString()); } }
Source:
public String getRouteName(@NonNull Resources resources) { return "JABODETABEK"; }

Target:
public String getRouteName(@NonNull Resources resources) { return resources.getString(R.string.kmt_defroute); }
Source:
public void testDelete() throws Exception { List<Deployment> deployments = api().list(); for (Deployment d : deployments) { if (d.name().contains("jcdep")) { URI uri = api().delete(d.name()); assertNotNull(uri); assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { System.out.println(uri.toString()); System.out.println(api.getJobApi().jobStatus(uri).name()); return ParseJobStatus.JobStatus.NO_CONTENT == api.getJobApi().jobStatus(uri); } }, 60 * maxTestDuration * 1000).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } } }

Target:
public void testDelete() throws Exception { List<Deployment> deployments = api().list(); for (Deployment d : deployments) { if (d.name().contains("jc")) { URI uri = api().delete(d.name()); assertNotNull(uri); assertTrue(uri.toString().contains("api-version")); assertTrue(uri.toString().contains("operationresults")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.NO_CONTENT == api.getJobApi().jobStatus(uri); } }, 60 * maxTestDuration * 1000).apply(uri); assertTrue(jobDone, "delete operation did not complete in the configured timeout"); } } }
Source:
public Flatbush(T[] items, int degree) { checkArgument(degree > 0, "degree must be positive"); this.degree = degree; this.items = requireNonNull(items, "items is null"); this.levelOffsets = Flatbush.calculateLevelIndices(items.length, degree); this.tree = this.buildTree(); }

Target:
public Flatbush(T[] items, int degree) { checkArgument(degree > 0, "degree must be positive"); this.degree = degree; this.items = requireNonNull(items, "items is null"); this.levelOffsets = calculateLevelOffsets(items.length, degree); this.tree = buildTree(); }
Source:
public AbstractSequence<NucleotideCompound> getSequence() throws CompoundNotFoundException { try { DNASequenceCreator creator = new DNASequenceCreator(ABITracerCompoundSet.getABITracerCompoundSet()); return creator.getSequence(sequence, 0); } catch (Exception e) { throw new CompoundNotFoundException(e.toString()); } }

Target:
public AbstractSequence<NucleotideCompound> getSequence() throws CompoundNotFoundException { DNASequenceCreator creator = new DNASequenceCreator(ABITracerCompoundSet.getABITracerCompoundSet()); return creator.getSequence(sequence, 0); }
Source:
public boolean isSSPISupported() { try { if (!Platform.isWindows()) { LOGGER.log(Level.FINE, "SSPI not supported: non-Windows host"); return false; } Class.forName("waffle.windows.auth.impl.WindowsSecurityContextImpl"); return true; } catch (NoClassDefFoundError ex) { LOGGER.log(Level.FINE, "SSPI unavailable (no Waffle/JNA libraries?)", ex); return false; } catch (ClassNotFoundException ex) { LOGGER.log(Level.FINE, "SSPI unavailable (no Waffle/JNA libraries?)", ex); return false; } }

Target:
public boolean isSSPISupported() { try { if (!Platform.isWindows()) { LOGGER.log(Level.FINE, "SSPI not supported: non-Windows host"); return false; } Class.forName("waffle.windows.auth.impl.WindowsSecurityContextImpl"); return true; } catch (NoClassDefFoundError ex) { LOGGER.log(Level.WARNING, "SSPI unavailable (no Waffle/JNA libraries?)", ex); return false; } catch (ClassNotFoundException ex) { LOGGER.log(Level.WARNING, "SSPI unavailable (no Waffle/JNA libraries?)", ex); return false; } }
Source:
public DataSource getNewDataSource() { if (switched) throw new IllegalStateException(); if (!isCurrent()) { switched = true; try { if (iter != null) { iter.close(); } iter = null; iterator(); } catch (Exception e) { throw new RuntimeException(e); } } return this; }

Target:
public DataSource getNewDataSource() { if (switched) throw new IllegalStateException(); if (!isCurrent()) { switched = true; iter = null; try { iterator(); } catch (IOException e) { throw new RuntimeException(); } } return this; }
Source:
public void deleteTableTest() throws Exception { List<Table> modelTables = getTables(); int amountBeforeDeletion = modelTables.size(); selectElementInTheModelexplorer(modelTables.get(0)); IHandler handler = getActiveHandler(); handler.execute((new ExecutionEvent(testedCommand, Collections.EMPTY_MAP, null, null))); modelTables = getTables(); Assert.assertEquals("The deletion of a table has no effect", amountBeforeDeletion - 1, modelTables.size()); }

Target:
public void deleteTableTest() throws Exception { List<Table> modelTables = getTables(); int amountBeforeDeletion = modelTables.size(); selectElementInTheModelexplorer(modelTables.get(0)); IHandler handler = getActiveHandler(); handler.execute((new ExecutionEvent(testedCommand, Collections.EMPTY_MAP, null, null))); modelTables = getTables(); Assert.assertEquals("The deletion of a table has no effect", amountBeforeDeletion - 1, modelTables.size()); TransactionalEditingDomain domain = ServiceUtilsForEObject.getInstance().getTransactionalEditingDomain(getRootOfTheModel()); domain.getCommandStack().undo(); modelTables = getTables(); Assert.assertEquals("The undo after the deletion of a table has no effect", amountBeforeDeletion, modelTables.size()); domain.getCommandStack().redo(); modelTables = getTables(); Assert.assertEquals("The redo after the deletion of a table has no effect", amountBeforeDeletion - 1, modelTables.size()); domain.getCommandStack().undo(); modelTables = getTables(); Assert.assertEquals("The undo after the deletion of a table has no effect", amountBeforeDeletion, modelTables.size()); domain.getCommandStack().redo(); modelTables = getTables(); Assert.assertEquals("The redo after the deletion of a table has no effect", amountBeforeDeletion - 1, modelTables.size()); }
Source:
public <T> void notifyReadyAsync(Callable<T> callable, BiConsumer<T, Throwable> handler) { workerExecutor.execute(() -> { try { T result = callable.call(); executorToNotify.execute(() -> handler.accept(result, null)); } catch (Throwable t) { LOG.error("Unexpected exception", t); executorToNotify.execute(() -> handler.accept(null, t)); } }); }

Target:
public <T> void notifyReadyAsync(Callable<T> callable, BiConsumer<T, Throwable> handler) { workerExecutor.execute(() -> { try { T result = callable.call(); executorToNotify.execute(() -> handler.accept(result, null)); } catch (Throwable t) { executorToNotify.execute(() -> handler.accept(null, t)); } }); }
Source:
public Table getTable(String dbName, String tableName) { Table table; try { synchronized(client) { table = HCatUtil.getTable(client, dbName, tableName); } } catch (RuntimeException e) { throw new RuntimeException("Hive metastore exception", e); } catch (Exception e) { throw new DatasetNotFoundException("Hive table lookup exception", e); } if (table == null) { throw new DatasetNotFoundException("Could not find info for table: " + tableName); } return table; }

Target:
public Table getTable(String dbName, String tableName) { Table table; try { synchronized(client) { table = HCatUtil.getTable(client, dbName, tableName); } } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new DatasetNotFoundException("Hive table lookup exception", e); } if (table == null) { throw new DatasetNotFoundException("Could not find info for table: " + tableName); } return table; }
Source:
public void onSelect(SelectEvent event) { int size = DynamicLayoutPanel.Layout.values().length; DynamicLayoutPanel.Layout layout = DynamicLayoutPanel.Layout.values()[(layoutPanel.getLayout().ordinal() + 1) % size]; layoutPanel.changeLayout(layout); }

Target:
public void onSelect(SelectEvent event) { layoutPanel.changeLayout(layoutPanel.getLayout().getNext()); }
Source:
public Promise<UsagesResponse> usages(TextDocumentPositionParams params) { return Promises.create( (resolve, reject) -> { requestTransmitter .newRequest() .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID) .methodName("java/usages") .paramsAsDto(params) .sendAndReceiveResultAsDto(UsagesResponse.class, 10000) .onSuccess(resolve::apply) .onTimeout( () -> { reject.apply(JsPromiseError.create(new TimeoutException("Timeout"))); }) .onFailure( error -> { reject.apply(ServiceUtil.getPromiseError(error)); }); }); }

Target:
public Promise<UsagesResponse> usages(TextDocumentPositionParams params) { return Promises.create( (resolve, reject) -> { requestTransmitter .newRequest() .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID) .methodName(USAGES) .paramsAsDto(params) .sendAndReceiveResultAsDto(UsagesResponse.class, REQUEST_TIMEOUT) .onSuccess(resolve::apply) .onTimeout(() -> reject.apply(JsPromiseError.create(new TimeoutException("Timeout")))) .onFailure(error -> reject.apply(ServiceUtil.getPromiseError(error))); }); }
Source:
public Void visitDir(AbstractFile dir) { if (isDotDirectory(dir)) { return null; } dest.mkdir(); try { int numProcessed = 0; for (Content child : dir.getChildren()) { if (child instanceof FsContent){ java.io.File childFile = getFsContentDest(child); ExtractFscContentVisitor<T, V> childVisitor = new ExtractFscContentVisitor<>(childFile, progress, worker, false); if (worker != null && worker.isCancelled()) { break; } if (progress != null && source) { progress.progress(child.getName(), numProcessed); } child.accept(childVisitor); numProcessed++; } } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Trouble fetching children to extract.", ex); } return null; }

Target:
public Void visitDir(AbstractFile dir) { if (isDotDirectory(dir)) { return null; } dest.mkdir(); try { int numProcessed = 0; for (Content child : dir.getChildren()) { if (child instanceof AbstractFile){ java.io.File childFile = getFsContentDest(child); ExtractFscContentVisitor<T, V> childVisitor = new ExtractFscContentVisitor<>(childFile, progress, worker, false); if (worker != null && worker.isCancelled()) { break; } if (progress != null && source) { progress.progress(child.getName(), numProcessed); } child.accept(childVisitor); numProcessed++; } } } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Trouble fetching children to extract.", ex); } return null; }
Source:
public AbstractMetricsRW(Clock clock) { this.clock = clock; }

Target:
protected AbstractMetricsRW(Clock clock) { this.clock = clock; }
Source:
private static int getXForTime(Rectangle rect, long time0, double pixelsPerNanoSec, long time) { int x = rect.x + (int) (Math.floor((time - time0) * pixelsPerNanoSec)); return Math.min(Math.max(x, Integer.MIN_VALUE / 256), Integer.MAX_VALUE / 256); }

Target:
private static int getXForTime(Rectangle rect, long time0, double pixelsPerNanoSec, long time) { int x = rect.x + (int) (Math.floor((time - time0) * pixelsPerNanoSec)); return Math.min(Math.max(x, -X_LIMIT), X_LIMIT); }
Source:
public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) { if (getParams().containsKey(ExtraConstants.EXTRA_GOOGLE_SIGN_IN_OPTIONS)) { throw new IllegalStateException( "Cannot overwrite previously set sign-in options."); } GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder(options); builder.requestEmail().requestIdToken(getApplicationContext() .getString(R.string.default_web_client_id)); getParams().putParcelable( ExtraConstants.EXTRA_GOOGLE_SIGN_IN_OPTIONS, builder.build()); return this; }

Target:
public GoogleBuilder setSignInOptions(@NonNull GoogleSignInOptions options) { Preconditions.checkUnset(getParams(), "Cannot overwrite previously set sign-in options.", ExtraConstants.EXTRA_GOOGLE_SIGN_IN_OPTIONS); GoogleSignInOptions.Builder builder = new GoogleSignInOptions.Builder(options); builder.requestEmail().requestIdToken(getApplicationContext() .getString(R.string.default_web_client_id)); getParams().putParcelable( ExtraConstants.EXTRA_GOOGLE_SIGN_IN_OPTIONS, builder.build()); return this; }
Source:
private void verifyUsages(int line, int offset, TextRange... trs) { Collection<TextRange> textRanges = context.referencesForSymbolAt(componentKey, line, offset); if (trs.length == 0) { assertThat(textRanges).isEmpty(); } else { assertThat(textRanges).containsExactly(trs); } }

Target:
private void verifyUsages(int line, int offset, TextRange... trs) { Collection<TextRange> textRanges = context.referencesForSymbolAt(componentKey, line, offset); assertThat(textRanges).containsExactly(trs); }
Source:
public static WebAppDescriptor.Builder getBuilder() { String p = System.getenv("withVladimir"); System.out.println("HELLLLLLLLLLLLLLOOOOOOOOOOOOOO " + p); if (p == null || !"true".equalsIgnoreCase(p)) { return getBuilderForLegacyApi(); } else { return getBuilderForVladimir(); } }

Target:
public static WebAppDescriptor.Builder getBuilder() { boolean withVlad = Boolean.parseBoolean(System.getenv("withVladimir")); if (withVlad) { return getBuilderForLegacyApi(); } else { return getBuilderForVladimir(); } }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } NetworkView other = (NetworkView) obj; if (compatibilityVersion == null) { if (other.compatibilityVersion != null) { return false; } } else if (!compatibilityVersion.equals(other.compatibilityVersion)) { return false; } if (network == null) { if (other.network != null) { return false; } } else if (!network.equals(other.network)) { return false; } if (storagePoolName == null) { if (other.storagePoolName != null) { return false; } } else if (!storagePoolName.equals(other.storagePoolName)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof NetworkView)) { return false; } NetworkView other = (NetworkView) obj; if (getCompatibilityVersion() == null) { if (other.getCompatibilityVersion() != null) { return false; } } else if (!getCompatibilityVersion().equals(other.getCompatibilityVersion())) { return false; } if (getNetwork() == null) { if (other.getNetwork() != null) { return false; } } else if (!getNetwork().equals(other.getNetwork())) { return false; } if (getStoragePoolName() == null) { if (other.getStoragePoolName() != null) { return false; } } else if (!getStoragePoolName().equals(other.getStoragePoolName())) { return false; } return true; }
Source:
public AbstractPcjIndexSetProvider(final Configuration conf) { requireNonNull(conf); this.conf = conf; }

Target:
public AbstractPcjIndexSetProvider(final Configuration conf) { this.conf = requireNonNull(conf); }
Source:
public SimpleCertificateResponseMessageType listTemporaryAlias(SimpleCertificateRequestMessageType request) { try { SimpleCertificateResponseMessageType response = buildSimpleResponse(true, "Temporary Aliases"); CollectionUtils.addAll(response.getAliasList(), getTempKeystore().aliases()); return response; } catch (CertificateManagerException | KeyStoreException e) { LOG.error("Eror while getting temporary aliases list: {}", e.getLocalizedMessage(), e); return buildSimpleResponse(false, "Fail to retrieve aliases list"); } }

Target:
public SimpleCertificateResponseMessageType listTemporaryAlias(SimpleCertificateRequestMessageType request) { try { SimpleCertificateResponseMessageType response = buildSimpleResponse(true, "Temporary Aliases"); CollectionUtils.addAll(response.getAliasList(), getTempKeystore().aliases()); return response; } catch (CertificateManagerException | KeyStoreException e) { LOG.error("Error while getting temporary alias list: {}", e.getLocalizedMessage(), e); return buildSimpleResponse(false, "Failed to retrieve alias list"); } }
Source:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = GeoWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); View answerView = binding.getRoot(); binding.geoAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); readOnly = prompt.isReadOnly(); if (readOnly) { binding.simpleButton.setVisibility(GONE); } else { binding.simpleButton.setText(getDefaultButtonLabel()); binding.simpleButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.simpleButton.setOnClickListener(v -> { Bundle bundle = GeoWidgetUtils.getGeoPointBundle(stringAnswer, accuracyThreshold, null, null); GeoWidgetUtils.onButtonClick(context, prompt, getPermissionUtils(), null, waitingForDataRegistry, GeoPointActivity.class, bundle, LOCATION_CAPTURE); }); } return answerView; }

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = GeoWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); binding.geoAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); if (prompt.isReadOnly()) { binding.simpleButton.setVisibility(GONE); } else { binding.simpleButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.simpleButton.setOnClickListener(v -> geoDataRequester.requestGeoPoint(context, prompt, answerText, waitingForDataRegistry)); } answerText = prompt.getAnswerText(); if (answerText != null && !answerText.isEmpty()) { binding.geoAnswerText.setText(GeoWidgetUtils.getAnswerToDisplay(getContext(), answerText)); binding.simpleButton.setText(R.string.change_location); } else { binding.simpleButton.setText(R.string.get_point); } return binding.getRoot(); }
Source:
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) { if (args.length == 1) { return Lists.newArrayList("set", "reset"); } else if (args.length == 2) { return Lists.newArrayList("1", "2", "3", "4"); } else { return Collections.emptyList(); } }

Target:
protected List<String> getTabCompleteOptions(Server server, User user, String commandLabel, String[] args) { if (args.length == 1) { return Lists.newArrayList("set", "clear"); } else if (args.length == 2) { return Lists.newArrayList("1", "2", "3", "4"); } else { return Collections.emptyList(); } }