auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean validateTableWithFollowingDescriptors( SqlCallBinding callBinding, int descriptors) { final SqlNode operand0 = callBinding.operand(0); final SqlValidator validator = callBinding.getValidator(); final RelDataType type = validator.getValidatedNodeType(operand0); if (type.getSqlTypeName() != SqlTypeName.ROW) { return false; } for (int i = 1; i < descriptors + 1; i++) { final SqlNode operand = callBinding.operand(i); <START> if (operand.getKind() != SqlKind.DESCRIPTOR) { <END> return false; } validateColumnNames(validator, type.getFieldNames(), ((SqlCall) operand).getOperandList()); } return true; }</code><technical_language>i < descriptors + 1 i <= descriptors</technical_language>

Target:
protected static boolean validateTableWithFollowingDescriptors( SqlCallBinding callBinding, int descriptors) { final SqlNode operand0 = callBinding.operand(0); final SqlValidator validator = callBinding.getValidator(); final RelDataType type = validator.getValidatedNodeType(operand0); if (type.getSqlTypeName() != SqlTypeName.ROW) { return false; } for (int i = 1; i < descriptors + 1; i++) { final SqlNode operand = callBinding.operand(i); if (operand.getKind() != SqlKind.DESCRIPTOR) { return false; } validateColumnNames(validator, type.getFieldNames(), ((SqlCall) operand).getOperandList()); } return true; }
Source:
<code>public ConcurTestConnectionApplication() { <START> singletons.add(new ConcurTestConnectionWebServiceImpl()); <END> }</code><technical_language>pattern in base Financials code is Resource classes registered in Application Resources calls services. I this service complex, follow pattern well</technical_language>

Target:
public ConcurTestConnectionApplication() { singletons.add(new ConcurTestConnectionResource()); }
Source:
<code>public void build(IProgressMonitor monitor, Map<String, Object> argumentsMap) throws Exception { if (needTempAggregator()) { createBuildAggregatorPom(); try { for (ITalendProcessJavaProject project : subjobProjects) { MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager(); Model projModel = mavenModelManager.readMavenModel(project.getProjectPom()); MavenArtifact artifact = new MavenArtifact(); artifact.setGroupId(projModel.getGroupId()); artifact.setArtifactId(projModel.getArtifactId()); artifact.setVersion(projModel.getVersion()); String artifactPath = PomUtil.getArtifactPath(artifact); final IMaven maven = MavenPlugin.getMaven(); String localRepositoryPath = maven.getLocalRepositoryPath(); if (localRepositoryPath != null) { File moduleFolder = new File(localRepositoryPath, artifactPath); PomUtil.cleanLastUpdatedFile(moduleFolder.getParentFile()); } } String goal = (String) argumentsMap.get(TalendProcessArgumentConstant.ARG_GOAL); MavenPomCommandLauncher mavenLauncher = new MavenPomCommandLauncher(pomFile, goal); mavenLauncher.setArgumentsMap(argumentsMap); <START> mavenLauncher.setIgnoreTestFailure(true); <END> mavenLauncher.execute(monitor); } finally { deleteBuildAggregatorPom(); restoreSubjobPoms(); } } }</code><technical_language>skipTests for run job in studio</technical_language>

Target:
public void build(IProgressMonitor monitor, Map<String, Object> argumentsMap) throws Exception { if (needTempAggregator()) { createBuildAggregatorPom(); try { for (ITalendProcessJavaProject project : subjobProjects) { MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager(); Model projModel = mavenModelManager.readMavenModel(project.getProjectPom()); MavenArtifact artifact = new MavenArtifact(); artifact.setGroupId(projModel.getGroupId()); artifact.setArtifactId(projModel.getArtifactId()); artifact.setVersion(projModel.getVersion()); String artifactPath = PomUtil.getArtifactPath(artifact); final IMaven maven = MavenPlugin.getMaven(); String localRepositoryPath = maven.getLocalRepositoryPath(); if (localRepositoryPath != null) { File moduleFolder = new File(localRepositoryPath, artifactPath); PomUtil.cleanLastUpdatedFile(moduleFolder.getParentFile()); } } String goal = (String) argumentsMap.get(TalendProcessArgumentConstant.ARG_GOAL); MavenPomCommandLauncher mavenLauncher = new MavenPomCommandLauncher(pomFile, goal); mavenLauncher.setArgumentsMap(argumentsMap); if (isBuildJob()) { mavenLauncher.setIgnoreTestFailure(true); } else { mavenLauncher.setSkipTests(true); } mavenLauncher.execute(monitor); } finally { deleteBuildAggregatorPom(); restoreSubjobPoms(); } } }
Source:
<code>public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); <START> if (argMap.containsKey(ARG_HELP) || others.isEmpty()) { <END> List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); System.out.println("Modules: " + StringUtils.join(modules, ", ")); return; } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } if(moduleService.parseArguments(others)) { System.out.println(module + " help"); return; } loadExtensions(moduleService, (String) argMap.get("extensions-dir")); moduleService.run(); } catch (IllegalArgumentException ex) { System.out.println(ex.getMessage()); logger.error(ex.getMessage()); } catch (Throwable t) { System.out.println(t.getMessage()); logger.error(t.getMessage()); logger.debug(t.getMessage(), t); } }</code><technical_language>I prefer if --help, if empty issue error a module provided exit zero</technical_language>

