auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void setErrorResponse(HttpMessage msg, String responseStatus, Exception cause, String errorType) throws HttpMalformedHeaderException { StringBuilder strBuilder = new StringBuilder(); if (cause instanceof SSLException) { strBuilder.append("An exception occurred while attempting to connect to: "); strBuilder.append(msg.getRequestHeader().getURI().toString()).append('\n'); strBuilder.append("The exception was: " + cause.getMessage()); strBuilder.append('\n').append('\n'); strBuilder.append(Constant.messages.getString("network.sslconnector.handshake.error.help", Constant.messages.getString("network.sslconnector.handshake.error.help.url"))); <START> LOGGER.warn(strBuilder.toString()); <END> if (LOGGER.isDebugEnabled()) { LOGGER.debug(cause, cause); strBuilder.append("\n\nStack Trace:\n"); for (String stackTraceFrame : ExceptionUtils.getRootCauseStackTrace(cause)) { strBuilder.append(stackTraceFrame).append('\n'); } } } else { strBuilder.append(errorType) .append(" [") .append(cause.getClass().getName()) .append("]: ") .append(cause.getLocalizedMessage()) .append("\n\nStack Trace:\n"); for (String stackTraceFrame : ExceptionUtils.getRootCauseStackTrace(cause)) { strBuilder.append(stackTraceFrame).append('\n'); } } setErrorResponse(msg, responseStatus, strBuilder.toString()); }</code><technical_language>Default configuration show warnings. levels do in log4j.properties file</technical_language>

Target:
private static void setErrorResponse(HttpMessage msg, String responseStatus, Exception cause, String errorType) throws HttpMalformedHeaderException { StringBuilder strBuilder = new StringBuilder(); if (cause instanceof SSLException) { strBuilder.append(Constant.messages.getString("network.ssl.error.connect")); strBuilder.append(msg.getRequestHeader().getURI().toString()).append('\n'); strBuilder.append(Constant.messages.getString("network.ssl.error.exception")).append(cause.getMessage()) .append('\n'); strBuilder.append(Constant.messages.getString("network.ssl.error.exception.rootcause")) .append(ExceptionUtils.getRootCauseMessage(cause)).append('\n'); strBuilder.append(Constant.messages.getString("network.ssl.error.help", Constant.messages.getString("network.ssl.error.help.url"))); log.warn(strBuilder.toString()); if (log.isDebugEnabled()) { log.debug(cause, cause); strBuilder.append("\n\nStack Trace:\n"); for (String stackTraceFrame : ExceptionUtils.getRootCauseStackTrace(cause)) { strBuilder.append(stackTraceFrame).append('\n'); } } } else { strBuilder.append(errorType) .append(" [") .append(cause.getClass().getName()) .append("]: ") .append(cause.getLocalizedMessage()) .append("\n\nStack Trace:\n"); for (String stackTraceFrame : ExceptionUtils.getRootCauseStackTrace(cause)) { strBuilder.append(stackTraceFrame).append('\n'); } } setErrorResponse(msg, responseStatus, strBuilder.toString()); }
Source:
<code><START> public void setDiskSpaceThreshold(float diskSpaceThreshold, float diskUsageWarnThreshold) { <END> validateThreshold(diskSpaceThreshold, diskUsageWarnThreshold); this.diskUsageThreshold = diskSpaceThreshold; this.diskUsageWarnThreshold = diskUsageWarnThreshold; }</code><technical_language>I this called in patch. Is a reason public</technical_language>

Target:
void setDiskSpaceThreshold(float diskSpaceThreshold, float diskUsageWarnThreshold) { validateThreshold(diskSpaceThreshold, diskUsageWarnThreshold); this.diskUsageThreshold = diskSpaceThreshold; this.diskUsageWarnThreshold = diskUsageWarnThreshold; }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered InteractiveAuthServlet"); try { String redirectUrl; if (StringUtils.isEmpty(SSOUtils.getSsoSession(request).getClientId())) { redirectUrl = ssoContext.getEngineUrl(); } else { Credentials userCredentials = getUserCredentials(request); try { if (SSOUtils.isUserAuthenticated(request)) { log.debug("User is authenticated redirecting to {}", SSOConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI; } else { redirectUrl = authenticateUser(request, response, userCredentials); } } catch (AuthenticationException ex) { if (userCredentials != null) { String profile = userCredentials.getProfile() == null ? "N/A" : userCredentials.getProfile(); log.error("Cannot authenticate user '{}@{}': {}", userCredentials.getUsername(), profile, ex.getMessage()); <START> log.debug("Cannot authenticate user", ex); <END> SSOUtils.getSsoSession(request).setLoginMessage(ex.getMessage()); } log.debug("Redirecting to LoginPage"); SSOUtils.getSsoSession(request).setReauthenticate(false); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_LOGIN_FORM_URI; } } if (redirectUrl != null) { response.sendRedirect(redirectUrl); } } catch (Exception ex) { SSOUtils.redirectToErrorPage(request, response, ex); } }</code><technical_language>reason user standard? log.debug("Exception", ex);</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered InteractiveAuthServlet"); try { String redirectUrl; if (StringUtils.isEmpty(SSOUtils.getSsoSession(request).getClientId())) { redirectUrl = ssoContext.getEngineUrl(); } else { Credentials userCredentials = getUserCredentials(request); try { if (SSOUtils.isUserAuthenticated(request)) { log.debug("User is authenticated redirecting to {}", SSOConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_REDIRECT_TO_MODULE_URI; } else { redirectUrl = authenticateUser(request, response, userCredentials); } } catch (AuthenticationException ex) { if (userCredentials != null) { String profile = userCredentials.getProfile() == null ? "N/A" : userCredentials.getProfile(); log.error("Cannot authenticate user '{}@{}': {}", userCredentials.getUsername(), profile, ex.getMessage()); log.debug("Exception", ex); SSOUtils.getSsoSession(request).setLoginMessage(ex.getMessage()); } log.debug("Redirecting to LoginPage"); SSOUtils.getSsoSession(request).setReauthenticate(false); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_LOGIN_FORM_URI; } } if (redirectUrl != null) { response.sendRedirect(redirectUrl); } } catch (Exception ex) { SSOUtils.redirectToErrorPage(request, response, ex); } }
Source:
<code>public Object createNew(Object arg) { try { return createNew0(arg); } catch (Exception e) { <START> throw rethrow(e); <END> } }</code><technical_language>check for class loader of exception class, if class loader hosting test cases GuardianException, transfer exception com.hazelcast.test.starter.Utils#transferThrowable</technical_language>

