auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testAddComponentWithLeakAwareByteBuf() { NoopResourceLeakTracker<ByteBuf> tracker = new NoopResourceLeakTracker<ByteBuf>(); <START> ByteBuf buffer = wrappedBuffer("hello world".getBytes()).slice(6, 5); <END> ByteBuf leakAwareBuf = wrap(buffer, tracker); CompositeByteBuf composite = compositeBuffer(); composite.addComponent(true, leakAwareBuf); byte[] result = new byte[5]; composite.component(0).readBytes(result); assertArrayEquals("world".getBytes(), result); }</code><technical_language>nit: getBytes(CharsetUtil.US_ASCII);</technical_language>

Target:
public void testAddComponentWithLeakAwareByteBuf() { NoopResourceLeakTracker<ByteBuf> tracker = new NoopResourceLeakTracker<ByteBuf>(); ByteBuf buffer = wrappedBuffer("hello world".getBytes(CharsetUtil.US_ASCII)).slice(6, 5); ByteBuf leakAwareBuf = wrap(buffer, tracker); CompositeByteBuf composite = compositeBuffer(); composite.addComponent(true, leakAwareBuf); byte[] result = new byte[5]; composite.component(0).readBytes(result); assertArrayEquals("world".getBytes(CharsetUtil.US_ASCII), result); composite.release(); }
Source:
<code><START> protected void scriptConsoleInitialized(ScriptConsole console){ <END> console.getCommand().addInputStreamListener(new ChartStreamDaemon2(console, dataSet, parser)); try { IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow()); IViewPart ivp = p.showView(GraphSelectorView.ID); String name = console.getName(); ((GraphSelectorView)ivp).createScriptSet(name.substring(name.lastIndexOf('/')+1), dataSet); } catch(WorkbenchException we) { we.printStackTrace(); } }</code><technical_language>Missing @Override annotation</technical_language>

Target:
protected void scriptConsoleInitialized(ScriptConsole console){ console.getCommand().addInputStreamListener(new ChartStreamDaemon2(console, dataSet, parser)); try { IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow()); IViewPart ivp = p.showView(GraphSelectorView.ID); String name = console.getName(); ((GraphSelectorView)ivp).createScriptSet(name.substring(name.lastIndexOf('/')+1), dataSet); } catch(WorkbenchException we) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.RunScriptChartAction_couldNotSwitchToGraphicPerspective, Messages.RunScriptChartAction_couldNotSwitchToGraphicPerspective + ": " + we.getMessage()); } }
Source:
<code>public InputStream getInputStream(GzipEntry entry) { if <START> (entry.equals(fEntry)) <END> { return fInternalEntryStream; } throw new IllegalArgumentException(); }</code><technical_language>I == is right here. want "equivalent" entries a Gzipfile return inputstream this file</technical_language>

Target:
public InputStream getInputStream(GzipEntry entry) { if (entry != fEntry) { throw new IllegalArgumentException(); } return fInternalEntryStream; }
Source:
<code>public JobResult process(final Job job) { String path = (String) job.getProperty(CacheInvalidationJobConstants.PAYLOAD_KEY_DATA_CHANGE_PATH); if (StringUtils.isEmpty(path)) { log.error("Invalidation job doesn't have path information."); return JobResult.CANCEL; } invalidate(path); if(invalidateRefs) { invalidateReferences(path); } <START> log.trace("Invalidation job for the path '[}' processed.", path); <END> return JobResult.OK; }</code><technical_language>suggestion log.trace("Invalidation job for path [ ] processed.", path);</technical_language>

Target:
public JobResult process(final Job job) { String path = (String) job.getProperty(CacheInvalidationJobConstants.PAYLOAD_KEY_DATA_CHANGE_PATH); if (StringUtils.isEmpty(path)) { log.error("Invalidation job doesn't have path information."); return JobResult.CANCEL; } invalidate(path); if(invalidateRefs) { invalidateReferences(path); } log.trace("Invalidation job for the path [ ] processed.", path); return JobResult.OK; }
Source:
<code>public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); <START> System.out.println(new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(metrics)); <END> assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.paxos.ManagedTimestampService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.LockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }</code><technical_language>nit: I this accidentally left in</technical_language>

Target:
public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.paxos.ManagedTimestampService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.LockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }
Source:
<code><START> protected String formatTime(String time) { <END> long microseconds = 0; try { String[] times = time.split("\\."); microseconds += Long.parseLong(times[0]) * 1000000; microseconds += Long.parseLong(times[1]); } catch (NumberFormatException ex) { GdbPlugin.log(ex); } Date date = new Date(microseconds / 1000); return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date); }</code><technical_language>some safety checks here. time "" for GDB 7.2 GDB 7.3. java.lang.NumberFormatException: For input string: "" java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) java.lang.Long.parseLong(Long.java:431) java.lang.Long.parseLong(Long.java:468) org.eclipse.cdt.dsf.gdb.internal.ui.tracepoints.TraceControlView.formatTime(TraceControlView.java:1399)</technical_language>

Target:
protected String formatTime(String time) { long milliseconds = getTimeMilliseconds(time); Date date = new Date(milliseconds); long currentTime = System.currentTimeMillis(); long days = TimeUnit.MILLISECONDS.toDays(currentTime - milliseconds); if (days == 0) { return TracepointsMessages.bind(TracepointsMessages.TraceControlView_today, DateFormat.getTimeInstance(DateFormat.SHORT).format(date)); } else if (days == 1) { return TracepointsMessages.bind(TracepointsMessages.TraceControlView_yesterday, DateFormat.getTimeInstance(DateFormat.SHORT).format(date)); } return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(date); }
Source:
<code>public Color getColor(RGB rgb) { Color color = fColorTable.get(rgb); if (color == null) { <START> Display.getDefault().syncExec(() <END> -> fColorTable.put(rgb, new Color(Display.getCurrent(), rgb))); color = fColorTable.get(rgb); } return color; }</code><technical_language>This PlatformUI.getWorkbench().getDisplay()</technical_language>

