auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void safeCopyExternalAssetsToPluginAssetRoot(final String pluginAssetsRoot) { Path externalAssetsPath = Paths.get(systemEnvironment.get(SystemEnvironment.GO_ANALYTICS_PLUGIN_EXTERNAL_ASSETS)); if (externalAssetsPath == null || !Files.exists(externalAssetsPath) || !Files.isDirectory(externalAssetsPath)) { LOGGER.debug("Analytics plugin external assets path ({}) does not exist or is not a directory. Not loading any assets.", externalAssetsPath); return; } try { Files.list(externalAssetsPath).forEach(path -> { try { Files.copy(path, Paths.get(pluginAssetsRoot, path.getFileName().toString())); } catch (Exception e) { LOGGER.error("Unable to copy analytics plugin external asset ({}) to plugin assets root.", path, e); } }); } catch (Exception e) { <START> LOGGER.error("Unable to list files in analytics plugin external assets location ({}).", externalAssetsPath, e); <END> } }</code><technical_language>@arvindsv bubble error fail write other plugin static assets disk. do here? If highcharts is present, work, more apparent a log message, no? I follow usages, making assumption thrown exceptions visible in UI</technical_language>

Target:
private void safeCopyExternalAssetsToPluginAssetRoot(final String pluginAssetsRoot) { Path externalAssetsPath = Paths.get(systemEnvironment.get(SystemEnvironment.GO_ANALYTICS_PLUGIN_EXTERNAL_ASSETS)); if (externalAssetsPath == null || !Files.exists(externalAssetsPath) || !Files.isDirectory(externalAssetsPath)) { LOGGER.debug("Analytics plugin external assets path ({}) does not exist or is not a directory. Not loading any assets.", externalAssetsPath); return; } try { Files.list(externalAssetsPath).forEach(path -> { try { Files.copy(path, Paths.get(pluginAssetsRoot, path.getFileName().toString())); } catch (Exception e) { LOGGER.error("Unable to copy analytics plugin external asset ({}) to plugin assets root.", path, e); throw new RuntimeException(e); } }); } catch (Exception e) { LOGGER.error("Unable to list files in analytics plugin external assets location ({}).", externalAssetsPath, e); throw new RuntimeException(e); } }
Source:
<code>public CorfuRuntime addLayoutServer(String layoutServer) { <START> bootstrapLayoutServers.add(layoutServer); <END> return this; }</code><technical_language>Add layoutServers too</technical_language>

Target:
public CorfuRuntime addLayoutServer(String layoutServer) { bootstrapLayoutServers.add(layoutServer); layoutServers.add(layoutServer); return this; }
Source:
<code>private Map<String, String> searchProjectsKeysByUuids(DbSession dbSession, List<ComponentDto> components) { Map<String, String> projectsKeysByUuid = components.stream() .filter(c -> c.uuid().equals(c.projectUuid())) .collect(toMap(ComponentDto::uuid, ComponentDto::key)); <START> Predicate<String> alreadyKnowProjectKey = projectsKeysByUuid::containsKey; <END> Set<String> projectUuidsToSearch = components.stream() .map(ComponentDto::projectUuid) .filter(alreadyKnowProjectKey.negate()) .collect(toHashSet()); List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch); projectsKeysByUuid.putAll(projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::key))); return projectsKeysByUuid; }</code><technical_language>This optimization is needed</technical_language>

Target:
private Map<String, String> searchProjectsKeysByUuids(DbSession dbSession, List<ComponentDto> components) { Set<String> projectUuidsToSearch = components.stream() .map(ComponentDto::projectUuid) .collect(toHashSet()); List<ComponentDto> projects = dbClient.componentDao().selectByUuids(dbSession, projectUuidsToSearch); return projects.stream().collect(toMap(ComponentDto::uuid, ComponentDto::key)); }
Source:
<code>public void traverseList() { Node currentNode = head; if (head != null) { do { <START> System.out.print(currentNode.value + " "); <END> currentNode = currentNode.nextNode; } while (currentNode != head); } }</code><technical_language>Avoid calls System.out... a proper logger</technical_language>

Target:
public void traverseList() { Node currentNode = head; if (head != null) { do { LOGGER.info(currentNode.value + " "); currentNode = currentNode.nextNode; } while (currentNode != head); } }
Source:
<code>public static void main(String[] args) { try { EngineStarter engineStarter = new EngineStarter(); engineStarter.springCtx.registerShutdownHook(); log.debug("Gonna start Messaging."); engineStarter.engineManager.startMessaging(); log.debug("Starting the runners."); engineStarter.engineManager.startRunnerThreads(); <START> log.debug("Done. Perun-Engine has started."); <END> System.out.println("Done. Perun-Engine has started."); if (SplashScreen.getSplashScreen() != null) { SplashScreen.getSplashScreen().close(); } } catch (HeadlessException e) { } catch (Exception e) { System.out.println("Can't start Perun-Engine: " + e); log.error("Can't start Perun-Engine: {}" , e); } }</code><technical_language>I this message in info. start engine, in a log file, started</technical_language>

Target:
public static void main(String[] args) { try { EngineStarter engineStarter = new EngineStarter(); engineStarter.springCtx.registerShutdownHook(); log.debug("Gonna start Messaging."); engineStarter.engineManager.startMessaging(); log.debug("Starting the runners."); engineStarter.engineManager.startRunnerThreads(); log.info("Done. Perun-Engine has started."); System.out.println("Done. Perun-Engine has started."); if (SplashScreen.getSplashScreen() != null) { SplashScreen.getSplashScreen().close(); } } catch (HeadlessException e) { } catch (Exception e) { System.out.println("Can't start Perun-Engine: " + e); log.error("Can't start Perun-Engine: {}" , e); } }
Source:
<code>public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); <START> Map<Long, Object> toDelete = new TreeMap<>(); <END> for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = (Long) ((TreeMap) toDelete).firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey : toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }</code><technical_language>I this in this case (within a function need Map) this case specifically needs TreeMap</technical_language>

