auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public @Nullable Map<@NonNull String, @NonNull SegmentStoreStatistics> getPerSegmentTypeStatsForRange(long start, long end, IProgressMonitor monitor) { @Nullable ITmfTrace trace = getTrace(); if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos())) { waitForCompletion(); return getPerSegmentTypeStats(); } return getPerTypeStats(start, end, monitor); }

Target:
public @Nullable Map<@NonNull String, @NonNull SegmentStoreStatistics> getPerSegmentTypeStatsForRange(long start, long end, IProgressMonitor monitor) { ITmfTrace trace = getTrace(); if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos())) { waitForCompletion(); return getPerSegmentTypeStats(); } return getPerTypeStats(start, end, monitor); }
Source:
public static MagicCommandFinder find(Code code, Map<String, MagicCommandFunctionality> commands, Message message, int executionCount, MessageCreator messageCreator) { List<MagicCommandItemWithResult> errors = new ArrayList<>(); LinkedHashMap<String, MagicCommandFunctionality> functionalityToRun = new LinkedHashMap<>(); code.getCommands().forEach(command -> { if (command.startsWith("%%") && isCellmagicHeadNonEmpty(command)) { errors.add(processIllegalCommand( "Cell magic head contains data move it to body.", message, executionCount, messageCreator)); return; } if (command.contains("\"")) { int indexOfFirstQuote = command.indexOf("\""); command = command.substring(0, indexOfFirstQuote) .replaceAll("\\s+"," ") .concat(command.substring(indexOfFirstQuote, command.length())); } else { command = command.replaceAll("\\s+"," "); } Optional<MagicCommandFunctionality> functionality = findFunctionality(commands, command); if (functionality.isPresent()) { functionalityToRun.put(command, functionality.get()); } else { errors.add(processIllegalCommand("Cell magic " + command + " not found", message, executionCount, messageCreator)); } }); return new MagicCommandFinder(functionalityToRun, errors); }

Target:
public static MagicCommandFinder find(Code code, Map<String, MagicCommandFunctionality> commands, Message message, int executionCount, MessageCreator messageCreator) { List<MagicCommandItemWithResult> errors = new ArrayList<>(); LinkedHashMap<String, MagicCommandFunctionality> functionalityToRun = new LinkedHashMap<>(); code.getCommands().forEach(command -> { if (command.startsWith("%%") && isCellmagicHeadNonEmpty(command)) { errors.add(processIllegalCommand( "Cell magic head contains data, move it to body.", message, executionCount, messageCreator)); return; } if (command.contains("\"")) { int indexOfFirstQuote = command.indexOf("\""); command = command.substring(0, indexOfFirstQuote) .replaceAll("\\s+"," ") .concat(command.substring(indexOfFirstQuote, command.length())); } else { command = command.replaceAll("\\s+"," "); } Optional<MagicCommandFunctionality> functionality = findFunctionality(commands, command); if (functionality.isPresent()) { functionalityToRun.put(command, functionality.get()); } else { errors.add(processIllegalCommand("Cell magic " + command + " not found", message, executionCount, messageCreator)); } }); return new MagicCommandFinder(functionalityToRun, errors); }
Source:
private boolean isRequestAllowed(HttpServletRequest httpRequest) { CurrentUser currentUser = userProvider.get(); if(httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { return currentUser instanceof IdentifiedUser && currentUser.getCapabilities().canAdministrateServer(); } return true; }

Target:
private boolean isRequestAllowed(HttpServletRequest httpRequest) { CurrentUser currentUser = userProvider.get(); if(httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { return currentUser.getCapabilities().canAdministrateServer(); } return true; }
Source:
public static ArrayList<Integer> johnsonLindenstraussMinDim(int[] n, double... eps){ Boolean basicCheck = n == null || n.length == 0 || eps == null || eps.length == 0; if (basicCheck) throw new IllegalArgumentException("Johnson-Lindenstrauss dimension estimation requires > 0 components and at least a relative error"); for (int i =0; i < eps.length; i++){ if (eps[i] <= 0 || eps[i] >= 1) { throw new IllegalArgumentException("A relative error should be in ]0, 1["); } } ArrayList<Integer> res = new ArrayList(n.length * eps.length); for (double epsilon : eps){ double denom = (Math.pow(epsilon, 2) / 2 - Math.pow(epsilon, 3) / 3); for (int components: n){ res.add((int) (4 * Math.log(components) / denom)); } } return res; }

Target:
public static List<Integer> johnsonLindenstraussMinDim(int[] n, double... eps){ Boolean basicCheck = n == null || n.length == 0 || eps == null || eps.length == 0; if (basicCheck) throw new IllegalArgumentException("Johnson-Lindenstrauss dimension estimation requires > 0 components and at least a relative error"); for (double epsilon: eps){ if (epsilon <= 0 || epsilon >= 1) { throw new IllegalArgumentException("A relative error should be in ]0, 1["); } } List<Integer> res = new ArrayList(n.length * eps.length); for (double epsilon : eps){ double denom = (Math.pow(epsilon, 2) / 2 - Math.pow(epsilon, 3) / 3); for (int components: n){ res.add((int) (4 * Math.log(components) / denom)); } } return res; }
Source:
public void addComment(String issueKey, String commentString) { try { JiraSOAPSession jiraSoapSession = login(); JiraSoapService jiraSoapService = jiraSoapSession.getJiraSoapService(); String authToken = jiraSoapSession.getAuthenticationToken(); final RemoteComment comment = new RemoteComment(); comment.setBody(commentString); jiraSoapService.addComment(authToken, issueKey, comment); } catch (RemoteException e) { log.error("Error commenting issue . XMLRPC call failed. "); throw new DomainMethodExecutionException("RPC called failed", e); } finally { this.state = AliveState.DISCONNECTED; } }

Target:
public void addComment(String issueKey, String commentString) { try { JiraSoapService jiraSoapService = login(); RemoteComment comment = new RemoteComment(); comment.setBody(commentString); jiraSoapService.addComment(authToken, issueKey, comment); } catch (RemoteException e) { log.error("Error commenting issue . XMLRPC call failed. "); throw new DomainMethodExecutionException("RPC called failed", e); } finally { this.state = AliveState.DISCONNECTED; } }
Source:
private void readDynamicImagesFromUrl() { try { String appServer = OseeClientProperties.getOseeApplicationServer(); URI uri = UriBuilder.fromUri(appServer).path("images.json").build(); String imagesJson = JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class); if (Strings.isValid(imagesJson)) { ObjectMapper mapper = new ObjectMapper(); DynamicImages images = mapper.readValue(imagesJson, DynamicImages.class); for (DynamicImage dynamicImage : images.getImages()) { try { if (Strings.isValid(dynamicImage.getImageUrl())) { URL url = new URL(dynamicImage.getImageUrl()); Image image = ImageDescriptor.createFromURL(url).createImage(); if (image != null) { IArtifactType artifactType = null; if (Strings.isNumeric(dynamicImage.getArtifactTypeUuid())) { artifactType = ArtifactTypeManager.getTypeByGuid(Long.valueOf(dynamicImage.getArtifactTypeUuid())); } if (artifactType == null && Strings.isValid(dynamicImage.getArtifactTypeName())) { artifactType = ArtifactTypeManager.getType(dynamicImage.getArtifactTypeName()); } if (artifactType != null) { ImageManager.storeOnImageRegistry(artifactType.getName(), ImageDescriptor.createFromImage(image)); ArtifactImageManager.registerOverrideImageProvider(this, artifactType); handledArtifactTypeNames.add(artifactType.getName()); } } } } catch (Exception ex) { OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex, "Error processing image [%s]", dynamicImage); } } } } catch (Exception ex) { OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex, "Error processing dynamic artifact images."); } }

