auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } ExileZone exileZone = game.getExile().getExileZone(exileZoneId); Card enchantedCard = exileZone.get(enchantedCardId, game); Player owner = game.getPlayer(enchantedCard.getOwnerId()); <START> if (enchantedCard != null) { <END> owner.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game); Permanent newPermanent = game.getPermanent(enchantedCardId); if (newPermanent != null) { Set<Card> toBattlefieldAttached = new HashSet<Card>(); for (Card enchantment : exileZone.getCards(game)) { if (filterAura.match(enchantment, game)) { boolean canTarget = false; for (Target target : enchantment.getSpellAbility().getTargets()) { Filter filter = target.getFilter(); if (filter.match(newPermanent, game)) { canTarget = true; break; } } if (!canTarget) { continue; } game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent); } toBattlefieldAttached.add(enchantment); } if (!toBattlefieldAttached.isEmpty()) { controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game); for (Card card : toBattlefieldAttached) { if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) { newPermanent.addAttachment(card.getId(), game); } } } } return true; } return false; }</code><technical_language>check owner null</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller == null) { return false; } ExileZone exileZone = game.getExile().getExileZone(exileZoneId); Card enchantedCard = exileZone.get(enchantedCardId, game); if (enchantedCard != null) { Player owner = game.getPlayer(enchantedCard.getOwnerId()); if (owner != null) { owner.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game); Permanent newPermanent = game.getPermanent(enchantedCardId); if (newPermanent != null) { Set<Card> toBattlefieldAttached = new HashSet<Card>(); for (Card enchantment : exileZone.getCards(game)) { if (filterAura.match(enchantment, game)) { boolean canTarget = false; for (Target target : enchantment.getSpellAbility().getTargets()) { Filter filter = target.getFilter(); if (filter.match(newPermanent, game)) { canTarget = true; break; } } if (!canTarget) { continue; } game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent); } toBattlefieldAttached.add(enchantment); } if (!toBattlefieldAttached.isEmpty()) { controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game); for (Card card : toBattlefieldAttached) { if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) { newPermanent.addAttachment(card.getId(), game); } } } } return true; } } return false; }
Source:
<code>private void processHelloRequest(final HelloRequest helloRequest, final Connection connection) throws HandshakeException { if (connection.hasOngoingHandshake()) { LOGGER.debug("Ignoring received from while already in an ongoing handshake with peer", <START> new Object[] { helloRequest.getMessageType(), helloRequest.getPeer() }); <END> } else { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, helloRequest.getPeer()), session); } }</code><technical_language>a good time remove new Object[] { ... }</technical_language>

Target:
private void processHelloRequest(final HelloRequest helloRequest, final Connection connection) throws HandshakeException { if (connection.hasOngoingHandshake()) { LOGGER.debug("Ignoring received from while already in an ongoing handshake with peer", helloRequest.getMessageType(), helloRequest.getPeer()); } else { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, helloRequest.getPeer()), session); } }
Source:
<code>public synchronized boolean deleteShardingKey(String realm, String shardingKey) { if (_leaderElection.isLeader()) { if (_zkClient.isClosed()) { throw new IllegalStateException("ZkClient is closed!"); } return deleteZkShardingKey(realm, shardingKey); } String urlSuffix = constructUrlSuffix(MetadataStoreRoutingConstants.MSDS_GET_ALL_REALMS_ENDPOINT, realm, MetadataStoreRoutingConstants.MSDS_GET_ALL_SHARDING_KEYS_ENDPOINT, shardingKey); return forwardRequestToLeader(urlSuffix, <START> MetadataStoreRoutingConstants.HttpRequestForwardingVerbs.DELETE, "deleteShardingKey", <END> Response.Status.OK.getStatusCode()); }</code><technical_language>I a string literal here</technical_language>

Target:
public synchronized boolean deleteShardingKey(String realm, String shardingKey) { if (_leaderElection.isLeader()) { if (_zkClient.isClosed()) { throw new IllegalStateException("ZkClient is closed!"); } return deleteZkShardingKey(realm, shardingKey); } String urlSuffix = constructUrlSuffix(MetadataStoreRoutingConstants.MSDS_GET_ALL_REALMS_ENDPOINT, realm, MetadataStoreRoutingConstants.MSDS_GET_ALL_SHARDING_KEYS_ENDPOINT, shardingKey); return forwardRequestToLeader(urlSuffix, HttpConstants.RestVerbs.DELETE, Response.Status.OK.getStatusCode()); }
Source:
<code><START> @Override <END> public ArrayList<VdcReturnValueBase> execute() { if (parameters == null || parameters.isEmpty()) { log.info("{} of type '{}' invoked with no actions", this.getClass().getSimpleName(), actionType); return new ArrayList<>(); } ArrayList<VdcReturnValueBase> returnValues = new ArrayList<>(); try { initCommandsAndReturnValues(returnValues); invokeCommands(returnValues); } catch (RuntimeException e) { log.error("Failed to execute multiple actions of type '{}': {}", actionType, e.getMessage()); log.error("Exception", e); } return returnValues; }</code><technical_language>convention in project is annotations method definition: @Override public ArrayList<VdcReturnValueBase> execute() { ... }</technical_language>