Target:
public void deleteEntriesUsingCachePolicy(int numRowsToDelete) { IndexEventHolder indexEventHolder = (IndexEventHolder) stateHolder.getState().getEventHolder(); if (numRowsToDelete >= indexEventHolder.size()) { indexEventHolder.deleteAll(); } else { Set<Object> keys = indexEventHolder.getAllPrimaryKeyValues(); TreeMap<Long, Object> toDelete = new TreeMap<>(); for (Object key : keys) { if (toDelete.size() < numRowsToDelete) { toDelete.put((Long) indexEventHolder.getEvent(key).getOutputData()[cachePolicyAttributePosition], key); } else { Long timestamp = (Long) indexEventHolder.getEvent(key). getOutputData()[cachePolicyAttributePosition]; Long firstKey = toDelete.firstKey(); if (timestamp < firstKey) { toDelete.remove(firstKey); toDelete.put(timestamp, key); } } } for (Object deleteKey : toDelete.values()) { if (deleteKey != null) { indexEventHolder.deleteEvent(deleteKey); } } } }
Source:
<code>public Paginable<T> getPaginableEntries() { PageProviderDefinition ppDefinition = getPageProviderDefinition(); if (ppDefinition == null) { throw new NuxeoException("Page provider given not found"); } PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) ctx.getCoreSession()); List<SortInfo> sortersInfos = null; if (!StringUtils.isBlank(sortBy)) { String[] sorts = sortBy.split(","); String[] orders = null; if (!StringUtils.isBlank(sortOrder)) { orders = sortOrder.split(","); } <START> if (ArrayUtils.isNotEmpty(sorts)) { <END> sortersInfos = new ArrayList<>(sorts.length); for (int i = 0; i < sorts.length; i++) { String sort = sorts[i]; boolean sortAscending = orders != null && orders.length > i && "asc".equals(orders[i].toLowerCase()); sortersInfos.add(new SortInfo(sort, sortAscending)); } } } PageProvider<T> pp = (PageProvider<T>) pps.getPageProvider("", ppDefinition, getSearchDocument(), sortersInfos, pageSize, currentPageIndex, props, getParams()); return getPaginableEntries(pp); }</code><technical_language>Is this useful? If sortBy blank, sortBy.split(",") return a empty array no</technical_language>

Target:
public Paginable<T> getPaginableEntries() { PageProviderDefinition ppDefinition = getPageProviderDefinition(); if (ppDefinition == null) { throw new NuxeoException("Page provider given not found"); } PageProviderService pps = Framework.getService(PageProviderService.class); Map<String, Serializable> props = new HashMap<>(); props.put(CoreQueryDocumentPageProvider.CORE_SESSION_PROPERTY, (Serializable) ctx.getCoreSession()); List<SortInfo> sortInfos = null; if (!StringUtils.isBlank(sortBy)) { String[] sorts = sortBy.split(","); String[] orders = null; if (!StringUtils.isBlank(sortOrder)) { orders = sortOrder.split(","); } sortInfos = new ArrayList<>(sorts.length); for (int i = 0; i < sorts.length; i++) { String sort = sorts[i]; boolean sortAscending = orders != null && orders.length > i && "asc".equals(orders[i].toLowerCase()); sortInfos.add(new SortInfo(sort, sortAscending)); } } PageProvider<T> pp = (PageProvider<T>) pps.getPageProvider("", ppDefinition, getSearchDocument(), sortInfos, pageSize, currentPageIndex, props, getParams()); return getPaginableEntries(pp); }
Source:
<code>public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { <START> if (args.length < 1) { <END> throw new ConfigRuntimeException("bit_xor requires at least one argument", ExceptionType.InsufficientArgumentsException, t); } long val = Static.getInt(args[0], t); for (int i = 1; i < args.length; i++) { val = val ^ Static.getInt(args[i], t); } return new CInt(val, t); }</code><technical_language>this sense value? Also, a neat trick, turn insufficient arguments a compiler error. implement optimizeDynamic, throw a ConfigCompileException if children.size() < minSize, return null</technical_language>