Target:
public Color getColor(RGB rgb) { Color color = fColorTable.get(rgb); if (color == null) { PlatformUI.getWorkbench().getDisplay().syncExec(() -> fColorTable.put(rgb, new Color(Display.getCurrent(), rgb))); color = fColorTable.get(rgb); } return color; }
Source:
<code>public void resetPassword(String userId, String token, String newPassword) throws com.dotmarketing.business.NoSuchUserException, DotSecurityException, DotInvalidTokenException, DotInvalidPasswordException { try { if(UtilMethods.isSet(userId) && UtilMethods.isSet(token)) { User user = APILocator.getUserAPI().loadUserById(userId); if (user == null){ throw new com.dotmarketing.business.NoSuchUserException(""); } String tokenInfo = user.getIcqId(); if(UtilMethods.isSet(tokenInfo) && tokenInfo.matches("^[a-zA-Z0-9]+:[0-9]+$")) { String userToken = tokenInfo.substring(0,tokenInfo.indexOf(':')); if(userToken.equals(token)) { <START> Calendar ttl = Calendar.getInstance(); <END> ttl.setTimeInMillis(Long.parseLong(tokenInfo.substring(tokenInfo.indexOf(':')+1))); ttl.add(Calendar.MINUTE, Config.getIntProperty("RECOVER_PASSWORD_TOKEN_TTL_MINS", 20)); if(ttl.after(Calendar.getInstance())) { APILocator.getUserAPI().updatePassword(user, newPassword, APILocator.getUserAPI().getSystemUser(), false); } else { throw new DotInvalidTokenException(tokenInfo, true); } } else { throw new DotInvalidTokenException(tokenInfo); } }else{ throw new DotInvalidTokenException(tokenInfo); } } } catch (DotDataException e) { throw new IllegalArgumentException(); } }</code><technical_language>This encapsulate DateUtils</technical_language>

Target:
public void resetPassword(String userId, String token, String newPassword) throws com.dotmarketing.business.NoSuchUserException, DotSecurityException, DotInvalidTokenException, DotInvalidPasswordException { try { if(UtilMethods.isSet(userId) && UtilMethods.isSet(token)) { User user = APILocator.getUserAPI().loadUserById(userId); if (user == null){ throw new com.dotmarketing.business.NoSuchUserException(""); } ResetPasswordTokenUtil.checkToken(user, token); } } catch (DotDataException e) { throw new IllegalArgumentException(); } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_course_unit_video, container, false); messageContainer = view.findViewById(R.id.message_container); <START> transcriptListView = (ListView) view.findViewById(R.id.transcript_listview); <END> if (showCastMiniController()) { view.findViewById(R.id.fl_mini_controller).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.fl_mini_controller).setVisibility(View.GONE); } return view; }</code><technical_language>(ListView) removed</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_course_unit_video, container, false); messageContainer = view.findViewById(R.id.message_container); transcriptListView = view.findViewById(R.id.transcript_listview); if (showCastMiniController()) { view.findViewById(R.id.fl_mini_controller).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.fl_mini_controller).setVisibility(View.GONE); } return view; }
Source:
<code><START> public void insertUserAuthorities(UserDetails user) { <END> for (GrantedAuthority auth : user.getAuthorities()) { getJdbcTemplate().update(createAuthoritySql, user.getUsername(), auth.getAuthority()); } }</code><technical_language>understand changed scope of this method (along other methods listed in PR)? align goal of ticket me</technical_language>

Target:
private void insertUserAuthorities(UserDetails user) { for (GrantedAuthority auth : user.getAuthorities()) { getJdbcTemplate().update(createAuthoritySql, user.getUsername(), auth.getAuthority()); } }
Source:
<code>public <Q, R> AsyncFuture<R> request( final GrpcDescriptor<Q, R> endpoint, final Q entity, final CallOptions options ) { return channel.doto(channel -> { final byte[] body; try { body = mapper.writeValueAsBytes(entity); } catch (JsonProcessingException e) { return async.failed(e); } final ClientCall<byte[], byte[]> call = channel.newCall(endpoint.descriptor(), options); final Metadata metadata = new Metadata(); final ResolvableFuture<R> future = async.future(); call.start(new ClientCall.Listener<byte[]>() { @Override public void onMessage(final byte[] message) { final R response; try { response = mapper.readValue(message, endpoint.responseType()); } catch (IOException e) { future.fail(e); return; } future.resolve(response); } @Override public void onClose(final Status status, final Metadata trailers) { if (status.isOk()) { if (!future.isDone()) { <START> future.fail(new RuntimeNodeException(getUri(), <END> "Request finished without response")); } } else { future.fail(new RuntimeNodeException(getUri(), "Request finished with status code (" + status + ")")); } } @Override public void onHeaders(final Metadata headers) { } @Override public void onReady() { } }, metadata); call.sendMessage(body); call.setMessageCompression(true); call.request(1); call.halfClose(); return future.onFailed(e -> errors.mark()); }); }</code><technical_language>a more cases this fail. Instead of mangling exception here, done cluster node layer catch AsyncFuture#catchError(...)</technical_language>