Target:
public static void main(String[] args) { try { Map<String, Object> argMap = parseArgs(args); setupLogger(argMap); List<String> others = (List<String>) argMap.get("__other__"); Map<String, ModuleService> moduleServices = loadModules(ModuleService.class); if (argMap.containsKey(ARG_HELP)) { List<String> modules = new ArrayList<>(moduleServices.keySet()); Collections.sort(modules); System.out.println("Modules: " + StringUtils.join(modules, ", ")); System.exit(0); } if(others.isEmpty()) { throw new IllegalArgumentException("Module must be provided"); } String module = others.remove(0); ModuleService moduleService = moduleServices.get(module); if (moduleService == null) { throw new IllegalArgumentException( String.format("No such '%1$s' module exists. To list existing modules use --help argument.", module) ); } moduleService.parseArguments(others); if(moduleService.isHelp()) { System.out.println(module + " help"); return; } loadExtensions(moduleService, argMap); moduleService.run(); } catch (Throwable t) { String message = t.getMessage() != null ? t.getMessage() : t.getClass().getName(); System.err.println(message); logger.error(message); logger.debug(message, t); System.exit(1); } }
Source:
<code>private Statement withRules(FrameworkMethod method, Object target, Statement statement) { RuleContainer ruleContainer = new RuleContainer() { protected Integer getOrder(FrameworkMember member) { Rule rule = member.getAnnotation(Rule.class); return rule != null ? rule.order() : null; } }; List<TestRule> testRules; List<MethodRule> methodRules; <START> AnnotatedValueListener.CURRENT.set(ruleContainer); <END> try { testRules = getTestRules(target); methodRules = rules(target); } finally { AnnotatedValueListener.CURRENT.remove(); } for (org.junit.rules.MethodRule each : methodRules) { if (!(each instanceof TestRule && testRules.contains(each))) { ruleContainer.add(each); } } for (TestRule each : testRules) { ruleContainer.add(each); } ruleContainer.sort(); return ruleContainer.apply(method, describeChild(method), target, statement); }</code><technical_language>want do similar in ParentRunner.withClassRules()</technical_language>

Target:
private Statement withRules(FrameworkMethod method, Object target, Statement statement) { RuleContainer ruleContainer = new RuleContainer(); CURRENT_RULE_CONTAINER.set(ruleContainer); try { List<TestRule> testRules = getTestRules(target); for (MethodRule each : rules(target)) { if (!(each instanceof TestRule && testRules.contains(each))) { ruleContainer.add(each); } } for (TestRule rule : testRules) { ruleContainer.add(rule); } } finally { CURRENT_RULE_CONTAINER.remove(); } return ruleContainer.apply(method, describeChild(method), target, statement); }
Source:
<code>public void testBasePathConflictInvalidReplaceId() throws Exception { String serviceId = setupTestService(); while(baragonServiceClient.getRequest(serviceId).get().getLoadBalancerState().equals(BaragonRequestState.WAITING)) { } if(baragonServiceClient.getRequest(serviceId).get().getLoadBalancerState().equals(BaragonRequestState.SUCCESS)) { String serviceId2 = serviceId + "-2"; <START> setupTestService(serviceId2, serviceId2, SERVICE_BASE_PATH, Optional.fromNullable("someotherservice"), Optional.<Map<String, Object>>absent(), Optional.<String>absent()); <END> while(baragonServiceClient.getRequest(serviceId2).get().getLoadBalancerState().equals(BaragonRequestState.WAITING)) { } if(baragonServiceClient.getRequest(serviceId2).get().getLoadBalancerState().equals(BaragonRequestState.INVALID_REQUEST_NOOP)) { } else { BaragonResponse resp = baragonServiceClient.getRequest(serviceId2).get(); throw new Exception("Request did not go as expected: " + resp.getMessage().get().toString() + "\nState: " + resp.getLoadBalancerState()); } removeService(serviceId); } else { BaragonResponse resp = baragonServiceClient.getRequest(serviceId).get(); throw new Exception("Request did not succeed: " + resp.getMessage().get().toString() + "\nState: " + resp.getLoadBalancerState()); } }</code><technical_language>need fromNullable null, Optional.of("someotherservice")</technical_language>

Target:
public void testBasePathConflictInvalidReplaceId() throws Exception { String serviceId = setupTestService(); waitForStatus(serviceId, BaragonRequestState.SUCCESS); String serviceId2 = serviceId + "-2"; setupTestService(serviceId2, serviceId2, SERVICE_BASE_PATH, Optional.of("someotherservice"), Optional.<Map<String, Object>>absent(), Optional.<String>absent()); waitForStatus(serviceId2, BaragonRequestState.INVALID_REQUEST_NOOP); }
Source:
<code>void fail(Throwable e) { if (setIf(stateReference, State.failed(e), state -> state.getKind() == INITIAL)) { splitLoader.stop(); queues.finish(); } <START> checkState(stateReference.get().getKind() == FAILED, <END> "Another thread raced to complete this split source before failure info is recorded"); }</code><technical_language>timeout, close, limit</technical_language>

Target:
void fail(Throwable e) { if (setIf(stateReference, State.failed(e), state -> state.getKind() == INITIAL)) { splitLoader.stop(); queues.finish(); } }
Source:
<code>public boolean isCheckDigitValid(List<Integer> digits, char checkDigit) { int modResult = ModUtil.calculateLuhnMod10Check( digits ); int checkValue = extractDigit( checkDigit ); <START> return modResult < 10 ? checkValue == modResult : checkValue == 0; <END> }</code><technical_language>This fix issue is mod10 is coded for check digit, a bit return correct calculateLuhnMod10Check hard code modResult if is greater 9</technical_language>

Target:
public boolean isCheckDigitValid(List<Integer> digits, char checkDigit) { int modResult = ModUtil.calculateLuhnMod10Check( digits ); if ( !Character.isDigit( checkDigit ) ) { return false; } int checkValue = extractDigit( checkDigit ); return checkValue == modResult; }
Source:
<code>public void testCancellationPriorToBeginRuleWontHoldRule() throws Exception { final Semaphore mainThreadSemaphore = new Semaphore(0); final Semaphore lockSemaphore = new Semaphore(0); final PathRule rule = new PathRule("testBeginRuleNoEnd"); IProgressMonitor cancelledMonitor = SubMonitor.convert(null); cancelledMonitor.setCanceled(true); Job job = Job.create("", monitor -> { mainThreadSemaphore.release(); try { lockSemaphore.acquire(); } catch (InterruptedException e) { } }); job.setRule(rule); job.schedule(); mainThreadSemaphore.acquire(); boolean canceledExceptionThrown = false; try { manager.beginRule(rule, cancelledMonitor); } catch (OperationCanceledException e) { canceledExceptionThrown = true; } <START> manager.endRule(rule); <END> lockSemaphore.release(); boolean interrupted = Thread.interrupted(); assertTrue("An OperationCancelledException was thrown", canceledExceptionThrown); assertFalse("The thread was not interrupted", interrupted); }</code><technical_language>endRule supposed a finally block</technical_language>