Target:
public Construct exec(Target t, Environment environment, Construct... args) throws ConfigRuntimeException { long val = Static.getInt(args[0], t); for (int i = 1; i < args.length; i++) { val = val ^ Static.getInt(args[i], t); } return new CInt(val, t); }
Source:
<code>public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) { int retval = super.setErrorParameter(event, parameter); if (!event.getUI().getSession().getConfiguration().isProductionMode()) { String springBootVersion = SpringBootVersion.getVersion(); <START> final String[] numbers = springBootVersion == null ? null : springBootVersion.split("\\."); <END> if (numbers != null && numbers.length > 1 && "2".equals(numbers[0]) && 4 > Integer.parseInt(numbers[1])) { String customMessage = "<span>When using Spring Boot Devtools with " + "automatic reload, please note that routes can sometimes be " + "lost due to a <a href ='<LINK_0>'>" + "compilation race condition</a>. See " + "<a href='<LINK_1>'>" + "the documentation</a> for further workarounds and other " + "live reload alternatives."; getElement().appendChild(new Html(customMessage).getElement()); } } return retval; }</code><technical_language>if(springBootVersion == null) { return; } final FrontendVersion springVersion = new FrontendVersion(springBootVersion); if (springVersion.isOlderThan(new FrontendVersion(2,4,0))) { ..</technical_language>

Target:
public int setErrorParameter(BeforeEnterEvent event, ErrorParameter<NotFoundException> parameter) { int retval = super.setErrorParameter(event, parameter); if (!event.getUI().getSession().getConfiguration().isProductionMode()) { String springBootVersion = SpringBootVersion.getVersion(); if (springBootVersion == null || springBootVersion.isEmpty()) { return retval; } FrontendVersion version = new FrontendVersion(springBootVersion); if (version.isOlderThan(new FrontendVersion(2, 4, 0))) { String customMessage = "<span>When using Spring Boot Devtools with " + "automatic reload, please note that routes can sometimes be " + "lost due to a <a href ='<LINK_0>'>" + "compilation race condition</a>. See " + "<a href='<LINK_1>'>" + "the documentation</a> for further workarounds and other " + "live reload alternatives."; getElement().appendChild(new Html(customMessage).getElement()); } } return retval; }
Source:
<code>protected void addVmDynamicToList(VmDynamic vmDynamic) { <START> if (vdsManager.shouldUpdateVmStatus(vmDynamic)) { <END> vmDynamicToSave.put(vmDynamic.getId(), vmDynamic); } }</code><technical_language>more deeper in stack - event a time another processed, code is done means process save DB. I higher in stack - call perform method in this class if fetched stats latest</technical_language>

Target:
protected void addVmDynamicToList(VmDynamic vmDynamic) { vmDynamicToSave.put(vmDynamic.getId(), vmDynamic); }
Source:
<code>public static void updateTimeZone() { final TimeZone timeZone = TmfTimePreferences.getTimeZone(); <START> synchronized (formats) { <END> for (SimpleDateFormat sdf : formats) { sdf.setTimeZone(timeZone); } } }</code><technical_language>"formats" is ImmutableList, need synchronize iterate. want thread is modifying time zones a time though. suggest putting method synchronized instead, another lock TimeGraphScale's level</technical_language>

Target:
public static void updateTimeZone() { final TimeZone timeZone = TmfTimePreferences.getTimeZone(); for (SimpleDateFormat sdf : formats) { synchronized (sdf) { sdf.setTimeZone(timeZone); } } }
Source:
<code>protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { CreateCinderSnapshotCommand createCinderSnapshotCommand = (CreateCinderSnapshotCommand) command; CreateCinderSnapshotParameters parameters = (CreateCinderSnapshotParameters) createCinderSnapshotCommand.getParameters(); Guid diskId = parameters.getDestinationImageId(); ImageStatus imageStatus; if (parameters.getSnapshotType().equals(Snapshot.SnapshotType.STATELESS)) { imageStatus = createCinderSnapshotCommand.getCinderBroker().getDiskStatus(diskId); } else { imageStatus = createCinderSnapshotCommand.getCinderBroker().getSnapshotStatus(diskId); } <START> DiskImage disk = DbFacade.getInstance().getDiskImageDao().getSnapshotById(diskId); <END> if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }</code><technical_language>please injection for dao</technical_language>

Target:
protected void childCommandsExecutionEnded(CommandBase<?> command, boolean anyFailed, List<Guid> childCmdIds, CommandExecutionStatus status, int completedChildren) { CreateCinderSnapshotCommand createCinderSnapshotCommand = (CreateCinderSnapshotCommand) command; CreateCinderSnapshotParameters parameters = (CreateCinderSnapshotParameters) createCinderSnapshotCommand.getParameters(); Guid diskId = parameters.getDestinationImageId(); ImageStatus imageStatus; if (parameters.getSnapshotType().equals(Snapshot.SnapshotType.STATELESS)) { imageStatus = createCinderSnapshotCommand.getCinderBroker().getDiskStatus(diskId); } else { imageStatus = createCinderSnapshotCommand.getCinderBroker().getSnapshotStatus(diskId); } DiskImage disk = diskImageDao.getSnapshotById(diskId); if (imageStatus != null && imageStatus != disk.getImageStatus()) { switch (imageStatus) { case OK: setCommandEndStatus(command, false, status, childCmdIds); break; case ILLEGAL: setCommandEndStatus(command, true, status, childCmdIds); break; } } }
Source:
<code>private void setMeasurementSystem(String measurementSystem) { if (StringUtils.isBlank(measurementSystem)) { this.measurementSystem = null; return; } try { this.measurementSystem = MeasurementSystem.valueOf(measurementSystem); <START> } catch (RuntimeException e) { <END> this.measurementSystem = null; } }</code><technical_language>Please more specific - encounter IAEs NPEs here</technical_language>

Target:
private void setMeasurementSystem(String measurementSystem) { SystemOfUnits oldMeasurementSystem = this.measurementSystem; String ms = StringUtils.isBlank(measurementSystem) ? "" : measurementSystem; switch (ms) { case "SI": this.measurementSystem = SIUnits.getInstance(); break; case "US": this.measurementSystem = ImperialUnits.getInstance(); break; default: logger.debug("Error setting measurement system for value '{}'.", measurementSystem); this.measurementSystem = null; } if (oldMeasurementSystem != null && this.measurementSystem == null) { logger.info("Measurement system is not set, falling back to locale based system."); } else if (this.measurementSystem != null && !this.measurementSystem.equals(oldMeasurementSystem)) { logger.info("Measurement system set to '{}'.", this.measurementSystem.getName()); } }
Source:
<code>public SerializedPage serialize(Slice slice, int positionCount) { checkArgument(slice.isCompact(), "slice is not compact"); <START> int uncompressedSize = slice.length(); <END> byte markers = PageCodecMarker.none(); if (compressor.isPresent()) { int maxCompressedSize = compressor.get().maxCompressedLength(uncompressedSize); ensureCompressionBufferCapacity(maxCompressedSize); int compressedSize = compressor.get().compress((byte[]) slice.getBase(), 0, uncompressedSize, compressionBuffer, 0, maxCompressedSize); if ((((double) compressedSize) / uncompressedSize) <= MINIMUM_COMPRESSION_RATIO) { slice = Slices.copyOf(Slices.wrappedBuffer(compressionBuffer, 0, compressedSize)); markers = COMPRESSED.set(markers); } } if (spillCipher.isPresent()) { slice = Slices.wrappedBuffer(spillCipher.get().encrypt(slice.toByteBuffer())); markers = ENCRYPTED.set(markers); } return new SerializedPage(slice, markers, positionCount, uncompressedSize); }</code><technical_language>This method's logic appears exact copy of serialize(Page page) for slice = Slices.copyOf(slice); line. sense extract this logic a helper method a copy logic conditional slice.isCompact() a boolean flag tells copy occur not</technical_language>

Target:
public SerializedPage serialize(Slice slice, int positionCount) { checkArgument(slice.isCompact(), "slice is not compact"); return wrapSlice(slice, positionCount); }
Source:
<code>public void testExtensionPoint() { List<MarkerSet> initial = MarkerConfigXmlParser.getMarkerSets(); <START> assertTrue("No Marker Set should be loaded at this point", initial.isEmpty()); <END> MarkerConfigXmlParser.initMarkerSets(); List<MarkerSet> loaded = MarkerConfigXmlParser.getMarkerSets(); assertEquals(1, loaded.size()); MarkerSet set = loaded.get(0); assertEquals("Wrong MarkerSet name", "Example", set.getName()); assertEquals("Wrong MarkerSet Id", "example.id", set.getId()); }</code><technical_language>This is working extension point marker sets (incorrectly) parsed if markers.xml file exist in state location</technical_language>

Target:
public void testExtensionPoint() { List<MarkerSet> markerSet = MarkerConfigXmlParser.getMarkerSets(); assertEquals("Extension point markers should be loaded", 1, markerSet.size()); MarkerSet set = markerSet.get(0); assertEquals("Wrong MarkerSet name", "Example", set.getName()); assertEquals("Wrong MarkerSet Id", "example.id", set.getId()); }
Source:
<code>public void showBusy(boolean busy) { MPart model = getModel(); <START> IEventBroker eventBroker = getEventBroker(model); <END> if (eventBroker != null) { Map<String, Object> data = new HashMap<String, Object>(); data.put(UIEvents.EventTags.ELEMENT, model); data.put(UIEvents.EventTags.ATTNAME, UIEvents.UILabel.BUSY); data.put(UIEvents.EventTags.NEW_VALUE, busy); eventBroker.send(UIEvents.UILabel.TOPIC_BUSY, data); } }</code><technical_language>simplify this UIEvents.publishEvent()</technical_language>

Target:
public void showBusy(boolean busy) { UIEvents.publishEvent(createEvent(UIEvents.UILabel.TOPIC_BUSY) .withParam(UIEvents.EventTags.ELEMENT, getModel()) .withParam(UIEvents.EventTags.ATTNAME, UIEvents.UILifeCycle.BUSY) .withParam(UIEvents.EventTags.NEW_VALUE, busy)); }
Source:
<code>public List<Role> findAllRoles() { <START> Query query = entityManager.createNamedQuery("listAllRoles"); <END> return query.getResultList(); }</code><technical_language>pls querydsl instead (already in master)</technical_language>

Target:
public List<Role> findAllRoles() { JPAQuery query = new JPAQuery(entityManager); query.from(QRoleImpl.roleImpl).list(QRoleImpl.roleImpl); List<RoleImpl> result = query.list(QRoleImpl.roleImpl); return Lists.transform(result, new Function<RoleImpl, Role>() { @Override public Role apply(RoleImpl input) { return input; } }); }
Source:
<code>public ImmutableSpongeCommandData(String storedCommand, int success, boolean tracks, Text lastOutput) { super(ImmutableCommandData.class); this.storedCommand = storedCommand; this.success = success; this.tracks = tracks; this.lastOutput = lastOutput; this.storedValue = new ImmutableSpongeValue<>(Keys.COMMAND, this.storedCommand); this.successValue = SpongeValueBuilder.boundedBuilder(Keys.SUCCESS_COUNT) .actualValue(this.success) .defaultValue(0) .minimum(0) .maximum(Integer.MAX_VALUE) .build() .asImmutable(); <START> this.tracksValue = ImmutableSpongeValue.cachedOf(Keys.TRACKS_OUTPUT, this.tracks, false); <END> this.lastOutputValue = new ImmutableSpongeOptionalValue<>(Keys.LAST_COMMAND_OUTPUT, Optional.ofNullable(this.lastOutput)); registerGetters(); }</code><technical_language>arguments switched</technical_language>

Target:
public ImmutableSpongeCommandData(String storedCommand, int success, boolean tracks, Text lastOutput) { super(ImmutableCommandData.class); this.storedCommand = storedCommand; this.success = success; this.tracks = tracks; this.lastOutput = lastOutput; this.storedValue = new ImmutableSpongeValue<>(Keys.COMMAND, this.storedCommand); this.successValue = SpongeValueBuilder.boundedBuilder(Keys.SUCCESS_COUNT) .actualValue(this.success) .defaultValue(0) .minimum(0) .maximum(Integer.MAX_VALUE) .build() .asImmutable(); this.tracksValue = ImmutableSpongeValue.cachedOf(Keys.TRACKS_OUTPUT, false, this.tracks); this.lastOutputValue = new ImmutableSpongeOptionalValue<>(Keys.LAST_COMMAND_OUTPUT, Optional.ofNullable(this.lastOutput)); registerGetters(); }
Source:
<code>private static String getExtension(String name) { int ext = name.lastIndexOf('.'); return 0 < ext ? <START> name.substring(ext, name.length()) : <END> ""; }</code><technical_language>name.substring(ext) is equivalent shorter write</technical_language>

Target:
private static String getExtension(String name) { int ext = name.lastIndexOf('.'); return 0 < ext ? name.substring(ext) : ""; }
Source:
<code>public Constraints clone() { if (myAnchor != null) { return new Constraints(myAnchor, relativeId); } <START> <END> if (direction != null) { return new Constraints(direction, relativeId); } return null; }</code><technical_language>for } else if { more suitable</technical_language>

Target:
public Constraints clone() { if (myAnchor != null) { return new Constraints(myAnchor, relativeId); } else if (direction != null) { return new Constraints(direction, relativeId); } return null; }
Source:
<code>private static void copyDirectory(final File source, final File target) throws IOException { Path sourcePath = source.toPath(); Path targetPath = target.toPath(); Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { Files.createDirectories(targetPath.resolve(sourcePath .relativize(dir))); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { if (attrs.isSymbolicLink()) { Path symTarget = Files.readSymbolicLink(file); File symTargetFile = symTarget.toFile(); if (!symTargetFile.isAbsolute()) { if (file.getParent() != null) { symTarget = file.getParent().resolve(symTarget); } else { throw new IOException("Recursive symbolic link: " + file.toFile().getAbsolutePath() + "=>" + symTargetFile.getCanonicalPath() <START> + "can't copy directory"); <END> } } if (symTarget.toFile().getCanonicalFile().isDirectory()) { if (file.getParent().toFile().getCanonicalPath(). startsWith(symTarget.toFile().getCanonicalPath())) { throw new IOException("Recursive symbolic link: " + file.toFile().getAbsolutePath() + "=>" + symTarget.toFile().getCanonicalPath() + ". Can't copy directory"); } else { copyDirectory(symTarget.toFile(), targetPath.resolve(sourcePath .relativize(file)).toFile()); } return FileVisitResult.CONTINUE; } } Files.copy(file, targetPath.resolve(sourcePath.relativize(file))); return FileVisitResult.CONTINUE; } }); }</code><technical_language>Needs a space "can't"</technical_language>

