auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public long store(RepositoryPath repositoryPath, InputStream is) throws IOException { boolean updatedMetadataFile = false; boolean updatedArtifactFile = false; boolean updatedArtifactChecksumFile = false; if (Files.exists(repositoryPath)) { if (RepositoryFiles.isMetadata(repositoryPath)) { updatedMetadataFile = true; } else if (RepositoryFiles.isChecksum(repositoryPath)) { updatedArtifactChecksumFile = true; } else { updatedArtifactFile = true; } } long result; URI pathUri = repositoryPath.toUri(); acquireLock(pathUri); try (final RepositoryOutputStream aos = artifactResolutionService.getOutputStream(repositoryPath)) { result = storeArtifact(repositoryPath, is, aos); } catch (IOException e) { throw e; } catch (Exception e) { throw new ArtifactStorageException(e); } finally { releaseLock(pathUri); } artifactEventListenerRegistry.dispatchArtifactStoredEvent(repositoryPath); if (updatedMetadataFile) { artifactEventListenerRegistry.dispatchArtifactMetadataFileUpdatedEvent(repositoryPath); artifactEventListenerRegistry.dispatchArtifactMetadataFileUploadedEvent(repositoryPath); } if (updatedArtifactChecksumFile) { artifactEventListenerRegistry.dispatchArtifactChecksumFileUpdatedEvent(repositoryPath); } <START> if (RepositoryFiles.isChecksum(repositoryPath)) { <END> artifactEventListenerRegistry.dispatchArtifactChecksumUploadedEvent(repositoryPath); } if (updatedArtifactFile) { artifactEventListenerRegistry.dispatchArtifactUploadedEvent(repositoryPath); } return result; }</code><technical_language>Cosmetic: Braces new line, please</technical_language>

Target:
public long store(RepositoryPath repositoryPath, InputStream is) throws IOException { boolean updatedMetadataFile = false; boolean updatedArtifactFile = false; boolean updatedArtifactChecksumFile = false; if (Files.exists(repositoryPath)) { if (RepositoryFiles.isMetadata(repositoryPath)) { updatedMetadataFile = true; } else if (RepositoryFiles.isChecksum(repositoryPath)) { updatedArtifactChecksumFile = true; } else { updatedArtifactFile = true; } } long result; repositoryPathLock.lock(repositoryPath); try (final RepositoryOutputStream aos = artifactResolutionService.getOutputStream(repositoryPath)) { result = storeArtifact(repositoryPath, is, aos); } catch (IOException e) { throw e; } catch (Exception e) { throw new ArtifactStorageException(e); } finally { repositoryPathLock.unlock(repositoryPath); } artifactEventListenerRegistry.dispatchArtifactStoredEvent(repositoryPath); if (updatedMetadataFile) { artifactEventListenerRegistry.dispatchArtifactMetadataFileUpdatedEvent(repositoryPath); artifactEventListenerRegistry.dispatchArtifactMetadataFileUploadedEvent(repositoryPath); } if (updatedArtifactChecksumFile) { artifactEventListenerRegistry.dispatchArtifactChecksumFileUpdatedEvent(repositoryPath); } if (RepositoryFiles.isChecksum(repositoryPath)) { artifactEventListenerRegistry.dispatchArtifactChecksumUploadedEvent(repositoryPath); } if (updatedArtifactFile) { artifactEventListenerRegistry.dispatchArtifactUploadedEvent(repositoryPath); } return result; }
Source:
<code>public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); String fileName = null; try { fileName = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : <START> " --admin-pass-file " + fileName) <END> + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, enumValue.name()); } } catch (IOException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } catch (InterruptedException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(fileName); } }</code><technical_language>If file name is absolute this work/fail depending is current working directory of tool. explicitly absolute path</technical_language>

