auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private ListenableFuture<GraphAndDataResults> combineFuture(Statement dataStatement, Statement graphStatement) { ListenableFuture<ResultSet> dataResult = session.executeAsync(dataStatement); ListenableFuture<ResultSet> graphResult = session.executeAsync(graphStatement); ListenableFuture<List<ResultSet>> future = Futures.allAsList(graphResult, dataResult); return Futures.transformAsync(future, combinedResults -> { List<Row> graphResults = getGraphResults(combinedResults); List<Row> dataResults = getDataResults(combinedResults); boolean resultsMatch = resultsMatch(graphResults, dataResults); if (resultsMatch || attempt.incrementAndGet() > NUMBER_OF_CASSANDRA_SELECT_RETRIES) { if (!resultsMatch) { log.warn("Exceeded retry count for combined data and graph future"); } return Futures.immediateFuture(new GraphAndDataResults(graphResults, dataResults)); } else { <START> return combineFuture(dataStatement, graphStatement); <END> } }); }</code><technical_language>do want log a line get idea is happening</technical_language>

Target:
private ListenableFuture<GraphAndDataResults> combineFuture(Statement dataStatement, Statement graphStatement) { ListenableFuture<ResultSet> dataResult = session.executeAsync(dataStatement); ListenableFuture<ResultSet> graphResult = session.executeAsync(graphStatement); ListenableFuture<List<ResultSet>> future = Futures.allAsList(graphResult, dataResult); return Futures.transformAsync(future, combinedResults -> { List<Row> graphResults = getGraphResults(combinedResults); List<Row> dataResults = getDataResults(combinedResults); boolean resultsMatch = resultsMatch(graphResults, dataResults); int attemptNumber = attempt.incrementAndGet(); if (resultsMatch || attemptNumber > NUMBER_OF_CASSANDRA_SELECT_RETRIES) { if (!resultsMatch) { log.warn("Exceeded retry count for combined data and graph future"); } else { if (attemptNumber > 1) { log.info("Succeeded to fetch combined data and graph future after attempts", attemptNumber); } } return Futures.immediateFuture(new GraphAndDataResults(graphResults, dataResults)); } else { return combineFuture(dataStatement, graphStatement); } }); }
Source:
<code>private BlockRead cacheBlock(String _lookup, BlockCache cache, BlockReader _currBlock, String block) throws IOException { <START> int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; <END> if ((cache == null) || (_currBlock.getRawSize() > Math.min(cache.getMaxSize(), MAX_ARRAY_SIZE))) { return new BlockRead(_currBlock, _currBlock.getRawSize()); } else { byte b[] = null; try { b = new byte[(int) _currBlock.getRawSize()]; _currBlock.readFully(b); } catch (IOException e) { log.debug("Error full blockRead for file " + fileName + " for block " + block, e); throw e; } finally { _currBlock.close(); } CacheEntry ce = null; try { ce = cache.cacheBlock(_lookup, b); } catch (Exception e) { log.warn("Already cached block: " + _lookup, e); } if (ce == null) return new BlockRead(new DataInputStream(new ByteArrayInputStream(b)), b.length); else return new CachedBlockRead(ce, ce.getBuffer()); } }</code><technical_language>Personally, I this a static constants caps implies convention</technical_language>

Target:
private BlockRead cacheBlock(String _lookup, BlockCache cache, BlockReader _currBlock, String block) throws IOException { if ((cache == null) || (_currBlock.getRawSize() > Math.min(cache.getMaxSize(), MAX_ARRAY_SIZE))) { return new BlockRead(_currBlock, _currBlock.getRawSize()); } else { byte b[] = null; try { b = new byte[(int) _currBlock.getRawSize()]; _currBlock.readFully(b); } catch (IOException e) { log.debug("Error full blockRead for file " + fileName + " for block " + block, e); throw e; } finally { _currBlock.close(); } CacheEntry ce = null; try { ce = cache.cacheBlock(_lookup, b); } catch (Exception e) { log.warn("Already cached block: " + _lookup, e); } if (ce == null) return new BlockRead(new DataInputStream(new ByteArrayInputStream(b)), b.length); else return new CachedBlockRead(ce, ce.getBuffer()); } }
Source:
<code>static boolean isValid(String value) { <START> return isBlank(value) || value.matches("[0-9]+"); <END> }</code><technical_language>So, hate for this, this is a inefficient compiles regex single time. this more performant: java private static final Pattern ALL_DIGITS = Pattern.compile("[0-9]+"); // return isBlank(value) || ALL_DIGITS.matcher(value).matches();</technical_language>

Target:
static boolean isValid(String value) { return isBlank(value) || ALL_DIGITS.matcher(value).matches(); }
Source:
<code>public void processContents(MElementContainer<MUIElement> container) { if (container == null) { return; } Object obj = container; ToolBarManager parentManager = getManager((MToolBar) obj); if (parentManager == null) { return; } List<MUIElement> parts = container.getChildren(); if (parts != null) { MUIElement[] plist = parts.toArray(new MUIElement[parts.size()]); for (int i = 0; i < plist.length; i++) { MUIElement childME = plist[i]; modelProcessSwitch(parentManager, (MToolBarElement) childME); } } parentManager.update(true); ToolBar tb = getToolbarFrom(container.getWidget()); if (tb != null) { <START> tb.pack(true); <END> tb.requestLayout(); } }</code><technical_language>More calls pack(...)</technical_language>

