auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean buildNoteObjectFromPNPayloadAndSaveIt(Bundle data) { if (data == null) { AppLog.e(T.NOTIFS, "Bundle is null! Cannot read '" + PUSH_ARG_NOTE_ID +"'."); return false; } String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = Note.buildFromBase64EncodedData(noteId, base64FullData); if (note != null) { return NotificationsTable.saveNote(note, true); } <START> return false; <END> }</code><technical_language>returning false, write AppLog indicating fail in accomplishing mission (that is, mission method name buildNoteObjectFromPNPayloadAndSaveIt)</technical_language>

Target:
private boolean buildNoteObjectFromPNPayloadAndSaveIt(Bundle data) { if (data == null) { AppLog.e(T.NOTIFS, "Bundle is null! Cannot read '" + PUSH_ARG_NOTE_ID +"'."); } else { String noteId = data.getString(PUSH_ARG_NOTE_ID, ""); String base64FullData = data.getString(PUSH_ARG_NOTE_FULL_DATA); Note note = Note.buildFromBase64EncodedData(noteId, base64FullData); if (note != null) { return NotificationsTable.saveNote(note, true); } } AppLog.w(T.NOTIFS, "Cannot build the Note object by using info available in the PN payload. Please see " + "previous log messages for detailed information about the error."); return false; }
Source:
<code>public URI getLocationHeaderAsURI() { try { return locationHeader != null ? new URI(locationHeader) : null; } catch (URISyntaxException e) { if (LRALogger.logger.isInfoEnabled()) { LRALogger.logger.infof("LRARecord.doEnd missing Location header on ACCEPTED response %s failed: %s", getRequestURI(), e.getMessage()); } <START> <END> return null; } }</code><technical_language>NPE</technical_language>

Target:
public URI getLocationHeaderAsURI() throws URISyntaxException { return locationHeader != null ? new URI(locationHeader) : null; }
Source:
<code>static void tidyUp() { <START> WebDriverWrapper fxDriver; <END> while (!freeDrivers.isEmpty()) { try { fxDriver = freeDrivers.pop(); fxDriver.getDriver().quit(); } catch (Exception e) { } } }</code><technical_language>renamed</technical_language>

Target:
static void tidyUp() { WebDriverWrapper driver; for (Entry<Browser, Stack<WebDriverWrapper>> map : freeDrivers.entrySet()) { while (!map.getValue().isEmpty()) { try { driver = map.getValue().pop(); driver.getDriver().quit(); } catch (Exception e) { } } } }
Source:
<code>static void buildShardLevelInfo(Logger logger, ShardStats[] stats, ImmutableOpenMap.Builder<String, Long> shardSizes, ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath, Map<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace.Builder> reservedSpaceByShard) { for (ShardStats s : stats) { final ShardRouting shardRouting = s.getShardRouting(); newShardRoutingToDataPath.put(shardRouting, s.getDataPath()); final StoreStats storeStats = s.getStats().getStore(); final long size = storeStats.sizeInBytes(); final long reserved = storeStats.getReservedSize().getBytes(); final String shardIdentifier = ClusterInfo.shardIdentifierFromRouting(shardRouting); if (logger.isTraceEnabled()) { logger.trace("shard: size: reserved: {}", shardIdentifier, size, reserved); } shardSizes.put(shardIdentifier, size); if (reserved != StoreStats.UNKNOWN_RESERVED_BYTES) { <START> reservedSpaceByShard.computeIfAbsent( <END> new ClusterInfo.NodeAndPath(shardRouting.currentNodeId(), s.getDataPath()), t -> new ClusterInfo.ReservedSpace.Builder()).add(shardRouting.shardId(), reserved); } } }</code><technical_language>I thought this merge contents accommodate for shards a specific NodePath encountered? I missing something</technical_language>

Target:
static void buildShardLevelInfo(Logger logger, ShardStats[] stats, ImmutableOpenMap.Builder<String, Long> shardSizes, ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath, Map<ClusterInfo.NodeAndPath, ClusterInfo.ReservedSpace.Builder> reservedSpaceByShard) { for (ShardStats s : stats) { final ShardRouting shardRouting = s.getShardRouting(); newShardRoutingToDataPath.put(shardRouting, s.getDataPath()); final StoreStats storeStats = s.getStats().getStore(); final long size = storeStats.sizeInBytes(); final long reserved = storeStats.getReservedSize().getBytes(); final String shardIdentifier = ClusterInfo.shardIdentifierFromRouting(shardRouting); logger.trace("shard: size: reserved: {}", shardIdentifier, size, reserved); shardSizes.put(shardIdentifier, size); if (reserved != StoreStats.UNKNOWN_RESERVED_BYTES) { reservedSpaceByShard.computeIfAbsent( new ClusterInfo.NodeAndPath(shardRouting.currentNodeId(), s.getDataPath()), t -> new ClusterInfo.ReservedSpace.Builder()).add(shardRouting.shardId(), reserved); } } }
Source:
<code>public ResponseEntity<Object> postImports( @PathVariable(required = false) Long id, @RequestParam(name = "async", required = false, defaultValue = "false") boolean async, @RequestParam(name = "exec", required = false, defaultValue = "false") boolean exec, @RequestBody(required = false) ImportContext obj, UriComponentsBuilder builder) throws IOException { ImportContext context = (ImportContext) context(id, true, false); if (context != null) { try { runImport(context, async); } catch (Throwable t) { if (t instanceof ValidationException) { throw new RestException(t.getMessage(), HttpStatus.BAD_REQUEST, t); } else { <START> LOGGER.log( <END> Level.SEVERE, "Error occurred while executing import (POST) " + t.getMessage(), t); throw new RestException( "Error occurred executing import", HttpStatus.INTERNAL_SERVER_ERROR, t); } } return new ResponseEntity<>("", new HttpHeaders(), HttpStatus.NO_CONTENT); } context = createImport(id, obj, async, exec); if (context != null) { importer.changed(context); } else { throw new RestException( "Error occurred executing import", HttpStatus.INTERNAL_SERVER_ERROR); } UriComponents uriComponents = getUriComponents(context.getId().toString(), builder); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setLocation(uriComponents.toUri()); return new ResponseEntity<>(context, headers, HttpStatus.CREATED); }</code><technical_language>Odd... needed? REST machinery logging thrown exceptions...</technical_language>

