auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void searchExternalGroups(final String searchFilter, final AsyncCallback<List<AccountGroup.ExternalNameKey>> callback) { final Collection<GroupReference> groups = groupBackend.suggest("ldapgroup/" + searchFilter); final List<AccountGroup.ExternalNameKey> matches = Lists.newArrayListWithCapacity(groups.size()); for (GroupReference ref : groups) { int index = ref.getUUID().get().indexOf(':'); if ((index >= 0) && !internalGroupBackend.handles(ref.getUUID())) { matches.add(new AccountGroup.ExternalNameKey( ref.getUUID().get().substring(index + 1))); } } Collections.sort(matches); callback.onSuccess(matches); }

Target:
public void searchExternalGroups(final String searchFilter, final AsyncCallback<List<AccountGroup.ExternalNameKey>> callback) { String prefix; switch (authConfig.getAuthType()) { case HTTP_LDAP: case LDAP: case LDAP_BIND: case CLIENT_SSL_CERT_LDAP: prefix = "ldapgroup/"; break; default: callback.onSuccess(Collections.<AccountGroup.ExternalNameKey>emptyList()); return; } final Collection<GroupReference> groups = groupBackend.suggest(prefix + searchFilter); final List<AccountGroup.ExternalNameKey> matches = Lists.newArrayListWithCapacity(groups.size()); for (GroupReference ref : groups) { int index = ref.getUUID().get().indexOf(':'); if ((index >= 0) && !internalGroupBackend.handles(ref.getUUID())) { matches.add(new AccountGroup.ExternalNameKey( ref.getUUID().get().substring(index + 1))); } } Collections.sort(matches); callback.onSuccess(matches); }
Source:
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { List<ItemStack> items = Lists.newArrayListWithCapacity(inv.getSizeInventory()); for (int i = 0; i < inv.getSizeInventory(); ++i) { ItemStack itemstack = inv.getStackInSlot(i); if (!itemstack.isEmpty()) { items.add(itemstack); } } int size = items.size(); if (size > 0) { int[] stackSelectedItem = new int[size + 1], stackSelectedIngredient = new int[size + 1]; boolean[] isItemSelected = new boolean[size], isIngredientSelected = new boolean[this.input.size()]; int pointer = 1; while (pointer > 0) { for (int i = stackSelectedItem[pointer]; i < size; ++i) { if (!isItemSelected[i]) { ItemStack itemstack = items.get(i); for (int j = this.input.size() - 1; j >= 0; --j) { if (!isIngredientSelected[j] && this.input.get(j).apply(itemstack)) { stackSelectedIngredient[pointer] = j; stackSelectedItem[pointer++] = i; isIngredientSelected[j] = true; isItemSelected[i] = true; i = -1; break; } } if (pointer > size) { return size == this.input.size(); } } } isIngredientSelected[stackSelectedIngredient[--pointer]] = false; isItemSelected[stackSelectedItem[pointer]++] = false; } } return false; }

Target:
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World world) { int ingredientCount = 0; RecipeItemHelper recipeItemHelper = new RecipeItemHelper(); for (int i = 0; i < inv.getSizeInventory(); ++i) { ItemStack itemstack = inv.getStackInSlot(i); if (!itemstack.isEmpty()) { ++ingredientCount; recipeItemHelper.accountStack(itemstack); } } return ingredientCount == this.input.size() && recipeItemHelper.canCraft(this, null); }
Source:
LocalPaxosComponents(TimelockPaxosMetrics metrics, PaxosUseCase paxosUseCase, Path legacyLogDirectory, Path sqliteLogDirectory, UUID leaderUuid, boolean canCreateNewClients) { this.metrics = metrics; this.paxosUseCase = paxosUseCase; this.baseLogDirectory = legacyLogDirectory; this.sqliteLogDirectory = paxosUseCase.logDirectoryRelativeToDataDirectory(sqliteLogDirectory).toAbsolutePath(); this.leaderUuid = leaderUuid; this.memoizedBatchAcceptor = Suppliers.memoize(this::createBatchAcceptor); this.memoizedBatchLearner = Suppliers.memoize(this::createBatchLearner); this.memoizedBatchPingableLeader = Suppliers.memoize(this::createBatchPingableLeader); this.canCreateNewClients = canCreateNewClients; }

