auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public void recognizesExcludedPaths() { <END> ErrorProneOptions options = ErrorProneOptions.processArgs( new String[] {"-XepExcludedPaths:build/generated,other_output"}); Pattern excludedPattern = options.getExcludedPattern(); assertThat(excludedPattern).isNotNull(); assertThat(excludedPattern.matcher("fizz/build/generated/Gen.java").matches()).isTrue(); assertThat(excludedPattern.matcher("fizz/bazz/generated/Gen.java").matches()).isFalse(); assertThat(excludedPattern.matcher("other_output/Gen.java").matches()).isTrue(); assertThat(excludedPattern.matcher("foo/other_output/subdir/Gen.java").matches()).isTrue(); }</code><technical_language>it; is existing test structure I copy</technical_language>

Target:
public void recognizesExcludedPaths() { ErrorProneOptions options = ErrorProneOptions.processArgs( new String[] {"-XepExcludedPaths:(.*/)?(build/generated|other_output)/.*\\.java"}); Pattern excludedPattern = options.getExcludedPattern(); assertThat(excludedPattern).isNotNull(); assertThat(excludedPattern.matcher("fizz/build/generated/Gen.java").matches()).isTrue(); assertThat(excludedPattern.matcher("fizz/bazz/generated/Gen.java").matches()).isFalse(); assertThat(excludedPattern.matcher("fizz/abuild/generated/Gen.java").matches()).isFalse(); assertThat(excludedPattern.matcher("other_output/Gen.java").matches()).isTrue(); assertThat(excludedPattern.matcher("foo/other_output/subdir/Gen.java").matches()).isTrue(); assertThat(excludedPattern.matcher("foo/other_output/subdir/Gen.cpp").matches()).isFalse(); }
Source:
<code>public boolean addLocationInformation(final String readName, final PhysicalLocation loc) { <START> if (this.readNameRegex == this.DEFAULT_READ_NAME_REGEX) { <END> final int fields = ReadNameParsingUtils.getRapidDefaultReadNameRegexSplit(readName, ':', tmpLocationFields); if (!(fields == 5 || fields == 7)) { throw new PicardException(String.format(" READ_NAME_REGEX '%s' did not match read name '%s'. " , this.readNameRegex, readName)); } final int offset = fields == 7 ? 2 : 0; loc.setTile((short) tmpLocationFields[offset + 2]); loc.setX(tmpLocationFields[offset + 3]); loc.setY(tmpLocationFields[offset + 4]); return true; } else if (this.readNameRegex == null) { return false; } else { if (this.readNamePattern == null) this.readNamePattern = Pattern.compile(this.readNameRegex); final Matcher m = this.readNamePattern.matcher(readName); if (m.matches()) { loc.setTile((short) Integer.parseInt(m.group(1))); loc.setX(Integer.parseInt(m.group(2))); loc.setY(Integer.parseInt(m.group(3))); return true; } else { throw new PicardException(String.format("READ_NAME_REGEX '%s' did not match read name '%s'. ", this.readNameRegex, readName)); } } }</code><technical_language>Lots of unnecessary this in this file, RHS of expression is undesirable for static member access</technical_language>

Target:
public boolean addLocationInformation(final String readName, final PhysicalLocation loc) { if (readNameRegex == DEFAULT_READ_NAME_REGEX) { final int fields = ReadNameParsingUtils.getRapidDefaultReadNameRegexSplit(readName, ':', tmpLocationFields); if (!(fields == 5 || fields == 7)) { throw new PicardException(String.format(" READ_NAME_REGEX '%s' did not match read name '%s'. " , this.readNameRegex, readName)); } final int offset = fields == 7 ? 2 : 0; loc.setTile((short) tmpLocationFields[offset + 2]); loc.setX(tmpLocationFields[offset + 3]); loc.setY(tmpLocationFields[offset + 4]); return true; } else if (readNameRegex == null) { return false; } else { if (readNamePattern == null) readNamePattern = Pattern.compile(readNameRegex); final Matcher m = readNamePattern.matcher(readName); if (m.matches()) { loc.setTile((short) Integer.parseInt(m.group(1))); loc.setX(Integer.parseInt(m.group(2))); loc.setY(Integer.parseInt(m.group(3))); return true; } else { throw new PicardException(String.format("READ_NAME_REGEX '%s' did not match read name '%s'. ", readNameRegex, readName)); } } }
Source:
<code>private static String getRobolectricVersion() { try { final Properties properties = new Properties(); <START> properties.load(SdkVersion.class.getClassLoader().getResourceAsStream("robolectric.version.properties")); <END> return properties.getProperty("robolectric.version"); } catch (IOException e) { throw new RuntimeException("Error determining Robolectric version: " + e.getMessage()); } }</code><technical_language>prefer a force push a single commit</technical_language>

Target:
private static String getRobolectricVersion() { ClassLoader classLoader = SdkVersion.class.getClassLoader(); try (InputStream is = classLoader.getResourceAsStream("robolectric-version.properties")) { final Properties properties = new Properties(); properties.load(is); return properties.getProperty("robolectric.version"); } catch (IOException e) { throw new RuntimeException("Error determining Robolectric version: " + e.getMessage()); } }
Source:
<code>public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (extensionPoint.equals(AVRO_SCHEMA)) { AvroSchemaDescriptor descriptor = (AvroSchemaDescriptor) contribution; <START> InputStream stream = getClass().getClassLoader().getResourceAsStream(descriptor.file); <END> if (stream == null) { log.error(String.format("Could not load stream for file %s.", descriptor.file)); return; } try { schemaStoreService.addSchema(new Schema.Parser().parse(stream)); } catch (IOException e) { log.error(String.format("Could not load stream for file %s. Error message: %s", descriptor.file, e.getMessage())); } } }</code><technical_language>load data classloader contributor.getRuntimeContext().getResource(). clean this resource loading stuff in future, declarative instead</technical_language>

