auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GlobalConfigurationBuilder that = (GlobalConfigurationBuilder) o; <START> if (evictionThreadPool != null ? !evictionThreadPool.equals(that.evictionThreadPool) : that.evictionThreadPool != null) <END> return false; if (listenerThreadPool != null ? !listenerThreadPool.equals(that.listenerThreadPool) : that.listenerThreadPool != null) return false; if (replicationQueueThreadPool != null ? !replicationQueueThreadPool.equals(that.replicationQueueThreadPool) : that.replicationQueueThreadPool != null) return false; if (persistenceThreadPool != null ? !persistenceThreadPool.equals(that.persistenceThreadPool) : that.persistenceThreadPool != null) return false; if (cl != null ? !cl.equals(that.cl) : that.cl != null) return false; if (globalJmxStatistics != null ? !globalJmxStatistics.equals(that.globalJmxStatistics) : that.globalJmxStatistics != null) return false; if (serialization != null ? !serialization.equals(that.serialization) : that.serialization != null) return false; if (shutdown != null ? !shutdown.equals(that.shutdown) : that.shutdown != null) return false; if (site != null ? !site.equals(that.site) : that.site != null) return false; if (security != null ? !security.equals(that.security) : that.security != null) return false; return transport != null ? !transport.equals(that.transport) : that.transport != null; }</code><technical_language>in equals() hashCode(), sense check if fields non-null final non-null :)</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GlobalConfigurationBuilder that = (GlobalConfigurationBuilder) o; if (!evictionThreadPool.equals(that.evictionThreadPool)) return false; if (!listenerThreadPool.equals(that.listenerThreadPool)) return false; if (!replicationQueueThreadPool.equals(that.replicationQueueThreadPool)) return false; if (!persistenceThreadPool.equals(that.persistenceThreadPool)) return false; if (cl != null ? !cl.equals(that.cl) : that.cl != null) return false; if (!globalJmxStatistics.equals(that.globalJmxStatistics)) return false; if (!serialization.equals(that.serialization)) return false; if (!shutdown.equals(that.shutdown)) return false; if (!site.equals(that.site)) return false; if (!security.equals(that.security)) return false; return !transport.equals(that.transport); }
Source:
<code>public synchronized Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Input input = AnnotationUtils.findAnnotation(method, Input.class); if (input != null) { <START> String name = BindingBeanDefinitionRegistryUtils.getChannelName(input, method); <END> return this.inputHolders.get(name).getBoundElement(); } else { Output output = AnnotationUtils.findAnnotation(method, Output.class); if (output != null) { String name = BindingBeanDefinitionRegistryUtils.getChannelName(output, method); return this.outputHolders.get(name).getBoundElement(); } } return null; }</code><technical_language>rename BindingBeanDefinitionRegistryUtils.getChannelName(..)</technical_language>

Target:
public synchronized Object invoke(MethodInvocation invocation) throws Throwable { Method method = invocation.getMethod(); Input input = AnnotationUtils.findAnnotation(method, Input.class); if (input != null) { String name = BindingBeanDefinitionRegistryUtils.getBindingTargetName(input, method); return this.inputHolders.get(name).getBoundTarget(); } else { Output output = AnnotationUtils.findAnnotation(method, Output.class); if (output != null) { String name = BindingBeanDefinitionRegistryUtils.getBindingTargetName(output, method); return this.outputHolders.get(name).getBoundTarget(); } } return null; }
Source:
<code>byte testByte() default (byte) 1; short testShort() default 2; int testInt() default 3; long testLong() default 4L; float testFloat() default 5.6f; double testDouble() default 7.8d; char testChar() default 'a'; String testString() default "10"; boolean testBoolean() default false; Class testClass() default TestEnum.class; <START> TestEnum testEnum() default TestEnum.A; <END> } public static @interface TestAnnotationArray { byte[] testBytes() default {(byte) 1, (byte) 2}; short[] testShorts() default {3, 4}; int[] testInts() default {5, 6}; long[] testLongs() default {7L, 8L}; float[] testFloats() default {9.1f, 2.3f}; double[] testDoubles() default {4.5d, 6.7d}; char[] testChars() default {'a', 'b'}; String[] testStrings() default {"cde", "fgh"}; boolean[] testBooleans() default {true, false}; Class[] testClasses() default {TestEnum.class, TestEnum.class}; TestEnum[] testEnums() default {TestEnum.A, TestEnum.B}; }</code><technical_language>Thanks for a test! is more case cover if want exhaustive: OtherAnnotation testAnnotation() default @OtherAnnotation(foo = 23, bar = "baz"); for arrays of course</technical_language>

Target:
byte testByte() default (byte) 1; short testShort() default 2; int testInt() default 3; long testLong() default 4L; float testFloat() default 5.6f; double testDouble() default 7.8d; char testChar() default 'a'; String testString() default "10"; boolean testBoolean() default false; Class<?> testClass() default TestEnum.class; TestEnum testEnum() default TestEnum.A; OtherAnnotation testAnnotation() default @OtherAnnotation(foo = 23, bar = "baz"); } public static @interface OtherAnnotation { int foo() default 123; String bar() default "bar"; }
Source:
<code>public void serverStarting(FMLServerStartingEvent evt) { new ForgeCommand(evt.getCommandDispatcher()); ConfigCommand.register(evt.getCommandDispatcher()); <START> evt.getServer().getResourceManager().addReloadListener(new ReloadListener<Object>() <END> { @Override protected Object prepare(IResourceManager resourceManagerIn, IProfiler profilerIn) { return null; } @Override protected void apply(Object splashList, IResourceManager resourceManagerIn, IProfiler profilerIn) { ForgeHooks.updateBurns(); } }); }</code><technical_language>is this needed if get reload event</technical_language>

