auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static KeyVaultCertificateIdentifier parse(String certificateId) throws IllegalArgumentException, MalformedURLException { if (certificateId == null) { throw new IllegalArgumentException("certificateId cannot be null"); } <START> URL url = new URL(certificateId); <END> String[] pathSegments = url.getPath().split("/"); if ((pathSegments.length != 3 && pathSegments.length != 4) || !"https".equals(url.getProtocol()) || (!"certificates".equals(pathSegments[1]) && !"deletedcertificates".equals(pathSegments[1])) || ("deletedcertificates".equals(pathSegments[1]) && pathSegments.length == 4)) { throw new IllegalArgumentException("certificateId is not a valid Key Vault Certificate identifier"); } return new KeyVaultCertificateIdentifier(certificateId, url.getProtocol() + "://" + url.getHost(), pathSegments[2], pathSegments.length == 4 ? pathSegments[3] : null); }</code><technical_language>is catch MalformedURLException wrap IllegalArgumentException a custom message attach MalformedURLException a cause</technical_language>

Target:
public static KeyVaultCertificateIdentifier parse(String certificateId) throws IllegalArgumentException { if (certificateId == null) { throw new IllegalArgumentException("certificateId cannot be null"); } try { final URL url = new URL(certificateId); final String[] pathSegments = url.getPath().split("/"); if ((pathSegments.length != 3 && pathSegments.length != 4) || !"https".equals(url.getProtocol()) || (!"certificates".equals(pathSegments[1]) && !"deletedcertificates".equals(pathSegments[1])) || ("deletedcertificates".equals(pathSegments[1]) && pathSegments.length == 4)) { throw new IllegalArgumentException("certificateId is not a valid Key Vault Certificate identifier"); } final String vaultUrl = String.format("%s://%s", url.getProtocol(), url.getHost()); final String certificateName = pathSegments[2]; final String certificateVersion = pathSegments.length == 4 ? pathSegments[3] : null; return new KeyVaultCertificateIdentifier(certificateId, vaultUrl, certificateName, certificateVersion); } catch (MalformedURLException e) { throw new IllegalArgumentException("Could not parse certificateId", e); } }
Source:
<code>public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if ( ViewPagerDownloadManager.instance.inInitialPhase(unit) ) return; if (isVisibleToUser) { <START> checkVideoStatus(unit); <END> try { if (playerFragment != null) { playerFragment.setCallback(this); playerFragment.handleOnResume(); } } catch (Exception ex) { logger.error(ex); } }else{ if (getActivity() != null) { ((BaseFragmentActivity) getActivity()).hideInfoMessage(true); } try { if (playerFragment != null) { playerFragment.setCallback(null); playerFragment.handleOnPause(); } } catch (Exception ex) { logger.error(ex); } } }</code><technical_language>Hmm, separate out error states functionality in checkVideoStatus(), want re-show messages here</technical_language>

Target:
public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); if ( ViewPagerDownloadManager.instance.inInitialPhase(unit) ) return; if (isVisibleToUser) { checkVideoStatus(unit); try { if (playerFragment != null) { playerFragment.setCallback(this); playerFragment.handleOnResume(); } } catch (Exception ex) { logger.error(ex); } }else{ if (getActivity() != null) { ((BaseFragmentActivity) getActivity()).hideInfoMessage(); } try { if (playerFragment != null) { playerFragment.setCallback(null); playerFragment.handleOnPause(); } } catch (Exception ex) { logger.error(ex); } } }
Source:
<code>public void stop() { logger.info("stopping SparkDriver"); try { if (javaStreamingContext != null) { javaStreamingContext.ssc().sc().cancelAllJobs(); javaStreamingContext.close(); } if (streamingContext != null) { streamingContext.sc().cancelAllJobs(); <START> streamingContext.stop(true, false); <END> } super.stop(); } catch (Exception e) { logger.warn("Exception when stopping the spark module " + e); } }</code><technical_language>is this want here? boolean stopping actual SparkContext 2nd boolean is FALSE for "graceful" So, jump out: 1) boolean values reverse of mention in TODO this 2) this is Java version (where call close), done - cancel call - a temporary workaround proper stop (with false, true) work</technical_language>

Target:
public void stop() { logger.info("stopping SparkDriver"); try { if (streamingContext != null) { streamingContext.sc().cancelAllJobs(); streamingContext.stop(true, false); } super.stop(); } catch (Exception e) { logger.warn("Exception when stopping the spark module " + e); } }
Source:
<code>public Connection getConnection() throws SQLException { Connection connection = null; int retryAttempt = 1; while (retryAttempt < AzDBUtil.MAX_DB_RETRY_COUNT) { try { connection = createDataSource().getConnection(); if (connection == null || isReadOnly(connection)) { throw new SQLException("Failed to find DB connection Or connection is read only. "); } else { return connection; } } catch (final SQLException ex) { try { invalidateConnection(connection); } catch (final Exception e) { logger.error( "can not invalidate connection.", e); } <START> logger.error( "Failed to find write-enabled DB connection. Wait 1 minutes and retry." <END> + " No.Attempt = " + retryAttempt, ex); sleep(1000L * 15); retryAttempt++; } } return connection; }</code><technical_language>wait 15 seconds match code</technical_language>

Target:
public Connection getConnection() throws SQLException { Connection connection = null; int retryAttempt = 1; while (retryAttempt < AzDBUtil.MAX_DB_RETRY_COUNT) { try { connection = createDataSource().getConnection(); if (connection == null || isReadOnly(connection)) { throw new SQLException("Failed to find DB connection Or connection is read only. "); } else { return connection; } } catch (final SQLException ex) { try { invalidateConnection(connection); } catch (final Exception e) { logger.error( "can not invalidate connection.", e); } logger.error( "Failed to find write-enabled DB connection. Wait 15 seconds and retry." + " No.Attempt = " + retryAttempt, ex); sleep(1000L * 15); retryAttempt++; } } return connection; }
Source:
<code>public static Calendar convertToCalendar(String value) { Calendar result = null; if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("N/A") && !value.equalsIgnoreCase("NA")) { try { result = Calendar.getInstance(); result.setTimeInMillis(Long.valueOf(value) * 1000); } catch (NumberFormatException e) { <START> logger.debug("Cannot convert to Calendar", value); <END> result = null; } } return result; }</code><technical_language>In static methods do this: java LoggerFactory.getLogger(WeatherUndergroundJsonUtils.class).debug(...);</technical_language>

