auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public org.jclouds.domain.Location apply(final Location location) { final LocationBuilder builder = new LocationBuilder(); builder.id(location.name()); builder.description(location.displayName()); <START> builder.parent(getOnlyElement(justProvider.get())); <END> builder.scope(LocationScope.ZONE); final Region region = Region.byName(location.displayName()); if (region != null) { builder.iso3166Codes(ImmutableSet.of(region.iso3166Code())); } return builder.build(); }</code><technical_language>parent location of ZONE REGION instead of provider</technical_language>

Target:
public org.jclouds.domain.Location apply(final Location location) { final LocationBuilder builder = new LocationBuilder(); builder.id(location.name()); builder.description(location.displayName()); builder.parent(getOnlyElement(justProvider.get())); builder.scope(LocationScope.REGION); final Region region = Region.byName(location.displayName()); if (region != null) { builder.iso3166Codes(ImmutableSet.of(region.iso3166Code())); } return builder.build(); }
Source:
<code>public static void assertCompany(Company company) { assertBaseCompany(company, true); assertThat(company.headquarters).isNotNull(); assertThat(company.homepage).isNotNull(); assertThat(company.origin_country).isNotEmpty(); <START> assertThat(company.origin_country).isNotEmpty(); <END> if (company.parent_company != null) assertBaseCompany(company.parent_company, true); }</code><technical_language>reason this is asserted twice</technical_language>

Target:
public static void assertCompany(Company company) { assertBaseCompany(company, true); assertThat(company.headquarters).isNotNull(); assertThat(company.homepage).isNotNull(); assertThat(company.origin_country).isNotEmpty(); if (company.parent_company != null) assertBaseCompany(company.parent_company, true); }
Source:
<code>public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("PhiroSeekBarColorBrickTest"); script.addBrick(new PhiroRGBLightBrick(PhiroRGBLightBrick.Eye.BOTH, INIT_COLOR_VALUE, INIT_COLOR_VALUE, INIT_COLOR_VALUE)); <START> baseActivityTestRule.launchActivity(null); <END> }</code><technical_language>please call baseActivityTestRule.launchActivity() if give null, ignores fragment position in rules constructor</technical_language>

Target:
public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("PhiroSeekBarColorBrickTest"); script.addBrick(new PhiroRGBLightBrick(PhiroRGBLightBrick.Eye.BOTH, INIT_COLOR_VALUE, INIT_COLOR_VALUE, INIT_COLOR_VALUE)); baseActivityTestRule.launchActivity(); }
Source:
<code>private static void addInsertNonDirectoryInformation(Path p, FileSystem fileSystem, InsertEventRequestData insertData) throws IOException { insertData.addToFilesAdded(p.toString()); FileChecksum cksum = fileSystem.getFileChecksum(p); <START> String acidDir = AcidUtils.getFirstLevelAcidDir(p); <END> if (cksum != null) { String checksumString = StringUtils.byteToHexString(cksum.getBytes(), 0, cksum.getLength()); insertData.addToFilesAddedChecksum(checksumString); } else { insertData.addToFilesAddedChecksum(""); } if (acidDir != null) { insertData.addToSubDirectoryList(acidDir); } }</code><technical_language>If is a subdir delta/base dir, this work. acidDir give complete subdir path for file</technical_language>

Target:
private static void addInsertNonDirectoryInformation(Path p, FileSystem fileSystem, InsertEventRequestData insertData) throws IOException { insertData.addToFilesAdded(p.toString()); FileChecksum cksum = fileSystem.getFileChecksum(p); String acidDirPath = AcidUtils.getFirstLevelAcidDirPath(p.getParent(), fileSystem); if (cksum != null) { String checksumString = StringUtils.byteToHexString(cksum.getBytes(), 0, cksum.getLength()); insertData.addToFilesAddedChecksum(checksumString); } else { insertData.addToFilesAddedChecksum(""); } if (acidDirPath != null) { insertData.addToSubDirectoryList(acidDirPath); } }
Source:
<code>synchronized void submitDecryptionTasks() { <START> if (m_hasOutstandingTask.compareAndSet(false, true)) { <END> Runnable task = new Runnable() { @Override public void run() { DBBPool.BBContainer srcC = null; boolean queuedMessages = false; SettableFuture<Void> sf = null; while ((srcC = getDecryptionFrame()) != null) { try { sf = SettableFuture.create(); m_decryptionResults.add(sf); final List<ByteBuffer> messages = new ArrayList<>(); srcC.b().flip(); m_dstBuffer.limit(m_dstBuffer.capacity()); m_sslBufferDecrypter.unwrap(srcC.b(), m_dstBuffer); if (m_dstBuffer.hasRemaining()) { ByteBuffer message; while ((message = m_sslMessageParser.message(m_dstBuffer)) != null) { messages.add(message); } } srcC.discard(); srcC = null; m_dstBuffer.clear(); m_decryptedMessages.offer(new DecryptionResult(messages, sf)); sf = null; queuedMessages = true; if (!m_isShuttingDown.get() && queuedMessages) { m_network.addToChangeList(m_port, true); } } catch(IOException ioe){ networkLog.error("Exception unwrapping an SSL frame", ioe); m_dstBuffer.clear(); return; } finally{ if (srcC != null) { srcC.discard(); } if (sf != null) { sf.setException(new Throwable("Decryption of buffer failed.")); } m_hasOutstandingTask.set(false); } } } }; try { m_sslEncryptionService.submitForDecryption(task); } catch (RejectedExecutionException e) { } } }</code><technical_language>I get double protection synchronized method CAS. redundant</technical_language>