Target:
public void processContents(MElementContainer<MUIElement> container) { if (container == null) { return; } Object obj = container; ToolBarManager parentManager = getManager((MToolBar) obj); if (parentManager == null) { return; } List<MUIElement> parts = container.getChildren(); if (parts != null) { MUIElement[] plist = parts.toArray(new MUIElement[parts.size()]); for (int i = 0; i < plist.length; i++) { MUIElement childME = plist[i]; modelProcessSwitch(parentManager, (MToolBarElement) childME); } } parentManager.update(true); ToolBar tb = getToolbarFrom(container.getWidget()); if (tb != null) { tb.requestLayout(); } }
Source:
<code>private boolean batchContainerInitializations() { synchronized (this.batchContainerInitializationsLock) { while (this.batchContainerInitializations == BATCH_INITIALIZATION_IN_PROGRESS) { if (this.batchContainerInitializingThread == Thread.currentThread()) { this.batchContainerInitializationNesting++; return true; } try { <START> this.batchContainerInitializationsLock.wait(); <END> } catch (InterruptedException e) { Thread.currentThread().interrupt(); return false; } } if (this.batchContainerInitializations == NEED_BATCH_INITIALIZATION) { this.batchContainerInitializations = BATCH_INITIALIZATION_IN_PROGRESS; this.batchContainerInitializingThread = Thread.currentThread(); this.batchContainerInitializationNesting++; return true; } return false; } }</code><technical_language>wait forever, if another thread waits for this some lock holding right now. Typically non-JDT containers tend call JDT sooner init, holding workspace locks in UI thread (implicit lock) etc. I pleasure analyse deadlock cases times, JDT init *without* this new lock. I personally this is a introduce extra locking (potentially 3rd party) container init</technical_language>

Target:
private synchronized boolean batchContainerInitializations() { switch (this.batchContainerInitializations) { case NEED_BATCH_INITIALIZATION: this.batchContainerInitializations = BATCH_INITIALIZATION_IN_PROGRESS; return true; case BATCH_INITIALIZATION_IN_PROGRESS: return true; } return false; }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if (getParameters().getHookName() == null || getParameters().getHookName().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_NAME_IS_REQUIRED); return false; } if (getParameters().getGlusterCommand() == null || getParameters().getGlusterCommand().isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_COMMAND_IS_REQUIRED); return false; } if (getParameters().getLevel() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_LEVEL_IS_REQUIRED); return false; } if (getParameters().getLevel() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_LEVEL_IS_REQUIRED); return false; <START> } <END> List<Guid> upServerIds = getUpServerIds(); if (upServerIds == null || upServerIds.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_UP_SERVER_FOUND); return false; } return true; }</code><technical_language>Please remove duplicate checks here. for enabling a gluster hook, Cluster Id Hook Id enough, fetch rest of details DB pass VDSM</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getParameters().getClusterId() == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CLUSTER_IS_NOT_VALID); return false; } if ( Guid.isNullOrEmpty(getParameters().getHookId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_HOOK_ID_IS_REQUIRED); return false; } List<Guid> upServerIds = getUpServerIds(); if (upServerIds == null || upServerIds.isEmpty()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_UP_SERVER_FOUND); return false; } return true; }
Source:
<code>public CompactSketch getResult(final boolean dstOrdered, final WritableMemory dstMem, final boolean reset) { final CompactSketch result = CompactOperations.componentsToCompact( <START> thetaLong_, curCount_, seedHash_, empty_, true, false, dstOrdered, dstMem, hashArr_); <END> if (reset) { reset(); } return result; }</code><technical_language>hashArr_ is a copy, reset is requested</technical_language>

Target:
public CompactSketch getResult(final boolean dstOrdered, final WritableMemory dstMem, final boolean reset) { final CompactSketch result = CompactOperations.componentsToCompact( thetaLong_, curCount_, seedHash_, empty_, true, false, dstOrdered, dstMem, hashArr_.clone()); if (reset) { reset(); } return result; }
Source:
<code>private boolean excludePoint(final String label, int index) { if (inclusionFlag == null || inclusionFlag == InclusionFlag.OFF) { return false; } boolean retVal; switch (inclusionFlag) { case INCLUDE_BY_STRING: <START> retVal = !(strExclusionSet.contains(label) || strExclusionSet <END> .stream() .parallel() .anyMatch(label::matches)); break; case EXCLUDE_BY_STRING: retVal = strExclusionSet.contains(label) || strExclusionSet .stream() .parallel() .anyMatch(label::matches); break; case INCLUDE_BY_COLUMN: retVal = !(colExclusionSet.contains(Integer.valueOf(index))); break; case EXCLUDE_BY_COLUMN: retVal = colExclusionSet.contains(Integer.valueOf(index)); break; default: retVal = false; } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(((retVal) ? "excluded" : "included") + " CSV Column: " + index + " : " + label); } return retVal; }</code><technical_language>format this condition consistently in case cases: suggestion retVal = !(strExclusionSet.contains(label) || strExclusionSet.stream().parallel().anyMatch(label::matches));</technical_language>

Target:
private boolean excludePoint(final String label, int index) { if (inclusionFlag == null || inclusionFlag == InclusionFlag.OFF) { return false; } boolean retVal; switch (inclusionFlag) { case INCLUDE_BY_STRING: retVal = !checkExclusionSet(label); break; case EXCLUDE_BY_STRING: retVal = checkExclusionSet(label); break; case INCLUDE_BY_COLUMN: retVal = !(colExclusionSet.contains(Integer.valueOf(index))); break; case EXCLUDE_BY_COLUMN: retVal = colExclusionSet.contains(Integer.valueOf(index)); break; default: retVal = false; } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(((retVal) ? "excluded" : "included") + " CSV Column: " + index + " : " + label); } return retVal; }
Source:
<code>public void updateMenuState(int numSelectedProjects, int numProjects) { boolean allowDelete = !isReadOnly && numSelectedProjects > 0; boolean allowExport = numSelectedProjects > 0; boolean allowExportAll = numProjects > 0; <START> fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), true); <END> String exportProjectLabel = numSelectedProjects > 1 ? MESSAGES.exportSelectedProjectsMenuItem(numSelectedProjects) : MESSAGES.exportProjectMenuItem(); fileDropDown.setItemHtmlById(WIDGET_NAME_EXPORTPROJECT, exportProjectLabel); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, allowExport); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), allowExportAll); }</code><technical_language>intend remove allowDelete check here? AllowDelete is set true if user permissions trash projects, is case</technical_language>