Target:
public ResponseEntity<Object> postImports( @PathVariable(required = false) Long id, @RequestParam(name = "async", required = false, defaultValue = "false") boolean async, @RequestParam(name = "exec", required = false, defaultValue = "false") boolean exec, @RequestBody(required = false) ImportContext obj, UriComponentsBuilder builder) throws IOException { ImportContext context = (ImportContext) context(id, true, false); if (context != null) { try { runImport(context, async); } catch (Throwable t) { if (t instanceof ValidationException) { throw new RestException(t.getMessage(), HttpStatus.BAD_REQUEST, t); } else { throw new RestException( "Error occurred executing import", HttpStatus.INTERNAL_SERVER_ERROR, t); } } return new ResponseEntity<>("", new HttpHeaders(), HttpStatus.NO_CONTENT); } context = createImport(id, obj, async, exec); if (context != null) { importer.changed(context); } else { throw new RestException( "Error occurred executing import", HttpStatus.INTERNAL_SERVER_ERROR); } UriComponents uriComponents = getUriComponents(context.getId().toString(), builder); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); headers.setLocation(uriComponents.toUri()); return new ResponseEntity<>(context, headers, HttpStatus.CREATED); }
Source:
<code>private void runAnsibleRemovePlaybook() { AuditLogable <START> auditable = <END> new AuditLogableImpl(); auditable.setVdsName(getVds().getName()); auditable.setVdsId(getVds().getId()); auditable.setCorrelationId(getCorrelationId()); try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hosts(getVds()) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); command.build(); auditable.addCustomValue("LogFile", command.logFile().getAbsolutePath()); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } else { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } } catch (Exception e) { auditable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }</code><technical_language>pls refactors in a separate PR, focus patch topic itself, refactor is part of actual fix</technical_language>

Target:
private void runAnsibleRemovePlaybook() { AuditLogable auditable = new AuditLogableImpl(); auditable.setVdsName(getVds().getName()); auditable.setVdsId(getVds().getId()); auditable.setCorrelationId(getCorrelationId()); try { AnsibleCommandBuilder command = new AnsibleCommandBuilder() .hosts(getVds()) .playbook(AnsibleConstants.HOST_REMOVE_PLAYBOOK); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_STARTED); AnsibleReturnValue ansibleReturnValue = ansibleExecutor.runCommand(command); auditable.addCustomValue("LogFile", ansibleReturnValue.getLogFile().getAbsolutePath()); if (ansibleReturnValue.getAnsibleReturnCode() != AnsibleReturnCode.OK) { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FAILED); } else { auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_FINISHED); } } catch (Exception e) { auditable.addCustomValue("Message", e.getMessage()); auditLogDirector.log(auditable, AuditLogType.VDS_ANSIBLE_HOST_REMOVE_EXECUTION_FAILED); } }
Source:
<code>public void recordSensorEvent(SensorEvent sensorEvent, JsonObject jsonObject) { int sensorType = sensorEvent.sensor.getType(); String sensorTypeKey = SENSOR_TYPE_TO_DATA_TYPE.get(sensorType); if (Strings.isNullOrEmpty(sensorTypeKey)) { logger.warn("Unable find type key for sensor type: " + sensorType); return; } jsonObject.addProperty(SENSOR_DATA_TYPE_KEY, sensorTypeKey); <START> jsonObject.addProperty(SENSOR_EVENT_ACCURACY_KEY, sensorEvent.accuracy); <END> switch (sensorType) { case Sensor.TYPE_ACCELEROMETER: recordAccelerometerEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_GRAVITY: recordGravityEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_LINEAR_ACCELERATION: recordLinearAccelerometerEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_GYROSCOPE: recordGyroscope(sensorEvent, jsonObject); break; case Sensor.TYPE_MAGNETIC_FIELD: recordMagneticField(sensorEvent, jsonObject); break; case Sensor.TYPE_GAME_ROTATION_VECTOR: case Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR: case Sensor.TYPE_ROTATION_VECTOR: recordRotationVector(sensorEvent, jsonObject); break; default: logger.warn("Unable to record sensor type: " + sensorType); } }</code><technical_language>add "uptime" here</technical_language>

Target:
public void recordSensorEvent(SensorEvent sensorEvent, JsonObject jsonObject) { int sensorType = sensorEvent.sensor.getType(); String sensorTypeKey = SENSOR_TYPE_TO_DATA_TYPE.get(sensorType); if (Strings.isNullOrEmpty(sensorTypeKey)) { logger.warn("Unable find type key for sensor type: " + sensorType); return; } jsonObject.addProperty(SENSOR_DATA_TYPE_KEY, sensorTypeKey); jsonObject.addProperty(SENSOR_EVENT_ACCURACY_KEY, sensorEvent.accuracy); switch (sensorType) { case Sensor.TYPE_ACCELEROMETER: recordAccelerometerEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_GRAVITY: recordGravityEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_LINEAR_ACCELERATION: recordLinearAccelerometerEvent(sensorEvent, jsonObject); break; case Sensor.TYPE_GYROSCOPE: recordGyroscope(sensorEvent, jsonObject); break; case Sensor.TYPE_MAGNETIC_FIELD: recordMagneticField(sensorEvent, jsonObject); break; case Sensor.TYPE_GYROSCOPE_UNCALIBRATED: case Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED: case Sensor.TYPE_ACCELEROMETER_UNCALIBRATED: recordUncalibrated(sensorEvent, jsonObject); break; case Sensor.TYPE_GAME_ROTATION_VECTOR: case Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR: case Sensor.TYPE_ROTATION_VECTOR: recordRotationVector(sensorEvent, jsonObject); break; default: logger.warn("Unable to record sensor type: " + sensorType); } }
Source:
<code>public void testNoTimeoutReturnsHealthy() throws Exception { String validationQuery = "select 1"; Jdbi jdbi = mock(Jdbi.class); Handle handle = mock(Handle.class); when(jdbi.open()).thenReturn(handle); when(jdbi.withHandle(Mockito.any())).thenCallRealMethod(); <START> when(handle.execute(validationQuery)).thenAnswer((Answer<Integer>) invocation -> null); <END> ExecutorService executorService = Executors.newSingleThreadExecutor(); JdbiHealthCheck jdbiHealthCheck = new JdbiHealthCheck(executorService, Duration.milliseconds(5), jdbi, validationQuery); HealthCheck.Result result = jdbiHealthCheck.check(); executorService.shutdown(); assertThat(result.isHealthy()).isTrue(); }</code><technical_language>method returns integer, I thenReturn(0)</technical_language>