Target:
synchronized void submitDecryptionTasks() { if (! m_hasOutstandingTask) { try { m_sslEncryptionService.submitForDecryption(m_decTask); m_hasOutstandingTask = true; } catch (RejectedExecutionException e) { } } }
Source:
<code><START> private void validateIOSeparator(String folderName) throws IOException { <END> if(folderName.contains(File.separator)) { throw new IOException("It's not possible to use the OS separator to create folder hierarchies like " + "\'MyParentFolder\'"+File.separator+"\'MyFolder\'. " + "Please use newFolder('MyParentFolder','MyFolder') instead"); } }</code><technical_language>list runtime exceptions in throws</technical_language>

Target:
private void validateIOSeparator(String folderName) throws IOException { if (folderName.contains(File.separator)) { String errorMsg = "It's not possible to use the OS separator to create folder " + "hierarchies like 'MyParentFolder'%s'MyFolder'. Please use newFolder('MyParentFolder', "+ "'MyFolder') instead"; throw new IOException(String.format(errorMsg,File.separator)); } }
Source:
<code>public synchronized void processProject(final IProgressMonitor progressMonitor) throws CoreException { <START> synchronized(this) { <END> try { this.initializing = true; progressMonitor.beginTask("Processing project '" + getProject().getName() + "'...", 1); this.elements.clear(); this.endpoints.clear(); this.indexationService.clear(); addBuiltinHttpMethods(); Logger.debug("Processing project '" + getProject().getName() + "'..."); processResourceChange(new ResourceDelta(getProject(), ADDED, 0), progressMonitor); if (WtpUtils.hasWebDeploymentDescriptor(getProject())) { processWebDeploymentDescriptorChange( new ResourceDelta(WtpUtils.getWebDeploymentDescriptor(getProject()), ADDED, 0), progressMonitor); } progressMonitor.worked(1); } catch (CoreException e) { Logger.error("Failed while processing resource results", e); } finally { progressMonitor.done(); setBuildStatus(Status.OK_STATUS); Logger.debug("Done processing resource results."); this.initializing = false; } } }</code><technical_language>synchronized method synchronized(this) means afaik</technical_language>

Target:
public void processProject(final IProgressMonitor progressMonitor) throws CoreException { try { readWriteLock.writeLock().lock(); this.initializing = true; progressMonitor.beginTask("Processing project '" + getProject().getName() + "'...", 1); this.elements.clear(); this.endpoints.clear(); this.indexationService.clear(); addBuiltinHttpMethods(); Logger.debug("Processing project '" + getProject().getName() + "'..."); processResourceChange(new ResourceDelta(getProject(), ADDED, 0), progressMonitor); if (WtpUtils.hasWebDeploymentDescriptor(getProject())) { processWebDeploymentDescriptorChange( new ResourceDelta(WtpUtils.getWebDeploymentDescriptor(getProject()), ADDED, 0), progressMonitor); } progressMonitor.worked(1); } catch (CoreException e) { Logger.error("Failed while processing resource results", e); } finally { progressMonitor.done(); readWriteLock.writeLock().unlock(); setBuildStatus(Status.OK_STATUS); Logger.debug("Done processing resource results."); this.initializing = false; } }
Source:
<code>public static void endTaskJob(ExecutionContext context, boolean exitStatus) { if (context == null) { return; } try { if (context.getExecutionMethod() == ExecutionMethod.AsJob && context.getJob() != null) { endJob(context, exitStatus); } else { Step parentStep = context.getStep(); if (context.getExecutionMethod() == ExecutionMethod.AsStep && parentStep != null) { Step finalizingStep = parentStep.getStep(StepEnum.FINALIZING); <START> if (finalizingStep != null) { <END> endTaskStep(finalizingStep.getId(), exitStatus ? JobExecutionStatus.FINISHED : JobExecutionStatus.FAILED); } parentStep.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(parentStep); List<Step> steps = DbFacade.getInstance().getStepDao().getStepsByJobId(parentStep.getJobId()); boolean hasChildStepsRunning = false; for (Step step : steps) { if (step.getStatus() == JobExecutionStatus.STARTED && step.getParentStepId() != null) { hasChildStepsRunning = true; break; } } if (!hasChildStepsRunning) { endJob(exitStatus, JobRepositoryFactory.getJobRepository().getJob(parentStep.getJobId())); } } } } catch (RuntimeException e) { log.error(e); } }</code><technical_language>Please update finalizingStep , need retrieve</technical_language>