Target:
public Object createNew(Object arg) { try { return createNew0(arg); } catch (Exception e) { throw new GuardianException(transferThrowable(e)); } }
Source:
<code>public UserProfile() { this.userPortalVmLoginAutomatically = true; <START> this.sshPublicKey = ""; <END> }</code><technical_language>need for explicitly 'this'</technical_language>

Target:
public UserProfile() { userPortalVmLoginAutomatically = true; sshPublicKey = ""; }
Source:
<code>private void initDottedLineSourceAndLayer(@NonNull Style loadedMapStyle) { loadedMapStyle.addSource(new GeoJsonSource(SOURCE_ID)); loadedMapStyle.addLayerBelow( new LineLayer( <START> "DIRECTIONS_LAYER_ID", SOURCE_ID).withProperties( <END> lineWidth(4.5f), lineColor(Color.BLACK), lineTranslate(new Float[] {0f, 4f}), lineDasharray(new Float[] {1.2f, 1.2f}) ), "road-label-small"); }</code><technical_language>"DIRECTIONS_LAYER_ID" a static final String</technical_language>

Target:
private void initDottedLineSourceAndLayer(@NonNull Style loadedMapStyle) { loadedMapStyle.addSource(new GeoJsonSource(SOURCE_ID)); loadedMapStyle.addLayerBelow( new LineLayer( DIRECTIONS_LAYER_ID, SOURCE_ID).withProperties( lineWidth(4.5f), lineColor(Color.BLACK), lineTranslate(new Float[] {0f, 4f}), lineDasharray(new Float[] {1.2f, 1.2f}) ), LAYER_BELOW_ID); }
Source:
<code>public void saveObservation(Observation observation, long encounterID) { createObservableIO(() -> { observation.setEncounterID(encounterID); new ObservationTable().insert(observation); <START> return null; <END> }); }</code><technical_language>I return id f inserted object. for update method need change places this. subscribe this method called</technical_language>

Target:
public Observable<Long> saveObservation(Observation observation, long encounterID) { return createObservableIO(() -> { observation.setEncounterID(encounterID); return new ObservationTable().insert(observation); }); }
Source:
<code>public int getCurrentPage() { StaplerRequest req = Stapler.getCurrentRequest(); <START> if(req == null) <END> return 1; int page = req.getParameter("page") == null ? 1 : Integer.parseInt(req.getParameter("page").toString()); page = Math.max(page, 1); int component = req.getParameter("component") == null ? 1 : Integer.parseInt(req.getParameter("component").toString()); if(component != componentNumber) { page = 1; } return page; }</code><technical_language>Missing (and in a other places)</technical_language>

Target:
public int getCurrentPage() { StaplerRequest req = Stapler.getCurrentRequest(); if (req == null) { return 1; } int page = req.getParameter("page") == null ? 1 : Integer.parseInt(req.getParameter("page").toString()); page = Math.max(page, 1); int component = req.getParameter("component") == null ? 1 : Integer.parseInt(req.getParameter("component").toString()); if (component != componentNumber) { page = 1; } return page; }
Source:
<code><START> public void testTheNormalStuff() { <END> assertThat( OrderMapper.INSTANCE.mapNormal( null ) ).isNull(); assertThat( OrderMapper.INSTANCE.mapNormal( "SPECIAL" ) ).isEqualTo( OrderType.EXTRA ); assertThat( OrderMapper.INSTANCE.mapNormal( "DEFAULT" ) ).isEqualTo( OrderType.STANDARD ); assertThat( OrderMapper.INSTANCE.mapNormal( "RETAIL" ) ).isEqualTo( OrderType.RETAIL ); assertThat( OrderMapper.INSTANCE.mapNormal( "B2B" ) ).isEqualTo( OrderType.B2B ); assertThat( OrderMapper.INSTANCE.mapNormal( "RETAIL" ) ).isEqualTo( OrderType.RETAIL ); assertThat( OrderMapper.INSTANCE.mapNormal( "STANDARD" ) ).isEqualTo( OrderType.STANDARD ); assertThat( OrderMapper.INSTANCE.mapNormal( "NORMAL" ) ).isEqualTo( OrderType.NORMAL ); }</code><technical_language>I for this test exception is thrown for unknown String</technical_language>

Target:
public void testTheNormalStuff() { assertThat( OrderMapper.INSTANCE.mapNormal( null ) ).isNull(); assertThat( OrderMapper.INSTANCE.mapNormal( "SPECIAL" ) ).isEqualTo( OrderType.EXTRA ); assertThat( OrderMapper.INSTANCE.mapNormal( "DEFAULT" ) ).isEqualTo( OrderType.STANDARD ); assertThat( OrderMapper.INSTANCE.mapNormal( "RETAIL" ) ).isEqualTo( OrderType.RETAIL ); assertThat( OrderMapper.INSTANCE.mapNormal( "B2B" ) ).isEqualTo( OrderType.B2B ); assertThat( OrderMapper.INSTANCE.mapNormal( "STANDARD" ) ).isEqualTo( OrderType.STANDARD ); assertThat( OrderMapper.INSTANCE.mapNormal( "NORMAL" ) ).isEqualTo( OrderType.NORMAL ); assertThat( OrderMapper.INSTANCE.mapNormal( "blah" ) ).isEqualTo( OrderType.RETAIL ); }
Source:
<code>public void setError(@NonNull Throwable e) { errorTextView.setText(ThrowableUtil.getErrorString(getContext(), e)); <START> messageTextView.setText(ThrowableUtil.getErrorDetailString(getContext(), e)); <END> }</code><technical_language>Good. view is easy understand. biz logic is else</technical_language>