Target:
public <Q, R> AsyncFuture<R> request( final GrpcDescriptor<Q, R> endpoint, final Q entity, final CallOptions options ) { return channel.doto(channel -> { final byte[] body; try { body = mapper.writeValueAsBytes(entity); } catch (JsonProcessingException e) { return async.failed(e); } final ClientCall<byte[], byte[]> call = channel.newCall(endpoint.descriptor(), options); final Metadata metadata = new Metadata(); final ResolvableFuture<R> future = async.future(); call.start(new ClientCall.Listener<byte[]>() { @Override public void onMessage(final byte[] message) { final R response; try { response = mapper.readValue(message, endpoint.responseType()); } catch (IOException e) { future.fail(e); return; } future.resolve(response); } @Override public void onClose(final Status status, final Metadata trailers) { if (status.isOk()) { if (!future.isDone()) { future.fail(new RuntimeException("Request finished without response")); } } else { future.fail(new RuntimeException( "Request finished with status code (" + status + ")")); } } @Override public void onHeaders(final Metadata headers) { } @Override public void onReady() { } }, metadata); call.sendMessage(body); call.setMessageCompression(true); call.request(1); call.halfClose(); return future.onFailed(e -> errors.mark()); }); }
Source:
<code>public static void build(StringBuilder result, HaxeFieldModel namedComponent, boolean isGetter) { Boolean isStatic = namedComponent.isStatic(); String name = namedComponent.getName(); String type = namedComponent.getResultType().isUnknown() ? "" : namedComponent.getResultType().toStringWithoutConstant(); if (isStatic) { result.append("static "); } result.append("function "); result.append(isGetter ? HaxePresentableUtil.getterName(name) : HaxePresentableUtil.setterName(name)); result.append("("); if (!isGetter) { result.append("value"); if (!type.isEmpty()) { result.append(":"); result.append(type); } } result.append(")"); <START> if (isGetter && !type.isEmpty()) { <END> result.append(":"); result.append(type); } result.append("{\n"); if (isGetter) { result.append("return "); result.append(name); result.append(";"); } else { result.append("return "); if (!isStatic) { result.append("this."); } result.append(name); result.append("= value;"); } result.append("\n}"); }</code><technical_language>I setters return type/value set well</technical_language>

Target:
public static void build(StringBuilder result, HaxeFieldModel namedComponent, boolean isGetter) { Boolean isStatic = namedComponent.isStatic(); String name = namedComponent.getName(); String type = namedComponent.getResultType().isUnknown() ? "" : namedComponent.getResultType().toStringWithoutConstant(); if (isStatic) { result.append("static "); } result.append("function "); result.append(isGetter ? HaxePresentableUtil.getterName(name) : HaxePresentableUtil.setterName(name)); result.append("("); if (!isGetter) { result.append("value"); if (!type.isEmpty()) { result.append(":"); result.append(type); } } result.append(")"); if (!type.isEmpty()) { result.append(":"); result.append(type); } result.append("{\n"); if (isGetter) { result.append("return "); result.append(name); result.append(";"); } else { result.append("return "); if (!isStatic) { result.append("this."); } result.append(name); result.append("= value;"); } result.append("\n}"); }
Source:
<code><START> private void loadConfig() { <END> Object type = module.getConfiguration().get(SCRIPT_TYPE); Object script = module.getConfiguration().get(SCRIPT); if (isNotValid(type) || isNotValid(script)) { throw new IllegalStateException( String.format("Type is missing in the configuration of module '%s'.", module.getId())); } else { this.type = (String) type; this.script = (String) script; } }</code><technical_language>this removal individual error description lost</technical_language>

Target:
private void loadConfig() { Object type = module.getConfiguration().get(SCRIPT_TYPE); Object script = module.getConfiguration().get(SCRIPT); if (!isValid(type)) { throw new IllegalStateException(String.format("Type is missing in the configuration of module '%s'.", module.getId())); } else if (!isValid(script)) { throw new IllegalStateException(String.format("Script is missing in the configuration of module '%s'.", module.getId())); } else { this.type = (String) type; this.script = (String) script; } }
Source:
<code>@Test void testNiladicForBigQuery() throws Exception { final SchemaPlus rootSchema = Frameworks.createRootSchema(true); final FrameworkConfig config = Frameworks.newConfigBuilder() .parserConfig(SqlParser.config().withConformance(SqlConformanceEnum.BIG_QUERY)) .defaultSchema(rootSchema) .build(); Planner planner = Frameworks.getPlanner(config); SqlNode node = planner.parse("select current_time, current_time(), current_date, " <START> + "current_date(), current_timestamp, current_timestamp()"); <END> planner.validate(node); }</code><technical_language>sql(xxx).withConformance(SqlConformanceEnum.BIG_QUERY).ok()</technical_language>

Target:
@Test void testNiladicForBigQuery() { sql("select current_time, current_time(), current_date, " + "current_date(), current_timestamp, current_timestamp()") .withConformance(SqlConformanceEnum.BIG_QUERY).ok(); }
Source:
<code>public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { URIStatus uriStatus = mFileSystem.getStatus(getAlluxioPath(path)); AlluxioURIStatus alluxioURIStatus = new AlluxioURIStatus(uriStatus.getFileInfo(), hiveFileContext); FileInStream fileInStream = mFileSystem.openFile(alluxioURIStatus, OpenFilePOptions.getDefaultInstance()); <START> return new FSDataInputStream(new AlluxioCachingHdfsFileInputStream(fileInStream, fileSystem.openFile(path, hiveFileContext), cacheValidationEnabled)); <END> }</code><technical_language>avoid fileSystem.openFile in case validation is disabled</technical_language>

Target:
public FSDataInputStream openFile(Path path, HiveFileContext hiveFileContext) throws Exception { URIStatus uriStatus = mFileSystem.getStatus(getAlluxioPath(path)); AlluxioURIStatus alluxioURIStatus = new AlluxioURIStatus(uriStatus.getFileInfo(), hiveFileContext); FileInStream fileInStream = mFileSystem.openFile(alluxioURIStatus, OpenFilePOptions.getDefaultInstance()); return new FSDataInputStream(new AlluxioCachingHdfsFileInputStream( fileInStream, (cacheValidationEnabled ? Optional.of(fileSystem.openFile(path, hiveFileContext)) : Optional.empty()), cacheValidationEnabled)); }
Source:
<code>public boolean isOwner() { if (canPerform(OWN, (short) 1)) { return true; } <START> if (!RefRight.ALL.equals(getRefName()) && getProjectControl().isOwner()) { <END> return true; } return false; }</code><technical_language>I a bug in this latest patch. line 107 modified considers RefRight.ALL is "refs/*" a RefControl instance "refs/*" refName member equals "refs/". So, correct code 107th line be: if (!RefRight.ALL.substring(0, RefRight.ALL.length() - 1).equals(getRefName()) && getProjectControl().isOwner())</technical_language>