Target:
LocalPaxosComponents(TimelockPaxosMetrics metrics, PaxosUseCase paxosUseCase, Path legacyLogDirectory, Path sqliteLogDirectory, UUID leaderUuid, boolean canCreateNewClients) { this.metrics = metrics; this.paxosUseCase = paxosUseCase; this.baseLogDirectory = legacyLogDirectory; this.sqliteLogDirectory = sqliteLogDirectory; this.leaderUuid = leaderUuid; this.memoizedBatchAcceptor = Suppliers.memoize(this::createBatchAcceptor); this.memoizedBatchLearner = Suppliers.memoize(this::createBatchLearner); this.memoizedBatchPingableLeader = Suppliers.memoize(this::createBatchPingableLeader); this.canCreateNewClients = canCreateNewClients; }
Source:
public ActionForward createDEAStandaloneGratuityPR(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { final DegreeCurricularPlan degreeCurricularPlan = getDegreeCurricularPlan(request); InstallmentBean installment = getInstallment(); StandaloneInstallmentBean standaloneInstallment = null; if (installment instanceof StandaloneInstallmentBean) { standaloneInstallment = (StandaloneInstallmentBean) installment; if (!installment.hasRequiredInformation()) { addActionMessage("installment", request, "label.payments.postingRules.paymentPlan.information.to.create.installment.is.all.required"); return createDEAGratuityPRInvalid(mapping, form, request, response); } } try { PostingRulesManager.createDEAStandaloneGratuityPostingRule(standaloneInstallment, degreeCurricularPlan); } catch (DomainException e) { addActionMessage(request, e.getKey(), e.getArgs()); return createDEAGratuityPRInvalid(mapping, form, request, response); } return showPostGraduationDegreeCurricularPlanPostingRules(mapping, form, request, response); }

Target:
public ActionForward createDEAStandaloneGratuityPR(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { final DegreeCurricularPlan degreeCurricularPlan = getDegreeCurricularPlan(request); InstallmentBean installment = getInstallment(); StandaloneInstallmentBean standaloneInstallment = (StandaloneInstallmentBean) installment; if (!installment.hasRequiredInformation()) { addActionMessage("installment", request, "label.payments.postingRules.paymentPlan.information.to.create.installment.is.all.required"); return createDEAGratuityPRInvalid(mapping, form, request, response); } try { PostingRulesManager.createDEAStandaloneGratuityPostingRule(standaloneInstallment, degreeCurricularPlan); } catch (DomainException e) { PaymentPlanBean paymentPlanEditor = new PaymentPlanBean(ExecutionYear.readCurrentExecutionYear()); request.setAttribute("degreeCurricularPlan", degreeCurricularPlan); request.setAttribute("paymentPlanEditor", paymentPlanEditor); request.setAttribute("installmentEditor", installment); addActionMessage(request, e.getKey(), e.getArgs()); return mapping.findForward("createDEAGratuityPR"); } return showPostGraduationDegreeCurricularPlanPostingRules(mapping, form, request, response); }
Source:
public void setOnTitleClickListener(final OnClickListener listener) { if (listener != null) { title.setOnClickListener(listener); } }

Target:
public void setOnTitleClickListener(final OnClickListener listener) { title.setOnClickListener(listener); }
Source:
public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { List<TableConfig> tableConfigs = getTableConfigsForSchema(schema.getSchemaName()); SchemaUtils.validate(schema, tableConfigs); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, "Invalid schema: " + schema.getSchemaName() + ". Reason: " + e.getMessage(), Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }

Target:
public String validateSchema(FormDataMultiPart multiPart) { Schema schema = getSchemaFromMultiPart(multiPart); try { List<TableConfig> tableConfigs = _pinotHelixResourceManager.getTableConfigsForSchema(schema.getSchemaName()); SchemaUtils.validate(schema, tableConfigs); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, "Invalid schema: " + schema.getSchemaName() + ". Reason: " + e.getMessage(), Response.Status.BAD_REQUEST, e); } return schema.toPrettyJsonString(); }
Source:
public void init(FilterConfig filterConfig) throws ServletException { dirAllowed = Context.getConfig().getBoolean("media.dirAllowed"); }

Target:
public void init(FilterConfig filterConfig) throws ServletException { }
Source:
@Override public Integer exitStatus(FilePath workspace, Launcher launcher) throws IOException, InterruptedException { Integer status = super.exitStatus(workspace, launcher); if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { LOGGER.log(Level.FINE, "apparently never started in {0}", controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0 && currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { LOGGER.log(Level.FINE, "heartbeat touches apparently not running in {0}", controlDir); return recordExitStatus(workspace, -1); } else { checkedTimestamp = currentTimestamp; LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } } return null; }

Target:
@Override public Integer exitStatus(FilePath workspace, Launcher launcher) throws IOException, InterruptedException { Integer status = super.exitStatus(workspace, launcher); if (status != null) { LOGGER.log(Level.FINE, "found exit code {0} in {1}", new Object[] {status, controlDir}); return status; } long now = System.nanoTime(); if (lastCheck == 0) { LOGGER.log(Level.FINE, "starting check in {0}", controlDir); lastCheck = now; } else if (now > lastCheck + TimeUnit.SECONDS.toNanos(HEARTBEAT_CHECK_INTERVAL)) { lastCheck = now; long currentTimestamp = getLogFile(workspace).lastModified(); if (currentTimestamp == 0) { LOGGER.log(Level.FINE, "apparently never started in {0}", controlDir); return recordExitStatus(workspace, -2); } else if (checkedTimestamp > 0) { if (currentTimestamp < checkedTimestamp) { LOGGER.log(Level.WARNING, "apparent clock skew in {0}", controlDir); } else if (currentTimestamp < checkedTimestamp + TimeUnit.SECONDS.toMillis(HEARTBEAT_MINIMUM_DELTA)) { FilePath pidFile = pidFile(workspace); if (pidFile.exists()) { LOGGER.log(Level.FINE, "still have {0} so heartbeat checks unreliable; process may or may not be alive", pidFile); } else { LOGGER.log(Level.FINE, "heartbeat touches apparently not running in {0}", controlDir); return recordExitStatus(workspace, -1); } } } else { LOGGER.log(Level.FINE, "seeing recent log file modifications in {0}", controlDir); } checkedTimestamp = currentTimestamp; } return null; }
Source:
public void shouldGetEncountersByEncounterTypeAndPatient() throws Exception { executeDataSet("EncountersForDifferentTypesWithObservations.xml"); SimpleObject result = deserialize(handle(newGetRequest(getURI(), new Parameter("s","default"),new Parameter("patient", "41c6b35e-c093-11e3-be87-005056821db0"), new Parameter("encounterType", "ff7397ea-c090-11e3-be87-005056821db0")))); Assert.assertEquals(1,((ArrayList)result.get("results")).size()); }

Target:
public void shouldGetEncountersByEncounterTypeAndPatient() throws Exception { executeDataSet("EncountersForDifferentTypesWithObservations.xml"); SimpleObject result = deserialize(handle(newGetRequest(getURI(), new Parameter("s","default"),new Parameter("patient", "41c6b35e-c093-11e3-be87-005056821db0"), new Parameter("encounterType", "ff7397ea-c090-11e3-be87-005056821db0")))); ArrayList encounters = (ArrayList) result.get("results"); Assert.assertEquals(1, encounters.size()); String encounterUuid = (String) PropertyUtils.getProperty(encounters.get(0), "uuid"); Assert.assertEquals("62967e68-96bb-11e0-8d6b-9b9415a91465", encounterUuid); }
Source:
private <T> T tryExecuteTransactionLoop(SessionWork<T> sessionWork, boolean readWriteTransaction, boolean readOnlyEntities) { Throwable lastException = null; int dampingFactor = PASchedulerProperties.SCHEDULER_DB_TRANSACTION_DAMPING_FACTOR.getValueAsInt(); int delay = PASchedulerProperties.SCHEDULER_DB_TRANSACTION_SLEEP_DELAY.getValueAsInt(); int maximumNumberOfRetries = Math.max(PASchedulerProperties.SCHEDULER_DB_TRANSACTION_MAXIMUM_RETRIES.getValueAsInt(), 0); for (int i = 0; i <= maximumNumberOfRetries; i++) { try { return tryExecuteTransaction(sessionWork, readWriteTransaction, readOnlyEntities); } catch (DatabaseManagerException e) { throw e; } catch (Throwable exception) { lastException = exception; logger.warn(String.format("Database operation failed. Automatic retry in %d ms (attempt %d)", delay, i), exception); new Sleeper(delay, logger).sleep(); delay *= dampingFactor; } } logger.warn("Maximum number of transaction retries exceeded, giving up. Last exception is: ", lastException); throw new DatabaseManagerException(lastException); }

Target:
private <T> T tryExecuteTransactionLoop(SessionWork<T> sessionWork, boolean readWriteTransaction, boolean readOnlyEntities) { Throwable lastException = null; int dampingFactor = PASchedulerProperties.SCHEDULER_DB_TRANSACTION_DAMPING_FACTOR.getValueAsInt(); int delay = PASchedulerProperties.SCHEDULER_DB_TRANSACTION_SLEEP_DELAY.getValueAsInt(); int maximumNumberOfRetries = Math.max(PASchedulerProperties.SCHEDULER_DB_TRANSACTION_MAXIMUM_RETRIES.getValueAsInt(), 0); for (int i = 0; i <= maximumNumberOfRetries; i++) { try { return tryExecuteTransaction(sessionWork, readWriteTransaction, readOnlyEntities); } catch (DatabaseManagerException | IllegalArgumentException e) { throw e; } catch (Throwable exception) { lastException = exception; logger.warn(String.format("Database operation failed. Automatic retry in %d ms (attempt %d)", delay, i), exception); new Sleeper(delay, logger).sleep(); delay *= dampingFactor; } } logger.warn("Maximum number of transaction retries exceeded, giving up. Last exception is: ", lastException); throw new DatabaseManagerException(lastException); }
Source:
public static String creationDateFormat( final Date date ) { return CREATION_DATE_FORMAT.format(date); }

Target:
public static String creationDateFormat( final Date date ) { return CREATION_DATE_FORMAT.format(date.toInstant()); }
Source:
protected BufferedImage readImage(Blob blob) { try { return readImage(blob.getStream()); } catch (IOException e) { throw new UncheckedIOException(e); } }

Target:
protected BufferedImage readImage(Blob blob) { try (InputStream is = blob.getStream()) { return readImage(is); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
private static String _getNight(final long time) { final Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(time); final int ampm = cal.get(Calendar.AM_PM); final Calendar endCal; final int startDay; final int endDay; if (ampm == Calendar.AM) { endCal = (Calendar) cal.clone(); endDay = cal.get(Calendar.DAY_OF_MONTH); cal.add(Calendar.DAY_OF_MONTH, -1); startDay = cal.get(Calendar.DAY_OF_MONTH); } else { startDay = cal.get(Calendar.DAY_OF_MONTH); cal.add(Calendar.DAY_OF_MONTH, 1); endCal = cal; endDay = cal.get(Calendar.DAY_OF_MONTH); } final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateFormat f = new SimpleDateFormat("yyyy-MMM-dd"); buf.append(f.format(endCal.getTime())); return buf.toString(); }

Target:
private static String _getNight(final long time) { final Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(time); final int ampm = cal.get(Calendar.AM_PM); final Calendar endCal; final int startDay; final int endDay; if (ampm == Calendar.AM) { endCal = (Calendar) cal.clone(); endDay = cal.get(Calendar.DAY_OF_MONTH); cal.add(Calendar.DAY_OF_MONTH, -1); startDay = cal.get(Calendar.DAY_OF_MONTH); } else { startDay = cal.get(Calendar.DAY_OF_MONTH); cal.add(Calendar.DAY_OF_MONTH, 1); endCal = cal; endDay = cal.get(Calendar.DAY_OF_MONTH); } final StringBuilder buf = new StringBuilder(); buf.append(startDay).append("/").append(endDay).append(" "); final DateFormat f = new SimpleDateFormat("MMM yyyy"); buf.append(f.format(endCal.getTime())); return buf.toString(); }
Source:
public void testGetEmailInfo() throws MessagingException { String email = "receiver@gmail.tmt"; String from = "sender@gmail.tmt"; String subject = "email subject"; if (Config.isUsingSendgrid()) { Sendgrid message = new Sendgrid(Config.SENDGRID_USERNAME, Config.SENDGRID_PASSWORD); message.addTo(email); message.setFrom(from); message.setSubject(subject); message.setHtml("<h1>email body</h1>"); assertEquals("[Email sent]to=receiver@gmail.tmt|from=sender@gmail.tmt|subject=email subject", Emails.getEmailInfo(message)); } else { Session session = Session.getDefaultInstance(new Properties(), null); MimeMessage message = new MimeMessage(session); message.addRecipient(Message.RecipientType.TO, new InternetAddress(email)); message.setFrom(new InternetAddress(from)); message.setSubject(subject); message.setContent("<h1>email body</h1>", "text/html"); assertEquals("[Email sent]to=receiver@gmail.tmt|from=sender@gmail.tmt|subject=email subject", Emails.getEmailInfo(message)); } }

Target:
public void testGetEmailInfo() throws MessagingException, JSONException { String email = "receiver@gmail.tmt"; String from = "sender@gmail.tmt"; String subject = "email subject"; ______TS("Sendgrid message"); Sendgrid message = new Sendgrid(Config.SENDGRID_USERNAME, Config.SENDGRID_PASSWORD); message.addTo(email); message.setFrom(from); message.setSubject(subject); message.setHtml("<h1>email body</h1>"); assertEquals("[Email sent]to=receiver@gmail.tmt|from=sender@gmail.tmt|subject=email subject", Emails.getEmailInfo(message)); ______TS("MimeMessage"); Session session = Session.getDefaultInstance(new Properties(), null); MimeMessage mimeMessage = new MimeMessage(session); mimeMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(email)); mimeMessage.setFrom(new InternetAddress(from)); mimeMessage.setSubject(subject); mimeMessage.setContent("<h1>email body</h1>", "text/html"); assertEquals("[Email sent]to=receiver@gmail.tmt|from=sender@gmail.tmt|subject=email subject", Emails.getEmailInfo(mimeMessage)); }
Source:
private Optional<String> getNormalizedAssetPath(NinjaProperties ninjaProperties){ Optional<String> assetBaseDir = Optional.absent(); String baseDir = ninjaProperties.get( "application.static.asset.basedir"); if(baseDir != null){ String pathSeparator = baseDir.substring( baseDir.length() - 1 ); if(!pathSeparator.matches( "[/\\\\]" )){ baseDir += File.separator; } assetBaseDir = Optional.of(baseDir); } return assetBaseDir; }

Target:
private Optional<String> getNormalizedAssetPath(NinjaProperties ninjaProperties){ String baseDir = ninjaProperties.get( NinjaConstant.APPLICATION_STATIC_ASSET_BASEDIR ); return Optional.fromNullable(FilenameUtils.normalizeNoEndSeparator(baseDir)); }
Source:
public ServerCnxnFactory getServerCnxnFactory() { if (secureServerCnxnFactory != null) { return secureServerCnxnFactory; } return serverCnxnFactory; }

Target:
public ServerCnxnFactory getServerCnxnFactory() { return serverCnxnFactory; }
Source:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { assert newCapacity >= 0 && newCapacity <= buf.maxCapacity(); int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer oldNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; allocate(parent.threadCache(), buf, newCapacity); int bytesToCopy; if (newCapacity > oldCapacity) { bytesToCopy = oldCapacity; } else { buf.trimIndicesToCapacity(newCapacity); bytesToCopy = newCapacity; } if (bytesToCopy > 0) { oldNioBuffer = memoryCopy(oldMemory, oldNioBuffer, oldOffset, buf, bytesToCopy); } if (freeOldMemory) { free(oldChunk, oldNioBuffer, oldHandle, oldMaxLength, buf.cache); } }

Target:
void reallocate(PooledByteBuf<T> buf, int newCapacity, boolean freeOldMemory) { assert newCapacity >= 0 && newCapacity <= buf.maxCapacity(); int oldCapacity = buf.length; if (oldCapacity == newCapacity) { return; } PoolChunk<T> oldChunk = buf.chunk; ByteBuffer oldNioBuffer = buf.tmpNioBuf; long oldHandle = buf.handle; T oldMemory = buf.memory; int oldOffset = buf.offset; int oldMaxLength = buf.maxLength; allocate(parent.threadCache(), buf, newCapacity); int bytesToCopy; if (newCapacity > oldCapacity) { bytesToCopy = oldCapacity; } else { buf.trimIndicesToCapacity(newCapacity); bytesToCopy = newCapacity; } memoryCopy(oldMemory, oldOffset, buf, bytesToCopy); if (freeOldMemory) { free(oldChunk, oldNioBuffer, oldHandle, oldMaxLength, buf.cache); } }
Source:
public Map<String, ?> exportUsers() { Map<String, Object> exportMap = new HashMap<>(); Map<Long, List<Seat>> seatMap = seatService.getAllSeats().stream(). collect(Collectors.groupingBy(seat -> seat.getUser().getId())); exportMap.put("users", ticketService.getAllTickets().stream().map(Ticket::getOwner) .map(user -> new UserExportDTO(user.getEmail(), user.getPassword(), user.getId(), seatMap.get(user.getId()))).collect(Collectors.toList())); exportMap.put("teams", teamService.getAllTeams().stream() .map(team -> new TeamExportDTO(team.getTeamName(), team.getCaptain().getId(), team.getMembers().stream().map(User::getId).collect(Collectors.toList())))); return exportMap; }

Target:
public Map<String, ?> exportUsers() { Map<String, Object> exportMap = new HashMap<>(); Map<Long, List<Seat>> seatMap = seatService.getAllSeats().stream() .filter(Seat::isTaken) .collect(Collectors.groupingBy(seat -> seat.getUser().getId())); exportMap.put("users", ticketService.getAllTickets().stream() .filter(Ticket::isValid) .map(Ticket::getOwner) .map(user -> new UserExportDTO(user.getEmail(), user.getPassword(), user.getProfile().getDisplayName(), user.getId(), seatMap.get(user.getId()).stream() .map(Seat::toString).collect(Collectors.toList()))) .collect(Collectors.toList())); exportMap.put("teams", teamService.getAllTeams().stream() .map(team -> new TeamExportDTO(team.getTeamName(), team.getCaptain().getId(), team.getMembers().stream() .map(User::getId).collect(Collectors.toList())))); return exportMap; }
Source:
public String importUserSkill(ImportUserSkillTO importUserSkills, User user) throws InternalServerErrorException, BadRequestException { List<String> failTechnologies = new ArrayList<>(); for (UserSkillTO userSkill : importUserSkills.getUserSkill()) { String email = userSkill.getEmail(); TechGalleryUser techGalleryUser; try { techGalleryUser = userService.getUserSyncedWithProvider(email.split("@")[0]); for (String techSkill : userSkill.getTechSkill()) { String[] split = techSkill.split(";"); if (!failTechnologies.contains(split[0])) { Technology technology = recoverTechnologyById(split[0]); if (technology != null) { Skill skillEntity = skillDao.findByUserAndTechnology(techGalleryUser, technology); if (skillEntity != null) { log.info("Inactivating skill: " + skillEntity.getId()); skillEntity.setInactivatedDate(new Date()); skillEntity.setActive(Boolean.FALSE); skillDao.update(skillEntity); } Skill skill = new Skill(); skill.setValue(Integer.parseInt(split[1])); addNewSkill(skill, techGalleryUser, technology); } else { failTechnologies.add(split[0]); } } } } catch (NotFoundException e) { log.info(e.getMessage()); } } return null; }

Target:
public String importUserSkill(ImportUserSkillTO importUserSkills, User user) throws InternalServerErrorException, BadRequestException { List<String> failTechnologies = new ArrayList<>(); for (UserSkillTO userSkill : importUserSkills.getUserSkill()) { String email = userSkill.getEmail(); TechGalleryUser techGalleryUser; try { techGalleryUser = userService.getUserSyncedWithProvider(email.split("@")[0]); for (String techSkill : userSkill.getTechSkill()) { String[] splitedTechSkill = techSkill.split(";"); if (!failTechnologies.contains(splitedTechSkill[0])) { Technology technology = recoverTechnologyById(splitedTechSkill[0]); if (technology != null) { Skill skillEntity = skillDao.findByUserAndTechnology(techGalleryUser, technology); if (skillEntity != null) { log.info("Inactivating skill: " + skillEntity.getId()); skillEntity.setInactivatedDate(new Date()); skillEntity.setActive(Boolean.FALSE); skillDao.update(skillEntity); } Skill skill = new Skill(); skill.setValue(Integer.parseInt(splitedTechSkill[1])); addNewSkill(skill, techGalleryUser, technology); } else { failTechnologies.add(splitedTechSkill[0]); } } } } catch (NotFoundException e) { log.log(Level.INFO, "User " + userSkill.getEmail() + " not found during import. Row ignored.", e); } } return null; }
Source:
public String toString() { return MoreObjects.toStringHelper(this) .add("_uri", _uri) .add("_version", _version) .add("_name", _name) .toString(); }

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("Uri", _uri) .add("Version", _version) .add("Name", _name) .toString(); }
Source:
private void buildSdk(String projectId, ProjectDataType dataType, ClientMessageOutputStream outStream, Project project, FileData sdkFileData) throws IOException, SandboxServiceException { outStream.println("Successfully got SDK."); File rootDir = createTempDirectory("demo-project"); try { outStream.println("Processing project archive..."); String sourceArchiveFile = Environment.getServerHomeDir() + "/" + DEMO_PROJECTS_FOLDER + "/" + project.getSourceArchive(); String rootProjectDir = rootDir.getAbsolutePath(); executeCommand(outStream, new String[]{"tar", "-C", rootProjectDir, "-xzvf", sourceArchiveFile}, null); File sdkFile = new File(rootProjectDir + "/" + project.getSdkLibDir() + "/" + sdkFileData.getFileName()); FileOutputStream fos = FileUtils.openOutputStream(sdkFile); fos.write(sdkFileData.getFileData()); fos.flush(); fos.close(); ProjectDataKey dataKey = new ProjectDataKey(projectId, dataType); if (dataType == ProjectDataType.SOURCE) { buildSdkSource(outStream, rootDir, sourceArchiveFile, rootProjectDir, dataKey); } else { buildBinary(outStream, project, rootDir, dataKey); } } finally { FileUtils.deleteDirectory(rootDir); } }

Target:
private void buildSdk(String projectId, ProjectDataType dataType, ClientMessageOutputStream outStream, Project project, FileData sdkFileData) throws IOException, SandboxServiceException { File rootDir = createTempDirectory("demo-project"); try { outStream.println("Processing project archive..."); String sourceArchiveFile = Environment.getServerHomeDir() + "/" + DEMO_PROJECTS_FOLDER + "/" + project.getSourceArchive(); String rootProjectDir = rootDir.getAbsolutePath(); executeCommand(outStream, new String[]{"tar", "-C", rootProjectDir, "-xzvf", sourceArchiveFile}, null); File sdkFile = new File(rootProjectDir + "/" + project.getSdkLibDir() + "/" + sdkFileData.getFileName()); FileOutputStream fos = FileUtils.openOutputStream(sdkFile); fos.write(sdkFileData.getFileData()); fos.flush(); fos.close(); ProjectDataKey dataKey = new ProjectDataKey(projectId, dataType); if (dataType == ProjectDataType.SOURCE) { buildSdkSource(outStream, rootDir, sourceArchiveFile, rootProjectDir, dataKey); } else { buildBinary(outStream, project, rootDir, dataKey); } } finally { FileUtils.deleteDirectory(rootDir); } }
Source:
public void testRefFilter() throws Exception { SubscribedRepository r = new SubscribedRepository(publisherConfig .getSubscriber("origin", db.getDirectory().getAbsolutePath())); r.setUpRefs(); Map<String, Ref> refs = r.getRemoteRefs(); assertTrue(refs.containsKey("refs/heads/master")); assertTrue(refs.containsKey("refs/tags/A")); Map<String, Ref> pubsubRefs = r.getPubSubRefs(); assertTrue(pubsubRefs.containsKey("refs/heads/master")); assertTrue(pubsubRefs.containsKey("refs/tags/A")); }

Target:
public void testRefFilter() throws Exception { SubscribedRepository r = new SubscribedRepository(publisherConfig .getSubscriber("origin", db.getDirectory().getAbsolutePath())); r.setUpRefs(); Set<String> refs = r.getRemoteRefs().keySet(); assertEquals(13, refs.size()); assertTrue(refs.contains("refs/heads/master")); assertTrue(refs.contains("refs/tags/A")); Set<String> pubsubRefs = r.getPubSubRefs().keySet(); assertEquals(13, pubsubRefs.size()); assertTrue(pubsubRefs.contains("refs/heads/master")); assertTrue(pubsubRefs.contains("refs/tags/A")); }
Source:
private void initBanner(Context context, ChartboostParams params, ChartboostBannerListener bannerListener) { String location = params.getLocation(); LinearLayout bannerContainer = new LinearLayout(context); LinearLayout.LayoutParams paramsLayout = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); paramsLayout.gravity = Gravity.CENTER_HORIZONTAL; mChartboostBanner = new ChartboostBanner(context, location, params.getBannerSize(), bannerListener); mChartboostBanner.setAutomaticallyRefreshesContent(false); bannerContainer.addView(mChartboostBanner, paramsLayout); }

Target:
private ChartboostBanner initBanner(Context context, ChartboostParams params, ChartboostBannerListener bannerListener) { String location = params.getLocation(); mBannerContainer = new FrameLayout(context); FrameLayout.LayoutParams paramsLayout = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); paramsLayout.gravity = Gravity.CENTER_HORIZONTAL; mChartboostBanner = new ChartboostBanner(context, location, params.getBannerSize(), bannerListener); mChartboostBanner.setAutomaticallyRefreshesContent(false); mBannerContainer.addView(mChartboostBanner, paramsLayout); return mChartboostBanner; }
Source:
private void beginLog() throws IOException { if (logs == null) { finishRef(); out.flushFileHeader(); out.setBlockSize(logBlockSize); logs = new Section(LOG_BLOCK_TYPE); } }