Target:
public static Calendar convertToCalendar(String value) { Calendar result = null; if (isValid(value)) { try { result = Calendar.getInstance(); result.setTimeInMillis(Long.valueOf(value) * 1000); } catch (NumberFormatException e) { LoggerFactory.getLogger(WeatherUndergroundJsonUtils.class).debug("Cannot convert to Calendar", value); result = null; } } return result; }
Source:
<code>public Node getContextNode() { <START> return getLibraryNode() != null || getParent() == null ? this : org.raml.yagi.framework.util.NodeUtils.getContextNode(getParent()); <END> }</code><technical_language>replace qualified name import</technical_language>

Target:
public Node getContextNode() { return getLibraryNode() != null || getParent() == null ? this : NodeUtils.getContextNode(getParent()); }
Source:
<code>public void graphReleased(Object v, MouseEvent me) { final PickedState<Object> pickedVertexState = _graphContext.getVisualizationViewer().getPickedVertexState(); final Object[] selectedObjects = pickedVertexState.getSelectedObjects(); final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout(); for (final Object vertex : selectedObjects) { final Double x = graphLayout.getX(vertex); final Double y = graphLayout.getY(vertex); if (vertex instanceof HasMetadataProperties) { final Map<String, String> metadataProperties = ((HasMetadataProperties) vertex).getMetadataProperties(); metadataProperties.put(JobGraphMetadata.METADATA_PROPERTY_COORDINATES_X, "" + x.intValue()); metadataProperties.put(JobGraphMetadata.METADATA_PROPERTY_COORDINATES_Y, "" + y.intValue()); } else if (vertex instanceof Table) { JobGraphMetadata.setPointForTable(_graphContext.getAnalysisJobBuilder(), (Table) vertex, x, y); } } if (selectedObjects.length > 0) { _graphContext.getJobGraph().refresh(); <START> } <END> }</code><technical_language>I guess refresh thought? :)</technical_language>

Target:
public void graphReleased(Object v, MouseEvent me) { if (_pressedPoint != null && _pressedPoint.equals(me.getPoint())) { return; } final PickedState<Object> pickedVertexState = _graphContext.getVisualizationViewer().getPickedVertexState(); final Object[] selectedObjects = pickedVertexState.getSelectedObjects(); final AbstractLayout<Object, JobGraphLink> graphLayout = _graphContext.getGraphLayout(); for (final Object vertex : selectedObjects) { final Double x = graphLayout.getX(vertex); final Double y = graphLayout.getY(vertex); if (vertex instanceof HasMetadataProperties) { final Map<String, String> metadataProperties = ((HasMetadataProperties) vertex).getMetadataProperties(); metadataProperties.put(JobGraphMetadata.METADATA_PROPERTY_COORDINATES_X, "" + x.intValue()); metadataProperties.put(JobGraphMetadata.METADATA_PROPERTY_COORDINATES_Y, "" + y.intValue()); } else if (vertex instanceof Table) { JobGraphMetadata.setPointForTable(_graphContext.getAnalysisJobBuilder(), (Table) vertex, x, y); } } if (selectedObjects.length > 0) { _graphContext.getJobGraph().refresh(); } }
Source:
<code>S3FileSystemBase( Provider<AbstractBackupPath> pathProvider, ICompression compress, final IConfiguration config, BackupMetrics backupMetrics, BackupNotificationMgr backupNotificationMgr) { super(config, backupMetrics, backupNotificationMgr, pathProvider); this.compress = compress; this.config = config; int threads = config.getBackupThreads(); LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>(threads); this.executor = new BlockingSubmitThreadPoolExecutor(threads, queue, config.getUploadTimeout()); double throttleLimit = config.getUploadThrottle(); this.rateLimiter = RateLimiter.create(throttleLimit < 1 ? Double.MAX_VALUE : throttleLimit); <START> int objectExistLimit = config.getRemoteFileSystemObjectThrottle(); <END> this.objectExistLimiter = RateLimiter.create(objectExistLimit < 1 ? Double.MAX_VALUE : objectExistLimit); }</code><technical_language>want consider changing dynamically, in case of incident</technical_language>

Target:
S3FileSystemBase( Provider<AbstractBackupPath> pathProvider, ICompression compress, final IConfiguration config, BackupMetrics backupMetrics, BackupNotificationMgr backupNotificationMgr) { super(config, backupMetrics, backupNotificationMgr, pathProvider); this.compress = compress; this.config = config; int threads = config.getBackupThreads(); LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>(threads); this.executor = new BlockingSubmitThreadPoolExecutor(threads, queue, config.getUploadTimeout()); this.rateLimiter = RateLimiter.create(1); this.objectExistLimiter = RateLimiter.create(1); configChangeListener(); }
Source:
<code>public void shouldFailedIfToTypeNotMatch() throws Exception { operation.value = Boolean.FALSE; try { operation.xpath = "lists:integer"; operation.run(doc); fail(); } catch (OperationException | UnsupportedOperationException e) { assertEquals("Given type \"false\" value is not a long type", e.getMessage()); } catch (Exception e) { <START> fail(); <END> } }</code><technical_language>part of original code clean up. Remove lines, Exception thrown, give clearer test error messages if a failure</technical_language>

Target:
public void shouldFailedIfToTypeNotMatch() throws Exception { operation.value = Boolean.FALSE; try { operation.xpath = "lists:integer"; operation.run(doc); fail(); } catch (Exception e) { assertEquals("Given type \"false\" value is not a long type", e.getMessage()); } }
Source:
<code>private static Map parse(Response res) { <START> return GSON.fromJson( <END> res.getBody().asString(), new TypeToken<Map<String, Object>>() {}.getType()); }</code><technical_language>concern Gson serialize deserialize in order validate. This won 't if broke anything</technical_language>