Target:
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) { if (extensionPoint.equals(SCHEMA_XP)) { AvroSchemaDescriptor descriptor = (AvroSchemaDescriptor) contribution; try { URL url = contributor.getRuntimeContext().getResource(descriptor.file); InputStream stream = url == null ? null : url.openStream(); if (stream == null) { log.error(String.format("Could not load stream for file %s.", descriptor.file)); return; } schemaStoreService.addSchema(new Schema.Parser().parse(stream)); } catch (IOException e) { log.error(String.format("Could not load stream for file %s. Error message: %s", descriptor.file, e.getMessage())); } } else { throw new RuntimeServiceException("Unknown extension point: " + extensionPoint); } }
Source:
<code>public void shouldSendLargeMessage() throws DotDataException, DotSecurityException, InterruptedException { final ReindexEntry reindexEntry = mock(ReindexEntry.class); final String cause = "cause"; final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies(); final Role adminRole = mock(Role.class); when(roleAPIMock.loadCMSAdminRole()).thenReturn(adminRole); final User user = mock(User.class); when(user.getUserId()).thenReturn("1"); when(roleAPIMock.findUsersForRole(adminRole)).thenReturn(list(user)); try { putReadOnly(indiciesInfo.getWorking(), true); putReadOnly(indiciesInfo.getLive(), false); esReadOnlyMonitor.start(reindexEntry, cause); <START> Thread.sleep(100); <END> checkLargeMessageSent(indiciesInfo, user); assertEquals(false, ESIndexUtil.isReadOnly(indiciesInfo.getWorking(), indiciesInfo.getLive())); } finally { putReadOnly(indiciesInfo.getWorking(), false); } }</code><technical_language>is another monitor is ready? this sleep a race condition</technical_language>

Target:
public void shouldSendLargeMessage() throws DotDataException, DotSecurityException, InterruptedException, IOException { final String message = "message"; final IndiciesInfo indiciesInfo = APILocator.getIndiciesAPI().loadIndicies(); final Role adminRole = mock(Role.class); when(roleAPIMock.loadCMSAdminRole()).thenReturn(adminRole); final User user = mock(User.class); when(user.getUserId()).thenReturn("1"); when(roleAPIMock.findUsersForRole(adminRole)).thenReturn(list(user)); try { setReadOnly(indiciesInfo.getWorking(), true); setReadOnly(indiciesInfo.getLive(), false); esReadOnlyMonitor.start(message); Thread.sleep(100); checkLargeMessageSent(user); assertEquals(false, ElasticsearchUtil.isAnyReadOnly(indiciesInfo.getWorking(), indiciesInfo.getLive())); } finally { setReadOnly(indiciesInfo.getWorking(), false); } }
Source:
<code>public static void recurseDir(File root, TreeSet<String> strings, IProgressMonitor monitor) { if (!root.exists() || !root.isDirectory()) { return; } File[] children = root.listFiles(); for (File child : children) { if (monitor.isCanceled()) { return; } if (child.exists() && child.isDirectory() <START> && child.getName().equals(".git")) { END> strings.add(child.getAbsolutePath()); return; } if (child.isDirectory()) { monitor.setTaskName(child.getPath()); recurseDir(child, strings, monitor); } } }</code><technical_language>Constants.DOT_GIT. if want test a directory is a Git repository, RepositoryCache.FileKey.isGitRepository()</technical_language>

Target:
public static void recurseDir(File root, TreeSet<String> strings, IProgressMonitor monitor) { if (!root.exists() || !root.isDirectory()) { return; } File[] children = root.listFiles(); for (File child : children) { if (monitor.isCanceled()) { return; } if (child.exists() && child.isDirectory() && RepositoryCache.FileKey.isGitRepository(child)) { strings.add(child.getAbsolutePath()); return; } if (child.isDirectory()) { monitor.setTaskName(child.getPath()); recurseDir(child, strings, monitor); } } }
Source:
<code>public AsmInstrumentingClassLoader(Setup setup, URL... urls) { super(AsmInstrumentingClassLoader.class.getClassLoader()); this.setup = setup; this.urls = new URLClassLoader(urls, null); classesToRemap = convertToSlashes(setup.classNameTranslations()); methodsToIntercept = convertToSlashes(setup.methodsToIntercept()); for (URL url : urls) { <START> System.out.println("DEBUG: Loading android sdk from " + url); <END> } }</code><technical_language>_sigh_ need a logging strategy</technical_language>

Target:
public AsmInstrumentingClassLoader(Setup setup, URL... urls) { super(AsmInstrumentingClassLoader.class.getClassLoader()); this.setup = setup; this.urls = new URLClassLoader(urls, null); classesToRemap = convertToSlashes(setup.classNameTranslations()); methodsToIntercept = convertToSlashes(setup.methodsToIntercept()); }
Source:
<code>public TestThriftDistributedQueriesIndexed() throws Exception { super(() -> createThriftQueryRunner(2, 2, true)); <START> Logging.initialize().setLevel("com.facebook.nifty.core.NiftyExceptionLogger", OFF); <END> }</code><technical_language>turn this test finishes</technical_language>