Target:
public ArrayList<VdcReturnValueBase> execute() { if (parameters == null || parameters.isEmpty()) { log.info("{} of type '{}' invoked with no actions", this.getClass().getSimpleName(), actionType); return new ArrayList<>(); } ArrayList<VdcReturnValueBase> returnValues = new ArrayList<>(); try { initCommandsAndReturnValues(returnValues); invokeCommands(returnValues); } catch (RuntimeException e) { log.error("Failed to execute multiple actions of type '{}': {}", actionType, e.getMessage()); log.error("Exception", e); } return returnValues; }
Source:
<code>public BlockShapeData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { BlockShapeData shape = new BlockShapeData(); JsonObject shapeObj = json.getAsJsonObject(); if (shapeObj.has(DISPLAY_NAME)) { shape.setDisplayName(shapeObj.getAsJsonPrimitive(DISPLAY_NAME).getAsString()); } for (BlockPart part : BlockPart.values()) { if (shapeObj.has(part.toString().toLowerCase(Locale.ENGLISH))) { JsonObject meshObj = shapeObj.getAsJsonObject(part.toString().toLowerCase(Locale.ENGLISH)); shape.setMeshPart(part, (BlockMeshPart) context.deserialize(meshObj, BlockMeshPart.class)); if (part.isSide() && meshObj.has(FULL_SIDE)) { shape.setBlockingSide(part.getSide(), meshObj.get(FULL_SIDE).getAsBoolean()); } } } if (shapeObj.has(COLLISION) && shapeObj.get(COLLISION).isJsonObject()) { JsonObject collisionInfo = shapeObj.get(COLLISION).getAsJsonObject(); processCollision(context, shape, collisionInfo); } else { <START> shape.setCollisionShape(PhysicsEngineManager.COLLISION_SHAPE_FACTORY.unitCube()); <END> shape.setCollisionSymmetric(true); } return shape; }</code><technical_language>PhysicEngineManager qualifier removed</technical_language>

Target:
public BlockShapeData deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { BlockShapeData shape = new BlockShapeData(); JsonObject shapeObj = json.getAsJsonObject(); if (shapeObj.has(DISPLAY_NAME)) { shape.setDisplayName(shapeObj.getAsJsonPrimitive(DISPLAY_NAME).getAsString()); } for (BlockPart part : BlockPart.values()) { if (shapeObj.has(part.toString().toLowerCase(Locale.ENGLISH))) { JsonObject meshObj = shapeObj.getAsJsonObject(part.toString().toLowerCase(Locale.ENGLISH)); shape.setMeshPart(part, (BlockMeshPart) context.deserialize(meshObj, BlockMeshPart.class)); if (part.isSide() && meshObj.has(FULL_SIDE)) { shape.setBlockingSide(part.getSide(), meshObj.get(FULL_SIDE).getAsBoolean()); } } } if (shapeObj.has(COLLISION) && shapeObj.get(COLLISION).isJsonObject()) { JsonObject collisionInfo = shapeObj.get(COLLISION).getAsJsonObject(); processCollision(context, shape, collisionInfo); } else { shape.setCollisionShape(COLLISION_SHAPE_FACTORY.getNewUnitCube()); shape.setCollisionSymmetric(true); } return shape; }
Source:
<code>public void postHandle( ServletRequest request, ServletResponse response ) throws Exception { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { try { getSubject( request, response ).logout(); } catch ( SessionException e ) { getLogger().trace( "Failed to find session for anonymous user.", e ); } if ( HttpServletRequest.class.isAssignableFrom( request.getClass() ) ) { HttpSession session = ( (HttpServletRequest) request ).getSession( false ); if ( session != null ) { session.invalidate(); } } } if ( request.getAttribute( NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED ) != null ) { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { sendChallenge( request, response ); } else { if ( getLogger().isDebugEnabled() ) { final Subject subject = getSubject( request, response ); String username; if ( subject != null && subject.isAuthenticated() ) { <START> username = subject.getPrincipal().toString(); <END> } else { username = getNexusConfiguration().getAnonymousUsername(); } getLogger().debug( "Request processing is rejected because user \"" + username + "\" lacks permissions." ); } sendForbidden( request, response ); } } }</code><technical_language>protect NPE principal while it. isAuthenticated protect it, is guarantee I</technical_language>

Target:
public void postHandle( ServletRequest request, ServletResponse response ) throws Exception { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { try { getSubject( request, response ).logout(); } catch ( SessionException e ) { getLogger().trace( "Failed to find session for anonymous user.", e ); } if ( HttpServletRequest.class.isAssignableFrom( request.getClass() ) ) { HttpSession session = ( (HttpServletRequest) request ).getSession( false ); if ( session != null ) { session.invalidate(); } } } if ( request.getAttribute( NexusJSecurityFilter.REQUEST_IS_AUTHZ_REJECTED ) != null ) { if ( request.getAttribute( ANONYMOUS_LOGIN ) != null ) { sendChallenge( request, response ); } else { if ( getLogger().isDebugEnabled() ) { final Subject subject = getSubject( request, response ); String username; if ( subject != null && subject.isAuthenticated() && subject.getPrincipal() != null ) { username = subject.getPrincipal().toString(); } else { username = getNexusConfiguration().getAnonymousUsername(); } getLogger().debug( "Request processing is rejected because user \"" + username + "\" lacks permissions." ); } sendForbidden( request, response ); } } }
Source:
<code>private JSONObject getEntitiesStatus(List<String> entities, EntityType type) throws JSONException, FalconException { JSONObject entityObject = new JSONObject(); for (String entity : entities) { try { EntityUtil.getEntity(type, entity); } catch (EntityNotRegisteredException e) { <START> entityObject.put(entity, ENTITY_NOT_EXISTS_STATUS); <END> } entityObject.put(entity, ENTITY_EXISTS_STATUS); } return entityObject; }</code><technical_language>JSON standards, keys constant strings. This { "name" : "abc, "status" : "EXISTS"} This easy consume programmatically also</technical_language>

Target:
private JSONObject getEntitiesStatus(List<String> entities, EntityType type) throws JSONException, FalconException { JSONObject entityObject = new JSONObject(); for (String entity : entities) { try { entityObject.put(NAME, entity); EntityUtil.getEntity(type, entity); entityObject.put(STATUS, ENTITY_EXISTS_STATUS); } catch (EntityNotRegisteredException e) { entityObject.put(STATUS, ENTITY_NOT_EXISTS_STATUS); } } return entityObject; }
Source:
<code><START> private void installScript(ScriptDTO script) { <END> final StringBuilder executeBuilder = new StringBuilder(); executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId())); executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId())); executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId())); executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId())); executeBuilder.append(script.getScript()); executeBuilder.append("\n"); executeBuilder.append("new Installer().run();"); getControl().getScriptInterpreter().runScript(executeBuilder.toString(), e -> Platform.runLater(() -> { if (!(e.getCause() instanceof InterruptedException)) { new ErrorMessage(tr("The script ended unexpectedly"), e); } })); }</code><technical_language>In opinion, new MVC widgets widgets I application logic (like installScript) belongs here. In general, a bit careful do 2 MVC in parallel (one new widgets other existing views/controllers). For lists, implementation sense is application (like other JavaFX control). current details panel MVC, I feeling application logic inside. if I express correctly. sense you</technical_language>