Target:
public void serverStarting(FMLServerStartingEvent evt) { new ForgeCommand(evt.getCommandDispatcher()); ConfigCommand.register(evt.getCommandDispatcher()); }
Source:
<code>public void initialise() { <START> addDesiredStateChange(new EnableShader("engine:prog.hdr")); <END> addDesiredStateChange(new BindFBO("sceneToneMapped")); addDesiredStateChange(new SetViewportSizeOf("sceneToneMapped")); addDesiredStateChange(new Clear(true, true, false)); }</code><technical_language>rename this EnableMaterial. A material is shader + configuration parameters</technical_language>

Target:
public void initialise() { requiresFBO(new FBOConfig(TONE_MAPPED, FULL_SCALE, FBO.Type.HDR), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(TONE_MAPPED, displayResolutionDependentFBOs)); addDesiredStateChange(new EnableMaterial("engine:prog.hdr")); addDesiredStateChange(new SetViewportToSizeOf(TONE_MAPPED, displayResolutionDependentFBOs)); }
Source:
<code>private List<String> parseGMLResultsForFeatureIDs(String file) { List<String> results = new ArrayList<String>(); ReachOverlayIdentifierParser roiParser; try { roiParser = new ReachOverlayIdentifierParser(); } catch (Exception e) { log.error("Unable to create GML SAX parser for model [" + modelBBox.getModelId() + "]. Exception: [" + e.getMessage() + "]"); <START> return results; <END> } try { results.addAll(roiParser.parseReachOverlayIdentifierSource(file)); } catch (SAXException e) { log.error("Unable to parse GeoServer response for [" + modelBBox.getModelId() + "]. SAXException: [" + e.getMessage() + "]"); e.printStackTrace(); } catch (IOException e) { log.error("Unable to parse GeoServer response for [" + modelBBox.getModelId() + "]. IOException: [" + e.getMessage() + "]"); e.printStackTrace(); } return results; }</code><technical_language>error issue. fail return a partial list</technical_language>

Target:
private List<String> parseGMLResultsForFeatureIDs(String file) throws SAXException, IOException, ParserConfigurationException { List<String> results = new ArrayList<String>(); ReachOverlayIdentifierParser roiParser = new ReachOverlayIdentifierParser(); results.addAll(roiParser.parseReachOverlayIdentifierSource(file)); return results; }
Source:
<code>private void export(SpanData span, List<TelemetryItem> telemetryItems) { Span.Kind kind = span.getKind(); String instrumentationName = span.getInstrumentationLibraryInfo().getName(); Matcher matcher = COMPONENT_PATTERN.matcher(instrumentationName); String stdComponent = matcher.matches() ? matcher.group(1) : null; if ("jms".equals(stdComponent) && !span.getParentSpanId().isValid() && kind == Span.Kind.CLIENT) { return; } if (kind == Span.Kind.INTERNAL) { <START> if (span.getName().equals("log.message")) { exportLogSpan(span, telemetryItems); <END> } else if (!span.getParentSpanId().isValid()) { exportRequest(stdComponent, span, telemetryItems); } else if (span.getName().equals("EventHubs.message")) { exportRemoteDependency(stdComponent, span, false, telemetryItems); } else { exportRemoteDependency(stdComponent, span, true, telemetryItems); } } else if (kind == Span.Kind.CLIENT || kind == Span.Kind.PRODUCER) { exportRemoteDependency(stdComponent, span, false, telemetryItems); } else if (kind == Span.Kind.SERVER || kind == Span.Kind.CONSUMER) { exportRequest(stdComponent, span, telemetryItems); } else { throw new UnsupportedOperationException(kind.name()); } }</code><technical_language>(not required for beta.1) need log handling, this is hack transport logs spans, official OpenTelemetry (which support Logs separately in future)</technical_language>

Target:
private void export(SpanData span, List<TelemetryItem> telemetryItems) { Span.Kind kind = span.getKind(); String instrumentationName = span.getInstrumentationLibraryInfo().getName(); Matcher matcher = COMPONENT_PATTERN.matcher(instrumentationName); String stdComponent = matcher.matches() ? matcher.group(1) : null; if ("jms".equals(stdComponent) && !span.getParentSpanId().isValid() && kind == Span.Kind.CLIENT) { return; } if (kind == Span.Kind.INTERNAL) { if (!span.getParentSpanId().isValid()) { exportRequest(stdComponent, span, telemetryItems); } else if (span.getName().equals("EventHubs.message")) { exportRemoteDependency(stdComponent, span, false, telemetryItems); } else { exportRemoteDependency(stdComponent, span, true, telemetryItems); } } else if (kind == Span.Kind.CLIENT || kind == Span.Kind.PRODUCER) { exportRemoteDependency(stdComponent, span, false, telemetryItems); } else if (kind == Span.Kind.SERVER || kind == Span.Kind.CONSUMER) { exportRequest(stdComponent, span, telemetryItems); } else { throw new UnsupportedOperationException(kind.name()); } }
Source:
<code>protected String sanitizedUrl(String url) { return super.sanitizedUrl(url) <START> .replaceAll("(?i)(;password=)[^;]*", "$1****"); <END> }</code><technical_language>"(?i)([:;]password=)[^;]*" in case put password (right colon) "jdbc:db2://sysmvs1.stl.ibm.com:5021/STLEC1:password=dbadm;user=dbadm;"</technical_language>

