auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunner <START> appRunner = ApplicationRunners.getApplicationRunner(ApplicationClassUtils.fromConfig(config), config); <END> switch (op) { case RUN: appRunner.run(); break; case KILL: appRunner.kill(); break; case STATUS: System.out.println(appRunner.status()); break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } }</code><technical_language>Formatting: 'appRunner' previous line, break equals</technical_language>

Target:
public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunner appRunner = ApplicationRunners.getApplicationRunner(ApplicationUtil.fromConfig(config), config); switch (op) { case RUN: appRunner.run(); break; case KILL: appRunner.kill(); break; case STATUS: System.out.println(appRunner.status()); break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } }
Source:
<code>public Collection<String> getSupportedCategories() { <START> return Collections.unmodifiableCollection(SUPPORTED_CATEGORIES); <END> }</code><technical_language>categories change, of SUPPORTED_CATEGORIES unmodifiable start</technical_language>

Target:
public Collection<String> getSupportedCategories() { return SUPPORTED_CATEGORIES; }
Source:
<code>private int mapPortForwarding(final DebuggingContext debuggingContext, final IProgressMonitor monitor) { monitor.subTask("Enabling port forwarding"); IPod pod = debuggingContext.getPod(); int remotePort = debuggingContext.getDebugPort(); if (pod == null || remotePort < 1) { return -1; } Set<PortPair> ports = PortForwardingUtils.getForwardablePorts(pod); Optional<PortPair> debugPort = ports.stream().filter(p -> remotePort == p.getRemotePort()).findFirst(); if (!debugPort.isPresent() || monitor.isCanceled()) { return -1; } if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } for (IPortForwardable.PortPair port : ports) { if(monitor.isCanceled()) { return -1; } <START> if (port.getRemotePort() != 9999) { <END> port.setLocalPort(SocketUtil.findFreePort()); } monitor.worked(1); } PortForwardingUtils.startPortForwarding(pod, ports, OpenShiftBinaryOption.SKIP_TLS_VERIFY); if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } return -1; }</code><technical_language>pelase extract this a constant reuse exists</technical_language>

Target:
private int mapPortForwarding(final DebuggingContext debuggingContext, final IProgressMonitor monitor) { monitor.subTask("Enabling port forwarding"); IPod pod = debuggingContext.getPod(); int remotePort = debuggingContext.getDebugPort(); if (pod == null || remotePort < 1) { return -1; } Set<PortPair> ports = PortForwardingUtils.getForwardablePorts(pod); Optional<PortPair> debugPort = ports.stream().filter(p -> remotePort == p.getRemotePort()).findFirst(); if (!debugPort.isPresent() || monitor.isCanceled()) { return -1; } if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } for (IPortForwardable.PortPair port : ports) { if(monitor.isCanceled()) { return -1; } if (port.getRemotePort() != OpenShiftDebugUtils.NATIVE_MANAGMENT_PORT) { port.setLocalPort(SocketUtil.findFreePort()); } monitor.worked(1); } PortForwardingUtils.startPortForwarding(pod, ports, OpenShiftBinaryOption.SKIP_TLS_VERIFY); if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } return -1; }
Source:
<code>private String listAllCommands() { <START> String commands = "Installed Commands: "; <END> Iterator<CliCommand> implementations = getAllCommands(); while (implementations.hasNext()) { CliCommand implementation = implementations.next(); String unCamel = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, implementation.getClass().getSimpleName()); commands += unCamel + ", "; } return commands; }</code><technical_language>a StringBuilder instead of a String</technical_language>

Target:
private String listAllCommands() { final StringBuilder commands = new StringBuilder("Installed Commands: "); final Iterator<CliCommand> implementations = getAllCommands(); while (implementations.hasNext()) { final CliCommand implementation = implementations.next(); commands.append(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, implementation.getClass().getSimpleName())); if (implementations.hasNext()) { commands.append(", "); } } return commands.toString(); }
Source:
<code>public UnitOfWorkAspect newAspect(ImmutableMap<String, SessionFactory> sessionFactories) { <START> return new UnitOfWorkAspect(this.sessionFactories); <END> }</code><technical_language>sessionFactories instead of this.sessionFactories? If yes, overload newAspect instead of changing signature</technical_language>