Target:
private static void copyDirectory(final File source, final File target) throws IOException { Path sourcePath = source.toPath(); Path targetPath = target.toPath(); Files.walkFileTree(sourcePath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException { Files.createDirectories(targetPath.resolve(sourcePath .relativize(dir))); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException { if (attrs.isSymbolicLink()) { Path symTarget = Files.readSymbolicLink(file); File symTargetFile = symTarget.toFile(); if (!symTargetFile.isAbsolute()) { if (file.getParent() != null) { symTarget = file.getParent().resolve(symTarget); } else { throw new IOException("Recursive symbolic link: " + file.toFile().getAbsolutePath() + "=>" + symTargetFile.getCanonicalPath() + ". Can't copy directory"); } } if (symTarget.toFile().getCanonicalFile().isDirectory()) { if (file.getParent().toFile().getCanonicalPath(). startsWith(symTarget.toFile().getCanonicalPath())) { throw new IOException("Recursive symbolic link: " + file.toFile().getAbsolutePath() + "=>" + symTarget.toFile().getCanonicalPath() + ". Can't copy directory"); } else { copyDirectory(symTarget.toFile(), targetPath.resolve(sourcePath .relativize(file)).toFile()); } return FileVisitResult.CONTINUE; } } Files.copy(file, targetPath.resolve(sourcePath.relativize(file))); return FileVisitResult.CONTINUE; } }); }
Source:
<code>public void glazedListDependencyVersionTest() { <START> testPapyrusDependencies2("ca.odell.glazedlists", <END> GLAZED_LIST_VERSION); }</code><technical_language>this class removed this patch is contained in other gerrit contribution: 98857</technical_language>