Target:
protected String sanitizedUrl(String url) { return super.sanitizedUrl(url) .replaceAll("(?i)([:;]password=)[^;]*", "$1****"); }
Source:
<code>private static SubtaskCheckpointCoordinator coordinator(boolean unalignedCheckpointEnabled, ChannelStateWriter channelStateWriter) throws IOException { return new SubtaskCheckpointCoordinatorImpl( <START> checkpointStorageWorkerView(100), <END> "test", StreamTaskActionExecutor.IMMEDIATE, new CloseableRegistry(), newDirectExecutorService(), new DummyEnvironment(), (message, unused) -> fail(message), unalignedCheckpointEnabled, (unused1, unused2) -> CompletableFuture.completedFuture(null), 0, channelStateWriter ); }</code><technical_language>nit: new TestCheckpointStorageWorkerView(100) for simple</technical_language>

Target:
private static SubtaskCheckpointCoordinator coordinator(boolean unalignedCheckpointEnabled, ChannelStateWriter channelStateWriter) throws IOException { return new SubtaskCheckpointCoordinatorImpl( new TestCheckpointStorageWorkerView(100), "test", StreamTaskActionExecutor.IMMEDIATE, new CloseableRegistry(), newDirectExecutorService(), new DummyEnvironment(), (message, unused) -> fail(message), unalignedCheckpointEnabled, (unused1, unused2) -> CompletableFuture.completedFuture(null), 0, channelStateWriter ); }
Source:
<code>void onExitForeground(final long timestamp) { runOnLogThread(new Runnable() { @Override public void run() { if (Utils.isEmptyString(apiKey)) { return; } refreshSessionTime(timestamp); inForeground = false; if (flushEventsOnClose) { updateServer(); } dbHelper.insertOrReplaceKeyValue(DEVICE_ID_KEY, deviceId); dbHelper.insertOrReplaceKeyValue(USER_ID_KEY, userId); dbHelper.insertOrReplaceKeyLongValue(OPT_OUT_KEY, optOut ? 1L : 0L); <START> dbHelper.insertOrReplaceKeyLongValue(LAST_EVENT_TIME_KEY, lastEventTime); <END> } }); }</code><technical_language>Persist sessionId PREVIOUS_SESSION_ID_KEY other I mentioned above</technical_language>

Target:
void onExitForeground(final long timestamp) { runOnLogThread(new Runnable() { @Override public void run() { if (Utils.isEmptyString(apiKey)) { return; } refreshSessionTime(timestamp); inForeground = false; if (flushEventsOnClose) { updateServer(); } dbHelper.insertOrReplaceKeyValue(DEVICE_ID_KEY, deviceId); dbHelper.insertOrReplaceKeyValue(USER_ID_KEY, userId); dbHelper.insertOrReplaceKeyLongValue(OPT_OUT_KEY, optOut ? 1L : 0L); dbHelper.insertOrReplaceKeyLongValue(PREVIOUS_SESSION_ID_KEY, sessionId); dbHelper.insertOrReplaceKeyLongValue(LAST_EVENT_TIME_KEY, lastEventTime); } }); }
Source:
<code>private void loadProperties() throws IOException { properties = new Properties(); try (InputStream defaultProperties = getClass().getClassLoader().getResourceAsStream("default.properties")) { properties.load(defaultProperties); } String propertiesPath; if (System.getProperty("propFile", "").equals("")) { <START> propertiesPath = "etc/app.properties"; <END> } else { propertiesPath = System.getProperty("propFile"); } try (FileInputStream appProperties = new FileInputStream(propertiesPath)) { properties.load(appProperties); } catch (IOException e) { LOG.debug("No overriding properties found at '" + propertiesPath + "'."); } properties.putAll(System.getProperties()); LOG.info("Loaded app.properties from " + propertiesPath); }</code><technical_language>propertiesPath = "etc/app.properties"; private static final STRING APPLICATION_PROPERTIES = "etc/app.properties"; [...] propertiesPath = APPLICATION_PROPERTIES;</technical_language>

Target:
private void loadProperties() throws IOException { properties = new Properties(); try (InputStream defaultProperties = getClass().getClassLoader().getResourceAsStream("default.properties")) { properties.load(defaultProperties); } String propertiesPath = System.getProperty(SYSTEM_PROPERTY); if (propertiesPath == null) { propertiesPath = DEFAULT_APPLICATION_PROPERTIES_PATH; } try (FileInputStream appProperties = new FileInputStream(propertiesPath)) { properties.load(appProperties); } catch (IOException e) { LOG.debug("No overriding properties found at '" + propertiesPath + "'."); } properties.putAll(System.getProperties()); LOG.info("Loaded app.properties from " + propertiesPath); }
Source:
<code>public static void initialize(Retransformer trans) throws Exception { transformer = trans; URI uri = OpenTracingRuleLoader.class.getResource(ROOT_RULE_FOLDER).toURI(); String s = uri.toString(); int separator = s.indexOf("!/"); String entryName = s.substring(separator + 2); URI fileURI = URI.create(s.substring(0, separator)); List<String> scripts = new ArrayList<>(); List<String> scriptNames = new ArrayList<>(); try (FileSystem fs = FileSystems.newFileSystem(fileURI, Collections.<String, Object>emptyMap())) { Path rules = fs.getPath(entryName); Files.walk(rules).filter(f -> f.toString().endsWith(RULE_FILE_EXTENSION)).forEach(f -> { StringBuilder sb = new StringBuilder(); try (BufferedReader reader = Files.newBufferedReader(f, StandardCharsets.UTF_8)) { String str = null; <START> while ((str = reader.readLine()) != null) { <END> sb.append(str); sb.append("\r\n"); } if (log.isLoggable(Level.FINEST)) { log.finest("Installing rule name=" + f.toString() + " script=" + sb.toString()); } scriptNames.add(f.toString()); scripts.add(sb.toString()); } catch (IOException ioe) { log.log(Level.SEVERE, "Failed to load rule file: " + f.toString(), ioe); } }); } try (PrintWriter writer = new PrintWriter(new StringWriter())) { transformer.installScript(scripts, scriptNames, writer); } if (log.isLoggable(Level.FINE)) { log.fine("Installed rules"); } }</code><technical_language>this need read line line? more compact code byte[] encoded = Files.readAllBytes(Paths.get(path)); return new String(encoded, encoding);</technical_language>