Target:
public void updateMenuState(int numSelectedProjects, int numProjects) { boolean allowDelete = !isReadOnly && numSelectedProjects > 0; boolean allowExport = numSelectedProjects > 0; boolean allowExportAll = numProjects > 0; fileDropDown.setItemEnabled(MESSAGES.trashProjectMenuItem(), allowDelete); fileDropDown.setItemEnabled(MESSAGES.deleteFromTrashButton(), allowDelete); String exportProjectLabel = numSelectedProjects > 1 ? MESSAGES.exportSelectedProjectsMenuItem(numSelectedProjects) : MESSAGES.exportProjectMenuItem(); fileDropDown.setItemHtmlById(WIDGET_NAME_EXPORTPROJECT, exportProjectLabel); fileDropDown.setItemEnabledById(WIDGET_NAME_EXPORTPROJECT, allowExport); fileDropDown.setItemEnabled(MESSAGES.exportAllProjectsMenuItem(), allowExportAll); }
Source:
<code>public InstructorCourseStudentDetailsEditPage submitUnsuccessfully(String studentName, String teamName, String studentEmail, String comments){ if (studentName != null) { fillTextBox(studentNameTextbox, studentName); } if (teamName != null) { fillTextBox(teamNameTextbox, teamName); } if (studentEmail != null) { fillTextBox(studentEmailTextbox, studentEmail); } if (comments != null) { fillTextBox(commentsTextbox, comments); } <START> if(teamName != null){ <END> clickAndConfirm(submitButton); }else{ submitButton.click(); } return this; }</code><technical_language>@Sumei1009, leave a whitespace <code>(</code>, <code>)</code>. Applies part of this pr. other places in code this strictly adhered to, coding standards</technical_language>

Target:
public InstructorCourseStudentDetailsEditPage submitUnsuccessfully(String studentName, String teamName, String studentEmail, String comments) { fillStudentDetailsForm(studentName, teamName, studentEmail, comments); return this; }
Source:
<code>public void onEventMainThread(QueueEvent event) { Log.d(TAG, "onEvent(" + event + ")"); switch(event.action) { case ADDED: queue.add(event.position, event.item); recyclerAdapter.notifyItemInserted(event.position); break; case SET_QUEUE: queue = event.items; recyclerAdapter.notifyDataSetChanged(); break; case REMOVED: case IRREVERSIBLE_REMOVED: int position = FeedItemUtil.indexOfItemWithId(queue, event.item.getId()); queue.remove(position); recyclerAdapter.notifyItemRemoved(position); break; case CLEARED: queue.clear(); recyclerAdapter.notifyDataSetChanged(); break; case SORTED: queue = event.items; recyclerAdapter.notifyDataSetChanged(); break; case MOVED: <START> break; <END> } onFragmentLoaded(); }</code><technical_language>daft, do handle this case now</technical_language>

Target:
public void onEventMainThread(QueueEvent event) { Log.d(TAG, "onEvent(" + event + ")"); switch(event.action) { case ADDED: queue.add(event.position, event.item); recyclerAdapter.notifyItemInserted(event.position); break; case SET_QUEUE: queue = event.items; recyclerAdapter.notifyDataSetChanged(); break; case REMOVED: case IRREVERSIBLE_REMOVED: int position = FeedItemUtil.indexOfItemWithId(queue, event.item.getId()); queue.remove(position); recyclerAdapter.notifyItemRemoved(position); break; case CLEARED: queue.clear(); recyclerAdapter.notifyDataSetChanged(); break; case SORTED: queue = event.items; recyclerAdapter.notifyDataSetChanged(); break; case MOVED: return; } saveScrollPosition(); onFragmentLoaded(); }
Source:
<code>public void waitForLeader(long timeout) throws Exception { final LeaderInformation leader = leaderQueue.poll(timeout, TimeUnit.MILLISECONDS); if (leader == null || leader.equals(LeaderInformation.empty())) { <START> throw new TimeoutException("Contender was not elected as the leader within " + timeout + "ms"); <END> } isLeader = true; }</code><technical_language>technically if leader == LeaderInformation.empty() time, retry a leader elected later</technical_language>

Target:
public void waitForLeader(long timeout) throws Exception { throwExceptionIfNotNull(); final String errorMsg = "Contender was not elected as the leader within " + timeout + "ms"; CommonTestUtils.waitUntilCondition( () -> { final LeaderInformation leader = leaderEventQueue.poll(timeout, TimeUnit.MILLISECONDS); return leader != null && !leader.isEmpty(); }, Deadline.fromNow(Duration.ofMillis(timeout)), errorMsg); isLeader = true; }
Source:
<code>private synchronized void handleExperimentResult(String testID) { logger.info("handleExperimentResult with testID: " + testID); HandleExperimentResultTask task = new HandleExperimentResultTask(testID); <START> Future<Boolean> future = taskExecutorService.submit(task); <END> testTasks.put(testID, future); try { Boolean hasRegressionModel = future.get(); TestRunningState nextState = hasRegressionModel ? DERIVE_PREDICTION_FUNCTION : VALIDATE_TERMINATION_CRITERIA; testModelDAO.setTestRunningState(testID, nextState); handleTestState(testID); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (BenchFlowTestIDDoesNotExistException e) { logger.error("test ID does not exist - should not happen"); } }</code><technical_language>determine if need a regression model in scheduler</technical_language>

Target:
private synchronized void handleExperimentResult(String testID) { logger.info("handleExperimentResult with testID: " + testID); HandleExperimentResultTask task = new HandleExperimentResultTask(testID); Future<?> future = taskExecutorService.submit(task); testTasks.put(testID, future); try { future.get(); Boolean hasRegressionModel = explorationModelDAO.hasRegressionModel(testID); TestRunningState nextState = hasRegressionModel ? DERIVE_PREDICTION_FUNCTION : VALIDATE_TERMINATION_CRITERIA; testModelDAO.setTestRunningState(testID, nextState); handleTestState(testID); } catch (InterruptedException | ExecutionException e) { e.printStackTrace(); } catch (BenchFlowTestIDDoesNotExistException e) { logger.error("test ID does not exist - should not happen"); } }
Source:
<code>private void doSingleParseHttpClientExecuteWithGzipResponse( int responseCode, String responseStatus, final String responseContent, ParseHttpClient client) throws Exception { MockWebServer server = new MockWebServer(); Buffer buffer = new Buffer(); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); GZIPOutputStream gzipOut = new GZIPOutputStream(byteOut); gzipOut.write(responseContent.getBytes()); gzipOut.close(); buffer.write(byteOut.toByteArray()); MockResponse mockResponse = new MockResponse() .setStatus("HTTP/1.1 " + responseCode + " " + responseStatus) .setBody(buffer) .setHeader("Content-Encoding", "gzip"); server.enqueue(mockResponse); server.start(); String requestUrl = server.getUrl("/").toString(); ParseHttpRequest parseRequest = new ParseHttpRequest.Builder() .setUrl(requestUrl) .setMethod(ParseRequest.Method.GET) .build(); client.addInternalInterceptor(new ParseDecompressInterceptor()); client.addExternalInterceptor(new ParseNetworkInterceptor() { @Override public ParseHttpResponse intercept(Chain chain) throws IOException { return chain.proceed(chain.getRequest()); } }); <START> <END> ParseHttpResponse parseResponse = client.execute(parseRequest); RecordedRequest recordedRequest = server.takeRequest(); assertEquals(ParseRequest.Method.GET.toString(), recordedRequest.getMethod()); Headers recordedHeaders = recordedRequest.getHeaders(); assertEquals("gzip", recordedHeaders.get("Accept-Encoding")); assertNull(parseResponse.getHeader("Content-Encoding")); byte[] content = ParseIOUtils.toByteArray(parseResponse.getContent()); assertArrayEquals(responseContent.getBytes(), content); server.shutdown(); }</code><technical_language>nit: whitespace</technical_language>