Target:
private void readDynamicImagesFromUrl() { try { String appServer = OseeClientProperties.getOseeApplicationServer(); URI uri = UriBuilder.fromUri(appServer).path("images.json").build(); String imagesJson = JaxRsClient.newClient().target(uri).request(MediaType.TEXT_PLAIN).get(String.class); if (Strings.isValid(imagesJson)) { ObjectMapper mapper = new ObjectMapper(); DynamicImages images = mapper.readValue(imagesJson, DynamicImages.class); for (DynamicImage dynamicImage : images.getImages()) { try { if (Strings.isValid(dynamicImage.getImageUrl())) { URL url = new URL(dynamicImage.getImageUrl()); Image image = ImageDescriptor.createFromURL(url).createImage(); if (image != null) { IArtifactType artifactType = null; if (Strings.isNumeric(dynamicImage.getArtifactTypeUuid())) { artifactType = ArtifactTypeManager.getTypeByGuid(Long.valueOf(dynamicImage.getArtifactTypeUuid())); } if (artifactType == null && Strings.isValid(dynamicImage.getArtifactTypeName())) { artifactType = ArtifactTypeManager.getType(dynamicImage.getArtifactTypeName()); } if (artifactType != null) { ArtifactImageManager.registerBaseImage(artifactType, ImageManager.createKeyedImage( artifactType.getGuid().toString(), ImageDescriptor.createFromImage(image)), this); } } } } catch (Exception ex) { OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex, "Error processing image [%s]", dynamicImage); } } } } catch (Exception ex) { OseeLog.logf(FrameworkArtifactImageProvider.class, Level.SEVERE, ex, "Error processing dynamic artifact images."); } }
Source:
public void onAudioFocusChange(int focusChange) { switch (focusChange) { case AudioManager.AUDIOFOCUS_LOSS: eventEmitter.audioFocusChanged(false); audioManager.abandonAudioFocus(this); break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: eventEmitter.audioFocusChanged(false); break; case AudioManager.AUDIOFOCUS_GAIN: eventEmitter.audioFocusChanged(true); break; default: break; } if (player != null) { if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { if (!muted) { player.setVolume(audioVolume * 0.8f); } } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { if (!muted) { player.setVolume(audioVolume * 1); } } } }