Target:
public static void endTaskJob(ExecutionContext context, boolean exitStatus) { if (context == null) { return; } try { if (context.getExecutionMethod() == ExecutionMethod.AsJob && context.getJob() != null) { endJob(context, exitStatus); } else { Step parentStep = context.getStep(); if (context.getExecutionMethod() == ExecutionMethod.AsStep && parentStep != null) { Step finalizingStep = parentStep.getStep(StepEnum.FINALIZING); if (finalizingStep != null) { finalizingStep.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(finalizingStep); } parentStep.markStepEnded(exitStatus); JobRepositoryFactory.getJobRepository().updateStep(parentStep); List<Step> steps = DbFacade.getInstance().getStepDao().getStepsByJobId(parentStep.getJobId()); boolean hasChildStepsRunning = false; for (Step step : steps) { if (step.getStatus() == JobExecutionStatus.STARTED && step.getParentStepId() != null) { hasChildStepsRunning = true; break; } } if (!hasChildStepsRunning) { endJob(exitStatus, JobRepositoryFactory.getJobRepository().getJob(parentStep.getJobId())); } } } } catch (RuntimeException e) { log.error(e); } }
Source:
<code>@Test public void testFileExpansionCorrectlyZeroesData() throws IOException { QueueFile queue = new QueueFile(file); byte[][] values = new byte[5][]; for (int blockNum = 0; blockNum < values.length; blockNum++) { values[blockNum] = new byte[1024]; for (int i = 0; i < values[blockNum].length; i++) { values[blockNum][i] = (byte) (blockNum + 1); } <START> } <END> queue.add(values[0]); queue.add(values[1]); queue.remove(); queue.add(values[2]); queue.add(values[3]); queue.add(values[4]); byte[] data = new byte[1028]; byte[] expected = new byte[1028]; queue.raf.seek(HEADER_LENGTH); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); data = new byte[3024]; expected = new byte[3024]; queue.raf.seek(5168); queue.raf.readFully(data, 0, expected.length); assertThat(data).isEqualTo(expected); }</code><technical_language>Tape's tests angry. This is overly complex initialization</technical_language>

Target:
@Test public void testFileExpansionCorrectlyZeroesData() throws IOException { QueueFile queue = new QueueFile(file); byte[][] values = new byte[5][]; for (int blockNum = 0; blockNum < values.length; blockNum++) { values[blockNum] = new byte[1024]; for (int i = 0; i < values[blockNum].length; i++) { values[blockNum][i] = (byte) (blockNum + 1); } } queue.add(values[0]); queue.add(values[1]); queue.remove(); queue.add(values[2]); queue.add(values[3]); queue.add(values[4]); int firstElementPadding = 1028; byte[] data = new byte[firstElementPadding]; queue.raf.seek(HEADER_LENGTH); queue.raf.readFully(data, 0, firstElementPadding); assertThat(data).containsOnly((byte) 0x00); int endOfLastElement = HEADER_LENGTH + firstElementPadding + 4 * (Element.HEADER_LENGTH + 1024); int readLength = (int) (queue.raf.length() - endOfLastElement); data = new byte[readLength]; queue.raf.seek(endOfLastElement); queue.raf.readFully(data, 0, readLength); assertThat(data).containsOnly((byte) 0x00); }
Source:
<code><START> public static void main(String[] args) throws Exception{ <END> Parameters param = getParameters(args); if (param.isStream()) { StatusListener listener = new StatusListener() { @Override public void onException(Exception e) { } @Override public void onStatus(Status status) { printStatus(status, param.isHideRt()); if (!status.isRetweet() || !param.isHideRt()) try { TimeUnit.SECONDS.sleep(1); } catch (Exception e) { System.err.println("Sleep error"); } } @Override public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) { } @Override public void onTrackLimitationNotice(int i) { } @Override public void onScrubGeo(long l, long l1) { } @Override public void onStallWarning(StallWarning stallWarning) { } }; try { stream(param, listener); } catch (TwitterException e) { System.err.println("twitter error"); } catch (Exception e) { System.err.println("connection error"); } } else { try { search(param); } catch (TwitterException e) { System.err.println("twitter error"); } catch (Exception e) { System.err.println("connection error"); } } }</code><technical_language>'{' is preceded whitespace. (283:75)</technical_language>

Target:
public static void main(String[] args) throws Exception { Parameters param = getParameters(args); if (param.isHelp()) { System.exit(0); } if (param.isStream()) { StatusAdapter listener = new StatusAdapter() { @Override public void onException(Exception e) { System.err.println("Stream error"); } @Override public void onStatus(Status status) { printStatus(status, param.isHideRt()); if (!status.isRetweet() || !param.isHideRt()) { try { TimeUnit.SECONDS.sleep(1); } catch (Exception e) { System.err.println("Sleep error"); } } } }; try { stream(param, listener); } catch (TwitterException e) { System.err.println("twitter error"); } catch (IOException e) { System.err.println("cant find api key"); } catch (Exception e) { System.err.println("connection error"); } } else { try { search(param); } catch (TwitterException e) { System.err.println("twitter error"); } catch (Exception e) { System.err.println("connection error"); } } }
Source:
<code><START> public static Property<AggregationNode, Rule.Context, List<Symbol>> groupingKeys() <END> { return property("groupingKeys", AggregationNode::getGroupingKeys); }</code><technical_language>Rule.Context in commit introduces C</technical_language>

Target:
public static Property<AggregationNode, Lookup, List<Symbol>> groupingKeys() { return property("groupingKeys", AggregationNode::getGroupingKeys); }
Source:
<code>public void testGetSecurityGroupById() { HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); SecurityGroup group = extension.getSecurityGroupById(zone + "/160"); <START> assertEquals("160", group.getId()); <END> }</code><technical_language>assertEquals(boolean actual, boolean expected)</technical_language>

Target:
public void testGetSecurityGroupById() { HttpRequest getSecurityGroup = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse getSecurityGroupResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_details_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(getSecurityGroup, getSecurityGroupResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); SecurityGroup group = extension.getSecurityGroupById(zone + "/160"); assertEquals(group.getId(), "160"); }
Source:
<code><START> catch (NoSuchMethodException e) { <END> mtd = null; }</code><technical_language>remove this catch, throw a exception explaining problem. I continue execution in this case</technical_language>