Target:
public boolean isOwner() { if (canPerform(OWN, (short) 1)) { return true; } if (getRefName().equals( RefRight.ALL.substring(0, RefRight.ALL.length() - 1)) && getProjectControl().isOwner()) { return true; } return false; }
Source:
<code>public void checkIfNamespaceIsAllowed(String namespaceName) throws ValidationException { if (allowUserDefinedNamespaces) { return; } String defaultNamespace = evalPlaceholders(defaultNamespaceName, EnvironmentContext.getCurrent().getSubject(), null); if (!namespaceName.equals(defaultNamespace)) { throw new ValidationException( <START> "User defined namespaces are not allowed. You're able to specify only admin configured which is '" <END> + defaultNamespaceName + '\''); } }</code><technical_language>This message a better-worded, lines of java String.format("User defined namespaces allowed. default namespace '%s' is available", defaultNamespaceName) maybe</technical_language>

Target:
public void checkIfNamespaceIsAllowed(String namespaceName) throws ValidationException { if (allowUserDefinedNamespaces) { return; } String defaultNamespace = evalPlaceholders(defaultNamespaceName, EnvironmentContext.getCurrent().getSubject(), null); if (!namespaceName.equals(defaultNamespace)) { throw new ValidationException( format( "User defined namespaces are not allowed. Only the default namespace '%s' is available.", defaultNamespaceName)); } }
Source:
<code>public void init() { <START> String multipleImportStr = System.getProperty(DASHBUILDER_RUNTIME_MULTIPLE_IMPORT, "false"); String allowExternalStr = System.getProperty(ALLOW_EXTERNAL_FILE_REGISTER_PROP, "true"); <END> importFileLocation = System.getProperty(IMPORT_FILE_LOCATION_PROP); importsBaseDir = System.getProperty(IMPORTS_BASE_DIR_PROP, "/tmp/dashbuilder"); multipleImport = Boolean.parseBoolean(multipleImportStr); allowExternal = Boolean.parseBoolean(allowExternalStr); uploadSize = DEFAULT_UPLOAD_SIZE; String uploadSizeStr = System.getProperty(UPLOAD_SIZE_PROP); if (uploadSizeStr != null) { try { uploadSize = 1024 * Integer.parseInt(uploadSizeStr); } catch (Exception e) { logger.warn("Not able to parse upload size {}", uploadSizeStr); logger.debug("Not able to parse upload size {}", uploadSizeStr, e); } } }</code><technical_language>suggestion String multipleImportStr = System.getProperty(DASHBUILDER_RUNTIME_MULTIPLE_IMPORT, Boolean.FALSE.toString()); String allowExternalStr = System.getProperty(ALLOW_EXTERNAL_FILE_REGISTER_PROP, Boolean.TRUE.toString());</technical_language>

Target:
public void init() { String multipleImportStr = System.getProperty(DASHBUILDER_RUNTIME_MULTIPLE_IMPORT, Boolean.FALSE.toString()); String allowExternalStr = System.getProperty(ALLOW_EXTERNAL_FILE_REGISTER_PROP, Boolean.FALSE.toString()); importFileLocation = System.getProperty(IMPORT_FILE_LOCATION_PROP); importsBaseDir = System.getProperty(IMPORTS_BASE_DIR_PROP, "/tmp/dashbuilder"); multipleImport = Boolean.parseBoolean(multipleImportStr); allowExternal = Boolean.parseBoolean(allowExternalStr); uploadSize = DEFAULT_UPLOAD_SIZE; String uploadSizeStr = System.getProperty(UPLOAD_SIZE_PROP); if (uploadSizeStr != null) { try { uploadSize = 1024 * Integer.parseInt(uploadSizeStr); } catch (Exception e) { logger.warn("Not able to parse upload size {}", uploadSizeStr); logger.debug("Not able to parse upload size {}", uploadSizeStr, e); } } }
Source:
<code>public XWikiAttachment removeAttachment(XWikiAttachment attachmentToRemove, boolean toRecycleBin) { List<XWikiAttachment> list = getAttachmentList(); <START> if (!list.contains(attachmentToRemove)) { <END> attachmentToRemove = null; } else { list.remove(attachmentToRemove); this.attachmentsToRemove.add(new XWikiAttachmentToRemove(attachmentToRemove, toRecycleBin)); setMetaDataDirty(true); } return attachmentToRemove; }</code><technical_language>need this if. simply rely list.remove return (which is true remove)</technical_language>

Target:
public XWikiAttachment removeAttachment(XWikiAttachment attachmentToRemove, boolean toRecycleBin) { if (this.attachmentList.remove(attachmentToRemove)) { this.attachmentsToRemove.add(new XWikiAttachmentToRemove(attachmentToRemove, toRecycleBin)); setMetaDataDirty(true); } else { attachmentToRemove = null; } return attachmentToRemove; }
Source:
<code>SearchResult queryJira(JiraCheck jiraCheck) { Map<String, String> requestParams = new HashMap<>(); requestParams.put("maxResults", "30"); requestParams.put("jql", jiraCheck.getJql()); final String jiraApiUrl = jiraCheck.getUrl() + "/rest/api/2/search"; log.debug("Retrieving jira status with JQL {}", jiraCheck.getJql()); final SearchResult searchResult; try { final String resultAsString = restClient.create() .withCredentials(jiraCheck.getUserName(), jiraCheck.getPassword()) .withQueryParameters(requestParams) .withTimeout(CloseableHttpClientRestClient.THIRTY_SECONS_IN_MS) <START> .withHeader("accept-encoding", "application/json") <END> .get(jiraApiUrl); searchResult = gson.fromJson(resultAsString, SearchResult.class); } catch (Exception e) { log.error("error fetching jira results", e); throw new RuntimeException(e.getMessage(), e); } if (searchResult == null) { log.error("deserialized to null. [Url= " + jiraApiUrl + ",Query=" + jiraCheck.getJql() + "]"); throw new IllegalStateException("deserialized to null. [Query=" + jiraCheck.getJql() + "]"); } return searchResult; }</code><technical_language>this is valid header for accept-encoding. gzip;q=0 empty string works</technical_language>