Target:
public static void initialize(Retransformer trans) throws Exception { transformer = trans; URI uri = OpenTracingRuleLoader.class.getResource(ROOT_RULE_FOLDER).toURI(); String s = uri.toString(); int separator = s.indexOf("!/"); String entryName = s.substring(separator + 2); URI fileURI = URI.create(s.substring(0, separator)); List<String> scripts = new ArrayList<>(); List<String> scriptNames = new ArrayList<>(); try (FileSystem fs = FileSystems.newFileSystem(fileURI, Collections.<String, Object>emptyMap())) { Path rules = fs.getPath(entryName); Files.walk(rules).filter(f -> f.toString().endsWith(RULE_FILE_EXTENSION)).forEach(f -> { try { scripts.add(new String(Files.readAllBytes(f))); scriptNames.add(f.toString()); } catch (IOException ioe) { log.log(Level.SEVERE, "Failed to load rule file: " + f.toString(), ioe); } }); } try (PrintWriter writer = new PrintWriter(new StringWriter())) { transformer.installScript(scripts, scriptNames, writer); } if (log.isLoggable(Level.FINE)) { log.fine("Installed rules"); } }
Source:
<code>public void onPreMerge(Repository repo, CodeReviewCommit commit, ProjectState destProject, NameKey destBranch, Id patchSetId) throws MergeValidationException { PatchSetApproval psa = approvalsUtil.getSubmitter(reviewDb.get(), commit.notes(), patchSetId); if (psa == null) { <START> throw new MergeValidationException( CommitMergeStatus.NO_PATCH_SET); <END> } final IdentifiedUser submitter = identifiedUserFactory.create(psa.getAccountId()); if (!submitter.getCapabilities().canAdministrateServer()) { throw new MergeValidationException(CommitMergeStatus.MISSING_DEPENDENCY); } }</code><technical_language>line</technical_language>

Target:
public void onPreMerge(Repository repo, CodeReviewCommit commit, ProjectState destProject, NameKey destBranch, Id patchSetId) throws MergeValidationException { PatchSetApproval psa = approvalsUtil.getSubmitter(reviewDb.get(), commit.notes(), patchSetId); if (psa == null) { throw new MergeValidationException(CommitMergeStatus.NO_PATCH_SET); } IdentifiedUser submitter = identifiedUserFactory.create(psa.getAccountId()); if (!submitter.getCapabilities().canAdministrateServer()) { throw new MergeValidationException(CommitMergeStatus.MISSING_DEPENDENCY); } }
Source:
<code>public void testConnectAnnotationsStringIncomplete() { <START> dispoItem.getDiscrepanciesList().values(); <END> for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 9); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 2) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 2]); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_InComplete, actual); }</code><technical_language>Delete line 120</technical_language>

Target:
public void testConnectAnnotationsStringIncomplete() { for (Discrepancy discrepancy : dispoItem.getDiscrepanciesList().values()) { discrepancy.setLocation(discrepancy.getLocation() + "zzz"); } DispoAnnotationData annotationOne = new DispoAnnotationData(); annotationOne.setLocationRefs("1zzz, 2zzz,12zzz,13zzz,14zzz,15zzz,16zzz,17zzz,18zzz"); annotationOne.setIsResolutionValid(true); annotationOne.setResolutionType("Code"); annotationOne.setId(annotIdOne); List<String> idsOfCoveredDisc = new ArrayList<String>(); annotationOne.setIdsOfCoveredDiscrepancies(idsOfCoveredDisc); dispoConnector.connectAnnotation(annotationOne, dispoItem.getDiscrepanciesList()); List<DispoAnnotationData> annotationsList = new ArrayList<DispoAnnotationData>(); annotationsList.add(annotationOne); dispoItem.setAnnotationsList(annotationsList); List<String> idsOfCoveredDiscrepancies = annotationOne.getIdsOfCoveredDiscrepancies(); Assert.assertTrue(idsOfCoveredDiscrepancies.size() == 9); for (int i = 0; i < idsOfCoveredDiscrepancies.size(); i++) { if (i < 2) { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies1_5[i]); } else { assertEquals(idsOfCoveredDiscrepancies.get(i), idsForDiscrepancies12_18[i - 2]); } } assertTrue(annotationOne.getIsConnected()); String actual = dispoConnector.getItemStatus(dispoItem); assertEquals(DispoStrings.Item_InComplete, actual); }
Source:
<code>public HashSet<String> getValues(ProgressMonitor pm){ HashSet<String> ret = new HashSet<String>(); try { long rowCount=ds.getRowCount(); pm.startTask(I18N.tr("Retrieving classes"), 10); pm.progressTo(0); double m = rowCount>0 ?(double)10/rowCount : 0; int n =0; int fieldIndex = ds.getFieldIndexByName(fieldName); for(long i=0; i<rowCount; i++){ Value val = ds.getFieldValue(i, fieldIndex); ret.add(val.toString()); if(i*m>n*10){ <START> if(pm.isCancelled()){ <END> pm.endTask(); return null; } n++; pm.progressTo(n); } } } catch (DriverException e) { LOGGER.error("IO error while handling the input data source : " + e.getMessage()); } pm.endTask(); return ret; }</code><technical_language>move isCancelled out of if(i*m..) able cancel 1% update</technical_language>