Target:
private static Map parse(Response res) { return GSON.fromJson(res.getBody().asString(), MAP_STRING_TO_OBJECT_TYPE); }
Source:
<code>public List<Path> compact(ThroughputController throughputController, User user) throws IOException { if (request instanceof DateTieredCompactionRequest) { return compactor.compact(request, ((DateTieredCompactionRequest) request).getBoundaries(), <START> ((DateTieredCompactionRequest) request).getBoundariesPolicies(), <END> throughputController, user); } else { throw new IllegalArgumentException("DateTieredCompactionRequest is expected. Actual: " + request.getClass().getCanonicalName()); } }</code><technical_language>Cast DateTieredCompactionRequest a locl variable of casted instance</technical_language>

Target:
public List<Path> compact(ThroughputController throughputController, User user) throws IOException { if (request instanceof DateTieredCompactionRequest) { DateTieredCompactionRequest compactionRequest = (DateTieredCompactionRequest) request; return compactor.compact(request, compactionRequest.getBoundaries(), compactionRequest.getBoundariesPolicies(), throughputController, user); } else { throw new IllegalArgumentException("DateTieredCompactionRequest is expected. Actual: " + request.getClass().getCanonicalName()); } }
Source:
<code>public String render() { <START> String swiftGeneratedHeader = String.format("%s-Swift.h", targetName); <END> return headerNames.stream() .filter(x -> !x.equals(swiftGeneratedHeader)) .map(x -> String.format("#import <%s/%s>\n", targetName, x)) .reduce("", String::concat); }</code><technical_language>move this a constructor a set in case need add more stuff in future. that: ImmutableSet<String> headersToExclude; public UmbrellaHeader(...) { ... headersToExclude = ImmutableSet.of( // Target-Swift.h header file excluded list of header names. // umbrella header import generated Objective-C header. // is job of module map Swift code is accessible // Objective-C Target-Swift.h header file. String.format("%s-Swift.h", targetName)); }</technical_language>

Target:
public String render() { return headerNames.stream() .filter(x -> !headersToExclude.contains(x)) .map(x -> String.format("#import <%s/%s>\n", targetName, x)) .reduce("", String::concat); }
Source:
<code>public void before() { LoggerFactory.getLogger( BlacklistTranslatorTest.class ).info( "Executing test " + testName.getMethodName() ); Map<String, String> headers = new LinkedHashMap<>( 1 ); <START> headers.put( "Foo", "bar" ); <END> this.blacklistTranslator = new DefaultTranslator( mockServer.getUrl(), 0, Translator.CHUNK_SPLIT_COUNT, "", "", headers ); }</code><technical_language>HttpHeaderHeaderTest hacks it. RESTParametersTest creates a dummy AbstractHandler (as headers extracted HttpServletRequest)</technical_language>

Target:
public void before() { LoggerFactory.getLogger( BlacklistTranslatorTest.class ).info( "Executing test " + testName.getMethodName() ); this.blacklistTranslator = new DefaultTranslator( mockServer.getUrl(), 0, Translator.CHUNK_SPLIT_COUNT, "", "" ); }
Source:
<code>public ContentElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { ContentElement.Builder builder = ContentElement.builder(); boolean inContentElement = true; while (inContentElement) { XmlPullParser.Event tag = parser.next(); if (tag == XmlPullParser.Event.START_ELEMENT) { String name = parser.getName(); switch (name) { case ToAffixElement.ELEMENT: parseToAffix(parser, builder); break; case FromAffixElement.ELEMENT: parseFromAffix(parser, builder); break; case TimestampAffixElement.ELEMENT: parseTimestampAffix(parser, builder); break; case RandomPaddingAffixElement.ELEMENT: parseRPadAffix(parser, builder); break; case PayloadElement.ELEMENT: parsePayload(parser, builder); break; default: parseCustomAffix(parser, builder); break; } } else if (tag == XmlPullParser.Event.END_ELEMENT) { String name = parser.getName(); <START> if (name.equals(ContentElement.ELEMENT) && ContentElement.NAMESPACE.equals(parser.getNamespace())) { <END> inContentElement = false; } } } return builder.build(); }</code><technical_language>I prefer depth comparison, a single integer comparison, String equality checks</technical_language>

Target:
public ContentElement parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { ContentElement.Builder builder = ContentElement.builder(); while (true) { XmlPullParser.Event tag = parser.next(); if (tag == XmlPullParser.Event.START_ELEMENT) { String name = parser.getName(); switch (name) { case ToAffixElement.ELEMENT: parseToAffix(parser, builder); break; case FromAffixElement.ELEMENT: parseFromAffix(parser, builder); break; case TimestampAffixElement.ELEMENT: parseTimestampAffix(parser, builder); break; case RandomPaddingAffixElement.ELEMENT: parseRPadAffix(parser, builder); break; case PayloadElement.ELEMENT: parsePayload(parser, xmlEnvironment, builder); break; default: parseCustomAffix(parser, xmlEnvironment, builder); break; } } else if (tag == XmlPullParser.Event.END_ELEMENT) { if (parser.getDepth() == initialDepth) { break; } } } return builder.build(); }
Source:
<code>public <T> Collection<T> services(String name) { if (!enterBusy()) return null; try { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); <START> Collection<ServiceContextImpl> ctxs = Optional.ofNullable(lookupDeployedServiceId(name)) <END> .map(locServices::get).orElse(null); if (F.isEmpty(ctxs)) return null; Collection<T> res = new ArrayList<>(ctxs.size()); for (ServiceContextImpl ctx : ctxs) { Service svc = ctx.service(); if (svc != null) res.add((T)svc); } return res; } finally { leaveBusy(); } }</code><technical_language>Evil</technical_language>

Target:
@Override public <T> Collection<T> services(String name) { ctx.security().authorize(name, SecurityPermission.SERVICE_INVOKE, null); Collection<ServiceContextImpl> ctxs; synchronized (locSvcs) { ctxs = locSvcs.get(name); } if (ctxs == null) return null; synchronized (ctxs) { Collection<T> res = new ArrayList<>(ctxs.size()); for (ServiceContextImpl ctx : ctxs) { Service svc = ctx.service(); if (svc != null) res.add((T)svc); } return res; } }
Source:
<code>protected void changeStorageDomainStatusInTransaction(final StoragePoolIsoMap map, final StorageDomainStatus status) { executeInNewTransaction(new TransactionMethod<StoragePoolIsoMap>() { @SuppressWarnings("synthetic-access") @Override public StoragePoolIsoMap runInTransaction() { <START> CompensationContext context = getCompensationContext(); <END> context.snapshotEntityStatus(map, map.getstatus()); map.setstatus(status); getStoragePoolIsoMapDao().updateStatus(map.getId(), map.getstatus()); getCompensationContext().stateChanged(); return null; } }); }</code><technical_language>this line removed</technical_language>

Target:
protected void changeStorageDomainStatusInTransaction(final StoragePoolIsoMap map, final StorageDomainStatus status) { executeInNewTransaction(new TransactionMethod<StoragePoolIsoMap>() { @Override public StoragePoolIsoMap runInTransaction() { CompensationContext context = getCompensationContext(); context.snapshotEntityStatus(map, map.getstatus()); updateStatus(map, status); getCompensationContext().stateChanged(); return null; } }); }
Source:
<code>private void assertValidState(EventAdmin eventAdmin) throws IllegalStateException { if (eventAdmin == null) { <START> throw new IllegalArgumentException("The event bus module is not available!"); <END> } }</code><technical_language>This IllegalStateException</technical_language>

Target:
private void assertValidState(EventAdmin eventAdmin) throws IllegalStateException { if (eventAdmin == null) { throw new IllegalStateException("The event bus module is not available!"); } }
Source:
<code>private void assertBigDecimalLiteral(RexBuilder builder, String val) { final RexNode literal = builder.makeExactLiteral(new BigDecimal(val)); <START> assertThat("Generated wrong BigDecimal RexLiteral", <END> ((RexLiteral) literal).getValueAs(BigDecimal.class).toString(), is(val)); }</code><technical_language>"Generated wrong BigDecimal RexLiteral" clarify much. testBigDecimalLiteral clarifies neither. Exception message provide clear (to a developer looked test method source) indication test failed. For instance: assertThat("builder.makeExactLiteral(new BigDecimal(" + val + ")).toString()", ..., is(val))</technical_language>

Target:
private void assertBigDecimalLiteral(RexBuilder builder, String val) { final RexNode literal = builder.makeExactLiteral(new BigDecimal(val)); assertThat("builder.makeExactLiteral(new BigDecimal(" + val + ")).getValueAs(BigDecimal.class).toString()", ((RexLiteral) literal).getValueAs(BigDecimal.class).toString(), is(val)); }
Source:
<code>public final void removeSession(String sessionId) { Iterator<Entry<String, SessionInfo>> iterator = sessionInfoMap.entrySet().iterator(); while (iterator.hasNext()) { if (iterator.next().getKey().equals(sessionId)) { iterator.remove(); break; <START> } <END> } }</code><technical_language>I understand key session id</technical_language>

Target:
public final void removeSession(String sessionId) { sessionInfoMap.remove(sessionId); }
Source:
<code><START> void refreshConnection() { <END> if (networkRequest != null) { networkRequest.resetTask(); } if (refreshTokenNetworkRequest != null) { refreshTokenNetworkRequest.resetTask(); } }</code><technical_language>this synchronized SyncSession instance? Is reachable user code SyncManager.refreshConnection</technical_language>

Target:
synchronized void refreshConnection() { if (networkRequest != null) { networkRequest.resetTask(); } if (refreshTokenNetworkRequest != null) { refreshTokenNetworkRequest.resetTask(); } }
Source:
<code>protected BookieServer startBookie(ServerConfiguration conf, final Bookie b) throws Exception { BookieServer server = new BookieServer(conf) { @Override protected Bookie newBookie(ServerConfiguration conf) { return b; } }; BookieSocketAddress address = Bookie.getBookieAddress(conf); if (bkc == null) { bkc = new BookKeeperTestClient(baseClientConf); } <START> Future<?> waitForBookie = bkc.waitForBookie(address); <END> server.start(); waitForBookie.get(30, TimeUnit.SECONDS); LOG.info("New bookie, {}, has been created.", address); try { startAutoRecovery(server, conf); } catch (CompatibilityException ce) { LOG.error("Exception while starting AutoRecovery!", ce); } catch (UnavailableException ue) { LOG.error("Exception while starting AutoRecovery!", ue); } return server; }</code><technical_language>is Future CompletableFuture</technical_language>

Target:
protected BookieServer startBookie(ServerConfiguration conf, final Bookie b) throws Exception { BookieServer server = new BookieServer(conf) { @Override protected Bookie newBookie(ServerConfiguration conf) { return b; } }; BookieSocketAddress address = Bookie.getBookieAddress(conf); if (bkc == null) { bkc = new BookKeeperTestClient(baseClientConf); } Future<?> waitForBookie = conf.isForceReadOnlyBookie() ? bkc.waitForReadOnlyBookie(address) : bkc.waitForWritableBookie(address); server.start(); waitForBookie.get(30, TimeUnit.SECONDS); LOG.info("New bookie '{}' has been created.", address); try { startAutoRecovery(server, conf); } catch (CompatibilityException ce) { LOG.error("Exception while starting AutoRecovery!", ce); } catch (UnavailableException ue) { LOG.error("Exception while starting AutoRecovery!", ue); } return server; }
Source:
<code><START> public List<Thing> parseGeneric(String jsonText, String listingName) throws ParseException, RedditError { <END> List<Thing> things = new LinkedList<Thing>(); Object response = jsonParser.parse(jsonText); validate(response); JSONObject object = (JSONObject) response; System.out.println(object.toJSONString()); JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get(listingName); for (Object element : array) { JSONObject data = (JSONObject) element; String kind = safeJsonToString(data.get("kind")); if (kind == null) { LOGGER.warn("Could not detect kind in a reddit listing element, skipping it."); } else if (kind.equals(Kind.COMMENT.value())) { things.add(new Comment(((JSONObject) data.get("data")))); } else if (kind.equals(Kind.LINK.value())) { things.add(new Submission(((JSONObject) data.get("data")))); } else if (kind.equals(Kind.SUBREDDIT.value())) { things.add(new Subreddit(((JSONObject) data.get("data")))); } } return things; }</code><technical_language>I need format classes created/modified. indentation funky :smile_cat:</technical_language>

Target:
public List<Thing> parseGeneric(String jsonText, String listingName) throws RedditParseException { try { List<Thing> things = new LinkedList<Thing>(); Object response = JSON_PARSER.parse(jsonText); validate(response); JSONObject object = (JSONObject) response; JSONArray array = (JSONArray) ((JSONObject) object.get("data")).get(listingName); for (Object element : array) { JSONObject data = (JSONObject) element; String kindData = safeJsonToString(data.get("kind")); Object objData = data.get("data"); if (kindData == null) { LOGGER.warn("Kind data missing, skipping it."); } else if (objData == null || !(objData instanceof JSONObject)) { LOGGER.warn("Object data missing, skipping it."); } else { Kind kind = Kind.match(kindData); Thing thing = parseThing(kind, ((JSONObject) data.get("data"))); if (thing == null) { LOGGER.warn("Encountered invalid kind for a listing (" + kindData + "), skipping it."); } else { things.add(thing); } } } return things; } catch (ParseException pe) { throw new RedditParseException(pe); } }
Source:
<code>private static void findAtomic(Queue<PostfixNotationSymbol> queue, Deque<Set<Long>> stack, AtomicOperation atomic) { Preconditions.checkArgument(stack.isEmpty()); for (PostfixNotationSymbol symbol : queue) { if(symbol == ConjunctionSymbol.AND) { stack.push(TSets.intersection(stack.pop(), stack.pop())); } else if(symbol == ConjunctionSymbol.OR) { stack.push(TSets.union(stack.pop(), stack.pop())); } else if(symbol instanceof Expression) { Expression exp = (Expression) symbol; if(exp.getKeyRaw().equals( Constants.JSON_RESERVED_IDENTIFIER_NAME)) { Set<Long> idSet; if(exp.getOperatorRaw() == (Operator.EQUALS)) { idSet = Sets.newTreeSet(); for (TObject tObj : exp.getValuesRaw()) { idSet.add(((Number) Convert.thriftToJava(tObj)) .longValue()); } stack.push(idSet); } else if(exp.getOperatorRaw() == (Operator.NOT_EQUALS)) { idSet = atomic.getAllRecords(); for (TObject tObj : exp.getValuesRaw()) { idSet.remove(((Number) Convert.thriftToJava(tObj)) .longValue()); } stack.push(idSet); } else { <START> throw new IllegalArgumentException(); <END> } } else { stack.push(exp.getTimestampRaw() == 0 ? atomic.find( exp.getKeyRaw(), exp.getOperatorRaw(), exp.getValuesRaw()) : atomic.find( exp.getTimestampRaw(), exp.getKeyRaw(), exp.getOperatorRaw(), exp.getValuesRaw())); } } else { throw new IllegalStateException(); } } }</code><technical_language>nice a message "Cannot query record id "+ex.getOperatorRaw()</technical_language>

Target:
private static void findAtomic(Queue<PostfixNotationSymbol> queue, Deque<Set<Long>> stack, AtomicOperation atomic) { Preconditions.checkArgument(stack.isEmpty()); for (PostfixNotationSymbol symbol : queue) { if(symbol == ConjunctionSymbol.AND) { stack.push(TSets.intersection(stack.pop(), stack.pop())); } else if(symbol == ConjunctionSymbol.OR) { stack.push(TSets.union(stack.pop(), stack.pop())); } else if(symbol instanceof Expression) { Expression exp = (Expression) symbol; if(exp.getKeyRaw().equals( Constants.JSON_RESERVED_IDENTIFIER_NAME)) { Set<Long> idSet; if(exp.getOperatorRaw() == (Operator.EQUALS)) { idSet = Sets.newTreeSet(); for (TObject tObj : exp.getValuesRaw()) { idSet.add(((Number) Convert.thriftToJava(tObj)) .longValue()); } stack.push(idSet); } else if(exp.getOperatorRaw() == (Operator.NOT_EQUALS)) { idSet = atomic.getAllRecords(); for (TObject tObj : exp.getValuesRaw()) { idSet.remove(((Number) Convert.thriftToJava(tObj)) .longValue()); } stack.push(idSet); } else { System.out.println("Cannot query on record id using "+exp.getOperatorRaw()); throw new IllegalArgumentException(); } } else { stack.push(exp.getTimestampRaw() == 0 ? atomic.find( exp.getKeyRaw(), exp.getOperatorRaw(), exp.getValuesRaw()) : atomic.find( exp.getTimestampRaw(), exp.getKeyRaw(), exp.getOperatorRaw(), exp.getValuesRaw())); } } else { throw new IllegalStateException(); } } }
Source:
<code>public void validateUserGroupProperties() { if (this.sessionStateless) { if (allowedGroupsConfigured()) { LOGGER.warn("Group names are not supported if you set 'sessionSateless' to 'true'."); } } else if (!allowedGroupsConfigured()) { throw new IllegalArgumentException("One of the User Group Properties must be populated. " + "Please populate azure.activedirectory.user-group.allowed-groups"); } if (!DEFAULT_GROUP_RELATIONSHIP.equalsIgnoreCase(groupRelationship) <START> && !"transitive".equalsIgnoreCase(groupRelationship)) { <END> throw new IllegalArgumentException("Configuration 'azure.activedirectory.group-relationship' " + "should be 'direct' or 'transitive'."); } }</code><technical_language>string "transitive" replaced a final transitive here</technical_language>

Target:
public void validateUserGroupProperties() { if (this.sessionStateless) { if (allowedGroupsConfigured()) { LOGGER.warn("Group names are not supported if you set 'sessionSateless' to 'true'."); } } else if (!allowedGroupsConfigured()) { throw new IllegalArgumentException("One of the User Group Properties must be populated. " + "Please populate azure.activedirectory.user-group.allowed-groups"); } if (!GROUP_RELATIONSHIP_DIRECT.equalsIgnoreCase(userGroup.groupRelationship) && !GROUP_RELATIONSHIP_TRANSITIVE.equalsIgnoreCase(userGroup.groupRelationship)) { throw new IllegalArgumentException("Configuration 'azure.activedirectory.user-group.group-relationship' " + "should be 'direct' or 'transitive'."); } }
Source:
<code><START> + public String unknownBeatmap() { <END> + return "Συγνώμη, δεν γνωρίζω αυτό το τραγούδι. Ίσως είναι αρκετά νεο, πολυ δύσκολο, μη εγκεκριμένο ή να μην είναι για το osu standard mode." ; + }</code><technical_language>greek in Default.java</technical_language>

Target:
public String unknownBeatmap() { return "Συγνώμη, δεν γνωρίζω αυτό το τραγούδι. Ίσως είναι αρκετά νεο, πολυ δύσκολο, μη εγκεκριμένο ή να μην είναι για το osu standard mode." ; }
Source:
<code>public void addTab(BasePanel basePanel, boolean raisePanel) { DefaultTaskExecutor.runInJavaFXThread(() -> { Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); tabbedPane.getTabs().add(newTab); <START> newTab.setOnCloseRequest(event -> closeTab((BasePanel) newTab.getContent())); <END> updateAllTabTitles(); if (raisePanel) { tabbedPane.getSelectionModel().select(newTab); } basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); BibDatabaseContext context = basePanel.getBibDatabaseContext(); if (readyForAutosave(context)) { AutosaveManager autosaver = AutosaveManager.start(context); autosaver.registerListener(new AutosaveUIManager(basePanel)); } BackupManager.start(context); trackOpenNewDatabase(basePanel); }); }</code><technical_language>a good observation. of user close tab if unsaved changes. Thus, improve functionality a bit calling confirmClose consuming event in case user canceled close operation</technical_language>

