auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(Error.EXCEPTION_NULL); <START> throw new IllegalArgumentException(Error.EXCEPTION_NULL); <END> } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(Error.ERROR_MESS_NULL); throw new IllegalArgumentException(Error.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newACK(response); }</code><technical_language>In meantime, NullPointerExceptionfor (even if is a lot of code updated that)</technical_language>

Target:
public static EmptyMessage manageError(OSException e, Response response) { if (e == null) { LOGGER.error(Error.EXCEPTION_NULL); throw new NullPointerException(Error.EXCEPTION_NULL); } String errMess = e.getMessage(); if (errMess == null) { LOGGER.error(Error.ERROR_MESS_NULL); throw new NullPointerException(Error.ERROR_MESS_NULL); } if (!response.isConfirmable()) { LOGGER.error("An Empty Message will not be created"); return null; } return EmptyMessage.newACK(response); }
Source:
<code>static ColumnCapabilities columnCapabilities(final IndexedTable table, final String columnName) { final ValueType valueType = table.rowSignature().getColumnType(columnName).orElse(null); if (valueType != null) { final ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl().setType(valueType); if (valueType == ValueType.STRING) { capabilities.setDictionaryEncoded(true); } <START> capabilities.setDictionaryValuesSorted(true); <END> capabilities.setDictionaryValuesUnique(false); return capabilities.setIsComplete(true); } else { return null; } }</code><technical_language>dictionary is row number. sorted</technical_language>

Target:
static ColumnCapabilities columnCapabilities(final IndexedTable table, final String columnName) { final ValueType valueType = table.rowSignature().getColumnType(columnName).orElse(null); if (valueType != null) { final ColumnCapabilitiesImpl capabilities = new ColumnCapabilitiesImpl().setType(valueType); if (valueType == ValueType.STRING) { capabilities.setDictionaryEncoded(true); } capabilities.setDictionaryValuesSorted(false); capabilities.setDictionaryValuesUnique(false); return capabilities.setIsComplete(true); } else { return null; } }
Source:
<code>public void setUp() { <START> jUnitCore = new JUnitCore(); <END> testListener = new TestListener(); jUnitCore.addListener(testListener); }</code><technical_language>In JUnit4-style tests, assign variables defined (and final if want :-). JUnit4 create instance of class is run, eligible for garbage collection right is run</technical_language>

Target:
public void setUp() { jUnitCore.addListener(testListener); }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE && resultCode == RESULT_OK) { Objects.requireNonNull(data); Objects.requireNonNull(data.getData()); Uri uri = data.getData(); try { Bitmap image = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); if (image != null) { String message = "User picture changed"; YieldsApplication.showToast(getApplicationContext(), message); <START> Bitmap croppedImage; <END> int h = image.getHeight(); int w = image.getWidth(); if (w > h){ croppedImage = Bitmap.createBitmap(image, (w-h)/2, 0, h, h); } else { croppedImage = Bitmap.createBitmap(image, 0, (h-w)/2, w, w); } int diameter = getResources().getInteger(R.integer.largeGroupImageDiameter); mUser.setImg(Bitmap.createScaledBitmap(croppedImage, diameter, diameter, false)); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); } else { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); } } catch (IOException e) { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); Log.d(TAG, message); } } }</code><technical_language>Is this done group picture also? a general helper good :)</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_IMAGE && resultCode == RESULT_OK) { Objects.requireNonNull(data); Objects.requireNonNull(data.getData()); Uri uri = data.getData(); try { Bitmap image = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); if (image != null) { String message = "User picture changed"; YieldsApplication.showToast(getApplicationContext(), message); int diameter = getResources().getInteger(R.integer.largeGroupImageDiameter); mUser.setImg(Bitmap.createScaledBitmap(getCroppedSquaredBitmap(image), diameter, diameter, false)); ServiceRequest request = new UserUpdateRequest(mUser); YieldsApplication.getBinder().sendRequest(request); } else { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); } } catch (IOException e) { String message = "Could not retrieve image"; YieldsApplication.showToast(getApplicationContext(), message); Log.d(TAG, message); } } }
Source:
<code>public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.shared.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); <START> storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20971520); <END> storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfElements = verifiableProperties.getInt("store.index.max.number.of.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange( "store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); }</code><technical_language>Write 20971520 20_1024_1024. Ideally, Default annotation support this approach too, I yet</technical_language>

Target:
public StoreConfig(VerifiableProperties verifiableProperties) { storeKeyFactory = verifiableProperties.getString("store.key.factory", "com.github.ambry.shared.BlobIdFactory"); storeDataFlushIntervalSeconds = verifiableProperties.getLong("store.data.flush.interval.seconds", 60); storeIndexMaxMemorySizeBytes = verifiableProperties.getInt("store.index.max.memory.size.bytes", 20*1024*1024); storeDataFlushDelaySeconds = verifiableProperties.getInt("store.data.flush.delay.seconds", 5); storeIndexMaxNumberOfInmemElements = verifiableProperties.getInt("store.index.max.number.of.inmem.elements", 10000); storeIndexBloomMaxFalsePositiveProbability = verifiableProperties.getDoubleInRange( "store.index.bloom.max.false.positive.probability", 0.01, 0.0, 1.0); }
Source:
<code>public void executeBehavior(final Class<?> testClass, final AbstractAjaxBehavior behavior, final String filename) throws Exception { <START> assert(behavior != null); <END> log.info("=== " + testClass.getName() + " : " + behavior.toString() + " ==="); executeBehavior(behavior); assertResultPage(testClass, filename); }</code><technical_language>This wrong</technical_language>