Target:
public void testNoTimeoutReturnsHealthy() throws Exception { when(handle.execute(VALIDATION_QUERY)).thenReturn(0); HealthCheck.Result result = sut.check(); assertThat(result.isHealthy()).isTrue(); }
Source:
<code>public void refresh(HelixDataAccessor accessor) { long startTime = System.currentTimeMillis(); _customizedViewCache.refresh(accessor); long endTime = System.currentTimeMillis(); <START> LOG.info("Refresh " + _customizedViewCache.getPropertyMap().size() + " CustomizedViews of type " + _customizedStateType <END> + " for cluster " + _clusterName + ", took " + (endTime - startTime) + " ms"); }</code><technical_language>This is propertyCache log: LogUtil.logInfo(LOG, genEventInfo(), String.format("Refreshed %s property %s %s ms. Selective: %s", _objMap.size(), _propertyDescription, System.currentTimeMillis() - start, _useSelectiveUpdate)); I is overlapping. is lead log here</technical_language>

Target:
public void refresh(HelixDataAccessor accessor) { _customizedViewCache.refresh(accessor); }
Source:
<code>private Object getBPMNProcessDiagram(String processId, String sessionId) { HttpPost httpPost; CloseableHttpResponse response; BufferedReader rd; String line; StringEntity stringEntity; String imageUrl = null; try { httpPost = new HttpPost( baseUrl + "/services/BPMNDeploymentService.BPMNDeploymentServiceHttpsSoap11Endpoint/"); httpPost.addHeader("COOKIE", sessionId); httpPost.addHeader("SOAPAction", "urn:getProcessDiagram"); httpPost.addHeader("Content-Type", "text/xml"); String imgPayload = "<soapenv:Envelope xmlns:soapenv=\"<LINK_1>\" " + "xmlns:ser=\"<LINK_0>" + ".org\"><soapenv:Header/><soapenv:Body><ser:getProcessDiagram><ser:processId>" + processId + "</ser:processId></ser:getProcessDiagram></soapenv:Body></soapenv:Envelope>"; stringEntity = new StringEntity(imgPayload, "UTF-8"); stringEntity.setChunked(true); httpPost.setEntity(stringEntity); response = client.execute(httpPost); rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent(), Charset.defaultCharset())); StringBuffer imgResult = new StringBuffer(); while ((line = rd.readLine()) != null) { imgResult.append(line); } String imageData = imgResult.toString().split(":return")[1]; imageUrl = "data:image/png;base64," + imageData.substring(1, imageData.length() - 4); } catch (ClientProtocolException e) { log.error("Exception : ", e); } catch (IOException e) { log.error("Exception : ", e); <START> } <END> return imageUrl; }</code><technical_language>multi catch</technical_language>

Target:
private Object getBPMNProcessDiagram(String processId, String sessionId) throws IOException { HttpPost httpPost; String line; StringEntity stringEntity; String imageUrl = null; try (CloseableHttpResponse response = null; BufferedReader rd = null) { httpPost = new HttpPost( baseUrl + "/services/BPMNDeploymentService.BPMNDeploymentServiceHttpsSoap11Endpoint/"); httpPost.addHeader(Constants.COOKIE, sessionId); httpPost.addHeader(Constants.SOAP_ACTION, Constants.SOAP_ACTION_GET_PROCESS_DIAGRAM); httpPost.addHeader(Constants.CONTENT_TYPE, Constants.XML_CONTENT_TYPE); String imgPayload = "<soapenv:Envelope xmlns:soapenv=\"<LINK_1>\" " + "xmlns:ser=\"<LINK_0>" + ".org\"><soapenv:Header/><soapenv:Body><ser:getProcessDiagram><ser:processId>" + processId + "</ser:processId></ser:getProcessDiagram></soapenv:Body></soapenv:Envelope>"; stringEntity = new StringEntity(imgPayload, Constants.UTF_8_ENCODING); stringEntity.setChunked(true); httpPost.setEntity(stringEntity); response = client.execute(httpPost); rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent(), Charset.defaultCharset())); StringBuffer imgResult = new StringBuffer(); while ((line = rd.readLine()) != null) { imgResult.append(line); } String imageData = imgResult.toString().split(":return")[1]; imageUrl = "data:image/png;base64," + imageData.substring(1, imageData.length() - 4); } catch (ClientProtocolException e) { log.error(Constants.CLIENT_PROTOCOL_EX, e); } return imageUrl; }
Source:
<code>public void waitWithAnyMonitor(long timeout, EventMonitor... monitors) throws ProActiveTimeoutException { TimeoutAccounter counter = TimeoutAccounter.getAccounter(timeout); synchronized (monitors) { Arrays.stream(monitors).forEach(monitor -> monitor.setTimeouted(false)); while (!counter.isTimeoutElapsed()) { if (Arrays.stream(monitors).anyMatch(monitor -> monitor.eventOccured)) { return; } try { Thread.sleep(1000); } catch (InterruptedException e) { <START> System.exit(1); <END> } } Arrays.stream(monitors).forEach(monitor -> monitor.setTimeouted(true)); } throw new ProActiveTimeoutException("timeout elapsed"); }</code><technical_language>a bit hardcore, propagate interrupt</technical_language>