Target:
private void doSingleParseHttpClientExecuteWithGzipResponse( int responseCode, String responseStatus, final String responseContent, ParseHttpClient client) throws Exception { MockWebServer server = new MockWebServer(); Buffer buffer = new Buffer(); ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); GZIPOutputStream gzipOut = new GZIPOutputStream(byteOut); gzipOut.write(responseContent.getBytes()); gzipOut.close(); buffer.write(byteOut.toByteArray()); MockResponse mockResponse = new MockResponse() .setStatus("HTTP/1.1 " + responseCode + " " + responseStatus) .setBody(buffer) .setHeader("Content-Encoding", "gzip"); server.enqueue(mockResponse); server.start(); String requestUrl = server.getUrl("/").toString(); ParseHttpRequest parseRequest = new ParseHttpRequest.Builder() .setUrl(requestUrl) .setMethod(ParseRequest.Method.GET) .build(); ParseHttpResponse parseResponse = client.execute(parseRequest); RecordedRequest recordedRequest = server.takeRequest(); assertEquals(ParseRequest.Method.GET.toString(), recordedRequest.getMethod()); Headers recordedHeaders = recordedRequest.getHeaders(); assertEquals("gzip", recordedHeaders.get("Accept-Encoding")); byte[] content = ParseIOUtils.toByteArray(parseResponse.getContent()); assertArrayEquals(responseContent.getBytes(), content); server.shutdown(); }
Source:
<code>public void layerRemoved(LayerCollectionEvent listener) { for (ILayer layer : listener.getAffected()) { removeLayerListenerRecursively(layer, this); if(!mapContext.isLayerModelSpatial()){ <START> mapTransform.setExtent(null); <END> } invalidateImage(); } }</code><technical_language>map context call setBoundingBox null method onMapContextBoundingBoxChange called. this command is necessary</technical_language>

Target:
public void layerRemoved(LayerCollectionEvent listener) { for (ILayer layer : listener.getAffected()) { removeLayerListenerRecursively(layer, this); if(!mapContext.isLayerModelSpatial()){ mapTransform.setAdjustExtent(false); mapTransform.setExtent(new Envelope()); } invalidateImage(); } }
Source:
<code>public String createMoveRefactoring(CreateMoveRefactoring cmr) throws JavaModelException, RefactoringException { LOG.info( "createMoveRefactoring started in " + System.currentTimeMillis() + " ms with " <START> + cmr.toString()); <END> IJavaProject javaProject = model.getJavaProject(cmr.getProjectPath()); IJavaElement[] javaElements; try { Function<ElementToMove, IJavaElement> map = javaElement -> { try { if (javaElement.isPack()) { return javaProject.findPackageFragment( new org.eclipse.core.runtime.Path(javaElement.getPath())); } else { IType type = javaProject.findType(javaElement.getPath()); if (type == null) { throw new IllegalArgumentException("Can't find type: " + javaElement.getPath()); } return type.getCompilationUnit(); } } catch (JavaModelException e) { throw new IllegalArgumentException(e); } }; javaElements = cmr.getElements().stream().map(map).toArray(IJavaElement[]::new); } catch (IllegalArgumentException e) { LOG.error( "createMoveRefactoring fail in " + System.currentTimeMillis() + " ms with exception " + e.getMessage()); if (e.getCause() instanceof JavaModelException) { throw (JavaModelException) e.getCause(); } else { throw e; } } if (RefactoringAvailabilityTester.isMoveAvailable(new IResource[0], javaElements)) { String moveRefactoringSession = manager.createMoveRefactoringSession(javaElements); LOG.info( "createMoveRefactoring finished in " + System.currentTimeMillis() + " ms with session id " + moveRefactoringSession); return moveRefactoringSession; } LOG.error( "createMoveRefactoring finished in " + System.currentTimeMillis() + " ms with with RefactoringException"); throw new RefactoringException("Can't create move refactoring."); }</code><technical_language>please LOG.info("createMoveRefactoring started in " ms " {}", System.currentTimeMillis(), cmr.toString())</technical_language>