Target:
public void setConfigValue(ConfigValues enumValue, DomainsConfigurationEntry entry, boolean passedAsValue) throws ManageDomainsResult { log.info("Setting value for " + enumValue.toString() + " to " + entry.getDomainsLoggingEntry()); String filePath = null; try { filePath = createPassFile(entry.getDomainsConfigurationEntry()); Process engineConfigProcess = Runtime.getRuntime().exec(engineConfigExecutable + " -s " + enumValue.name() + ((passedAsValue) ? "=" + entry.getDomainsConfigurationEntry() : " --admin-pass-file " + filePath) + " -p " + engineConfigProperties); int retVal = engineConfigProcess.waitFor(); if (retVal != 0) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION, enumValue.name()); } } catch (IOException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } catch (InterruptedException e) { throw new ManageDomainsResult(ManageDomainsResultEnum.FAILED_SETTING_CONFIGURATION_VALUE_FOR_OPTION_WITH_DETAILS, new String[] { enumValue.name(), e.getMessage() }); } finally { disposePassFile(filePath); } }
Source:
<code>public void onAuthenticationFailure( HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { super.onAuthenticationFailure(request, response, exception); HttpSession session = request.getSession(false); if (session != null || isAllowSessionCreation()) { String usernameParameter = loginDecisionFilter.getUsernameParameter(); String lastUserName = request.getParameter(usernameParameter); request.getSession().setAttribute(LAST_USERNAME_KEY, lastUserName); String provider = request.getParameter("provider"); provider = Strings.isNullOrEmpty(provider) ? "internal" : provider; request.getSession().setAttribute(LAST_PROVIDER_KEY, provider); request.getSession().setAttribute(IS_LOCKED, false); if(exception instanceof LdapAuthenticationProcessException) { request.getSession().setAttribute(ERROR_KEY, "login.ldap.internal.user.exists"); } if(exception instanceof LockedException) { <START> ((LockedException)exception).getExtraInformation(); <END> request.getSession().setAttribute(IS_LOCKED, true); } } }</code><technical_language>remove unused line</technical_language>

Target:
public void onAuthenticationFailure( HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { super.onAuthenticationFailure(request, response, exception); HttpSession session = request.getSession(false); if (session != null || isAllowSessionCreation()) { String usernameParameter = loginDecisionFilter.getUsernameParameter(); String lastUserName = request.getParameter(usernameParameter); request.getSession().setAttribute(LAST_USERNAME_KEY, lastUserName); String provider = request.getParameter("provider"); provider = Strings.isNullOrEmpty(provider) ? "internal" : provider; request.getSession().setAttribute(LAST_PROVIDER_KEY, provider); request.getSession().setAttribute(IS_LOCKED, false); if(exception instanceof LdapAuthenticationProcessException) { request.getSession().setAttribute(ERROR_KEY, "login.ldap.internal.user.exists"); } if(exception instanceof LockedException) { request.getSession().setAttribute(IS_LOCKED, true); } } }
Source:
<code>private static void setResponseVisibleSettings(PageData data, FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasResultVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.resultsVisibleFromTime); additionalSettings.setResponseVisibleDateChecked(hasResultVisibleDate); additionalSettings.setResponseVisibleDateValue(hasResultVisibleDate ? TimeHelper.formatDate(feedbackSession.resultsVisibleFromTime) : ""); additionalSettings.setResponseVisibleTimeOptions( data.getTimeOptionsAsElementTags( hasResultVisibleDate ? feedbackSession.resultsVisibleFromTime : <START> null)); <END> additionalSettings.setResponseVisibleDateDisabled(!hasResultVisibleDate); additionalSettings.setResponseVisibleImmediatelyChecked( Const.TIME_REPRESENTS_FOLLOW_VISIBLE.equals( feedbackSession.resultsVisibleFromTime)); additionalSettings.setResponseVisiblePublishManuallyChecked( Const.TIME_REPRESENTS_LATER.equals(feedbackSession.resultsVisibleFromTime) || Const.TIME_REPRESENTS_NOW.equals(feedbackSession.resultsVisibleFromTime)); additionalSettings.setResponseVisibleNeverChecked(Const.TIME_REPRESENTS_NEVER.equals(feedbackSession.resultsVisibleFromTime)); }</code><technical_language>Operators front of line</technical_language>

Target:
private static void setResponseVisibleSettings(PageData data, FeedbackSessionAttributes feedbackSession, FeedbackSessionsAdditionalSettingsFormSegment additionalSettings) { boolean hasResultVisibleDate = !TimeHelper.isSpecialTime(feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisibleDateChecked = hasResultVisibleDate; additionalSettings.responseVisibleDateValue = hasResultVisibleDate ? TimeHelper.formatDate(feedbackSession.resultsVisibleFromTime) : ""; additionalSettings.responseVisibleTimeOptions = data.getTimeOptionsAsElementTags( hasResultVisibleDate ? feedbackSession.resultsVisibleFromTime : null); additionalSettings.isResponseVisibleDateDisabled = !hasResultVisibleDate; additionalSettings.isResponseVisibleImmediatelyChecked = Const.TIME_REPRESENTS_FOLLOW_VISIBLE.equals( feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisiblePublishManuallyChecked = Const.TIME_REPRESENTS_LATER.equals(feedbackSession.resultsVisibleFromTime) || Const.TIME_REPRESENTS_NOW.equals(feedbackSession.resultsVisibleFromTime); additionalSettings.isResponseVisibleNeverChecked = Const.TIME_REPRESENTS_NEVER.equals( feedbackSession.resultsVisibleFromTime); }
Source:
<code>public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); <START> updateSendButtonEnabledState(); <END> editMessageTextField.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(Editable s) { updateSendButtonEnabledState(); } }); }</code><technical_language>This line changed. - if fragment is recreated previous state, e.g. device rotation - button animated again</technical_language>

Target:
public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); final String message = editMessageTextField.getText().toString(); sendButton.setEnabled(!message.trim().isEmpty()); editMessageTextField.addTextChangedListener(new SimpleTextWatcher() { @Override public void afterTextChanged(Editable s) { updateSendButtonEnabledState(); } }); }
Source:
<code>public String getUrl() { <START> return "module/radiology/radiologyOrder.list"; <END> }</code><technical_language>@ivange94 please RadiologyOrderListController.RADIOLOGY_ORDER_LIST_REQUEST_MAPPING</technical_language>

Target:
public String getUrl() { return RadiologyOrderListController.RADIOLOGY_ORDER_LIST_REQUEST_MAPPING; }
Source:
<code>public List<Long> allocateAvailableMacs(int numberOfMacs) { if (getAvailableMacsCount() < numberOfMacs) { throw new VdcBLLException(VdcBllErrors.MAC_POOL_NO_MACS_LEFT); } final List<Long> result = new ArrayList<>(numberOfMacs); int remainingMacs = numberOfMacs; while (remainingMacs > 0) { <START> final Range rangeWithAvailableMac = getRangeWithAvailableMac(true); <END> final List<Long> allocatedMacs = rangeWithAvailableMac.allocateMacs(remainingMacs); remainingMacs -= allocatedMacs.size(); result.addAll(allocatedMacs); } return result; }</code><technical_language>i.e. : final Range rangeWithAvailableMac = getRangeWithAvailableMac(); Validate.notNull(rangeWithAvailableMac);</technical_language>