Target:
public void setError(@NonNull Throwable e) { ThrowableUtil.AppError error = ThrowableUtil.getAppError(getContext(), e); errorTextView.setText(error.getError()); messageTextView.setText(error.getDetail()); }
Source:
<code>public void testAuthenticationSupport() { try ( CassandraContainer cassandraContainer = new CassandraContainer<>() .withAuthentication() <START> .withConfigurationOverride("cassandra-authentication-test-configuration") <END> ) { cassandraContainer.start(); ResultSet resultSet = performQuery(cassandraContainer.getCluster(), "SELECT release_version FROM system.local"); assertTrue("Query was not applied", resultSet.wasApplied()); } }</code><technical_language>is configuration override a must? I expect withAuthentication() do job, otherwise, point of it</technical_language>

Target:
public void testAuthenticationSupport() { try ( CassandraContainer cassandraContainer = new CassandraContainer<>() .withConfigurationOverride("cassandra-authentication-test-configuration") ) { cassandraContainer.start(); ResultSet resultSet = performQuery(cassandraContainer.getCluster(), "SELECT release_version FROM system.local"); assertTrue("Query was not applied", resultSet.wasApplied()); } }
Source:
<code>public void onMinecartPass(EntityMinecart cart) { if (powered && cart.canBeRidden() && cart.riddenByEntity != null) { double x = getPos().getX(); double z = getPos().getZ(); double offset = 1.5; IBlockState state = getWorld().getBlockState(getPos()); <START> EnumRailDirection dir = state.getValue(((BlockRailBase) state.getBlock()).getShapeProperty()); <END> if (dir == EnumRailDirection.NORTH_SOUTH) if (mirrored) x += offset; else x -= offset; else if (mirrored) z += offset; else z -= offset; CartUtils.dismount(cart, x + 0.5, getPos().getY() + 1, z + 0.5); cart.getEntityData().setInteger("MountPrevention", TIME_TILL_NEXT_MOUNT); } }</code><technical_language>is a helper in TrackTools.getRailDirectionRaw()</technical_language>

Target:
public void onMinecartPass(EntityMinecart cart) { if (powered && cart.canBeRidden() && cart.riddenByEntity != null) { double x = getPos().getX(); double z = getPos().getZ(); double offset = 1.5; IBlockState state = getWorld().getBlockState(getPos()); EnumRailDirection dir = TrackTools.getTrackDirectionRaw(state); if (dir == EnumRailDirection.NORTH_SOUTH) if (mirrored) x += offset; else x -= offset; else if (mirrored) z += offset; else z -= offset; CartUtils.dismount(cart, x + 0.5, getPos().getY() + 1, z + 0.5); cart.getEntityData().setInteger("MountPrevention", TIME_TILL_NEXT_MOUNT); } }
Source:
<code>private void checkIfPageIsSaved() { if (getTitle() != null) { <START> getActivity().getSupportLoaderManager().restartLoader(LOADER_ID, null, savedPageCheckCallbacks); <END> } }</code><technical_language>want add a null check getActivity() clients of displayNewPage idea Fragment lifecycles</technical_language>

Target:
private void checkIfPageIsSaved() { if (getActivity() != null && getTitle() != null) { getActivity().getSupportLoaderManager().restartLoader(LOADER_ID, null, savedPageCheckCallbacks); } }
Source:
<code><START> private boolean checkAndEstablishConnectionWithNewAM() { <END> boolean response = false; int attempt = 1; while (attempt <= RETRY_COUNT) { String newCoordinatorUrl = SERDE.fromBytes(coordinatorStreamStore.get(CoordinationConstants.YARN_COORDINATOR_URL)); try { if (coordinatorUrl.equals(newCoordinatorUrl)) { LOG.info("Attempt to discover new AM. Sleep for {}ms before next attempt.", attempt, sleepDurationForReconnectWithAM); Thread.sleep(sleepDurationForReconnectWithAM); } else { LOG.info("Found new AM: {}. Establishing heartbeat with the new AM.", newCoordinatorUrl); coordinatorUrl = newCoordinatorUrl; containerHeartbeatClient = getContainerHeartbeatClient(); response = containerHeartbeatClient.requestHeartbeat().isAlive(); LOG.info("Received heartbeat response: from new AM: {}", response, this.coordinatorUrl); break; } } catch (InterruptedException e) { LOG.warn("Interrupted during sleep."); Thread.currentThread().interrupt(); } attempt++; } return response; }</code><technical_language>nice breakdown check establishing part. [1] easier write simpler tests tests logic separately [2] allows handling evolution of modular functions. e.g retry for establishing for checking today. wdyt</technical_language>