Target:
public void executeBehavior(final Class<?> testClass, final AbstractAjaxBehavior behavior, final String filename) throws Exception { assertNotNull(behavior); log.info("=== " + testClass.getName() + " : " + behavior.toString() + " ==="); executeBehavior(behavior); assertResultPage(testClass, filename); }
Source:
<code>private static File loadLibraryFile(String libFolder, String libFileName, String tmpFolder) throws IOException { s_hostLog.debug("Loading library from jar using path = " + libFolder + "/" + libFileName); String uuid = UUID.randomUUID().toString(); String extractedLibFileName = String.format("voltdb-%s-%s", uuid, libFileName); File extractedLibFile = new File(tmpFolder, extractedLibFileName); String libPath = libFolder + "/" + libFileName; InputStream reader = null; FileOutputStream writer = null; <START> try { <END> reader = NativeLibraryLoader.class.getResourceAsStream(libPath); try { writer = new FileOutputStream(extractedLibFile); byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = reader.read(buffer)) != -1) { writer.write(buffer, 0, bytesRead); } } finally { if (writer != null) { writer.close(); } } } finally { if (reader != null) { reader.close(); } extractedLibFile.deleteOnExit(); } boolean success = extractedLibFile.setReadable(true) && extractedLibFile.setWritable(true, true) && extractedLibFile.setExecutable(true); if (!success) { String msg = "Could not update extracted lib file " + extractedLibFile + " to be rwx"; s_hostLog.warn(msg); throw new RuntimeException(msg); } return new File(tmpFolder, extractedLibFileName); }</code><technical_language>A try-with-resources do here</technical_language>

Target:
private static File loadLibraryFile(String libFolder, String libFileName, String tmpFolder) throws IOException { s_hostLog.debug("Loading library from jar using path = " + libFolder + "/" + libFileName); String uuid = UUID.randomUUID().toString(); String extractedLibFileName = String.format("voltdb-%s-%s", uuid, libFileName); File extractedLibFile = new File(tmpFolder, extractedLibFileName); String libPath = libFolder + "/" + libFileName; try (InputStream reader = NativeLibraryLoader.class.getResourceAsStream(libPath)) { try (FileOutputStream writer = new FileOutputStream(extractedLibFile)) { byte[] buffer = new byte[8192]; int bytesRead = 0; while ((bytesRead = reader.read(buffer)) != -1) { writer.write(buffer, 0, bytesRead); } } } finally { extractedLibFile.deleteOnExit(); } boolean success = extractedLibFile.setReadable(true) && extractedLibFile.setWritable(true, true) && extractedLibFile.setExecutable(true); if (! success) { String msg = "Could not update extracted lib file " + extractedLibFile + " to be rwx"; s_hostLog.warn(msg); throw new RuntimeException(msg); } return new File(tmpFolder, extractedLibFileName); }
Source:
<code>public void testGeneralPurposeWindowFunctionsWithStandaloneValues() { execute("select col1, col2, " + "first_value(col1) OVER(order by col2, col1), " + "last_value(col1) OVER(order by col2, col1), " + "nth_value(col1, 3) OVER(order by col2, col1), " + <START> "lag(col1) OVER(order by col2, col1) " + <END> "from unnest([1, 1, 3, 2], [1, 2, 2, 3]) " + "order by col1, col2"); assertThat(printedTable(response.rows()), is("1| 1| 1| 1| NULL| NULL\n" + "1| 2| 1| 1| NULL| 1\n" + "2| 3| 1| 2| 3| 3\n" + "3| 2| 1| 3| 3| 1\n")); }</code><technical_language>I this integration test this is nth_value specific stuff</technical_language>

Target:
public void testGeneralPurposeWindowFunctionsWithStandaloneValues() { execute("select col1, col2, " + "first_value(col1) OVER(order by col2, col1), " + "last_value(col1) OVER(order by col2, col1), " + "nth_value(col1, 3) OVER(order by col2, col1) " + "from unnest([1, 1, 3, 2], [1, 2, 2, 3]) " + "order by col1, col2"); assertThat(printedTable(response.rows()), is("1| 1| 1| 1| NULL\n" + "1| 2| 1| 1| NULL\n" + "2| 3| 1| 2| 3\n" + "3| 2| 1| 3| 3\n")); }
Source:
<code>public boolean hasEntry(long entryId, int bookieIndex) { <START> int[] set = writeSets[(int) (entryId % ensembleSize)]; <END> return ArrayUtils.contains(set, bookieIndex); }</code><technical_language>I this improved. is checking entry is supposed stored in bookie. I simply calculate it</technical_language>

Target:
public boolean hasEntry(long entryId, int bookieIndex) { WriteSet w = getWriteSet(entryId); try { return w.contains(bookieIndex); } finally { w.recycle(); } }
Source:
<code>private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panels = getCurrentPanels(); if (panels.isEmpty()) { logger.info("Did not save new board"); return; } TextInputDialog dlg = new TextInputDialog(""); dlg.getEditor().setId("boardnameinput"); dlg.setTitle("Board Name"); dlg.getDialogPane().setContentText("What should this board be called?"); dlg.getDialogPane().setHeaderText("Please name this board"); Optional<String> response = dlg.showAndWait(); if (response.isPresent()) { String boardName = response.get(); if (boardName.equals("")) { logger.info("Did not save new board"); return; <START> } <END> prefs.addBoard(boardName, panels); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); } }</code><technical_language>want factor validation out another method, log case, for example if empty, if consists of whitespace, etc</technical_language>