Target:
public void onAudioFocusChange(int focusChange) { switch (focusChange) { case AudioManager.AUDIOFOCUS_LOSS: eventEmitter.audioFocusChanged(false); pausePlayback(); audioManager.abandonAudioFocus(this); break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: eventEmitter.audioFocusChanged(false); break; case AudioManager.AUDIOFOCUS_GAIN: eventEmitter.audioFocusChanged(true); break; default: break; } if (player != null) { if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { if (!muted) { player.setVolume(audioVolume * 0.8f); } } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { if (!muted) { player.setVolume(audioVolume * 1); } } } }
Source:
private static void handleTraceContentChanged(TmfTraceElement traceElement) { Display.getDefault().asyncExec(() -> { boolean opened = false; for (ITmfTrace openedTrace : TmfTraceManager.getInstance().getOpenedTraces()) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(openedTrace)) { if (traceElement.getResource().equals(trace.getResource())) { opened = true; break; } } } if (!opened) { traceElement.deleteSupplementaryResources(); return; } if (!promptQueue.isEmpty()) { if (!promptQueue.contains(traceElement)) { promptQueue.add(traceElement); } return; } promptQueue.add(traceElement); while (!promptQueue.isEmpty()) { TmfTraceElement prompting = promptQueue.poll(); boolean always = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.DELETE_RESOURCE_REFRESH); if (always) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } else { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog messageDialog = new MessageDialog(shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, null, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getName()), MessageDialog.QUESTION, 2, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL); int returnCode = messageDialog.open(); if (returnCode >= 1) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.DELETE_RESOURCE_REFRESH, true); } } } }); }

Target:
private static void handleTraceContentChanged(TmfTraceElement traceElement) { Display.getDefault().asyncExec(() -> { boolean opened = false; for (ITmfTrace openedTrace : TmfTraceManager.getInstance().getOpenedTraces()) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(openedTrace)) { if (traceElement.getResource().equals(trace.getResource())) { opened = true; break; } } } if (!opened) { traceElement.deleteSupplementaryResources(); return; } if (!promptQueue.isEmpty()) { if (!promptQueue.contains(traceElement)) { promptQueue.add(traceElement); } return; } promptQueue.add(traceElement); TmfTraceElement prompting = traceElement; while (prompting != null) { boolean always = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE); if (always) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } else { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog messageDialog = new MessageDialog(shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, null, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getElementPath()), MessageDialog.QUESTION, 2, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, Messages.TmfProjectRegistry_Always); int returnCode = messageDialog.open(); if (returnCode >= 1) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE, true); } } prompting = promptQueue.poll(); } }); }
Source:
public EObject getEObject(String uriFragment) { Option<String> optionalRewrittenFragment = VSMMigrationService.getInstance().getNewFragment(uriFragment); if (optionalRewrittenFragment.some()) { return getEObject(optionalRewrittenFragment.get()); } else { if (isLoading) { return super.getEObject(uriFragment); } else { return getEObjectByID(uriFragment); } } }

Target:
public EObject getEObject(String uriFragment) { Option<String> optionalRewrittenFragment = VSMMigrationService.getInstance().getNewFragment(uriFragment); if (optionalRewrittenFragment.some()) { return getEObject(optionalRewrittenFragment.get()); } else { if (isLoading) { EObject eObject = super.getEObject(uriFragment); if (eObject != null) { String fragment = EcoreUtil.getURI(eObject).fragment(); if (fragment != null) { setID(eObject, fragment); } } return eObject; } else { EObject eObject = getEObjectByID(uriFragment); if (eObject == null) { eObject = super.getEObject(uriFragment); if (eObject != null) { String fragment = EcoreUtil.getURI(eObject).fragment(); if (fragment != null) { setID(eObject, fragment); return getEObject(uriFragment); } } } return eObject; } } }
Source:
public void run() { long periodMSec = checkpointConf.getCheckPeriod() * 1000; long checkpointPeriodMSec = checkpointConf.getPeriod() * 1000; long lastCheckpointTime = 0; if (!backupNode.shouldCheckpointAtStartup()) { lastCheckpointTime = monotonicNow(); } while(shouldRun) { try { long now = monotonicNow(); boolean shouldCheckpoint = false; if(now >= lastCheckpointTime + checkpointPeriodMSec) { shouldCheckpoint = true; } else { long txns = countUncheckpointedTxns(); if(txns >= checkpointConf.getTxnCount()) shouldCheckpoint = true; } if(shouldCheckpoint) { doCheckpoint(); lastCheckpointTime = now; } } catch(IOException e) { LOG.error("Exception in doCheckpoint: ", e); } catch(Throwable e) { LOG.error("Throwable Exception in doCheckpoint: ", e); shutdown(); break; } try { Thread.sleep(LongMath.gcd(periodMSec, checkpointPeriodMSec)); } catch(InterruptedException ie) { } } }