Target:
public void glazedListDependencyVersionTest() { testPapyrusDependencies2("ca.odell.glazedlists", NATTABLE_VERSION); }
Source:
<code>public SashLayout(final Composite host, MUIElement root) { this.root = root; this.host = host; host.addMouseTrackListener(MouseTrackListener.mouseExitAdapter(e -> { host.setCursor(null); lastCursor = null; })); host.addMouseMoveListener(e -> { <START> if (!draggingSashes) { <END> List<SashRect> sashList = getSashRects(e.x, e.y); final int newCursor; if (sashList.isEmpty()) { newCursor = SWT.CURSOR_ARROW; } else if (sashList.size() == 1) { if (sashList.get(0).container.isHorizontal()) newCursor = SWT.CURSOR_SIZEWE; else newCursor = SWT.CURSOR_SIZENS; } else { newCursor = SWT.CURSOR_SIZEALL; } if (lastCursor == null || lastCursor != newCursor) { host.setCursor(host.getDisplay().getSystemCursor(newCursor)); } } else { try { layoutUpdateInProgress = true; adjustWeights(sashesToDrag, e.x, e.y); try { host.setRedraw(false); host.layout(); } finally { host.setRedraw(true); } host.update(); } finally { layoutUpdateInProgress = false; } } }); host.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { host.setCapture(false); draggingSashes = false; } @Override public void mouseDown(MouseEvent e) { if (e.button != 1) { return; } sashesToDrag = getSashRects(e.x, e.y); if (sashesToDrag.size() > 0) { draggingSashes = true; host.setCapture(true); } } }); }</code><technical_language>move lamba a method</technical_language>

Target:
public SashLayout(final Composite host, MUIElement root) { this.root = root; this.host = host; host.addMouseTrackListener(MouseTrackListener.mouseExitAdapter(e -> { host.setCursor(null); lastCursor = null; })); host.addMouseMoveListener(e -> { if (!draggingSashes) { List<SashRect> sashList = getSashRects(e.x, e.y); final int newCursor; if (sashList.isEmpty()) { newCursor = SWT.CURSOR_ARROW; } else if (sashList.size() == 1) { if (sashList.get(0).container.isHorizontal()) newCursor = SWT.CURSOR_SIZEWE; else newCursor = SWT.CURSOR_SIZENS; } else { newCursor = SWT.CURSOR_SIZEALL; } if (lastCursor == null || lastCursor != newCursor) { host.setCursor(host.getDisplay().getSystemCursor(newCursor)); lastCursor = newCursor; } } else { try { layoutUpdateInProgress = true; adjustWeights(sashesToDrag, e.x, e.y); try { host.setRedraw(false); host.layout(); } finally { host.setRedraw(true); } host.update(); } finally { layoutUpdateInProgress = false; } } }); host.addMouseListener(new MouseAdapter() { @Override public void mouseUp(MouseEvent e) { host.setCapture(false); draggingSashes = false; } @Override public void mouseDown(MouseEvent e) { if (e.button != 1) { return; } sashesToDrag = getSashRects(e.x, e.y); if (sashesToDrag.size() > 0) { draggingSashes = true; host.setCapture(true); } } }); }
Source:
<code>private void initToolTips() { <START> numberOfCoresTooltip.setHtml(templates.numOfCoresTooltipBasicDetails()); <END> }</code><technical_language>able CommonApplicationTemplates</technical_language>

Target:
private void initToolTips() { numberOfCoresTooltip.setHtml(templates.numOfCpuCoresTooltip()); }
Source:
<code>public void respondOk_whenCreateMandateRequest(CreateMandateRequestParams params) { <START> setupCreateAgreement(params.getGatewayAccountId(), aResponse() <END> .withStatus(CREATED_201) .withHeader(CONTENT_TYPE, APPLICATION_JSON) .withHeader(LOCATION, format("/v1/api/accounts/%s/mandates/%s", params.getGatewayAccountId(), params.getMandateId())) .withBody(buildCreateAgreementResponse( params.getMandateId(), params.getProviderId(), params.getServiceReference(), params.getReturnUrl(), params.getCreatedDate(), params.getState(), params.getDescription(), validGetLink(mandateLocation(params.getGatewayAccountId(), params.getMandateId()), "self"), validGetLink(nextUrl(params.getChargeTokenId()), "next_url"), validPostLink(nextUrlPost(), "next_url_post", "application/x-www-form-urlencoded", Map.of("chargeTokenId", params.getChargeTokenId()) ))) ); }</code><technical_language>setupCreateMandate</technical_language>