Target:
private void beginLog() throws IOException { if (logs == null) { finishRefAndObjSections(); out.flushFileHeader(); out.setBlockSize(logBlockSize); logs = new Section(LOG_BLOCK_TYPE); } }
Source:
public void initializeSelectorMetrics(final AtomicLong activeConnections) { numActiveConnections = new Gauge<Long>() { @Override public Long getValue() { return activeConnections.get(); } }; }

Target:
void initializeSelectorMetrics(final AtomicLong activeConnections) { numActiveConnections = new Gauge<Long>() { @Override public Long getValue() { return activeConnections.get(); } }; }
Source:
public KieServerTypePermission(Set<Class<?>> classes) { super(patterns()); this.classes = classes; }

Target:
public KieServerTypePermission(Set<Class<?>> classes) { super(patterns()); this.classes = classes == null ? new HashSet<>() : classes; }
Source:
public void sendPhoneVerificationToken() throws Exception { when(service.getNextToken()).thenReturn("012345"); service.sendPhoneVerificationToken(study, USER_ID, TestConstants.PHONE); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); SmsMessageProvider provider = smsMessageProviderCaptor.getValue(); Map<String,String> tokens = provider.getTokenMap(); assertEquals("012-345", tokens.get("sptoken")); assertEquals("2 hours", tokens.get("phoneVerificationExpirationPeriod")); String message = provider.getSmsRequest().getMessage(); assertTrue(message.contains("012-345")); }