Target:
public TestThriftDistributedQueriesIndexed() throws Exception { super(() -> createThriftQueryRunner(2, 2, true)); Logging logging = Logging.initialize(); previousLogLevel = logging.getLevel(NIFTY_LOGGER_NAME); logging.setLevel(NIFTY_LOGGER_NAME, OFF); }
Source:
<code>protected int parseWithoutValidation(final String flag) { SamFlagField.validate(flag, STRING); int value = 0; for (int i = 0; i < flag.length(); i++) { switch (flag.charAt(i)) { case 'p': value |= SAMFlag.READ_PAIRED.flag; break; case 'P': value |= SAMFlag.PROPER_PAIR.flag; break; case 'u': value |= SAMFlag.READ_UNMAPPED.flag; break; case 'U': value |= SAMFlag.MATE_UNMAPPED.flag; break; case 'r': value |= SAMFlag.READ_REVERSE_STRAND.flag; break; case 'R': value |= SAMFlag.MATE_REVERSE_STRAND.flag; break; case '1': value |= SAMFlag.FIRST_OF_PAIR.flag; break; case '2': value |= SAMFlag.SECOND_OF_PAIR.flag; break; case 's': value |= SAMFlag.NOT_PRIMARY_ALIGNMENT.flag; break; <START> case 'q': value |= SAMFlag.READ_FAILS_VENDOR_QUALITY_CHECK.flag; break; <END> case 'd': value |= SAMFlag.DUPLICATE_READ.flag; break; case 'S': value |= SAMFlag.SUPPLEMENTARY_ALIGNMENT.flag; break; case 'f': case 'F': case 'm': case 'M': case '_': break; default: throw new SAMFormatException("Unknown flag character '" + flag.charAt(i) + "' in flag '" + flag + "'"); } } return value; }</code><technical_language>this x well</technical_language>

Target:
protected int parseWithoutValidation(final String flag) { throw new SAMFormatException("NONE not allowed for the SamFlagField when reading the SAM flag field."); }
Source:
<code>private void setListeners() { fabPlus.setOnClickListener(view -> animateFAB(isFabOpen)); fabCamera.setOnClickListener(view -> controller.initiateCameraPick(getActivity(), CAMERA_UPLOAD_REQUEST_CODE)); <START> fabGallery.setOnClickListener(view -> controller.initiateGalleryPick(getActivity(), 5, GALLERY_UPLOAD_REQUEST_CODE)); <END> }</code><technical_language>great if extract this 5 a constant field, easier understand param</technical_language>

Target:
private void setListeners() { fabPlus.setOnClickListener(view -> animateFAB(isFabOpen)); fabCamera.setOnClickListener(view -> controller.initiateCameraPick(this, CAMERA_UPLOAD_REQUEST_CODE)); fabGallery.setOnClickListener(view -> controller.initiateGalleryPick(this, MULTIPLE_UPLOAD_IMAGE_LIMIT, GALLERY_UPLOAD_REQUEST_CODE)); }
Source:
<code>public RawBytes value( long seed ) { RawBytes value = newValue(); <START> value.bytes = ByteBuffer.allocate( 17 ).putLong( seed ).putLong( seed ).array(); <END> return value; }</code><technical_language>17, is some magic needs byte bigger something, is for fun</technical_language>

Target:
public RawBytes value( long seed ) { RawBytes value = newValue(); value.bytes = fromSeed( seed ); return value; }
Source:
<code><START> private Alert[] getAlertNodes() { <END> ExtensionAlert extAlert = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAlert.class); DefaultMutableTreeNode node = (DefaultMutableTreeNode) extAlert.getAlertPanel().getTreeAlert().getLastSelectedPathComponent(); TreePath[] paths = extAlert.getAlertPanel().getTreeAlert().getSelectionPaths(); Alert[] alertNodes = new Alert[paths.length]; for(int i = 0; i < paths.length; i++ ) { DefaultMutableTreeNode alertNode = (DefaultMutableTreeNode)paths[i].getLastPathComponent(); alertNodes[i] = (Alert)alertNode.getUserObject(); } return alertNodes; }</code><technical_language>This changed List<Alert> instead</technical_language>

Target:
private Set<Alert> getAlertNodes() { TreePath[] paths = this.extAlert.getAlertPanel().getTreeAlert().getSelectionPaths(); HashSet<Alert> alertNodes = new HashSet<Alert>(); for(int i = 0; i < paths.length; i++ ) { DefaultMutableTreeNode alertNode = (DefaultMutableTreeNode)paths[i].getLastPathComponent(); if(alertNode.getChildCount() == 0) { alertNodes.add((Alert)alertNode.getUserObject()); continue; } for(int j = 0; j < alertNode.getChildCount(); j++ ) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)alertNode.getChildAt(j); alertNodes.add((Alert)node.getUserObject()); } } return alertNodes; }
Source:
<code>public static List<TaskRecord> queryTaskTable(Connection connection, Timestamp ts, String schema, String tableName, PTable.TaskType taskType, String tenantId, String indexName) throws SQLException { String taskQuery = "SELECT " + PhoenixDatabaseMetaData.TASK_TS + ", " + PhoenixDatabaseMetaData.TENANT_ID + ", " + PhoenixDatabaseMetaData.TABLE_SCHEM + ", " + PhoenixDatabaseMetaData.TABLE_NAME + ", " + PhoenixDatabaseMetaData.TASK_STATUS + ", " + PhoenixDatabaseMetaData.TASK_TYPE + ", " + PhoenixDatabaseMetaData.TASK_PRIORITY + ", " + PhoenixDatabaseMetaData.TASK_DATA + " FROM " + PhoenixDatabaseMetaData.SYSTEM_TASK_NAME; taskQuery += " WHERE " + PhoenixDatabaseMetaData.TABLE_NAME + " ='" + tableName + "' AND " + PhoenixDatabaseMetaData.TASK_TYPE + "=" + taskType.getSerializedValue(); if (!Strings.isNullOrEmpty(tenantId)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TENANT_ID + "='" + tenantId + "' "; } if (!Strings.isNullOrEmpty(schema)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TABLE_SCHEM + "='" + schema + "' "; } if (!Strings.isNullOrEmpty(indexName)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TASK_DATA + " LIKE '%" + indexName + "%'"; } List<TaskRecord> result = populateTasks(connection, taskQuery); if (ts != null) { <START> result.removeIf(p -> !p.getTimeStamp().equals(ts)); <END> } return result; }</code><technical_language>This complain for some branches need source compatible Java 7 instead of 8</technical_language>