Target:
public void run() { long periodMSec = checkpointConf.getCheckPeriod() * 1000; long checkpointPeriodMSec = checkpointConf.getPeriod() * 1000; long lastCheckpointTime = 0; long lastEditLogCheckTime =0; if (!backupNode.shouldCheckpointAtStartup()) { lastCheckpointTime = monotonicNow(); } while(shouldRun) { try { long now = monotonicNow(); boolean shouldCheckpoint = false; if(now >= lastCheckpointTime + checkpointPeriodMSec) { shouldCheckpoint = true; } else if(now >= lastEditLogCheckTime + periodMSec) { long txns = countUncheckpointedTxns(); lastEditLogCheckTime = now; if(txns >= checkpointConf.getTxnCount()) shouldCheckpoint = true; } if(shouldCheckpoint) { doCheckpoint(); lastCheckpointTime = now; lastEditLogCheckTime = now; } } catch(IOException e) { LOG.error("Exception in doCheckpoint: ", e); } catch(Throwable e) { LOG.error("Throwable Exception in doCheckpoint: ", e); shutdown(); break; } try { Thread.sleep(LongMath.gcd(periodMSec, checkpointPeriodMSec)); } catch(InterruptedException ie) { } } }
Source:
public boolean test(Map.Entry<String, Revisioned> entry) { Object value = entry.getValue(); if (value == null) return false; if (value instanceof CachedRole) { CachedRole cachedRole = (CachedRole)value; if (cachedRole.getComposites().contains(role)) return true; } if (value instanceof CachedGroup) { CachedGroup cachedRole = (CachedGroup)value; if (cachedRole.getRoleMappings().contains(role)) return true; } if (value instanceof RoleQuery) { RoleQuery roleQuery = (RoleQuery)value; if (roleQuery.getRoles().contains(role)) return true; } if (value instanceof CachedClient) { CachedClient cachedClient = (CachedClient)value; if (cachedClient.getScope().contains(role)) return true; } if (value instanceof CachedClientScope) { CachedClientScope cachedClientTemplate = (CachedClientScope)value; if (cachedClientTemplate.getScope().contains(role)) return true; } return false; }

Target:
public boolean test(Map.Entry<String, Revisioned> entry) { Object value = entry.getValue(); if (value == null) return false; if (value instanceof CachedRole) { CachedRole cachedRole = (CachedRole)value; if (cachedRole.getComposites().contains(role)) return true; } if (value instanceof CachedGroup) { CachedGroup cachedRole = (CachedGroup)value; if (cachedRole.getRoleMappings().contains(role)) return true; } if (value instanceof RoleQuery) { RoleQuery roleQuery = (RoleQuery)value; if (roleQuery.getRoles().contains(role)) return true; } if (value instanceof CachedClient) { CachedClient cachedClient = (CachedClient)value; if (cachedClient.getScope().contains(role)) return true; } if (value instanceof CachedClientScope) { CachedClientScope cachedClientScope = (CachedClientScope)value; if (cachedClientScope.getScope().contains(role)) return true; } return false; }
Source:
public static boolean containsMatchingProperty(Set<IConfigurationProperty> existingProperties, String name, String os, String arch) { for (IConfigurationProperty property : existingProperties) { if (name.equals(property.getName().trim())) { String propOs = property.getOs() != null ? property.getOs().trim() : ""; if (ALL_OS.equals(propOs) || ALL_OS.equals(os) || propOs.equals(os)) { String propArch = property.getArch() != null ? property.getArch().trim() : ""; if (propArch.equals(arch) || ALL_ARCH.equals(arch) || ALL_ARCH.equals(propArch)) { return true; } } } } return false; }

Target:
public static boolean containsMatchingProperty(Set<IConfigurationProperty> existingProperties, String name, String os, String arch) { for (IConfigurationProperty property : existingProperties) { if (name.equals(property.getName().trim())) { String propOs = property.getOs() != null ? property.getOs().trim() : ALL_OS; if (ALL_OS.equals(propOs) || ALL_OS.equals(os) || propOs.equals(os)) { String propArch = property.getArch() != null ? property.getArch().trim() : ALL_ARCH; if (propArch.equals(arch) || ALL_ARCH.equals(arch) || ALL_ARCH.equals(propArch)) { return true; } } } } return false; }
Source:
public void setTerminateDruidProcessOnConnectFail(Boolean terminateDruidProcessOnConnectFail) { this.terminateDruidProcessOnConnectFail = terminateDruidProcessOnConnectFail == null ? false : terminateDruidProcessOnConnectFail; }

Target:
public void setTerminateDruidProcessOnConnectFail(Boolean terminateDruidProcessOnConnectFail) { if (terminateDruidProcessOnConnectFail == null) { this.terminateDruidProcessOnConnectFail = false; } else { this.terminateDruidProcessOnConnectFail = terminateDruidProcessOnConnectFail; } }
Source:
public static Policy getPolicy(CloudResourceManager crmService, String projectId) { Policy policy = null; try { GetIamPolicyRequest request = new GetIamPolicyRequest(); policy = crmService.projects().getIamPolicy(projectId, request).execute(); } catch (IOException e) { System.out.println("Unable to get policy: \n" + e.toString()); } return policy; }

Target:
public static Policy getPolicy(CloudResourceManager crmService, String projectId) { Policy policy = null; try { GetIamPolicyRequest request = new GetIamPolicyRequest(); policy = crmService.projects().getIamPolicy(projectId, request).execute(); } catch (IOException e) { System.out.println("Unable to get policy: \n" + e.getMessage() + e.getStackTrace()); } return policy; }
Source:
public Object intercept(InvocationContext ic) throws Exception { final TransactionManager tm = getTransactionManager(); final Transaction tx = tm.getTransaction(); boolean previousUserTransactionAvailability = setUserTransactionAvailable(false); try { return doIntercept(tm, tx, ic); } finally { resetUserTransactionAvailability(previousUserTransactionAvailability); } }