Target:
catch (NoSuchMethodException e) { throw new ExceptionInInitializerError("'invokeMethod' is not defined in " + PlatformService.class.getName()); }
Source:
<code>private void init() { initializationTime = System.currentTimeMillis(); statsDClient = new NonBlockingStatsDClient( null, this.statsdHost, this.statsdPort, Integer.MAX_VALUE, new String[] {}, new LoggingErrorHandler(), "none"); <START> } <END></code><technical_language>reference note: Integer.MAX_VALUE is default queue length, this *NOT* change behavior</technical_language>

Target:
private void init() { initializationTime = System.currentTimeMillis(); String entityID = this.statsdPort == 0 ? "none" : null; statsDClient = new NonBlockingStatsDClient( null, this.statsdHost, this.statsdPort, Integer.MAX_VALUE, new String[] {}, new LoggingErrorHandler(), entityID); }
Source:
<code>public void execute() { final int initialNotificationResend = 1; final List<ResponseData> notificationsToResend = this.responseDataRepository .findByNumberOfNotificationsSentLessThan(this.resendNotificationMaximum); for (final ResponseData responseData : notificationsToResend) { final int multiplier = (int) Math.pow(this.resendNotificationMultiplier, responseData.getNumberOfNotificationsSent()); <START> final Date currentDate = new Date(); <END> final long previousModificationTimeInterval = currentDate.getTime() - responseData.getModificationTime().getTime(); final long creationTimeInterval = currentDate.getTime() - responseData.getCreationTime().getTime(); if (TimeUnit.MINUTES.toMillis(this.resendThresholdInHours) < creationTimeInterval) { if (multiplier == initialNotificationResend) { this.resendNotification(responseData); } else if ((TimeUnit.HOURS.toMillis(this.resendThresholdInHours) * multiplier) < previousModificationTimeInterval) { this.resendNotification(responseData); } } } }</code><technical_language>Refactor increase readability: - create private method determine next notification time for response data compare this current time in order determine if a notification</technical_language>

Target:
public void execute() { final long[] resendDelays = this.calculateResendDelays(this.resendNotificationMaximum); for (int notificationsResent = this.resendNotificationMaximum - 1; notificationsResent > -1; notificationsResent--) { final long delay = resendDelays[notificationsResent]; final DateTime createdBefore = DateTime.now(DateTimeZone.UTC).minus(delay); this.resendNotifications((short) notificationsResent, createdBefore); } }
Source:
<code>protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerEndpoint.class); at("/r/aps").serve(AccessPointEndpoint.class); at("/r/operators").serve(OperatorEndpoint.class); at("/r/roaming-groups").serve(RoamingGroupEndpoint.class); at("/r/venues").serve(VenueEndpoint.class); at("/r/ip-types").serve(IpTypeService.class); at("/r/auth-types").serve(AuthTypeEndpoint.class); at("/r/service-providers").serve(ServiceProviderEndpoint.class); <START> at("/r/nai-realm").serve(NaiRealmEndpoint.class); <END> } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }</code><technical_language>plural form for REST</technical_language>

Target:
protected void configure() { Multibinder<ServicePlugin> plugins = Multibinder.newSetBinder(binder(), ServicePlugin.class); plugins.addBinding().toInstance(Plugins.of(new HttpBackend(port))); bind(ObjectValidator.class).to(ApacheObjectValidator.class).in(Singleton.class); install(new ServletModule() { @Override protected void configureServlets() { bind(TestServlet.class).in(Singleton.class); serve("/test").with(TestServlet.class); } }); install(new SitebricksModule() { @Override protected void configureSitebricks() { at("/testservice").serve(ExampleService.class); at("/r/controllers").serve(ApControllerEndpoint.class); at("/r/aps").serve(AccessPointEndpoint.class); at("/r/operators").serve(OperatorEndpoint.class); at("/r/roaming-groups").serve(RoamingGroupEndpoint.class); at("/r/venues").serve(VenueEndpoint.class); at("/r/ip-types").serve(IpTypeService.class); at("/r/auth-types").serve(AuthTypeEndpoint.class); at("/r/service-providers").serve(ServiceProviderEndpoint.class); at("/r/capabilities").serve(CapabilityEndpoint.class); at("/r/nai-realms").serve(NaiRealmEndpoint.class); } }); bindInterceptor(annotatedWith(Service.class), returns(only(Reply.class)), new HttpRequestErrorReporter("Internal Server Error")); }
Source:
<code>public synchronized void commit() throws SQLException { <START> if (activeConnection != null && activeConnection.isValid(5)) { <END> activeConnection.commit(); } else { logger.debug("Connection to MySql DB is not available"); } }</code><technical_language>I connection null commit rollback is called</technical_language>

Target:
public synchronized void commit() throws SQLException { activeConnection.commit(); }
Source:
<code>public String getWorkingDirectory(CommandLine cl) { String[] args = cl.getArgs(); String baseDirPath = args[1]; String workingDirPath = Paths.get(baseDirPath, this.getCommandName()).toString(); LOG.debug("Command %s works in %s", this.getCommandName(), workingDirPath); File workingDir = new File(workingDirPath); if (!workingDir.exists()) { <START> System.out.format("Working path %s does not exist. mkdir first%n", workingDirPath); <END> workingDir.mkdirs(); } return workingDirPath; }</code><technical_language>This message sound user run mkdir. Instead, this say: "Creating working directory: %s %n" sounds command is creating directory</technical_language>