Target:
public List<Long> allocateAvailableMacs(int numberOfMacs) { if (getAvailableMacsCount() < numberOfMacs) { throw new VdcBLLException(VdcBllErrors.MAC_POOL_NO_MACS_LEFT); } final List<Long> result = new ArrayList<>(numberOfMacs); int remainingMacs = numberOfMacs; while (remainingMacs > 0) { final Range rangeWithAvailableMac = getRangeWithAvailableMac(); Validate.notNull(rangeWithAvailableMac); final List<Long> allocatedMacs = rangeWithAvailableMac.allocateMacs(remainingMacs); remainingMacs -= allocatedMacs.size(); result.addAll(allocatedMacs); } return result; }
Source:
<code>public void testFileConversion() throws Exception { List<String> cmd = new ArrayList<>(); cmd.add("bin\\win32\\ffmpeg64.exe"); cmd.add("-i"); <START> cmd.add("C:\\Users\\IBM_ADMIN\\Downloads\\jungle\\utbr.mp3"); <END> cmd.add("-vn"); cmd.add("-f"); cmd.add("mp3"); cmd.add("pipe:"); String[] cmdArray = cmd.toArray(new String[cmd.size()]); OutputParams params = new OutputParams(null); ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.runInNewThread(); InputStream file = pw.getInputStream(0); PushbackInputStream pis = new PushbackInputStream(file); FileOutputStream os = new FileOutputStream("a.mp3"); int read = file.read(); read = pis.read(); byte[] bytes = new byte[1024 * 1024]; while (read != -1) { read = pis.read(); pis.unread(read); read = pis.read(bytes, 0, bytes.length); System.out.println(read); os.write(bytes); read = pis.read(); pis.unread(read); System.out.println(read); } file.close(); os.close(); }</code><technical_language>Do for</technical_language>

Target:
public void testFileConversion() throws Exception { List<String> cmd = new ArrayList<>(); cmd.add("bin\\win32\\ffmpeg64.exe"); cmd.add("-i"); cmd.add("utbr.mp3"); cmd.add("-vn"); cmd.add("-f"); cmd.add("mp3"); cmd.add("pipe:"); String[] cmdArray = cmd.toArray(new String[cmd.size()]); OutputParams params = new OutputParams(null); ProcessWrapperImpl pw = new ProcessWrapperImpl(cmdArray, params); pw.runInNewThread(); InputStream file = pw.getInputStream(0); PushbackInputStream pis = new PushbackInputStream(file); FileOutputStream os = new FileOutputStream("a.mp3"); int read = file.read(); read = pis.read(); byte[] bytes = new byte[1024 * 1024]; while (read != -1) { read = pis.read(); pis.unread(read); read = pis.read(bytes, 0, bytes.length); System.out.println(read); os.write(bytes); read = pis.read(); pis.unread(read); System.out.println(read); } file.close(); os.close(); }
Source:
<code>public ResultData customizeResult(ResultData result) { <START> if (extraOptions == null) { <END> return new MapResultData(); } MapResultData customizedResult = new MapResultData(); customizedResult.setResult(DATA_CTX_RESULT, result); MapResultData extraResult = new MapResultData(); extraOptions.getProperties() .forEach((key, value) -> extraResult.setResult(key, new ValueResultData(value))); customizedResult.setResult(DATA_CTX_EXTRA_OPTIONS, extraResult); return customizedResult; }</code><technical_language>This is changing behaviour. Previously add result DATA_CTX_RESULT</technical_language>

Target:
public ResultData customizeResult(ResultData result) { MapResultData customizedResult = new MapResultData(); customizedResult.setResult(DATA_CTX_RESULT, result); if (extraOptions == null) { return customizedResult; } MapResultData extraResult = new MapResultData(); extraOptions.getProperties().forEach((key, value) -> extraResult.setResult(key, new ValueResultData(value))); customizedResult.setResult(DATA_CTX_EXTRA_OPTIONS, extraResult); return customizedResult; }
Source:
<code>public void testExtraRequirementMissingVersionRange() throws Exception { Xpp3Dom dom = new Xpp3Dom("configuration"); Xpp3Dom extraRequirements = new Xpp3Dom("extraRequirements"); Xpp3Dom requirement = new Xpp3Dom("requirement"); Xpp3Dom type = new Xpp3Dom("type"); <START> Xpp3Dom id = new Xpp3Dom("id"); <END> requirement.addChild(id); requirement.addChild(type); extraRequirements.addChild(requirement); dom.addChild(extraRequirements); try { configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom); fail(); } catch (Exception e) { assertTrue(e.getMessage().contains( "Element <versionRange> is missing in <extraRequirements><requirement> section.")); } }</code><technical_language>extract of this code a "createConfigurationDom()" similar method avoid copy-pasted code in test methods</technical_language>

Target:
public void testExtraRequirementMissingVersionRange() throws Exception { Xpp3Dom dom = createConfigurationDom("type", "id"); try { configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom); fail(); } catch (BuildFailureException e) { assertTrue(e.getMessage().contains( "Element <versionRange> is missing in <extraRequirements><requirement> section.")); } }
Source:
<code>private static Archive<?> createDeploymentWithSpringContextLoaderListener() { WebArchive archive = ShrinkWrap.create(WebArchive.class, deploymentWithSpringContextLoaderListenerSpringIncluded + ".war") .addClass(TestResource.class) .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new PropertyPermission("arquillian.*", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), new FilePermission("<<ALL FILES>>", "read"), new LoggingPermission("control", "") ), "permissions.xml"); <START> <END> TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithSpringContextLoaderListenerSpringIncluded + ".war"), true); return archive; }</code><technical_language>valid</technical_language>