Target:
private void onBoardSaveAs() { logger.info("Menu: Boards > Save as"); List<PanelInfo> panels = getCurrentPanels(); if (panels.isEmpty()) { logger.info("Did not save new board"); return; } TextInputDialog dlg = new TextInputDialog(""); dlg.getEditor().setId("boardnameinput"); dlg.setTitle("Board Name"); dlg.getDialogPane().setContentText("What should this board be called?"); dlg.getDialogPane().setHeaderText("Please name this board"); Optional<String> response = dlg.showAndWait(); if (response.isPresent()) { String boardName = response.get().trim(); if (isBoardNameValid(boardName)) { prefs.addBoard(boardName, panels); prefs.setLastOpenBoard(boardName); ui.triggerEvent(new BoardSavedEvent()); logger.info("New board " + boardName + " saved"); } } }
Source:
<code>private static void checkCommand(Command command) { checkArgument(command.hasMessage(), "Command message must be set."); checkArgument(command.hasContext(), "Command context must be set."); final CommandContext context = command.getContext(); checkValid(context.getCommandId()); checkTimestamp(context.getTimestamp(), "Command time"); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); checkNotEmptyOrBlank(commandType, "command type"); final Object targetId = tryToGetTargetId(commandMessage); <START> if (targetId != null) { <END> final String targetIdString = idToString(targetId); checkNotEmptyOrBlank(targetIdString, "command target ID"); final String targetIdType = targetId.getClass().getName(); checkNotEmptyOrBlank(targetIdType, "command target ID type"); } }</code><technical_language>Please test for null result</technical_language>

Target:
static void checkCommand(Command command) { checkArgument(command.hasMessage(), "Command message must be set."); checkArgument(command.hasContext(), "Command context must be set."); final CommandContext context = command.getContext(); checkValid(context.getCommandId()); checkTimestamp(context.getTimestamp(), "Command time"); final Message commandMessage = Commands.getMessage(command); final String commandType = TypeName.of(commandMessage).nameOnly(); checkNotEmptyOrBlank(commandType, "command type"); final Object targetId = tryToGetTargetId(commandMessage); if (targetId != null) { final String targetIdString = idToString(targetId); checkNotEmptyOrBlank(targetIdString, "command target ID"); final String targetIdType = targetId.getClass().getName(); checkNotEmptyOrBlank(targetIdType, "command target ID type"); } }
Source:
<code>private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setTimeToIdleSeconds(0); <START> c.setTimeToLiveSeconds(0 ); <END> if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }</code><technical_language>Is this true in latest Ehcache version? Based error messages sounded instead just: c.setEternal(true);</technical_language>

Target:
private void configureDefaultCache() { final CacheConfiguration c = new CacheConfiguration(); c.setMaxElementsInMemory(1024); c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU); c.setEternal(true); if (mgr.getDiskStoreConfiguration() != null) { c.setMaxElementsOnDisk(16384); c.setOverflowToDisk(false); c.setDiskPersistent(false); c.setDiskSpoolBufferSizeMB(5); c.setDiskExpiryThreadIntervalSeconds(60 * 60); } mgr.setDefaultCacheConfiguration(c); }
Source:
<code>public WebVideoViewBase(Context context, Content model, ConversationFullScreenVideoFrame fullScreenContainer) { super(context); <START> this.context = context; <END> this.model = model; this.fullScreenContainer = fullScreenContainer; url = model.getValue(); height = Integer.parseInt(model.getHeight()); if (height <= 0) { height = 220; } String aStyle = "style='font-size: 0.6875em; color: #666; width:100%;'"; String pStyle = "style='text-align:center; margin-top:8px'"; errorHtml = ("<p " + pStyle + ">") + ("<a " + aStyle + " href='" + url.toString() + EXTERNAL_MARKER + "'>") + ("Can't see the video?</a>"); if (SwrveHelper.isNullOrEmpty(url)) { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = "<p>Sorry, a malformed URL was detected. This video cannot be played.</p> "; } else if (url.toLowerCase().contains(PLAYER_VIDEO_YOUTUBE) || url.toLowerCase().contains(PLAYER_VIDEO_VIMEO)) { videoHtml = "<iframe type='text/html' width='100%' height='" + height + "' src=" + url + " frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>" + errorHtml; } else { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = errorHtml; } }</code><technical_language>WebView a context variable</technical_language>

Target:
public WebVideoViewBase(Context context, Content model, ConversationFullScreenVideoFrame fullScreenContainer) { super(context); this.model = model; this.fullScreenContainer = fullScreenContainer; url = model.getValue(); height = Integer.parseInt(model.getHeight()); if (height <= 0) { height = 220; } String aStyle = "style='font-size: 0.6875em; color: #666; width:100%;'"; String pStyle = "style='text-align:center; margin-top:8px'"; errorHtml = ("<p " + pStyle + ">") + ("<a " + aStyle + " href='" + url.toString() + EXTERNAL_MARKER + "'>") + ("Can't see the video?</a>"); if (SwrveHelper.isNullOrEmpty(url)) { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = "<p>Sorry, a malformed URL was detected. This video cannot be played.</p> "; } else if (url.toLowerCase().contains(PLAYER_VIDEO_YOUTUBE) || url.toLowerCase().contains(PLAYER_VIDEO_VIMEO)) { videoHtml = "<iframe type='text/html' width='100%' height='" + height + "' src=" + url + " frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>" + errorHtml; } else { Toast.makeText(this.getContext(), "Unknown Video Player Detected", Toast.LENGTH_SHORT).show(); videoHtml = errorHtml; } }
Source:
<code>public static String getClientId(String id) { <START> return id + CLIENT_ID_SUFFIX; <END> }</code><technical_language>I add a check here: if ID contains suffix, throw IllegalStateException InvalidParameterException, otherwise, a chance ID abc-client-client, is appropriate</technical_language>