Target:
public String getWorkingDirectory(CommandLine cl) { String[] args = cl.getArgs(); String baseDirPath = args[1]; String workingDirPath = Paths.get(baseDirPath, this.getCommandName()).toString(); LOG.debug("Command %s works in %s", this.getCommandName(), workingDirPath); File workingDir = new File(workingDirPath); if (!workingDir.exists()) { System.out.format("Creating working directory: %s%n", workingDirPath); workingDir.mkdirs(); } return workingDirPath; }
Source:
<code>public void activate(Context context) { for (String s : lookupFields) { lookupFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getLookupFieldType(s)))); } if (includeFields != null) { for (String s : includeFields) { includeFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getIncludeFieldType(s)))); } } store.setFieldInfo(lookupFieldInfo, includeFieldInfo); try { cacheManager.initialize(); } catch (IOException e) { <START> throw new RuntimeException("Unable to initialize cache store", e); <END> } }</code><technical_language>cache store initialization failure, backup fail well, it. this unable initialize cache manager</technical_language>

Target:
public void activate(Context context) { for (String s : lookupFields) { lookupFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getLookupFieldType(s)))); } if (includeFields != null) { for (String s : includeFields) { includeFieldInfo.add(new FieldInfo(s, s, SupportType.getFromJavaType(getIncludeFieldType(s)))); } } store.setFieldInfo(lookupFieldInfo, includeFieldInfo); try { cacheManager.initialize(); } catch (IOException e) { throw new RuntimeException("Unable to initialize cache manager", e); } }
Source:
<code>public void emptyClassNotEmptyMethodEmptyRule() throws IOException { <START> final ExcludesXml xml = new ExcludesXml(":toString"); <END> xml.assertXpath("count( xml.assertXpath("count( final ExcludesXml same = new ExcludesXml(":toString:"); same.assertXpath("count( same.assertXpath("count( }</code><technical_language>@ilyakharlamov Create class constants repeated strings remove PMD.AvoidDuplicateLiterals supression</technical_language>

Target:
public void emptyClassNotEmptyMethodEmptyRule() throws Exception { final Document xml = new FindBugsExcludes( new Environment.Mock().withExcludes(":equals:") ).asXml(); MatcherAssert.assertThat( xml, Matchers.allOf( new HasXPath( FindBugsExcludesTest.COUNT_MATCH, new IsEqual<>("1") ), new HasXPath( "count( new IsEqual<>("1") ) ) ); }
Source:
<code><START> public Iterable<AccountGroup.UUID> getAllOwners() { <END> Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); Iterable<ProjectState> tree = tree(); for (ProjectState p : tree) { result.addAll(p.localOwners); } return result; }</code><technical_language>I a reason return Iterable instead of more specific return type Set. result is small a lazy evaluation is necessary (which justify returning Iterable). Returning Iterable instead of a more specific type unnecessarily limits caller do return result</technical_language>

Target:
public Set<AccountGroup.UUID> getAllOwners() { Set<AccountGroup.UUID> result = new HashSet<AccountGroup.UUID>(); for (ProjectState p : tree()) { result.addAll(p.localOwners); } return result; }
Source:
<code>public KeyPairCredential clone() { <START> return this; <END> }</code><technical_language>Key interfaces extend Destroyable, meaning key pairs cloned too... somehow</technical_language>

Target:
public KeyPairCredential clone() { final PrivateKey privateKey = keyPair.getPrivate(); final PrivateKey clone = KeyUtil.cloneKey(PrivateKey.class, privateKey); return privateKey == clone ? this : new KeyPairCredential(new KeyPair(keyPair.getPublic(), clone)); }
Source:
<code>public static void GET_REPLICATION_PROGRESS(ResultSet[] resultSets) throws StandardException, SQLException { ReplicationManager replicationManager = EngineDriver.driver().manager().getReplicationManager(); long ts = replicationManager.getReplicationProgress(); if (ts > 0) { DateTime dateTime = new DateTime(ts); resultSets[0] = ProcedureUtils.generateResult( "Replication progress", dateTime.toString()); } else { <START> resultSets[0] = ProcedureUtils.generateResult("Error", "Information for available"); <END> } }</code><technical_language>typo in result string, I guess "Information available"</technical_language>

Target:
public static void GET_REPLICATION_PROGRESS(ResultSet[] resultSets) throws StandardException, SQLException { ReplicationManager replicationManager = EngineDriver.driver().manager().getReplicationManager(); long ts = replicationManager.getReplicationProgress(); if (ts > 0) { DateTime dateTime = new DateTime(ts); resultSets[0] = ProcedureUtils.generateResult( "Replication progress", dateTime.toString()); } else { resultSets[0] = ProcedureUtils.generateResult("Error", "Information not available"); } }
Source:
<code>public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options) { try { validateAccountType(account.type); validateAuthTokenType(authTokenType); } catch (AuthenticatorException e) { Timber.e(e, "Failed to validate account type %s", account.type); return e.getFailureBundle(); } String accessToken = ""; <START> final AccountManager accountManager = AccountManager.get(mContext); <END> if (authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.Companion.getAccountType()))) { accessToken = accountManager.getPassword(account); } else { accessToken = accountManager.peekAuthToken(account, authTokenType); if (accessToken == null && canBeRefreshed(authTokenType)) { refreshToken(account, authTokenType, accountManager, accountAuthenticatorResponse); return null; } } if (accessToken != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.Companion.getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); return result; } final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, accountAuthenticatorResponse); intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); intent.putExtra(KEY_LOGIN_OPTIONS, options); intent.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, account); intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_EXPIRED_TOKEN); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }</code><technical_language>naming is welcome</technical_language>