Target:
private static Archive<?> createDeploymentWithSpringContextLoaderListener() { WebArchive archive = ShrinkWrap.create(WebArchive.class, deploymentWithSpringContextLoaderListenerSpringIncluded + ".war") .addClass(TestResource.class) .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new RuntimePermission("accessDeclaredMembers"), new FilePermission("<<ALL FILES>>", "read"), new LoggingPermission("control", "") ), "permissions.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithSpringContextLoaderListenerSpringIncluded + ".war"), true); return archive; }
Source:
<code>public static ReadMapping decimalReadMapping(DecimalType decimalType) { requireNonNull(decimalType, "decimalType is null"); if (decimalType.isShort()) { return longReadMapping(decimalType, (resultSet, columnIndex) -> resultSet.getBigDecimal(columnIndex).unscaledValue().longValueExact()); } <START> else { <END> return sliceReadMapping(decimalType, (resultSet, columnIndex) -> encodeScaledValue(resultSet.getBigDecimal(columnIndex))); } }</code><technical_language>else is redundant</technical_language>

Target:
public static ReadMapping decimalReadMapping(DecimalType decimalType) { if (decimalType.isShort()) { return longReadMapping(decimalType, (resultSet, columnIndex) -> resultSet.getBigDecimal(columnIndex).unscaledValue().longValueExact()); } return sliceReadMapping(decimalType, (resultSet, columnIndex) -> encodeScaledValue(resultSet.getBigDecimal(columnIndex))); }
Source:
<code>public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { <START> if (exchange.getRequest().isCanceled()) { <END> if (response.getType() != Type.ACK) { LOGGER.finer("rejecting blockwise transfer for canceled Exchange"); EmptyMessage rst = EmptyMessage.newRST(response); sendEmptyMessage(exchange, rst); } } else if (!response.hasBlockOption()) { exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { BlockOption block = response.getOptions().getBlock1(); if (block != null) { handleBlock1Response(exchange, response, block); } block = response.getOptions().getBlock2(); if (block != null) { handleBlock2Response(exchange, response, block); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }</code><technical_language>blockwise layer is responsible of sending RST message for ~~non~~ block response</technical_language>

Target:
public void receiveResponse(final Exchange exchange, final Response response) { if (isTransparentBlockwiseHandlingEnabled()) { if (response.isError()) { switch(response.getCode()) { case REQUEST_ENTITY_INCOMPLETE: case REQUEST_ENTITY_TOO_LARGE: KeyUri key = getKey(exchange, exchange.getCurrentRequest()); clearBlock1Status(key); default: Response resp = new Response(response.getCode()); resp.setToken(exchange.getRequest().getToken()); if (exchange.getRequest().getType() == Type.CON) { resp.setType(Type.ACK); resp.setMID(exchange.getRequest().getMID()); } else { resp.setType(Type.NON); } resp.setSource(response.getSource()); resp.setSourcePort(response.getSourcePort()); resp.setPayload(response.getPayload()); resp.setOptions(response.getOptions()); exchange.setResponse(resp); upper().receiveResponse(exchange, resp); } } else if (!response.hasBlockOption()) { exchange.setResponse(response); upper().receiveResponse(exchange, response); } else { if (response.getOptions().hasBlock1()) { handleBlock1Response(exchange, response); } if (response.getOptions().hasBlock2()) { handleBlock2Response(exchange, response); } } } else { exchange.setResponse(response); upper().receiveResponse(exchange, response); } }
Source:
<code>public ServerTemplate cloneServerTemplate() { ServerTemplate serverTemplate = new ServerTemplate(); serverTemplate.setId(this.getId()); serverTemplate.setName(this.getName()); containersSpec.forEach(c -> serverTemplate.addContainerSpec(new ContainerSpec(c.getId(), c.getContainerName(), c.getServerTemplateKey(), c.getReleasedId(), c.getStatus(), cloneContainerConfigMap(c.getConfigs())))); final Map<Capability, ServerConfig> cloneServerConfig = new HashMap<>(); <START> configs.entrySet().stream().forEach(entry -> cloneServerConfig.put(entry.getKey(), entry.getValue())); <END> serverTemplate.setConfigs(cloneServerConfig); serverInstances.forEach(serverInstance -> serverTemplate.addServerInstance(new ServerInstanceKey(serverInstance.getServerTemplateId(), serverInstance.getServerName(), serverInstance.getServerInstanceId(), serverInstance.getUrl()))); final List<String> cloneCapabilities = new ArrayList<>(); capabilities.forEach(capability -> cloneCapabilities.add(capability)); serverTemplate.setCapabilities(cloneCapabilities); serverTemplate.setMode(mode); return serverTemplate; }</code><technical_language>This reduced final Map<Capability, ServerConfig> cloneServerConfig = new HashMap<>(configs); a shallow copy anyway</technical_language>

Target:
public ServerTemplate cloneServerTemplate() { synchronized (lock) { ServerTemplate serverTemplate = new ServerTemplate(this.getId(), this.getName(), new ArrayList<>(capabilities), getConfigs(), Collections.EMPTY_LIST, new ArrayList<ServerInstanceKey>(serverInstances)); containersSpec.forEach(c -> serverTemplate.addContainerSpec(new ContainerSpec(c.getId(), c.getContainerName(), c.getServerTemplateKey(), c.getReleasedId(), c.getStatus(), new EnumMap<>(c.getConfigs())))); serverTemplate.setMode(mode); return serverTemplate; } }
Source:
<code>static void removeFromWarsByContext(Entity entity, String targetName) { targetName = filenameToWebContextMapper.convertDeploymentTargetNameToContext(targetName); synchronized (entity) { Map<String,String> newWarsMap = MutableMap.copyOf(entity.getConfig(WARS_BY_CONTEXT)); String url = newWarsMap.remove(targetName); if (url==null) { <START> DynamicTasks.submit(Tasks.warning("Context "+targetName+" not known at "+entity+"; attempting to undeploy regardless", null), entity); <END> } ((EntityInternal)entity).setConfig(WARS_BY_CONTEXT, newWarsMap); } }</code><technical_language>Instead of warning here, prefer this method return true/false removed. If caller do logging. log message relate this method is doing. call in ControlledDynamicWebAppClusterImpl need do this logging get check calls getCluster().undeploy(target)</technical_language>

Target:
static boolean removeFromWarsByContext(Entity entity, String targetName) { targetName = FILENAME_TO_WEB_CONTEXT_MAPPER.convertDeploymentTargetNameToContext(targetName); synchronized (entity) { Map<String,String> newWarsMap = MutableMap.copyOf(entity.getConfig(WARS_BY_CONTEXT)); String url = newWarsMap.remove(targetName); if (url==null) { return false; } ((EntityInternal)entity).setConfig(WARS_BY_CONTEXT, newWarsMap); return true; } }
Source:
<code><START> public String toString() { <END> StringBuffer sb = new StringBuffer("{"); sb.append("webrequest:"); sb.append("uriHost" + this.getUriHost()); sb.append("uriPath," + this.getUriPath()); sb.append("uriQuery," + this.getUriQuery()); sb.append("httpStatus," + this.getHttpStatus()); sb.append("contentType," + this.getContentType()); sb.append("userAgent," + this.getUserAgent()) ; sb.append("X-Analytics," + this.getRawXAnalyticsHeader()); sb.append("}"); return sb.toString(); }</code><technical_language>If add a toString, output a JSON string</technical_language>

Target:
public String toString() { StringBuffer sb = new StringBuffer("{"); sb.append("webrequest:"); sb.append(", 'uriHost':" + this.getUriHost()); sb.append(", 'uriPath':" + this.getUriPath()); sb.append(", 'uriQuery':" + this.getUriQuery()); sb.append(", 'httpStatus':" + this.getHttpStatus()); sb.append(", 'contentType':" + this.getContentType()); sb.append(", 'userAgent':" + this.getUserAgent()) ; sb.append(", 'X-Analytics':" + this.getRawXAnalyticsHeader()); sb.append("}"); return sb.toString(); }
Source:
<code>protected Users mapDbUserCollection(List<DbUser> entities) { Users collection = new Users(); for (DbUser entity : entities) { <START> collection.getUsers().add(addLinks(modifyDomain(map(entity)), <END> BaseResource.class)); } return collection; }</code><technical_language>please add populate() call addLinks()</technical_language>

Target:
protected Users mapDbUserCollection(List<DbUser> entities) { Users collection = new Users(); for (DbUser entity : entities) { User user = map(entity); user = populate(user, entity); user = addLinks(user, BaseResource.class); collection.getUsers().add(user); } return collection; }
Source:
<code>public void handle(Request request, Response response) throws Exception { <START> userSession.checkLoggedIn().checkIsSystemAdministrator(); <END> GroupsWsResponse groupsWsResponse = doHandle(toGroupsRequest(request)); writeProtobuf(groupsWsResponse, request, response); }</code><technical_language>limit page size</technical_language>

Target:
public void handle(Request request, Response response) throws Exception { GroupsWsResponse groupsWsResponse = doHandle(toGroupsRequest(request)); writeProtobuf(groupsWsResponse, request, response); }
Source:
<code>public boolean waitForCompletion(long timeoutMillis) throws InterruptedException { WorkManager workManager = getWorkManager(); <START> if (workManager!=null) { <END> return workManager.awaitCompletion(timeoutMillis, TimeUnit.MILLISECONDS); } else { return false; } }</code><technical_language>Space before/after !=. Prefer early-exit idiom: if (workManager == null) { return false; } return workManager.await..</technical_language>

Target:
public boolean waitForCompletion(long timeoutMillis) throws InterruptedException { WorkManager workManager = getWorkManager(); if (workManager == null) { return false; } return workManager.awaitCompletion(timeoutMillis, TimeUnit.MILLISECONDS); }
Source:
<code>public void addAll(final Subscription... subscriptions) { <START> List<Subscription> subscriptionList = new ArrayList<Subscription>(4); <END> for (Subscription s : subscriptions) { if (!s.isUnsubscribed()) { subscriptionList.add(s); } } if (!unsubscribed) { synchronized (this) { if (!unsubscribed) { if (this.subscriptions == null) { this.subscriptions = new HashSet<Subscription>(4); } this.subscriptions.addAll(subscriptionList); return; } } } for (Subscription s : subscriptionList) { s.unsubscribe(); } }</code><technical_language>for-each in synchronized block need for a temporary array</technical_language>

Target:
public void addAll(final Subscription... subscriptions) { if (!unsubscribed) { synchronized (this) { if (!unsubscribed) { if (this.subscriptions == null) { this.subscriptions = new HashSet<Subscription>(subscriptions.length); } for (Subscription s : subscriptions) { if (!s.isUnsubscribed()) { this.subscriptions.add(s); } } return; } } } for (Subscription s : subscriptions) { s.unsubscribe(); } }
Source:
<code>protected ActionResult execute() { String idOfCourseToArchive = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(idOfCourseToArchive); String setArchiveStatus = getRequestParamValue(Const.ParamsNames.COURSE_ARCHIVE_STATUS); Assumption.assertNotNull(setArchiveStatus); boolean setArchive = Boolean.parseBoolean(setArchiveStatus); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(idOfCourseToArchive, account.googleId), logic.getCourse(idOfCourseToArchive)); try { if (setArchive) { logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); if (isRedirectedToHomePage()) { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED_FROM_HOMEPAGE, idOfCourseToArchive)); } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED, idOfCourseToArchive)); } statusToAdmin = "Course archived: " + idOfCourseToArchive; } else { <START> logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); <END> statusToUser.add(String.format(Const.StatusMessages.COURSE_UNARCHIVED, idOfCourseToArchive)); statusToAdmin = "Course unarchived: " + idOfCourseToArchive; } } catch (Exception e) { setStatusForException(e); } if (isRedirectedToHomePage()) { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } else { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); } }</code><technical_language>This appears is if else</technical_language>