Target:
public void waitWithAnyMonitor(long timeout, EventMonitor... monitors) throws ProActiveTimeoutException, InterruptedException { TimeoutAccounter counter = TimeoutAccounter.getAccounter(timeout); synchronized (monitors) { Arrays.stream(monitors).forEach(monitor -> monitor.setTimeouted(false)); while (!counter.isTimeoutElapsed()) { if (Arrays.stream(monitors).anyMatch(monitor -> monitor.eventOccured)) { return; } Thread.sleep(1000); } Arrays.stream(monitors).forEach(monitor -> monitor.setTimeouted(true)); } throw new ProActiveTimeoutException("timeout elapsed"); }
Source:
<code>public void clickMenu(String... menuNames) { <START> for (int i = 0; i < menuNames.length; i++) { <END> click(menuNames[i]); } }</code><technical_language>a for loop for this instead? java for (String menuName : menuNames) { click(menuName); }</technical_language>

Target:
public void clickMenu(String... menuNames) { for (String menuName : menuNames) { click(menuName); } }
Source:
<code>public Response getProfileLogs(@QueryParam("queryId") final Long queryId, @QueryParam("fragmentId") final Long fragmentId, @QueryParam("start") final Long start, @QueryParam("end") final Long end, @DefaultValue("0") @QueryParam("minLength") final Long minLength, @DefaultValue("false") @QueryParam("onlyRootOp") final boolean onlyRootOp, @Context final UriInfo uriInfo) throws DbException { Preconditions.checkArgument(queryId != null, "Missing required field queryId."); Preconditions.checkArgument(fragmentId != null, "Missing required field fragmentId."); Preconditions.checkArgument(start != null, "Missing required field start."); Preconditions.checkArgument(end != null, "Missing required field end."); Preconditions.checkArgument(minLength >= 0, "MinLength has to be greater than or equal to 0"); ResponseBuilder response = Response.ok(); response.type(MediaType.TEXT_PLAIN); PipedOutputStream writerOutput = new PipedOutputStream(); PipedInputStream input; try { input = new PipedInputStream(writerOutput, MyriaConstants.DEFAULT_PIPED_INPUT_STREAM_SIZE); } catch (IOException e) { throw new DbException(e); } PipedStreamingOutput entity = new PipedStreamingOutput(input); response.entity(entity); TupleWriter writer = new CsvTupleWriter(writerOutput); <START> try { <END> server.startLogDataStream(queryId, fragmentId, start, end, minLength, onlyRootOp, writer); } catch (IllegalArgumentException e) { throw new MyriaApiException(Status.BAD_REQUEST, e); } return response.build(); }</code><technical_language>This is a redundant try/catch</technical_language>