Target:
public Bundle getAuthToken(AccountAuthenticatorResponse accountAuthenticatorResponse, Account account, String authTokenType, Bundle options) { try { validateAccountType(account.type); validateAuthTokenType(authTokenType); } catch (AuthenticatorException e) { Timber.e(e, "Failed to validate account type %s", account.type); return e.getFailureBundle(); } String accessToken; final AccountManager accountManager = AccountManager.get(mContext); if (authTokenType.equals(AccountTypeUtils.getAuthTokenTypePass(MainApp.Companion.getAccountType()))) { accessToken = accountManager.getPassword(account); } else { accessToken = accountManager.peekAuthToken(account, authTokenType); if (accessToken == null && canBeRefreshed(authTokenType)) { refreshToken(accountAuthenticatorResponse, account, authTokenType, accountManager, options); return null; } } if (accessToken != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.Companion.getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); return result; } return prepareBundleToAccessAuthenticatorActivity(accountAuthenticatorResponse, account, authTokenType, options); }
Source:
<code>public Set<StandardDrive> apply(HttpResponse response) { String text = returnStringIf200.apply(response); <START> if (text == null || text.trim().equals("")) <END> return ImmutableSet.<StandardDrive> of(); return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToStandardDrive)); }</code><technical_language>out of curiosity, this expected return a non-empty string of spaces? {...} if</technical_language>

Target:
public Set<StandardDrive> apply(HttpResponse response) { String text = nullToEmpty(returnStringIf2xx.apply(response)); if (text.trim().equals("")) { return ImmutableSet.<StandardDrive> of(); } return ImmutableSet.copyOf(Iterables.transform(mapConverter.apply(text), mapToStandardDrive)); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(event); RepositoryTreeNode node = nodes.get(0); WizardDialog wizardDialog = null; try { switch (node.getType()) { case REF: Ref ref = (Ref) node.getObject(); wizardDialog = new PushBranchDialog(getShell(event), new PushBranchWizard(node.getRepository(), ref)); break; case TAG: wizardDialog = new WizardDialog(getShell(event), createPushTagsWizard(nodes)); break; case REPO: wizardDialog = new WizardDialog(getShell(event), new PushWizard(node.getRepository())); break; default: throw new UnsupportedOperationException("type not supported!"); } } catch (URISyntaxException e1) { Activator.handleError(e1.getMessage(), e1, true); return null; } <START> wizardDialog.setHelpAvailable(true); <END> wizardDialog.open(); return null; }</code><technical_language>REPO case available. This leaves non-functional buttons in REF TAG cases</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { List<RepositoryTreeNode> nodes = getSelectedNodes(event); RepositoryTreeNode node = nodes.get(0); IWizard pushWiz = null; try { switch (node.getType()) { case REF: Ref ref = (Ref) node.getObject(); pushWiz = new PushBranchWizard(node.getRepository(), ref); break; case TAG: pushWiz = createPushTagsWizard(nodes); break; case REPO: pushWiz = new PushWizard(node.getRepository()); break; default: throw new UnsupportedOperationException("type not supported!"); } } catch (URISyntaxException e1) { Activator.handleError(e1.getMessage(), e1, true); return null; } WizardDialog dlg = new PushBranchDialog(getShell(event), pushWiz); dlg.setHelpAvailable(pushWiz.isHelpAvailable()); dlg.open(); return null; }
Source:
<code>public ExtendManagedBlockStorageDiskSizeParameters() { <START> super(); <END> }</code><technical_language>Do need this? implicit</technical_language>

Target:
public ExtendManagedBlockStorageDiskSizeParameters() { }
Source:
<code>public void search_shouldSearchForDiagnosesFromSpecifiedDiagnosisConceptSources() throws Exception { <START> controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, null, "ICRC,ICD-10-WHO", null, null); <END> verify(emrApiProperties, never()).getConceptSourcesForDiagnosisSearch(); }</code><technical_language>"CIEL,ICD-10-WHO"</technical_language>

Target:
public void search_shouldSearchForDiagnosesFromSpecifiedDiagnosisConceptSources() throws Exception { controller.search(context, uiUtils, emrApiProperties, emrConceptService, conceptService, queryString, null, "CIEL,ICD-10-WHO", null, null); verify(emrApiProperties, never()).getConceptSourcesForDiagnosisSearch(); }
Source:
<code>public String toString() { final StringBuilder sb = new StringBuilder(super.toString()); sb.append("AbfsInputStream@(").append(this.hashCode()).append("){"); <START> sb.append(streamStatistics.toString()); <END> sb.append("}"); return sb.toString(); }</code><technical_language>needs check for stats == null</technical_language>