Target:
public Object intercept(InvocationContext ic) throws Exception { final TransactionManager tm = getTransactionManager(); final Transaction tx = tm.getTransaction(); boolean previousUserTransactionAvailability = setUserTransactionAvailable(userTransactionAvailable); try { return doIntercept(tm, tx, ic); } finally { resetUserTransactionAvailability(previousUserTransactionAvailability); } }
Source:
void threadSafeParametersTest() throws Exception { String[] iatas = { "JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX" }; Future[] future = new Future[iatas.length]; ExecutorService executorService = Executors.newFixedThreadPool(iatas.length); try { for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i].toLowerCase() ); airportRepository.save(airport); } try { Thread.sleep(1000); } catch (InterruptedException ie) { ; } for (int k = 0; k < 50; k++) { Callable<Boolean>[] suppliers = new Callable[iatas.length]; for (int i = 0; i < iatas.length; i++) { final int idx = i; suppliers[i] = () -> { try { Thread.sleep(iatas.length - idx); } catch (InterruptedException ie) { ; } List<Airport> airports = airportRepository.findAllByIata(iatas[idx]); String foundName = airportRepository.findAllByIata(iatas[idx]).get(0).getIata(); assertEquals(iatas[idx], foundName); return iatas[idx].equals(foundName); }; } for (int i = 0; i < iatas.length; i++) { future[i] = executorService.submit(suppliers[i]); } for (int i = 0; i < iatas.length; i++) { future[i].get(); } } } finally { executorService.shutdown(); for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i] ); airportRepository.delete(airport); } } }

Target:
void threadSafeParametersTest() throws Exception { String[] iatas = { "JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX" }; Future[] future = new Future[iatas.length]; ExecutorService executorService = Executors.newFixedThreadPool(iatas.length); try { for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i].toLowerCase(Locale.ROOT) ); airportRepository.save(airport); } sleep(1000); for (int k = 0; k < 50; k++) { Callable<Boolean>[] suppliers = new Callable[iatas.length]; for (int i = 0; i < iatas.length; i++) { final int idx = i; suppliers[i] = () -> { sleep(iatas.length - idx); List<Airport> airports = airportRepository.findAllByIata(iatas[idx]); String foundName = airportRepository.findAllByIata(iatas[idx]).get(0).getIata(); assertEquals(iatas[idx], foundName); return iatas[idx].equals(foundName); }; } for (int i = 0; i < iatas.length; i++) { future[i] = executorService.submit(suppliers[i]); } for (int i = 0; i < iatas.length; i++) { future[i].get(); } } } finally { executorService.shutdown(); for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i] ); airportRepository.delete(airport); } } }
Source:
private Map<String, HiveColumnStatistics> groupStatisticsByColumn(List<ColumnStatisticsInfo> statistics, OptionalLong rowCount) { return statistics.stream() .collect(toImmutableMap(ColumnStatisticsInfo::getColName, statisticsObj -> AlluxioProtoUtils.fromProto(statisticsObj.getData(), rowCount))); }

Target:
private Map<String, HiveColumnStatistics> groupStatisticsByColumn(List<ColumnStatisticsInfo> statistics, OptionalLong rowCount) { return statistics.stream() .collect(toImmutableMap(ColumnStatisticsInfo::getColName, statisticsInfo -> AlluxioProtoUtils.fromProto(statisticsInfo.getData(), rowCount))); }
Source:
public void testEnableTablesWithNull() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { HTableDescriptor[] descriptors = admin.enableTables((String) null); assertTrue(descriptors.length > 0); } catch (Exception e) { actualError = e; } assertNotNull(actualError); assertTrue(actualError instanceof NullPointerException); actualError = null; try { assertEquals(0, admin.enableTables("").length); } catch (Exception e) { actualError = e; } assertNull(actualError); } }

Target:
public void testEnableTablesWithNull() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { admin.enableTables((String) null); } catch (Exception e) { actualError = e; } assertNotNull(actualError); assertTrue(actualError instanceof NullPointerException); assertEquals(0, admin.enableTables("").length); } }
Source:
SSOStateSerializer() { }

Target:
private SSOStateSerializer() { }
Source:
public static void main(String[] args) throws Exception { Logger.getLogger(FJmsPublisherTransport.class).setLevel(Level.ALL); FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); FPublisherTransportFactory publisherFactory = new FJmsPublisherTransport.Factory(connection, "VirtualTopic.", true); FScopeProvider provider = new FScopeProvider(publisherFactory, null, protocolFactory); AlbumWinnersPublisher.Iface publisher = new AlbumWinnersPublisher.Client(provider); publisher.open(); Album album = new Album(); album.setASIN(UUID.randomUUID().toString()); album.setDuration(1200); album.addToTracks( new Track( "Comme des enfants", "Coeur de pirate", "Grosse Boîte", "Béatrice Martin", 169, PerfRightsOrg.ASCAP)); publisher.publishWinner(new FContext(), album); List<Album> albums = new ArrayList<>(); albums.add(album); albums.add(album); publisher.publishContestStart(new FContext(), albums); System.out.println("Published event"); publisher.close(); connection.close(); }