Target:
public static String getClientId(String id) { if (id.endsWith(CLIENT_ID_SUFFIX)) { throw new IllegalStateException("Id already contains suffix: " + CLIENT_ID_SUFFIX); } return id + CLIENT_ID_SUFFIX; }
Source:
<code>private CheckpointCoordinator instantiateCheckpointCoordinator( JobID jid, ScheduledExecutor testingScheduledExecutor, ExecutionVertex... ackVertices) { CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 10000000L, 600000L, 0L, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); Executor executor = Executors.directExecutor(); return new CheckpointCoordinator( jid, chkConfig, new ExecutionVertex[0], ackVertices, new ExecutionVertex[0], Collections.emptyList(), new StandaloneCheckpointIDCounter(), new StandaloneCompletedCheckpointStore(10), new MemoryStateBackend(), executor, <START> new CheckpointsCleaner(executor), <END> testingScheduledExecutor, SharedStateRegistry.DEFAULT_FACTORY, new CheckpointFailureManager( 0, NoOpFailJobCall.INSTANCE)); }</code><technical_language>creating interface (CheckpointCleaner) a no-op implementation in tests possible</technical_language>

Target:
private CheckpointCoordinator instantiateCheckpointCoordinator( JobID jid, ScheduledExecutor testingScheduledExecutor, ExecutionVertex... ackVertices) { CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 10000000L, 600000L, 0L, 1, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, false, 0); Executor executor = Executors.directExecutor(); return new CheckpointCoordinator( jid, chkConfig, new ExecutionVertex[0], ackVertices, new ExecutionVertex[0], Collections.emptyList(), new StandaloneCheckpointIDCounter(), new StandaloneCompletedCheckpointStore(10), new MemoryStateBackend(), executor, new CheckpointsCleaner(), testingScheduledExecutor, SharedStateRegistry.DEFAULT_FACTORY, new CheckpointFailureManager( 0, NoOpFailJobCall.INSTANCE)); }
Source:
<code>public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,2),new SourceCodeUpgradeScript(sdd,tc)); <START> } <END></code><technical_language>Splice version is 1.1.2, 2.6</technical_language>

Target:
public SpliceCatalogUpgradeScripts(SpliceDataDictionary sdd,Splice_DD_Version catalogVersion,TransactionController tc){ this.sdd=sdd; this.catalogVersion=catalogVersion; this.tc=tc; ddComparator=new Comparator<Splice_DD_Version>(){ @Override public int compare(Splice_DD_Version version1,Splice_DD_Version version2){ long v1=version1.toLong(); long v2=version2.toLong(); if(v1<v2) return -1; else if(v1==v2) return 0; else return 1; } }; scripts=new TreeMap<>(ddComparator); scripts.put(new Splice_DD_Version(sdd,1,0,0),new UpgradeScriptForFuji(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,1,1,1),new LassenUpgradeScript(sdd,tc)); scripts.put(new Splice_DD_Version(sdd,2,6,0),new SourceCodeUpgradeScript(sdd,tc)); }
Source:
<code>public RowBatch nextBatch(RowBatch previous, Class<T> clazz) throws IOException { RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(); } ObjectColumnVector<T> columnVector; if (rowBatch.getColumns() == null) { columnVector = ColumnVector.ofType(clazz); rowBatch.setColumns(new ColumnVector[] { columnVector }); } else { columnVector = (ObjectColumnVector<T>) rowBatch.getColumns()[0]; <START> } <END> return readVector(columnVector) ? rowBatch : null; }</code><technical_language>this logic in RowBatch constructor</technical_language>

Target:
public RowBatch nextBatch(RowBatch previous, Class<T> clazz) throws IOException { RowBatch rowBatch = previous; if (rowBatch == null) { rowBatch = new RowBatch(new ColumnVector[] { ColumnVector.ofType(clazz) } ); } return readVector((ObjectColumnVector<T>) rowBatch.getColumns()[0]) ? rowBatch : null; }
Source:
<code>public static ExecutorService newBlockingSingleThreaded( final String nameFormat, final int capacity, <START> final Integer priority <END> ) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }</code><technical_language>is this used</technical_language>

Target:
public static ExecutorService newBlockingSingleThreaded( final String nameFormat, final int capacity, final Integer priority ) { final BlockingQueue<Runnable> queue; if (capacity > 0) { queue = new ArrayBlockingQueue<>(capacity); } else { queue = new SynchronousQueue<>(); } return new ThreadPoolExecutor( 1, 1, 0L, TimeUnit.MILLISECONDS, queue, makeThreadFactory(nameFormat, priority), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { try { executor.getQueue().put(r); } catch (InterruptedException e) { throw new RejectedExecutionException("Got Interrupted while adding to the Queue"); } } } ); }
Source:
<code>public ProductData populate(Product source) { if (source == null) { throw new IllegalArgumentException("source is null"); } super.populate(source); this.uuid = source.getUuid(); this.id = source.getId(); this.name = source.getName(); this.multiplier = source.getMultiplier(); this.href = source.getHref(); this.locked = source.isLocked(); this.setAttributes(source.getAttributes()); if (source.getProductContent() != null) { if (this.content == null) { this.content = new HashMap<>(); } else { this.content.clear(); } for (ProductContent entity : source.getProductContent()) { this.addProductContent(entity.toDTO()); } } else { this.setProductContent(null); } this.setDependentProductIds(source.getDependentProductIds()); this.setBranding(source.getBranding()); if (source.getProvidedProducts() != null) { this.setProvidedProducts(source.getProvidedProducts().stream() <START> .map(prod -> this.populate(prod)) <END> .collect(Collectors.toSet())); } return this; }</code><technical_language>a bit confused this. calling populate method recursively here, overwrite data marketing ProductData (this) populating already? If is in order turn Product a ProductData, new ProductData(Product product) is instead</technical_language>