Target:
public void sendPhoneVerificationToken() throws Exception { when(service.getNextToken()).thenReturn("012345"); service.sendPhoneVerificationToken(study, USER_ID, TestConstants.PHONE); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); verify(mockCacheProvider).setObject(eq("012345"), stringCaptor.capture(), eq(AccountWorkflowService.VERIFY_OR_RESET_EXPIRE_IN_SECONDS)); String string = stringCaptor.getValue(); JsonNode node = BridgeObjectMapper.get().readTree(string); assertEquals("api", node.get("studyId").textValue()); assertEquals("userId", node.get("userId").textValue()); SmsMessageProvider provider = smsMessageProviderCaptor.getValue(); Map<String,String> tokens = provider.getTokenMap(); assertEquals("012-345", tokens.get("sptoken")); assertEquals("2 hours", tokens.get("phoneVerificationExpirationPeriod")); String message = provider.getSmsRequest().getMessage(); assertTrue(message.contains("012-345")); verifyNoMoreInteractions(mockCacheProvider); }
Source:
Optional<AggregateStateRecord> perform() { Iterator<AggregateEventRecord> historyBackward = storage.historyBackward(request); if (!historyBackward.hasNext()) { return Optional.absent(); } while (historyBackward.hasNext() && snapshot == null) { AggregateEventRecord record = historyBackward.next(); switch (record.getKindCase()) { case EVENT: history.addFirst(record.getEvent()); break; case SNAPSHOT: snapshot = record.getSnapshot(); break; case KIND_NOT_SET: default: throw newIllegalStateException("Event or snapshot missing in record: \"%s\"", shortDebugString(record)); } } AggregateStateRecord result = buildRecord(); return Optional.of(result); }