Target:
private boolean checkAndEstablishConnectionWithNewAM() { boolean response = false; int attempt = 1; while (attempt <= retryCount) { String newCoordinatorUrl = SERDE.fromBytes(coordinatorStreamStore.get(CoordinationConstants.YARN_COORDINATOR_URL)); try { if (coordinatorUrl.equals(newCoordinatorUrl)) { LOG.info("Attempt to discover new AM. Sleep for {}ms before next attempt.", attempt, sleepDurationForReconnectWithAM); Thread.sleep(sleepDurationForReconnectWithAM); } else { LOG.info("Found new AM: {}. Establishing heartbeat with the new AM.", newCoordinatorUrl); coordinatorUrl = newCoordinatorUrl; containerHeartbeatClient = createContainerHeartbeatClient(coordinatorUrl, containerExecutionId); response = containerHeartbeatClient.requestHeartbeat().isAlive(); LOG.info("Received heartbeat response: from new AM: {}", response, this.coordinatorUrl); break; } } catch (InterruptedException e) { LOG.warn("Interrupted during sleep."); Thread.currentThread().interrupt(); } attempt++; } return response; }
Source:
<code>ChainedDownsamplingIterator(final Iterator<SAMRecord> iterator, final double proportion, final int seed) { <START> super(new ConstantMemoryDownsamplingIterator(iterator, Math.min(1, proportion + 0.01), seed), proportion, seed); <END> final long discarded = ((ConstantMemoryDownsamplingIterator) getUnderlyingIterator()).getDiscardedCount(); for (long i=0; i<discarded; ++i) recordDiscardedRecord(null); }</code><technical_language>presumably, 1% extra is "definitely" amount need, right? in case 5sd for [Bernoulli](<LINK_0> is \sqrt(p(1-p)). recommend p + 5_sqrt(p_(1-p)) instead of p+0.01. Good allow 1 a valid for p, :smiley_cat:</technical_language>

Target:
ChainedDownsamplingIterator(final Iterator<SAMRecord> iterator, final double proportion, final int seed) { super(new ConstantMemoryDownsamplingIterator(iterator, adjustProportion(proportion), seed), proportion, seed); final long discarded = ((ConstantMemoryDownsamplingIterator) getUnderlyingIterator()).getDiscardedCount(); recordDiscardRecords(discarded); }
Source:
<code>public void shouldAddPermissionForUsersWhenUsingChainExtension() throws OperationException { List<String> users = Arrays.asList("jchastain", "rdeniro", "dwashington"); users.forEach(user -> when(userManager.getUserModel(user)).thenReturn(new SimpleDocumentModel(user))); DocumentModel doc = session.getDocument(new PathRef("/src")); OperationContext ctx = new OperationContext(session); ctx.setInput(doc); Object object = automationService.run(ctx, "testAddPermissionToUsers"); assertThat(object, instanceOf(DocumentModel.class)); DocumentModel documentModel = (DocumentModel) object; ACL acl = documentModel.getACP().getACL("local"); <START> assertNotNull("Local ACL cannot be null !", acl); <END> assertThat("ACEs size must be the same then users size !", acl.getACEs(), arrayWithSize(users.size())); Map<String, ACE> mapAceByUser = Arrays.stream(acl.getACEs()) .collect(Collectors.toMap(ACE::getUsername, ace -> ace)); for (String user : users) { ACE ace = mapAceByUser.get(user); assertNotNull(String.format("User of %s must have a defined ACE", user), ace); assertThat(String.format("User of %s must have a Read permission on document %s", user, documentModel), SecurityConstants.READ, equalTo(ace.getPermission())); } }</code><technical_language>strictly needed here, "local" ACL exists</technical_language>

Target:
public void shouldAddPermissionForUsersWhenUsingChainExtension() throws OperationException { List<String> users = Arrays.asList("jchastain", "rdeniro", "dwashington"); users.forEach(user -> when(userManager.getUserModel(user)).thenReturn(new SimpleDocumentModel(user))); DocumentModel doc = session.getDocument(new PathRef("/src")); OperationContext ctx = new OperationContext(session); ctx.setInput(doc); DocumentModel documentModel = (DocumentModel) automationService.run(ctx, "testAddPermissionToUsers"); ACP acp = documentModel.getACP(); assertNotNull(acp); ACL acl = acp.getACL("local"); assertNotNull(acl); Map<String, Object> params = Collections.singletonMap("permission", SecurityConstants.READ); Assert.assertTrue(acl.getACEs().length >= 3); for (String user : users) { assertExpectedPermissions(acl, params, user); } }
Source:
<code>public static MBExpression create(JSONArray json) { String name; if (json.get(0) instanceof String) { name = (String) json.get(0); if (colors.contains(name)) { return new MBColor(json); } else if (decisions.contains(name)) { return new MBDecision(json); } else if (featureData.contains(name)) { return new MBFeatureData(json); } else if (heatMap.contains(name)) { return new MBHeatmap(json); } else if (lookUp.contains(name)) { return new MBLookup(json); } else if (math.contains(name)) { return new MBMath(json); } else if (ramps.contains(name)) { return new MBRampsScalesCurves(json); } else if (string.contains(name)) { return new MBString(json); } else if (types.contains(name)) { return new MBTypes(json); } else if (variableBindings.contains(name)) { return new MBVariableBinding(json); } else if (zoom.contains(name)) { return new MBZoom(json); } else { <START> throw new MBFormatException("Expression \"" + name + "\" not supported."); <END> } } throw new MBFormatException("Requires a string name of the expression at position 0"); }</code><technical_language>This change of improvement, true. GT necessarily support full set of expressions, this distinction is relevant, invalid supported fixes - invalid expression is user error (most a misspelling), simple fix, expression is supported means need upgrade (or wait for) a version of geotools supports expression. I do this - if maintained a list of expressions GT support, inevitably outdated. a more descriptive error message? like: Expression \"" + name + "\" invalid. misspelled supported this implementation"</technical_language>

Target:
public static MBExpression create(JSONArray json) { String name; if (json.get(0) instanceof String) { name = (String) json.get(0); if (colors.contains(name)) { return new MBColor(json); } else if (decisions.contains(name)) { return new MBDecision(json); } else if (featureData.contains(name)) { return new MBFeatureData(json); } else if (heatMap.contains(name)) { return new MBHeatmap(json); } else if (lookUp.contains(name)) { return new MBLookup(json); } else if (math.contains(name)) { return new MBMath(json); } else if (ramps.contains(name)) { return new MBRampsScalesCurves(json); } else if (string.contains(name)) { return new MBString(json); } else if (types.contains(name)) { return new MBTypes(json); } else if (variableBindings.contains(name)) { return new MBVariableBinding(json); } else if (zoom.contains(name)) { return new MBZoom(json); } else { throw new MBFormatException( "Data expression \"" + name + "\" invalid. It may be misspelled or not supported by this implementation:" + json); } } throw new MBFormatException("Requires a string name of the data expression at position 0"); }
Source:
<code>static void quoteListenerAndHostAttributeKeys(Node objLit, AbstractCompiler compiler) { Preconditions.checkState(objLit.isObjectLit()); boolean changeMade = false; for (Node keyNode : objLit.children()) { if (keyNode.isComputedProp()) { continue; } if (!keyNode.getString().equals("listeners") && !keyNode.getString().equals("hostAttributes")) { continue; } for (Node keyToQuote : keyNode.getFirstChild().children()) { keyToQuote.setQuotedString(); changeMade = true; } } if (changeMade) { <START> compiler.reportCodeChange(); <END> } }</code><technical_language>Tyler this call is cheap, call in loop</technical_language>

Target:
static void quoteListenerAndHostAttributeKeys(Node objLit, AbstractCompiler compiler) { Preconditions.checkState(objLit.isObjectLit()); for (Node keyNode : objLit.children()) { if (keyNode.isComputedProp()) { continue; } if (!keyNode.getString().equals("listeners") && !keyNode.getString().equals("hostAttributes")) { continue; } for (Node keyToQuote : keyNode.getFirstChild().children()) { keyToQuote.setQuotedString(); compiler.reportCodeChange(); } } }
Source:
<code>public void unsetModelRepository(ModelRepository modelRepo) { <START> modelRepo.removeModelRepositoryChangeListener(this); <END> this.modelRepo = null; }</code><technical_language>necessary remove in deactivate already</technical_language>

Target:
public void unsetModelRepository(ModelRepository modelRepo) { this.modelRepo = null; }
Source:
<code>protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered InteractiveChangePasswdServlet"); Credentials userCredentials = null; String redirectUrl; try { log.debug("User is not authenticated extracting credentials from request."); userCredentials = getUserCredentials(request); if (userCredentials == null) { throw new AuthenticationException("Unable to extract user credentials from request"); } if (!userCredentials.getNewCredentials().equals(userCredentials.getConfirmedNewCredentials())) { throw new AuthenticationException("The passwords don't match."); } redirectUrl = changeUserPasswd(request, userCredentials); } catch (AuthenticationException ex) { String msg = String.format("Change Password for user '%s' failed : %s", userCredentials == null ? "" : userCredentials.getUsername() + "@" + userCredentials.getProfile(), ex.getMessage()); log.error(msg); log.debug("Exception", ex); SSOUtils.getSsoSession(request).setChangePasswdMessage(msg); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_CHANGE_PASSWD_FORM_URI; <START> } <END> log.debug("Redirecting to url: {}", redirectUrl); response.sendRedirect(redirectUrl); }</code><technical_language>I catch ExtensionInvokeCommandUnsupportedException redirect error message. internal error message</technical_language>

Target:
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.debug("Entered InteractiveChangePasswdServlet"); Credentials userCredentials = null; String redirectUrl; try { log.debug("User is not authenticated extracting credentials from request."); userCredentials = getUserCredentials(request); if (userCredentials == null) { throw new AuthenticationException("Unable to extract user credentials from request"); } if (!userCredentials.getNewCredentials().equals(userCredentials.getConfirmedNewCredentials())) { throw new AuthenticationException("The passwords don't match."); } redirectUrl = changeUserPasswd(request, userCredentials); } catch (Exception ex) { String msg = String.format("Change Password for user '%s' failed : %s", userCredentials == null ? "" : userCredentials.getUsername() + "@" + userCredentials.getProfile(), ex.getMessage()); log.error(msg); log.debug("Exception", ex); SSOUtils.getSsoSession(request).setChangePasswdMessage(msg); redirectUrl = request.getContextPath() + SSOConstants.INTERACTIVE_CHANGE_PASSWD_FORM_URI; } log.debug("Redirecting to url: {}", redirectUrl); response.sendRedirect(redirectUrl); }
Source:
<code>public Member getMemberByUserExtSources(PerunSession sess, Vo vo, List<UserExtSource> ueas) throws InternalErrorException, MemberNotExistsException { if (ueas == null) { throw new InternalErrorException("Given userExtSources are null."); } if (ueas.isEmpty()) { throw new InternalErrorException("Given userExtSources are empty."); } Set<Member> foundMembers = new HashSet<>(); for (UserExtSource ues: ueas) { try { foundMembers.add(getMembersManagerImpl().getMemberByUserExtSource(sess, vo, ues)); } catch (MemberNotExistsException e) { <START> throw new MemberNotExistsException("Member with userExtSources " + ueas + " doesn't exists."); <END> } } if (foundMembers.size() > 1) { throw new InternalErrorException("Given userExtSources do not belong to the same member."); } else { return (Member)foundMembers.toArray()[0]; } }</code><technical_language>I ignore this exception, get list of UES, some of registered in Perun, meaning find user for some of a new UES add user. throw MemberNotExistsException, if foundMembers.size() == 0</technical_language>