Target:
private void installScript(ScriptDTO script) { final StringBuilder executeBuilder = new StringBuilder(); executeBuilder.append(String.format("TYPE_ID=\"%s\";\n", script.getTypeId())); executeBuilder.append(String.format("CATEGORY_ID=\"%s\";\n", script.getCategoryId())); executeBuilder.append(String.format("APPLICATION_ID=\"%s\";\n", script.getApplicationId())); executeBuilder.append(String.format("SCRIPT_ID=\"%s\";\n", script.getId())); executeBuilder.append(script.getScript()); executeBuilder.append("\n"); executeBuilder.append("new Installer().run();"); getControl().getScriptInterpreter().runScript(executeBuilder.toString(), e -> Platform.runLater(() -> { if (!(e.getCause() instanceof InterruptedException)) { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("The script ended unexpectedly")) .withException(e) .build(); errorDialog.showAndWait(); } })); }
Source:
<code>public void addToMetricsFile(final MetricsFile<WgsMetrics, Integer> file, final boolean includeBQHistogram, final CountingFilter dupeFilter, final CountingFilter mapqFilter, final CountingPairedFilter pairFilter) { final WgsMetrics metrics = getMetrics(dupeFilter, mapqFilter, pairFilter); file.addMetric(metrics); file.addHistogram(getHighQualityDepthHistogram()); if (includeBQHistogram) { <START> addBaseQHistogram(file); <END> } }</code><technical_language>write unfiltered depth histogram in this case</technical_language>

Target:
public void addToMetricsFile(final MetricsFile<WgsMetrics, Integer> file, final boolean includeBQHistogram, final CountingFilter dupeFilter, final CountingFilter mapqFilter, final CountingPairedFilter pairFilter) { final WgsMetrics metrics = getMetrics(dupeFilter, mapqFilter, pairFilter); file.addMetric(metrics); file.addHistogram(getHighQualityDepthHistogram()); if (includeBQHistogram) addBaseQHistogram(file); }
Source:
<code>@Override boolean isAdmin(User user) { if (user == null) { return false; } if( inner != null && inner.isAdmin(user)) { return true; <START> } else if (outer != null && outer.isAdmin(user)) { <END> return true; } return false; }</code><technical_language>need for "else if" returning "if" above</technical_language>

Target:
@Override boolean isAdmin(User user) { if (user == null) { return false; } return (inner != null && inner.isAdmin(user)) || (outer != null && outer.isAdmin(user)); }
Source:
<code>public synchronized int read() throws IOException { <START> throw new IOException("read without parameter not supported"); <END> }</code><technical_language>This supported</technical_language>

Target:
public synchronized int read() { int bytes = read(singleByte); if (bytes == -1) { return -1; } return singleByte[0] & 0xFF; }
Source:
<code>private void setBulkOptions(BulkRequestBuilder bulkRequest, BulkOptions bulkOptions) { <START> if (bulkOptions != null) { <END> if (bulkOptions.getTimeout() != null) { bulkRequest.setTimeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.setWaitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } } }</code><technical_language>Thank ;)</technical_language>

Target:
private void setBulkOptions(BulkRequestBuilder bulkRequest, BulkOptions bulkOptions) { if (bulkOptions.getTimeout() != null) { bulkRequest.setTimeout(bulkOptions.getTimeout()); } if (bulkOptions.getRefreshPolicy() != null) { bulkRequest.setRefreshPolicy(bulkOptions.getRefreshPolicy()); } if (bulkOptions.getWaitForActiveShards() != null) { bulkRequest.setWaitForActiveShards(bulkOptions.getWaitForActiveShards()); } if (bulkOptions.getPipeline() != null) { bulkRequest.pipeline(bulkOptions.getPipeline()); } if (bulkOptions.getRoutingId() != null) { bulkRequest.routing(bulkOptions.getRoutingId()); } }
Source:
<code>public MappedRoleMapper() { this.reverseRoleMap = new LinkedHashMap<>(); <START> this.removeMapped = true; END> this.removeNonMapped = true; this.keyRoles = Roles.NONE; }</code><technical_language>This fields this is custom-role-mapper specific - related mapped-role-mapper in subsystem</technical_language>