Target:
public UnitOfWorkAspect newAspect(ImmutableMap<String, SessionFactory> sessionFactories) { return new UnitOfWorkAspect(sessionFactories); }
Source:
<code>public DatabaseStorageBase(String databaseDirectory) { dbUrl = String.format(dbUrlPreFormat, databaseDirectory); try { conn = DriverManager.getConnection(dbUrl); } catch (SQLException e) { log.error("Ran into a SQL problem - could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } catch (Exception e) { <START> log.error("Ran into a general expection, so could not open a connection to the database! No properties will be loaded or persisted!!"); <END> log.error(e.toString()); e.printStackTrace(); } if (propertiesTableExists() == false) { createPropertiesTable(); } }</code><technical_language>"expection" -> "exception"</technical_language>

Target:
public DatabaseStorageBase(String databaseDirectory) { dbUrl = String.format(dbUrlPreFormat, databaseDirectory); try { conn = DriverManager.getConnection(dbUrl); } catch (SQLException e) { log.error("Ran into a SQL problem - could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } catch (Exception e) { log.error("Ran into a general exception, so could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } if (propertiesTableExists() == false) { createPropertiesTable(); } }
Source:
<code>default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B> joiner) { if (joiner instanceof FilteringBiJoiner) { FilteringBiJoiner<A, B> filteringJoiner = (FilteringBiJoiner<A, B>) joiner; return join(otherClass) .filter(filteringJoiner.getFilter()); } else { <START> return join(getConstraintFactory().from(otherClass), joiner); <END> } }</code><technical_language>do need handle FilteringJoiner already? join(UniStream, BiJoiner) method deal wether BiJoiner is a FilteringBiJoiner? I original code this change. if fails test, problem is in this method, in delegating method</technical_language>

Target:
default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B> joiner) { return join(getConstraintFactory().from(otherClass), joiner); }
Source:
<code>public void run() { try { stats.addQueuedTime(Duration.nanosSince(queuedTime)); long start = System.nanoTime(); backupStore.get().backupShard(uuid, source); stats.addCopyShardDataRate(new DataSize(source.length(), BYTE), Duration.nanosSince(start)); File restored = new File(storageService.getStagingFile(uuid) + ".validate"); backupStore.get().restoreShard(uuid, restored); if (!Files.equal(source, restored)) { stats.incrementBackupCorruption(); <START> <END> File quarantineBase = storageService.getQuarantineFile(uuid); File quarantineOriginal = new File(quarantineBase.getPath() + ".original"); File quarantineRestored = new File(quarantineBase.getPath() + ".restored"); if (!source.renameTo(quarantineOriginal) || !restored.renameTo(quarantineRestored)) { log.warn("Quarantine of corrupt backup shard failed: %s", uuid); } throw new PrestoException(RAPTOR_BACKUP_CORRUPTION, "Backup is corrupt after write: " + uuid); } stats.incrementBackupSuccess(); } catch (Throwable t) { stats.incrementBackupFailure(); throw Throwables.propagate(t); } }</code><technical_language>add a log message</technical_language>

Target:
public void run() { try { stats.addQueuedTime(Duration.nanosSince(queuedTime)); long start = System.nanoTime(); backupStore.get().backupShard(uuid, source); stats.addCopyShardDataRate(new DataSize(source.length(), BYTE), Duration.nanosSince(start)); File restored = new File(storageService.getStagingFile(uuid) + ".validate"); backupStore.get().restoreShard(uuid, restored); if (!Files.equal(source, restored)) { stats.incrementBackupCorruption(); File quarantineBase = storageService.getQuarantineFile(uuid); File quarantineOriginal = new File(quarantineBase.getPath() + ".original"); File quarantineRestored = new File(quarantineBase.getPath() + ".restored"); log.error("Backup is corrupt after write. Quarantining local file: %s", quarantineBase); if (!source.renameTo(quarantineOriginal) || !restored.renameTo(quarantineRestored)) { log.warn("Quarantine of corrupt backup shard failed: %s", uuid); } throw new PrestoException(RAPTOR_BACKUP_CORRUPTION, "Backup is corrupt after write: " + uuid); } if (!restored.delete()) { log.warn("Failed to delete staging file: %s", restored); } stats.incrementBackupSuccess(); } catch (Throwable t) { stats.incrementBackupFailure(); throw Throwables.propagate(t); } }
Source:
<code>public DDF removeColumns(List<String> columnNames) throws DDFException { if (columnNames == null || columnNames.isEmpty()) throw new DDFException("columnNames must be specified"); List<String> currentColumnNames = this.getDDF().getColumnNames(); for(String columnName: columnNames) { if(!currentColumnNames.contains(columnName)) { throw new DDFException(String.format("Column %s does not exists", columnName)); } } <START> List<String> columns = this.getDDF().getColumnNames(); <END> for (String columnName : currentColumnNames) { for (Iterator<String> it = columns.iterator();it.hasNext();) { if (it.next().equals(columnName)) { it.remove(); } } } DDF newddf = this.project(columns); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; }</code><technical_language>This is List<String> currentColumnNames = this.getDDF().getColumnNames();, declare again</technical_language>

Target:
public DDF removeColumns(List<String> columnNames) throws DDFException { if (columnNames == null || columnNames.isEmpty()) throw new DDFException("columnNames must be specified"); List<String> currentColumnNames = this.getDDF().getColumnNames(); for(String columnName: columnNames) { if(!currentColumnNames.contains(columnName)) { throw new DDFException(String.format("Column %s does not exists", columnName)); } } for (String columnName : columnNames) { for (Iterator<String> it = currentColumnNames.iterator();it.hasNext();) { if (it.next().equals(columnName)) { it.remove(); } } } DDF newddf = this.project(currentColumnNames); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; }
Source:
<code>public static List<SearchField> buildSearchFields(Class<?> model, FieldBuilderOptions options) { <START> if (options == null) { return FieldBuilder.build(model, MemberNameConverterProviders.createInstance()); } return FieldBuilder.build(model, options.getSerializer()); <END> }</code><technical_language>Instead of repeating this implementation, this method call buildSearchFields in async client</technical_language>

Target:
public static List<SearchField> buildSearchFields(Class<?> model, FieldBuilderOptions options) { return SearchIndexAsyncClient.buildSearchFields(model, options); }
Source:
<code>public Class<?> getType(Class<?> entityClass, String identifier) { <START> if (isIdType(entityClass, identifier)) { <END> return getIdType(entityClass); } ConcurrentHashMap<String, Class<?>> fieldTypes = getEntityBinding(entityClass).fieldsToTypes; return fieldTypes == null ? null : fieldTypes.get(identifier); }</code><technical_language>In commit, code like: java if (!ID_IDENTIFIER.equals(getEntityBinding(entityClass).getIdFieldName())) { return getIdType(entityClass); } Is a reason define a new method isIdType code commit</technical_language>

Target:
public Class<?> getType(Class<?> entityClass, String identifier) { if (identifier.equals(REGULAR_ID_NAME)) { return getEntityBinding(entityClass).getIdType(); } ConcurrentHashMap<String, Class<?>> fieldTypes = getEntityBinding(entityClass).fieldsToTypes; return fieldTypes == null ? null : fieldTypes.get(identifier); }
Source:
<code>public static <T extends GraphQLType> List<T> sortGraphQLTypes(Collection<T> types) { <START> ArrayList<T> sorted = new ArrayList<>(types); <END> sorted.sort(graphQLTypeComparator()); return sorted; }</code><technical_language>List<T>? :-)</technical_language>

Target:
public static <T extends GraphQLType> List<T> sortGraphQLTypes(Collection<T> types) { List<T> sorted = new ArrayList<>(types); sorted.sort(graphQLTypeComparator()); return sorted; }
Source:
<code>public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { <START> return null; <END> }</code><technical_language>Lets throw exception instead</technical_language>

Target:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { throw new UnsupportedOperationException(); }
Source:
<code><START> public InputReferenceNode(CallSiteBinder callSiteBinder, Scope scope, Type type, BytecodeExpression block, BytecodeExpression position) <END> { Variable wasNullVariable = scope.getVariable("wasNull"); Class<?> javaType = type.getJavaType(); if (!javaType.isPrimitive() && javaType != Slice.class) { javaType = Object.class; } body = new IfStatement(); body.condition(block.invoke("isNull", boolean.class, position)); body.ifTrue() .putVariable(wasNullVariable, true) .pushJavaDefault(javaType); String methodName = "get" + Primitives.wrap(javaType).getSimpleName(); body.ifFalse(constantType(callSiteBinder, type).invoke(methodName, javaType, block, position)); this.block = block; this.position = position; }</code><technical_language>I realize refactor I suggested requires callSiteBinder, scope type input constructor. This constructor is suited a public constructor. private (it called outer class, InputReferenceCompiler</technical_language>

Target:
private InputReferenceNode(CallSiteBinder callSiteBinder, Scope scope, Type type, BytecodeExpression block, BytecodeExpression position) { Variable wasNullVariable = scope.getVariable("wasNull"); Class<?> javaType = type.getJavaType(); if (!javaType.isPrimitive() && javaType != Slice.class) { javaType = Object.class; } IfStatement ifStatement = new IfStatement(); ifStatement.condition(block.invoke("isNull", boolean.class, position)); ifStatement.ifTrue() .putVariable(wasNullVariable, true) .pushJavaDefault(javaType); String methodName = "get" + Primitives.wrap(javaType).getSimpleName(); ifStatement.ifFalse(constantType(callSiteBinder, type).invoke(methodName, javaType, block, position)); this.body = ifStatement; this.block = block; this.position = position; }
Source:
<code>public boolean isAuthSupported() { <START> return true; <END> }</code><technical_language>Returning isAuthRequired default sounds gold me</technical_language>

Target:
public boolean isAuthSupported() { return isAuthRequired(); }
Source:
<code>public synchronized ArrayList<StorageDirectoryParcelable> getStorageDirectoriesNew() { ArrayList<StorageDirectoryParcelable> volumes = new ArrayList<>(); StorageManager sm = getSystemService(StorageManager.class); for (StorageVolume volume : sm.getStorageVolumes()) { <START> Log.i("MainActivity", "Volume: " + volume + ""); <END> if (!volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED) && !volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED_READ_ONLY)) { continue; } File path = Utils.getVolumeDirectory(volume); String name = volume.getDescription(this); int icon = R.drawable.ic_sd_storage_white_24dp; if (!volume.isRemovable()) { icon = R.drawable.ic_phone_android_white_24dp; } else { if (name.toUpperCase().contains("USB") || path.getPath().toUpperCase().contains("USB")) { icon = R.drawable.ic_usb_white_24dp; } else { icon = R.drawable.ic_sd_storage_white_24dp; } } volumes.add(new StorageDirectoryParcelable(path.getPath(), name, icon)); } return volumes; }</code><technical_language>Please delete this log call. (If allow contributor changes I push changes directly)</technical_language>