Target:
public static List<TaskRecord> queryTaskTable(Connection connection, Timestamp ts, String schema, String tableName, PTable.TaskType taskType, String tenantId, String indexName) throws SQLException { String taskQuery = "SELECT " + PhoenixDatabaseMetaData.TASK_TS + ", " + PhoenixDatabaseMetaData.TENANT_ID + ", " + PhoenixDatabaseMetaData.TABLE_SCHEM + ", " + PhoenixDatabaseMetaData.TABLE_NAME + ", " + PhoenixDatabaseMetaData.TASK_STATUS + ", " + PhoenixDatabaseMetaData.TASK_TYPE + ", " + PhoenixDatabaseMetaData.TASK_PRIORITY + ", " + PhoenixDatabaseMetaData.TASK_DATA + " FROM " + PhoenixDatabaseMetaData.SYSTEM_TASK_NAME; taskQuery += " WHERE " + PhoenixDatabaseMetaData.TABLE_NAME + " ='" + tableName + "' AND " + PhoenixDatabaseMetaData.TASK_TYPE + "=" + taskType.getSerializedValue(); if (!Strings.isNullOrEmpty(tenantId)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TENANT_ID + "='" + tenantId + "' "; } if (!Strings.isNullOrEmpty(schema)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TABLE_SCHEM + "='" + schema + "' "; } if (!Strings.isNullOrEmpty(indexName)) { taskQuery += " AND " + PhoenixDatabaseMetaData.TASK_DATA + " LIKE '%" + indexName + "%'"; } List<TaskRecord> taskRecords = populateTasks(connection, taskQuery); List<TaskRecord> result = new ArrayList<TaskRecord>(); if (ts != null) { for (TaskRecord tr : taskRecords) { if (tr.getTimeStamp().equals(ts)) { result.add(tr); } } } else { result = taskRecords; } return result; }
Source:
<code>public RetryBudgetImpl(String name, RetryConfig config) { this.name = name; this.config = config; this.maxAttempts = config.getMaxAttempts(); this.intervalFunction = config.getIntervalFunction(); this.exceptionPredicate = config.getExceptionPredicate(); this.bufferSize = config.getBufferSize(); <START> this._bufferSize = config.getBufferSize(); <END> this.retryThreshold = config.getRetryThreshold(); this.eventProcessor = new RetryEventProcessor(); this.succeededAfterRetryCounter = new LongAdder(); this.failedAfterRetryCounter = new LongAdder(); this.succeededWithoutRetryCounter = new LongAdder(); this.failedWithoutRetryCounter = new LongAdder(); this.metrics = new RetryMetricsImpl(succeededAfterRetryCounter, failedAfterRetryCounter, succeededWithoutRetryCounter, failedWithoutRetryCounter); this.sleepFunction = config.getSleepFunction(); this.ringBitSet = new RingBitSet(bufferSize); }</code><technical_language>find a name for _bufferSize</technical_language>

Target:
public RetryBudgetImpl(String name, RetryConfig config) { this.name = name; this.config = config; this.maxAttempts = config.getMaxAttempts(); this.intervalFunction = config.getIntervalFunction(); this.exceptionPredicate = config.getExceptionPredicate(); this.bufferSize = config.getBufferSize(); this.retryThreshold = config.getRetryThreshold(); this.eventProcessor = new RetryEventProcessor(); this.succeededAfterRetryCounter = new LongAdder(); this.failedAfterRetryCounter = new LongAdder(); this.succeededWithoutRetryCounter = new LongAdder(); this.failedWithoutRetryCounter = new LongAdder(); this.metrics = new RetryMetricsImpl(succeededAfterRetryCounter, failedAfterRetryCounter, succeededWithoutRetryCounter, failedWithoutRetryCounter); this.ringBitSet = new RingBitSet(config.getBufferSize()); this.sleepFunction = config.getSleepFunction(); }
Source:
<code>public boolean getUseTorForBitcoinJ() { var usableLocalNodePresent = localBitcoinNode.safeIsUsable(); <START> <END> if ((!Config.baseCurrencyNetwork().isMainnet() || usableLocalNodePresent) && !config.useTorForBtcOptionSetExplicitly) return false; else return prefPayload.isUseTorForBitcoinJ(); }</code><technical_language>Blank line</technical_language>

Target:
public boolean getUseTorForBitcoinJ() { if ((!Config.baseCurrencyNetwork().isMainnet() || localBitcoinNode.shouldBeUsed()) && !config.useTorForBtcOptionSetExplicitly) return false; else return prefPayload.isUseTorForBitcoinJ(); }
Source:
<code>private void layoutAndCenterShell() { Point prefSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); prefSize.y += 50; shell.setSize( prefSize ); <START> Rectangle parentSize = parent.getDisplay().getBounds(); <END> int locationX = ( parentSize.width - prefSize.x ) / 2 + parentSize.x; int locationY = ( parentSize.height - prefSize.y ) / 2 + parentSize.y; shell.setLocation( locationX, locationY ); }</code><technical_language>Rename displaySize similar FileDialog</technical_language>

Target:
private void layoutAndCenterShell() { Point prefSize = shell.computeSize( SWT.DEFAULT, SWT.DEFAULT ); prefSize.y += 50; shell.setSize( prefSize ); Rectangle displaySize = parent.getDisplay().getBounds(); int locationX = ( displaySize.width - prefSize.x ) / 2 + displaySize.x; int locationY = ( displaySize.height - prefSize.y ) / 2 + displaySize.y; shell.setLocation( locationX, locationY ); }
Source:
<code>public void testJsonToCSV() { String row1 = "id, query, queryType, requestId, principalName, status, createdOn, updatedOn, asyncAfterSeconds, resultType, result"; <START> String row2 = "\"edc4a871-dff2-4054-804e-d80075cf827d\", \"/group?sort=commonName&fields%5Bgroup%5D=commonName,description\", \"GRAPHQL_V1_0\""; <END> String row2End = "10.0, \"CSV\", null"; TableExport queryObj = new TableExport(); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.CSV); PersistentResource resource = mock(PersistentResource.class); when(resource.getObject()).thenReturn(queryObj); TableExportThread queryThread = new TableExportThread(queryObj, engine, exporter); queryThread.incrementRecordCount(); String output = queryThread.convertToCSV(resource); assertEquals(true, output.startsWith(row1)); assertEquals(true, output.contains(row2)); assertEquals(true, output.endsWith(row2End)); }</code><technical_language>is a confusing rows match query. consistent</technical_language>