Target:
public MappedRoleMapper()
Source:
<code>public void copyToBuffer(final Buffer destinationBuffer) throws IOException { if (this.writeMode.get()) { throw new IllegalStateException("Cannot copy buffer that is still in write mode"); } if (size() > destinationBuffer.size()) { throw new IllegalArgumentException("Destination buffer is too small to store content of source buffer: " + size() + " vs. " + destinationBuffer.size()); } final MemoryBuffer target = (MemoryBuffer) destinationBuffer; <START> System.arraycopy(this.getMemorySegment().getBackingArray(), 0, <END> target.getMemorySegment().getBackingArray(),target.position(), limit()- position() ); target.position(limit()-position()); destinationBuffer.finishWritePhase(); }</code><technical_language>Move this a method in memory segment. getBackingArray() method is deprecated disappear</technical_language>

Target:
public void copyToBuffer(final Buffer destinationBuffer) throws IOException { if (size() > destinationBuffer.size()) { throw new IllegalArgumentException("Destination buffer is too small to store content of source buffer: " + size() + " vs. " + destinationBuffer.size()); } final MemoryBuffer target = (MemoryBuffer) destinationBuffer; this.internalMemorySegment.copyTo(this.position(), target.getMemorySegment(), destinationBuffer.position(), limit()-position()); target.position(limit()-position()); destinationBuffer.flip(); }
Source:
<code>public void beforeClass() throws IOException { config = new IntegrationTestConfigContext(); mantaClient = new MantaClient(config); <START> testPathPrefix = IntegrationTestConfigContext.generateBasePath(config, this.getClass().getSimpleName()); <END> testPathPrefix = testPathPrefix.substring(0, testPathPrefix.lastIndexOf(SEPARATOR)); }</code><technical_language>modify IntegrationTestConfigContext.generateBasePath method stripping character? Alternatively, another method called IntegrationTestConfigContext.generateBasePathWithoutSeparator (or some name) omits seperator</technical_language>

Target:
public void beforeClass() throws IOException { config = new IntegrationTestConfigContext(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestConfigContext.generateBasePathWithoutSeparator(config, this.getClass().getSimpleName()); }
Source:
<code>protected void executeCommand() { List<VmDevice> watchdogs = getWatchdogs(); VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); <START> setActionReturnValue(watchdogDevice); <END> setSucceeded(true); }</code><technical_language>setSucceeded(true) is enough in update command</technical_language>

Target:
protected void executeCommand() { List<VmDevice> watchdogs = getWatchdogs(); VmDevice watchdogDevice = watchdogs.get(0); watchdogDevice.setSpecParams(getSpecParams()); getVmDeviceDao().update(watchdogDevice); setSucceeded(true); }
Source:
<code><START> public Storage setDefaultStorage(final String defaultStorageId) { <END> final Storage storage = getStorage(defaultStorageId); try { curator.setData().forPath(ZK_TIMELINES_DEFAULT_STORAGE, defaultStorageId.getBytes(Charsets.UTF_8)); } catch (final Exception e) { LOG.error("Error while setting default storage in zk ", e.getMessage(), e); throw new InternalNakadiException("Error while setting default storage in zk"); } return storage; }</code><technical_language>declare throws please</technical_language>

Target:
public Storage setDefaultStorage(final String defaultStorageId) throws NoSuchStorageException, InternalNakadiException { final Storage storage = getStorage(defaultStorageId); try { curator.setData().forPath(ZK_TIMELINES_DEFAULT_STORAGE, defaultStorageId.getBytes(Charsets.UTF_8)); } catch (final Exception e) { LOG.error("Error while setting default storage in zk ", e.getMessage(), e); throw new InternalNakadiException("Error while setting default storage in zk"); } return storage; }
Source:
<code>public static void selectFolder(SWTBot bot, boolean check, String... treePath) { SWTBotTree tree = bot.tree(); bot.waitUntil(Conditions.widgetIsEnabled(tree)); SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, treePath); if (check) { <START> folderNode.check(); <END> } else { folderNode.select(); } }</code><technical_language>This checks element select (so file table show folder's files). UI, I if this fixed in SWTBotTreeItem.setChecked()</technical_language>

Target:
public static void selectFolder(SWTBot bot, boolean check, String... treePath) { SWTBotTree tree = bot.tree(); bot.waitUntil(Conditions.widgetIsEnabled(tree)); SWTBotTreeItem folderNode = SWTBotUtils.getTreeItem(bot, tree, treePath); folderNode.select(); if (check) { folderNode.check(); } }
Source:
<code>public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); healthCheck.cancel(true); if(forceShutdown){ <START> driver.sendStatusUpdate(TaskStatus.newBuilder() <END> .setTaskId(currentTaskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } if (task.process != null) { LOGGER.debug("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.error("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.error("No running task found. Stopping executor."); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_LOST) .build()); driver.stop(); } }</code><technical_language>kill subprocess (task.process.destroy()) shutting driver</technical_language>