Target:
public synchronized ArrayList<StorageDirectoryParcelable> getStorageDirectoriesNew() { ArrayList<StorageDirectoryParcelable> volumes = new ArrayList<>(); StorageManager sm = getSystemService(StorageManager.class); for (StorageVolume volume : sm.getStorageVolumes()) { if (!volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED) && !volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED_READ_ONLY)) { continue; } File path = Utils.getVolumeDirectory(volume); String name = volume.getDescription(this); int icon; if (!volume.isRemovable()) { icon = R.drawable.ic_phone_android_white_24dp; } else { if (name.toUpperCase().contains("USB") || path.getPath().toUpperCase().contains("USB")) { icon = R.drawable.ic_usb_white_24dp; } else { icon = R.drawable.ic_sd_storage_white_24dp; } } volumes.add(new StorageDirectoryParcelable(path.getPath(), name, icon)); } return volumes; }
Source:
<code><START> public Segment(String path, String etag, long sizeBytes) { <END> this.path = checkNotNull(path, "path"); this.etag = checkNotNull(etag, "etag of %s", path); this.sizeBytes = sizeBytes; }</code><technical_language>Is this change necessary? Is in tests</technical_language>

Target:
private Segment(String path, String etag, long sizeBytes) { this.path = checkNotNull(path, "path"); this.etag = checkNotNull(etag, "etag of %s", path); this.sizeBytes = sizeBytes; }
Source:
<code>public String toString() { return "ClientIcmpPingConfig{" + "timeoutMilliseconds=" + timeoutMilliseconds + ", intervalMilliseconds=" + intervalMilliseconds + ", echoFailFastOnStartup=" + echoFailFastOnStartup + ", ttl=" + ttl + ", maxAttempts=" + maxAttempts <START> + ", enabled=" + enabled <END> + '}'; }</code><technical_language>put enabled top of list</technical_language>