Target:
SearchResult queryJira(JiraCheck jiraCheck) { Map<String, String> requestParams = new HashMap<>(); requestParams.put("maxResults", "30"); requestParams.put("jql", jiraCheck.getJql()); final String jiraApiUrl = jiraCheck.getUrl() + "/rest/api/2/search"; log.debug("Retrieving jira status with JQL {}", jiraCheck.getJql()); final SearchResult searchResult; try { final String resultAsString = restClient.create() .withCredentials(jiraCheck.getUserName(), jiraCheck.getPassword()) .withQueryParameters(requestParams) .withTimeout(CloseableHttpClientRestClient.THIRTY_SECONS_IN_MS) .withHeader("accept-encoding", "gzip;q=0") .get(jiraApiUrl); searchResult = gson.fromJson(resultAsString, SearchResult.class); } catch (Exception e) { log.error("error fetching jira results", e); throw new RuntimeException(e.getMessage(), e); } if (searchResult == null) { log.error("deserialized to null. [Url= " + jiraApiUrl + ",Query=" + jiraCheck.getJql() + "]"); throw new IllegalStateException("deserialized to null. [Query=" + jiraCheck.getJql() + "]"); } return searchResult; }
Source:
<code>public void init() throws MessagingException { <START> headerName = getInitParameter("headerName", String.class); <END> if (headerName == null || headerName.equals("")) { throw new MessagingException("Please configure a header name to contain the classification (if any)."); } }</code><technical_language>headerName = getInitParameter("headerName"); enough</technical_language>

Target:
public void init() throws MessagingException { headerName = getInitParameter("headerName"); if (headerName == null || headerName.equals("")) { throw new MessagingException("Please configure a header name to contain the classification (if any)."); } }
Source:
<code>private boolean doesPageContentsHaveContainer( final Table<String, String, Set<PersonalizedContentlet>> pageContents, final ContainerUUID containerUUID, final Container container) { if(pageContents.contains(container.getIdentifier(), containerUUID.getUUID())){ return true; } else if(pageContents.contains(container.getIdentifier(), ParseContainer.PARSE_CONTAINER_UUID_PREFIX + containerUUID.getUUID())) { <START> return true; <END> } else if (ContainerUUID.UUID_LEGACY_VALUE.equals(containerUUID.getUUID())) { boolean pageContenstContains = pageContents.contains(containerUUID.getIdentifier(), ContainerUUID.UUID_START_VALUE); if (!pageContenstContains && container instanceof FileAssetContainer) { pageContenstContains = pageContents.contains(container.getIdentifier(), ContainerUUID.UUID_START_VALUE); } return pageContenstContains; } else { return false; } }</code><technical_language>Agree. need a test a change API level</technical_language>

Target:
protected boolean doesPageContentsHaveContainer( final Table<String, String, Set<PersonalizedContentlet>> pageContents, final ContainerUUID containerUUID, final Container container) { if(pageContents.contains(container.getIdentifier(), containerUUID.getUUID())){ return true; } else if(pageContents.contains(container.getIdentifier(), ParseContainer.PARSE_CONTAINER_UUID_PREFIX + containerUUID.getUUID())) { return true; } else if (ContainerUUID.UUID_LEGACY_VALUE.equals(containerUUID.getUUID())) { boolean pageContenstContains = pageContents.contains(containerUUID.getIdentifier(), ContainerUUID.UUID_START_VALUE); if (!pageContenstContains && container instanceof FileAssetContainer) { pageContenstContains = pageContents.contains(container.getIdentifier(), ContainerUUID.UUID_START_VALUE); } return pageContenstContains; } else { return false; } }
Source:
<code>public void changeStatus(Integer requestId, String oldStatus, String newStatus) { Validate.isTrue(requestId != null, "Request id must be non null"); Validate.isTrue(StringUtils.isNotBlank(oldStatus), "Old status must be non-blank"); Validate.isTrue(StringUtils.isNotBlank(newStatus), "New status must be non-blank"); Validate.isTrue(!oldStatus.equals(newStatus), "Statuses must be different"); Date now = new Date(); <START> seriesImportDao.changeStatus(new UpdateImportRequestStatusDbDto(requestId, now, oldStatus, newStatus)); <END> }</code><technical_language>Please, extract a local variable: java Date = new Date(); UpdateImportRequestStatusDbDto status = new UpdateImportRequestStatusDbDto( requestId, now, oldStatus, newStatus ); seriesImportDao.changeStatus(status);</technical_language>

Target:
public void changeStatus(Integer requestId, String oldStatus, String newStatus) { Validate.isTrue(requestId != null, "Request id must be non null"); Validate.isTrue(StringUtils.isNotBlank(oldStatus), "Old status must be non-blank"); Validate.isTrue(StringUtils.isNotBlank(newStatus), "New status must be non-blank"); Validate.isTrue(!oldStatus.equals(newStatus), "Statuses must be different"); Date now = new Date(); UpdateImportRequestStatusDbDto status = new UpdateImportRequestStatusDbDto(requestId, now, oldStatus, newStatus); seriesImportDao.changeStatus(status); }
Source:
<code>public void prepare() throws Exception { projectName = NameGenerator.generate("project", 4); <START> WorkspaceConfigDto workspace = <END> DtoFactory.getInstance() .createDtoFromJson( readFileToString(new File(WS_CONFIG_PATH), Charset.forName("UTF-8")), WorkspaceConfigDto.class); workspace .getEnvironments() .get("replaced_name") .getMachines() .get("dev-machine") .setServers( Collections.singletonMap( GWT_CODESERVER_NAME, newDto(ServerConfigDto.class).withProtocol("http").withPort("9876"))); testWorkspace = new TestWorkspaceImpl( NameGenerator.generate("check-gwt-test", 4), testUser, 4, workspace, workspaceServiceClient); URL resource = getClass().getResource("/projects/web-gwt-java-simple"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), projectName, ProjectTemplates.MAVEN_SPRING); testCommandServiceClient.createCommand( "cd /projects/" + projectName + " && mvn clean install -DskipTests", BUILD_COMMAND, CUSTOM, testWorkspace.getId()); testCommandServiceClient.createCommand( "mvn clean gwt:run-codeserver -f ${current.project.path} -Dgwt.bindAddress=0.0.0.0", RUN_GWT_COMMAND, CUSTOM, testWorkspace.getId()); }</code><technical_language>Please, reuse utility for deserialization</technical_language>