Target:
public Response getProfileLogs(@QueryParam("queryId") final Long queryId, @QueryParam("fragmentId") final Long fragmentId, @QueryParam("start") final Long start, @QueryParam("end") final Long end, @DefaultValue("0") @QueryParam("minLength") final Long minLength, @DefaultValue("false") @QueryParam("onlyRootOp") final boolean onlyRootOp, @Context final UriInfo uriInfo) throws DbException { Preconditions.checkArgument(queryId != null, "Missing required field queryId."); Preconditions.checkArgument(fragmentId != null, "Missing required field fragmentId."); Preconditions.checkArgument(start != null, "Missing required field start."); Preconditions.checkArgument(end != null, "Missing required field end."); Preconditions.checkArgument(minLength >= 0, "MinLength has to be greater than or equal to 0"); ResponseBuilder response = Response.ok(); response.type(MediaType.TEXT_PLAIN); PipedOutputStream writerOutput = new PipedOutputStream(); PipedInputStream input; try { input = new PipedInputStream(writerOutput, MyriaConstants.DEFAULT_PIPED_INPUT_STREAM_SIZE); } catch (IOException e) { throw new DbException(e); } PipedStreamingOutput entity = new PipedStreamingOutput(input); response.entity(entity); TupleWriter writer = new CsvTupleWriter(writerOutput); server.startLogDataStream(queryId, fragmentId, start, end, minLength, onlyRootOp, writer); return response.build(); }
Source:
<code>public String getTableToolContent(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user")@Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); if (workflowVersion == null) { throw new CustomWebApplicationException("workflow version " + workflowVersionId + " does not exist", HttpStatus.SC_BAD_REQUEST); } if (workflowVersion.getToolTableJson() != null) { return workflowVersion.getToolTableJson(); } <START> SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); <END> if (mainDescriptor != null) { Set<SourceFile> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); final Optional<String> toolTableJson = lInterface.getContent(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.TOOLS, toolDAO); if (toolTableJson.isPresent()) { workflowVersion.setToolTableJson(toolTableJson.get()); return toolTableJson.get(); } return null; } return null; }</code><technical_language>Before, if error, setToolTableJson(null). set all. Do want that? I answer, raising question. In theory, understanding flow, if a in fiel, get cleared change, doesn't. This in 2 other places (ran this first). Checking this is intended everywhere. bug fix :) concerned values cleared</technical_language>

Target:
public String getTableToolContent(@ApiParam(hidden = true) @Parameter(hidden = true, name = "user")@Auth Optional<User> user, @ApiParam(value = "workflowId", required = true) @PathParam("workflowId") Long workflowId, @ApiParam(value = "workflowVersionId", required = true) @PathParam("workflowVersionId") Long workflowVersionId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkOptionalAuthRead(user, workflow); WorkflowVersion workflowVersion = getWorkflowVersion(workflow, workflowVersionId); if (workflowVersion == null) { throw new CustomWebApplicationException("workflow version " + workflowVersionId + " does not exist", HttpStatus.SC_BAD_REQUEST); } if (workflowVersion.getToolTableJson() != null) { return workflowVersion.getToolTableJson(); } SourceFile mainDescriptor = getMainDescriptorFile(workflowVersion); if (mainDescriptor != null) { Set<SourceFile> secondaryDescContent = extractDescriptorAndSecondaryFiles(workflowVersion); LanguageHandlerInterface lInterface = LanguageHandlerFactory.getInterface(workflow.getFileType()); final Optional<String> toolTableJson = lInterface.getContent(workflowVersion.getWorkflowPath(), mainDescriptor.getContent(), secondaryDescContent, LanguageHandlerInterface.Type.TOOLS, toolDAO); final String json = toolTableJson.orElseGet(null); workflowVersion.setToolTableJson(json); return json; } return null; }
Source:
<code>public static void signOAuth(final String host, final String path, final String method, final boolean https, final Parameters params, final OAuthTokens tokens, final String consumerKey, final String consumerSecret) { params.put( "oauth_consumer_key", consumerKey, "oauth_nonce", CryptUtils.md5(Long.toString(System.currentTimeMillis())), "oauth_signature_method", "HMAC-SHA1", "oauth_timestamp", Long.toString(System.currentTimeMillis() / 1000), "oauth_version", "1.0"); if (tokens.getTokenPublic() != null && !tokens.getTokenPublic().isEmpty()) { params.put("oauth_token", StringUtils.defaultString(tokens.getTokenPublic())); <START> } <END> params.put("oauth_signature", signCompletedOAuth(host, path, method, https, params, tokens.getTokenSecret(), consumerSecret)); }</code><technical_language>This suspicious, previous implementation explicitly setting oauth_token-parameter, in initial request. Scouring docs, this required, cross-check other authorizations work (e.g. twitter, oc.*)</technical_language>

Target:
public static void signOAuth(final String host, final String path, final String method, final boolean https, final Parameters params, final OAuthTokens tokens, final String consumerKey, final String consumerSecret) { params.put( "oauth_consumer_key", consumerKey, "oauth_nonce", CryptUtils.md5(Long.toString(System.currentTimeMillis())), "oauth_signature_method", "HMAC-SHA1", "oauth_timestamp", Long.toString(System.currentTimeMillis() / 1000), "oauth_version", "1.0"); if (StringUtils.isNotEmpty(tokens.getTokenPublic())) { params.put("oauth_token", StringUtils.defaultString(tokens.getTokenPublic())); } params.put("oauth_signature", signCompletedOAuth(host, path, method, https, params, tokens.getTokenSecret(), consumerSecret)); }
Source:
<code>public int getActiveNodesTotal(boolean onlyNewComputers) { int totalServers = 0; <START> for (Server server : getRunningNodes()) { <END> JCloudsComputer computer = (JCloudsComputer) Jenkins.getActiveInstance().getNode(server.getName()).toComputer(); if (computer != null && !computer.isPendingDelete() && !(computer.getOfflineCause() instanceof OfflineCause.UserCause)) { if (onlyNewComputers) { if (!computer.isUsed()) { totalServers++; } } else { totalServers++; } } } return totalServers; }</code><technical_language>Note getRunningNodes() queries openstack for servers created this template in stage of provisioning: ready, utilized, tearing waiting for it. focus computers in Jenkins IMO</technical_language>

Target:
public int getActiveNodesTotal(boolean onlyNewComputers) { int totalServers = 0; for (Node node : Jenkins.getActiveInstance().getNodes()) { if (node instanceof JCloudsSlave) { JCloudsSlave slave = (JCloudsSlave) node; if (slave.getId().getCloudName().equals(cloud.name) && slave.getId().getTemplateName().equals(name)) { JCloudsComputer computer = (JCloudsComputer) slave.toComputer(); if (computer != null && !computer.isPendingDelete() && !(computer.getOfflineCause() instanceof OfflineCause.UserCause)) { if (onlyNewComputers) { if (!computer.isUsed()) { totalServers++; } } else { totalServers++; } } } } } return totalServers; }
Source:
<code>public QueryRunner<T> getRunner(QuerySegmentWalker walker) { <START> return getQuerySegmentSpecForLookUp().lookup(this, walker); <END> }</code><technical_language>nit: if this, "ForLookup" (U is capital)</technical_language>

Target:
public QueryRunner<T> getRunner(QuerySegmentWalker walker) { return getQuerySegmentSpecForLookUp(this).lookup(this, walker); }
Source:
<code>private static void validateEmail(String value) throws WSSecurityException { <START> final EmailValidator validator = EmailValidator.getInstance(); <END> if (!validator.isValid(value)) { throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid email address."); } }</code><technical_language>need create a variable here. EmailValidator.getInstance().isvalid()</technical_language>

Target:
private static void validateEmail(String value) throws WSSecurityException { if (!EmailValidator.getInstance().isValid(value)) { throw new WSSecurityException(ErrorCode.FAILURE, "Not a valid email address."); } }
Source:
<code>public void calculateFromDerivedFields() { numHomVar = Math.round(TOTAL_SNPS / (HET_HOMVAR_RATIO + 1.0)); numHets = TOTAL_SNPS - numHomVar; calculateFromDerivedFields(TOTAL_HET_DEPTH); <START> } <END></code><technical_language>In case of Nan, denominator zero....so easy</technical_language>

Target:
public void calculateFromDerivedFields() { numHomVar = invertFromRatio(TOTAL_SNPS, HET_HOMVAR_RATIO); numHets = TOTAL_SNPS - numHomVar; calculateFromDerivedFields(TOTAL_HET_DEPTH); }
Source:
<code>private String envName(Secret secret, String key) throws InfrastructureException { String mountEnvName; if (secret.getData().size() == 1) { try { mountEnvName = firstNonNull( <START> secret.getMetadata().getAnnotations().get("envName"), <END> secret.getMetadata().getAnnotations().get(key + ".envName")); } catch (NullPointerException e) { throw new InfrastructureException( format( "Unable to mount secret '%s': it has to be mounted as Env, but env name is not specified." + "Please make sure you specified 'envName' annotation of secret.'", secret.getMetadata().getName())); } } else { mountEnvName = secret.getMetadata().getAnnotations().get(key + ".envName"); if (mountEnvName == null) { throw new InfrastructureException( format( "Unable to mount key '%s' of secret '%s': it has to be mounted as Env, but env name is not specified." + "Please make sure you specified '%s.envName' annotation of secret.'", key, secret.getMetadata().getName(), key)); } } return mountEnvName; }</code><technical_language>envName -> org.eclipse.che/env-name</technical_language>

Target:
private String envName(Secret secret, String key) throws InfrastructureException { String mountEnvName; if (secret.getData().size() == 1) { try { mountEnvName = firstNonNull( secret.getMetadata().getAnnotations().get(ANNOTATION_ENV_NAME), secret .getMetadata() .getAnnotations() .get(format(ANNOTATION_ENV_NAME_TEMPLATE, key))); } catch (NullPointerException e) { throw new InfrastructureException( format( "Unable to mount secret '%s': It is configured to be mount as a environment variable, but its was not specified. Please define the '%s' annotation on the secret to specify it.", secret.getMetadata().getName(), ANNOTATION_ENV_NAME)); } } else { mountEnvName = secret.getMetadata().getAnnotations().get(format(ANNOTATION_ENV_NAME_TEMPLATE, key)); if (mountEnvName == null) { throw new InfrastructureException( format( "Unable to mount key '%s' of secret '%s': It is configured to be mount as a environment variable, but its was not specified. Please define the '%s' annotation on the secret to specify it.", key, secret.getMetadata().getName(), format(ANNOTATION_ENV_NAME_TEMPLATE, key))); } } return mountEnvName; }
Source:
<code>public void editTitle(AgentPrincipals agent, PID pid, String title) throws Exception { try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit titles", pid, agent.getPrincipals(), Permission.editDescription); ContentObject obj = (ContentObject) repoObjLoader.getRepositoryObject(pid); BinaryObject mods = obj.getDescription(); <START> String username = agent.getUsername(); <END> String newMods; InputStream modsStream; try { modsStream = mods.getBinaryStream(); } catch (NullPointerException e) { modsStream = null; } if (modsStream != null) { String modsString = IOUtils.toString(modsStream, StandardCharsets.UTF_8); ByteArrayInputStream modsByteArray = new ByteArrayInputStream(modsString.getBytes()); SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false)); Document document = sb.build(modsByteArray); Element rootEl = document.getRootElement(); String oldTitle = getOldTitle(rootEl); if (oldTitle != "no mods:title") { newMods = updateTitle(document, title); } else { newMods = addTitleToMODS(document, title); } } else { Document document = new Document(); document.addContent(new Element("mods", MODS_V3_NS)); newMods = addTitleToMODS(document, title); } InputStream newModsStream = new ByteArrayInputStream(newMods.getBytes()); modsValidator.validate(newModsStream); obj.setDescription(newModsStream); } operationsMessageSender.sendUpdateDescriptionOperation(agent.getUsername(), Arrays.asList(pid)); }</code><technical_language>This variable moment, remove</technical_language>

Target:
public void editTitle(AgentPrincipals agent, PID pid, String title) { try (Timer.Context context = timer.time()) { aclService.assertHasAccess( "User does not have permissions to edit titles", pid, agent.getPrincipals(), Permission.editDescription); ContentObject obj = (ContentObject) repoObjLoader.getRepositoryObject(pid); BinaryObject mods = obj.getDescription(); Document newMods; InputStream modsStream; if (mods != null) { modsStream = mods.getBinaryStream(); } else { modsStream = null; } if (modsStream != null) { SAXBuilder sb = new SAXBuilder(new XMLReaderSAX2Factory(false)); Document document; try { document = sb.build(modsStream); } catch (IOException | JDOMException e) { throw new ServiceException("Unable to build mods document for " + pid, e); } Element rootEl = document.getRootElement(); if (hasExistingTitle(rootEl)) { newMods = updateTitle(document, title); } else { newMods = addTitleToMODS(document, title); } } else { Document document = new Document(); document.addContent(new Element("mods", MODS_V3_NS)); newMods = addTitleToMODS(document, title); } InputStream newModsStream; try { ByteArrayOutputStream outStream = new ByteArrayOutputStream(); new XMLOutputter().output(newMods, outStream); newModsStream = new ByteArrayInputStream(outStream.toByteArray()); } catch (IOException e) { throw new ServiceException("Unable to build new mods stream for " + pid, e); } modsValidator.validate(newModsStream); obj.setDescription(newModsStream); } operationsMessageSender.sendUpdateDescriptionOperation(agent.getUsername(), Arrays.asList(pid)); }
Source:
<code>public void testGetRawRoutingData() <START> throws IOException { <END> Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); _testRawRoutingData .forEach((realm, keys) -> Assert.assertEquals(rawRoutingData.get(realm), keys)); }</code><technical_language>Nit, a change for helix style IntelliJ. new change, this line wrapped. update style format it</technical_language>

Target:
public void testGetRawRoutingData() throws IOException { Map<String, List<String>> rawRoutingData = HttpRoutingDataReader.getRawRoutingData(); _testRawRoutingData.forEach((realm, keys) -> Assert .assertEquals(new HashSet(rawRoutingData.get(realm)), new HashSet(keys))); }
Source:
<code><START> public int hashCode() { <END> return root.hashCode(); }</code><technical_language>hashCode equals inconsistent</technical_language>

Target:
public int hashCode() { return root.hashCode() ^ refs.hashCode(); }
Source:
<code>public static String getJarVersionNumber() { Class clazz = SelendroidStandaloneDriver.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); String version = ""; if (!classPath.startsWith("jar")) { String dev_path = ""; if(classPath.startsWith("file") && classPath.contains("target")) dev_path = classPath.substring(5, classPath.lastIndexOf("target")); try { version = getVersionFromPom(dev_path); } catch (Exception e) { e.printStackTrace(); <START> return "pom file path may not exist"; <END> } } else { try { version = getVersionFromManifest(classPath); } catch (IOException e){ return ""; } } return version; }</code><technical_language>if this is default fallback, return "dev" instead</technical_language>

Target:
public static String getJarVersionNumber() { Class clazz = SelendroidStandaloneDriver.class; String className = clazz.getSimpleName() + ".class"; String classPath = clazz.getResource(className).toString(); if (!classPath.startsWith("jar")) { return "dev"; } String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF"; Manifest manifest; try { manifest = new Manifest(new URL(manifestPath).openStream()); } catch (Exception e) { return ""; } Attributes attr = manifest.getMainAttributes(); return attr.getValue("version"); }
Source:
<code>public MockResponse dispatch(RecordedRequest request) { String path = request.getPath(); String method = request.getMethod(); switch (method.toUpperCase()) { <START> case POST: case PUT: <END> return handleCreate(path, request.getBody().readUtf8()); case PATCH: return handlePatch(path, request.getBody().readUtf8()); case GET: return detectWatchMode(path)? handleWatch(request): handleGet(path); case DELETE: return handleDelete(path); default: return null; } }</code><technical_language>Is ADDED right event received for a replace operation</technical_language>

Target:
public MockResponse dispatch(RecordedRequest request) { String path = request.getPath(); String method = request.getMethod(); switch (method.toUpperCase()) { case POST: return handleCreate(path, request.getBody().readUtf8()); case PUT: return handleReplace(path, request.getBody().readUtf8()); case PATCH: return handlePatch(path, request.getBody().readUtf8()); case GET: return detectWatchMode(path)? handleWatch(path): handleGet(path); case DELETE: return handleDelete(path); default: return null; } }
Source:
<code>public void run(SourceContext sourceContext) { Random random = new Random(); for (int i = 0; i < recordCount; i++) { Row row = Row.of(random.nextInt(1000), NAMES[random.nextInt(NAMES.length)], random.nextDouble()); sourceContext.collect(row); } <START> <END> }</code><technical_language>Remove empty line</technical_language>

Target:
public void run(SourceContext sourceContext) { Random random = new Random(); for (int i = 0; i < NAMES.length; i++) { Row row = Row.of(i, NAMES[i]); sourceContext.collect(row); } }
Source:
<code>public void testGetDocContent_markAllDocsPublic() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.<String, String>of ( "adaptor.markAllDocsAsPublic", "true")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); <START> mockDocument(os, id, DOCUMENT_TIMESTAMP, true, 1000d, "text/plain"); <END> DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); traverser.getDocContent(new Id(id), request, response); assertEquals( ImmutableSet.of(PropertyNames.ID, PropertyNames.DATE_LAST_MODIFIED, PropertyNames.CONTENT_SIZE, PropertyNames.MIME_TYPE), response.getMetadata().getKeys()); assertEquals("text/plain", response.getContentType()); byte[] actualContent = baos.toByteArray(); assertEquals("sample content", new String(actualContent, UTF_8)); assertFalse(response.isSecure()); assertNull(response.getAcl()); assertTrue(response.getNamedResources().isEmpty()); }</code><technical_language>wildly persuaded mock permissions set it. I get null empty ACL distinction, explicit tests</technical_language>