Target:
public void killTask(ExecutorDriver driver, TaskID taskId) { LOGGER.info("Killing task : " + taskId.getValue()); healthCheck.cancel(true); if(forceShutdown){ forceShutdown(driver); return; } if (task.process != null) { LOGGER.debug("Found task to kill: " + taskId.getValue()); int pid = task.pid(); if (pid == -1) { LOGGER.error("Graceful shutdown failed. Could not read crate.pid."); task.process.destroy(); task.process = null; return; } boolean success = task.gracefulStop(); if (success) { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_KILLED) .build()); driver.stop(); } else { driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_RUNNING) .build()); } } else { LOGGER.error("No running task found. Stopping executor."); driver.sendStatusUpdate(TaskStatus.newBuilder() .setTaskId(taskId) .setState(TaskState.TASK_LOST) .build()); driver.stop(); } }
Source:
<code>public ClassLoader connectorLoader(String connectorClassOrAlias) { log.debug("Getting plugin class loader for connector: '{}'", connectorClassOrAlias); <START> String fullName = aliases.getOrDefault(connectorClassOrAlias, connectorClassOrAlias); <END> PluginClassLoader classLoader = pluginClassLoader(fullName); if (classLoader == null) { log.error( "Plugin class loader for connector: '{}' was not found. Returning: {}", connectorClassOrAlias, this ); return this; } return classLoader; }</code><technical_language>If targeting version AK 1.0 (which I correctly do), refrain java 8 features. Java 8 support added AK 1.0, this method in original code. More generally, recommend avoiding refactorings this in critical PRs this one. payoff is small risk high (here break compilation follow a fix right this PR is merged 0.11.0.4). expands scope of PR review harder. So, if need move consolidated in helper methods is fine, careful new ways do code doing</technical_language>

Target:
public ClassLoader connectorLoader(String connectorClassOrAlias) { log.debug("Getting plugin class loader for connector: '{}'", connectorClassOrAlias); String fullName = aliases.containsKey(connectorClassOrAlias) ? aliases.get(connectorClassOrAlias) : connectorClassOrAlias; PluginClassLoader classLoader = pluginClassLoader(fullName); if (classLoader == null) { log.error( "Plugin class loader for connector: '{}' was not found. Returning: {}", connectorClassOrAlias, this ); return this; } return classLoader; }
Source:
<code>public void setMaxSpeed(double maxSpeed) { <START> if (this.maxSpeed == null || maxSpeed > this.maxSpeed) { <END> this.maxSpeed = maxSpeed; } }</code><technical_language>I &&</technical_language>

Target:
public void setMaxSpeed(double maxSpeed) { if (maxSpeed > this.maxSpeed) { this.maxSpeed = maxSpeed; } }
Source:
<code>public void color(String color) { <START> if (!colorPattern.matcher(color).matches()) { <END> throw new IllegalArgumentException( "Color '" + color + "' doesn't match acceptable color pattern."); } this.color = color; }</code><technical_language>is worth enforcing this locally? allow more colors in future</technical_language>

Target:
public void color(String color) { this.color = color; }
Source:
<code>public MemcachedClient create() { if (useSharedClient && clients.size() == 1) { logger.info("Using a shared client"); return clients.get(0); } logger.info("Creating a new client"); MemcachedClient client = null; <START> try { <END> client = new MemcachedClient(this.addresses); } catch (IOException ex) { throw new IllegalStateException("Error starting Memcached client.", ex); } clients.add(client); return client; }</code><technical_language>this lead more 1 client created create is called concurrently. simple method synchronized</technical_language>

Target:
public synchronized MemcachedClient create() { if (useSharedClient && clients.size() == 1) { logger.info("Using a shared client"); return clients.get(0); } logger.info("Creating a new client"); MemcachedClient client = null; try { client = new MemcachedClient(this.addresses); } catch (IOException ex) { throw new IllegalStateException("Error starting Memcached client.", ex); } clients.add(client); return client; }
Source:
<code>private void checkListType(EStructuralFeature structuralFeature) throws IllegalListTypeException { <START> if (structuralFeature.getLowerBound() != 0 || structuralFeature.getUpperBound() != -1) { <END> throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list."); } if (!EReference.class.isInstance(structuralFeature)) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list of EObjects."); } }</code><technical_language>this check is wrong need check for isMany. bounds for validation purposes, define a list, 2 entries lowerbound=2 && upperbound=2 . This generate a list feature validations for a list 2 elements</technical_language>