Target:
public String toString() { return "ClientIcmpPingConfig{" + "enabled=" + enabled + ", timeoutMilliseconds=" + timeoutMilliseconds + ", intervalMilliseconds=" + intervalMilliseconds + ", echoFailFastOnStartup=" + echoFailFastOnStartup + ", ttl=" + ttl + ", maxAttempts=" + maxAttempts + '}'; }
Source:
<code>public void setup() { initMocks(this); registerVolatileStorageService(); managedItemProvider = getService(ManagedItemProvider.class); assertNotNull(managedItemProvider); metadataRegistry = getService(MetadataRegistry.class); assertNotNull(metadataRegistry); itemRegistry = getService(ItemRegistry.class); assertNotNull(itemRegistry); <START> itemRegistry.removeRegistryChangeListener(mockListener); <END> }</code><technical_language>move this tearDown</technical_language>

Target:
public void setup() { initMocks(this); registerVolatileStorageService(); managedItemProvider = getService(ManagedItemProvider.class); assertNotNull(managedItemProvider); metadataRegistry = getService(MetadataRegistry.class); assertNotNull(metadataRegistry); itemRegistry = getService(ItemRegistry.class); assertNotNull(itemRegistry); }
Source:
<code>public void constraintViolationExceptionCausesBadRequest() { Path violationPath = mock(Path.class); when(violationPath.toString()).thenReturn("violationPath"); ConstraintViolation violation = mock(ConstraintViolation.class); when(violation.getRootBeanClass()).thenReturn(CustomValidationExceptionMapperTest.class); when(violation.getPropertyPath()).thenReturn(violationPath); when(violation.getMessage()).thenReturn("violationMessage"); ConstraintViolationException exception = mock(ConstraintViolationException.class); when(exception.getConstraintViolations()).thenReturn(new LinkedHashSet(asList(violation))); try (Response response = exceptionMapper.toResponse(exception)) { <START> assertThat(response.getStatus(), is(Response.Status.BAD_REQUEST.getStatusCode())); <END> ErrorResponse error = (ErrorResponse) response.getEntity(); assertThat(error.error, is("violationPath: violationMessage")); } }</code><technical_language>Static import</technical_language>

Target:
public void constraintViolationExceptionCausesBadRequest() { Path violationPath = mock(Path.class); when(violationPath.toString()).thenReturn("violationPath"); ConstraintViolation violation = mock(ConstraintViolation.class); when(violation.getRootBeanClass()).thenReturn(CustomValidationExceptionMapperTest.class); when(violation.getPropertyPath()).thenReturn(violationPath); when(violation.getMessage()).thenReturn("violationMessage"); ConstraintViolationException exception = mock(ConstraintViolationException.class); when(exception.getConstraintViolations()).thenReturn(new LinkedHashSet(asList(violation))); try (Response response = exceptionMapper.toResponse(exception)) { assertThat(response.getStatus(), is(BAD_REQUEST.getStatusCode())); ErrorResponse error = (ErrorResponse) response.getEntity(); assertThat(error.error, is("violationPath: violationMessage")); } }
Source:
<code>public static String getResponseFromServer(final URL constructedUrl, final HostnameVerifier hostnameVerifier, final Properties sslConfig, final String encoding) { URLConnection conn = null; try { conn = constructedUrl.openConnection(); if (conn instanceof HttpsURLConnection) { HttpsURLConnection httpsConnection = (HttpsURLConnection)conn; <START> SSLSocketFactory socketFactory = createSslSocketFactory(sslConfig); <END> if (socketFactory != null) { httpsConnection.setSSLSocketFactory(socketFactory); } if (hostnameVerifier != null) { httpsConnection.setHostnameVerifier(hostnameVerifier); } else { httpsConnection.setHostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier()); } } final BufferedReader in; if (CommonUtils.isEmpty(encoding)) { in = new BufferedReader(new InputStreamReader(conn.getInputStream())); } else { in = new BufferedReader(new InputStreamReader(conn.getInputStream(), encoding)); } String line; final StringBuilder stringBuffer = new StringBuilder(255); while ((line = in.readLine()) != null) { stringBuffer.append(line); stringBuffer.append("\n"); } return stringBuffer.toString(); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e); } finally { if (conn != null && conn instanceof HttpURLConnection) { ((HttpURLConnection)conn).disconnect(); } } }</code><technical_language>Please keyword final declaring httpsConnection socketFactory</technical_language>