Target:
public ProductData populate(Product source) { if (source == null) { throw new IllegalArgumentException("source is null"); } super.populate(source); this.uuid = source.getUuid(); this.id = source.getId(); this.name = source.getName(); this.multiplier = source.getMultiplier(); this.href = source.getHref(); this.locked = source.isLocked(); this.setAttributes(source.getAttributes()); if (source.getProductContent() != null) { if (this.content == null) { this.content = new HashMap<>(); } else { this.content.clear(); } for (ProductContent entity : source.getProductContent()) { this.addProductContent(entity.toDTO()); } } else { this.setProductContent(null); } this.setDependentProductIds(source.getDependentProductIds()); this.setBranding(source.getBranding()); if (source.getProvidedProducts() != null) { this.setProvidedProducts(source.getProvidedProducts().stream() .map(prod -> new ProductData(prod)) .collect(Collectors.toSet())); } return this; }
Source:
<code>GoogleCloudStorageSinkConfiguration(final FileStrategyConfiguration fileStrategy, @JsonProperty(required = true) final String bucket) { super(fileStrategy); <START> this.bucket = bucket; <END> }</code><technical_language>a nullity check here</technical_language>

Target:
GoogleCloudStorageSinkConfiguration(final FileStrategyConfiguration fileStrategy, @JsonProperty(required = true) final String bucket) { super(fileStrategy); this.bucket = Objects.requireNonNull(bucket); }
Source:
<code>private RemoteMethodCallResults invokeAndWaitRemote(final RemoteMethodCall remoteCall) { final UUID methodCallId = UUID.randomUUID(); final CountDownLatch latch = new CountDownLatch(1); synchronized (pendingLock) { pendingInvocations.put(methodCallId, latch); } final Invoke invoke = new HubInvoke(methodCallId, true, remoteCall); send(invoke, messenger.getServerNode()); <START> if (!Interruptibles.awaitResult(() -> latch.await(1, TimeUnit.MINUTES)).result.orElse(false)) { <END> throw new IllegalStateException( String.format( "Server timed out while waiting for result of method %s for remote %s with id %s", remoteCall.getMethodName(), remoteCall.getRemoteName(), methodCallId)); } synchronized (pendingLock) { final RemoteMethodCallResults methodCallResults = results.remove(methodCallId); if (methodCallResults == null) { throw new IllegalStateException( "No results from remote call. Method returned:" + remoteCall.getMethodName() + " for remote name:" + remoteCall.getRemoteName() + " with id:" + methodCallId); } return methodCallResults; } }</code><technical_language>Is 1 minute potentially over-generous timeout? simulated this error chance? show option submit error report (I'm hoping yes)</technical_language>

Target:
private RemoteMethodCallResults invokeAndWaitRemote(final RemoteMethodCall remoteCall) { final UUID methodCallId = UUID.randomUUID(); final CountDownLatch latch = new CountDownLatch(1); synchronized (pendingLock) { pendingInvocations.put(methodCallId, latch); } final Invoke invoke = new HubInvoke(methodCallId, true, remoteCall); send(invoke, messenger.getServerNode()); if (!Interruptibles.awaitResult(() -> latch.await(20, TimeUnit.SECONDS)).result.orElse(false)) { synchronized (pendingLock) { pendingInvocations.remove(methodCallId); } throw new IllegalStateException( String.format( "Server timed out while waiting for result of method %s for remote %s with id %s", remoteCall.getMethodName(), remoteCall.getRemoteName(), methodCallId)); } synchronized (pendingLock) { final RemoteMethodCallResults methodCallResults = results.remove(methodCallId); if (methodCallResults == null) { throw new IllegalStateException( "No results from remote call. Method returned:" + remoteCall.getMethodName() + " for remote name:" + remoteCall.getRemoteName() + " with id:" + methodCallId); } return methodCallResults; } }
Source:
<code>private Property toProperty(@NonNull String value) { switch (value) { case "hasStagedChanges": return Property.HAS_STAGED_CHANGES; case "hasUnstagedChanges": return Property.HAS_UNSTAGED_CHANGES; case "hasNotIgnoredResources": return Property.HAS_NOT_IGNORED_RESOURCES; case "hasTrackedResources": return Property.HAS_TRACKED_RESOURCES; default: <START> break; <END> } return null; }</code><technical_language>Simply default: return null; removing line 129 a bit shorter more regular</technical_language>

Target:
private Property toProperty(@NonNull String value) { switch (value) { case "hasStagedChanges": return Property.HAS_STAGED_CHANGES; case "hasUnstagedChanges": return Property.HAS_UNSTAGED_CHANGES; case "hasNotIgnoredResources": return Property.HAS_NOT_IGNORED_RESOURCES; case "hasTrackedResources": return Property.HAS_TRACKED_RESOURCES; default: return null; } }
Source:
<code>public void finished(TaskEvent taskEvent) { if (taskEvent.getKind() != Kind.ANALYZE) { return; } if (JavaCompiler.instance(context).errorCount() > 0) { return; } TreePath path = JavacTrees.instance(context).getPath(taskEvent.getTypeElement()); if (path == null) { path = new TreePath(taskEvent.getCompilationUnit()); } verify(seen.add(path.getLeaf()), "Duplicate FLOW event for: %s", taskEvent.getTypeElement()); Context subContext = new SubContext(context); subContext.put(ErrorProneOptions.class, errorProneOptions); Log log = Log.instance(context); JCCompilationUnit compilation = (JCCompilationUnit) path.getCompilationUnit(); DescriptionListener descriptionListener = descriptionListenerFactory.getDescriptionListener(log, compilation); try { if (path.getLeaf().getKind() == Tree.Kind.COMPILATION_UNIT) { if (!isExcludedPath(compilation.getSourceFile().toUri())) { transformer.get().apply(path, subContext, descriptionListener); } } else if (finishedCompilation(path.getCompilationUnit())) { <START> if (!isExcludedPath(compilation.getSourceFile().toUri())) { <END> transformer.get().apply(new TreePath(compilation), subContext, descriptionListener); } } } catch (ErrorProneError e) { e.logFatalError(log); throw e; } catch (CompletionFailure e) { log.error("proc.cant.access", e.sym, e.getDetailValue(), Throwables.getStackTraceAsString(e)); } }</code><technical_language>nice de-duplicate this logic</technical_language>

Target:
public void finished(TaskEvent taskEvent) { if (taskEvent.getKind() != Kind.ANALYZE) { return; } if (JavaCompiler.instance(context).errorCount() > 0) { return; } TreePath path = JavacTrees.instance(context).getPath(taskEvent.getTypeElement()); if (path == null) { path = new TreePath(taskEvent.getCompilationUnit()); } verify(seen.add(path.getLeaf()), "Duplicate FLOW event for: %s", taskEvent.getTypeElement()); Context subContext = new SubContext(context); subContext.put(ErrorProneOptions.class, errorProneOptions); Log log = Log.instance(context); JCCompilationUnit compilation = (JCCompilationUnit) path.getCompilationUnit(); DescriptionListener descriptionListener = descriptionListenerFactory.getDescriptionListener(log, compilation); try { if (!isExcludedPath(compilation.getSourceFile().toUri())) { if (path.getLeaf().getKind() == Tree.Kind.COMPILATION_UNIT) { transformer.get().apply(path, subContext, descriptionListener); } else if (finishedCompilation(path.getCompilationUnit())) { transformer.get().apply(new TreePath(compilation), subContext, descriptionListener); } } } catch (ErrorProneError e) { e.logFatalError(log); throw e; } catch (CompletionFailure e) { log.error("proc.cant.access", e.sym, e.getDetailValue(), Throwables.getStackTraceAsString(e)); } }
Source:
<code>protected TmfViewerFolder<ITmfStatisticsViewer> createStatisticsViewers() { int defaultStyle = SWT.NONE; TmfViewerFolder<ITmfStatisticsViewer> tabsView = new TmfViewerFolder<ITmfStatisticsViewer>(fParent); Composite folder = tabsView.getParentFolder(); ITmfStatisticsViewer viewer = new TmfStatisticsViewer(); viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName, fExperiment); tabsView.addTab(viewer, defaultStyle); tabsView.setSelection(0); if (fExperiment != null) { String traceName; IResource traceResource; for (ITmfTrace trace : fExperiment.getTraces()) { traceName = trace.getName(); traceResource = trace.getResource(); viewer = TmfViewerFactory.getStatisticsViewer(traceResource); <START> if (viewer == null) { <END> viewer = new TmfStatisticsViewer(); } viewer.init(folder, traceName, trace); tabsView.addTab(viewer, defaultStyle); } } return tabsView; }</code><technical_language>If is TmfStatisticsViewer defined for trace type create a default TmfStatisticsViewer redundant information in global stats trace specific stats</technical_language>