Target:
private void checkListType(EStructuralFeature structuralFeature) throws IllegalListTypeException { if (!structuralFeature.isMany()) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list."); } if (!EReference.class.isInstance(structuralFeature)) { throw new IllegalListTypeException( "The VIndexDomainModelReference's domainModelEFeature must reference a list of EObjects."); } }
Source:
<code>public void setConf(final MongoDBRdfConfiguration conf) { this.conf = conf; <START> auths = conf.getAuthorizations(); <END> }</code><technical_language>this go</technical_language>

Target:
public void setConf(final MongoDBRdfConfiguration conf) { this.conf = conf; this.auths = conf.getAuthorizations(); }
Source:
<code>public RowMapper<Map<String, Object>> specialize(ResultSet rs, StatementContext ctx) throws SQLException { ResultSetMetaData m = rs.getMetaData(); int columnCount = m.getColumnCount(); String[] columnNames = new String[columnCount+1]; for (int i = 1; i <= columnCount; i++) { <START> String key = m.getColumnName(i); <END> String alias = m.getColumnLabel(i); if (alias == null) { alias = key; } if (foldCase) { alias = alias.toLowerCase(Locale.ROOT); } columnNames[i] = alias; } return (r, c) -> { Map<String, Object> row = new HashMap<>(); for (int i = 1; i <= columnCount; i++) { row.put(columnNames[i], rs.getObject(i)); } return row; }; }</code><technical_language>If SQLException unchecked, great</technical_language>

Target:
public RowMapper<Map<String, Object>> specialize(ResultSet rs, StatementContext ctx) throws SQLException { ResultSetMetaData m = rs.getMetaData(); int columnCount = m.getColumnCount(); String[] columnNames = new String[columnCount+1]; for (int i = 1; i <= columnCount; i++) { String key = m.getColumnName(i); String alias = m.getColumnLabel(i); if (alias == null) { alias = key; } if (foldCase) { alias = alias.toLowerCase(Locale.ROOT); } columnNames[i] = alias; } return (r, c) -> { Map<String, Object> row = new HashMap<>(columnCount); for (int i = 1; i <= columnCount; i++) { row.put(columnNames[i], rs.getObject(i)); } return row; }; }
Source:
<code>private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue) { ObjectContainer<String> objectToSend; try { while((objectToSend = recordQueue.take()) != null) { final ObjectContainer<String> finalObjectToSend = objectToSend; producer.send(new ProducerRecord<String, String>(topic, finalObjectToSend.getData()), new Callback() { @Override public void onCompletion(RecordMetadata recordMetadata, Exception e) { if(e != null) { log.warn(e, "Exception occured!"); if(topic.equals(config.getMetricTopic())) { <START> if(!metricQueue.offer(finalObjectToSend)) { <END> log.warn("metricQueue is now memory bounded! metricLost: " + metricLost.incrementAndGet()); } } else if(topic.equals(config.getAlertTopic())) { if(!alertQueue.offer(finalObjectToSend)) { log.warn("alertQueue is now memory bounded! alertLost: " + alertLost.incrementAndGet()); } } else { log.warn("Invalid topic name! invalidLost: " + invalidLost.incrementAndGet()); } } } }); } } catch (InterruptedException e) { log.warn(e, "Failed to take record from queue!"); } }</code><technical_language>offering message, I dropped if exception sending it. Remember kafka producer inherently retry mechanism</technical_language>