Target:
public static String getResponseFromServer(final URL constructedUrl, final HostnameVerifier hostnameVerifier, final Properties sslConfig, final String encoding) { URLConnection conn = null; try { conn = constructedUrl.openConnection(); configureHttpsConnection(conn,sslConfig,hostnameVerifier); final BufferedReader in; if (CommonUtils.isEmpty(encoding)) { in = new BufferedReader(new InputStreamReader(conn.getInputStream())); } else { in = new BufferedReader(new InputStreamReader(conn.getInputStream(), encoding)); } String line; final StringBuilder stringBuffer = new StringBuilder(255); while ((line = in.readLine()) != null) { stringBuffer.append(line); stringBuffer.append("\n"); } return stringBuffer.toString(); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e); } finally { if (conn != null && conn instanceof HttpURLConnection) { ((HttpURLConnection)conn).disconnect(); } } }
Source:
<code>public void doAnalysisForRelativeTreeRef(TreeReference expressionWithContextTypeRelative) throws AnalysisInvalidException { if (getContextRef() == null) { <START> throw new AnalysisInvalidException(); <END> } doNormalTreeRefAnalysis(expressionWithContextTypeRelative); if (!this.isSubAnalyzer) { getContextRef().applyAndPropagateAnalyzer(this); } }</code><technical_language>I useful add messages these, easier track false negatives (IE: get invalid analysis: process is recursive tricky figure out ended throwing issue</technical_language>

Target:
public void doAnalysisForRelativeTreeRef(TreeReference expressionWithContextTypeRelative) throws AnalysisInvalidException { if (getContextRef() == null) { throw new AnalysisInvalidException("No context ref was available when trying to " + "analyze the following expression with context type relative: " + expressionWithContextTypeRelative.toString()); } doNormalTreeRefAnalysis(expressionWithContextTypeRelative); if (!this.isSubAnalyzer) { getContextRef().applyAndPropagateAnalyzer(this); } }
Source:
<code>protected void doRun() throws Exception { if (DISABLED) { return; } final long now = System.currentTimeMillis(); long iota = System.currentTimeMillis(); final long recurrencePeriosMillis = TimeUnit.SECONDS.toMillis(RECURRENCE_PERIOD_SEC); long thresholdMillis = recurrencePeriosMillis > THRESHOLD ? recurrencePeriosMillis * 2 : THRESHOLD; OUTER: for (InflightRequest req : filter.tracker.values()) { long totalTime = now - req.startTime; if (totalTime> thresholdMillis) { if (req.ended) continue; PrintWriter w = null; try { if (req.record==null) { req.record = logs.file(format.format(new Date(iota++)) + ".txt"); logs.add(req.record); w = new PrintWriter(req.record,"UTF-8"); req.writeHeader(w); } else { w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(req.record,true),"UTF-8")); logs.touch(req.record); } ThreadInfo lockedThread = ManagementFactory.getThreadMXBean().getThreadInfo(req.thread.getId()); w.println(lockedThread); w.println(totalTime + "msec elapsed in " + lockedThread.getThreadName()); <START> w.println(ManagementFactory.getThreadMXBean().getThreadInfo(lockedThread.getLockOwnerId())); <END> continue OUTER; } finally { IOUtils.closeQuietly(w); } } } }</code><technical_language>Means is method unused deleted</technical_language>

Target:
protected void doRun() throws Exception { if (DISABLED) { return; } final long now = System.currentTimeMillis(); long iota = System.currentTimeMillis(); final long recurrencePeriosMillis = TimeUnit.SECONDS.toMillis(RECURRENCE_PERIOD_SEC); long thresholdMillis = recurrencePeriosMillis > THRESHOLD ? recurrencePeriosMillis * 2 : THRESHOLD; for (InflightRequest req : filter.tracker.values()) { long totalTime = now - req.startTime; if (totalTime> thresholdMillis) { if (req.ended) continue; PrintWriter w = null; try { if (req.record==null) { req.record = logs.file(format.format(new Date(iota++)) + ".txt"); logs.add(req.record); w = new PrintWriter(req.record,"UTF-8"); req.writeHeader(w); } else { w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(req.record,true),"UTF-8")); logs.touch(req.record); } ThreadInfo lockedThread = ManagementFactory.getThreadMXBean().getThreadInfo(req.thread.getId()); if (lockedThread != null ) { w.println(lockedThread); w.println(totalTime + "msec elapsed in " + lockedThread.getThreadName()); w.println(ManagementFactory.getThreadMXBean().getThreadInfo(lockedThread.getLockOwnerId())); } } finally { IOUtils.closeQuietly(w); } } } }
Source:
<code>public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: babble <file.bla>"); } else { String path = args[0]; File file = new File(path); CharStream chars = new ANTLRInputStream(new FileInputStream(file)); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); String target = "target/classes/" + file.getName().replace(".bla", ".class"); ParseTreeWalker walker = new ParseTreeWalker(); ParseTree tree = parser.program(); <START> <END> ASTGenerator generator = new ASTGenerator(); Node irtree = generator.visitProgram((ProgramContext) tree); PrintWriter out = new PrintWriter("target/classes/" + file.getName().replace(".bla", ".graphviz")); out.print(Graphvizivier.nodeToGraph(irtree)); out.close(); App app = new App(file.getName().split("\\.")[0]); walker.walk(app, tree); app.writeBytecode(target); System.out.println(String.format("[ OK ] Compiled %s", target)); } }</code><technical_language>Superfluous whitespace</technical_language>

Target:
public static void main(String[] args) throws Exception { for (String path : args) { File file = new File(path); CharStream chars = new ANTLRInputStream(new FileInputStream(file)); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); String target = "target/classes/" + file.getName().replace(".bla", ".class"); ParseTreeWalker walker = new ParseTreeWalker(); ParseTree tree = parser.program(); ASTGenerator generator = new ASTGenerator(); Node irtree = generator.visitProgram((ProgramContext) tree); PrintWriter out = new PrintWriter("target/classes/" + file.getName().replace(".bla", ".dot")); out.print(Graphvizivier.nodeToGraph(irtree)); out.close(); App app = new App(file.getName().split("\\.")[0]); walker.walk(app, tree); app.writeBytecode(target); System.out.println(String.format("[ OK ] Compiled %s", target)); } }
Source:
<code>public ItemFoodBundle() { <START> super(15, 20.6f, true); <END> setUnlocalizedName("food_bundle"); setRegistryName(new ResourceLocation(AncientWarfareNPC.MOD_ID, "food_bundle")); setCreativeTab(AncientWarfareNPC.TAB); AncientWarfareNPC.proxy.addClientRegister(this); }</code><technical_language>Saturation modifier is 0 (no saturation) 1 (full saturation), 20 sounds game works that</technical_language>