Target:
public void respondOk_whenCreateMandateRequest(CreateMandateRequestParams params) { setupCreateMandate(params.getGatewayAccountId(), aResponse() .withStatus(CREATED_201) .withHeader(CONTENT_TYPE, APPLICATION_JSON) .withHeader(LOCATION, format("/v1/api/accounts/%s/mandates/%s", params.getGatewayAccountId(), params.getMandateId())) .withBody(buildCreateMandateResponse( params.getMandateId(), params.getProviderId(), params.getServiceReference(), params.getReturnUrl(), params.getCreatedDate(), params.getState(), params.getDescription(), validGetLink(mandateLocation(params.getGatewayAccountId(), params.getMandateId()), "self"), validGetLink(nextUrl(params.getChargeTokenId()), "next_url"), validPostLink(nextUrlPost(), "next_url_post", "application/x-www-form-urlencoded", Map.of("chargeTokenId", params.getChargeTokenId()) ))) ); }
Source:
<code>protected List<KetchReplica> createReplicas(KetchLeader leader, Repository repo) throws URISyntaxException { List<KetchReplica> <START> remotes = <END> new ArrayList<>(); Config cfg = repo.getConfig(); String localName = getLocalName(cfg); for (String name : cfg.getSubsections(CONFIG_KEY_REMOTE)) { ReplicaConfig kc = new ReplicaConfig().fromConfig(cfg, name); if (kc.getType() == NONE) { continue; } if (name.equals(localName)) { remotes.add(new LocalReplica(leader, name, kc)); continue; } RemoteConfig rc = new RemoteConfig(cfg, name); List<URIish> uris = rc.getPushURIs(); if (uris.isEmpty()) { uris = rc.getURIs(); } for (URIish uri : uris) { String n = uris.size() == 1 ? name : uri.getHost(); remotes.add(new RemoteGitReplica(leader, n, uri, kc, rc)); } } return remotes; }</code><technical_language>s/remotes/replicas/ local replica is included in list</technical_language>

Target:
protected List<KetchReplica> createReplicas(KetchLeader leader, Repository repo) throws URISyntaxException { List<KetchReplica> replicas = new ArrayList<>(); Config cfg = repo.getConfig(); String localName = getLocalName(cfg); for (String name : cfg.getSubsections(CONFIG_KEY_REMOTE)) { if (!hasParticipation(cfg, name)) { continue; } ReplicaConfig kc = ReplicaConfig.newFromConfig(cfg, name); if (name.equals(localName)) { replicas.add(new LocalReplica(leader, name, kc)); continue; } RemoteConfig rc = new RemoteConfig(cfg, name); List<URIish> uris = rc.getPushURIs(); if (uris.isEmpty()) { uris = rc.getURIs(); } for (URIish uri : uris) { String n = uris.size() == 1 ? name : uri.getHost(); replicas.add(new RemoteGitReplica(leader, n, uri, kc, rc)); } } return replicas; }
Source:
<code>public static Stereotype getViewpointStereotype(Project project) { Profile profile = StereotypesHelper.getAllProfiles(project).stream().filter <START> (x -> (MDKConstants.SYSML_PROFILE_LOCAL_ID).equals(x.getLocalID())) <END> .findFirst() .orElse(null); if (profile == null) { return null; } return StereotypesHelper.getStereotype(project, "Viewpoint", profile); }</code><technical_language>Converters.getElementToIdConverter.convert(x) swap out conversion refactor</technical_language>

Target:
public static Stereotype getViewpointStereotype(Project project) { Profile profile = StereotypesHelper.getAllProfiles(project).stream().filter ( x -> MDKConstants.SYSML_PROFILE_ID.equals(Converters.getElementToIdConverter().apply(x))) .findAny() .orElse(null); if (profile == null) { return null; } return StereotypesHelper.getStereotype(project, "Viewpoint", profile); }
Source:
<code>public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { if (aTarget instanceof RepositoryGroupNode) { return handleRepositoryGroupNodeDrop((RepositoryGroupNode) aTarget, aDropTargetEvent); } else if (aTarget instanceof IWorkspaceRoot) { return <START> handleWOrkspaceRootDrop(aDropTargetEvent); <END> } String[] data = (String[]) aDropTargetEvent.data; for (String folder : data) { File repoFile = new File(folder); if (FileKey.isGitRepository(repoFile, FS.DETECTED)) Activator.getDefault().getRepositoryUtil() .addConfiguredRepository(repoFile); else if (!repoFile.getName().equals(Constants.DOT_GIT)) { File dotgitfile = new File(repoFile, Constants.DOT_GIT); if (FileKey.isGitRepository(dotgitfile, FS.DETECTED)) Activator.getDefault().getRepositoryUtil() .addConfiguredRepository(dotgitfile); } } return Status.OK_STATUS; }</code><technical_language>Typo</technical_language>

Target:
public IStatus handleDrop(CommonDropAdapter aDropAdapter, DropTargetEvent aDropTargetEvent, Object aTarget) { if (aTarget instanceof RepositoryGroupNode) { return handleRepositoryGroupNodeDrop((RepositoryGroupNode) aTarget, aDropTargetEvent); } else if (aTarget instanceof IWorkspaceRoot) { return handleWorkspaceRootDrop(aDropTargetEvent); } String[] data = (String[]) aDropTargetEvent.data; for (String folder : data) { File repoFile = new File(folder); if (FileKey.isGitRepository(repoFile, FS.DETECTED)) Activator.getDefault().getRepositoryUtil() .addConfiguredRepository(repoFile); else if (!repoFile.getName().equals(Constants.DOT_GIT)) { File dotgitfile = new File(repoFile, Constants.DOT_GIT); if (FileKey.isGitRepository(dotgitfile, FS.DETECTED)) Activator.getDefault().getRepositoryUtil() .addConfiguredRepository(dotgitfile); } } return Status.OK_STATUS; }
Source:
<code>public static String getSAPVersion(String camelVersion) { switch (camelVersion) { case CAMEL_2_15_1_REDHAT_621084: return SAP_621_REDHAT_084; case CAMEL_2_15_1_REDHAT_621117: return SAP_621_REDHAT_117; case CAMEL_2_15_1_REDHAT_621159: return SAP_621_REDHAT_159; case CAMEL_2_15_1_REDHAT_621169: return SAP_621_REDHAT_169; case CAMEL_2_15_1_REDHAT_621186: return SAP_621_REDHAT_186; case CAMEL_2_17_0_REDHAT_630187: return SAP_630_REDHAT_187; case CAMEL_2_17_0_REDHAT_630224: return SAP_630_REDHAT_224; case CAMEL_2_17_0_REDHAT_630254: return SAP_630_REDHAT_254; case CAMEL_2_17_0_REDHAT_630262: return SAP_630_REDHAT_262; default: <START> if (camelVersion.startsWith("6.2.1")) { <END> return SAP_621_REDHAT_LATEST; } return SAP_630_REDHAT_LATEST; } }</code><technical_language>Camel version 6.2.1</technical_language>