Target:
public void testCancellationPriorToBeginRuleWontHoldRule() throws Exception { final Semaphore mainThreadSemaphore = new Semaphore(0); final Semaphore lockSemaphore = new Semaphore(0); final PathRule rule = new PathRule("testBeginRuleNoEnd"); IProgressMonitor cancelledMonitor = SubMonitor.convert(null); cancelledMonitor.setCanceled(true); Job job = Job.create("", monitor -> { mainThreadSemaphore.release(); try { lockSemaphore.acquire(); } catch (InterruptedException e) { } }); job.setRule(rule); job.schedule(); mainThreadSemaphore.acquire(); boolean canceledExceptionThrown = false; try { manager.beginRule(rule, cancelledMonitor); } catch (OperationCanceledException e) { canceledExceptionThrown = true; } finally { manager.endRule(rule); } lockSemaphore.release(); boolean interrupted = Thread.interrupted(); assertTrue("An OperationCancelledException should have been thrown", canceledExceptionThrown); assertFalse("The Thread.interrupted() state leaked", interrupted); }
Source:
<code>public List<String> listSchemas() { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (SchemaTableName tableName : tableDescriptions.keySet()) { <START> builder.add(tableName.getSchemaName()); <END> } return ImmutableList.copyOf(builder.build()); }</code><technical_language>Do need a set here? Is a duplicate in keys of tableDescriptions, is a Map? I guess this enough: return tableDescriptions.keySet() .stream() .map(SchemaTableName::getSchemaName) .collect(toImmutableList());</technical_language>

Target:
public List<String> listSchemas() { return tableDescriptions.keySet().stream() .map(SchemaTableName::getSchemaName) .collect(toImmutableList()); }
Source:
<code>public void vmsAreUpdatedByTheOrderOfTheirIds() { createSimpleCommand(); VmStatic vm1 = new VmStatic(); <START> vm1.setId(new Guid("77296e00-0cad-4e5a-9299-008a7b6f4355")); VmStatic vm2 = new VmStatic(); vm2.setId(new Guid("87296e00-0cad-4e5a-9299-008a7b6f4355")); VmStatic vm3 = new VmStatic(); vm3.setId(new Guid("67296e00-0cad-4e5a-9299-008a7b6f4355")); <END> when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3)); assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate()); }</code><technical_language>Members nice</technical_language>

Target:
public void vmsAreUpdatedByTheOrderOfTheirIds() { createSimpleCommand(); VmStatic vm1 = new VmStatic(); vm1.setId(VM_ID1); VmStatic vm2 = new VmStatic(); vm2.setId(VM_ID2); VmStatic vm3 = new VmStatic(); vm3.setId(VM_ID3); when(vmStaticDao.getAllByCluster(any())).thenReturn(Arrays.asList(vm1, vm2, vm3)); assertEquals(Arrays.asList(vm2, vm3, vm1), cmd.filterVmsInClusterNeedUpdate()); }
Source:
<code>private void addItemsOnSpinner() { playerSpinner = (Spinner) findViewById(R.id.select_player); List<String> list = new ArrayList<String>(); list.add("OoyalaDefault"); list.add("GoogleIMA"); list.add("Freewheel"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); playerSpinner.setAdapter(dataAdapter); formatSpinner = (Spinner) findViewById(R.id.selectFormat); list = new ArrayList<String>(); list.add("default"); list.add("dash"); list.add("akamai_hd2_vod_hls"); list.add("mp4"); list.add("m3u8"); list.add("hls"); list.add("akamai_hd2_hls"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); formatSpinner.setAdapter(dataAdapter); hevcSpinner = (Spinner) findViewById(R.id.hevc_mode); list = new ArrayList<String>(); <START> list.add("NoHEVCParam"); <END> list.add("HEVCPreferred"); list.add("HEVCNotPreferred"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hevcSpinner.setAdapter(dataAdapter); }</code><technical_language>this option? I it</technical_language>

Target:
private void addItemsOnSpinner() { playerSpinner = (Spinner) findViewById(R.id.select_player); List<String> list = new ArrayList<String>(); list.add("OoyalaDefault"); list.add("GoogleIMA"); list.add("Freewheel"); ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); playerSpinner.setAdapter(dataAdapter); formatSpinner = (Spinner) findViewById(R.id.selectFormat); list = new ArrayList<String>(); list.add("default"); list.add("dash"); list.add("akamai_hd2_vod_hls"); list.add("mp4"); list.add("m3u8"); list.add("hls"); list.add("akamai_hd2_hls"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); formatSpinner.setAdapter(dataAdapter); hevcSpinner = (Spinner) findViewById(R.id.hevc_mode); list = new ArrayList<String>(); list.add("NoPreference"); list.add("HEVCPreferred"); list.add("HEVCNotPreferred"); dataAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hevcSpinner.setAdapter(dataAdapter); }
Source:
<code>public String getCreatedTimeDateString() { <START> return TimeHelper.formatDateForInstructorCoursesPage(createdTime, timeZone); <END> }</code><technical_language>If wrong, this method (and methods below) format dates for display in instructor sessions page. method naming is accurate here...but if a name is long I guess this works</technical_language>

Target:
public String getCreatedTimeDateString() { return TimeHelper.formatDateForInstructorSessionsPage(createdTime, timeZone); }
Source:
<code><START> public Map<String, RoutingTableSnapshot> getRoutingTableSnapshots() { <END> Map<String, RoutingTableSnapshot> snapshots = new HashMap<>(); for (String key : _routingTableRef.keySet()) { snapshots.put(key, new RoutingTableSnapshot(_routingTableRef.get(key).get())); } return snapshots; }</code><technical_language>I suggest making return more comprehensive. Map<String (path), Map<String (type), RoutingTableSnapshot>></technical_language>