Target:
public void testJsonToCSV() { String row1 = "id, query, queryType, requestId, principalName, status, createdOn, updatedOn, asyncAfterSeconds, resultType, result"; String row2 = "\"edc4a871-dff2-4054-804e-d80075cf827d\", \"/tableExport\", \"GRAPHQL_V1_0\""; String row2End = "10.0, \"CSV\", null"; TableExport queryObj = new TableExport(); String query = "/tableExport"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.GRAPHQL_V1_0); queryObj.setResultType(ResultType.CSV); PersistentResource resource = mock(PersistentResource.class); when(resource.getObject()).thenReturn(queryObj); TableExportThread queryThread = new TableExportThread(queryObj, engine, exporter); queryThread.incrementRecordCount(); String output = queryThread.convertToCSV(resource); assertEquals(true, output.startsWith(row1)); assertEquals(true, output.contains(row2)); assertEquals(true, output.endsWith(row2End)); }
Source:
<code><START> public Map<Dimension, List<SchemaGraph.JoinPath>> pruneFactPaths( <END> CubeInterface cube, final CandidateFact cfact) { Map<Dimension, List<SchemaGraph.JoinPath>> prunedPaths = new HashMap<Dimension, List<SchemaGraph.JoinPath>>(); for (Map.Entry<Dimension, List<SchemaGraph.JoinPath>> ppaths : allPaths.entrySet()) { prunedPaths.put(ppaths.getKey(), new ArrayList<SchemaGraph.JoinPath>(ppaths.getValue())); List<SchemaGraph.JoinPath> paths = prunedPaths.get(ppaths.getKey()); for (int i = 0; i < paths.size(); i++) { SchemaGraph.JoinPath jp = paths.get(i); List<String> cubeCols = jp.getColumnsForTable((AbstractCubeTable) cube); if (cubeCols != null && !cfact.getColumns().containsAll(cubeCols)) { LOG.info("Removing join path:" + jp + " as columns :" + cubeCols + " dont exist"); paths.remove(i); i--; } } } pruneEmptyPaths(prunedPaths); return prunedPaths; }</code><technical_language>mark this private in this class</technical_language>

Target:
private Map<Dimension, List<SchemaGraph.JoinPath>> pruneFactPaths( CubeInterface cube, final CandidateFact cfact) { Map<Dimension, List<SchemaGraph.JoinPath>> prunedPaths = new HashMap<Dimension, List<SchemaGraph.JoinPath>>(); for (Map.Entry<Dimension, List<SchemaGraph.JoinPath>> ppaths : allPaths.entrySet()) { prunedPaths.put(ppaths.getKey(), new ArrayList<SchemaGraph.JoinPath>(ppaths.getValue())); List<SchemaGraph.JoinPath> paths = prunedPaths.get(ppaths.getKey()); for (int i = 0; i < paths.size(); i++) { SchemaGraph.JoinPath jp = paths.get(i); List<String> cubeCols = jp.getColumnsForTable((AbstractCubeTable) cube); if (cubeCols != null && !cfact.getColumns().containsAll(cubeCols)) { LOG.info("Removing join path:" + jp + " as columns :" + cubeCols + " dont exist"); paths.remove(i); i--; } } } pruneEmptyPaths(prunedPaths); return prunedPaths; }
Source:
<code>public void afterStart() { <START> processorLifecycleListener.afterStart(); <END> if (numProcessorsToStart.decrementAndGet() == 0) { appStatus = ApplicationStatus.Running; } }</code><technical_language>end of method status updated</technical_language>

Target:
public void afterStart() { if (numProcessorsToStart.decrementAndGet() == 0) { appStatus = ApplicationStatus.Running; } userDefinedProcessorLifecycleListener.afterStart(); }
Source:
<code>public void testOrderDocument() throws OperationException { assertEquals(Long.valueOf(0), file11.getPos()); assertEquals(Long.valueOf(1), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); <START> <END> moveBefore(file12, file11); assertEquals(Long.valueOf(1), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); moveBefore(file11, file13); assertEquals(Long.valueOf(1), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); moveBefore(file13, file11); assertEquals(Long.valueOf(2), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(1), file13.getPos()); }</code><technical_language>fail here, avoiding a return statement</technical_language>

Target:
public void testOrderDocument() throws OperationException { assertEquals(Long.valueOf(0), file11.getPos()); assertEquals(Long.valueOf(1), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); assertEquals(Long.valueOf(3), file14.getPos()); assertEquals(Long.valueOf(4), file15.getPos()); moveBefore(file12, file11); assertEquals(Long.valueOf(1), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); assertEquals(Long.valueOf(3), file14.getPos()); assertEquals(Long.valueOf(4), file15.getPos()); moveBefore(file11, file13); assertEquals(Long.valueOf(1), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(2), file13.getPos()); assertEquals(Long.valueOf(3), file14.getPos()); assertEquals(Long.valueOf(4), file15.getPos()); moveBefore(file13, file11); assertEquals(Long.valueOf(2), file11.getPos()); assertEquals(Long.valueOf(0), file12.getPos()); assertEquals(Long.valueOf(1), file13.getPos()); assertEquals(Long.valueOf(3), file14.getPos()); assertEquals(Long.valueOf(4), file15.getPos()); moveBefore(file12, null); assertEquals(Long.valueOf(1), file11.getPos()); assertEquals(Long.valueOf(4), file12.getPos()); assertEquals(Long.valueOf(0), file13.getPos()); assertEquals(Long.valueOf(2), file14.getPos()); assertEquals(Long.valueOf(3), file15.getPos()); }
Source:
<code>public String createSocketBinding() throws CommandFailedException, IOException { String name = "UndertowSocketBinding_" + RandomStringUtils.randomAlphanumeric(6); try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { client.apply(new AddSocketBinding.Builder(name) <START> .port(AvailablePortFinder.getNextAvailable()) <END> .build()); } return name; }</code><technical_language>give ephemeral port numbers new java.net.ServerSocket(0) OK guaranteed. good idea log selected port number. WDYT</technical_language>