Target:
protected ActionResult execute() { String idOfCourseToArchive = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(idOfCourseToArchive); String setArchiveStatus = getRequestParamValue(Const.ParamsNames.COURSE_ARCHIVE_STATUS); Assumption.assertNotNull(setArchiveStatus); boolean setArchive = Boolean.parseBoolean(setArchiveStatus); new GateKeeper().verifyAccessible( logic.getInstructorForGoogleId(idOfCourseToArchive, account.googleId), logic.getCourse(idOfCourseToArchive)); try { logic.setArchiveStatusOfInstructor(account.googleId, idOfCourseToArchive, setArchive); if (setArchive) { if (isRedirectedToHomePage()) { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED_FROM_HOMEPAGE, idOfCourseToArchive)); } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_ARCHIVED, idOfCourseToArchive)); } statusToAdmin = "Course archived: " + idOfCourseToArchive; } else { statusToUser.add(String.format(Const.StatusMessages.COURSE_UNARCHIVED, idOfCourseToArchive)); statusToAdmin = "Course unarchived: " + idOfCourseToArchive; } } catch (Exception e) { setStatusForException(e); } if (isRedirectedToHomePage()) { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } else { return createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE); } }
Source:
<code>private static List<AbstractHead> createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) throws InvalidPatternException { final List<AbstractHead> heads = new ArrayList<AbstractHead>( patternPart.length()); boolean escapeFlag = false; for (int i = 0; i < patternPart.length(); i++) { final char c = patternPart.charAt(i); switch (c) { case '*': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, true); heads.add(head); } break; } case '?': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, false); heads.add(head); } break; } case '\\': { if (escapeFlag || (invalidWildgetCharacter != null && invalidWildgetCharacter == '\\')) { addCharacterHead(heads, c); escapeFlag = false; } else { escapeFlag = true; } break; } default: addCharacterHead(heads, c); escapeFlag = false; } } <START> if (escapeFlag) { <END> throw new InvalidPatternException("Pattern ends with '\\'", patternPart); } return heads; }</code><technical_language>style-nit; braces for simple single-statement constrcuts</technical_language>