Target:
public void addTab(BasePanel basePanel, boolean raisePanel) { DefaultTaskExecutor.runInJavaFXThread(() -> { Tab newTab = new Tab(basePanel.getTabTitle(), basePanel); tabbedPane.getTabs().add(newTab); newTab.setOnCloseRequest(event -> { closeTab((BasePanel) newTab.getContent()); event.consume(); }); updateAllTabTitles(); if (raisePanel) { tabbedPane.getSelectionModel().select(newTab); } basePanel.getUndoManager().registerListener(new UndoRedoEventManager()); BibDatabaseContext context = basePanel.getBibDatabaseContext(); if (readyForAutosave(context)) { AutosaveManager autosaver = AutosaveManager.start(context); autosaver.registerListener(new AutosaveUIManager(basePanel)); } BackupManager.start(context); trackOpenNewDatabase(basePanel); }); }
Source:
<code><START> public void register(final Class<?> clazz, final Object converter) { <END> otherWord = ""; }</code><technical_language>3 methods public do need them</technical_language>

Target:
private void register(final Class<?> clazz, final Object converter) { otherWord = ""; }
Source:
<code>public ParticleEffectBuilder count(int count) throws IllegalArgumentException { if (count < 1) { <START> throw new IllegalArgumentException("Count may not be less than 1."); <END> } else { this.count = count; } return this; }</code><technical_language>Guava's [checkArgument](<LINK_0>,%20java.lang.Object%29)</technical_language>