Target:
public Map<String, Map<String, RoutingTableSnapshot>> getRoutingTableSnapshots() { Map<String, Map<String, RoutingTableSnapshot>> snapshots = new HashMap<>(); for (String key : _routingTableRefMap.keySet()) { RoutingTable routingTable = _routingTableRefMap.get(key).get(); String propertyTypeName = routingTable.getPropertyType().name(); String customizedStateType = routingTable.getStateType(); if (!snapshots.containsKey(propertyTypeName)) { snapshots.put(propertyTypeName, new HashMap<>()); } snapshots.get(propertyTypeName).put(customizedStateType, new RoutingTableSnapshot(routingTable)); } return snapshots; }
Source:
<code>public void localSslAuthenticationDisabled() throws Exception { server.await(); <START> dbClient = ClientBuilder.url(new URL(server.getUrl())) <END> .setSSLAuthenticationDisabled(true) .build(); dbClient.getAllDbs(); }</code><technical_language>SimpleHttpsServer extends SimpleHttpServer this (and other tests in this class) CloudantClientHelper.newSimpleHttpServerClient(server) they</technical_language>

Target:
public void localSslAuthenticationDisabled() throws Exception { server.await(); dbClient = CloudantClientHelper.newSimpleHttpServerClient(server) .disableSSLAuthentication() .build(); dbClient.getAllDbs(); }
Source:
<code><START> @Override public void start() { <END> session.addActivityConsumer(this, Priority.ACTIVE); }</code><technical_language>Do a formatter ? I haven this style Eclipse formatter</technical_language>

Target:
public void start() { session.addActivityConsumer(this, Priority.ACTIVE); }
Source:
<code><START> public static GridCellValue<?> extractGridCellValue(final GridCellTuple cellTuple) { <END> final GridCell<?> cell = cellTuple.getGridWidget().getModel().getCell(cellTuple.getRowIndex(), cellTuple.getColumnIndex()); return cell == null ? null : cell.getValue(); }</code><technical_language>Great improvement thanks... ask however... reason choose return Optional<GridCellValue<?>> remove Optional.ofNullable(..) in commands? a question.. happy "as is".. a nice improvement</technical_language>

Target:
public static Optional<GridCellValue<?>> extractGridCellValue(final GridCellTuple cellTuple) { final GridCell<?> cell = cellTuple.getGridWidget().getModel().getCell(cellTuple.getRowIndex(), cellTuple.getColumnIndex()); return Optional.ofNullable(cell == null ? null : cell.getValue()); }
Source:
<code>public void writeTime( long nanosOfDayLocal, int offsetSeconds ) { <START> this.nanosOfDayUTC = nanosOfDayLocal - offsetSeconds * 1_000_000_000L; <END> this.zoneOffsetSeconds = offsetSeconds; }</code><technical_language>want new NANOS_PER_SECOND instead of hardcode 1_000_000_000L</technical_language>

Target:
public void writeTime( long nanosOfDayLocal, int offsetSeconds ) { this.nanosOfDayUTC = nanosOfDayLocal - offsetSeconds * NANOS_PER_SECOND; this.zoneOffsetSeconds = offsetSeconds; }
Source:
<code>public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); <START> exception.expect(IllegalArgumentException.class); <END> byte[] errorBytes = {0x01}; assertArrayEquals(errorBytes, ByteUtils.unescape(errorBytes)); byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); }</code><technical_language>If code immediately this throws exception, rest of test executed</technical_language>

Target:
public void testEscape() { byte[] bytes = {0x00, 0x01}; byte[] escaped = ByteUtils.escape(bytes); assertArrayEquals(bytes, ByteUtils.unescape(escaped)); byte[] notEscaped = {0x02, 0x02, 0x02}; assertArrayEquals(notEscaped, ByteUtils.unescape(notEscaped)); }
Source:
<code>protected PutRequest createPutRequest() { return new PutRequest(correlationIdGenerator.incrementAndGet(), putManager.routerConfig.routerHostname, <START> chunkBlobId, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(buf.duplicate()), <END> buf.remaining(), BlobType.DataBlob); }</code><technical_language>1) Is necessary store usermetadata chunk (unless is metadata blob) ? HEAD (or other metadata operation) access metadata blob. 2) I understand do buf.duplicate() (I a shallow copy hit perf - curious need it)</technical_language>

Target:
protected PutRequest createPutRequest() { return new PutRequest(NonBlockingRouter.correlationIdGenerator.incrementAndGet(), routerConfig.routerHostname, chunkBlobId, blobProperties, ByteBuffer.wrap(userMetadata), new ByteBufferInputStream(buf.duplicate()), buf.remaining(), BlobType.DataBlob); }
Source:
<code>private void readCommonParameters(Class<?> cls) { Path path = AnnotationUtils.findAnnotation(cls, Path.class); if (path != null) { return; } List<Method> filteredMethods = getFilteredMethods(cls); for (Method method : filteredMethods) { path = AnnotationUtils.findAnnotation(method, Path.class); if (path != null) { return; } String httpMethod = extractOperationMethod(null, method, SwaggerExtensions.chain()); if (httpMethod != null) { return; } } Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { Annotation[] annotations = field.getAnnotations(); if (annotations.length > 0) { List<Parameter> params = getParameters(cls, Arrays.asList(annotations)); for (Parameter param : params) { <START> swagger.addParameter(param.getName(), param); <END> } } } }</code><technical_language>Currently, if a parameter exists name, is simply overwritten. This lead unexpected behaviour, is unclear parameter in generated swagger.json in end. want stop build this point inform user this. do think</technical_language>