Target:
public String toString() { final StringBuilder sb = new StringBuilder(super.toString()); if (streamStatistics != null) { sb.append("AbfsInputStream@(").append(this.hashCode()).append("){"); sb.append(streamStatistics.toString()); sb.append("}"); } return sb.toString(); }
Source:
<code>public byte[] getDataFromService(String service) { byte[] responseBodyB64 = null; int maxNbrGets = 3; int statusCode = 0; if (client == null) { client = new HttpClient(); } synchronized (client) { GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { for (int i = 0; i < maxNbrGets && statusCode != HttpStatus.SC_OK; i++) { statusCode = client.executeMethod(method); if (statusCode != HttpStatus.SC_OK) { String statusLine = method.getStatusLine().toString(); <START> if (statusLine.contains(" 500 ")) { <END> logger.warn("HTTP GET failed mit error 500, try Again"); Thread.sleep(2000L); continue; } else if (statusLine.contains(" 403 ")) { byte[] test = new byte[1]; return test; } else { logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e); e.printStackTrace(); } catch (InterruptedException e) { logger.error("Sleep was interrupted: {}", e); e.printStackTrace(); } catch (IOException e) { logger.error("Fatal transport error: {}", e); e.printStackTrace(); } finally { method.releaseConnection(); } return responseBodyB64; } }</code><technical_language>Please correct method for HTTP response status code</technical_language>

Target:
public byte[] getDataFromService(String service) { byte[] responseBodyB64 = null; int maxNbrGets = 3; int statusCode = 0; if (client == null) { client = new HttpClient(); } synchronized (client) { GetMethod method = new GetMethod("http://" + device.getIP4Address() + service); method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3, false)); method.setRequestHeader("Accept", "application/json"); method.addRequestHeader("User-Agent", "TeleHeater/2.2.3"); try { for (int i = 0; i < maxNbrGets && statusCode != HttpStatus.SC_OK; i++) { statusCode = client.executeMethod(method); switch (statusCode) { case HttpStatus.SC_OK: break; case HttpStatus.SC_INTERNAL_SERVER_ERROR: logger.warn("HTTP GET failed: 500, internal server error, repeating.. "); Thread.sleep(2000L); continue; case HttpStatus.SC_FORBIDDEN: byte[] test = new byte[1]; return test; default: logger.error("HTTP GET failed: {}", method.getStatusLine()); return null; } } device.setCharSet(method.getResponseCharSet()); responseBodyB64 = ByteStreams.toByteArray(method.getResponseBodyAsStream()); } catch (HttpException e) { logger.error("Fatal protocol violation: {}", e.getMessage()); } catch (InterruptedException e) { logger.error("Sleep was interrupted: {}", e.getMessage()); } catch (IOException e) { logger.error("Fatal transport error: {}", e.getMessage()); } finally { method.releaseConnection(); } return responseBodyB64; } }
Source:
<code>public PartitionQC get(Run run, Partition partition) throws IOException { <START> authorizationManager.throwIfNotReadable(run); <END> return partitionQcDao.get(run, partition); }</code><technical_language>Auth check managed run retrieved PartitionQC instead</technical_language>

Target:
public PartitionQC get(Run run, Partition partition) throws IOException { Run managedRun = runService.get(run.getId()); authorizationManager.throwIfNotReadable(managedRun); return partitionQcDao.get(managedRun, partition); }
Source:
<code>public AccountBuilder(Account origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } this.id = origin.getId(); this.name = origin.getName(); this.status = origin.getStatus(); for (Container container : origin.getAllContainers()) { idToContainerMetadataMap.put(container.getId(), container); } <START> this.version = ACCOUNT_METADATA_VERSION_1; <END> }</code><technical_language>about. Incase introduce a new version for Account in future, this code like. Some fields in V2 in V1. Do dummy values for</technical_language>

Target:
public AccountBuilder(Account origin) { if (origin == null) { throw new IllegalArgumentException("origin cannot be null."); } id = origin.getId(); name = origin.getName(); status = origin.getStatus(); for (Container container : origin.getAllContainers()) { idToContainerMetadataMap.put(container.getId(), container); } }
Source:
<code>public Object create(String type, ApiRequest request, ResourceManager next) { Credential credential = request.proxyRequestObject(Credential.class); if (StringUtils.isBlank(credential.getKind())) { credential.setKind(request.getType()); } <START> LocalAuthPasswordValidator.validatePassword(credential.getSecretValue(), jsonMapper); <END> boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } return super.create(type, request, next); }</code><technical_language>This class called for credential types restrict checking password kind is io.cattle.platform.core.constants.CredentialConstants.KIND_PASSWORD. Additonally need call TransformationService hash cleartext set credential.setSecretValue(...)</technical_language>

Target:
public Object create(String type, ApiRequest request, ResourceManager next) { Credential credential = request.proxyRequestObject(Credential.class); if (StringUtils.isBlank(credential.getKind())) { credential.setKind(request.getType()); } if (StringUtils.equals(credential.getKind(), CredentialConstants.KIND_PASSWORD)) { LocalAuthPasswordValidator.validatePassword(credential.getSecretValue(), jsonMapper); String clearSecret = credential.getSecretValue(); credential.setSecretValue(ApiContext.getContext().getTransformationService().transform(clearSecret, "HASH")); boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } credential = (Credential) super.create(type, request, next); credential.setSecretValue(clearSecret); return credential; } boolean isUnique = passwordDao.isUnique(credential); if (!isUnique) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, CredentialConstants.PUBLIC_VALUE); } return super.create(type, request, next); }
Source:
<code>private void processIndexSegmentEntriesBackward(IndexSegment indexSegment, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) throws StoreException { <START> logger.trace("Processing index entries backward by IndexScanner for segment " + indexSegment); <END> List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.containerForecastStartTimeMs, deletedKeys); processEntriesForContainerBucket(newScanResults, validIndexEntries, deletedKeys); validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.logSegmentForecastStartTimeMs, deletedKeys); processEntriesForLogSegmentBucket(newScanResults, validIndexEntries, deletedKeys); }</code><technical_language>formatting</technical_language>