Target:
protected TmfViewerFolder createStatisticsViewers() { int defaultStyle = SWT.NONE; TmfViewerFolder tabsView = new TmfViewerFolder(fParent); Composite folder = tabsView.getParentFolder(); ITmfStatisticsViewer viewer = new TmfStatisticsViewer(); if (fExperiment != null) { viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName + " - " + fExperiment.getName(), fExperiment); tabsView.addTab(viewer, defaultStyle); String traceName; IResource traceResource; for (ITmfTrace trace : fExperiment.getTraces()) { traceName = trace.getName(); traceResource = trace.getResource(); viewer = TmfViewerFactory.getStatisticsViewer(traceResource); if (viewer == null) { viewer = new TmfStatisticsViewer(); } viewer.init(folder, traceName, trace); tabsView.addTab(viewer, defaultStyle); } } else { viewer.init(folder, Messages.TmfStatisticsView_GlobalTabName, fExperiment); tabsView.addTab(viewer, defaultStyle); } tabsView.setSelection(0); return tabsView; }
Source:
<code>public void errorChannelTest() { class ErrorThrower extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { throw new RuntimeException(); } } class DefaultTargetProducer extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final Target defaultTarget = new Target(); defaultTarget.setName("Default"); return defaultTarget; } } context.getBean("requestChannel", DirectChannel.class).subscribe(new ErrorThrower()); context.getBean("errChannel", DirectChannel.class).subscribe(new DefaultTargetProducer()); final PollableChannel replyChannel = context.getBean("replyChannel", PollableChannel.class); Target original = new Target(); original.setName("John"); Message<?> request = MessageBuilder.withPayload(original).setReplyChannel(replyChannel).build(); context.getBean("inputChannel", DirectChannel.class).send(request); <START> Message<?> reply = replyChannel.receive(0); <END> Target enriched = (Target) reply.getPayload(); assertEquals("Mr. Default", enriched.getName()); }</code><technical_language>issue is here. replyChannel is a <queue>, is guaranty, message in queue immediately. I wait timeout 10000. other side: mind reworking this test real integration one? I wait for result enricher's output-channel, reply-channel downstream gateway</technical_language>