Target:
public HashSet<String> getValues(ProgressMonitor pm){ HashSet<String> ret = new HashSet<String>(); try { long rowCount=ds.getRowCount(); pm.startTask(I18N.tr("Retrieving classes"), 10); pm.progressTo(0); double m = rowCount>0 ?(double)10/rowCount : 0; int n =0; int fieldIndex = ds.getFieldIndexByName(fieldName); for(long i=0; i<rowCount; i++){ Value val = ds.getFieldValue(i, fieldIndex); ret.add(val.toString()); if(i*m>n*10){ n++; pm.progressTo(n); } if(pm.isCancelled()){ pm.endTask(); return null; } } } catch (DriverException e) { LOGGER.error("IO error while handling the input data source : " + e.getMessage()); } pm.endTask(); return ret; }
Source:
<code>public static void main(final String ... args) throws Exception { <START> System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "info"); <END> URI workingDirectory = new File(System.getProperty("user.dir")).getCanonicalFile().toURI(); SwiftGeneratorCommandLineConfig cliConfig = new SwiftGeneratorCommandLineConfig(); JCommander jCommander = new JCommander(cliConfig, args); jCommander.setProgramName(SwiftGenerator.class.getSimpleName()); if (cliConfig.inputFiles == null) { jCommander.usage(); return; } SwiftGeneratorConfig.Builder configBuilder = SwiftGeneratorConfig.builder() .inputBase(workingDirectory) .addInputs(Lists.transform(cliConfig.inputFiles, new Function<File, URI>() { @Nullable @Override public URI apply(@Nullable File input) { return input.toURI(); } })) .outputFolder(cliConfig.outputDirectory) .overridePackage(cliConfig.overridePackage) .defaultPackage(cliConfig.defaultPackage) .addTweak(SwiftGeneratorTweak.ADD_CLOSEABLE_INTERFACE) .generateIncludedCode(cliConfig.generateIncludedCode) .codeFlavor(cliConfig.mutableTypes ? "java-regular" : "java-immutable"); if (cliConfig.addThriftExceptions) { configBuilder.addTweak(SwiftGeneratorTweak.ADD_THRIFT_EXCEPTION); } new SwiftGenerator(configBuilder.build()).parse(); }</code><technical_language>log logback-classic anyway, easier pop a logback.xml file necessary config src/main/resources done? This cumbersome</technical_language>

Target:
public static void main(final String ... args) throws Exception { URI workingDirectory = new File(System.getProperty("user.dir")).getCanonicalFile().toURI(); SwiftGeneratorCommandLineConfig cliConfig = new SwiftGeneratorCommandLineConfig(); JCommander jCommander = new JCommander(cliConfig, args); jCommander.setProgramName(SwiftGenerator.class.getSimpleName()); if (cliConfig.inputFiles == null) { jCommander.usage(); return; } SwiftGeneratorConfig.Builder configBuilder = SwiftGeneratorConfig.builder() .inputBase(workingDirectory) .outputFolder(cliConfig.outputDirectory) .overridePackage(cliConfig.overridePackage) .defaultPackage(cliConfig.defaultPackage) .generateIncludedCode(cliConfig.generateIncludedCode) .codeFlavor(cliConfig.generateBeans ? "java-regular" : "java-immutable"); for (SwiftGeneratorTweak tweak : cliConfig.tweaks) { configBuilder.addTweak(tweak); } if (cliConfig.addThriftExceptions) { configBuilder.addTweak(SwiftGeneratorTweak.ADD_THRIFT_EXCEPTION); } Iterable<URI> inputs = Iterables.transform(cliConfig.inputFiles, FILE_TO_URI_TRANSFORM); new SwiftGenerator(configBuilder.build()).parse(inputs); }
Source:
<code>public void onEntitySpawn(EntitySpawnEvent event) { WorldConfigurationNode node = VanillaConfiguration.WORLDS.get(event.getEntity().getWorld()); Living mob = event.getEntity().get(Living.class); if (!(mob instanceof Player)) { if (!node.SPAWN_ANIMALS.getBoolean()) { <START> if ((mob instanceof Neutral) || (mob instanceof Passive)) { <END> event.setCancelled(true); } } if (!node.SPAWN_MONSTERS.getBoolean()) { if (mob instanceof Aggressive) { event.setCancelled(true); } } } }</code><technical_language>do if (mob instanceof Neutral || mob instanceof Passive) { extra parentheses</technical_language>

Target:
public void onEntitySpawn(EntitySpawnEvent event) { WorldConfigurationNode node = VanillaConfiguration.WORLDS.get(event.getEntity().getWorld()); Living mob = event.getEntity().get(Living.class); if (!(mob instanceof Player)) { if (!node.SPAWN_ANIMALS.getBoolean()) { if (mob instanceof Neutral || mob instanceof Passive) { event.setCancelled(true); } } if (!node.SPAWN_MONSTERS.getBoolean()) { if (mob instanceof Aggressive) { event.setCancelled(true); } } } }
Source:
<code>private Mono<java.net.http.HttpRequest> toJdkHttpRequest(HttpRequest request) { return Mono.fromCallable(() -> { final java.net.http.HttpRequest.Builder builder = java.net.http.HttpRequest.newBuilder(); try { builder.uri(request.getUrl().toURI()); } catch (URISyntaxException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } final HttpHeaders headers = request.getHeaders(); if (headers != null) { for (HttpHeader header : headers) { final String headerName = header.getName(); if (!restrictedHeaders.contains(headerName)) { final String headerValue = header.getValue(); builder.setHeader(headerName, headerValue); <START> } else { <END> logger.error("The header '" + headerName + "' is restricted by default in JDK HttpClient 12 " + "and above (unless it is whitelisted in JAVA_HOME/conf/net.properties)."); } } } switch (request.getHttpMethod()) { case GET: return builder.GET().build(); case HEAD: return builder.method("HEAD", noBody()).build(); default: final String contentLength = request.getHeaders().getValue("content-length"); final BodyPublisher bodyPublisher = toBodyPublisher(request.getBody(), contentLength); return builder.method(request.getHttpMethod().toString(), bodyPublisher).build(); } }); }</code><technical_language>ways allowlist. update message here? Also, change whitelist wording. Do want change log level WARNING</technical_language>

Target:
private Mono<java.net.http.HttpRequest> toJdkHttpRequest(HttpRequest request) { return Mono.fromCallable(() -> { final java.net.http.HttpRequest.Builder builder = java.net.http.HttpRequest.newBuilder(); try { builder.uri(request.getUrl().toURI()); } catch (URISyntaxException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } final HttpHeaders headers = request.getHeaders(); if (headers != null) { for (HttpHeader header : headers) { final String headerName = header.getName(); if (!restrictedHeaders.contains(headerName)) { final String headerValue = header.getValue(); builder.setHeader(headerName, headerValue); } else { logger.warning("The header '" + headerName + "' is restricted by default in JDK HttpClient 12 " + "and above. This header can be added to allow list in JAVA_HOME/conf/net.properties " + "or in System.setProperty() or in Configuration. Use the key 'jdk.httpclient" + ".allowRestrictedHeaders' and a comma separated list of header names."); } } } switch (request.getHttpMethod()) { case GET: return builder.GET().build(); case HEAD: return builder.method("HEAD", noBody()).build(); default: final String contentLength = request.getHeaders().getValue("content-length"); final BodyPublisher bodyPublisher = toBodyPublisher(request.getBody(), contentLength); return builder.method(request.getHttpMethod().toString(), bodyPublisher).build(); } }); }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getMissingServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { <START> setVdsName(vds.getName()); <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); return false; } } return true; }</code><technical_language>if vds == null vds.getName() throw NPE</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getMissingServerHooks().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS); return false; } for (GlusterServerHook serverHook: getMissingServerHooks()) { VDS vds = getVdsDAO().get(serverHook.getServerId()); if (vds == null || vds.getStatus() != VDSStatus.Up) { setVdsName(vds != null ? vds.getName() : "No Server"); addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SERVER_STATUS_NOT_UP); return false; } } return true; }
Source:
<code>public TopNNode(@JsonProperty("id") PlanNodeId id, @JsonProperty("source") PlanNode source, @JsonProperty("count") long count, @JsonProperty("orderBy") List<Symbol> orderBy, @JsonProperty("orderings") Map<Symbol, SortOrder> orderings, @JsonProperty("step") Step step) { super(id); requireNonNull(source, "source is null"); Preconditions.checkArgument(count >= 0, "count must be positive"); checkCondition(count <= Integer.MAX_VALUE, NOT_SUPPORTED, "ORDER BY LIMIT > %s is not supported", Integer.MAX_VALUE); requireNonNull(orderBy, "orderBy is null"); Preconditions.checkArgument(!orderBy.isEmpty(), "orderBy is empty"); Preconditions.checkArgument(orderings.size() == orderBy.size(), "orderBy and orderings sizes don't match"); this.source = source; this.count = count; this.orderBy = ImmutableList.copyOf(orderBy); this.orderings = ImmutableMap.copyOf(orderings); <START> this.step = step; <END> }</code><technical_language>require null</technical_language>