Target:
private void sendToKafka(final String topic, MemoryBoundLinkedBlockingQueue<String> recordQueue) { ObjectContainer<String> objectToSend; try { while (true) { objectToSend = recordQueue.take(); producer.send(new ProducerRecord<>(topic, objectToSend.getData()), producerCallback); } } catch (InterruptedException e) { log.warn(e, "Failed to take record from queue!"); } }
Source:
<code>public List<Map<String, String>> getModifiedData() { if (0 < modifiedData.size()) { XStream _xstream = new XStream(new DomDriver()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss"); String lastmoddate = sdf.format(date); java.io.File _writing = null; if (!new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) { new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes"); if (!_writing.exists()) { _writing.mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_" + "FixTask00012UpdateAssetsHosts" + ".xml"); BufferedOutputStream _bout = null; try { _bout = new BufferedOutputStream(Files.newOutputStream(_writing.toPath())); <START> } catch (IOException e) { <END> } try { _xstream.toXML(modifiedData, _bout); } finally { CloseUtils.closeQuietly(_bout); } } return modifiedData; }</code><technical_language>unclosed _bout OutputStream. "_xstream.toXML(modifiedData, _bout);" moved try-catch try-with-resources. code: try(BufferedOutputStream _bout = new BufferedOutputStream(new FileOutputStream(_writing))) { _xstream.toXML(modifiedData, _bout); } catch (IOException e) { // Logger }</technical_language>

Target:
public List<Map<String, String>> getModifiedData() { if (0 < modifiedData.size()) { XStream _xstream = new XStream(new DomDriver()); Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy_HH-mm-ss"); String lastmoddate = sdf.format(date); java.io.File _writing = null; if (!new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").exists()) { new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes").mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes"); if (!_writing.exists()) { _writing.mkdirs(); } _writing = new java.io.File(ConfigUtils.getBackupPath()+File.separator+"fixes" + java.io.File.separator + lastmoddate + "_" + "FixTask00012UpdateAssetsHosts" + ".xml"); try (BufferedOutputStream _bout = new BufferedOutputStream(Files.newOutputStream(_writing.toPath()))){ _xstream.toXML(modifiedData, _bout); } catch (IOException e) { Logger.error(this, "Error trying to get modified data from XML.", e); } } return modifiedData; }
Source:
<code>public void init() { try { ccf = new ConnectionContextFactory(conFactory); pcc = ccf.createProducerConnectionContext(new Endpoint(Endpoint.Type.QUEUE, ACTION_PLUGIN_REGISTER)); ActionPluginMessage apMsg = new ActionPluginMessage(); apMsg.setOp(EmailPlugin.INIT_PLUGIN); apMsg.setActionPlugin(EmailPlugin.PLUGIN_NAME); Set<String> properties = new HashSet<String>(); properties.add("to"); <START> properties.add("cc"); <END> properties.add("description"); apMsg.setProperties(properties); MessageId mid = new MessageProcessor().send(pcc, apMsg); msgLog.infoPluginRegistration(EmailPlugin.INIT_PLUGIN, mid.toString()); } catch (JMSException e) { log.debug(e.getMessage(), e); msgLog.errorCannotSendMessage(EmailPlugin.INIT_PLUGIN, e.getMessage()); } }</code><technical_language>Do want EmailPlugin constants here, instead of literal Strings</technical_language>

Target:
public void init() { try { ccf = new ConnectionContextFactory(conFactory); pcc = ccf.createProducerConnectionContext(new Endpoint(Endpoint.Type.QUEUE, ACTION_PLUGIN_REGISTER)); ActionPluginMessage apMsg = new ActionPluginMessage(); apMsg.setOp(EmailPlugin.INIT_PLUGIN); apMsg.setActionPlugin(EmailPlugin.PLUGIN_NAME); Set<String> properties = new HashSet<String>(); properties.add(EmailPlugin.PROP_FROM); properties.add(EmailPlugin.PROP_FROM_NAME); properties.add(EmailPlugin.PROP_TO); properties.add(EmailPlugin.PROP_CC); properties.add(EmailPlugin.PROP_MESSAGE_ID); properties.add(EmailPlugin.PROP_IN_REPLY_TO); properties.add(EmailPlugin.PROP_TEMPLATE_HAWKULAR_URL); properties.add(EmailPlugin.PROP_TEMPLATE_LOCALE); properties.add(EmailPlugin.PROP_TEMPLATE_PLAIN); properties.add(EmailPlugin.PROP_TEMPLATE_HTML); apMsg.setProperties(properties); MessageId mid = new MessageProcessor().send(pcc, apMsg); msgLog.infoPluginRegistration(EmailPlugin.INIT_PLUGIN, mid.toString()); } catch (JMSException e) { log.debug(e.getMessage(), e); msgLog.errorCannotSendMessage(EmailPlugin.INIT_PLUGIN, e.getMessage()); } finally { if (pcc != null) { try { pcc.close(); pcc = null; } catch (IOException ignored) { } } if (ccf != null) { try { ccf.close(); } catch (JMSException ignored) { } } } }
Source:
<code>public RibbonApacheHttpResponse execute(RibbonApacheHttpRequest request, final IClientConfig configOverride) throws Exception { final RequestConfig.Builder builder = RequestConfig.custom(); IClientConfig config = configOverride != null ? configOverride : this.config; <START> if (config != null) { <END> builder.setConnectTimeout(config.get( CommonClientConfigKey.ConnectTimeout, this.connectTimeout)); builder.setSocketTimeout(config.get( CommonClientConfigKey.ReadTimeout, this.readTimeout)); builder.setRedirectsEnabled(config.get( CommonClientConfigKey.FollowRedirects, this.followRedirects)); } else { builder.setConnectTimeout(this.connectTimeout); builder.setSocketTimeout(this.readTimeout); builder.setRedirectsEnabled(this.followRedirects); } final RequestConfig requestConfig = builder.build(); if (isSecure(configOverride)) { final URI secureUri = UriComponentsBuilder.fromUri(request.getUri()) .scheme("https").build().toUri(); request = request.withNewUri(secureUri); } final HttpUriRequest httpUriRequest = request.toRequest(requestConfig); final HttpResponse httpResponse = this.delegate.execute(httpUriRequest); return new RibbonApacheHttpResponse(httpResponse, httpUriRequest.getURI()); }</code><technical_language>If add final field in abstract class, yes</technical_language>

Target:
public RibbonApacheHttpResponse execute(RibbonApacheHttpRequest request, final IClientConfig configOverride) throws Exception { final RequestConfig.Builder builder = RequestConfig.custom(); IClientConfig config = configOverride != null ? configOverride : this.config; builder.setConnectTimeout(config.get( CommonClientConfigKey.ConnectTimeout, this.connectTimeout)); builder.setSocketTimeout(config.get( CommonClientConfigKey.ReadTimeout, this.readTimeout)); builder.setRedirectsEnabled(config.get( CommonClientConfigKey.FollowRedirects, this.followRedirects)); final RequestConfig requestConfig = builder.build(); if (isSecure(configOverride)) { final URI secureUri = UriComponentsBuilder.fromUri(request.getUri()) .scheme("https").build().toUri(); request = request.withNewUri(secureUri); } final HttpUriRequest httpUriRequest = request.toRequest(requestConfig); final HttpResponse httpResponse = this.delegate.execute(httpUriRequest); return new RibbonApacheHttpResponse(httpResponse, httpUriRequest.getURI()); }
Source:
<code>public LivenessCheckScheduler(Consumer<String> errorHandler, TableUtils table, BlobUtils blob, AtomicReference<String> currentJMVersion, final String pid) { this.table = table; this.blob = blob; this.currentJMVersion = currentJMVersion; <START> liveProcessorsList = new AtomicReference<>(null); <END> this.errorHandler = errorHandler; this.processorId = pid; }</code><technical_language>nit: initialize in Line 56 itself</technical_language>

Target:
public LivenessCheckScheduler(Consumer<String> errorHandler, TableUtils table, BlobUtils blob, AtomicReference<String> currentJMVersion, final String pid) { this.table = table; this.blob = blob; this.currentJMVersion = currentJMVersion; this.errorHandler = errorHandler; this.processorId = pid; }
Source:
<code>private ConsumerRebalanceListener getConsumerRebalanceListener(final KafkaConsumer<String, String> consumer) { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { for (TopicPartition partition : partitions) consumer.seek(partition, 0); } @Override public void onPartitionsLost(Collection<TopicPartition> partitions) { <START> System.out.println("hit partitions lost " + partitions); <END> } }; }</code><technical_language>Is this outdated debug statement? If not, add a similar line onPartitionsRevoked()</technical_language>