Target:
public Member getMemberByUserExtSources(PerunSession sess, Vo vo, List<UserExtSource> ueas) throws InternalErrorException, MemberNotExistsException { if (ueas == null) { throw new InternalErrorException("Given userExtSources are null."); } if (ueas.isEmpty()) { throw new InternalErrorException("Given userExtSources are empty."); } Set<Member> foundMembers = new HashSet<>(); for (UserExtSource ues: ueas) { try { foundMembers.add(getMembersManagerImpl().getMemberByUserExtSource(sess, vo, ues)); } catch (MemberNotExistsException e) { } } if (foundMembers.isEmpty()) { throw new MemberNotExistsException("Member with userExtSources " + ueas + " doesn't exists."); } if (foundMembers.size() > 1) { throw new InternalErrorException("Given userExtSources do not belong to the same member."); } else { return (Member)foundMembers.toArray()[0]; } }
Source:
<code>public ErrorObjects build() { if (errors.isEmpty()) { <START> throw new IllegalArgumentException("at least one error object"); <END> } return container; }</code><technical_language>error is required</technical_language>

Target:
public ErrorObjects build() { if (errors.isEmpty()) { throw new IllegalArgumentException("At least one error is required"); } validateCurrentError(); return new ErrorObjects(errors); }
Source:
<code>public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> records) { writeMetrics.numPutAlls.inc(); long startNs = System.nanoTime(); Preconditions.checkNotNull(rwTable, "Cannot write to a read-only table: " + rdTable); return rwTable.putAllAsync(records).handleAsync((result, e) -> { if (e != null) { throw new SamzaException("Failed to put records " + records, e); } else if (!isWriteAround) { Set<K> allKeys = new HashSet<>(); List<K> delKeys = new ArrayList<>(); List<Entry<K, V>> putRecords = new ArrayList<>(); records.forEach(r -> { <START> allKeys.add(r.getKey()); <END> if (r.getValue() != null) { putRecords.add(r); } else { delKeys.add(r.getKey()); } }); cache.deleteAll(delKeys); cache.putAll(putRecords); } writeMetrics.putAllNs.update(System.nanoTime() - startNs); return result; }); }</code><technical_language>allKeys populated? If unused, remove entirely</technical_language>