Target:
public void prepare() throws Exception { projectName = NameGenerator.generate("project", 4); WorkspaceConfigDto workspace = workspaceDtoDeserializer.deserializeWorkspaceTemplate(CODENVY_UBUNTU_JDK8); workspace .getEnvironments() .get("replaced_name") .getMachines() .get("dev-machine") .getServers() .put( GWT_CODESERVER_NAME, newDto(ServerConfigDto.class).withProtocol("http").withPort("9876")); testWorkspace = new TestWorkspaceImpl( NameGenerator.generate("check-gwt-test", 4), testUser, 4, workspace, workspaceServiceClient); URL resource = getClass().getResource("/projects/web-gwt-java-simple"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), projectName, ProjectTemplates.MAVEN_SPRING); testCommandServiceClient.createCommand( "cd /projects/" + projectName + " && mvn clean install -DskipTests", BUILD_COMMAND, CUSTOM, testWorkspace.getId()); testCommandServiceClient.createCommand( "mvn clean gwt:run-codeserver -f ${current.project.path} -Dgwt.bindAddress=0.0.0.0", RUN_GWT_COMMAND, CUSTOM, testWorkspace.getId()); }
Source:
<code>public void afterClass() throws Exception { String testClassName = this.getShortClassName(); <START> System.out.println("AfterClass: " + testClassName + " of TestTaskSchedulingTwoCurrentStates called."); <END> super.afterClass(); }</code><technical_language>here. TestHelper methods</technical_language>

Target:
public void afterClass() throws Exception { super.afterClass(); }
Source:
<code>public void checkIndentation() { final DetailAST modifiers = getMainAst().findFirstToken(TokenTypes.MODIFIERS); final DetailAST ident = getMainAst().findFirstToken(TokenTypes.IDENT); if (getMainAst().getType() == TokenTypes.ANNOTATION_DEF) { <START> checkWrappingIndentation(getMainAst(), modifiers); <END> checkAnnotatioDefIndent(ident); } else { checkWrappingIndentation(getMainAst(), getListChild()); } if (modifiers.getChildCount() == 0) { final int lineStart = getLineStart(ident); if (!getIndent().isAcceptable(lineStart)) { logError(ident, "ident", lineStart); } } else { checkModifiers(); } super.checkIndentation(); }</code><technical_language>I removed this differences in test. Please explain is needed a example in input show it</technical_language>

Target:
public void checkIndentation() { final DetailAST modifiers = getMainAst().findFirstToken(TokenTypes.MODIFIERS); if (modifiers.getChildCount() == 0) { if (getMainAst().getType() != TokenTypes.ANNOTATION_DEF) { final DetailAST ident = getMainAst().findFirstToken(TokenTypes.IDENT); final int lineStart = getLineStart(ident); if (!getIndent().isAcceptable(lineStart)) { logError(ident, "ident", lineStart); } } } else { checkModifiers(); } if (getMainAst().getType() == TokenTypes.ANNOTATION_DEF) { final DetailAST atAst = getMainAst().findFirstToken(TokenTypes.AT); if (isOnStartOfLine(atAst)) { checkWrappingIndentation(getMainAst(), getListChild(), 0, getIndent().getFirstIndentLevel(), false); } } else { checkWrappingIndentation(getMainAst(), getListChild()); } super.checkIndentation(); }
Source:
<code>private boolean isInventoryWhitelisted(Inventory inventory) { <START> if (inventory == null) <END> return false; Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES); return whitelist.contains(inventory.getName()); }</code><technical_language>Please breaches</technical_language>

Target:
private boolean isInventoryWhitelisted(Inventory inventory) { if (inventory == null) { return false; } Set<String> whitelist = settings.getProperty(RestrictionSettings.UNRESTRICTED_INVENTORIES); return whitelist.contains(ChatColor.stripColor(inventory.getName())); }
Source:
<code>private void updateMidiValuesStartingAtNote(NoteName startingNote, NoteName currentActiveNote) { int correspondingMidiValue = startingNote.getMidi(); for (int i = 0; i < WHITE_KEY_COUNT; i++) { <END> while (NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } whitePianoKeys.get(i).setTag(correspondingMidiValue); whitePianoKeys.get(i).setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); correspondingMidiValue++; } <START> correspondingMidiValue = startingNote.getMidi(); for (int i = 0; i < BLACK_KEY_COUNT; i++) { while (!NoteName.getNoteNameFromMidiValue(correspondingMidiValue).isSigned()) { correspondingMidiValue++; } blackPianoKeys.get(i).setTag(correspondingMidiValue); blackPianoKeys.get(i).setText(NoteName.getNoteNameFromMidiValue(correspondingMidiValue).name()); correspondingMidiValue++; } updateButtonColors(currentActiveNote); }</code><technical_language>I prefer this in separate function avoid code duplication</technical_language>

Target:
private void updateMidiValuesStartingAtNote(NoteName startingNote, NoteName currentActiveNote) { int correspondingMidiValue = startingNote.getMidi(); for (PianoKeyType type : PianoKeyType.values()) { updateMidiValueOfType(type, correspondingMidiValue); } updatePianoKeyColors(currentActiveNote); }
Source:
<code>public void close() { _instanceCounter.dec(); _registry.removeMatching(new MetricFilter() { @Override public boolean matches(String name, Metric metric) { <START> if (name.equals(_instanceCounterName) && _instanceCounter.getCount() != 0) { <END> return false; } return _names.contains(name); } }); _names.clear(); }</code><technical_language>IDEA shows a warning for this line simplified</technical_language>