Target:
private void readCommonParameters(Class<?> cls) { Path path = AnnotationUtils.findAnnotation(cls, Path.class); if (path != null) { return; } List<Method> filteredMethods = getFilteredMethods(cls); for (Method method : filteredMethods) { path = AnnotationUtils.findAnnotation(method, Path.class); if (path != null) { return; } String httpMethod = extractOperationMethod(null, method, SwaggerExtensions.chain()); if (httpMethod != null) { return; } } Field[] fields = cls.getDeclaredFields(); for (Field field : fields) { Annotation[] annotations = field.getAnnotations(); if (annotations.length > 0) { List<Parameter> params = getParameters(cls, Arrays.asList(annotations)); for (Parameter param : params) { if (hasCommonParameter(param)) { String msg = "[" + cls.getCanonicalName() + "] Redefining common parameter '" + param.getName() + "' already defined elsewhere"; throw new RuntimeException(msg); } swagger.addParameter(param.getName(), param); } } } }
Source:
<code>public static UsersStateDifference fromUmsAndIpaUsersStates(UmsUsersState umsState, UsersState ipaState) { <START> ImmutableSet<FmsUser> usersToAdd = calculateUsersToAdd(umsState, ipaState); LOGGER.info("usersToAdd size = {}", usersToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding users {}", usersToAdd.stream().map(FmsUser::getName).collect(Collectors.toSet())); } ImmutableSet<String> usersToRemove = calculateUsersToRemove(umsState, ipaState); LOGGER.info("usersToRemove size = {}", usersToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing users {}", usersToRemove.stream().collect(Collectors.toSet())); } ImmutableSet<FmsGroup> groupsToAdd = calculateGroupsToAdd(umsState, ipaState); LOGGER.info("groupsToAdd size = {}", groupsToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding groups {}", groupsToAdd.stream().map(FmsGroup::getName).collect(Collectors.toSet())); } ImmutableSet<FmsGroup> groupsToRemove = calculateGroupsToRemove(umsState, ipaState); LOGGER.info("groupsToRemove size = {}", groupsToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing groups {}", groupsToRemove.stream().map(FmsGroup::getName).collect(Collectors.toSet())); } ImmutableMultimap<String, String> groupMembershipToAdd = calculateGroupMembershipToAdd(umsState, ipaState); LOGGER.info("groupMembershipToAdd size = {}", groupMembershipToAdd.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("adding group memberships {}", groupMembershipToAdd.asMap()); } ImmutableMultimap<String, String> groupMembershipToRemove = calculateGroupMembershipToRemove(umsState, ipaState); LOGGER.info("groupMembershipToRemove size = {}", groupMembershipToRemove.size()); if (LOGGER.isDebugEnabled()) { LOGGER.debug("removing group memberships {}", groupMembershipToRemove.asMap()); <END> } return new UsersStateDifference( groupsToAdd, groupsToRemove, usersToAdd, usersToRemove, groupMembershipToAdd, groupMembershipToRemove); }</code><technical_language>lgtm, I this log moved calculate methods. isDebugEnabled is overkill I think, debug enabled everywhere, if planning change revisit logging</technical_language>

Target:
public static UsersStateDifference fromUmsAndIpaUsersStates(UmsUsersState umsState, UsersState ipaState) { return new UsersStateDifference( calculateGroupsToAdd(umsState, ipaState), calculateGroupsToRemove(umsState, ipaState), calculateUsersToAdd(umsState, ipaState), calculateUsersToRemove(umsState, ipaState), calculateGroupMembershipToAdd(umsState, ipaState), calculateGroupMembershipToRemove(umsState, ipaState)); }
Source:
<code><START> public void setManagedDeviceMap(Map<Guid, VmDevice> map) { <END> mVmStatic.setManagedDeviceMap(map); }</code><technical_language>if vmStatic null, check in setters</technical_language>

Target:
public void setManagedDeviceMap(Map<Guid, VmDevice> map) { if (mVmStatic == null) { mVmStatic = new VmStatic(); } mVmStatic.setManagedDeviceMap(map); }
Source:
<code>public void validate() { if (!containsMacro("sheetValue") && sheet.equalsIgnoreCase(SHEET_NO) && !StringUtils.isNumeric(sheetValue)) { throw new IllegalArgumentException("Invalid sheet number. The value should be greater than or equals to zero."); } if (!(Strings.isNullOrEmpty(tableExpiryPeriod)) && (Strings.isNullOrEmpty(memoryTableName))) { throw new IllegalArgumentException("Value for Table Expiry period is valid only when file tracking table " + "is specified. Please specify file tracking table name."); } <START> if (!containsMacro("rowsLimit") && !StringUtils.isNumeric(rowsLimit)) { <END> throw new IllegalArgumentException("Invalid row limit. The value should be greater than zero."); } }</code><technical_language>This fail isNumeric returns true for empty string based version of apache commons using</technical_language>

Target:
public void validate() { if (!containsMacro("sheetValue") && sheet.equalsIgnoreCase(SHEET_NO) && !StringUtils.isNumeric(sheetValue)) { throw new IllegalArgumentException("Invalid sheet number. The value should be greater than or equals to zero."); } if (!(Strings.isNullOrEmpty(tableExpiryPeriod)) && (Strings.isNullOrEmpty(memoryTableName))) { throw new IllegalArgumentException("Value for Table Expiry period is valid only when file tracking table " + "is specified. Please specify file tracking table name."); } if (!Strings.isNullOrEmpty(rowsLimit) && !StringUtils.isNumeric(rowsLimit)) { throw new IllegalArgumentException(String.format("Invalid row limit: %s. " + "Numeric value expected.", rowsLimit)); } }
Source:
<code>private void throwUnsupportedOperationException() { throw new UnsupportedOperationException( <START> "Session-aware operation is not supported by " + FEDERATED_ZK_CLIENT + ". Instead, please use " + DEDICATED_ZK_CLIENT_FACTORY + " for this operation"); <END> }</code><technical_language>Nit: people DedicatdZkClient instead of DedicatedZkClientFactory</technical_language>