Target:
public static void main(String[] args) throws Exception { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); FPublisherTransportFactory publisherFactory = new FJmsPublisherTransport.Factory.Builder(connection).build(); FScopeProvider provider = new FScopeProvider(publisherFactory, null, protocolFactory); AlbumWinnersPublisher.Iface publisher = new AlbumWinnersPublisher.Client(provider); publisher.open(); Album album = new Album(); album.setASIN(UUID.randomUUID().toString()); album.setDuration(1200); album.addToTracks( new Track( "Comme des enfants", "Coeur de pirate", "Grosse Boîte", "Béatrice Martin", 169, PerfRightsOrg.ASCAP)); publisher.publishWinner(new FContext(), album); List<Album> albums = new ArrayList<>(); albums.add(album); albums.add(album); publisher.publishContestStart(new FContext(), albums); System.out.println("Published event"); publisher.close(); connection.close(); }
Source:
private Task<Void> saveAsync(final String sessionToken, final ProgressCallback uploadProgressCallback, Task<Void> toAwait, final Task<Void> cancellationToken) { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } Task<ParseFile.State> saveTask = data != null ? getFileController().saveAsync( state, data, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken) : getFileController().saveAsync( state, file, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken); return saveTask.onSuccessTask(new Continuation<State, Task<Void>>() { @Override public Task<Void> then(Task<State> task) throws Exception { state = task.getResult(); return task.makeVoid(); } }); } }); }

Target:
private Task<Void> saveAsync(final String sessionToken, final ProgressCallback uploadProgressCallback, Task<Void> toAwait, final Task<Void> cancellationToken) { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } Task<ParseFile.State> saveTask; if (data != null) { saveTask = getFileController().saveAsync( state, data, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken); } else { saveTask = getFileController().saveAsync( state, file, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken); } return saveTask.onSuccessTask(new Continuation<State, Task<Void>>() { @Override public Task<Void> then(Task<State> task) throws Exception { state = task.getResult(); file = null; return task.makeVoid(); } }); } }); }
Source:
private static String[] provideIncorrectFormats() { String[] data = new String[] {" Knuth, Donald E. ", "Knuth, Donald E. and Kurt Cobain and A. Einstein", ", and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and ,", "and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and"}; return data; }

Target:
private static Stream<String> provideIncorrectFormats() { return Stream.of(" Knuth, Donald E. ", "Knuth, Donald E. and Kurt Cobain and A. Einstein", ", and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and ,", "and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and"); }
Source:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0, 1}}, {"0\\n1", new int[] {0}}, {"0 1\\n2 3", new int[] {0, 1}}, {"0 1 2\\n3 4 5\\n6 7 8", new int[] {0, 1, 2}} }); }

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0, 1}}, { "0\n" + "1", new int[] {0}}, { "0 1\n" + "2 3", new int[] {0, 1}}, { "0 1 2\n" + "3 4 5\n" + "6 7 8", new int[] {0, 1, 2}} }); }
Source:
protected ToStringHelper string() { return Objects.toStringHelper(this) .add("id", id); }

Target:
protected ToStringHelper string() { return MoreObjects.toStringHelper(this).omitNullValues().add("id", id); }
Source:
public Principal getPrincipal(HttpRequest httpRequest) { try { String auth = AuthUtil.getHeader(httpRequest, "Authorization"); if (!auth.isEmpty()) { String[] authArray = auth.split(" "); if (authArray[0].equals("Basic")) { return null; } else { Base64 base64Url = new Base64(true); String[] splitstring = authArray[1].split("\\."); String base64EncodedBody = splitstring[1]; String body = new String(base64Url.decode(base64EncodedBody)); JSONObject obj = new JSONObject(body); String tokenType = obj.getString("typ"); if (tokenType.equals("Refresh")) { handleRefreshToken(httpRequest, auth); } else if (tokenType.equals("Bearer")) { handleBearerToken(httpRequest); } } KeycloakSecurityContext keycloakSecurityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName()); if (keycloakSecurityContext != null) { String userName = keycloakSecurityContext.getToken().getPreferredUsername(); Principal principal = createPrincipal(userName); return principal; } } else { return null; } } catch (CandlepinException e) { throw e; } catch (Exception e) { throw new ServiceUnavailableException(i18nProvider.get().tr("Keycloak Authentication failed")); } return null; }

Target:
public Principal getPrincipal(HttpRequest httpRequest) { try { String auth = AuthUtil.getHeader(httpRequest, "Authorization"); if (!auth.isEmpty()) { String[] authArray = auth.split(" "); if (authArray[0].equalsIgnoreCase("basic")) { return null; } else { String tokenType = TokenVerifier.create(authArray[1], JsonWebToken.class).getToken().getType(); switch (tokenType) { case TokenUtil.TOKEN_TYPE_BEARER: handleBearerToken(httpRequest); break; case TokenUtil.TOKEN_TYPE_REFRESH: handleRefreshToken(httpRequest, authArray[1]); break; default: log.warn("Not authenticating as token type is unsupported: {}", tokenType); break; } } KeycloakSecurityContext keycloakSecurityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName()); if (keycloakSecurityContext != null && keycloakSecurityContext.getToken() != null) { String userName = keycloakSecurityContext.getToken().getPreferredUsername(); return createPrincipal(userName); } } else { return null; } } catch (CandlepinException e) { throw e; } catch (Exception e) { throw new ServiceUnavailableException(i18nProvider.get().tr("Keycloak Authentication failed")); } return null; }
Source:
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(RECEIVE_ALL_KEY, maximumMessageCount, maximumWaitTime, emitter); }); final Flux<PartitionEvent> map = events.collectList().map(x -> { logger.info("Number of events received: {}", x.size()); return Flux.fromIterable(x); }).block(); return new IterableStream<>(map); }