Target:
public synchronized void close() { _instanceCounter.dec(); if (_instanceCounter.getCount() == 0) { _registry.remove(_instanceCounterName); } for (String name : _names) { _registry.remove(name); } _names.clear(); }
Source:
<code><START> private CompletionStage<Void> deleteFromStoresAndNotify(K key, V value, Metadata metadata) { <END> deleteFromStores(key); if (cacheNotifier != null && cacheNotifier.hasListener(CacheEntryExpired.class)) { return cacheNotifier.notifyCacheEntryExpired(key, value, metadata, null); } return CompletableFutures.completedNull(); }</code><technical_language>join(), I return CompletionStage here</technical_language>

Target:
private void deleteFromStoresAndNotify(K key, V value, Metadata metadata) { deleteFromStores(key); CompletionStages.join(cacheNotifier.notifyCacheEntryExpired(key, value, metadata, null)); }
Source:
<code>private String getRecipientNames(Set<String> recipients) { StringBuilder namesStringBuilder = new StringBuilder(); int i = 0; for (String recipient : recipients) { if (i == recipients.size() - 1 && recipients.size() > 1) { namesStringBuilder.append("and "); } StudentAttributes student = roster.getStudentForEmail(recipient); if (courseId.equals(recipient)) { namesStringBuilder.append("<b>All students in this course</b>, "); } else if (student != null) { if (recipients.size() == 1) { namesStringBuilder.append("<b>" + student.name + " (" + student.team + ", " + student.email + ")</b>, "); } else { namesStringBuilder.append("<b>" + student.name + "</b>" + ", "); } } else { namesStringBuilder.append("<b>" + recipient + "</b>" + ", "); } i++; } String namesString = namesStringBuilder.toString(); return removeEndComma(namesString); <START> } <END></code><technical_language>is if this method takes roster a parameter. possible, feed method needs parameters. easier test</technical_language>

Target:
private String getRecipientNames(Set<String> recipients) { StringBuilder namesStringBuilder = new StringBuilder(); int i = 0; for (String recipient : recipients) { if (i == recipients.size() - 1 && recipients.size() > 1) { namesStringBuilder.append("and "); } StudentAttributes student = roster.getStudentForEmail(recipient); if (courseId.equals(recipient)) { namesStringBuilder.append("All students in this course, "); } else if (student != null) { if (recipients.size() == 1) { namesStringBuilder.append(student.name + " (" + student.team + ", " + student.email + "), "); } else { namesStringBuilder.append(student.name + ", "); } } else { namesStringBuilder.append(recipient + ", "); } i++; } String namesString = namesStringBuilder.toString(); return removeEndComma(namesString); }
Source:
<code>public void openOutsideWebsite(String url) { try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), "No application can handle this request. " + "Please install a map app.", Toast.LENGTH_SHORT).show(); <START> e.printStackTrace(); <END> } }</code><technical_language>Timber.e()</technical_language>

Target:
public void openOutsideWebsite(String url) { try { startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); } catch (ActivityNotFoundException e) { Toast.makeText(getActivity(), "No application can handle this request. " + "Please install a map app.", Toast.LENGTH_SHORT).show(); Timber.e(e, "No map application"); } }
Source:
<code>private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap, boolean useDefaults, IASTNode point) { for (ICPPTemplateParameter tpar : pars) { if (tpar.isParameterPack()) { ICPPTemplateArgument[] deducedArgs= tpMap.getPackExpansion(tpar); if (deducedArgs == null) { tpMap.put(tpar, ICPPTemplateArgument.EMPTY_ARGUMENTS); } else { for (ICPPTemplateArgument arg : deducedArgs) { if (arg == null) return false; } } } else { ICPPTemplateArgument deducedArg= tpMap.getArgument(tpar); if (deducedArg == null && useDefaults) { deducedArg= tpar.getDefaultValue(); if (deducedArg != null) { deducedArg= CPPTemplates.instantiateArgument(deducedArg, tpMap, -1, null, point); if (deducedArg != null) { if (deducedArg instanceof CPPTemplateTypeArgument) { CPPTemplateTypeArgument deducedTypeArg = (CPPTemplateTypeArgument) deducedArg; <START> if (!(deducedTypeArg.getTypeValue() instanceof IProblemBinding)) { <END> tpMap.put(tpar, deducedArg); } } else { tpMap.put(tpar, deducedArg); } } } } if (deducedArg == null) return false; } } return true; }</code><technical_language>I replaced IProblemBinding ISemanticProblem ProblemType is a IProblemBinding</technical_language>