Target:
public ItemFoodBundle() { super(15, 1, true); setUnlocalizedName("food_bundle"); setRegistryName(new ResourceLocation(AncientWarfareNPC.MOD_ID, "food_bundle")); setCreativeTab(AncientWarfareNPC.TAB); AncientWarfareNPC.proxy.addClientRegister(this); }
Source:
<code>public void stop() { LOG.info("Stopping event hub system consumer..."); List<CompletableFuture<Void>> futures = new ArrayList<>(); streamPartitionReceivers.values().forEach((receiver) -> futures.add(receiver.close())); CompletableFuture<Void> allFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])); try { allFuture.get(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOG.warn("Failed to close receivers", e); <START> Util.logThreadDump("Log thread dump as we failed during consumer shutdown"); <END> } LOG.info("Receivers are shutdown. Start shutting down EventHubManagers"); ExecutorService shutdownExecutorService = Executors.newCachedThreadPool(); List<Future> futureList = new ArrayList<>(); perPartitionEventHubManagers.values() .forEach(ehClientManager -> futureList.add( shutdownExecutorService.submit(() -> ehClientManager.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)))); futureList.forEach(future -> { try { future.get(); } catch (Exception e) { LOG.warn("exception during EventHubManagers shutdown", e); } }); shutdownExecutorService.shutdown(); LOG.info("EventHubManagers are shutdown"); perPartitionEventHubManagers.clear(); perStreamEventHubManagers.clear(); isStarted = false; LOG.info("Event hub system consumer stopped."); }</code><technical_language>string is meant id: name - "Thread dump for EventHubSystemConsumer.PartitionReceiver#close failure"</technical_language>

Target:
public void stop() { LOG.info("Stopping event hub system consumer..."); LOG.info("Start shutting down eventhubs receivers"); ShutdownUtil.boundedShutdown(streamPartitionReceivers.values().stream().map(receiver -> new Runnable() { @Override public void run() { try { receiver.close().get(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOG.error("Failed to shutdown receiver.", e); } } }).collect(Collectors.toList()), "EventHubSystemConsumer.Receiver#close", DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); LOG.info("Start shutting down eventhubs managers"); ShutdownUtil.boundedShutdown(perPartitionEventHubManagers.values().stream().map(manager -> new Runnable() { @Override public void run() { try { manager.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); } catch (Exception e) { LOG.error("Failed to shutdown eventhubs manager.", e); } } }).collect(Collectors.toList()), "EventHubSystemConsumer.ClientManager#close", DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); perPartitionEventHubManagers.clear(); perStreamEventHubManagers.clear(); isStarted = false; LOG.info("Event hub system consumer stopped."); }
Source:
<code>public LedgerHandle createLedgerAdv(final long ledgerId, int ensSize, int writeQuorumSize, int ackQuorumSize, DigestType digestType, byte passwd[], final Map<String, byte[]> customMetadata) throws InterruptedException, BKException{ SyncCreateCallback result = new SyncCreateCallback(); asyncCreateLedgerAdv(ledgerId, ensSize, writeQuorumSize, ackQuorumSize, digestType, passwd, result, null, customMetadata); <START> LedgerHandle lh = (LedgerHandle) SyncCallbackUtils.waitForResult(result); <END> if (lh == null) { LOG.error("Unexpected condition : no ledger handle returned for a success ledger creation"); throw BKException.create(BKException.Code.UnexpectedConditionException); } else if (ledgerId != lh.getId()) { LOG.error("Unexpected condition : Expected ledgerId: but got: {}", ledgerId, lh.getId()); throw BKException.create(BKException.Code.UnexpectedConditionException); } LOG.info("Ensemble: for ledger: {}", lh.getLedgerMetadata().getEnsemble(0L), lh.getId()); return lh; }</code><technical_language>I do need casting here. I this in multiple places</technical_language>

Target:
public LedgerHandle createLedgerAdv(final long ledgerId, int ensSize, int writeQuorumSize, int ackQuorumSize, DigestType digestType, byte passwd[], final Map<String, byte[]> customMetadata) throws InterruptedException, BKException{ CompletableFuture<LedgerHandle> future = new CompletableFuture<>(); SyncCreateCallback result = new SyncCreateCallback(future); asyncCreateLedgerAdv(ledgerId, ensSize, writeQuorumSize, ackQuorumSize, digestType, passwd, result, null, customMetadata); LedgerHandle lh = SyncCallbackUtils.waitForResult(future); if (lh == null) { LOG.error("Unexpected condition : no ledger handle returned for a success ledger creation"); throw BKException.create(BKException.Code.UnexpectedConditionException); } else if (ledgerId != lh.getId()) { LOG.error("Unexpected condition : Expected ledgerId: but got: {}", ledgerId, lh.getId()); throw BKException.create(BKException.Code.UnexpectedConditionException); } LOG.info("Ensemble: for ledger: {}", lh.getLedgerMetadata().getEnsemble(0L), lh.getId()); return lh; }
Source:
<code>private String prepareSkippedObjectsMessage(List<String> skippedObjects, String objectName) { String skippedObjectsMessage = null; if (!skippedObjects.isEmpty()) { skippedObjectsMessage = "These " + objectName + " from extSource were skipped: { "; for (String skippedGroup : skippedObjects) { <START> if (skippedGroup == null) continue; <END> skippedObjectsMessage += skippedObjects + ", "; } skippedObjectsMessage += " }"; } return skippedObjectsMessage; }</code><technical_language>this for skipped groups members, skipped object is defined skippedGroup. skippedObject</technical_language>