Target:
public void testGetDocContent_markAllDocsPublic() throws Exception { options = TestObjectFactory.newConfigOptions( ImmutableMap.<String, String>of ( "adaptor.markAllDocsAsPublic", "true")); String id = "{AAAAAAAA-0000-0000-0000-000000000000}"; DocId docId = newDocId(new Id(id)); MockObjectStore os = getObjectStore(); mockDocument(os, id, DOCUMENT_TIMESTAMP, true, TestObjectFactory.getPermissions( PermissionSource.SOURCE_DIRECT, PermissionSource.SOURCE_TEMPLATE, PermissionSource.SOURCE_PARENT)); DocumentTraverser traverser = new DocumentTraverser(options); Request request = new MockRequest(docId); ByteArrayOutputStream baos = new ByteArrayOutputStream(); RecordingResponse response = new RecordingResponse(baos); traverser.getDocContent(new Id(id), request, response); assertEquals( ImmutableSet.of(PropertyNames.ID, PropertyNames.DATE_LAST_MODIFIED), response.getMetadata().getKeys()); byte[] actualContent = baos.toByteArray(); assertEquals("sample content", new String(actualContent, UTF_8)); assertFalse(response.isSecure()); assertNull(response.getAcl()); assertTrue(response.getNamedResources().isEmpty()); }
Source:
<code>public boolean isFinished() { double distanceSum = 0; for (int i = 0; i < encoders.length; i++) { try { distanceSum += encoders[i].getDistanceSafely() - initialDistances[i]; LogKitten.d("Encoder " + i + " reads " + encoders[i].getDistanceSafely() + " out of " + distance); } catch (InvalidSensorException e) { cancel(); if (fallbackCommand != null) { <START> fallbackCommand.initialize(); <END> } return true; } } double distanceAvg = distanceSum / encoders.length; return distanceAvg >= distance; }</code><technical_language>initialize() schedule()</technical_language>