Target:
private static boolean verifyDeduction(ICPPTemplateParameter[] pars, CPPTemplateParameterMap tpMap, boolean useDefaults, IASTNode point) { for (ICPPTemplateParameter tpar : pars) { if (tpar.isParameterPack()) { ICPPTemplateArgument[] deducedArgs= tpMap.getPackExpansion(tpar); if (deducedArgs == null) { tpMap.put(tpar, ICPPTemplateArgument.EMPTY_ARGUMENTS); } else { for (ICPPTemplateArgument arg : deducedArgs) { if (arg == null) return false; } } } else { ICPPTemplateArgument deducedArg= tpMap.getArgument(tpar); if (deducedArg == null && useDefaults) { deducedArg= tpar.getDefaultValue(); if (deducedArg != null) { deducedArg= CPPTemplates.instantiateArgument(deducedArg, tpMap, -1, null, point); if (deducedArg != null) { if (deducedArg instanceof CPPTemplateTypeArgument) { CPPTemplateTypeArgument deducedTypeArg = (CPPTemplateTypeArgument) deducedArg; if (!(deducedTypeArg.getTypeValue() instanceof ISemanticProblem)) { tpMap.put(tpar, deducedArg); } } else { tpMap.put(tpar, deducedArg); } } } } if (deducedArg == null) return false; } } return true; }
Source:
<code>protected void runNow(String ruleUID, boolean considerConditions, Map<String, Object> context) { RuntimeRule rule = getRuntimeRule(ruleUID); if (rule == null) { logger.warn("Failed to execute rule '{}': Invalid Rule UID", ruleUID); return; } synchronized (this) { final RuleStatus ruleStatus = getRuleStatus(ruleUID); if (ruleStatus != RuleStatus.IDLE) { logger.error("Failed to execute rule ‘{}' with status '{}'", ruleUID, ruleStatus.name()); return; } } <START> setRuleStatusInfo(ruleUID, new RuleStatusInfo(RuleStatus.TRIGGERED, RuleStatusDetail.NONE, null, context), <END> true); try { clearContext(rule); if (context != null && !context.isEmpty()) { getContext(ruleUID).putAll(context); } if (considerConditions) { if (calculateConditions(rule)) { setRuleStatusInfo(ruleUID, new RuleStatusInfo(RuleStatus.RUNNING), true); executeActions(rule, false); } } else { setRuleStatusInfo(ruleUID, new RuleStatusInfo(RuleStatus.RUNNING), true); executeActions(rule, false); } logger.debug("The rule '{}' is executed.", ruleUID); } catch (Throwable t) { logger.error("Fail to execute rule '{}': {}", new Object[] { ruleUID, t.getMessage() }, t); } synchronized (this) { if (getRuleStatus(ruleUID) == RuleStatus.TRIGGERED || getRuleStatus(ruleUID) == RuleStatus.RUNNING) { setRuleStatusInfo(ruleUID, new RuleStatusInfo(RuleStatus.IDLE), true); } } }</code><technical_language>Is intention set status of "synchronized" block? set status it..</technical_language>

Target:
protected void runNow(String ruleUID, boolean considerConditions, Map<String, Object> context) { RuntimeRule rule = getRuntimeRule(ruleUID); if (rule == null) { logger.warn("Failed to execute rule '{}': Invalid Rule UID", ruleUID); return; } try { changeRuleStatus(rule, RuleStatusInfo.createTriggeredStatusInfo(context), RuleStatus.IDLE); clearContext(rule); if (context != null && !context.isEmpty()) { getContext(ruleUID).putAll(context); } if (considerConditions) { if (calculateConditions(rule)) { changeRuleStatus(rule, RuleStatusInfo.create(RuleStatus.RUNNING), RuleStatus.TRIGGERED); executeActions(rule, false); } } else { changeRuleStatus(rule, RuleStatusInfo.create(RuleStatus.RUNNING), RuleStatus.TRIGGERED); executeActions(rule, false); } logger.debug("The rule '{}' is executed.", ruleUID); if (getRuleStatus(ruleUID) != RuleStatus.DISABLED) { changeRuleStatus(rule, RuleStatusInfo.create(RuleStatus.IDLE), RuleStatus.TRIGGERED, RuleStatus.RUNNING); } } catch (Throwable t) { logger.error("Fail to execute rule '{}': {}", new Object[] { ruleUID, t.getMessage() }, t); } }
Source:
<code>protected Pair<Boolean, StorageDomain> syncDomainLuns(StorageDomain storageDomain) { return new Pair<>( StorageHelperDirector.getInstance() .getItem(storageDomain.getStorageType()).syncDomainInfo(storageDomain, null), <START> storageDomain); <END> }</code><technical_language>pair Pair<Boolean, Guid>, need entire domain object</technical_language>

Target:
protected Pair<Boolean, Guid> syncDomainLuns(StorageDomain storageDomain) { return new Pair<>( StorageHelperDirector.getInstance() .getItem(storageDomain.getStorageType()).syncDomainInfo(storageDomain, null), storageDomain.getId()); }
Source:
<code>protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResetGlusterVolumeOptions, new ResetGlusterVolumeOptionsVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getVolumeOption(), getParameters().isForceAction())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { if (getParameters().getVolumeOption() != null && !(getParameters().getVolumeOption().getKey().isEmpty())) { <START> GlusterVolumeOptionEntity entity = getGlusterVolume().getOption(getParameters().getVolumeOption().getKey()); <END> String optionValue = entity.getValue(); removeOptionInDb(entity); isResetAllOptions = false; getParameters().getVolumeOption().setValue(optionValue != null ? optionValue : ""); } else { for (GlusterVolumeOptionEntity option : getGlusterVolume().getOptions()) { removeOptionInDb(option); } isResetAllOptions = true; } } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_OPTIONS_RESET_FAILED, returnValue.getVdsError().getMessage()); return; } }</code><technical_language>Please add null check for entity</technical_language>

Target:
protected void executeCommand() { VDSReturnValue returnValue = runVdsCommand(VDSCommandType.ResetGlusterVolumeOptions, new ResetGlusterVolumeOptionsVDSParameters(upServer.getId(), getGlusterVolumeName(), getParameters().getVolumeOption(), getParameters().isForceAction())); setSucceeded(returnValue.getSucceeded()); if (getSucceeded()) { if (getParameters().getVolumeOption() != null && !(getParameters().getVolumeOption().getKey().isEmpty())) { GlusterVolumeOptionEntity entity = getGlusterVolume().getOption(getParameters().getVolumeOption().getKey()); removeOptionInDb(entity); isResetAllOptions = false; if(entity != null) { String optionValue = entity.getValue(); getParameters().getVolumeOption().setValue(optionValue != null ? optionValue : ""); } } else { for (GlusterVolumeOptionEntity option : getGlusterVolume().getOptions()) { removeOptionInDb(option); } isResetAllOptions = true; } } else { handleVdsError(AuditLogType.GLUSTER_VOLUME_OPTIONS_RESET_FAILED, returnValue.getVdsError().getMessage()); return; } }