Target:
public ParticleEffectBuilder count(int count) throws IllegalArgumentException { Preconditions.checkArgument(count > 0); this.count = count; return this; }
Source:
<code>public BaseScreenlet getScreenlet(Context context, AssetEntry assetEntry, HashMap<String, Integer> layouts, boolean autoLoad) { String className = assetEntry.getClassName(); switch (className) { case "com.liferay.document.library.kernel.model.DLFileEntry": BaseFileDisplayScreenlet screenlet = getDLFileEntryScreenlet(context, assetEntry.getMimeType()); if (screenlet != null) { Integer layoutId = layouts.get(screenlet.getClass().getName()); screenlet.setFileEntry((FileEntry) assetEntry); screenlet.setAutoLoad(autoLoad); screenlet.render(layoutId); return screenlet; } case "com.liferay.blogs.kernel.model.BlogsEntry": BlogsEntryDisplayScreenlet blogsScreenlet = new BlogsEntryDisplayScreenlet(context); <START> Integer layoutId = layouts.get(blogsScreenlet.getClass().getName()); <END> blogsScreenlet.setBlogsEntry((BlogsEntry) assetEntry); blogsScreenlet.setAutoLoad(autoLoad); blogsScreenlet.render(layoutId); return blogsScreenlet; default: return null; } }</code><technical_language>uhm... typical of default layout</technical_language>