Target:
private static List<AbstractHead> createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) throws InvalidPatternException { final List<AbstractHead> heads = new ArrayList<AbstractHead>( patternPart.length()); boolean escapeFlag = false; for (int i = 0; i < patternPart.length(); i++) { final char c = patternPart.charAt(i); switch (c) { case '*': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, true); heads.add(head); } break; } case '?': { if (escapeFlag) { addCharacterHead(heads, c); escapeFlag = false; } else { final AbstractHead head = createWildCardHead( invalidWildgetCharacter, false); heads.add(head); } break; } case '\\': { if (escapeFlag || (invalidWildgetCharacter != null && invalidWildgetCharacter == '\\')) { addCharacterHead(heads, c); escapeFlag = false; } else { escapeFlag = true; } break; } default: addCharacterHead(heads, c); escapeFlag = false; } } if (escapeFlag) throw new InvalidPatternException("Pattern ends with '\\'", patternPart); return heads; }
Source:
<code>protected void resolveDuplicates(SourceRefElement handle) { Integer occurenceCount = this.occurenceCounts.get(handle); if (occurenceCount == null) this.occurenceCounts.put(handle, Integer.valueOf(1)); else { this.occurenceCounts.put(handle, Integer.valueOf(occurenceCount.intValue() + 1)); handle.occurrenceCount = <START> occurenceCount.intValue(); <END> } if (handle instanceof SourceType && ((SourceType) handle).isAnonymous()) { Object key = handle.getParent().getAncestor(IJavaElement.TYPE); occurenceCount = this.localOccurrenceCounts.get(key); if (occurenceCount == null) this.localOccurrenceCounts.put(key, Integer.valueOf(1)); else { this.localOccurrenceCounts.put(key, Integer.valueOf(occurenceCount.intValue() + 1)); ((SourceType)handle).localOccurrenceCount = occurenceCount.intValue(); } } }</code><technical_language>+ 1, increment before, in block</technical_language>