Target:
public boolean isFinished() { double distanceSum = 0; for (int i = 0; i < encoders.length; i++) { try { distanceSum += encoders[i].getDistanceSafely() - initialDistances[i]; LogKitten.d("Encoder " + i + " reads " + encoders[i].getDistanceSafely() + " out of " + distance); } catch (InvalidSensorException e) { cancel(); if (fallbackCommand != null) { fallbackCommand.schedule(); } return true; } } return distanceSum / (double) encoders.length >= distance; }
Source:
<code>private boolean matches(final PairedReadSequence lhs, final PairedReadSequence rhs, final double maxDiffRate, final boolean useBarcodes) { final int read1Length = Math.min(lhs.read1.length, rhs.read1.length); final int read2Length = Math.min(lhs.read2.length, rhs.read2.length); final int maxErrors = (int) Math.floor((read1Length + read2Length) * maxDiffRate); int errors = 0; if (useBarcodes) { <START> if (((PairedReadSequenceWithBarcodes) lhs).barcode != ((PairedReadSequenceWithBarcodes) rhs).barcode) return false; <END> if (((PairedReadSequenceWithBarcodes) lhs).readOneBarcode != ((PairedReadSequenceWithBarcodes) rhs).readOneBarcode) return false; if (((PairedReadSequenceWithBarcodes) lhs).readTwoBarcode != ((PairedReadSequenceWithBarcodes) rhs).readTwoBarcode) return false; } for (int i = MIN_IDENTICAL_BASES; i < read1Length; ++i) { if (lhs.read1[i] != rhs.read1[i]) { if (++errors > maxErrors) return false; } } for (int i = MIN_IDENTICAL_BASES; i < read2Length; ++i) { if (lhs.read2[i] != rhs.read2[i]) { if (++errors > maxErrors) return false; } } return true; }</code><technical_language>refactor casting</technical_language>