Target:
public BaseScreenlet getScreenlet(Context context, AssetEntry assetEntry, HashMap<String, Integer> layouts, boolean autoLoad) { String className = assetEntry.getClassName(); switch (className) { case "com.liferay.document.library.kernel.model.DLFileEntry": BaseFileDisplayScreenlet screenlet = getDLFileEntryScreenlet(context, assetEntry.getMimeType()); if (screenlet != null) { Integer layoutId = layouts.get(screenlet.getClass().getName()); screenlet.setFileEntry((FileEntry) assetEntry); screenlet.setAutoLoad(autoLoad); screenlet.render(layoutId); return screenlet; } return null; case "com.liferay.blogs.kernel.model.BlogsEntry": BlogsEntryDisplayScreenlet blogsScreenlet = new BlogsEntryDisplayScreenlet(context); Integer layoutId = layouts.get(blogsScreenlet.getClass().getName()); blogsScreenlet.setBlogsEntry((BlogsEntry) assetEntry); blogsScreenlet.setAutoLoad(autoLoad); blogsScreenlet.render(layoutId); return blogsScreenlet; default: return null; } }
Source:
<code>public Resolution findMethod(Env env, JavaType site, String name, List<JavaType> argTypes) { <START> return findMethod(env, site, site, name, argTypes, ImmutableList.<JavaType>of()); <END> }</code><technical_language>false parameter avoid initial call new method findMethod</technical_language>