Target:
Optional<AggregateStateRecord> perform() { Iterator<AggregateEventRecord> historyBackward = storage.historyBackward(request); if (!historyBackward.hasNext()) { return Optional.absent(); } while (historyBackward.hasNext() && snapshot == null) { AggregateEventRecord record = historyBackward.next(); handleRecord(record); } AggregateStateRecord result = buildRecord(); return Optional.of(result); }
Source:
public final LogicalPageKey getLogicalPage( final int page ) { if ( isPaginationFinished() == false ) { throw new IllegalStateException(); } try { return logicalPages.get( page ); } catch ( IndexOutOfBoundsException e ) { throw e; } }

Target:
public final LogicalPageKey getLogicalPage( final int page ) { if ( isPaginationFinished() == false ) { throw new IllegalStateException(); } return logicalPages.get( page ); }
Source:
protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) throws OperationFailedException { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_S3); String username = ModelAttributes.S3_USERNAME.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.USER_NAME, username); String password = ModelAttributes.S3_PASSWORD.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.USER_PASSWORD, password); String bucketName = ModelAttributes.S3_BUCKET_NAME.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.BUCKET_NAME, bucketName); String endPoint = ModelAttributes.S3_ENDPOINT_URL.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.ENDPOINT_URL, endPoint); }