Target:
public CompletableFuture<Void> putAllAsync(List<Entry<K, V>> records) { writeMetrics.numPutAlls.inc(); long startNs = System.nanoTime(); Preconditions.checkNotNull(rwTable, "Cannot write to a read-only table: " + rdTable); return rwTable.putAllAsync(records).handle((result, e) -> { if (e != null) { throw new SamzaException("Failed to put records " + records, e); } else if (!isWriteAround) { cache.putAll(records); } writeMetrics.putAllNs.update(System.nanoTime() - startNs); return result; }); }
Source:
<code>private static void setCompressionProperties(Configuration config, HiveCompressionCodec compression) { boolean compressed = compression != HiveCompressionCodec.NONE; config.setBoolean(COMPRESSRESULT.varname, compressed); config.setBoolean("mapred.output.compress", compressed); config.setBoolean(FileOutputFormat.COMPRESS, compressed); config.set(HIVE_ORC_DEFAULT_COMPRESS.varname, compression.getOrcCompressionKind().name()); config.set(HIVE_ORC_COMPRESSION.varname, compression.getOrcCompressionKind().name()); config.set(OrcFile.OrcTableProperties.COMPRESSION.getPropName(), compression.getOrcCompressionKind().name()); if (compression.getCodec().isPresent()) { config.set("mapred.output.compression.codec", compression.getCodec().get().getName()); config.set(FileOutputFormat.COMPRESS_CODEC, compression.getCodec().get().getName()); } else { config.unset("mapred.output.compression.codec"); config.unset(FileOutputFormat.COMPRESS_CODEC); } <START> compression.getParquetCompressionCodec().ifPresent(parquetCompressionCodec -> config.set(ParquetOutputFormat.COMPRESSION, parquetCompressionCodec.name())); <END> config.set(FileOutputFormat.COMPRESS_TYPE, BLOCK.toString()); }</code><technical_language>nit: parquetCompressionCodec -> codec in lambda compression.getParquetCompressionCodec().ifPresent(codec -> config.set(ParquetOutputFormat.COMPRESSION, codec.name()));</technical_language>

Target:
private static void setCompressionProperties(Configuration config, HiveCompressionCodec compression) { boolean compressed = compression != HiveCompressionCodec.NONE; config.setBoolean(COMPRESSRESULT.varname, compressed); config.setBoolean("mapred.output.compress", compressed); config.setBoolean(FileOutputFormat.COMPRESS, compressed); config.set(HIVE_ORC_DEFAULT_COMPRESS.varname, compression.getOrcCompressionKind().name()); config.set(HIVE_ORC_COMPRESSION.varname, compression.getOrcCompressionKind().name()); config.set(OrcFile.OrcTableProperties.COMPRESSION.getPropName(), compression.getOrcCompressionKind().name()); if (compression.getCodec().isPresent()) { config.set("mapred.output.compression.codec", compression.getCodec().get().getName()); config.set(FileOutputFormat.COMPRESS_CODEC, compression.getCodec().get().getName()); } else { config.unset("mapred.output.compression.codec"); config.unset(FileOutputFormat.COMPRESS_CODEC); } compression.getParquetCompressionCodec().ifPresent(codec -> config.set(ParquetOutputFormat.COMPRESSION, codec.name())); config.set(FileOutputFormat.COMPRESS_TYPE, BLOCK.toString()); }
Source:
<code>public void onPause() { super.onPause(); <START> if (getAllowStartStopFromHeadsetKey()) { <END> unregisterHeadsetListener(); } unRegisterStartStopListener(); }</code><technical_language>this bug before, headset working while app minimized</technical_language>

Target:
public void onPause() { super.onPause(); }
Source:
<code><START> public SAMRecordIterator assertSorted(final SortOrder sortOrder) { throw new RuntimeException("assertSorted is not implemented."); } <END></code><technical_language>UnsupportedOperationException</technical_language>

Target:
public SAMRecordIterator assertSorted(final SortOrder sortOrder) { throw new UnsupportedOperationException("assertSorted is not implemented."); }
Source:
<code>private PlaybackController setupPlaybackController() { return new PlaybackController(getActivity(), true) { @Override public ImageButton getPlayButton() { return butPlay; } @Override <START> public boolean loadMediaInfo() { <END> ExternalPlayerFragment fragment = ExternalPlayerFragment.this; if (fragment != null) { return fragment.loadMediaInfo(); } else { return false; } } }; }</code><technical_language>Removing onPositionObserverUpdate() breaks progress bar in external player (it update)</technical_language>

Target:
private PlaybackController setupPlaybackController() { return new PlaybackController(getActivity(), true) { @Override public void onPositionObserverUpdate() { ExternalPlayerFragment.this.onPositionObserverUpdate(); } @Override public ImageButton getPlayButton() { return butPlay; } @Override public boolean loadMediaInfo() { ExternalPlayerFragment fragment = ExternalPlayerFragment.this; if (fragment != null) { return fragment.loadMediaInfo(); } else { return false; } } @Override public void onShutdownNotification() { playbackDone(); } @Override public void onPlaybackEnd() { playbackDone(); } }; }
Source:
<code>public String getProvider() { <START> return provider != null ? provider : ""; END> }</code><technical_language>I is do code calling it, in getter</technical_language>

Target:
public String getProvider() { return provider; }
Source:
<code>public void run() { UIOutputCallbackControllerServiceImpl uiOutputCallbackControllerServiceImpl = UIEventAdaptorServiceInternalValueHolder.getUIOutputCallbackRegisterServiceImpl(); CopyOnWriteArrayList<Session> sessions = uiOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId); if (sessions != null) { for (Session session : sessions) { synchronized (session) { try { session.getBasicRemote().sendText(message); } catch (IOException e) { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, "Cannot send to endpoint", e, log, tenantId); } } } } else if(!isLoggedDroppedMessage) { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, "No clients registered", log, tenantId); isLoggedDroppedMessage = true; <START> } <END> }</code><technical_language>@keizer619 IMO, need improve this change. success operation. need variable isLoggedDroppedMessage "false".</technical_language>