Target:
public Resolution findMethod(Env env, JavaType site, String name, List<JavaType> argTypes) { return findMethod(env, site, site, name, argTypes, ImmutableList.<JavaType>of(), false); }
Source:
<code>public void testFollow() { TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace ust = traceManager.getActiveTrace(); assertNotNull(ust); ITmfTrace kernelTest = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTest.getPath(), TRACETYPE_ID); SWTBotEditor kernelEditor = SWTBotUtils.activateEditor(fBot, kernelTest.getName()); fBot.editorByTitle(kernelTest.getName()); ITmfTrace kernel = traceManager.getActiveTrace(); assertNotNull(kernel); SWTBotTable kernelEventTable = kernelEditor.bot().table(); SWTBotTableItem kernelEvent = kernelEventTable.getTableItem(5); <START> kernelEvent.contextMenu("Follow time updates from other traces").click(); <END> SWTBotUtils.activateEditor(fBot, ust.getName()); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust)); IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false); assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, ust, RANGE)); SWTBotUtils.activateEditor(fBot, kernel.getName()); fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, kernel, RANGE)); kernelTest.dispose(); }</code><technical_language>test trace follow, checking option unchecking (the is a idea, verify 'toggle' behavior of option)</technical_language>

Target:
public void testFollow() { TmfTraceManager traceManager = TmfTraceManager.getInstance(); ITmfTrace ust = traceManager.getActiveTrace(); assertNotNull(ust); ITmfTrace kernelTest = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.CONTEXT_SWITCHES_KERNEL); SWTBotUtils.openTrace(TRACE_PROJECT_NAME, kernelTest.getPath(), TRACETYPE_ID); SWTBotEditor kernelEditor = SWTBotUtils.activateEditor(fBot, kernelTest.getName()); fBot.editorByTitle(kernelTest.getName()); ITmfTrace kernel = traceManager.getActiveTrace(); assertNotNull(kernel); SWTBotTable kernelEventTable = kernelEditor.bot().table(); SWTBotTableItem kernelEvent = kernelEventTable.getTableItem(5); kernelEvent.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click(); SWTBotUtils.activateEditor(fBot, ust.getName()); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, RANGE, ust)); IWorkbenchPart part = fOriginalViewBot.getViewReference().getPart(false); assertTrue(part instanceof AbstractTimeGraphView); AbstractTimeGraphView abstractTimeGraphView = (AbstractTimeGraphView) part; fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, ust, RANGE)); SWTBotUtils.activateEditor(fBot, kernel.getName()); fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, kernel, RANGE)); kernelEvent.contextMenu(FOLLOW_TIME_UPDATES_FROM_OTHER_TRACES).click(); TmfSignalManager.dispatchSignal(new TmfWindowRangeUpdatedSignal(this, ust.getInitialTimeRange(), ust)); fBot.waitUntil(new PinAndCloneCondition(abstractTimeGraphView, kernel, RANGE)); kernelTest.dispose(); }
Source:
<code>public CentralRepoAccount getOrCreateAccount(CentralRepoAccountType crAccountType, String accountUniqueID) throws CentralRepoException { String query = "INSERT INTO accounts (account_type_id, account_unique_identifier) " + "VALUES ( " + crAccountType.getAccountTypeId() + ", '" <START> + accountUniqueID + "' ) ON CONFLICT DO NOTHING"; <END> try (Connection connection = connect(); Statement s = connection.createStatement();) { s.execute(query); return getAccount(crAccountType, accountUniqueID); } catch (SQLException ex) { throw new CentralRepoException("Error adding an account to CR database.", ex); } }</code><technical_language>syntax for CONFLICT DO is for SQLite Postgres. need able handle both. need method getPlatformSpecificInsertSQL(String sql)</technical_language>

Target:
public CentralRepoAccount getOrCreateAccount(CentralRepoAccountType crAccountType, String accountUniqueID) throws CentralRepoException { CentralRepoAccount account = getAccount(crAccountType, accountUniqueID); if (null == account) { String insertSQL = "INSERT INTO accounts (account_type_id, account_unique_identifier) " + "VALUES (?, ?) " + getConflictClause(); try (Connection connection = connect(); PreparedStatement preparedStatement = connection.prepareStatement(insertSQL);) { preparedStatement.setInt(1, crAccountType.getAccountTypeId()); preparedStatement.setString(2, accountUniqueID); preparedStatement.executeUpdate(); account = getAccount(crAccountType, accountUniqueID); } catch (SQLException ex) { throw new CentralRepoException("Error adding an account to CR database.", ex); } } return account; }
Source:
<code>public String toString() { return String.format("title = [ %s ], author = [ %s ], company = [ %s ]", title.toString(), author.toString(), <START> company.toString()); <END> }</code><technical_language>I need call .toString() objects passed String.format - method internally</technical_language>