Target:
public TopNNode(@JsonProperty("id") PlanNodeId id, @JsonProperty("source") PlanNode source, @JsonProperty("count") long count, @JsonProperty("orderBy") List<Symbol> orderBy, @JsonProperty("orderings") Map<Symbol, SortOrder> orderings, @JsonProperty("step") Step step) { super(id); requireNonNull(source, "source is null"); Preconditions.checkArgument(count >= 0, "count must be positive"); checkCondition(count <= Integer.MAX_VALUE, NOT_SUPPORTED, "ORDER BY LIMIT > %s is not supported", Integer.MAX_VALUE); requireNonNull(orderBy, "orderBy is null"); Preconditions.checkArgument(!orderBy.isEmpty(), "orderBy is empty"); Preconditions.checkArgument(orderings.size() == orderBy.size(), "orderBy and orderings sizes don't match"); this.source = source; this.count = count; this.orderBy = ImmutableList.copyOf(orderBy); this.orderings = ImmutableMap.copyOf(orderings); this.step = requireNonNull(step, "step is null"); }
Source:
<code>private final ClientResponseImpl dispatchSubscribe(InvocationClientHandler handler, StoredProcedureInvocation task) { final ParameterSet ps = task.getParams(); final Object params[] = ps.toArray(); String err = null; final ClientInterfaceHandleManager cihm = m_cihm.get(handler.connectionId()); if (cihm == null) { return null; } for (int ii = 0; ii < params.length; ii++) { final Object param = params[ii]; if (param == null) { err = "Parameter index " + ii + " was null"; break; } if (!(param instanceof String)) { err = "Parameter index " + ii + " was not a String"; break; } if ("TOPOLOGY".equals(param)) { cihm.setWantsTopologyUpdates(true); <START> cihm.setWantsProcUpdates(true); <END> } else { err = "Parameter \"" + param + "\" is not recognized/supported"; break; } } return new ClientResponseImpl( err == null ? ClientResponse.SUCCESS : ClientResponse.GRACEFUL_FAILURE, new VoltTable[] { }, err, task.clientHandle); }</code><technical_language>"ProcedureUpdates" "TopologyUpdates" affinity is on? Is other case consistent " false, true" "true, false"? @zeemanhe If not, is a need introduce a new option</technical_language>