Target:
protected void writeBinaryStorageConfiguration( String repositoryName, OperationContext context, ModelNode model, EditableDocument binaries ) throws OperationFailedException { binaries.set(FieldName.TYPE, FieldValue.BINARY_STORAGE_TYPE_S3); String username = ModelAttributes.S3_USERNAME.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.USER_NAME, username); String password = ModelAttributes.S3_PASSWORD.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.USER_PASSWORD, password); String bucketName = ModelAttributes.S3_BUCKET_NAME.resolveModelAttribute(context, model).asString(); binaries.setString(FieldName.BUCKET_NAME, bucketName); ModelNode node = ModelAttributes.S3_ENDPOINT_URL.resolveModelAttribute(context, model); String endPoint = node.isDefined() ? node.asString() : null; binaries.setString(FieldName.ENDPOINT_URL, endPoint); }
Source:
public void testReviewArtifactIsFiltered() { ITask task = mock(ITask.class); when(task.getAttribute("ARTIFACT")).thenReturn("true"); TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter(); boolean wasFiltered = !filter.select(null, task); Assert.assertTrue(wasFiltered); }

Target:
public void testReviewArtifactIsFiltered() { ITask task = mock(ITask.class); when(task.getAttribute("ARTIFACT")).thenReturn("true"); TaskReviewArtifactFilter filter = new TaskReviewArtifactFilter(); boolean wasFiltered = !filter.select(null, task); assertTrue(wasFiltered); }
Source:
private void addSupportedGroups(List<SupportedGroup> defaultGroups, PublicKey publicKey) { if (publicKey != null) { SupportedGroup group = SupportedGroup.fromPublicKey(publicKey); if (group != null && group.isUsable() && !defaultGroups.contains(group)) { if (!config.recommendedSupportedGroupsOnly || !group.isRecommended()) { defaultGroups.add(group); } } } }