Target:
public String createSocketBinding() throws CommandFailedException, IOException { String name = "UndertowSocketBinding_" + RandomStringUtils.randomAlphanumeric(6); try (OnlineManagementClient client = ManagementClientProvider.createOnlineManagementClient()) { int port = AvailablePortFinder.getNextAvailable(1024); log.info("Obtained port for socket binding '" + name + "' is " + port); client.apply(new AddSocketBinding.Builder(name) .port(port) .build()); } return name; }
Source:
<code>private static int runCommandDir(final File dir, final String... args) throws IOException { try { if (MOPProcessor.verbose) { System.out.println(dir.toString() + ": " + Arrays.asList(args).toString()); } final ProcessBuilder builder = new ProcessBuilder(); builder.command(args).directory(dir); if (MOPProcessor.verbose) { builder.inheritIO(); } else { builder.redirectErrorStream(true); } final Process proc = builder.start(); if (!MOPProcessor.verbose) { final StringWriter writer = new StringWriter(); new Thread(new Runnable() { public void run() { try { IOUtils.copy(proc.getInputStream(), writer); } catch (IOException e) { <START> e.printStackTrace(); <END> } } }).start(); } return proc.waitFor(); } catch (InterruptedException ie) { ie.printStackTrace(); return -1; } }</code><technical_language>This is acceptable response IO exception. investigate is for errors try do similar, users get a friendly error message in this case a stack trace</technical_language>

Target:
private static int runCommandDir(final File dir, final String... args) throws IOException { try { if (MOPProcessor.verbose) { System.out.println(dir.toString() + ": " + Arrays.asList(args).toString()); } final ProcessBuilder builder = new ProcessBuilder(); builder.command(args).directory(dir); if (MOPProcessor.verbose) { builder.inheritIO(); } else { builder.redirectErrorStream(true); } final Process proc = builder.start(); if (!MOPProcessor.verbose) { final StringWriter writer = new StringWriter(); new Thread(new Runnable() { public void run() { try { IOUtils.copy(proc.getInputStream(), writer); } catch (IOException e) { System.err.println("Exception in reading subprocess output: " + e.getMessage()); } } }).start(); } return proc.waitFor(); } catch (InterruptedException ie) { ie.printStackTrace(); return -1; } }
Source:
<code>public Category findByVariable(final String variable, final User user, final boolean respectFrontendRoles) throws DotDataException, DotSecurityException { final Category category = categoryFactory.findByVar(variable); <START> if(!InodeUtils.isSet(category.getCategoryId())) <END> return null; if(!permissionAPI.doesUserHavePermission(category, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles)) throw new DotSecurityException("User doesn't have permission to use this category = " + category.getInode()); return category; }</code><technical_language>curly brackets if is line</technical_language>

Target:
public Category findByVariable(final String variable, final User user, final boolean respectFrontendRoles) throws DotDataException, DotSecurityException { final Category category = categoryFactory.findByVar(variable); if(!InodeUtils.isSet(category.getCategoryId())) { return null; } if(!permissionAPI.doesUserHavePermission(category, PermissionAPI.PERMISSION_USE, user, respectFrontendRoles)) { throw new DotSecurityException("User doesn't have permission to use this category = " + category.getInode()); } return category; }
Source:
<code>public CANEncoder(String name, int id, boolean reverseDirection, double distancePerPulse) { super(name, id); this.reverseDirection = reverseDirection; <START> this.distancePerPulse = distancePerPulse; <END> this.offset = 0.0; }</code><technical_language>setCustomPIDSourceType instead</technical_language>

Target:
public CANEncoder(String name, int id, boolean reverseDirection, double distancePerPulse) { super(name, id); this.reverseDirection = reverseDirection; this.distancePerPulse = distancePerPulse; this.offset = 0.0; setCustomPIDSourceType(CustomPIDSourceType.kDisplacement); }
Source:
<code>public void notifyChanged(Notification notification) { if (Notification.SET == notification.getEventType()) { Object feature = notification.getFeature(); if (BasePackage.Literals.NAMED_ELEMENT__NAME.equals(feature)) { suppressModifyEvent = true; nameLabel.setText(notification.getNewStringValue()); <START> suppressModifyEvent = false; <END> } } }</code><technical_language>enough check if new name name different, set if equal, avoid endless notification cycles</technical_language>

Target:
public void notifyChanged(Notification notification) { if (Notification.SET == notification.getEventType()) { if (BasePackage.Literals.NAMED_ELEMENT__NAME.equals(notification.getFeature())) { nameLabel.setText(notification.getNewStringValue()); } } }
Source:
<code>private void findFragmentReferences(ArrayList<TextFileChange> changes, IProgressMonitor monitor) throws CoreException { BundleDescription[] fragments = fDesc.getFragments(); SubMonitor subMonitor = SubMonitor.convert(monitor, "", fragments.length); String id = fDesc.getSymbolicName(); for (int i = 0; i < fragments.length; i++) { IPluginModelBase base = PluginRegistry.findModel(fragments[i]); if (base instanceof IFragmentModel && id.equals(((IFragmentModel) (base)).getFragment().getPluginId())) { CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(base, Constants.FRAGMENT_HOST, id, fNewId); <START> op.run(subMonitor.newChild(1)); <END> TextFileChange change = op.getChange(); if (change != null) changes.add(change); } else subMonitor.worked(1); } }</code><technical_language>consider allocating this child monitor unconditionally start of for loop's iteration removing else branch</technical_language>