Target:
private boolean matches(final PairedReadSequence lhs, final PairedReadSequence rhs, final double maxDiffRate, final boolean useBarcodes) { final int read1Length = Math.min(lhs.read1.length, rhs.read1.length); final int read2Length = Math.min(lhs.read2.length, rhs.read2.length); final int maxErrors = (int) Math.floor((read1Length + read2Length) * maxDiffRate); int errors = 0; if (useBarcodes) { final PairedReadSequenceWithBarcodes lhsWithBarcodes = (PairedReadSequenceWithBarcodes) lhs; final PairedReadSequenceWithBarcodes rhsWithBarcodes = (PairedReadSequenceWithBarcodes) rhs; if (lhsWithBarcodes.barcode != rhsWithBarcodes.barcode || lhsWithBarcodes.readOneBarcode != rhsWithBarcodes.readOneBarcode || lhsWithBarcodes.readTwoBarcode != rhsWithBarcodes.readTwoBarcode) { return false; } } for (int i = MIN_IDENTICAL_BASES; i < read1Length; ++i) { if (lhs.read1[i] != rhs.read1[i]) { if (++errors > maxErrors) return false; } } for (int i = MIN_IDENTICAL_BASES; i < read2Length; ++i) { if (lhs.read2[i] != rhs.read2[i]) { if (++errors > maxErrors) return false; } } return true; }
Source:
<code>public AccessControlPolicyIterator getApplicablePolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } JcrAccessControlList acl = getApplicableACL(absPath); if (!acl.isEmpty() && !acl.hasPrivileges(securityContext(), new Privilege[] { privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL) })) { throw new AccessDeniedException(); } CachedNode node = session.cachedNode(session.pathFactory().create(absPath), false); <START> if (node.hasACL(session.cache())) { <END> return AccessControlPolicyIteratorImpl.EMPTY; } return new AccessControlPolicyIteratorImpl(new JcrAccessControlList(this, absPath)); }</code><technical_language>I follow this logic. If node _does_ ACL child node, this method returns empty list? if node _does not_ ACL child node, return iterator AC policies</technical_language>

Target:
public AccessControlPolicyIterator getApplicablePolicies( String absPath ) throws PathNotFoundException, AccessDeniedException, RepositoryException { if (session.isReadOnly()) { throw new AccessDeniedException(JcrI18n.permissionDenied.text(absPath, "read access control content")); } JcrAccessControlList acl = getApplicableACL(absPath); if (!acl.isEmpty() && !acl.hasPrivileges(securityContext(), new Privilege[] { privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL) })) { throw new AccessDeniedException(); } CachedNode node = session.cachedNode(session.pathFactory().create(absPath), false); if (node.hasACL(session.cache())) { return AccessControlPolicyIteratorImpl.EMPTY; } else { return new AccessControlPolicyIteratorImpl(new JcrAccessControlList(this, absPath)); } }
Source:
<code>public ActionEventRequest deserialize(JsonElement element, Type type, JsonDeserializationContext context) { <START> LOGGER.debug("Deserializing the json into ActionEventRequest object"); <END> ActionEventRequest actionEvent = null; if (element.isJsonObject()) { JsonObject jsonObject = element.getAsJsonObject(); actionEvent = new ActionEventRequestBuilder().setDisplayName(getValue(jsonObject, DISPLAY_NAME_FIELD)) .setSubject(getValue(jsonObject, SUBJECT_FIELD)).setDescription(getValue(jsonObject, DESCRIPTION_FIELD)) .setServiceInterface(getValue(jsonObject, SERVICE_INTERFACE_FIELD)) .setServiceMethod(getValue(jsonObject, SERVICE_METHOD_FIELD)) .setServiceMethodCallManner(getValue(jsonObject, SERVICE_METHOD_CALL_MANNER_FIELD)) .setName(getValue(jsonObject, NAME_FIELD)).createActionEventRequest(); if (jsonObject.has(ACTION_PARAMETERS_FIELD)) { JsonArray jsonArray = jsonObject.getAsJsonArray(ACTION_PARAMETERS_FIELD); for (int i = 0; i < jsonArray.size(); ++i) { ActionParameterRequest parameter = context.deserialize(jsonArray.get(i), ActionParameterRequest.class); boolean changeOrder = parameter.getOrder() == null; actionEvent.addParameter(parameter, changeOrder); } } if (!actionEvent.isValid()) { throw new JsonParseException("Channel action must contains subject and/or serviceInterface and serviceMethod"); } } return actionEvent; }</code><technical_language>Besides this trace, cares this</technical_language>

Target:
public ActionEventRequest deserialize(JsonElement element, Type type, JsonDeserializationContext context) { ActionEventRequest actionEvent = null; if (element.isJsonObject()) { JsonObject jsonObject = element.getAsJsonObject(); actionEvent = new ActionEventRequestBuilder().setDisplayName(getValue(jsonObject, DISPLAY_NAME_FIELD)) .setSubject(getValue(jsonObject, SUBJECT_FIELD)).setDescription(getValue(jsonObject, DESCRIPTION_FIELD)) .setServiceInterface(getValue(jsonObject, SERVICE_INTERFACE_FIELD)) .setServiceMethod(getValue(jsonObject, SERVICE_METHOD_FIELD)) .setServiceMethodCallManner(getValue(jsonObject, SERVICE_METHOD_CALL_MANNER_FIELD)) .setName(getValue(jsonObject, NAME_FIELD)).createActionEventRequest(); if (jsonObject.has(ACTION_PARAMETERS_FIELD)) { JsonArray jsonArray = jsonObject.getAsJsonArray(ACTION_PARAMETERS_FIELD); for (int i = 0; i < jsonArray.size(); ++i) { ActionParameterRequest parameter = context.deserialize(jsonArray.get(i), ActionParameterRequest.class); boolean changeOrder = parameter.getOrder() == null; actionEvent.addParameter(parameter, changeOrder); } } if (!actionEvent.isValid()) { throw new JsonParseException("Channel action must contains subject and/or serviceInterface and serviceMethod"); } } return actionEvent; }