Target:
protected void resolveDuplicates(SourceRefElement handle) { Integer occurenceCount = this.occurenceCounts.get(handle); if (occurenceCount == null) this.occurenceCounts.put(handle, Integer.valueOf(1)); else { this.occurenceCounts.put(handle, Integer.valueOf(occurenceCount.intValue() + 1)); handle.occurrenceCount = occurenceCount.intValue() + 1; } if (handle instanceof SourceType && ((SourceType) handle).isAnonymous()) { Object key = handle.getParent().getAncestor(IJavaElement.TYPE); occurenceCount = this.localOccurrenceCounts.get(key); if (occurenceCount == null) this.localOccurrenceCounts.put(key, Integer.valueOf(1)); else { this.localOccurrenceCounts.put(key, Integer.valueOf(occurenceCount.intValue() + 1)); ((SourceType)handle).localOccurrenceCount = occurenceCount.intValue() + 1; } } }
Source:
<code>public void testGetDetailAst() { final DetailAST ast = new DetailAST(); <START> final FullIdent indent = FullIdent.createFullIdent(ast); <END> Assert.assertEquals("Invalid full indent", ast, indent.getDetailAST()); }</code><technical_language>This a detailed test is more complex this. a test more 1 AST show stick if is more</technical_language>

Target:
public void testGetDetailAst() throws Exception { final FileText testFileText = new FileText( new File(getPath("InputFullIdentTestArrayType.java")).getAbsoluteFile(), System.getProperty("file.encoding", StandardCharsets.UTF_8.name())); final DetailAST packageDefinitionNode = JavaParser.parse(new FileContents(testFileText)); final DetailAST packageName = packageDefinitionNode.getFirstChild().getNextSibling(); final FullIdent ident = FullIdent.createFullIdent(packageName); Assert.assertEquals("Invalid full indent", "com[1x8]", ident.getDetailAst().toString()); }
Source:
<code><START> public int getNumberOfMessages() { <END> while (true) { final long size = producerIndex; if (size == RESIZING) { Thread.yield(); continue; } return (int) Math.min(size, Integer.MAX_VALUE); } }</code><technical_language>isLive is volatile sync is remove, this updated atomic field updater? no</technical_language>

Target:
public int getNumberOfMessages() { return messages.size(); }
Source:
<code>public AdWebViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); <START> WebSettings webSettings = webView.getSettings(); <END> webSettings.setJavaScriptEnabled(true); txtSponsored.setVisibility(View.VISIBLE); this.clickUrl = null; }</code><technical_language>need for instanciation, right? webView.getSettings().setJavaScriptEnabled(true);</technical_language>

Target:
public AdWebViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); webView.getSettings().setJavaScriptEnabled(true); txtSponsored.setVisibility(View.VISIBLE); this.clickUrl = null; }
Source:
<code>public void configure(HttpSecurity http) throws Exception { log.debug("Smart Cosmos Security enabled, all requests must be authorized and no login redirect is offered."); http <START> .exceptionHandling() <END> .accessDeniedHandler(new DirectAccessDeniedHandler()) .authenticationEntryPoint(new DirectUnauthorizedEntryPoint("/login")) .and() .antMatcher("/**").authorizeRequests() .anyRequest().authenticated() .and() .anonymous() .key(SmartCosmosAnonymousUser.ANONYMOUS_AUTHENTICATION_KEY) .principal(SmartCosmosAnonymousUser.ANONYMOUS_USER); }</code><technical_language>thank for formatting</technical_language>

Target:
public void configure(HttpSecurity http) throws Exception { log.debug("Smart Cosmos Security enabled, all requests must be authorized and no login redirect is offered."); http .exceptionHandling() .accessDeniedHandler(new DirectAccessDeniedHandler()) .authenticationEntryPoint(new DirectUnauthorizedEntryPoint("/login")) .and() .antMatcher("/**").authorizeRequests() .anyRequest().authenticated() .and() .anonymous() .key(SmartCosmosUser.ANONYMOUS_AUTHENTICATION_KEY) .principal(SmartCosmosUser.ANONYMOUS_USER); }
Source:
<code>public void testDepositSwitchCreateSuccess() throws Exception { HashMap<String, String> userAuth = new HashMap<>(); userAuth.put("user_id", "user_good"); userAuth.put("auth_token", "pass_good"); Response<ItemImportResponse> itemImportResponse = client().service() .itemImport(new ItemImportRequest(Arrays.asList("identity", "auth"), userAuth) .withWebhook("<LINK_0>")) .execute(); assertSuccessResponse(itemImportResponse); assertNotNull(itemImportResponse.body().getAccessToken()); String accessToken = itemImportResponse.body().getAccessToken(); Response<AccountsGetResponse> accountsGetResponse = client().service() .accountsGet(new AccountsGetRequest(accessToken)).execute(); assertSuccessResponse(accountsGetResponse); assertNotNull(accountsGetResponse.body().getAccounts()); <START> String accountId = accountsGetResponse.body().getAccounts().get(0).getAccountId(); <END> Response<DepositSwitchCreateResponse> depositSwitchCreateResponse = client().service() .depositSwitchCreate(new DepositSwitchCreateRequest(accountId, accessToken)).execute(); assertSuccessResponse(depositSwitchCreateResponse); assertNotNull(depositSwitchCreateResponse.body().getDepositSwitchId()); }</code><technical_language>Instead of grabbing zero'th index, filter for account type subtype instead</technical_language>