Target:
private String prepareSkippedObjectsMessage(List<String> skippedObjects, String objectName) { String skippedObjectsMessage = null; if (!skippedObjects.isEmpty()) { skippedObjectsMessage = "These " + objectName + " from extSource were skipped: { "; for (String skippedObject : skippedObjects) { if (skippedObject == null) continue; skippedObjectsMessage += skippedObjects + ", "; } skippedObjectsMessage += " }"; } return skippedObjectsMessage; }
Source:
<code>default boolean hasParametersOfType(Class<?>... paramTypes) { return getParameters().stream() <START> .map(p -> p.getType() instanceof ClassOrInterfaceType <END> ? ((ClassOrInterfaceType) p.getType()).getName().asString() : p.getType().asString()) .collect(toList()) .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toList())); }</code><technical_language>a nice shorthand for that: <LINK_0></technical_language>

Target:
default boolean hasParametersOfType(Class<?>... paramTypes) { return getParameters().stream() .map(p -> p.getType().toClassOrInterfaceType() .map(NodeWithSimpleName::getNameAsString) .orElse(p.getType().asString())) .collect(toList()) .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toList())); }
Source:
<code>public void set(Object value) throws Exception { if (direction == OUTPUT|| direction == RETURN_VALUE) throw new UnsupportedOperationException("Trying to set value of output parameter "+name); if (value != null) { <START> TypeNormaliser tn = TypeNormaliserFactory.getNormaliser(value.getClass()); <END> if (tn != null) { value = tn.normalise(value); } } cs.setObject(index, value, sqlType, userDefinedTypeName); }</code><technical_language>tabs for indentation here</technical_language>

Target:
public void set(Object value) throws Exception { if (direction == OUTPUT|| direction == RETURN_VALUE) throw new UnsupportedOperationException("Trying to set value of output parameter "+name); cs.setObject(index, toJdbcCompatibleValue(value), sqlType, userDefinedTypeName); }
Source:
<code>public T copyAttribute(T attribute) { try { Class<T> klass = (Class<T>) attribute.getClass(); Constructor<T> constructor = klass.getConstructor(klass); return constructor.newInstance(attribute); } catch (Exception e) { <START> throw new CacheException(e); <END> } }</code><technical_language>a CacheConfigurationException</technical_language>

Target:
public T copyAttribute(T attribute) { try { Class<T> klass = (Class<T>) attribute.getClass(); Constructor<T> constructor = klass.getConstructor(klass); return constructor.newInstance(attribute); } catch (Exception e) { throw new CacheConfigurationException(e); } }
Source:
<code>public CompletableFuture<Void> invoke(boolean success) { if (trace) { <START> log.tracef("After completion callback, success=%d", success); <END> } validator.endInvalidatingKey(lockOwner, key, success); return null; }</code><technical_language>success=%b</technical_language>

Target:
public CompletableFuture<Void> invoke(boolean success) { if (trace) { log.tracef("After completion callback, success=%b", success); } validator.endInvalidatingKey(lockOwner, key, success); return null; }
Source:
<code>@Override protected void writeToSocket(Socket sock, byte[] data, <START> long timeout) throws IOException { <END> if (!blockMsgs) super.writeToSocket(sock, data, timeout); }</code><technical_language>on-lined</technical_language>

Target:
@Override protected void writeToSocket(Socket sock, byte[] data, long timeout) throws IOException { super.writeToSocket(sock, data, timeout); }
Source:
<code>public CharSequence getStr(int col) { <START> return PG_TYPE_TO_NAME.get(PG_TYPE_OIDS.get(row)); <END> }</code><technical_language>PG_TYPE_TO_NAME array (dense)</technical_language>

Target:
public CharSequence getStr(int col) { return PG_TYPE_TO_NAME[row]; }
Source:
<code>public String get(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where("key").is(key)); Datastore result = template.findOne(query, Datastore.class, collectionName); if(result != null){ return result.value; } <START> return null; <END> }</code><technical_language>for this enough: java Query query = Query.query(Criteria.where("_id").is(key)); query.fields().include("value"); return (String) template.findOne(query, Map.class, collectionName).get("value");</technical_language>

Target:
public String get(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where(ID_FIELD).is(key)); query.fields().exclude(ID_FIELD); @SuppressWarnings("unchecked") Map<String, String> result = template.findOne(query, Map.class, collectionName); return result == null ? null : result.get(VALUE); }
Source:
<code>public void start() { running = true; <START> System.out.println("Started"); <END> }</code><technical_language>switch this Logger</technical_language>

Target:
public void start() { running = true; addToLog("[GAME]\tStarted game."); }
Source:
<code>private static void setYValue(int index, double[] y, double value, DisplayType type) { if (type.equals(DisplayType.DELTA)) { y[index] = value; double prevValue = value; if (index > 0) { prevValue = y[index - 1]; } y[index] = value - prevValue; <START> return; <END> } y[index] = value; }</code><technical_language>else instead please</technical_language>

Target:
private static void setYValue(int index, double[] y, double value, DisplayType type) { if (type.equals(DisplayType.DELTA)) { y[index] = value; double prevValue = value; if (index > 0) { prevValue = y[index - 1]; } y[index] = value - prevValue; } else { y[index] = value; } }
Source:
<code>private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] groupIds = aspect.getGroupIds(); int quark = (groupIds.length > 0) ? ss.getQuarkRelativeAndAdd(rootQuark, groupIds) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); <START> ss.modifyAttribute(event.getTimestamp().toNanos(), <END> eventContent == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(eventContent), quark); }</code><technical_language>pass eventContent Long ss now, TmfStateValues a of</technical_language>