Target:
public static String getSAPVersion(String camelVersion) { switch (camelVersion) { case CAMEL_2_15_1_REDHAT_621084: return SAP_621_REDHAT_084; case CAMEL_2_15_1_REDHAT_621117: return SAP_621_REDHAT_117; case CAMEL_2_15_1_REDHAT_621159: return SAP_621_REDHAT_159; case CAMEL_2_15_1_REDHAT_621169: return SAP_621_REDHAT_169; case CAMEL_2_15_1_REDHAT_621186: return SAP_621_REDHAT_186; case CAMEL_2_17_0_REDHAT_630187: return SAP_630_REDHAT_187; case CAMEL_2_17_0_REDHAT_630224: return SAP_630_REDHAT_224; case CAMEL_2_17_0_REDHAT_630254: return SAP_630_REDHAT_254; case CAMEL_2_17_0_REDHAT_630262: return SAP_630_REDHAT_262; default: if (camelVersion.startsWith("2.15")) { return SAP_621_REDHAT_LATEST; } return SAP_630_REDHAT_LATEST; } }
Source:
<code>public void reconnectPolicyDefault() throws ConfigurationException, MqttException, InterruptedException { <START> MqttBrokerConnection a = new MqttBrokerConnection("123.123.123.123", null, false, "MqttBrokerConnectionTests"); <END> assertTrue(a.getReconnectStrategy() instanceof PeriodicReconnectStrategy); AbstractReconnectStrategy p = a.getReconnectStrategy(); assertThat(p.getBrokerConnection(), equalTo(a)); }</code><technical_language>please refactor a brokerConnection review other tests for refactoring</technical_language>

Target:
public void reconnectPolicyDefault() throws ConfigurationException, MqttException, InterruptedException { MqttBrokerConnectionEx connection = new MqttBrokerConnectionEx("123.123.123.123", null, false, "MqttBrokerConnectionTests"); assertTrue(connection.getReconnectStrategy() instanceof PeriodicReconnectStrategy); AbstractReconnectStrategy p = connection.getReconnectStrategy(); assertThat(p.getBrokerConnection(), equalTo(connection)); }
Source:
<code>private PlanNodeWithCost getJoinNodeWithCost(Context context, JoinNode possibleJoinNode) { TypeProvider types = context.getSymbolAllocator().getTypes(); StatsProvider stats = context.getStatsProvider(); boolean replicated = possibleJoinNode.getDistributionType().get().equals(REPLICATED); PlanNodeCostEstimate exchangesCost = exchangeCostCalculator.calculateJoinExchangeCost( <START> possibleJoinNode.getLeft(), <END> possibleJoinNode.getRight(), stats, types, replicated); PlanNodeCostEstimate inputCost = exchangeCostCalculator.calculateJoinInputCost( possibleJoinNode.getLeft(), possibleJoinNode.getRight(), stats, types, replicated); return new PlanNodeWithCost(exchangesCost.add(inputCost), possibleJoinNode); }</code><technical_language>nit: call this isReplicated</technical_language>

Target:
private PlanNodeWithCost getJoinNodeWithCost(Context context, JoinNode possibleJoinNode) { TypeProvider types = context.getSymbolAllocator().getTypes(); StatsProvider stats = context.getStatsProvider(); boolean replicated = possibleJoinNode.getDistributionType().get().equals(REPLICATED); int estimatedSourceDistributedTaskCount = taskCountEstimator.estimateSourceDistributedTaskCount(); PlanNodeCostEstimate exchangesCost = calculateJoinExchangeCost( possibleJoinNode.getLeft(), possibleJoinNode.getRight(), stats, types, replicated, estimatedSourceDistributedTaskCount); PlanNodeCostEstimate inputCost = calculateJoinInputCost( possibleJoinNode.getLeft(), possibleJoinNode.getRight(), stats, types, replicated, estimatedSourceDistributedTaskCount); return new PlanNodeWithCost(exchangesCost.add(inputCost), possibleJoinNode); }
Source:
<code>public IndexedTable(DataSchema dataSchema, QueryContext queryContext, int trimSize, int trimThreshold) { super(dataSchema); List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions(); assert groupByExpressions != null; _numKeyColumns = groupByExpressions.size(); _aggregationFunctions = queryContext.getAggregationFunctions(); List<OrderByExpressionContext> orderByExpressions = queryContext.getOrderByExpressions(); if (orderByExpressions != null) { _hasOrderBy = true; _tableResizer = new TableResizer(dataSchema, queryContext); _trimSize = trimSize; <START> _trimThresholdForUpsert = Math.max(trimSize * 4, trimThreshold); <END> _trimThresholdForFinish = trimSize * 4; } else { _hasOrderBy = false; _tableResizer = null; _trimSize = trimSize; _trimThresholdForUpsert = trimSize; _trimThresholdForFinish = trimSize; } }</code><technical_language>this max trimThreshold is higher bound allowed</technical_language>