Target:
public String toString() { return String.format("title = [ %s ], author = [ %s ], company = [ %s ]", title, author, company); }
Source:
<code>private void overrideParameters() { if (getParameters().getOperation() == ImageOperation.Copy) { getParameters().setUseCopyCollapse(true); getParameters().setAddImageDomainMapping(false); Guid newId = Guid.newGuid(); Guid newGroupId = Guid.newGuid(); DiskImage image = getImage(); <START> image.setId(newGroupId); <END> image.setImageId(newId); image.setDiskAlias(getDiskAlias()); image.setStorageIds(new ArrayList<Guid>()); image.getStorageIds().add(getParameters().getStorageDomainId()); image.setQuotaId(getParameters().getQuotaId()); image.setDiskProfileId(getParameters().getDiskProfileId()); getParameters().setDestinationImageId(newId); getParameters().setImageGroupID(getParameters().getImageGroupID()); getParameters().setDestImageGroupId(newGroupId); } else { getParameters().setUseCopyCollapse(false); getParameters().setDestinationImageId(getImageId()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setDestImageGroupId(getImageGroupId()); } getParameters().setVolumeFormat(getDiskImage().getVolumeFormat()); getParameters().setVolumeType(getDiskImage().getVolumeType()); getParameters().setCopyVolumeType(CopyVolumeType.SharedVol); getParameters().setParentCommand(getActionType()); getParameters().setParentParameters(getParameters()); getParameters().setDiskProfileId(getImage().getDiskProfileId()); }</code><technical_language>done copying a vm disk previous behavior for template disks</technical_language>

Target:
private void overrideParameters() { boolean isTemplate = isTemplate(); if (getParameters().getOperation() == ImageOperation.Copy) { getParameters().setUseCopyCollapse(true); getParameters().setAddImageDomainMapping(true); if (!isTemplate) { getParameters().setAddImageDomainMapping(false); Guid newId = Guid.newGuid(); Guid newGroupId = Guid.newGuid(); DiskImage image = getImage(); image.setId(newGroupId); image.setImageId(newId); image.setDiskAlias(getDiskAlias()); image.setStorageIds(new ArrayList<Guid>()); image.getStorageIds().add(getParameters().getStorageDomainId()); image.setQuotaId(getParameters().getQuotaId()); image.setDiskProfileId(getParameters().getDiskProfileId()); getParameters().setDestinationImageId(newId); getParameters().setImageGroupID(getParameters().getImageGroupID()); getParameters().setDestImageGroupId(newGroupId); } } else { getParameters().setUseCopyCollapse(false); } if (getParameters().getOperation() == ImageOperation.Move || isTemplate) { getParameters().setDestinationImageId(getImageId()); getParameters().setImageGroupID(getImageGroupId()); getParameters().setDestImageGroupId(getImageGroupId()); } getParameters().setVolumeFormat(getDiskImage().getVolumeFormat()); getParameters().setVolumeType(getDiskImage().getVolumeType()); getParameters().setCopyVolumeType(CopyVolumeType.SharedVol); getParameters().setParentCommand(getActionType()); getParameters().setParentParameters(getParameters()); getParameters().setDiskProfileId(getImage().getDiskProfileId()); }
Source:
<code>public GraphTraversal<Vertex, Vertex> findById(UUID timId) { IndexHits<Node> hits = getExactIndex(ID_INDEX).query(TIM_ID, timId.toString()); <START> List<Long> ids = StreamSupport.stream(hits.spliterator(), false).map(h -> h.getId()).collect(toList()); <END> return ids.isEmpty() ? EmptyGraphTraversal.instance() : traversal().V(ids); }</code><technical_language>hmm, this 1 vertex? quicksearch Id functions signature return Optional<vertex> instead of a GraphTraversal</technical_language>

Target:
public Optional<Vertex> findById(UUID timId) { IndexHits<Node> hits = getIdIndex(ID_INDEX).query(TIM_ID, timId.toString()); List<Long> ids = StreamIterator.stream(hits.iterator()).map(h -> h.getId()).collect(toList()); GraphTraversal<Vertex, Vertex> vertexT = traversal().V(ids); return !ids.isEmpty() && vertexT.hasNext() ? Optional.of(vertexT.next()) : Optional.empty(); }
Source:
<code>public Response queryCaseUserTasksByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseUserTaskWithVariablesList taskVariableSummaryList = caseManagementRuntimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext((page * pageSize), pageSize)); <START> logger.debug("Returning result of process instance search: {}", taskVariableSummaryList); <END> return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }</code><technical_language>Log message "case tasks search" instead of "process search"</technical_language>

Target:
public Response queryCaseUserTasksByVariables(@Context HttpHeaders headers, String payload, @ApiParam(value = "optional pagination - at which page to start, defaults to 0 (meaning first)", required = false) @QueryParam("page") @DefaultValue("0") Integer page, @ApiParam(value = "optional pagination - size of the result, defaults to 10", required = false) @QueryParam("pageSize") @DefaultValue("10") Integer pageSize) { Header conversationIdHeader = buildConversationIdHeader("", context, headers); Variant v = getVariant(headers); try { String type = getContentType(headers); CaseUserTaskWithVariablesList taskVariableSummaryList = caseManagementRuntimeDataServiceBase.queryUserTasksByVariables(payload, type, new QueryContext((page * pageSize), pageSize)); logger.debug("Returning result of case instance user task search: {}", taskVariableSummaryList); return createCorrectVariant(taskVariableSummaryList, headers, Response.Status.OK, conversationIdHeader); } catch (Exception e) { logger.error("Unexpected error during processing {}", e.getMessage(), e); return internalServerError(errorMessage(e), v, conversationIdHeader); } }
Source:
<code>protected boolean validateLeaseStorageDomain(Guid leaseStorageDomainId) { StorageDomain domain = storageDomainDao.get(leaseStorageDomainId); StorageDomainValidator validator = new StorageDomainValidator(domain); if (!validate(validator.isDomainExistAndActive())) { return false; } <START> if (!getStoragePoolId().equals(domain.getStoragePoolId())) { <END> return failValidation(EngineMessage.ACTION_TYPE_FAILED_LEASE_STORAGE_IS_NOT_A_PART_OF_POOL); } return true; }</code><technical_language>validating domain is a data domain</technical_language>

Target:
protected boolean validateLeaseStorageDomain(Guid leaseStorageDomainId) { StorageDomain domain = storageDomainDao.get(leaseStorageDomainId); StorageDomainValidator validator = new StorageDomainValidator(domain); if (!validate(validator.isDomainExistAndActive()) || validate(validator.isDataDomain())) { return false; } if (!getStoragePoolId().equals(domain.getStoragePoolId())) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_LEASE_STORAGE_IS_NOT_A_PART_OF_POOL); } return true; }
Source:
<code>public static boolean isRedirectURIValid(String redirectURI) { if (!redirectURI.startsWith("http")) { return true; } <START> if (redirectURI.startsWith("https") || redirectURI.startsWith("http://localhost")) { <END> return true; } return false; }</code><technical_language>Yes, a regex</technical_language>

Target:
public static boolean isRedirectURIValid(String redirectURI) { if (redirectURI.startsWith("https") || !redirectURI.startsWith("http")) { return true; } return LOCALHOST_PATTERN.matcher(redirectURI).matches(); }