Target:
public void run() { UIOutputCallbackControllerServiceImpl uiOutputCallbackControllerServiceImpl = UIEventAdaptorServiceInternalValueHolder.getUIOutputCallbackRegisterServiceImpl(); CopyOnWriteArrayList<Session> sessions = uiOutputCallbackControllerServiceImpl.getSessions(tenantId, streamId); if (sessions != null) { doLogDroppedMessage = true; for (Session session : sessions) { synchronized (session) { try { session.getBasicRemote().sendText(message); } catch (IOException e) { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, "Cannot send to endpoint", e, log, tenantId); } } } } else if(doLogDroppedMessage) { EventAdapterUtil.logAndDrop(eventAdapterConfiguration.getName(), message, "No clients registered", log, tenantId); doLogDroppedMessage = false; } }
Source:
<code>public boolean onOptionsItemSelected(MenuItem item) { String url = String.format(Locale.US, "<LINK_0>", mRepoOwner, mRepoName, mRef, mPath); switch (item.getItemId()) { case R.id.browser: IntentUtils.launchBrowser(this, Uri.parse(url)); return true; case R.id.share: IntentUtils.share(this, getString(R.string.share_file_subject, FileUtils.getFileName(mPath), mRepoOwner + "/" + mRepoName), url); return true; case MENU_ITEM_HISTORY: startActivity(CommitHistoryActivity.makeIntent(this, mRepoOwner, mRepoName, mRef, mPath)); return true; case R.id.view_raw: boolean newState = !mViewRawText; item.setChecked(newState); <START> mViewRawText = newState; <END> onRefresh(); return true; } return super.onOptionsItemSelected(item); }</code><technical_language>mViewRawText = !mViewRawText; item.setChecked(mViewRawText);</technical_language>

Target:
public boolean onOptionsItemSelected(MenuItem item) { String url = String.format(Locale.US, "<LINK_0>", mRepoOwner, mRepoName, mRef, mPath); switch (item.getItemId()) { case R.id.browser: IntentUtils.launchBrowser(this, Uri.parse(url)); return true; case R.id.share: IntentUtils.share(this, getString(R.string.share_file_subject, FileUtils.getFileName(mPath), mRepoOwner + "/" + mRepoName), url); return true; case MENU_ITEM_HISTORY: startActivity(CommitHistoryActivity.makeIntent(this, mRepoOwner, mRepoName, mRef, mPath)); return true; case R.id.view_raw: mViewRawText = !mViewRawText; item.setChecked(mViewRawText); onRefresh(); return true; } return super.onOptionsItemSelected(item); }
Source:
<code>public BigDecimal convert( final String value ) { <START> return new BigDecimal( value ); <END> }</code><technical_language>This in theory throw a NumberFormatException. This is caught in similar case in ListBoxByteSingletonDOMElementFactory, good catch too</technical_language>

Target:
public BigDecimal convert( final String value ) { try { return new BigDecimal( value ); } catch ( NumberFormatException nfe ) { return new BigDecimal( "0.0" ); } }
Source:
<code>public String toString() { <START> final StringBuilder sb = new StringBuilder("FilePosition{"); <END> sb.append("line=").append(line); sb.append(", column=").append(column); sb.append('}'); return sb.toString(); }</code><technical_language>ToStringBuilder</technical_language>

Target:
public String toString() { return new ToStringBuilder(this) .append("line", line) .append("column", column) .toString(); }
Source:
<code>public void onDonePressed() { if (mEmailFieldValidator.validate(mEmailEditText.getText())) { <START> if (getFlowParams().passwordResetSettings != null) <END> customResetPassword(); else normalResetPassword(); } }</code><technical_language>a style nit: please { } for blocks, one-line blocks. This is more consistent rest of codebase reduces bugs</technical_language>

Target:
public void onDonePressed() { if (mEmailFieldValidator.validate(mEmailEditText.getText())) { if (getFlowParams().passwordResetSettings != null) { resetPassword(mEmailEditText.getText().toString(), getFlowParams().passwordResetSettings); } else { resetPassword(mEmailEditText.getText().toString(), null); } } }
Source:
<code>public PipelinePostProcessorHandler(List<PipelinePostProcessor> postProcessors) { <START> this.postProcessors = postProcessors; <END> }</code><technical_language>I guess missing -- this autowired somewhere? is spring smart enough infer that</technical_language>

Target:
public PipelinePostProcessorHandler(List<PipelinePostProcessor> postProcessors) { postProcessors.sort(Comparator.comparing(PipelinePostProcessor::priority)); this.postProcessors = postProcessors; }
Source:
<code>private void testMSIEndpointWithSystemAssigned() { if (CoreUtils.isNullOrEmpty(CONFIGURATION.get(Configuration.PROPERTY_MSI_ENDPOINT)) && CoreUtils.isNullOrEmpty(CONFIGURATION.get(Configuration.PROPERTY_MSI_SECRET))) { throw logger.logExceptionAsError( new IllegalStateException("testMSIEndpointWithUserAssigned - MSIEndpoint and Identity Point not" <START> + "configured in the environment. Atleast one should be configuured")); <END> } assertConfigPresence(Configuration.PROPERTY_MSI_SECRET, "testMSIEndpointWithSystemAssigned - MSISecret not configured in the environment."); IdentityClient client = new IdentityClientBuilder().build(); AccessToken accessToken = client.authenticateToManagedIdentityEndpoint( CONFIGURATION.get(PROPERTY_IDENTITY_ENDPOINT), CONFIGURATION.get(PROPERTY_IDENTITY_HEADER), CONFIGURATION.get(Configuration.PROPERTY_MSI_ENDPOINT), CONFIGURATION.get(Configuration.PROPERTY_MSI_SECRET), new TokenRequestContext().addScopes("<LINK_0>")) .flatMap(token -> { if (token == null || token.getToken() == null) { return Mono.error(logger.logExceptionAsError(new IllegalStateException( "Access Token not returned from System Assigned Identity"))); } else { return Mono.just(token); } }).block(); if (accessToken == null) { System.out.println("Error: Access token is null."); return; } System.out.printf("Received token with length %d and expiry at %s %n " + "testMSIEndpointWithSystemAssigned - Succeeded %n", accessToken.getToken().length(), accessToken.getExpiresAt().format(DateTimeFormatter.ISO_DATE_TIME)); }</code><technical_language>suggestion + "configured in environment. configured"));</technical_language>