Target:
private void throwUnsupportedOperationException() { throw new UnsupportedOperationException( "Session-aware operation is not supported by " + FEDERATED_ZK_CLIENT + ". Instead, please use " + DEDICATED_ZK_CLIENT_FACTORY + " to create a dedicated RealmAwareZkClient for this operation."); }
Source:
<code>public StagingCommitter(Path outputPath, TaskAttemptContext context) throws IOException { super(outputPath, context); this.constructorOutputPath = checkNotNull(getOutputPath(), "output path"); Configuration conf = getConf(); this.uploadPartSize = conf.getLongBytes( MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); this.uniqueFilenames = conf.getBoolean( FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES, DEFAULT_STAGING_COMMITTER_UNIQUE_FILENAMES); <START> setWorkPath(buildWorkPath(context, this.getUUID())); <END> this.wrappedCommitter = createWrappedCommitter(context, conf); setOutputPath(constructorOutputPath); Path finalOutputPath = getOutputPath(); checkNotNull(finalOutputPath, "Output path cannot be null"); S3AFileSystem fs = getS3AFileSystem(finalOutputPath, context.getConfiguration(), false); s3KeyPrefix = fs.pathToKey(finalOutputPath); LOG.debug("{}: final output path is {}", getRole(), finalOutputPath); ConflictResolution mode = getConflictResolutionMode(getJobContext(), fs.getConf()); LOG.debug("Conflict resolution mode: {}", mode); }</code><technical_language>nit: getUUID() this.</technical_language>

Target:
public StagingCommitter(Path outputPath, TaskAttemptContext context) throws IOException { super(outputPath, context); this.constructorOutputPath = checkNotNull(getOutputPath(), "output path"); Configuration conf = getConf(); this.uploadPartSize = conf.getLongBytes( MULTIPART_SIZE, DEFAULT_MULTIPART_SIZE); this.uniqueFilenames = conf.getBoolean( FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES, DEFAULT_STAGING_COMMITTER_UNIQUE_FILENAMES); setWorkPath(buildWorkPath(context, getUUID())); this.wrappedCommitter = createWrappedCommitter(context, conf); setOutputPath(constructorOutputPath); Path finalOutputPath = getOutputPath(); checkNotNull(finalOutputPath, "Output path cannot be null"); S3AFileSystem fs = getS3AFileSystem(finalOutputPath, context.getConfiguration(), false); s3KeyPrefix = fs.pathToKey(finalOutputPath); LOG.debug("{}: final output path is {}", getRole(), finalOutputPath); ConflictResolution mode = getConflictResolutionMode(getJobContext(), fs.getConf()); LOG.debug("Conflict resolution mode: {}", mode); }
Source:
<code>public String toString() { return MoreObjects.toStringHelper(this) <START> .add("_uuid", _uuid) <END> .add("_versionSet", _versionSet) .add("_versionSpecificationAttributes", _versionSpecificationAttributes) .add("_position", _position) .toString(); }</code><technical_language>match conventional toString implementation</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("Uuid", _uuid) .add("VersionSet", _versionSet) .add("VersionSpecificationAttributes", _versionSpecificationAttributes) .add("Position", _position) .toString(); }
Source:
<code>private void verifyHostname(String hostname) throws DatastreamException { try { String path = KeyBuilder.instances(_cluster); _zkClient.ensurePath(path); List<String> instances = _zkClient.getChildren(path); Set<String> hostnames = instances.stream().map(s -> s.substring(0, s.lastIndexOf('-'))).collect(Collectors.toSet()); if (!hostnames.contains(hostname)) { throw new DatastreamException("Hostname " + hostname + " is not valid"); } } catch (Exception ex) { <START> throw new DatastreamException(ex); <END> } }</code><technical_language>log error throw</technical_language>

Target:
private void verifyHostname(String hostname) throws DatastreamException { try { String path = KeyBuilder.instances(_cluster); _zkClient.ensurePath(path); List<String> instances = _zkClient.getChildren(path); Set<String> hostnames = instances.stream().map(s -> s.substring(0, s.lastIndexOf('-'))).collect(Collectors.toSet()); if (!hostnames.contains(hostname)) { String msg = "Hostname " + hostname + " is not valid"; LOG.error(msg); throw new DatastreamException(msg); } } catch (Exception ex) { LOG.error("Fail to verify the hostname", ex); throw new DatastreamException(ex); } }
Source:
<code>public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { int brickCount = volume.getBricks().size(); if (volume == null) { return; } GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: int count = countBrickDown(volume); if((count <= brickCount) && (count != 0)) { statusImage = resources.volumeUpWarning(); tooltip = constants.volumeBricksDown(); } else { statusImage = resources.upImage(); tooltip = constants.up(); } break; default: statusImage = resources.downImage(); tooltip = constants.down(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); <START> if(countBrickDown(volume) == brickCount) { <END> ImageResource alertImage = resources.alertImage(); SafeHtml alertImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(alertImage).getHTML()); sb.append(alertImageHtml); } }</code><technical_language>repeated call countBrickDown. This avoided storing result of call method</technical_language>

Target:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { int brickCount = volume.getBricks().size(); if (volume == null) { return; } int count = 0; GlusterStatus status = volume.getStatus(); ImageResource statusImage = null; String tooltip; switch (status) { case DOWN: statusImage = resources.downImage(); tooltip = constants.down(); break; case UP: count = countDownBricks(volume); if((count <= brickCount) && (count != 0)) { statusImage = resources.volumeUpWarning(); tooltip = constants.volumeBricksDown(); } else { statusImage = resources.upImage(); tooltip = constants.up(); } break; default: statusImage = resources.downImage(); tooltip = constants.down(); } SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML()); sb.append(applicationTemplates.statusTemplate(statusImageHtml, tooltip)); if(count == brickCount) { ImageResource alertImage = resources.alertImage(); SafeHtml alertImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(alertImage).getHTML()); sb.append(alertImageHtml); } }
Source:
<code>private void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) { if (peopleAttributes.contains(attribute)) { return; } AbstractAttributeEditor editor = createAttributeEditor(attribute); if (editor != null) { editor.createLabelControl(composite, toolkit); GridDataFactory.defaultsFor(editor.getLabelControl()) .indent(COLUMN_MARGIN, 0) .applyTo(editor.getLabelControl()); editor.createControl(composite, toolkit); getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); GridDataFactory gridDataFactory = GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.TOP); if (editor instanceof MultiSelectionAttributeEditor) { gridDataFactory.hint(SWT.DEFAULT, 95); } gridDataFactory.applyTo(editor.getControl()); } <START> if (attribute.getId().equals( <END> getTaskData().getAttributeMapper().mapToRepositoryKey(attribute.getParentAttribute(), TaskAttribute.USER_CC))) { toolkit.createLabel(composite, ""); Label label = toolkit.createLabel(composite, Messages.TaskEditorPeoplePart_Select_to_remove); GridDataFactory.fillDefaults().indent(0, 5).align(SWT.CENTER, SWT.CENTER).applyTo(label); } }</code><technical_language>I this sense here, attribute editor allow removing people</technical_language>