Target:
private void findFragmentReferences(ArrayList<TextFileChange> changes, IProgressMonitor monitor) throws CoreException { BundleDescription[] fragments = fDesc.getFragments(); SubMonitor subMonitor = SubMonitor.convert(monitor, fragments.length); String id = fDesc.getSymbolicName(); for (int i = 0; i < fragments.length; i++) { IPluginModelBase base = PluginRegistry.findModel(fragments[i]); SubMonitor iterationMonitor = subMonitor.newChild(1); if (base instanceof IFragmentModel && id.equals(((IFragmentModel) (base)).getFragment().getPluginId())) { CreateHeaderChangeOperation op = new CreateHeaderChangeOperation(base, Constants.FRAGMENT_HOST, id, fNewId); op.run(iterationMonitor); TextFileChange change = op.getChange(); if (change != null) { changes.add(change); } } } }
Source:
<code>private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } final Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == HttpStatus.BAD_REQUEST || errorCode == HttpStatus.CONFLICT) && !android.text.TextUtils.isEmpty(errorBody)) { try { final Type objectMapType = new TypeToken<HashMap<String, Object>>() { }.getType(); final Type fieldErrorListType = new TypeToken<List<RegisterResponseFieldError>>() { }.getType(); final HashMap<String, Object> body = gson.fromJson(errorBody, objectMapType); final FormFieldMessageBody errorResponse = new FormFieldMessageBody(); for (String key : body.keySet()) { <START> final Object fieldError = body.get(key); if (fieldError instanceof Collection<?>) { errorResponse.put(key, gson.fromJson(gson.toJson(fieldError), fieldErrorListType)); } } if (errorResponse.size() > 0) { throw new RegistrationException(errorResponse); } } catch (JsonSyntaxException ex) { } <END> } throw new HttpStatusException(response); } }</code><technical_language>code more descriptive understandable: java final Object fieldError = body.get(key); if (fieldError instanceof Collection<?>) { /* conversion of errorBody JSON String Map<String, Object> malformed JSON properties of key & pairs i.e. removed quotations encapsulating key & pairs. code line is required transform valid JSON. */ final String fieldErrorJson = gson.toJson(fieldError); errorResponse.put(key, gson.fromJson(fieldErrorJson, fieldErrorListType)); }</technical_language>

Target:
private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } final Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == HttpStatus.BAD_REQUEST || errorCode == HttpStatus.CONFLICT) && !android.text.TextUtils.isEmpty(errorBody)) { try { final Type objectMapType = new TypeToken<HashMap<String, Object>>() { }.getType(); final Type fieldErrorListType = new TypeToken<List<RegisterResponseFieldError>>() { }.getType(); final HashMap<String, Object> body = gson.fromJson(errorBody, objectMapType); final FormFieldMessageBody errorResponse = new FormFieldMessageBody(); for (String key : body.keySet()) { final Object fieldError = body.get(key); if (fieldError instanceof Collection<?>) { final String fieldErrorJson = gson.toJson(fieldError); errorResponse.put(key, gson.fromJson(fieldErrorJson, fieldErrorListType)); } } if (errorResponse.size() > 0) { throw new RegistrationException(errorResponse); } } catch (JsonSyntaxException ex) { } } throw new HttpStatusException(response); } }
Source:
<code>public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } <START> pws = (ProgramWorkflowService) applicationContext.getBean("programWorkflowDAO"); <END> }</code><technical_language>testing ProgramWorkflowService DAO</technical_language>

Target:
public void runBeforeEachTest() { executeDataSet(CREATE_PATIENT_PROGRAMS_XML); if (pws == null) { pws = Context.getProgramWorkflowService(); adminService = Context.getAdministrationService(); encounterService = Context.getEncounterService(); cs = Context.getConceptService(); } pws = (ProgramWorkflowService) applicationContext.getBean("programWorkflowService"); }
Source:
<code>public SignatureToolTipManager(DocDisplay docDisplay) { RStudioGinjector.INSTANCE.injectMembers(this); toolTip_ = new RCompletionToolTip(docDisplay); docDisplay_ = docDisplay; handlers_ = new HandlerRegistrations(); timer_ = new Timer() { @Override public void run() { if (!uiPrefs_.showSignatureTooltips().getGlobalValue()) return; if (coordinates_ == null && !uiPrefs_.showFunctionTooltipOnIdle().getGlobalValue()) return; resolveActiveFunctionAndDisplayToolTip(); } }; handlers_.add(docDisplay_.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { attachPreviewHandler(); } })); handlers_.add(docDisplay_.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { timer_.cancel(); toolTip_.hide(); detachPreviewHandler(); } })); handlers_.add(docDisplay_.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(final CursorChangedEvent event) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { if (anchor_ != null && toolTip_.isShowing() && !anchor_.getRange().contains(event.getPosition())) { anchor_ = null; toolTip_.hide(); } timer_.schedule(DELAY_MS); } }); } })); handlers_.add(toolTip_.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { <START> if (event.isAttached()) <END> { } else { coordinates_ = null; position_ = null; anchor_ = null; } } })); }</code><technical_language>Nit: collapse !isAttached</technical_language>

Target:
public SignatureToolTipManager(DocDisplay docDisplay) { RStudioGinjector.INSTANCE.injectMembers(this); toolTip_ = new RCompletionToolTip(docDisplay); docDisplay_ = docDisplay; handlers_ = new HandlerRegistrations(); timer_ = new Timer() { @Override public void run() { if (!uiPrefs_.showSignatureTooltips().getGlobalValue()) return; if (coordinates_ == null && !uiPrefs_.showFunctionTooltipOnIdle().getGlobalValue()) return; resolveActiveFunctionAndDisplayToolTip(); } }; monitor_ = new Timer() { @Override public void run() { if (ready_) { timer_.schedule(TIMER_DELAY_MS); ready_ = false; } } }; handlers_.add(docDisplay_.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { attachPreviewHandler(); beginMonitoring(); } })); handlers_.add(docDisplay_.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { timer_.cancel(); toolTip_.hide(); detachPreviewHandler(); endMonitoring(); } })); handlers_.add(docDisplay_.addCursorChangedHandler(new CursorChangedHandler() { @Override public void onCursorChanged(final CursorChangedEvent event) { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { if (anchor_ != null && toolTip_.isShowing() && !anchor_.getRange().contains(event.getPosition())) { anchor_ = null; toolTip_.hide(); } } }); } })); handlers_.add(toolTip_.addAttachHandler(new AttachEvent.Handler() { @Override public void onAttachOrDetach(AttachEvent event) { if (!event.isAttached()) { coordinates_ = null; position_ = null; anchor_ = null; } } })); }
Source:
<code>protected void testDelStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } <START> assertEqualsB4Right(right); <END> }</code><technical_language>Please check left content, in order left model modified.Please verify other tests present problem</technical_language>