Target:
private final ClientResponseImpl dispatchSubscribe(InvocationClientHandler handler, StoredProcedureInvocation task) { final ParameterSet ps = task.getParams(); final Object params[] = ps.toArray(); String err = null; final ClientInterfaceHandleManager cihm = m_cihm.get(handler.connectionId()); if (cihm == null) { return null; } for (int ii = 0; ii < params.length; ii++) { final Object param = params[ii]; if (param == null) { err = "Parameter index " + ii + " was null"; break; } if (!(param instanceof String)) { err = "Parameter index " + ii + " was not a String"; break; } if ("TOPOLOGY".equals(param)) { cihm.setWantsTopologyUpdates(true); } else { err = "Parameter \"" + param + "\" is not recognized/supported"; break; } } return new ClientResponseImpl( err == null ? ClientResponse.SUCCESS : ClientResponse.GRACEFUL_FAILURE, new VoltTable[] { }, err, task.clientHandle); }
Source:
<code>public final boolean asBit(Object val) { String val0 = cast(val); if (val0.equalsIgnoreCase(BooleanConverter.TRUE)) { return true; } else if (val0.equalsIgnoreCase(BooleanConverter.FALSE)) { return false; } <START> throw HazelcastSqlException.error(SqlErrorCode.DATA_EXCEPTION, "String literal cannot be converter to BIT: " + val); <END> }</code><technical_language>necessarily a literal</technical_language>