Target:
public String createMoveRefactoring(CreateMoveRefactoring cmr) throws JavaModelException, RefactoringException { IJavaProject javaProject = model.getJavaProject(cmr.getProjectPath()); IJavaElement[] javaElements; try { Function<ElementToMove, IJavaElement> map = javaElement -> { try { if (javaElement.isPack()) { return javaProject.findPackageFragment( new org.eclipse.core.runtime.Path(javaElement.getPath())); } else { IType type = javaProject.findType(javaElement.getPath()); if (type == null) { throw new IllegalArgumentException("Can't find type: " + javaElement.getPath()); } return type.getCompilationUnit(); } } catch (JavaModelException e) { throw new IllegalArgumentException(e); } }; javaElements = cmr.getElements().stream().map(map).toArray(IJavaElement[]::new); } catch (IllegalArgumentException e) { if (e.getCause() instanceof JavaModelException) { throw (JavaModelException) e.getCause(); } else { throw e; } } if (RefactoringAvailabilityTester.isMoveAvailable(new IResource[0], javaElements)) { return manager.createMoveRefactoringSession(javaElements); } throw new RefactoringException("Can't create move refactoring."); }
Source:
<code>private static void testEncodingAndDecodingWebException(Class<? extends WebApplicationException> exceptionClass, Status status) { WebApplicationException exceptionToProcess; try { exceptionToProcess = exceptionClass.getConstructor(String.class, Status.class).newInstance(message, status); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e); } RemoteException exception = (RemoteException) encodeAndDecode(exceptionToProcess); <START> assertThat(exception.getCause(), is(nullValue())); <END> assertThat(exception.getStatus(), is(status.getStatusCode())); assertThat(exception.getRemoteException().getExceptionName(), is(exceptionClass.getName())); assertThat(exception.getMessage(), is(message)); }</code><technical_language>is of RemoteExceptions expected null</technical_language>

Target:
private static void testEncodingAndDecodingWebException(Class<? extends WebApplicationException> exceptionClass, Status status) { WebApplicationException exceptionToProcess; try { exceptionToProcess = exceptionClass.getConstructor(String.class, Status.class).newInstance(message, status); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e); } RemoteException exception = (RemoteException) encodeAndDecode(exceptionToProcess); assertThat(exception.getCause(), is(nullValue())); assertThat(exception.getStatus(), is(status.getStatusCode())); assertThat(exception.getRemoteException().getErrorName(), is(exceptionClass.getName())); assertThat(exception.getMessage(), is(message)); }
Source:
<code>public ScrambleLogic( final GameData data, final PlayerId player, final Set<Territory> territoriesWithBattles, final BattleTracker battleTracker) { this.data = data; this.player = player; this.territoriesWithBattles = territoriesWithBattles; this.battleTracker = battleTracker; this.airbaseThatCanScramblePredicate = Matches.unitIsEnemyOf(data, player) .and(Matches.unitIsAirBase()) .and(Matches.unitIsNotDisabled()) .and(Matches.unitIsBeingTransported().negate()); this.canScrambleFromPredicate = <START> PredicateBuilder.of(Matches.territoryIsWater().or(Matches.isTerritoryEnemy(player, data))) <END> .and( Matches.territoryHasUnitsThatMatch( Matches.unitCanScramble() .and(Matches.unitIsEnemyOf(data, player)) .and(Matches.unitIsNotDisabled()))) .and(Matches.territoryHasUnitsThatMatch(airbaseThatCanScramblePredicate)) .andIf(Properties.getScrambleFromIslandOnly(data), Matches.territoryIsIsland()) .build(); this.maxScrambleDistance = computeMaxScrambleDistance(data); }</code><technical_language>Identical blocks of code in 2 locations. Consider refactoring</technical_language>

Target:
public ScrambleLogic( final GameData data, final PlayerId player, final Set<Territory> territoriesWithBattles, final BattleTracker battleTracker) { if (!Properties.getScrambleRulesInEffect(data)) { throw new IllegalStateException("Scrambling not supported"); } this.data = data; this.player = player; this.territoriesWithBattles = territoriesWithBattles; this.battleTracker = battleTracker; this.airbaseThatCanScramblePredicate = Matches.unitIsEnemyOf(data, player) .and(Matches.unitIsAirBase()) .and(Matches.unitIsNotDisabled()) .and(Matches.unitIsBeingTransported().negate()); this.canScrambleFromPredicate = PredicateBuilder.of(Matches.territoryIsWater().or(Matches.isTerritoryEnemy(player, data))) .and( Matches.territoryHasUnitsThatMatch( Matches.unitCanScramble() .and(Matches.unitIsEnemyOf(data, player)) .and(Matches.unitIsNotDisabled()))) .and(Matches.territoryHasUnitsThatMatch(airbaseThatCanScramblePredicate)) .andIf(Properties.getScrambleFromIslandOnly(data), Matches.territoryIsIsland()) .build(); this.maxScrambleDistance = computeMaxScrambleDistance(data); }
Source:
<code>public void register() { if (m_registered) { return; } try { m_topologyDao.register(this); m_registered = true; LOG.info("register: protocol:{}", getProtocol().getId()); } catch (Exception e) { <START> LOG.error("register: {}", e.getMessage()); <END> } }</code><technical_language>is ok loose stack trace? Alternative: LOG.error("register: {}", e);</technical_language>

Target:
public void register() { if (m_registered) { return; } try { m_topologyDao.register(this); m_registered = true; LOG.info("register: protocol:{}", getProtocol().getId()); } catch (Exception e) { LOG.error("register", e); } }
Source:
<code>public void initializeState(FunctionInitializationContext context) throws Exception { Preconditions.checkState(this.checkpointedState == null, "The " + getClass().getSimpleName() + " has already been initialized."); <START> this.checkpointedState = context.getOperatorStateStore().getListState( <END> new ListStateDescriptor<>( "arrow-source-state", new TupleSerializer<>( (Class<Tuple2<Integer, Integer>>) (Class<?>) Tuple2.class, new TypeSerializer[]{IntSerializer.INSTANCE, IntSerializer.INSTANCE}) ) ); this.indexesToEmit = new ArrayDeque<>(); if (context.isRestored()) { for (Tuple2<Integer, Integer> v : this.checkpointedState.get()) { this.indexesToEmit.add(v); } } else { final int stepSize = getRuntimeContext().getNumberOfParallelSubtasks(); final int taskIdx = getRuntimeContext().getIndexOfThisSubtask(); for (int i = taskIdx; i < arrowData.length; i += stepSize) { this.indexesToEmit.add(Tuple2.of(i, 0)); } } }</code><technical_language>add some log in this method? For example, LOG.info restored information</technical_language>