Target:
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(RECEIVE_ALL_KEY, maximumMessageCount, maximumWaitTime, emitter); }); return new IterableStream<>(events); }
Source:
protected void executeAnalysis() { Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); } catch (TmfAnalysisException e) { } module.execute(); } } }

Target:
protected IStatus executeAnalysis() { MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null); Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); } catch (TmfAnalysisException e) { } status.add(module.execute()); } } return status; }
Source:
public void testAll() throws Exception { testGetInstructorForEmail(); testGetInstructorsForEmail(); testGetInstructorForGoogleId(); testGetInstructorsForGoogleId(); testGetInstructorForRegistrationKey(); testGetInstructorsForCourse(); testGetKeyForInstructor(); testIsGoogleIdOfInstructorOfCourse(); testIsEmailOfInstructorOfCourse(); testVerifyInstructorExists(); testVerifyIsEmailOfInstructorOfCourse(); testIsNewInstructor(); testAddInstructor(); testUpdateInstructorByGoogleId(); testUpdateInstructorByEmail(); testDeleteInstructor(); testDeleteInstructorsForGoogleId(); testDeleteInstructorsForCourse(); testGetCoOwnersForCourse(); }

Target:
public void testAll() throws Exception { testGetInstructorForEmail(); testGetInstructorsForEmail(); testGetInstructorForGoogleId(); testGetInstructorsForGoogleId(); testGetInstructorForRegistrationKey(); testGetInstructorsForCourse(); testGetKeyForInstructor(); testIsGoogleIdOfInstructorOfCourse(); testIsEmailOfInstructorOfCourse(); testVerifyInstructorExists(); testVerifyIsEmailOfInstructorOfCourse(); testIsNewInstructor(); testAddInstructor(); testGetCoOwnersForCourse(); testUpdateInstructorByGoogleId(); testUpdateInstructorByEmail(); testDeleteInstructor(); testDeleteInstructorsForGoogleId(); testDeleteInstructorsForCourse(); }
Source:
public Response publishModel(@PathParam("modelId") long modelId) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { String registryPath = mlModelHandler.publishModel(tenantId, userName, modelId); return Response.ok(registryPath).build(); } catch (InvalidRequestException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(new MLErrorBean(e.getMessage())).build(); } catch (MLModelPublisherException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new MLErrorBean(e.getMessage())) .build(); } }

Target:
public Response publishModel(@PathParam("modelId") long modelId) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { String registryPath = mlModelHandler.publishModel(tenantId, userName, modelId); return Response.ok(new MLResponseBean(registryPath)).build(); } catch (InvalidRequestException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(new MLErrorBean(e.getMessage())).build(); } catch (MLModelPublisherException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new MLErrorBean(e.getMessage())) .build(); } }
Source:
public int compare(RefRight a, RefRight b) { int aLength = a.getRefPattern().length(); int bLength = b.getRefPattern().length(); return bLength - aLength; }

Target:
public int compare(RefRight a, RefRight b) { int aLength = a.getRefPattern().length(); int bLength = b.getRefPattern().length(); if ((bLength - aLength) == 0) { return a.getApprovalCategoryId().get() .compareTo(b.getApprovalCategoryId().get()); } return bLength - aLength; }
Source:
protected void buildVmVirtioSerial() { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSERIAL.getName()); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.VirtioSerial); struct.put(VdsProperties.Index, Integer.toString(0)); addAddress(vmDevice, struct); addDevice(struct, vmDevice, null); } }

Target:
protected void buildVmVirtioSerial() { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSERIAL.getName()); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.VirtioSerial); addAddress(vmDevice, struct); addDevice(struct, vmDevice, null); } }
Source:
protected abstract void addKeyValue(UTF8StringPointable stringKey, TaggedValuePointable taggedValuePointable) throws IOException; private void addPair(TaggedValuePointable tempTvp) throws IOException, SystemException { TaggedValuePointable tvp = isDuplicateKeys(tempTvp, tvps.keySet()); value = ppool.takeOne(TaggedValuePointable.class); tempTvp.getValue(stringKey); op.getValue(stringKey, value); if (tvp == null) { key = ppool.takeOne(TaggedValuePointable.class); key.set(tempTvp); values = new ArrayList<>(); values.add(value); tvps.put(key, values); } else { values = tvps.get(tvp); values.add(value); tvps.replace(tvp, values); } }