Target:
private void addSupportedGroups(List<SupportedGroup> defaultGroups, PublicKey publicKey) { if (publicKey != null) { SupportedGroup group = SupportedGroup.fromPublicKey(publicKey); if (group != null && group.isUsable() && !defaultGroups.contains(group)) { if (!config.recommendedSupportedGroupsOnly || group.isRecommended()) { defaultGroups.add(group); } } } }
Source:
public boolean hasTaskReadyToRun() { TaskContainer nextExecuteTask = executeQueue.peek(); if (nextExecuteTask != null) { if (! nextExecuteTask.running) { return true; } else if (executeQueue.size() > 1) { return true; } } Iterator<TaskContainer> it = scheduledQueue.iterator(); while (it.hasNext()) { TaskContainer scheduledTask = it.next(); if (scheduledTask.getDelayInMillis() <= 0 && ! scheduledTask.running) { return true; } } return false; }

Target:
public boolean hasTaskReadyToRun() { synchronized (executeQueueRemoveLock) { TaskContainer nextExecuteTask = executeQueue.peek(); if (nextExecuteTask != null) { if (! nextExecuteTask.running) { return true; } else if (executeQueue.size() > 1) { return true; } } } synchronized (scheduledQueue.getModificationLock()) { Iterator<TaskContainer> it = scheduledQueue.iterator(); while (it.hasNext()) { TaskContainer scheduledTask = it.next(); if (scheduledTask.getDelayInMillis() <= 0 && ! scheduledTask.running) { return true; } } } return false; }
Source:
protected void renderDesktop(Execution exec, Page page, Writer out) throws IOException { HtmlPageRenders.setContentType(exec, page); final PageCtrl pageCtrl = (PageCtrl) page; write(out, HtmlPageRenders.outFirstLine(exec, page)); write(out, HtmlPageRenders.outDocType(exec, page)); Double number = exec.getBrowser("mobile"); out.write("<html"); if (number == null || number.intValue() == 0) { Double ie = exec.getBrowser("ie"); write(out, pageCtrl.getRootAttributes()); out.write(">\n<head>\n" + "<title>"); } else { write(out, pageCtrl.getRootAttributes()); out.write(">\n<head>\n"); String viewport = page.getViewport(); if (!"auto".equals(viewport)) out.write("<meta name=\"viewport\" content=\"" + viewport + "\" > \n"); else if (!"true".equals(Library.getProperty("org.zkoss.zul.tablet.meta.viewport.disabled", "false"))) out.write( "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" > \n"); out.write("<title>"); } write(out, page.getTitle()); out.write("</title>\n"); outHeaders(exec, page, out); out.write("</head>\n"); out.write("<body>\n"); HtmlPageRenders.outPageContent(exec, page, out, false); writeln(out, HtmlPageRenders.outUnavailable(exec)); WebApp webApp = exec.getDesktop().getWebApp(); Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice"); if (notice instanceof String) { out.write((String) notice); } out.write("\n</body>\n</html>\n"); }

Target:
protected void renderDesktop(Execution exec, Page page, Writer out) throws IOException { HtmlPageRenders.setContentType(exec, page); final PageCtrl pageCtrl = (PageCtrl) page; write(out, HtmlPageRenders.outFirstLine(exec, page)); write(out, HtmlPageRenders.outDocType(exec, page)); Double number = exec.getBrowser("mobile"); out.write("<html"); if (number == null || number.intValue() == 0) { write(out, pageCtrl.getRootAttributes()); out.write(">\n<head>\n" + "<title>"); } else { write(out, pageCtrl.getRootAttributes()); out.write(">\n<head>\n"); String viewport = page.getViewport(); if (!"auto".equals(viewport)) out.write("<meta name=\"viewport\" content=\"" + viewport + "\" > \n"); else if (!"true".equals(Library.getProperty("org.zkoss.zul.tablet.meta.viewport.disabled", "false"))) out.write( "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" > \n"); out.write("<title>"); } write(out, page.getTitle()); out.write("</title>\n"); outHeaders(exec, page, out); out.write("</head>\n"); out.write("<body>\n"); HtmlPageRenders.outPageContent(exec, page, out, false); writeln(out, HtmlPageRenders.outUnavailable(exec)); WebApp webApp = exec.getDesktop().getWebApp(); Object notice = webApp.getAttribute("org.zkoss.zk.ui.client.notice"); if (notice instanceof String) { out.write((String) notice); } out.write("\n</body>\n</html>\n"); }
Source:
public void postProcessAdminWrongOptionsException() throws Exception { String token = getAuthToken(admin.getEmail(), password); MvcResult mvcResult = getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data")) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), new LinkedList<>(), ProcessStatus.FAILED)))).andReturn(); ObjectMapper mapper = new ObjectMapper(); String content = mvcResult.getResponse().getContentAsString(); Map<String, Object> map = mapper.readValue(content, Map.class); Integer processId = Integer.valueOf(String.valueOf(map.get("processId"))); getClient(token).perform(delete("/api/system/processes/" + processId)); }

Target:
public void postProcessAdminWrongOptionsException() throws Exception { String token = getAuthToken(admin.getEmail(), password); AtomicReference<Integer> idRef = new AtomicReference<>(); try { getClient(token) .perform(post("/api/system/scripts/mock-script/processes").contentType("multipart/form-data")) .andExpect(status().isAccepted()) .andExpect(jsonPath("$", is( ProcessMatcher.matchProcess("mock-script", String.valueOf(admin.getID()), new LinkedList<>(), ProcessStatus.FAILED)))) .andDo(result -> idRef .set(read(result.getResponse().getContentAsString(), "$.processId"))); } finally { ProcessBuilder.deleteProcess(idRef.get()); } }
Source:
KeyboardOperationMove(final GridLayer gridLayer, final GridLienzoScrollable panel) { super(gridLayer); this.panel = Optional.of(panel); }

Target:
KeyboardOperationMove(final GridLayer gridLayer, final GridLienzoScrollable panel) { super(gridLayer); this.panel = Optional.ofNullable(panel); }
Source:
private Button createAction(CarMenuItem item) { Context context = getContext(); Button button = new Button(new ContextThemeWrapper(context, item.getStyleResId()), null, 0); CharSequence title = item.getTitle(); button.setText(title); if (item.getIcon() != null) { Drawable icon = item.getIcon().loadDrawable(context); icon.setBounds(0, 0, 30, 30); button.setCompoundDrawables(icon, null, null, null); if (title != null && !TextUtils.isEmpty(title)) { button.setCompoundDrawablePadding(mActionButtonPadding); } } button.setEnabled(item.isEnabled()); button.setOnClickListener(v -> { CarMenuItem.OnClickListener onClickListener = item.getOnClickListener(); if (onClickListener != null) { onClickListener.onClick(item); } }); return button; }

Target:
private Button createAction(CarMenuItem item) { Context context = getContext(); Button button = new Button(new ContextThemeWrapper(context, item.getStyleResId()), null, 0); CharSequence title = item.getTitle(); button.setText(title); if (item.getIcon() != null) { Drawable icon = item.getIcon().loadDrawable(context); icon.setBounds(0, 0, mActionButtonIconBound, mActionButtonIconBound); button.setCompoundDrawables(icon, null, null, null); if (title != null && !TextUtils.isEmpty(title)) { button.setCompoundDrawablePadding(mActionButtonPadding); } } button.setEnabled(item.isEnabled()); button.setOnClickListener(v -> { CarMenuItem.OnClickListener onClickListener = item.getOnClickListener(); if (onClickListener != null) { onClickListener.onClick(item); } }); return button; }
Source:
protected SeekableStreamDataSourceMetadata<Integer, Long> createDataSourceMetadata( SeekableStreamPartitions<Integer, Long> partitions ) { return null; }

Target:
protected SeekableStreamDataSourceMetadata<Integer, Long> createDataSourceMetadata( SeekableStreamPartitions<Integer, Long> partitions ) { throw new UnsupportedOperationException(); }
Source:
private void renameTemplate(Node templateNode, String plfVersion, Workspace workspace){ try { if(templateNode.hasNode(TemplateService.DIALOGS)){ Node dialogs = templateNode.getNode(TemplateService.DIALOGS); NodeIterator iter = dialogs.getNodes(); while (iter.hasNext()) { Node dialogNode = iter.nextNode(); StringBuffer path = new StringBuffer(dialogNode.getPath()); workspace.move(path.toString(), path.append("_").append(plfVersion).toString()); } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Exceptions happen while renaming dialogs", e); } } try { if(templateNode.hasNode(TemplateService.VIEWS)){ Node views = templateNode.getNode(TemplateService.VIEWS); NodeIterator iter = views.getNodes(); while (iter.hasNext()) { Node viewNode = iter.nextNode(); StringBuffer path = new StringBuffer(viewNode.getPath()); workspace.move(path.toString(), path.append("_").append(plfVersion).toString()); } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Exceptions happen while renaming views", e); } } try { if(templateNode.hasNode(TemplateService.SKINS)){ Node skins = templateNode.getNode(TemplateService.SKINS); NodeIterator iter = skins.getNodes(); while (iter.hasNext()) { Node skinNode = iter.nextNode(); StringBuffer path = new StringBuffer(skinNode.getPath()); workspace.move(path.toString(), path.append("_").append(plfVersion).toString()); } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Exceptions happen while renaming skins", e); } } }

Target:
private void renameTemplate(Node templateNode, String plfVersion, Workspace workspace){ String[] childNodesName = new String[]{TemplateService.DIALOGS, TemplateService.VIEWS, TemplateService.SKINS}; for (String nodeName : childNodesName) { try { if(templateNode.hasNode(nodeName)){ Node childNode = templateNode.getNode(nodeName); if (log.isInfoEnabled()) { log.info("Process rename children of {}", nodeName); } NodeIterator iter = childNode.getNodes(); while (iter.hasNext()) { Node node = iter.nextNode(); StringBuffer path = new StringBuffer(node.getPath()); workspace.move(path.toString(), path.append("_").append(plfVersion).toString()); } } } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Exceptions happen while renaming children of {}", nodeName, e); } } } }
Source:
public String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description) { String registrationID = new StringBuilder().append(layer).append(appContext).toString(); boolean providerAlreadyRegistrated = this.keyToAuthConfigProviderMap.containsKey(registrationID); this.keyToAuthConfigProviderMap.put(registrationID, provider); if (providerAlreadyRegistrated) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(false); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, false); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }

Target:
public String registerConfigProvider(AuthConfigProvider provider, String layer, String appContext, String description) { String registrationID = new StringBuilder().append(layer).append(appContext).toString(); boolean providerAlreadyRegistered = this.keyToAuthConfigProviderMap.containsKey(registrationID); this.keyToAuthConfigProviderMap.put(registrationID, provider); if (providerAlreadyRegistered) { JBossRegistrationContext context = (JBossRegistrationContext) this.keyToRegistrationContextMap.get(registrationID); context.setDescription(description); context.setIsPersistent(false); RegistrationListener listener = this.keyToRegistrationListenerMap.get(registrationID); if (listener != null) listener.notify(layer, appContext); } else { RegistrationContext context = new JBossRegistrationContext(layer, appContext, description, false); this.keyToRegistrationContextMap.put(registrationID, context); } return registrationID; }