Target:
public void initializeState(FunctionInitializationContext context) throws Exception { Preconditions.checkState(this.checkpointedState == null, "The " + getClass().getSimpleName() + " has already been initialized."); this.checkpointedState = context.getOperatorStateStore().getListState( new ListStateDescriptor<>( "arrow-source-state", new TupleSerializer<>( (Class<Tuple2<Integer, Integer>>) (Class<?>) Tuple2.class, new TypeSerializer[]{IntSerializer.INSTANCE, IntSerializer.INSTANCE}) ) ); this.indexesToEmit = new ArrayDeque<>(); if (context.isRestored()) { for (Tuple2<Integer, Integer> v : this.checkpointedState.get()) { this.indexesToEmit.add(v); } LOG.info("Subtask restored state: {}.", getRuntimeContext().getIndexOfThisSubtask(), indexesToEmit); } else { final int stepSize = getRuntimeContext().getNumberOfParallelSubtasks(); final int taskIdx = getRuntimeContext().getIndexOfThisSubtask(); for (int i = taskIdx; i < arrowData.length; i += stepSize) { this.indexesToEmit.add(Tuple2.of(i, 0)); } LOG.info("Subtask has no restore state, initialized with {}.", taskIdx, indexesToEmit); } }
Source:
<code>public void warning(String message){ <START> AeroGearLogger.logger.warn(format(message)); <END> }</code><technical_language>wondering, w/ slf4j do need custom format() ? I hope/think done slf4j logging library</technical_language>

Target:
public void warning(String message){ AeroGearLogger.logger.warn(message); }
Source:
<code>public RegistrationUpdateEvent(String address, List<RegistrationInfo> registrations) { this.address = address; if (registrations == null || registrations.isEmpty()) { this.registrations = Collections.emptyList(); } else { <START> this.registrations = Collections.unmodifiableList(registrations); <END> } }</code><technical_language>avoid unmodifiableList cluster manager trust list modified</technical_language>

Target:
public RegistrationUpdateEvent(String address, List<RegistrationInfo> registrations) { this.address = address; this.registrations = registrations == null ? Collections.emptyList() : registrations; }
Source:
<code>boolean retryCallAfterBackoff( final RequestT payload, final Metadata requestHeaders, final Listener<ResponseT> listener) { long sleepTimeout = BackOff.STOP; <START> if (backOff == null) { <END> backOff = retryOptions.createBackoff(); } try { sleepTimeout = backOff.nextBackOffMillis(); } catch (IOException e) { } if (sleepTimeout != BackOff.STOP) { scheduledExecutorService.schedule(new Runnable() { @Override public void run() { try { retryCall(payload, requestHeaders, listener); } catch (RuntimeException e) { Metadata trailers = new Metadata(); listener.onClose(Status.fromThrowable(e), trailers); } } }, sleepTimeout, TimeUnit.MILLISECONDS); return true; } return false; }</code><technical_language>do need threadsafe</technical_language>

Target:
synchronized boolean retryCallAfterBackoff( final RequestT payload, final Metadata requestHeaders, final Listener<ResponseT> listener) { long sleepTimeout = BackOff.STOP; if (backOff == null) { backOff = retryOptions.createBackoff(); } try { sleepTimeout = backOff.nextBackOffMillis(); } catch (IOException e) { } if (sleepTimeout != BackOff.STOP) { scheduledExecutorService.schedule(new Runnable() { @Override public void run() { try { retryCall(payload, requestHeaders, listener); } catch (RuntimeException e) { Metadata trailers = new Metadata(); listener.onClose(Status.fromThrowable(e), trailers); } } }, sleepTimeout, TimeUnit.MILLISECONDS); return true; } return false; }
Source:
<code>public void registerCache(String name, int maxSize, int timeout) { <START> registerCache(name, maxSize, timeout, new CacheDescriptor()); <END> }</code><technical_language>retrieving default descriptor</technical_language>

Target:
public void registerCache(String name, int maxSize, int timeout) { registerCache(name); }
Source:
<code>public void testListWithOption() { GenericQueryOptions options = new GenericQueryOptions(); options.options(1, 1, null, null, null); List<MonitoringCenter> resultWithQuery = monitoringCenterApi().list(options); <START> assertNotNull(resultWithQuery); <END> }</code><technical_language>here, verify element is returned</technical_language>

Target:
public void testListWithOption() { GenericQueryOptions options = new GenericQueryOptions(); options.options(1, 1, null, null, null); List<MonitoringCenter> resultWithQuery = monitoringCenterApi().list(options); assertNotNull(resultWithQuery); Assert.assertTrue(resultWithQuery.size() >= 1); }
Source:
<code>public void should_not_print_any_output_when_quiet_option_is_given() throws Exception { <START> execute("version", "-quiet"); <END> assertOk(); assertNoOutput(out); assertNoOutput(err); }</code><technical_language>@marchof kinda corner-case, while -quiet suppresses stdout for version command, suppress for -help -quiet. I a bit surprised java -jar jacococli.jar -version worked out works for tools</technical_language>

Target:
public void should_not_print_any_output_when_quiet_option_is_given() throws Exception { execute("version", "--quiet"); assertOk(); assertNoOutput(out); assertNoOutput(err); }
Source:
<code>public void destroyCache(final String alias) { <START> final CacheHolder cacheHolder = caches.get(alias); <END> if(cacheHolder == null) { throw new IllegalArgumentException("No Cache associated with alias " + alias); } final Ehcache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if(ehcache.getStatus() == Status.AVAILABLE) { ehcache.close(); } ehcache.toMaintenance().destroy(); }</code><technical_language>this a caches.remove()</technical_language>