Target:
protected IndexedTable(DataSchema dataSchema, QueryContext queryContext, int trimSize, int trimThreshold) { super(dataSchema); List<ExpressionContext> groupByExpressions = queryContext.getGroupByExpressions(); assert groupByExpressions != null; _numKeyColumns = groupByExpressions.size(); _aggregationFunctions = queryContext.getAggregationFunctions(); List<OrderByExpressionContext> orderByExpressions = queryContext.getOrderByExpressions(); if (orderByExpressions != null) { _hasOrderBy = true; _tableResizer = new TableResizer(dataSchema, queryContext); _trimSize = Math.min(trimSize, trimThreshold / 2); _trimThreshold = trimThreshold; } else { _hasOrderBy = false; _tableResizer = null; _trimSize = trimSize; _trimThreshold = trimSize; } }
Source:
<code>public double[] getMzValues() { double[] result = null; byte[] bytesIn = new byte[getMzBinaryDataInfo().getEncodedLength()]; int precision = 0; EnumSet<MzMLBinaryDataInfo.MzMLCompressionType> compressions = EnumSet .noneOf(MzMLBinaryDataInfo.MzMLCompressionType.class); try { mappedByteBufferInputStream.setPosition(getMzBinaryDataInfo().getPosition()); XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance(); XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(mappedByteBufferInputStream); <START> if (getMzBinaryDataInfo().getBitLength().toString().startsWith("THIRTY_TWO")) { <END> precision = 32; } else if (getMzBinaryDataInfo().getBitLength().toString().startsWith("SIXTY_FOUR")) { precision = 64; } while (xmlEventReader.hasNext()) { XMLEvent xmlEvent = xmlEventReader.nextEvent(); if (xmlEvent.isStartElement()) { StartElement startElement = xmlEvent.asStartElement(); if (startElement.getName().getLocalPart().equals("binary") && xmlEventReader.hasNext()) { xmlEvent = xmlEventReader.nextEvent(); bytesIn = xmlEvent.asCharacters().getData().getBytes(); compressions.add(getMzBinaryDataInfo().getCompressionType()); result = MzMLPeaksDecoder.decode(bytesIn, getMzBinaryDataInfo().getArrayLength(), new Integer(precision), getMzBinaryDataInfo().getEncodedLength(), compressions).arr; break; } } } } catch (XMLStreamException e) { e.printStackTrace(); } catch (DataFormatException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (MSDKException e) { e.printStackTrace(); } return result; }</code><technical_language>is need convert String here, is it</technical_language>

Target:
public double[] getMzValues() { double[] result = null; byte[] bytesIn = new byte[getMzBinaryDataInfo().getEncodedLength()]; Integer precision; EnumSet<MzMLBinaryDataInfo.MzMLCompressionType> compressions = EnumSet .noneOf(MzMLBinaryDataInfo.MzMLCompressionType.class); try { mappedByteBufferInputStream.setPosition(getMzBinaryDataInfo().getPosition()); switch (getMzBinaryDataInfo().getBitLength()) { case THIRTY_TWO_BIT_FLOAT: case THIRTY_TWO_BIT_INTEGER: precision = 32; break; case SIXTY_FOUR_BIT_FLOAT: case SIXTY_FOUR_BIT_INTEGER: precision = 64; break; default: precision = null; } mappedByteBufferInputStream.read(bytesIn, 0, getMzBinaryDataInfo().getEncodedLength()); compressions.add(getMzBinaryDataInfo().getCompressionType()); result = MzMLPeaksDecoder.decode(bytesIn, getMzBinaryDataInfo().getEncodedLength(), precision, getMzBinaryDataInfo().getArrayLength(), compressions).arr; } catch (Exception e) { e.printStackTrace(); } return result; }
Source:
<code>public Bundle asBundle() { <START> bundle.putString(JWT, jwt); END> return bundle; }</code><technical_language>I muck this in this part</technical_language>

Target:
public Bundle asBundle() { return bundle; }
Source:
<code>protected void internalRegisterService(ServiceInstance<T> service) throws Exception { byte[] bytes = serializer.serialize(service); String path = pathForInstance(service.getName(), service.getId()); final int MAX_TRIES = 2; boolean isDone = false; for ( int i = 0; !isDone && (i < MAX_TRIES); ++i ) { try { CreateMode mode; switch (service.getServiceType()){ case DYNAMIC: mode = CreateMode.EPHEMERAL; break; case DYNAMIC_SEQUENTIAL: mode = CreateMode.EPHEMERAL_SEQUENTIAL; break; default: <START> mode = CreateMode.PERSISTENT; <END> } client.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path, bytes); isDone = true; } catch ( KeeperException.NodeExistsException e ) { client.delete().forPath(path); } } }</code><technical_language>missing <code>break;</code></technical_language>

Target:
protected void internalRegisterService(ServiceInstance<T> service) throws Exception { byte[] bytes = serializer.serialize(service); String path = pathForInstance(service.getName(), service.getId()); final int MAX_TRIES = 2; boolean isDone = false; for ( int i = 0; !isDone && (i < MAX_TRIES); ++i ) { try { CreateMode mode; switch (service.getServiceType()) { case DYNAMIC: mode = CreateMode.EPHEMERAL; break; case DYNAMIC_SEQUENTIAL: mode = CreateMode.EPHEMERAL_SEQUENTIAL; break; default: mode = CreateMode.PERSISTENT; break; } client.create().creatingParentContainersIfNeeded().withMode(mode).forPath(path, bytes); isDone = true; } catch ( KeeperException.NodeExistsException e ) { client.delete().forPath(path); } } }
Source:
<code><START> public File gitPrefix() throws IOException { <END> String gitExe = scanPath(SystemReader.getInstance().getenv("PATH"), "git"); if (gitExe != null) return new File(gitExe).getAbsoluteFile().getParentFile() .getParentFile(); return super.gitPrefix(); }</code><technical_language>This needs @Override annotation</technical_language>

Target:
public File gitPrefix() { File gitExe = searchPath(SystemReader.getInstance().getenv("PATH"), "git"); if (gitExe != null) return gitExe.getParentFile().getParentFile(); return super.gitPrefix(); }
Source:
<code><START> private String getEditUrl(String page, String query) { <END> return urlBuilder.appendQueryStringToURL( urlBuilder.getUrlForWikiPage(String.format("/wiki/%s", urlBuilder.normalizePageName(page))), query); }</code><technical_language>![MAJOR](<LINK_0> 'Severity: MAJOR') Remove this unused private "getEditUrl" method. [![rule](<LINK_1>](http://sonar-s4/coding_rules#rule_key=squid%3AUnusedPrivateMethod)</technical_language>

Target:
private String getEditUrl(String page, String query) { return urlBuilder.appendQueryStringToURL( urlBuilder.getUrlForWikiPage(urlBuilder.normalizePageName(page)), query); }