Target:
protected void addAttribute(Composite composite, FormToolkit toolkit, TaskAttribute attribute) { if (peopleAttributes.contains(attribute)) { return; } AbstractAttributeEditor editor = createAttributeEditor(attribute); if (editor != null) { editor.createLabelControl(composite, toolkit); GridDataFactory.defaultsFor(editor.getLabelControl()) .indent(COLUMN_MARGIN, 0) .applyTo(editor.getLabelControl()); editor.createControl(composite, toolkit); getTaskEditorPage().getAttributeEditorToolkit().adapt(editor); GridDataFactory gridDataFactory = GridDataFactory.fillDefaults() .grab(true, false) .align(SWT.FILL, SWT.TOP) .indent(3, 0); if (editor instanceof MultiSelectionAttributeEditor) { gridDataFactory.hint(SWT.DEFAULT, 95); } gridDataFactory.applyTo(editor.getControl()); } }
Source:
<code>static String buildColumnTypes(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return EMPTY_STRING; } return Joiner.on(",").join(columns.stream() <START> .map(column -> column.getHiveType().getTypeInfo().getTypeName()).collect(Collectors.toList())); <END> }</code><technical_language>extracting a variable for long stream operations more readable</technical_language>

Target:
private static String buildColumnTypes(List<HiveColumnHandle> columns) { if (columns == null || columns.isEmpty()) { return EMPTY_STRING; } return columns .stream() .map(column -> column.getHiveType().getTypeInfo().getTypeName()) .collect(Collectors.joining(",")); }
Source:
<code>public void trade() { Set<String> stocksToBuy = getBuyOrders().keySet(); for (String stockToBuy : stocksToBuy) { if (!getSellOrders().containsKey(stockToBuy)) { continue; } ArrayList<Order> buyOrderList = getBuyOrders().remove(stockToBuy); ArrayList<Order> sellOrderList = getSellOrders().remove(stockToBuy); <START> ArrayList<Order> buyOrderSortedArrayList = sortOrderList(buyOrderList,OrderType.BUY); <END> ArrayList<Order> sellOrderSortedArrayList = sortOrderList(sellOrderList,OrderType.SELL); TreeMap<Double, Pair<Integer, Integer>> orderCumulative = new TreeMap<Double, Pair<Integer, Integer>>(); calculateCumulative(buyOrderSortedArrayList, sellOrderSortedArrayList, orderCumulative); Pair<Double, Integer> resultPair=findMatchPrice(orderCumulative); double matchPrice= (Double) resultPair.getLeft(); int buyQuantity= (Integer) resultPair.getRight(); int sellQuantity=buyQuantity; ArrayList<Order> buyOrderTempArrayList = (ArrayList<Order>) buyOrderSortedArrayList .clone(); ArrayList<Order> sellOrderTempArrayList = (ArrayList<Order>) sellOrderSortedArrayList .clone(); comfirmMartketPrice(stockToBuy, matchPrice); performBuyOrders(stockToBuy, buyOrderList, matchPrice, buyQuantity, buyOrderTempArrayList); performSellOrders(stockToBuy, sellOrderList, matchPrice, sellQuantity, sellOrderTempArrayList); } }</code><technical_language>variable name need "ArrayList" in</technical_language>

Target:
public void trade() { Set<String> stocksToBuy = getBuyOrders().keySet(); for (String stockToBuy : stocksToBuy) { if (!getSellOrders().containsKey(stockToBuy)) { continue; } ArrayList<Order> buyOrderList = getBuyOrders().remove(stockToBuy); ArrayList<Order> sellOrderList = getSellOrders().remove(stockToBuy); ArrayList<Order> buyOrderSortedList = sortOrderList(buyOrderList,OrderType.BUY); ArrayList<Order> sellOrderSortedList = sortOrderList(sellOrderList,OrderType.SELL); TreeMap<Double, Pair<Integer, Integer>> orderCumulative = new TreeMap<Double, Pair<Integer, Integer>>(); calculateCumulative(buyOrderSortedList, sellOrderSortedList, orderCumulative); Pair<Double, Integer> resultPair=findMatchPrice(orderCumulative); double matchPrice= (Double) resultPair.getLeft(); int buyQuantity= (Integer) resultPair.getRight(); int sellQuantity=buyQuantity; ArrayList<Order> buyOrderTempList = (ArrayList<Order>) buyOrderSortedList .clone(); ArrayList<Order> sellOrderTempList = (ArrayList<Order>) sellOrderSortedList .clone(); comfirmMartketPrice(stockToBuy, matchPrice); performBuyOrders(stockToBuy, buyOrderList, matchPrice, buyQuantity, buyOrderTempList); performSellOrders(stockToBuy, sellOrderList, matchPrice, sellQuantity, sellOrderTempList); } }
Source:
<code>public ObjectNode createParserUIInitializationData(ImportingJob job, List<ObjectNode> fileRecords, String format) { ObjectNode options = super.createParserUIInitializationData(job, fileRecords, format); String separator = guessSeparator(job, fileRecords); JSONUtilities.safePut(options, "separator", separator != null ? separator : "\\t"); JSONUtilities.safePut(options, "guessCellValueTypes", false); JSONUtilities.safePut(options, "processQuotes", true); JSONUtilities.safePut(options, "quoteCharacter", String.valueOf(CSVParser.DEFAULT_QUOTE_CHARACTER)); <START> JSONUtilities.safePut(options, "trimStrings", false); <END> return options; }</code><technical_language>potentially set this true instead - this enable option default in UI. importer behave in if importer configuration generated a previous version, false default in getBoolean in readTable. I strong feelings this enabled default in UI. more consistent other importers support trimming strings. I expect workflows preserving whitespace strings rare for TSV/CSV. leaning enabling @ostephens do think</technical_language>