Target:
public final boolean asBit(Object val) { String val0 = cast(val); if (val0.equalsIgnoreCase(BooleanConverter.TRUE)) { return true; } else if (val0.equalsIgnoreCase(BooleanConverter.FALSE)) { return false; } throw HazelcastSqlException.error(SqlErrorCode.DATA_EXCEPTION, "VARCHAR value cannot be converted to BIT: " + val); }
Source:
<code>public void testViolationsByVariableName() throws Exception { final String[] expected = { "19:11: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "35:11: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "51:11: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), <START> "58:11: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), <END> }; final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); final String filePath = getPath("InputEmptyCatchBlockViolationsByVariableName.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(checkConfig, filePath, expected, warnList); }</code><technical_language>violation message - Empty catch block.([link](<LINK_0> position 11 is for catch token Problem is code is {}. Please do update in code place SLIST token catch. more precise placing in auto-fix functionality suggestion fix</technical_language>

Target:
public void testViolationsByVariableName() throws Exception { final String[] expected = { "20:9: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "36:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "52:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), "59:18: " + getCheckMessage(EmptyCatchBlockCheck.class, "catch.block.empty"), }; final Configuration checkConfig = getModuleConfig("EmptyCatchBlock"); final String filePath = getPath("InputEmptyCatchBlockViolationsByVariableName.java"); final Integer[] warnList = getLinesWithWarn(filePath); verify(checkConfig, filePath, expected, warnList); }
Source:
<code>public void typePinDescription(String pinDescription) { waitForElementByElement(descriptionField); descriptionField.sendKeys(pinDescription); <START> PageObjectLogging.log("typePinDescription", "Pin description was typed in", true); <END> }</code><technical_language>I in other method, parameter is in log. Consider adding pinDescription log</technical_language>

Target:
public void typePinDescription(String pinDescription) { waitForElementByElement(descriptionField); descriptionField.sendKeys(pinDescription); PageObjectLogging.log("typePinDescription", pinDescription + "Pin description was typed in", true); }
Source:
<code>public Response createIssue(@Context HttpServletRequest request, @FormParam("title") String title, @FormParam("description") String description, @FormParam("assignee") String assigneeNetID) throws IOException{ Issue issue = new Issue(); issue.setTitle(title); issue.setDescription(description); issue.setOpen(true); User assignee = users.findByNetId(assigneeNetID); checkCollaborator(assignee); issue.setAssignee(assignee); <START> issue.setTimestamp(new Date()); <END> issue.setRepository(getRepositoryEntity()); issueBackend.createIssue(getRepositoryApi(getRepositoryEntity()), issue); return redirect(issue.getURI().toString()); }</code><technical_language>I this field @Creation annotation, this assignment is needed, done Hibernate hood</technical_language>

Target:
public Response createIssue(@Context HttpServletRequest request, @FormParam("title") String title, @FormParam("description") String description, @FormParam("assignee") String assigneeNetID) throws IOException{ Issue issue = new Issue(); issue.setTitle(title); issue.setDescription(description); issue.setOpen(true); User assignee = users.findByNetId(assigneeNetID); checkCollaborator(assignee); issue.setAssignee(assignee); issue.setRepository(getRepositoryEntity()); issueBackend.createIssue(getRepositoryApi(getRepositoryEntity()), issue); return redirect(issue.getURI().toString()); }
Source:
<code>private static Mson setFlipPageCommand(Mson mson, int pageHumanBased, int destinationPage, List<String> args, MassiveCommand command) { String number = String.valueOf(destinationPage); String oldNumber = String.valueOf(pageHumanBased); String commandLine; if (args != null) { List<String> arguments = new ArrayList<>(args); if (args.contains(oldNumber)) arguments.set(arguments.indexOf(oldNumber), number); else <START> arguments.add(0,number); <END> commandLine = command.getCommandLine(arguments); } else { commandLine = command.getCommandLine(number); } String tooltip = MsonEvent.command(commandLine).createTooltip(); commandLine = CmdMassiveCore.get().cmdMassiveCoreClick.getCommandLine(commandLine); mson = mson.command(commandLine); mson = mson.tooltip(tooltip); return mson; }</code><technical_language>single line conditionals brackets. find examples of this a in this file</technical_language>

Target:
private static Mson setFlipPageCommand(Mson mson, int pageHumanBased, int destinationPage, List<String> args, MassiveCommand command) { String number = String.valueOf(destinationPage); String oldNumber = String.valueOf(pageHumanBased); String commandLine; if (args != null) { int pageParamIndex = command.getPageParameterIndex(); List<String> arguments = new ArrayList<>(args); if (pageParamIndex == -1) pageParamIndex = arguments.indexOf(oldNumber); if (pageParamIndex > -1 && pageParamIndex < arguments.size()) arguments.set(pageParamIndex, number); else arguments.add(0, number); commandLine = command.getCommandLine(arguments); } else { commandLine = command.getCommandLine(number); } String tooltip = MsonEvent.command(commandLine).createTooltip(); commandLine = CmdMassiveCore.get().cmdMassiveCoreClick.getCommandLine(commandLine); mson = mson.command(commandLine); mson = mson.tooltip(tooltip); return mson; }
Source:
<code>private Class<?> loadRemoteClass(String name, Channel channel, ClassReference cr, RemoteClassLoader rcl) throws ClassNotFoundException { synchronized (rcl.getClassLoadingLock(name)) { Class<?> c = rcl.findLoadedClass(name); boolean interrupted = false; try { int tries = 0; <START> while (tries < MAX_RETRIES) { <END> tries++; try { invokeClassLoadTestingHookIfNeeded(); if (c != null) { return c; } Future<byte[]> img = cr.classImage.resolve(channel, name.replace('.', '/') + ".class"); if (img.isDone()) { try { return rcl.loadClassFile(name, img.get()); } catch (ExecutionException x) { } } return rcl.loadClassFile(name, proxy.fetch(name)); } catch (IOException x) { throw new ClassNotFoundException(name, x); } catch (InterruptedException x) { interrupted = true; try { rcl.getClassLoadingLock(name).wait(RETRY_SLEEP_DURATION_MILLISECONDS); } catch (InterruptedException e) { } LOGGER.finer("Handling interrupt while loading remote class. Current retry count = " + tries + ", maximum = " + MAX_RETRIES); } } throw new ClassNotFoundException("Could not load class " + name + " after " + MAX_RETRIES + " tries."); } finally { if (interrupted) Thread.currentThread().interrupt(); } } }</code><technical_language>for loops, do you? ;P</technical_language>

Target:
private Class<?> loadRemoteClass(String name, Channel channel, ClassReference cr, RemoteClassLoader rcl) throws ClassNotFoundException { synchronized (rcl.getClassLoadingLock(name)) { Class<?> c = rcl.findLoadedClass(name); int tries = 0; while (true) { try { invokeClassLoadTestingHookIfNeeded(); if (c != null) { return c; } Future<byte[]> img = cr.classImage.resolve(channel, name.replace('.', '/') + ".class"); if (img.isDone()) { try { return rcl.loadClassFile(name, img.get()); } catch (ExecutionException x) { } } return rcl.loadClassFile(name, proxy.fetch(name)); } catch (IOException x) { throw new ClassNotFoundException(name, x); } catch (InterruptedException | RemotingSystemException x) { tries++; if (shouldRetry(x, tries)) { sleepForRetry(); LOGGER.finer("Handling interrupt while loading remote class. Current retry count = " + tries + ", maximum = " + MAX_RETRIES); continue; } break; } } throw new ClassNotFoundException("Could not load class " + name + " after " + tries + " tries."); } }
Source:
<code>public List<String> getApplicableMethodNames() { <START> List<String> values = new ArrayList<String>(2); <END> values.add("createSocket"); values.add("getInsecure"); return values; }</code><technical_language>return Arrays.asList("createSockets", "getInsecure") instead</technical_language>

Target:
public List<String> getApplicableMethodNames() { return Arrays.asList("createSocket", "getInsecure"); }
Source:
<code>public void applyUpdater(final INDArray gradient, final int iteration) { if (v == null) { throw new IllegalStateException("Updater has not been initialized with view state"); } final double momentum = config.getMomentum(); final double learningRate = config.getLearningRate(); final INDArray vPrev = v.dup(gradientReshapeOrder); <START> vPrev.muli(momentum).subi(gradient.dup(gradientReshapeOrder).muli(learningRate)); <END> gradient.addi(vPrev); }</code><technical_language>This is incorrect. dup, update original v array - *always* equal initial (0), equal vanilla SGD in practice. Instead, v.muli(momentum).subi(gradient.dup(order).muli(learningRate))</technical_language>

Target:
public void applyUpdater(final INDArray gradient, final int iteration) { if (v == null) { throw new IllegalStateException("Updater has not been initialized with view state"); } final double momentum = config.getMomentum(); final double learningRate = config.getLearningRate(); v.muli(momentum).addi(gradient.dup(gradientReshapeOrder).muli(learningRate)); gradient.assign(vPrev); }
Source:
<code>public void updateRepositoryConfiguration(TaskRepository taskRepository, IProgressMonitor monitor) throws CoreException { try { monitorMap.put(taskRepository.getId(), monitor != null ? OperationUtil.convert(monitor) : new NullOperationMonitor()); configurationCache.invalidate(taskRepository.getId()); <START> configurationCache.get(taskRepository.getId()); <END> } catch (ExecutionException e) { throw new CoreException(new Status(IStatus.ERROR, BugzillaRestCore.ID_PLUGIN, e.getMessage(), e)); } finally { monitorMap.remove(taskRepository.getId()); } }</code><technical_language>refresh intead of call 2 methods</technical_language>

Target:
public void updateRepositoryConfiguration(TaskRepository taskRepository, IProgressMonitor monitor) throws CoreException { monitorMap.put(taskRepository.getId(), monitor != null ? OperationUtil.convert(monitor) : new NullOperationMonitor()); configurationCache.refresh(taskRepository.getId()); monitorMap.remove(taskRepository.getId()); }