Target:
public void testDepositSwitchCreateSuccess() throws Exception { HashMap<String, String> userAuth = new HashMap<>(); userAuth.put("user_id", "user_good"); userAuth.put("auth_token", "pass_good"); Response<ItemImportResponse> itemImportResponse = client().service() .itemImport(new ItemImportRequest(Arrays.asList("identity", "auth"), userAuth) .withWebhook("<LINK_0>")) .execute(); assertSuccessResponse(itemImportResponse); assertNotNull(itemImportResponse.body().getAccessToken()); String accessToken = itemImportResponse.body().getAccessToken(); Response<AccountsGetResponse> accountsGetResponse = client().service() .accountsGet(new AccountsGetRequest(accessToken)).execute(); assertSuccessResponse(accountsGetResponse); assertNotNull(accountsGetResponse.body().getAccounts()); List<Account> accounts = accountsGetResponse.body().getAccounts(); String accountId = ""; for (int i = 0; i < accounts.size(); i++) { if (accounts.get(i).getType().equals("depository")) { accountId = accounts.get(i).getAccountId(); break; } } Response<DepositSwitchCreateResponse> depositSwitchCreateResponse = client().service() .depositSwitchCreate(new DepositSwitchCreateRequest(accountId, accessToken)).execute(); assertSuccessResponse(depositSwitchCreateResponse); assertNotNull(depositSwitchCreateResponse.body().getDepositSwitchId()); }
Source:
<code>protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) { <START> if (c == null) { <END> try { c = findClass(name); } catch (final ClassNotFoundException e) { c = super.loadClass(name, resolve); } } } if (resolve) { resolveClass(c); } return c; }</code><technical_language>harmful, null check is done twice</technical_language>

Target:
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException { Class<?> c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (final ClassNotFoundException e) { c = super.loadClass(name, resolve); } } if (resolve) { resolveClass(c); } return c; }
Source:
<code>public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/BPMN2-SimpleRestartTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithTimerTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithObsoleteTest.bpmn2"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/kmodule", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } KieMavenRepository repository = getKieMavenRepository(); repository.deployArtifact(releaseId, kJar1, pom); <START> ReleaseId releaseId3 = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, "1.1.0"); <END> InternalKieModule kJar3 = createKieJar(ks, releaseId3, processes); File pom3 = new File("target/kmodule3", "pom.xml"); pom3.getParentFile().mkdirs(); try { FileOutputStream fs = new FileOutputStream(pom3); fs.write(getPom(releaseId3).getBytes()); fs.close(); } catch (Exception e) { } repository = getKieMavenRepository(); repository.deployArtifact(releaseId3, kJar3, pom3); }</code><technical_language>2 kjar deployed I rename following: - releaseId3 releaseId2 - kJar3 kJar2 - pom3 pom2 - target/kmodule2 Question is: do need deploy processes a version</technical_language>

Target:
public void prepare() { configureServices(); logger.debug("Preparing kjar"); KieServices ks = KieServices.Factory.get(); ReleaseId releaseId = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, VERSION); List<String> processes = new ArrayList<String>(); processes.add("repo/processes/general/BPMN2-SimpleRestartTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithTimerTest.bpmn2"); processes.add("repo/processes/general/BPMN2-SimpleRestartWithObsoleteTest.bpmn2"); InternalKieModule kJar1 = createKieJar(ks, releaseId, processes); File pom = new File("target/kmodule", "pom.xml"); pom.getParentFile().mkdir(); try { FileOutputStream fs = new FileOutputStream(pom); fs.write(getPom(releaseId).getBytes()); fs.close(); } catch (Exception e) { } KieMavenRepository repository = getKieMavenRepository(); repository.deployArtifact(releaseId, kJar1, pom); ReleaseId releaseId2 = ks.newReleaseId(GROUP_ID, ARTIFACT_ID, "1.1.0"); InternalKieModule kJar2 = createKieJar(ks, releaseId2, processes); File pom2 = new File("target/kmodule2", "pom.xml"); pom2.getParentFile().mkdirs(); try { FileOutputStream fs = new FileOutputStream(pom2); fs.write(getPom(releaseId2).getBytes()); fs.close(); } catch (Exception e) { } repository = getKieMavenRepository(); repository.deployArtifact(releaseId2, kJar2, pom2); }
Source:
<code>public HistoricJobLogQuery hostname(String hostname) { <START> ensureNotNull("hostName", hostname); ensureNotContainsEmptyString("hostName", Collections.singletonList(hostname)); <END> this.hostname = hostname; return this; }</code><technical_language>I guess instead of lines? suggestion ensureNotEmpty("hostName", hostname);</technical_language>

Target:
public HistoricJobLogQuery hostname(String hostname) { ensureNotEmpty("hostName", hostname); this.hostname = hostname; return this; }
Source:
<code>public void detach(Attachable service) { if (ServoController.class.isAssignableFrom(service.getClass())) { detachServoController((ServoController) service); return; } <START> error("%s doesn't know how to attach a %s", getClass().getSimpleName(), service.getClass().getSimpleName()); <END> }</code><technical_language>log message is "attach" in "detach" method. this is misleading</technical_language>

Target:
public void detach(Attachable service) { if (!isAttached(controller)) { return; } if (ServoController.class.isAssignableFrom(service.getClass())) { disable(); if (controller != null) { ServoController temp = controller; controller = null; controllerName = null; temp.detach(this); } broadcastState(); } else { error("%s doesn't know how to detach a %s", getClass().getSimpleName(), service.getClass().getSimpleName()); } }
Source:
<code>private void resetRoles(Role role) { try { PermissionCollector permissionCollector = (PermissionCollector) findByClass(PermissionCollector.class); if (permissionCollector != null) { permissionCollector.resetRoles(role); } } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>logger</technical_language>

Target:
private void resetRoles(Role role) { try { PermissionCollector permissionCollector = (PermissionCollector) findByClass(PermissionCollector.class); if (permissionCollector != null) { permissionCollector.resetRoles(role); } } catch (Exception e) { Logger.getLogger(getClass().getName()).log(Level.SEVERE, String.format("Reset permissions of role %s failed", role.name()), e); } }