Target:
public void errorChannelTest() { class ErrorThrower extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { throw new RuntimeException(); } } class DefaultTargetProducer extends AbstractReplyProducingMessageHandler { @Override protected Object handleRequestMessage(Message<?> requestMessage) { final Target defaultTarget = new Target(); defaultTarget.setName("Default"); return defaultTarget; } } context.getBean("requestChannel", DirectChannel.class).subscribe(new ErrorThrower()); context.getBean("errChannel", DirectChannel.class).subscribe(new DefaultTargetProducer()); Target original = new Target(); original.setName("John"); Message<?> request = MessageBuilder.withPayload(original).build(); context.getBean("inputChannel", DirectChannel.class).send(request); Message<?> reply = context.getBean("outputChannel", PollableChannel.class).receive(10000); Target enriched = (Target) reply.getPayload(); assertEquals("Mr. Default", enriched.getName()); }
Source:
<code>static public float getPercentUniqueMovements(final List<TrackerMotion> userOriginalTrackerMotions, final List<TrackerMotion> partnerOriginalTrackerMotions){ final int numUserMotions = userOriginalTrackerMotions.size(); final int numPartnerMotions = partnerOriginalTrackerMotions.size(); int numUniqueUserMotions = numUserMotions; if (numUserMotions == 0){ return 0.0f; } else if (numPartnerMotions == 0){ return 1.0f; } long currentPartnerMotionTS = partnerOriginalTrackerMotions.get(0).timestamp; int i = 0; for (TrackerMotion userMotion : userOriginalTrackerMotions){ long currentUserMotionTS = userMotion.timestamp; <START> while (currentUserMotionTS > currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE & i < numPartnerMotions - 1){ <END> i+=1; currentPartnerMotionTS = partnerOriginalTrackerMotions.get(i).timestamp; } if (currentUserMotionTS >= currentPartnerMotionTS - DateTimeConstants.MILLIS_PER_MINUTE & currentUserMotionTS <= currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE){ numUniqueUserMotions -= 1; } } final float percentUniqueMovements = (float)numUniqueUserMotions / (float) numUserMotions; return percentUniqueMovements; }</code><technical_language>&&</technical_language>

Target:
static public float getPercentUniqueMovements(final List<TrackerMotion> userOriginalTrackerMotions, final List<TrackerMotion> partnerOriginalTrackerMotions){ final int numUserMotions = userOriginalTrackerMotions.size(); final int numPartnerMotions = partnerOriginalTrackerMotions.size(); int numUniqueUserMotions = numUserMotions; if (numUserMotions == 0){ return 0.0f; } else if (numPartnerMotions == 0){ return 1.0f; } long currentPartnerMotionTS = partnerOriginalTrackerMotions.get(0).timestamp; int i = 0; for (final TrackerMotion userMotion : userOriginalTrackerMotions){ final long currentUserMotionTS = userMotion.timestamp; while (currentUserMotionTS > currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE && i < numPartnerMotions - 1){ i+=1; currentPartnerMotionTS = partnerOriginalTrackerMotions.get(i).timestamp; } if (currentUserMotionTS >= currentPartnerMotionTS - DateTimeConstants.MILLIS_PER_MINUTE && currentUserMotionTS <= currentPartnerMotionTS + DateTimeConstants.MILLIS_PER_MINUTE){ numUniqueUserMotions -= 1; } } final float percentUniqueMovements = (float)numUniqueUserMotions / (float) numUserMotions; return percentUniqueMovements; }
Source:
<code>public static Transform<FullQuery, QueryResultPart> fromResultGroup( final ClusterShard shard ) { return result -> { final ImmutableList<ShardedResultGroup> groups = ImmutableList.copyOf(result .getGroups() .stream() .map(ResultGroup.toShardedResultGroup(shard)) .iterator()); long sampleSize = 0; <START> if (result.getStatistics().getCounters().containsKey(AggregationInstance.SAMPLE_SIZE)) { <END> sampleSize = result.getStatistics().getCounters().get(AggregationInstance.SAMPLE_SIZE); } else { for (final ShardedResultGroup g : groups) { sampleSize += g.getMetrics().getData().size(); } } return new QueryResultPart(groups, result.getErrors(), result.getTrace(), result.getLimits(), sampleSize); }; }</code><technical_language>This smoother if add accessor Statistics: Optional<Long> Statistics#getCounterValue(String key) this become: java final long sampleSize = result.getStatistics().getCounterValue(AggregationInstance.SAMPLE_SIZE).orElseGet(() -> { // calculate groups });</technical_language>

Target:
public static Transform<FullQuery, QueryResultPart> fromResultGroup( final ClusterShard shard ) { return result -> { final ImmutableList<ShardedResultGroup> groups = ImmutableList.copyOf(result .getGroups() .stream() .map(ResultGroup.toShardedResultGroup(shard)) .iterator()); final long preAggregationSampleSize = result .getStatistics() .getCounterValue(AggregationInstance.SAMPLE_SIZE) .orElseGet(() -> { long sum = 0; for (final ShardedResultGroup g : groups) { sum += g.getMetrics().getData().size(); } return sum; }); return new QueryResultPart(groups, result.getErrors(), result.getTrace(), result.getLimits(), preAggregationSampleSize); }; }
Source:
<code><START> public int runEmpiOnAllTargetTypes(String theCriteria) { <END> int submittedCount = 0; submittedCount += runEmpiOnPatientType(theCriteria); submittedCount += runEmpiOnPractitionerType(theCriteria); return submittedCount; }</code><technical_language>for numbers get big, long is safer int</technical_language>