Target:
protected abstract void addKeyValue(UTF8StringPointable stringKey, TaggedValuePointable taggedValuePointable) throws IOException; private void addPair(TaggedValuePointable tvp1, ObjectPointable op) throws IOException, SystemException { TaggedValuePointable tvp = isDuplicateKeys(tvp1, tvps.keySet()); value = ppool.takeOne(TaggedValuePointable.class); tvp1.getValue(stringKey); op.getValue(stringKey, value); if (tvp == null) { key = ppool.takeOne(TaggedValuePointable.class); key.set(tvp1); values = new ArrayList<>(); values.add(value); tvps.put(key, values); } else { tvps.get(tvp).add(value); } }
Source:
public void singleCellSpanningSeveralPages() { new TestDataBuilder() .put(10, 1, 1000) .put(10, 1, 1001) .put(10, 1, 1002) .put(10, 1, 1003) .put(10, 1, 1004) .store(); List<CandidateCellForSweeping> cells = getAllCandidates( conservativeRequest(PtBytes.EMPTY_BYTE_ARRAY, 2000L, 2)); assertEquals(ImmutableList.of(ImmutableCandidateCellForSweeping.builder() .cell(cell(10, 1)) .isLatestValueEmpty(false) .numCellsTsPairsExamined(5) .sortedTimestamps(1000L, 1001L, 1002L, 1003L, 1004L) .build()), cells); }

Target:
public void singleCellSpanningSeveralPages() { new TestDataBuilder() .put(10, 1, 1000L) .put(10, 1, 1001L) .put(10, 1, 1002L) .put(10, 1, 1003L) .put(10, 1, 1004L) .store(); List<CandidateCellForSweeping> cells = getAllCandidates( conservativeRequest(PtBytes.EMPTY_BYTE_ARRAY, 2000L, 2)); assertEquals(ImmutableList.of(ImmutableCandidateCellForSweeping.builder() .cell(cell(10, 1)) .isLatestValueEmpty(false) .numCellsTsPairsExamined(5) .sortedTimestamps(1000L, 1001L, 1002L, 1003L, 1004L) .build()), cells); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(" Bank label: " + getBankLabel()); sb.append("\n Capacity: " + FormatUtil.formatBytes(getCapacity())); sb.append("\n Clock speed: " + FormatUtil.formatHertz(getClockSpeed())); sb.append("\n Manufacturer: " + getManufacturer()); sb.append("\n Memory type: " + getMemoryType()); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Bank label: " + getBankLabel()); sb.append(", Capacity: " + FormatUtil.formatBytes(getCapacity())); sb.append(", Clock speed: " + FormatUtil.formatHertz(getClockSpeed())); sb.append(", Manufacturer: " + getManufacturer()); sb.append(", Memory type: " + getMemoryType()); return sb.toString(); }
Source:
public void getChildCollection_shouldThrowAPIExceptionIfGetterMethodNotFound() throws Exception { ClassWithBadGetter oo = new ClassWithBadGetter(); oo.setMyLocations(new HashSet<>()); Assertions.assertThrows(APIException.class,() ->RequiredDataAdvice.getChildCollection(oo, ClassWithBadGetter.class.getDeclaredField("locations"))); }

Target:
public void getChildCollection_shouldThrowAPIExceptionIfGetterMethodNotFound() throws Exception { ClassWithBadGetter oo = new ClassWithBadGetter(); oo.setMyLocations(new HashSet<>()); RequiredDataAdvice.getChildCollection(oo, ClassWithBadGetter.class.getDeclaredField("locations")); }
Source:
public abstract void scheduleJob(Config config) throws JumbuneException; public void deleteCurrentJobEntryFromCron(String jobName) throws JumbuneException { InputStream cronInputStream; cronInputStream = getCurrentUserCronTabInfo(); try { if (cronInputStream != null && cronInputStream.available() != 0) { StringBuilder cronBuilder = new StringBuilder(); InputStreamReader isReader = new InputStreamReader( cronInputStream); BufferedReader br = new BufferedReader(isReader); do { String textinLine = br.readLine(); if (textinLine == null) break; if (!textinLine.contains(jobName+File.separator)){ cronBuilder.append(textinLine); cronBuilder.append("\n"); } } while (true); writeLatestCronTabToFile(cronBuilder.toString()); addUpdatedFileToCron(); } } catch (IOException ioe) { LOGGER.info( " Could not update crontab to remove entry of current job", ioe); throw new JumbuneException(ioe.getMessage()); } finally { if (cronInputStream != null) { try { cronInputStream.close(); } catch (IOException e) { LOGGER.error("could not close the cron file input stream ", e); throw new JumbuneException(e.getMessage()); } } } }

Target:
protected abstract void scheduleJob(Config config) throws JumbuneException; public void deleteCurrentJobEntryFromCron(String jobName) throws JumbuneException { InputStream cronInputStream; cronInputStream = getCurrentUserCronTabInfo(); BufferedReader br = null; try { if (cronInputStream != null && cronInputStream.available() != 0) { StringBuilder cronBuilder = new StringBuilder(); InputStreamReader isReader = new InputStreamReader( cronInputStream); br = new BufferedReader(isReader); do { String textinLine = br.readLine(); if (textinLine == null) break; if (!textinLine.contains(jobName+File.separator)){ cronBuilder.append(textinLine); cronBuilder.append("\n"); } } while (true); writeLatestCronTabToFile(cronBuilder.toString()); addUpdatedFileToCron(); } } catch (IOException ioe) { LOGGER.warn( " Could not update crontab to remove entry of current job", ioe); throw new JumbuneException(ioe.getMessage()); } finally { if (br != null) { try { br.close(); } catch (IOException e) { LOGGER.error("could not close the cron file input stream ", e); throw new JumbuneException(e.getMessage()); } } } }