Target:
public void destroyCache(final String alias) { final CacheHolder cacheHolder = caches.remove(alias); if(cacheHolder == null) { throw new IllegalArgumentException("No Cache associated with alias " + alias); } final Ehcache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if(ehcache.getStatus() == Status.AVAILABLE) { ehcache.close(); } ehcache.toMaintenance().destroy(); }
Source:
<code>public void testOCDMarshallUnmarshall() throws Exception { XmlMarshallUnmarshallImpl xmlMarshallerImpl = new XmlMarshallUnmarshallImpl(); String pid = "org.eclipse.kura.cloud.CloudService"; Tocd definition = ComponentUtil.readObjectClassDefinition(pid); Map<String, Object> properties = new HashMap<>(); properties.put("prop.string", new String("prop.value")); properties.put("prop.long", Long.MAX_VALUE); properties.put("prop.double", Double.MAX_VALUE); properties.put("prop.float", Float.MAX_VALUE); properties.put("prop.integer", Integer.MAX_VALUE); properties.put("prop.byte", Byte.MAX_VALUE); properties.put("prop.character", 'a'); properties.put("prop.short", Short.MAX_VALUE); XmlComponentConfigurations xcc = new XmlComponentConfigurations(); List<ComponentConfiguration> ccis = new ArrayList<>(); ComponentConfigurationImpl config = new ComponentConfigurationImpl(pid, definition, properties); ccis.add(config); xcc.setConfigurations(ccis); String s = xmlMarshallerImpl.marshal(xcc); <START> System.err.println(s); <END> XmlComponentConfigurations config1 = xmlMarshallerImpl.unmarshal(s, XmlComponentConfigurations.class); String s1 = xmlMarshallerImpl.marshal(config1); System.err.println(s1); Map<String, Object> properties1 = config1.getConfigurations().get(0).getConfigurationProperties(); assertEquals(properties, properties1); }</code><technical_language>logger instead</technical_language>

Target:
public void testOCDMarshallUnmarshall() throws Exception { XmlMarshallUnmarshallImpl xmlMarshallerImpl = new XmlMarshallUnmarshallImpl(); String pid = "org.eclipse.kura.cloud.CloudService"; Tocd definition = ComponentUtil.readObjectClassDefinition(pid); Map<String, Object> properties = new HashMap<>(); properties.put("prop.string", new String("prop.value")); properties.put("prop.long", Long.MAX_VALUE); properties.put("prop.double", Double.MAX_VALUE); properties.put("prop.float", Float.MAX_VALUE); properties.put("prop.integer", Integer.MAX_VALUE); properties.put("prop.byte", Byte.MAX_VALUE); properties.put("prop.character", 'a'); properties.put("prop.short", Short.MAX_VALUE); XmlComponentConfigurations xcc = new XmlComponentConfigurations(); List<ComponentConfiguration> ccis = new ArrayList<>(); ComponentConfigurationImpl config = new ComponentConfigurationImpl(pid, definition, properties); ccis.add(config); xcc.setConfigurations(ccis); String s = xmlMarshallerImpl.marshal(xcc); logger.info(s); XmlComponentConfigurations config1 = xmlMarshallerImpl.unmarshal(s, XmlComponentConfigurations.class); String s1 = xmlMarshallerImpl.marshal(config1); logger.info(s1); Map<String, Object> properties1 = config1.getConfigurations().get(0).getConfigurationProperties(); assertEquals(properties, properties1); }
Source:
<code>protected boolean canDoAction() { if (!FeatureSupported.isRefreshLunsSupported(getStoragePool().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } <START> if ((getStorageDomain().getStorageType() == StorageType.NFS || getStorageDomain().getStorageType() == StorageType.UNKNOWN)) { <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); return false; } if (!checkStorageDomainStatusNotEqual(StorageDomainStatus.Locked)) { return false; } return true; }</code><technical_language>This be: if (!getStorageDomain().getStorageType.isBlock()) duplicating logic in StorageDomainType</technical_language>

Target:
protected boolean canDoAction() { if (!FeatureSupported.refreshLunSupported(getStoragePool().getCompatibilityVersion())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REFRESH_LUNS_UNSUPPORTED_ACTION); } if (!(checkStorageDomain() && checkStorageDomainStatus(StorageDomainStatus.Active))) { return false; } if (!getStorageDomain().getStorageType().isBlockDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); return false; } if (!checkStorageDomainStatusNotEqual(StorageDomainStatus.Locked)) { return false; } return true; }
Source:
<code>public String getJavaExpressionWithAppend(final Schema inputSchema, final Schema stateSchema) { <START> return new StringBuilder().append("result.append").append(getOutputType(inputSchema, stateSchema).getName()) <END> .append("(").append(getJavaExpression(inputSchema, stateSchema)).append(")").toString(); }</code><technical_language>constant-ify result, tb, row, state</technical_language>

Target:
public String getJavaExpressionWithAppend(final Schema inputSchema, final Schema stateSchema) { return new StringBuilder(RESULT).append(".append").append(getOutputType(inputSchema, stateSchema).getName()) .append("(").append(getJavaExpression(inputSchema, stateSchema)).append(")").toString(); }
Source:
<code><START> public OrganisationIdFilter(@Memoized Supplier<String> organisationIdSupplier) { <END> this.organisationIdSupplier = organisationIdSupplier; }</code><technical_language>Remove public modifier. is a best-practice in Guice injection constructors visible default scope</technical_language>