Target:
private void testMSIEndpointWithSystemAssigned() { if (CoreUtils.isNullOrEmpty(CONFIGURATION.get(Configuration.PROPERTY_MSI_ENDPOINT)) && CoreUtils.isNullOrEmpty(CONFIGURATION.get(Configuration.PROPERTY_MSI_SECRET))) { throw logger.logExceptionAsError( new IllegalStateException("testMSIEndpointWithUserAssigned - MSIEndpoint and Identity Point not" + "configured in the environment. At least one should be configured")); } assertConfigPresence(Configuration.PROPERTY_MSI_SECRET, "testMSIEndpointWithSystemAssigned - MSISecret not configured in the environment."); IdentityClient client = new IdentityClientBuilder().build(); AccessToken accessToken = client.authenticateToManagedIdentityEndpoint( CONFIGURATION.get(PROPERTY_IDENTITY_ENDPOINT), CONFIGURATION.get(PROPERTY_IDENTITY_HEADER), CONFIGURATION.get(Configuration.PROPERTY_MSI_ENDPOINT), CONFIGURATION.get(Configuration.PROPERTY_MSI_SECRET), new TokenRequestContext().addScopes("<LINK_0>")) .flatMap(token -> { if (token == null || token.getToken() == null) { return Mono.error(logger.logExceptionAsError(new IllegalStateException( "Access Token not returned from System Assigned Identity"))); } else { return Mono.just(token); } }).block(); if (accessToken == null) { System.out.println("Error: Access token is null."); return; } System.out.printf("Received token with length %d and expiry at %s %n " + "testMSIEndpointWithSystemAssigned - Succeeded %n", accessToken.getToken().length(), accessToken.getExpiresAt().format(DateTimeFormatter.ISO_DATE_TIME)); }
Source:
<code>public PerunNotifReceiver call(ApiCaller ac, Deserializer parms) throws PerunException { ac.stateChangingCheck(); if (parms.contains("receiver")) { return ac.getNotificationManager().createPerunNotifReceiver(ac.getSession(), parms.read("receiver", PerunNotifReceiver.class)); } else if (parms.contains("target") && parms.contains("key") && parms.contains("templateId") && parms.contains("locale") ) { PerunNotifReceiver receiver = new PerunNotifReceiver(); receiver.setLocale(parms.read("locale", String.class)); receiver.setTarget(parms.read("target", String.class)); receiver.setTemplateId(parms.read("templateId", Integer.class)); <START> PerunNotifTypeOfReceiver type = PerunNotifTypeOfReceiver.resolve(parms.read("key", String.class)); <END> receiver.setTypeOfReceiver(type); return ac.getNotificationManager().createPerunNotifReceiver(ac.getSession(), receiver); } else { throw new RpcException("Parameters missing", "Parameter 'receiver' or parameters 'locale', 'target', 'key', 'templateId' not provided."); } }</code><technical_language>updated docs key -> type, actual reading of param is name (same for exception text lines below)</technical_language>

Target:
public PerunNotifReceiver call(ApiCaller ac, Deserializer parms) throws PerunException { if (parms.contains("id")) { return ac.getNotificationManager().getPerunNotifReceiverById(ac.getSession(), parms.readInt("id")); } else { throw new RpcException(RpcException.Type.MISSING_VALUE, "id"); } }
Source:
<code><START> public long rtcpTCCRemoteBitrateEstimator (Integer ssrc_, <END> long sendTime, long receivedTime, int packetLength) { long nowMs = receivedTime; synchronized (critSect) { Detector it = overuseDetectors.get(ssrc_); if (it == null) { it = new Detector(nowMs, new OverUseDetectorOptions(), true); overuseDetectors.put(ssrc_, it); ssrcs = null; } Detector estimator = it; estimator.lastPacketTimeMs = nowMs; this.incomingBitrate.update(packetLength, nowMs); BandwidthUsage priorState = estimator.detector.getState(); long[] deltas = this.deltas; deltas[0] = 0; deltas[1] = 0; deltas[2] = 0; if (estimator.interArrival.computeDeltas( sendTime, receivedTime, packetLength, deltas)) { double timestampDeltaMs = deltas[0] * kTimestampToMs; estimator.estimator.update( deltas[1], timestampDeltaMs, (int) deltas[2], estimator.detector.getState()); estimator.detector.detect( estimator.estimator.getOffset(), timestampDeltaMs, estimator.estimator.getNumOfDeltas(), nowMs); } if (estimator.detector.getState() == BandwidthUsage.kBwOverusing) { long incomingBitrateBps = this.incomingBitrate.getRate(nowMs); if (priorState != BandwidthUsage.kBwOverusing || remoteRate.isTimeToReduceFurther( nowMs, incomingBitrateBps)) { updateEstimate(nowMs); } } } return this.incomingBitrate.getRate(receivedTime); }</code><technical_language>This duplicates a lot of code</technical_language>

Target:
public long rtcpTCCRemoteBitrateEstimator(Integer ssrc_, long sendTime, long receivedTime, int packetLength) { long interArrivalTime = getInterArrivalDelayVariation (ssrc_, sendTime, receivedTime, packetLength); return interArrivalTime; }
Source:
<code>private void doCreateProject() { final String projectName = createProjectTxt.getText().trim(); <START> if (projectName.contains(" ")) { <END> return; } String parentName = null; if (showParentCandidates.getValue()) { parentName = suggestedParents.getItemText(suggestedParents.getSelectedIndex()); } else { parentName = parentTxt.getText(); } if (parentName.equals(NO_PARENT_SELECTED) && showParentCandidates.getValue()) { parentName = ""; } Util.PROJECT_SVC.createNewProject(projectName, parentName, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(projectName), ProjectScreen.INFO)); } @Override public void onFailure(Throwable caught) { super.onFailure(caught); } }); }</code><technical_language>Is this check needed? If I expect in a level this check is executed if a project is created command SSH, e.g. this check in PerformCreateProjectImpl#validateParameters() in LocalDiskRepositoryManager#isUnreasonableName(String) If this check stays here, error message displayed user, project name entered is invalid this is project creation failed</technical_language>

Target:
private void doCreateProject() { final String projectName = createProjectTxt.getText().trim(); if (projectName.contains(" ")) { return; } String parentName = null; if (showParentCandidates.getValue()) { parentName = suggestedParents.getItemText(suggestedParents.getSelectedIndex()); if (parentName.equals(NO_PARENT_SELECTED)) { parentName = ""; } } else { parentName = parentTxt.getText(); } Util.PROJECT_SVC.createNewProject(projectName, parentName, new GerritCallback<VoidResult>() { @Override public void onSuccess(VoidResult result) { History.newItem(Dispatcher.toProjectAdmin(new Project.NameKey(projectName), ProjectScreen.INFO)); } @Override public void onFailure(Throwable caught) { super.onFailure(caught); } }); }