Target:
protected void testDelStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.DELETE, 2); assertDeletedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsM2(right); assertEqualsM2(left); }
Source:
<code>protected static String chooseIndexForFields(Set<String> neededFields, Map<String, Object> indexes) { String chosenIndex = null; for (String indexName: indexes.keySet()) { Map<String, Object> indexDefinition = (Map<String, Object>) indexes.get(indexName); String indexType = (String) indexDefinition.get("type"); if (indexType.equalsIgnoreCase("text")) { continue; <START> } <END> List<String> fieldList = (List<String>) indexDefinition.get("fields"); Set<String> providedFields = new HashSet<String>(fieldList); if (providedFields.containsAll(neededFields)) { chosenIndex = indexName; break; } } return chosenIndex; }</code><technical_language>add always-printed log message remembered</technical_language>

Target:
protected static String chooseIndexForFields(Set<String> neededFields, Map<String, Object> indexes) { String chosenIndex = null; for (String indexName: indexes.keySet()) { Map<String, Object> indexDefinition = (Map<String, Object>) indexes.get(indexName); String indexType = (String) indexDefinition.get("type"); if (indexType.equalsIgnoreCase("text")) { logger.log(Level.INFO, "Full text search is not yet supported. " + String.format("Text index %s is being ignored.", indexName)); continue; } List<String> fieldList = (List<String>) indexDefinition.get("fields"); Set<String> providedFields = new HashSet<String>(fieldList); if (providedFields.containsAll(neededFields)) { chosenIndex = indexName; break; } } return chosenIndex; }
Source:
<code>protected OneAndOneApi create(Properties props, Iterable<Module> modules) { Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); constants = injector.getInstance(OneAndOneConstants.class); Predicate<Server> serverAvailableCheck = new Predicate<Server>() { @Override public boolean apply(Server currentServer) { Server server = api.serverApi().get(currentServer.id()); if ((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0) { return false; } else { return true; } } <START> }; <END> serverReady = Predicates2.retry(serverAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); return injector.getInstance(OneAndOneApi.class); }</code><technical_language>Configure this in a reusable predicate in HttpApiModule. [this](<LINK_0> example</technical_language>

Target:
protected OneAndOneApi create(Properties props, Iterable<Module> modules) { Injector injector = newBuilder().modules(modules).overrides(props).buildInjector(); constants = injector.getInstance(OneAndOneConstants.class); Predicate<Server> serverAvailableCheck = new Predicate<Server>() { @Override public boolean apply(Server currentServer) { Server server = api.serverApi().get(currentServer.id()); if ((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0) { return false; } else { return true; } } }; Predicate<ServerPrivateNetworkRef> privateNetworkAvailableCheck = new Predicate<ServerPrivateNetworkRef>() { @Override public boolean apply(ServerPrivateNetworkRef networkRef) { PrivateNetwork server = api.serverApi().getPrivateNetwork(networkRef.serverId(), networkRef.privateNetworkId()); return server.state() != Types.GenericState.ACTIVE; } }; waitUntilPrivateNetworkReady = Predicates2.retry(privateNetworkAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); waitUntilServerReady = Predicates2.retry(serverAvailableCheck, constants.pollTimeout(), constants.pollPeriod(), constants.pollMaxPeriod(), TimeUnit.SECONDS); return injector.getInstance(OneAndOneApi.class); }
Source:
<code>private boolean isPubsubTrigger(Trigger trigger) { return PUBSUB_TRIGGER_TYPE.equals(trigger.getType()) <START> && (trigger.getSubscriptionName() != null && !trigger.getSubscriptionName().isEmpty()) <END> && (trigger.getPubsubType() != null && !trigger.getPubsubType().isEmpty()); }</code><technical_language>StringUtils.isEmpty apache.lang3 I</technical_language>

Target:
private boolean isPubsubTrigger(Trigger trigger) { return PUBSUB_TRIGGER_TYPE.equals(trigger.getType()) && !StringUtils.isEmpty(trigger.getSubscriptionName()) && !StringUtils.isEmpty(trigger.getPubsubType()); }
Source:
<code>public final Image getTitleImage() { if (isDisposed()) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); } Image newLegacyPartImage = null; if (legacyPart != null) { newLegacyPartImage = legacyPart.getTitleImage(); } <START> if ((newLegacyPartImage != null) && (newLegacyPartImage != legacyPartImage)) { <END> legacyPartImage = newLegacyPartImage; setImageDescriptor(computeImageDescriptor()); } if (image == null) { image = JFaceResources.getResources().createImageWithDefault(imageDescriptor); } return image; }</code><technical_language>brackets conditions superfluous removed</technical_language>

Target:
public final Image getTitleImage() { if (isDisposed()) { return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW); } Image newLegacyPartImage = null; if (legacyPart != null) { newLegacyPartImage = legacyPart.getTitleImage(); } if (newLegacyPartImage != null && newLegacyPartImage != legacyPartImage) { legacyPartImage = newLegacyPartImage; setImageDescriptor(computeImageDescriptor()); } if (image == null) { image = JFaceResources.getResources().createImageWithDefault(imageDescriptor); } return image; }