Target:
OrganisationIdFilter(@Memoized Supplier<String> organisationIdSupplier) { this.organisationIdSupplier = organisationIdSupplier; }
Source:
<code>public static void main(String[] args) { if (args.length < 3) { System.err.println("ERROR - Expected at least two arguments. " + "Usage: MiniFluoCommand <fluoHomeDir> <command> <appName> ..."); System.exit(-1); } String fluoHomeDir = args[0]; String command = args[1]; String appName = args[2]; String[] remainArgs = Arrays.copyOfRange(args, 3, args.length); if (command.equalsIgnoreCase("scan")) { for (String logger : new String[] {Logger.ROOT_LOGGER_NAME, "io.fluo"}) { ((Logger) LoggerFactory.getLogger(logger)).setLevel(Level.ERROR); } } else if (command.equalsIgnoreCase("wait")) { ((Logger) LoggerFactory.getLogger(FluoConfiguration.class)).setLevel(Level.ERROR); } FluoInstall fluoInstall = new FluoInstall(fluoHomeDir); MiniAppRunner runner = new MiniAppRunner(); switch (command.toLowerCase()) { case "classpath": runner.classpath(fluoHomeDir, remainArgs); break; case "scan": <START> runner.scan(chooseConfig(fluoInstall.resolveFluoConfiguration(appName)), remainArgs); <END> break; case "cleanup": runner.cleanup(fluoInstall.resolveFluoConfiguration(appName)); break; case "wait": runner.waitUntilFinished(chooseConfig(fluoInstall.resolveFluoConfiguration(appName))); break; default: System.err.println("Unknown command: " + command); break; } }</code><technical_language>If print out config used, in case of mini sense do in resolveFluoConfiguration</technical_language>

Target:
public static void main(String[] args) { if (args.length < 3) { System.err.println("ERROR - Expected at least two arguments. " + "Usage: MiniFluoCommand <fluoHomeDir> <command> <appName> ..."); System.exit(-1); } String fluoHomeDir = args[0]; String command = args[1]; String appName = args[2]; String[] remainArgs = Arrays.copyOfRange(args, 3, args.length); if (command.equalsIgnoreCase("scan")) { for (String logger : new String[] {Logger.ROOT_LOGGER_NAME, "io.fluo"}) { ((Logger) LoggerFactory.getLogger(logger)).setLevel(Level.ERROR); } } else if (command.equalsIgnoreCase("wait")) { ((Logger) LoggerFactory.getLogger(FluoConfiguration.class)).setLevel(Level.ERROR); } fluoInstall = new FluoInstall(fluoHomeDir); MiniAppRunner runner = new MiniAppRunner(); switch (command.toLowerCase()) { case "classpath": runner.classpath(fluoHomeDir, remainArgs); break; case "scan": runner.scan(chooseConfig(appName), remainArgs); break; case "cleanup": verifyNoArgs(remainArgs); runner.cleanup(fluoInstall.resolveFluoConfiguration(appName, false)); break; case "wait": verifyNoArgs(remainArgs); runner.waitUntilFinished(chooseConfig(appName)); break; default: System.err.println("Unknown command: " + command); break; } }
Source:
<code>protected void showOutlinePageRec(OutlinePageRec pageRec) { if (activeRec == pageRec) { return; } if (activeRec != null && pageRec != null && activeRec.contentOutlinePage == pageRec.contentOutlinePage) { activeRec = pageRec; return; } activeRec = pageRec; <START> Control pageControl = activeRec.contentOutlinePage.getControl(); <END> if (pageControl != null && !pageControl.isDisposed()) { PageSite pageSite = (PageSite) activeRec.getPageSite(); sashEditorPageBook.showPage(pageControl); getSite().setActivePageSite(pageSite); } }</code><technical_language>PageRec null ? sure, check activeRec avoid Null pointer Exception ..</technical_language>

Target:
protected void showOutlinePageRec(OutlinePageRec pageRec) { if (activeRec == pageRec) { return; } if (activeRec != null && pageRec != null && activeRec.contentOutlinePage == pageRec.contentOutlinePage) { activeRec = pageRec; return; } activeRec = pageRec; if (activeRec != null) { Control pageControl = activeRec.contentOutlinePage.getControl(); if (pageControl != null && !pageControl.isDisposed()) { PageSite pageSite = (PageSite) activeRec.getPageSite(); sashEditorPageBook.showPage(pageControl); getSite().setActivePageSite(pageSite); } } }
Source:
<code>private boolean pullImage(DockerTemplate dockerTemplate) throws IOException { final String imageName = dockerTemplate.getDockerTemplateBase().getImage(); List<Image> images = getClient().listImagesCmd().exec(); NameParser.ReposTag repostag = NameParser.parseRepositoryTag(imageName); final String fullImageName = repostag.repos + ":" + (repostag.tag.isEmpty() ? "latest" : repostag.tag); boolean imageExists = Iterables.any(images, new Predicate<Image>() { @Override public boolean apply(Image image) { return Arrays.asList(image.getRepoTags()).contains(fullImageName); } }); boolean pull = imageExists ? dockerTemplate.getPullStrategy().pullIfExists(imageName) : dockerTemplate.getPullStrategy().pullIfNotExists(imageName); if (pull) { LOGGER.info("Pulling image '{}' since one was not found. This may take awhile...", imageName); try (InputStream imageStream = getClient().pullImageCmd(imageName).exec()) { int streamValue = 0; while (streamValue != -1) { streamValue = imageStream.read(); } } <START> LOGGER.info("Finished pulling image '{}'", imageName); <END> } return true; }</code><technical_language>if pull image, write finished</technical_language>

Target:
private void pullImage(DockerTemplate dockerTemplate) throws IOException { final String imageName = dockerTemplate.getDockerTemplateBase().getImage(); List<Image> images = getClient().listImagesCmd().exec(); NameParser.ReposTag repostag = NameParser.parseRepositoryTag(imageName); final String fullImageName = repostag.repos + ":" + (repostag.tag.isEmpty() ? "latest" : repostag.tag); boolean imageExists = Iterables.any(images, new Predicate<Image>() { @Override public boolean apply(Image image) { return Arrays.asList(image.getRepoTags()).contains(fullImageName); } }); boolean pull = imageExists ? dockerTemplate.getPullStrategy().pullIfExists(imageName) : dockerTemplate.getPullStrategy().pullIfNotExists(imageName); if (pull) { LOGGER.info("Pulling image '{}' since one was not found. This may take awhile...", imageName); try (InputStream imageStream = getClient().pullImageCmd(imageName).exec()) { int streamValue = 0; while (streamValue != -1) { streamValue = imageStream.read(); } } LOGGER.info("Finished pulling image '{}'", imageName); } }