Target:
private ConsumerRebalanceListener getConsumerRebalanceListener(final KafkaConsumer<String, String> consumer) { return new ConsumerRebalanceListener() { @Override public void onPartitionsRevoked(Collection<TopicPartition> partitions) { } @Override public void onPartitionsAssigned(Collection<TopicPartition> partitions) { for (TopicPartition partition : partitions) consumer.seek(partition, 0); } }; }
Source:
<code>private static void downloadBlob(CloudBlob blob, FilePath downloadDir, boolean flattenDirectories, TaskListener listener) throws WAStorageException { try { FilePath downloadFile = new FilePath(downloadDir, blob.getName()); if (flattenDirectories) { downloadFile = new FilePath(downloadDir, downloadFile.getName()); <START> } <END> try (OutputStream fos = downloadFile.write()) { long startTime = System.currentTimeMillis(); blob.download(fos, null, getBlobRequestOptions(), Utils.updateUserAgent()); long endTime = System.currentTimeMillis(); listener.getLogger().println( "blob " + blob.getName() + " is downloaded to " + downloadDir + " in " + getTime(endTime - startTime)); } } catch (Exception e) { throw new WAStorageException(e.getMessage(), e.getCause()); } }</code><technical_language>nit: cleaner wrap _just_ this blob.download() call in try block for stream</technical_language>

Target:
private static void downloadBlob(CloudBlob blob, FilePath downloadDir, boolean flattenDirectories, TaskListener listener) throws WAStorageException { try { FilePath downloadFile = new FilePath(downloadDir, blob.getName()); if (flattenDirectories) { downloadFile = new FilePath(downloadDir, downloadFile.getName()); } long startTime = System.currentTimeMillis(); try (OutputStream fos = downloadFile.write()) { blob.download(fos, null, getBlobRequestOptions(), Utils.updateUserAgent()); } long endTime = System.currentTimeMillis(); listener.getLogger().println( "blob " + blob.getName() + " is downloaded to " + downloadDir + " in " + getTime(endTime - startTime)); } catch (Exception e) { throw new WAStorageException(e.getMessage(), e.getCause()); } }
Source:
<code>public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); <START> if (!VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { s_logger.debug("Skipping health checks data for internal lbvms as it's router.health.checks.enabled is false"); return response; } <END> List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } response.setResponses(routerResponses, result.second()); return response; }</code><technical_language>shrug:</technical_language>

Target:
public ListResponse<DomainRouterResponse> searchForInternalLbVms(ListInternalLBVMsCmd cmd) { Pair<List<DomainRouterJoinVO>, Integer> result = searchForRoutersInternal(cmd, cmd.getId(), cmd.getRouterName(), cmd.getState(), cmd.getZoneId(), cmd.getPodId(), null, cmd.getHostId(), cmd.getKeyword(), cmd.getNetworkId(), cmd.getVpcId(), cmd.getForVpc(), cmd.getRole(), null); ListResponse<DomainRouterResponse> response = new ListResponse<DomainRouterResponse>(); List<DomainRouterResponse> routerResponses = ViewResponseHelper.createDomainRouterResponse(result.first().toArray(new DomainRouterJoinVO[result.first().size()])); if (VirtualNetworkApplianceManager.RouterHealthChecksEnabled.value()) { for (DomainRouterResponse res : routerResponses) { DomainRouterVO resRouter = _routerDao.findByUuid(res.getId()); res.setHealthChecksFailed(routerHealthCheckResultDao.hasFailingChecks(resRouter.getId())); if (cmd.shouldFetchHealthCheckResults()) { res.setHealthCheckResults(responseGenerator.createHealthCheckResponse(resRouter, new ArrayList<>(routerHealthCheckResultDao.getHealthCheckResults(resRouter.getId())))); } } } response.setResponses(routerResponses, result.second()); return response; }
Source:
<code>public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { <START> String location = "/tmp/upload"; <END> String fileName = location + request.getPathInfo(); FileInputStream fis = null; try { fis = new FileInputStream(fileName); response.setContentType("application/octet-stream"); OutputStream out = response.getOutputStream(); IOUtils.copy(fis, out); } finally { IOUtils.closeQuietly(out); IOUtils.closeQuietly(fis); } }</code><technical_language>string multiple times ==> put in a var</technical_language>

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String fileName = uploadPath + request.getPathInfo(); try (FileInputStream fis = new FileInputStream(fileName)){ response.setContentType("application/octet-stream"); try (OutputStream out = response.getOutputStream()){ IOUtils.copy(fis, out); } } }
Source:
<code>public static byte[] createMaxByteArray(int num_bytes) { byte[] max_byte_arr = new byte[num_bytes]; <START> for (int i = 0; i < max_byte_arr.length; i++) { <END> max_byte_arr[i] = (byte) 0xff; } return max_byte_arr; }</code><technical_language>Arrays.fill(max_byte_arr, (byte) 0xff);</technical_language>

Target:
public static byte[] createMaxByteArray(int num_bytes) { byte[] max_byte_arr = new byte[num_bytes]; Arrays.fill(max_byte_arr, (byte) 0xff); return max_byte_arr; }
Source:
<code>public FormValidation doCheckRemote(StaplerRequest req, @AncestorInPath AbstractProject context, @QueryParameter String value, @QueryParameter String credentialsId) { Jenkins instance = Jenkins.getInstance(); if (instance != null) { ModuleLocation.DescriptorImpl d = instance.getDescriptorByType(ModuleLocation.DescriptorImpl.class); if (d != null) { return d.doCheckCredentialsId( req, context, value, credentialsId); } } <START> return null; <END> }</code><technical_language>a warning</technical_language>

Target:
public FormValidation doCheckRemote(StaplerRequest req, @AncestorInPath AbstractProject context, @QueryParameter String value, @QueryParameter String credentialsId) { Jenkins instance = Jenkins.getInstance(); if (instance != null) { ModuleLocation.DescriptorImpl d = instance.getDescriptorByType(ModuleLocation.DescriptorImpl.class); if (d != null) { return d.doCheckCredentialsId( req, context, value, credentialsId); } } return FormValidation.warning("Unable to check remote."); }