Target:
private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] groupIds = aspect.getGroupIds(); int quark = (groupIds.length > 0) ? ss.getQuarkRelativeAndAdd(rootQuark, groupIds) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent == null ? null : eventContent, quark); }
Source:
<code><START> public HttpFields.Mutable getTrailers() <END> { return trailers; }</code><technical_language>this HttpFields return type</technical_language>

Target:
public HttpFields getTrailers() { return trailers; }
Source:
<code>void setBackgroundColor (long handle, GdkColor color) { if (OS.GTK3) { GdkRGBA rgba = null; double alpha = 1.0; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { alpha = 0; Control control = findBackgroundControl(); if (control == null) control = this; color = control.getBackgroundColor(); } } else { alpha = backgroundAlpha; } if (color != null) { <START> rgba = new GdkRGBA (); <END> rgba = display.toGdkRGBA (color); rgba.alpha = alpha / (float)255; } long context = OS.gtk_widget_get_style_context (handle); setBackgroundColor (context, handle, rgba); OS.gtk_style_context_invalidate (context); return; } int index = OS.GTK_STATE_NORMAL; long style = OS.gtk_widget_get_modifier_style (handle); long ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr != 0) OS.g_free (ptr); ptr = 0; String pixmapName = null; int flags = OS.gtk_rc_style_get_color_flags (style, index); if (color != null) { flags |= OS.GTK_RC_BG; pixmapName = "<none>"; } else { flags &= ~OS.GTK_RC_BG; if (backgroundImage == null && (state & PARENT_BACKGROUND) != 0) { pixmapName = "<parent>"; } } if (pixmapName != null) { byte[] buffer = Converter.wcsToMbcs (null, pixmapName, true); ptr = OS.g_malloc (buffer.length); OS.memmove (ptr, buffer, buffer.length); } OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); OS.gtk_rc_style_set_bg (style, index, color); OS.gtk_rc_style_set_color_flags (style, index, flags); modifyStyle (handle, style); }</code><technical_language>display.toGdkRGBA returns null remove "rgba=new GdkRGBA()"</technical_language>

Target:
void setBackgroundColor (long handle, GdkColor color) { if (OS.GTK3) { GdkRGBA rgba = null; double alpha = 1.0; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { alpha = 0; Control control = findBackgroundControl(); if (control == null) control = this; color = control.getBackgroundColor(); } } else { alpha = backgroundAlpha; } if (color != null) { rgba = display.toGdkRGBA (color); rgba.alpha = alpha / (float)255; } long context = OS.gtk_widget_get_style_context (handle); setBackgroundColor (context, handle, rgba); OS.gtk_style_context_invalidate (context); return; } int index = OS.GTK_STATE_NORMAL; long style = OS.gtk_widget_get_modifier_style (handle); long ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr != 0) OS.g_free (ptr); ptr = 0; String pixmapName = null; int flags = OS.gtk_rc_style_get_color_flags (style, index); if (color != null) { flags |= OS.GTK_RC_BG; pixmapName = "<none>"; } else { flags &= ~OS.GTK_RC_BG; if (backgroundImage == null && (state & PARENT_BACKGROUND) != 0) { pixmapName = "<parent>"; } } if (pixmapName != null) { byte[] buffer = Converter.wcsToMbcs (null, pixmapName, true); ptr = OS.g_malloc (buffer.length); OS.memmove (ptr, buffer, buffer.length); } OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); OS.gtk_rc_style_set_bg (style, index, color); OS.gtk_rc_style_set_color_flags (style, index, flags); modifyStyle (handle, style); }
Source:
<code>private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) <START> && !isSameRange(reference.getRange(), included.getRange()) <END> && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); }</code><technical_language>reference.equals(included) work</technical_language>

Target:
private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) && !reference.equals(included) && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); }
Source:
<code>private void testGodMode(boolean isPart) throws IOException { runGodModeRoutine(isPart); writeToFile(OUTPUT_PATH, PLACEHOLDER_CONTENT); runGodModeRoutine(isPart); <START> File file = new File(OUTPUT_PATH); <END> if (!file.delete()) { print("Delete failed: " + file.getAbsolutePath()); file.deleteOnExit(); } }</code><technical_language>I refactor this a method of</technical_language>

Target:
private void testGodMode(boolean isPart) throws Exception { try { verifyHtml(OUTPUT_FILENAME, isPart); signalFailureToDetectException(); } catch (IOException e) { ignoreExpectedException(); } runGodModeRoutine(isPart); writeToFile(OUTPUT_FILEPATH, PLACEHOLDER_CONTENT); try { verifyHtml(OUTPUT_FILENAME, isPart); signalFailureToDetectException(); } catch (AssertionError ae) { ignoreExpectedException(); } runGodModeRoutine(isPart); deleteFile(OUTPUT_FILEPATH); }
Source:
<code>private long findSize(CapacityRange capacityRange) { if (capacityRange.getRequiredBytes() != 0) { return capacityRange.getRequiredBytes(); } else { if (capacityRange.getLimitBytes() != 0) { <START> return Math.min(1000_000_000, capacityRange.getLimitBytes()); <END> } else { return 1000_000_000; } } }</code><technical_language>1000_000_000 configurable</technical_language>

Target:
private long findSize(CapacityRange capacityRange) { if (capacityRange.getRequiredBytes() != 0) { return capacityRange.getRequiredBytes(); } else { if (capacityRange.getLimitBytes() != 0) { return Math.min(defaultVolumeSize, capacityRange.getLimitBytes()); } else { return defaultVolumeSize; } } }