Target:
public ObjectNode createParserUIInitializationData(ImportingJob job, List<ObjectNode> fileRecords, String format) { ObjectNode options = super.createParserUIInitializationData(job, fileRecords, format); String separator = guessSeparator(job, fileRecords); JSONUtilities.safePut(options, "separator", separator != null ? separator : "\\t"); JSONUtilities.safePut(options, "guessCellValueTypes", false); JSONUtilities.safePut(options, "processQuotes", true); JSONUtilities.safePut(options, "quoteCharacter", String.valueOf(CSVParser.DEFAULT_QUOTE_CHARACTER)); JSONUtilities.safePut(options, "trimStrings", true); return options; }
Source:
<code>@Override public void run() { StreamExecutionListener stream = serviceExecutor.getBuffer( query, windowRowSize, windowMillisSize, windowRate ); try { if ( stream == null ) { <START> this.runGenTrans( new ArrayList<>() ); <END> } else if ( stream.hasCachedWindow() ) { this.runGenTrans( stream.getCachedWindow() ); } else { buffer = stream.getBuffer().subscribe( list -> this.runGenTrans( list ) ); } } catch ( KettleException e ) { throw Throwables.propagate( e ); } }</code><technical_language>if list passed in is changed, suggest Collections.emptyList instead</technical_language>

Target:
@Override public void run() { StreamExecutionListener stream = serviceExecutor.getBuffer( query, windowRowSize, windowMillisSize, windowRate ); try { if ( stream == null ) { this.runGenTrans( Collections.emptyList() ); } else if ( stream.hasCachedWindow() ) { this.runGenTrans( stream.getCachedWindow() ); } else { buffer = stream.getBuffer().subscribe( list -> this.runGenTrans( list ) ); } } catch ( KettleException e ) { throw Throwables.propagate( e ); } }
Source:
<code>public void onImportStyle() { ILayer[] layers = mapContext.getSelectedLayers(); if (layers.length == 1) { ILayer layer = layers[0]; final OpenFilePanel inputXMLPanel = new OpenFilePanel( "org.orbisgis.core.ui.editorViews.toc.actions.ImportStyle", "Choose a location"); inputXMLPanel.addFilter("se", "Symbology Encoding 2.0 (FeatureTypeStyle"); if (UIFactory.showDialog(inputXMLPanel)) { String seFile = inputXMLPanel.getSelectedFile().getAbsolutePath(); try { layer.addStyle(new Style(layer, seFile)); } catch (SeExceptions.InvalidStyle ex) { <START> LOGGER.error(I18N.tr(ex.getLocalizedMessage())); <END> String msg = ex.getMessage().replace("<", "\n - ").replace(',', ' ').replace(": ", "\n - "); JOptionPane.showMessageDialog(null, msg, "Error while loading the style", JOptionPane.ERROR_MESSAGE); } } } }</code><technical_language>Remove I18N.tr( ), give LOGGER.error(ex.getLocalizedMessage(),ex);</technical_language>

Target:
public void onImportStyle() { ILayer[] layers = mapContext.getSelectedLayers(); if (layers.length == 1) { ILayer layer = layers[0]; final OpenFilePanel inputXMLPanel = new OpenFilePanel( "org.orbisgis.core.ui.editorViews.toc.actions.ImportStyle", "Choose a location"); inputXMLPanel.addFilter("se", "Symbology Encoding 2.0 (FeatureTypeStyle"); if (UIFactory.showDialog(inputXMLPanel)) { String seFile = inputXMLPanel.getSelectedFile().getAbsolutePath(); try { layer.addStyle(new Style(layer, seFile)); } catch (SeExceptions.InvalidStyle ex) { LOGGER.error(ex.getLocalizedMessage()); String msg = ex.getMessage().replace("<", "\n - ").replace(',', ' ').replace(": ", "\n - "); JOptionPane.showMessageDialog(null, msg, "Error while loading the style", JOptionPane.ERROR_MESSAGE); } } } }
Source:
<code>public void isGitRepository() { <START> assertTrue(new File(db.getDirectory(), "HEAD").delete()); <END> assertTrue(RepositoryCache.FileKey.isGitRepository(db.getDirectory(), db.getFS())); }</code><technical_language>a repository converted reftable .git/HEAD ? deleted convertToReftable()</technical_language>

Target:
public void isGitRepository() { assertTrue(RepositoryCache.FileKey.isGitRepository(db.getDirectory(), db.getFS())); }
Source:
<code>public boolean exists(final String path) { return doExecuteWithClient(new ClientCallback<FTPClient, Boolean>() { @Override public Boolean doWithClient(FTPClient client) { try { String[] names = client.listNames(path); <START> return !ObjectUtils.isEmpty(names); <END> } catch (IOException e) { throw new MessagingException("Failed to listNames for " + path, e); } } }); }</code><technical_language>No; this break existing applications (not code) this method check for existence of a directory FTP server properly supports STAT. This needs work for files directories, BUT, I want overhead of 4 trips server for cases **know** for a file. I easy provide compatibility, performance hit, adding more methods template</technical_language>

Target:
public boolean exists(final String path) { return doExecuteWithClient(new ClientCallback<FTPClient, Boolean>() { @Override public Boolean doWithClient(FTPClient client) { try { switch (FtpRemoteFileTemplate.this.existsMode) { case STAT: return client.getStatus(path) != null; case NLST: String[] names = client.listNames(path); return !ObjectUtils.isEmpty(names); case NLST_AND_DIRS: return getSession().exists(path); default: throw new IllegalStateException("Unsupported 'existsMode': " + FtpRemoteFileTemplate.this.existsMode); } } catch (IOException e) { throw new MessagingException("Failed to check the remote path for " + path, e); } } }); }