Target:
private void processIndexSegmentEntriesBackward(IndexSegment indexSegment, List<IndexEntry> indexEntries, Map<StoreKey, Long> deletedKeys) throws StoreException { logger.trace("Processing index entries backward by IndexScanner for segment {}", indexSegment); List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.containerForecastStartTimeMs, deletedKeys); processEntriesForContainerBucket(newScanResults, validIndexEntries, deletedKeys); validIndexEntries = getValidIndexEntries(indexSegment, indexEntries, newScanResults.logSegmentForecastStartTimeMs, deletedKeys); processEntriesForLogSegmentBucket(newScanResults, validIndexEntries, deletedKeys); }
Source:
<code>public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issuesCount = getElementsList().size(); closedIssuesCount = getClosedIssuesCount(); openIssuesCount = issuesCount - closedIssuesCount; updateFooter(); <START> listView.restoreSelection(); <END> this.setId(IdGenerator.getPanelId(panelIndex)); }</code><technical_language>relative order of this updateFooter matter? Feels shouldn't</technical_language>

Target:
public final void refreshItems() { final HashSet<Integer> issuesWithNewComments = updateIssueCommentCounts(Qualifier.hasUpdatedQualifier(getCurrentFilterExpression())); listView.setCellFactory(list -> new ListPanelCell(this, panelIndex, issuesWithNewComments)); listView.saveSelection(); listView.setItems(null); listView.setItems(getElementsList()); issuesCount = getElementsList().size(); closedIssuesCount = getClosedIssuesCount(); openIssuesCount = issuesCount - closedIssuesCount; listView.restoreSelection(); this.setId(IdGenerator.getPanelId(panelIndex)); updateFooter(); }
Source:
<code>ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { if (!mIsActive) { throw new IllegalStateException("Camera is not active. Please bind use cases first."); } if (percentage > 1.0f || percentage < 0f) { Log.d(TAG, "invalid zoomPercentage: not in [0..1] range"); } percentage = rangeLimit(percentage, 1.0f, 0f); float ratio = getRatioByPercentage(percentage); <START> setLiveDataValue(mZoomPercentageLiveData, percentage); <END> return setZoomRatioInternal(ratio, false); }</code><technical_language>this done setZoomRatioInternal function. If be, boolean parameter of setZoomRatioInternal function removed</technical_language>

Target:
ListenableFuture<Void> setZoomPercentage(@FloatRange(from = 0f, to = 1f) float percentage) { synchronized (mActiveLock) { if (!mIsActive) { throw new IllegalStateException( "Camera is not active."); } if (percentage > 1.0f || percentage < 0f) { Log.d(TAG, "invalid zoomPercentage: not in [0..1] range"); } percentage = rangeLimit(percentage, 1.0f, 0f); if (getMaxDigitalZoom() == MIN_ZOOM) { percentage = 0.0f; } float ratio = getRatioByPercentage(percentage); setLiveDataValue(mZoomPercentageLiveData, percentage); return setZoomRatioInternal(ratio, false); } }
Source:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { <END> if (getActionBar() != null) { getActionBar().setDisplayHomeAsUpEnabled(true); } } }</code><technical_language>check for >= ICS instead</technical_language>

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { getActionBar().setDisplayHomeAsUpEnabled(true); } }
Source:
<code>public void generateTestData() { Random rand = new Random(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 40; i++) { Person person = getRandomPerson(rand); try { docs.add(new CosmosItemProperties(mapper.writeValueAsString(person))); } catch (JsonProcessingException e) { <START> e.printStackTrace(); <END> } } }</code><technical_language>logger please</technical_language>

Target:
public void generateTestData() { Random rand = new Random(); ObjectMapper mapper = new ObjectMapper(); for (int i = 0; i < 40; i++) { Person person = getRandomPerson(rand); try { docs.add(new CosmosItemProperties(mapper.writeValueAsString(person))); } catch (JsonProcessingException e) { logger.error(e.getMessage()); } } String resourceJson = String.format("{ " + "\"id\": \"%s\", \"intprop\": %d }", UUID.randomUUID().toString(), 5); String resourceJson2 = String.format("{ " + "\"id\": \"%s\", \"intprop\": %f }", UUID.randomUUID().toString(), 5.0f); docs.add(new CosmosItemProperties(resourceJson)); docs.add(new CosmosItemProperties(resourceJson2)); }
Source:
<code>public static String determineDomainID(URI uri) { if (URIConverter.INSTANCE.exists(uri, null)) { try { return DomainIDParser.parse(uri); } catch (SAXException e) { <START> return ""; <END> } catch (Exception e) { e.printStackTrace(); } } return BasePackage.Literals.DOMAIN_ELEMENT__DOMAIN_ID.getDefaultValueLiteral(); }</code><technical_language>return generic domain in a case</technical_language>

Target:
public static String determineDomainID(URI uri) { if (URIConverter.INSTANCE.exists(uri, null)) { try { return DomainIDParser.parse(uri); } catch (SAXException e) { return getDefaultDomain(); } catch (Exception e) { e.printStackTrace(); } } return getDefaultDomain(); }