Target:
public long runEmpiOnAllTargetTypes(String theCriteria) { long submittedCount = 0; submittedCount += runEmpiOnPatientType(theCriteria); submittedCount += runEmpiOnPractitionerType(theCriteria); return submittedCount; }
Source:
<code>private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { <START> new Thread(() -> cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME), <END> threadName()).start(); } }</code><technical_language>of core executors here</technical_language>

Target:
private void startCounterCache() { if (counterCacheStarted.compareAndSet(false, true)) { cacheManager.getGlobalComponentRegistry() .getComponent(Executor.class, KnownComponentNames.ASYNC_OPERATIONS_EXECUTOR) .execute(() -> { String oldName = Thread.currentThread().getName(); try { Thread.currentThread().setName(threadName()); cacheManager.getCache(CounterModuleLifecycle.COUNTER_CACHE_NAME); } finally { Thread.currentThread().setName(oldName); } }); } }
Source:
<code>protected void executeCommand() { initPoolUser(); <START> getParameters().setEntityInfo(new EntityInfo(VdcObjectType.VM, getVmId())); <END> VdcReturnValueBase vdcReturnValue = attachUserToVm(); if (!vdcReturnValue.getSucceeded()) { log.info("Failed to give user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); setActionReturnValue(vdcReturnValue); vmPoolHandler.releaseVm(getVmId(), !isVmPrestarted()); return; } else { log.info("Succeeded giving user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); } if (!isVmPrestarted()) { vdcReturnValue = runVm(); setSucceeded(vdcReturnValue.getSucceeded()); getReturnValue().getVdsmTaskIdList().addAll(getReturnValue().getInternalVdsmTaskIdList()); } else { setSucceeded(true); } setActionReturnValue(getVmId()); }</code><technical_language>this is typically located in constructor/init method, no</technical_language>

Target:
protected void executeCommand() { initPoolUser(); VdcReturnValueBase vdcReturnValue = attachUserToVm(); if (!vdcReturnValue.getSucceeded()) { log.info("Failed to give user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); setActionReturnValue(vdcReturnValue); return; } else { log.info("Succeeded giving user '{}' permission to Vm '{}'", getAdUserId(), getVmId()); } if (!isVmPrestarted()) { vdcReturnValue = runVm(); setSucceeded(vdcReturnValue.getSucceeded()); getReturnValue().getVdsmTaskIdList().addAll(getReturnValue().getInternalVdsmTaskIdList()); } else { setSucceeded(true); } setActionReturnValue(getVmId()); }
Source:
<code>public FunInputAnchor() { this.curried = false; this.inputType = new Label(".....") { @Override public void relocate(double x, double y) { super.relocate(x, y); FunInputAnchor.this.dragShift(y); } }; this.inputType.setMinWidth(USE_PREF_SIZE); this.inputType.getStyleClass().add("inputType"); this.anchor = new InputAnchor(FunApplyBlock.this); <START> this.anchor.layoutXProperty().bind(this.inputType.widthProperty().divide(2)); <END> this.getChildren().addAll(this.anchor, this.inputType); dragContext = new DragContext(this.inputType); dragContext.setDragInitAction(c -> {this.curried = false;}); dragContext.setDragFinishAction(c -> { double height = this.inputType.getHeight(); this.curried = this.inputType.getLayoutY() > height; this.inputType.relocate(0, this.curried ? 2*height : 0); FunApplyBlock.this.initiateConnectionChanges(); }); }</code><technical_language>allow a bind - simple enough of - officially prefer right layouts</technical_language>

Target:
public FunInputAnchor() { this.curried = false; this.inputType = new Label(".....") { @Override public void relocate(double x, double y) { super.relocate(x, y); FunInputAnchor.this.dragShift(y); } }; this.inputType.setMinWidth(USE_PREF_SIZE); this.inputType.getStyleClass().add("inputType"); this.anchor = new InputAnchor(FunApplyBlock.this); this.anchor.layoutXProperty().bind(this.inputType.widthProperty().divide(2)); this.getChildren().addAll(this.anchor, this.inputType); dragContext = new DragContext(this.inputType); dragContext.setDragInitAction(c -> {this.curried = false;}); dragContext.setDragFinishAction(c -> { double height = this.inputType.getHeight(); boolean mostlyDown = this.inputType.getLayoutY() > height; double newY = mostlyDown ? 2*height : 0; this.inputType.relocate(0, newY); this.curried = mostlyDown; FunApplyBlock.this.dragShiftOuput(newY - height); FunApplyBlock.this.initiateConnectionChanges(); }); }
Source:
<code>public void invalidAntNameTest() { for (String invalidAntName : INVALID_ANT_NAMES) { inputFile = new String[] { <START> "0000", <END> "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create " + invalidAntName + ",1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("direction " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("escape " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("position " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(inputFile)); } }</code><technical_language>If input file matter, please reassign test run (It's hard read, especially for a detailed test)</technical_language>

Target:
public void invalidAntNameTest() { for (String invalidAntName : INVALID_ANT_NAMES) { inputFile = new String[] { "0000", "0000", "0a00", "0000" }; runs = new Run[] { new ErrorRun("create " + invalidAntName + ",1,1"), quit() }; sessionTest(runs, Input.getFile(inputFile)); runs = new Run[] { new ErrorRun("direction " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(TASK_SHEET_INPUT_FILE_1)); runs = new Run[] { new ErrorRun("escape " + TASK_SHEET_INPUT_FILE_1), quit() }; sessionTest(runs, Input.getFile(inputFile)); runs = new Run[] { new ErrorRun("position " + invalidAntName), quit() }; sessionTest(runs, Input.getFile(TASK_SHEET_INPUT_FILE_1)); } }