auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static ExecutorService createInstrumentedFixedThreadPool(CassandraKeyValueServiceConfig config, MetricRegistry registry) { return new InstrumentedExecutorService( createFixedThreadPool("Atlas Cassandra KVS", config.poolSize() * config.servers().thrift().size()), registry, MetricRegistry.name(CassandraKeyValueService.class, "executorService")); }

Target:
private static ExecutorService createInstrumentedFixedThreadPool(CassandraKeyValueServiceConfig config, MetricRegistry registry) { return new InstrumentedExecutorService( createFixedThreadPool("Atlas Cassandra KVS", config.poolSize() * config.servers().numberOfHosts()), registry, MetricRegistry.name(CassandraKeyValueService.class, "executorService")); }
Source:
public void testEntryNotWrapped() throws Throwable { assertClusterSize("Wrong cluster size!", 3); final Object key = new MagicKey(cache(0), cache(1)); final Cache<Object, Object> futureBackupOwnerCache = cache(2); cache(0).put(key, INITIAL_VALUE); final PerCacheInboundInvocationHandler spyHandler = spyInvocationHandler(futureBackupOwnerCache); final EntryFactory spyEntryFactory = spyEntryFactory(futureBackupOwnerCache); final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); doAnswer(invocation -> { CacheRpcCommand command = (CacheRpcCommand) invocation.getArguments()[0]; if (command instanceof StateResponseCommand) { log.debugf("Blocking command %s", command); latch2.countDown(); latch1.await(); } return invocation.callRealMethod(); }).when(spyHandler).handle(any(CacheRpcCommand.class), any(Reply.class), any(DeliverOrder.class)); doAnswer(invocation -> { InvocationContext context = (InvocationContext) invocation.getArguments()[0]; log.debugf("wrapEntryForWriting invoked with %s", context); Object mvccEntry = invocation.callRealMethod(); assertNull(context.lookupEntry(key), "Entry should not be wrapped!"); return mvccEntry; }).when(spyEntryFactory).wrapEntryForWriting(any(InvocationContext.class), any(), anyInt(), anyBoolean(), anyBoolean()); Future<?> killMemberResult = fork(() -> killMember(1)); latch2.await(30, TimeUnit.SECONDS); futureBackupOwnerCache.put(key, FINAL_VALUE); latch1.countDown(); killMemberResult.get(30, TimeUnit.SECONDS); }

Target:
public void testEntryNotWrapped() throws Throwable { assertClusterSize("Wrong cluster size!", 3); final Object key = new MagicKey(cache(0), cache(1)); final Cache<Object, Object> futureBackupOwnerCache = cache(2); cache(0).put(key, INITIAL_VALUE); final PerCacheInboundInvocationHandler spyHandler = spyInvocationHandler(futureBackupOwnerCache); final EntryFactory spyEntryFactory = spyEntryFactory(futureBackupOwnerCache); final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); doAnswer(invocation -> { CacheRpcCommand command = (CacheRpcCommand) invocation.getArguments()[0]; if (command instanceof StateResponseCommand) { log.debugf("Blocking command %s", command); latch2.countDown(); latch1.await(); } return invocation.callRealMethod(); }).when(spyHandler).handle(any(CacheRpcCommand.class), any(Reply.class), any(DeliverOrder.class)); doAnswer(invocation -> { InvocationContext context = (InvocationContext) invocation.getArguments()[0]; log.debugf("wrapEntryForWriting invoked with %s", context); CompletionStage<Void> stage = (CompletionStage<Void>) invocation.callRealMethod(); CompletionStages.join(stage); assertNull(context.lookupEntry(key), "Entry should not be wrapped!"); return stage; }).when(spyEntryFactory).wrapEntryForWriting(any(InvocationContext.class), any(), anyInt(), anyBoolean(), anyBoolean()); Future<?> killMemberResult = fork(() -> killMember(1)); latch2.await(30, TimeUnit.SECONDS); futureBackupOwnerCache.put(key, FINAL_VALUE); latch1.countDown(); killMemberResult.get(30, TimeUnit.SECONDS); }
Source:
public static Comparator<SimpleFeature> sortComparator(SortBy sortBy) { if (sortBy == null) { sortBy = SortBy.NATURAL_ORDER; } if (sortBy == SortBy.NATURAL_ORDER) { return new Comparator<SimpleFeature>() { public int compare(SimpleFeature f1, SimpleFeature f2) { return f1.getID().compareTo(f2.getID()); } }; } else if (sortBy == SortBy.REVERSE_ORDER) { return new Comparator<SimpleFeature>() { public int compare(SimpleFeature f1, SimpleFeature f2) { int compare = f1.getID().compareTo(f2.getID()); return -compare; } }; } else { final PropertyName PROPERTY = sortBy.getPropertyName(); final SortOrder ORDER = sortBy.getSortOrder(); return new Comparator<SimpleFeature>() { @SuppressWarnings("unchecked") public int compare(SimpleFeature f1, SimpleFeature f2) { Object value1 = PROPERTY.evaluate(f1, Comparable.class); Object value2 = PROPERTY.evaluate(f2, Comparable.class); if (value1 == null || value2 == null) { return 0; } if (value1 instanceof Comparable && value1.getClass().isInstance(value2)) { if(ORDER == SortOrder.ASCENDING) { return ((Comparable<Object>) value1).compareTo(value2); }else { return ((Comparable<Object>) value2).compareTo(value1); } } else { return 0; } } }; } }

Target:
public static Comparator<SimpleFeature> sortComparator(SortBy sortBy) { if (sortBy == null) { sortBy = SortBy.NATURAL_ORDER; } if (sortBy == SortBy.NATURAL_ORDER) { return new Comparator<SimpleFeature>() { public int compare(SimpleFeature f1, SimpleFeature f2) { return f1.getID().compareTo(f2.getID()); } }; } else if (sortBy == SortBy.REVERSE_ORDER) { return new Comparator<SimpleFeature>() { public int compare(SimpleFeature f1, SimpleFeature f2) { int compare = f1.getID().compareTo(f2.getID()); return -compare; } }; } else { final PropertyName propertyName = sortBy.getPropertyName(); final SortOrder sortOrder = sortBy.getSortOrder(); return new Comparator<SimpleFeature>() { @SuppressWarnings("unchecked") public int compare(SimpleFeature f1, SimpleFeature f2) { Object value1 = propertyName.evaluate(f1, Comparable.class); Object value2 = propertyName.evaluate(f2, Comparable.class); if (value1 == null || value2 == null) { return 0; } if (value1 instanceof Comparable && value1.getClass().isInstance(value2)) { if (sortOrder == SortOrder.ASCENDING) { return ((Comparable<Object>) value1).compareTo(value2); } else { return ((Comparable<Object>) value2).compareTo(value1); } } else { return 0; } } }; } }
Source:
public void deleteS3Bucket(String bucketName) throws IOException { Preconditions.checkArgument( Strings.isNotBlank(bucketName), "Bucket name cannot be null or empty"); omMetadataManager.getLock().acquireS3BucketLock(bucketName); try { String map = omMetadataManager.getS3Table().get(bucketName); if (map == null) { throw new OMException("No such S3 bucket. " + bucketName, OMException.ResultCodes.S3_BUCKET_NOT_FOUND); } bucketManager.deleteBucket(getOzoneVolumeName(bucketName), bucketName); omMetadataManager.getS3Table().delete(bucketName); } catch(IOException ex) { throw ex; } finally { omMetadataManager.getLock().releaseS3BucketLock(bucketName); } }

Target:
public void deleteS3Bucket(String bucketName) throws IOException { Preconditions.checkArgument( Strings.isNotBlank(bucketName), "Bucket name cannot be null or empty"); omMetadataManager.getLock().acquireLock(S3_BUCKET_LOCK, bucketName); try { String map = omMetadataManager.getS3Table().get(bucketName); if (map == null) { throw new OMException("No such S3 bucket. " + bucketName, OMException.ResultCodes.S3_BUCKET_NOT_FOUND); } bucketManager.deleteBucket(getOzoneVolumeName(bucketName), bucketName); omMetadataManager.getS3Table().delete(bucketName); } catch(IOException ex) { throw ex; } finally { omMetadataManager.getLock().releaseLock(S3_BUCKET_LOCK, bucketName); } }
Source:
public CompletableFuture<JobExecutionResult> getJobExecutionResult() { checkNotNull(classLoader); final Time retryPeriod = Time.milliseconds(100L); return JobStatusPollingUtils.getJobResult(dispatcherGateway, jobId, retryExecutor, timeout, retryPeriod) .thenApply((jobResult) -> { try { return jobResult.toJobExecutionResult(classLoader); } catch (Throwable t) { throw new CompletionException( ApplicationFailureException.fromJobResult(jobResult, classLoader)); } }); }

Target:
public CompletableFuture<JobExecutionResult> getJobExecutionResult() { checkNotNull(classLoader); final Time retryPeriod = Time.milliseconds(100L); return JobStatusPollingUtils.getJobResult(dispatcherGateway, jobId, retryExecutor, timeout, retryPeriod) .thenApply((jobResult) -> { try { return jobResult.toJobExecutionResult(classLoader); } catch (Throwable t) { throw new CompletionException( UnsuccessfulExecutionException.fromJobResult(jobResult, classLoader)); } }); }
Source:
public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { try { Directory indexDir = new IndexDirectory( Paths.get(fIndexRoot, fContainerId, TIMESTAMPS_DIR)); IndexWriterConfig config = new IndexWriterConfig( new SimpleAnalyzer()); ConcurrentMergeScheduler mergeScheduler = new ConcurrentMergeScheduler(); mergeScheduler.setDefaultMaxMergesAndThreads(true); config.setMergeScheduler(mergeScheduler); config.setOpenMode(OpenMode.CREATE_OR_APPEND); fTimestampsWriter = new IndexWriter(indexDir, config); } catch (IOException e) { Logger.logException(e); } } return fTimestampsWriter; }

Target:
public synchronized IndexWriter getTimestampsWriter() { if (fTimestampsWriter == null) { Path writerPath = Paths.get(fIndexRoot, fContainerId, TIMESTAMPS_DIR); fTimestampsWriter = createIndexWriter(writerPath); } return fTimestampsWriter; }
Source:
CompletableFuture<Void> sendLeavePresenceToExistingOccupants(MUCRole leaveRole) { if (!leaveRole.isLocal() || leaveRole.isRemoteFmuc()) return CompletableFuture.completedFuture(null); Log.trace( "Send presence of leaving occupant '{}' to existing occupants of room '{}'.", leaveRole.getUserAddress(), leaveRole.getChatRoom().getJID() ); try { Presence originalPresence = leaveRole.getPresence(); Presence presence = originalPresence.createCopy(); presence.setType(Presence.Type.unavailable); presence.setStatus(null); Element childElement = presence.getChildElement("x", "<LINK_0>"); if (childElement == null) { childElement = presence.addChildElement("x", "<LINK_0>"); } Element item = childElement.element("item"); if (item == null) { item = childElement.addElement("item"); } item.addAttribute("role", "none"); if(!shouldBroadcastPresence(originalPresence)){ leaveRole.send(presence); return CompletableFuture.completedFuture(null); } else { if (getOccupantsByNickname(leaveRole.getNickname()).size() <= 1) { if (JOIN_PRESENCE_ENABLE.getValue()) { return broadcastPresence(presence, false, leaveRole); } } } } catch (Exception e) { Log.error( "An exception occurred while sending leave presence of occupant '"+leaveRole.getUserAddress()+"' to the other occupants of room: '"+leaveRole.getChatRoom().getJID()+"'.", e); } return CompletableFuture.completedFuture(null); }

Target:
CompletableFuture<Void> sendLeavePresenceToExistingOccupants(MUCRole leaveRole) { if (!leaveRole.isLocal() || leaveRole.isRemoteFmuc()) { return CompletableFuture.completedFuture(null); } Log.trace( "Send presence of leaving occupant '{}' to existing occupants of room '{}'.", leaveRole.getUserAddress(), leaveRole.getChatRoom().getJID() ); try { Presence originalPresence = leaveRole.getPresence(); Presence presence = originalPresence.createCopy(); presence.setType(Presence.Type.unavailable); presence.setStatus(null); Element childElement = presence.getChildElement("x", "<LINK_0>"); if (childElement == null) { childElement = presence.addChildElement("x", "<LINK_0>"); } Element item = childElement.element("item"); if (item == null) { item = childElement.addElement("item"); } item.addAttribute("role", "none"); if(!shouldBroadcastPresence(originalPresence)){ leaveRole.send(presence); return CompletableFuture.completedFuture(null); } else { if (getOccupantsByNickname(leaveRole.getNickname()).size() <= 1) { if (JOIN_PRESENCE_ENABLE.getValue()) { return broadcastPresence(presence, false, leaveRole); } } } } catch (Exception e) { Log.error( "An exception occurred while sending leave presence of occupant '"+leaveRole.getUserAddress()+"' to the other occupants of room: '"+leaveRole.getChatRoom().getJID()+"'.", e); } return CompletableFuture.completedFuture(null); }
Source:
public void add(Object obj) throws IOException { if (obj == null) { addValue(0); } else if (obj instanceof Integer) { addValue(((Number) obj).intValue()); } else if (obj instanceof int[]) { int[] vals = (int[]) obj; if (vals.length == 0) { addValue(0); } else { addValue(vals[0]); } } else { throw new IAE("unsupported object type"); } }

Target:
public void add(Object obj) throws IOException { if (obj == null) { addValue(0); } else if (obj instanceof Integer) { addValue(((Number) obj).intValue()); } else if (obj instanceof int[]) { int[] vals = (int[]) obj; if (vals.length == 0) { addValue(0); } else { addValue(vals[0]); } } else { throw new IAE("Unsupported single value type: " + obj.getClass()); } }
Source:
public static void received(Channel channel, Response response, boolean timeout) { try { DefaultFuture future = FUTURES.remove(response.getId()); if (future != null) { Timeout t = future.timeoutCheckTask; if (t != null) { t.cancel(); } future.doReceived(response); } else { logger.warn("The timeout response finally returned at " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())) + ", response " + response + (channel == null ? "" : ", channel: " + channel.getLocalAddress() + " -> " + channel.getRemoteAddress())); } } finally { CHANNELS.remove(response.getId()); } }

Target:
public static void received(Channel channel, Response response, boolean timeout) { try { DefaultFuture future = FUTURES.remove(response.getId()); if (future != null) { Timeout t = future.timeoutCheckTask; if (!timeout) { t.cancel(); } future.doReceived(response); } else { logger.warn("The timeout response finally returned at " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())) + ", response " + response + (channel == null ? "" : ", channel: " + channel.getLocalAddress() + " -> " + channel.getRemoteAddress())); } } finally { CHANNELS.remove(response.getId()); } }
Source:
private byte[] serialize(MetacardType anywhereMType) throws MetacardCreationException { try { return OBJECT_MAPPER.writeValueAsBytes(anywhereMType); } catch (JsonProcessingException e) { throw new MetacardCreationException(COULD_NOT_READ_METACARD_TYPE_MESSAGE, e); } }

Target:
private byte[] serialize(MetacardType anywhereMType) throws MetacardCreationException { try { return METACARD_TYPE_MAPPER.writeValueAsBytes(anywhereMType); } catch (JsonProcessingException e) { throw new MetacardCreationException(COULD_NOT_READ_METACARD_TYPE_MESSAGE, e); } }
Source:
public ModelServiceImpl(IEclipseContext appContext) { if (appContext == null) { throw new NullPointerException("No application context given!"); } this.appContext = appContext; Bundle bundle = FrameworkUtil.getBundle(getClass()); if (bundle != null) { BundleContext bundleContext = bundle.getBundleContext(); if (bundleContext != null) { Dictionary<String, Object> properties = new Hashtable<>(); properties.put(EventConstants.EVENT_TOPIC, new String[] { UIEvents.UIElement.TOPIC_WIDGET }); bundleContext.registerService(EventHandler.class.getName(), ContextInjectionFactory.make(HostedElementEventHandler.class, appContext), properties); } } else { IEventBroker eventBroker = appContext.get(IEventBroker.class); if (eventBroker == null) { throw new IllegalStateException( "Could not get an IEventBroker instance. Please check your configuration that a providing bundle is present and active."); } eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, null, ContextInjectionFactory.make(HostedElementEventHandler.class, appContext), true); } mApplicationElementFactory = new GenericMApplicationElementFactoryImpl( appContext.get(IExtensionRegistry.class)); }

Target:
public ModelServiceImpl(IEclipseContext appContext) { if (appContext == null) { throw new NullPointerException("No application context given!"); } this.appContext = appContext; Bundle bundle = FrameworkUtil.getBundle(getClass()); if (bundle != null && bundle.getBundleContext() != null) { Dictionary<String, Object> properties = new Hashtable<>(); properties.put(EventConstants.EVENT_TOPIC, new String[] { UIEvents.UIElement.TOPIC_WIDGET }); bundle.getBundleContext().registerService(EventHandler.class.getName(), ContextInjectionFactory.make(HostedElementEventHandler.class, appContext), properties); } else { IEventBroker eventBroker = appContext.get(IEventBroker.class); if (eventBroker == null) { throw new IllegalStateException( "Could not get an IEventBroker instance. Please check your configuration that a providing bundle is present and active."); } eventBroker.subscribe(UIEvents.UIElement.TOPIC_WIDGET, null, ContextInjectionFactory.make(HostedElementEventHandler.class, appContext), true); } mApplicationElementFactory = new GenericMApplicationElementFactoryImpl( appContext.get(IExtensionRegistry.class)); }
Source:
private void toggleStickyField() { try { JSONObject field = (JSONObject) mNoteFields.get(mCurrentPos); if (field.getBoolean("sticky")){ field.put("sticky", false); } else { field.put("sticky", true); } } catch (JSONException e) { throw new RuntimeException(e); } }

Target:
private void toggleStickyField() { JSONObject field = (JSONObject) mNoteFields.get(mCurrentPos); if (field.getBoolean("sticky")) { field.put("sticky", false); } else { field.put("sticky", true); } }
Source:
private ListenableFuture<Map<Long, Long>> loadCommitTimestamps( AsyncTransactionService asyncTransactionService, Set<Long> startTimestamps) { if (startTimestamps.size() == 1) { long singleTs = startTimestamps.iterator().next(); return Futures.transform(asyncTransactionService.getAsync(singleTs), commitTsOrNull -> commitTsOrNull == null ? ImmutableMap.of() : ImmutableMap.of(singleTs, commitTsOrNull), MoreExecutors.directExecutor()); } else { return asyncTransactionService.getAsync(startTimestamps); } }

Target:
private static ListenableFuture<Map<Long, Long>> loadCommitTimestamps( AsyncTransactionService asyncTransactionService, Set<Long> startTimestamps) { if (startTimestamps.size() == 1) { long singleTs = startTimestamps.iterator().next(); return Futures.transform(asyncTransactionService.getAsync(singleTs), commitTsOrNull -> commitTsOrNull == null ? ImmutableMap.of() : ImmutableMap.of(singleTs, commitTsOrNull), MoreExecutors.directExecutor()); } else { return asyncTransactionService.getAsync(startTimestamps); } }
Source:
public void testIncludePattern() throws IOException { ReliableEventReader reader = new ReliableSpoolingFileEventReader.Builder() .spoolDirectory(WORK_DIR) .includePattern("^file2$") .deletePolicy(DeletePolicy.IMMEDIATE.toString()) .build(); List<File> before = listFiles(WORK_DIR); Assert.assertEquals("Expected 5, not: " + before, 5, before.size()); List<Event> events; do { events = reader.readEvents(10); reader.commit(); } while (!events.isEmpty()); List<File> after = listFiles(WORK_DIR); Assert.assertEquals("Expected 4, not: " + after, 4, after.size()); Set<String> expectedLeftFiles = new HashSet<String>(Arrays.asList("file0", "file1", "file3", "emptylineFile")); for (File f: after) { expectedLeftFiles.remove(f.getName()); } Assert.assertTrue("Unexpected files were sent", expectedLeftFiles.isEmpty()); List<File> trackerFiles = listFiles(new File(WORK_DIR, SpoolDirectorySourceConfigurationConstants.DEFAULT_TRACKER_DIR)); Assert.assertEquals("Expected 0, not: " + trackerFiles, 0, trackerFiles.size()); }

Target:
public void testIncludePattern() throws IOException { ReliableEventReader reader = new ReliableSpoolingFileEventReader.Builder() .spoolDirectory(WORK_DIR) .includePattern("^file2$") .deletePolicy(DeletePolicy.IMMEDIATE.toString()) .build(); String[] beforeFiles = { "file0", "file1", "file2", "file3", "emptylineFile" }; Assert.assertTrue("Expected " + beforeFiles.length + " files in working dir", checkLeftFilesInDir(WORK_DIR, beforeFiles)); processEventsWithReader(reader, 10); String[] afterFiles = { "file0", "file1", "file3", "emptylineFile" }; Assert.assertTrue("Expected " + afterFiles.length + " files left in working dir", checkLeftFilesInDir(WORK_DIR, afterFiles)); Assert.assertTrue("Expected no files left in tracker dir", checkLeftFilesInDir(TRACKER_DIR, new String[0])); }
Source:
private GridCoverage2D prepareForBandMerge(GridCoverage2D coverage) { RenderedImage ri = coverage.getRenderedImage(); SampleModel sampleModel = ri.getSampleModel(); if (sampleModel.getNumBands() == 1 && ri.getColorModel() instanceof IndexColorModel) { final ParameterBlock paramBlk = new ParameterBlock().addSource(ri); int dataType = sampleModel.getDataType(); paramBlk.add(dataType); ComponentColorModel targetColorModel = new ComponentColorModel( ColorSpace.getInstance(ColorSpace.CS_GRAY), false, false, Transparency.OPAQUE, dataType); ImageLayout layout = new ImageLayout(ri); layout.setColorModel(targetColorModel); if (!targetColorModel.isCompatibleSampleModel(sampleModel)) { SampleModel targetSampleModel = targetColorModel.createCompatibleSampleModel( sampleModel.getWidth(), sampleModel.getHeight()); layout.setSampleModel(targetSampleModel); } Hints localHints = new Hints(hints); localHints.put(JAI.KEY_IMAGE_LAYOUT, layout); RenderedOp formatted = JAI.create("Format", paramBlk, localHints); return new GridCoverageFactory() .create( coverage.getName(), formatted, coverage.getGridGeometry(), coverage.getSampleDimensions(), new GridCoverage[] {coverage}, coverage.getProperties()); } return coverage; }

Target:
private GridCoverage2D prepareForBandMerge(GridCoverage2D coverage) { RenderedImage ri = coverage.getRenderedImage(); SampleModel sampleModel = ri.getSampleModel(); if (sampleModel.getNumBands() == 1 && ri.getColorModel() instanceof IndexColorModel) { ImageWorker worker = new ImageWorker(ri); worker.removeIndexColorModel(); RenderedImage formatted = worker.getRenderedImage(); return new GridCoverageFactory() .create( coverage.getName(), formatted, coverage.getGridGeometry(), coverage.getSampleDimensions(), new GridCoverage[] {coverage}, coverage.getProperties()); } return coverage; }
Source:
protected static String printResults(Statement stmt, String selection, int columnVerificationNumber) throws SQLException{ ResultSet res; String sql= selection; res=stmt.executeQuery(sql); System.out.println("\n"+"Printing Results: "+sql+"\n"); ResultSetMetaData rsmd = res.getMetaData(); int columnsNumber = rsmd.getColumnCount(); for (int q=1; q<=columnsNumber; q++){ System.out.print(rsmd.getColumnName(q) +" "); } System.out.println(); System.out.println(); while (res.next()) { for (int i = 1; i <= columnsNumber; i++) { String columnValue = res.getString(i); System.out.print(columnValue +" "); } System.out.println(""); } res=stmt.executeQuery(sql); return resultSetVerification(res, columnVerificationNumber); }

Target:
static String printResults(Statement stmt, String selection, int columnVerificationNumber) throws SQLException { ResultSet res; String sql = selection; res = stmt.executeQuery(sql); System.out.println("\n" + "Printing Results: " + sql + "\n"); ResultSetMetaData rsmd = res.getMetaData(); int columnsNumber = rsmd.getColumnCount(); for (int q = 1; q <= columnsNumber; q++) { System.out.print(rsmd.getColumnName(q) + " "); } System.out.println("\n"); while (res.next()) { for (int i = 1; i <= columnsNumber; i++) { String columnValue = res.getString(i); System.out.print(columnValue + " "); } System.out.println(""); } res = stmt.executeQuery(sql); return resultSetVerification(res, columnVerificationNumber); }
Source:
ClientInfoResourceTestClient( ObjectMapper jsonMapper, @TestClient HttpClient httpClient, IntegrationTestingConfig config ) { this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.broker = config.getBrokerUrl(); this.responseHandler = new StatusResponseHandler(Charsets.UTF_8); }

Target:
ClientInfoResourceTestClient( ObjectMapper jsonMapper, @TestClient HttpClient httpClient, IntegrationTestingConfig config ) { this.jsonMapper = jsonMapper; this.httpClient = httpClient; this.brokerUrl = config.getBrokerUrl(); this.responseHandler = new StatusResponseHandler(Charsets.UTF_8); }
Source:
public void pidFileForStaleProcessIsIgnored() throws Exception { Files.write(getPidFile().toPath(), "66000".getBytes()); TestUtils.SwarmClientProcessWrapper node = TestUtils.runSwarmClient( "agent0", j, processDestroyer, temporaryFolder, "-pidFile", getPidFile().getAbsolutePath()); TestUtils.waitForNode("agent0", j); int newPid = NumberUtils.toInt( new String(Files.readAllBytes(getPidFile().toPath()), UTF_8)); OSProcess[] childProcesses = os.getChildProcesses(os.getProcessId(), 0, null); assertTrue("Pid in pidFile must match our new pid", Arrays.stream(childProcesses).anyMatch(proc -> proc.getProcessID() == newPid)); }

Target:
public void pidFileForStaleProcessIsIgnored() throws Exception { File pidFile = getPidFile(); Files.write(pidFile.toPath(), "66000".getBytes()); TestUtils.createSwarmClient( j, processDestroyer, temporaryFolder, "-pidFile", pidFile.getAbsolutePath()); int newPid = readPidFromFile(pidFile); OSProcess[] childProcesses = os.getChildProcesses(os.getProcessId(), 0, null); assertTrue( "PID in PID file must match our new PID", Arrays.stream(childProcesses).anyMatch(proc -> proc.getProcessID() == newPid)); }
Source:
private MojoParameters buildParameters(String projectDir, String sourceDir, String outputDir) { MavenProject mavenProject = new MavenProject(); mavenProject.setFile(new File(projectDir + File.separator + "pom.xml")); return new MojoParameters(null, mavenProject, null, null, null, null, sourceDir, outputDir); }

Target:
private MojoParameters buildParameters(String projectDir, String sourceDir, String outputDir) { MavenProject mavenProject = new MavenProject(); mavenProject.setFile(new File(projectDir, "pom.xml")); return new MojoParameters(null, mavenProject, null, null, null, null, sourceDir.replace("/", File.separator), outputDir.replace("/", File.separator)); }
Source:
public void deleteGermplasmListFolder(final Integer folderId) { final GermplasmList folder = this.getGermplasmListById(folderId) .orElseThrow(() -> new MiddlewareException("FolderId does not exist")); this.daoFactory.getGermplasmListDAO().makeTransient(folder); }

Target:
public void deleteGermplasmListFolder(final Integer folderId) { final GermplasmList folder = this.getGermplasmListById(folderId) .orElseThrow(() -> new MiddlewareRequestException("", "list.folder.not.found")); this.daoFactory.getGermplasmListDAO().makeTransient(folder); }
Source:
public ListenableFuture<AckingContainer> poll(boolean forcePollSchema) { final SettableFuture<AckingContainer> fut = SettableFuture.create(); PollTask pollTask = new PollTask(fut, forcePollSchema); try { m_es.execute(new Runnable() { @Override public void run() { if (!m_mastershipAccepted.get()) { pollTask.clear(); m_pollTask = null; return; } try { if (m_pendingContainer.get() != null) { pollTask.setFuture(m_pendingContainer.getAndSet(null)); if (m_pollTask != null) { if (exportLog.isDebugEnabled()) { exportLog.debug("Pick up work from pending container, set poll future to null"); } m_pollTask = null; } return; } if (m_pollTask != null) { fut.setException(new ReentrantPollException("Reentrant poll detected: InCat = " + m_isInCatalog + " In ExportDataSource for Table " + getTableName() + ", Partition " + getPartitionId())); return; } if (!m_es.isShutdown()) { pollImpl(pollTask); } } catch (Exception e) { exportLog.error("Exception polling export buffer", e); } catch (Error e) { VoltDB.crashLocalVoltDB("Error polling export buffer", true, e); } } }); } catch (RejectedExecutionException rej) { exportLog.info("Polling from export data source rejected, this should be harmless"); } return fut; }

Target:
public ListenableFuture<AckingContainer> poll(boolean forcePollSchema) { final SettableFuture<AckingContainer> fut = SettableFuture.create(); PollTask pollTask = new PollTask(fut, forcePollSchema); try { m_es.execute(new Runnable() { @Override public void run() { if (!m_mastershipAccepted.get()) { pollTask.clear(); m_pollTask = null; return; } try { if (m_pendingContainer.get() != null) { AckingContainer cont = m_pendingContainer.getAndSet(null); boolean hasSchema = cont.schema() != null; if (!hasSchema) { BBContainer schemaContainer = m_committedBuffers.pollSchema(); if (schemaContainer == null) { pollTask.setException(new IOException("No schema for committedSeqNo " + cont)); return; } else { cont.setSchema(schemaContainer); } } pollTask.setFuture(cont); if (m_pollTask != null) { if (exportLog.isDebugEnabled()) { exportLog.debug("Pick up work from pending container, set poll future to null"); } m_pollTask = null; } return; } if (m_pollTask != null) { fut.setException(new ReentrantPollException("Reentrant poll detected: InCat = " + m_isInCatalog + " In ExportDataSource for Table " + getTableName() + ", Partition " + getPartitionId())); return; } if (!m_es.isShutdown()) { pollImpl(pollTask); } } catch (Exception e) { exportLog.error("Exception polling export buffer", e); } catch (Error e) { VoltDB.crashLocalVoltDB("Error polling export buffer", true, e); } } }); } catch (RejectedExecutionException rej) { exportLog.info("Polling from export data source rejected, this should be harmless"); } return fut; }
Source:
public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) return 0; if (cnt == -1) return -1; final int startOff = off; final int end = off + len; while (off < end) { if (ptr == cnt && !fillBuffer()) { break; } byte b = buf[ptr++]; if (isBinary || b != '\n') { bs[off++] = last = b; continue; } if (b == '\n') { if (last == '\r') { bs[off++] = last = b; continue; } bs[off++] = last = '\r'; ptr--; } else { bs[off++] = last = b; } } int n = startOff == off ? -1 : off - startOff; if (n > 0) last = bs[off - 1]; return n; }

Target:
public int read(byte[] bs, int off, int len) throws IOException { if (len == 0) return 0; if (cnt == -1) return -1; final int startOff = off; final int end = off + len; while (off < end) { if (ptr == cnt && !fillBuffer()) break; byte b = buf[ptr++]; if (isBinary || b != '\n') { bs[off++] = last = b; continue; } if (b == '\n') { if (last == '\r') { bs[off++] = last = b; continue; } bs[off++] = last = '\r'; ptr--; } else bs[off++] = last = b; } int n = startOff == off ? -1 : off - startOff; if (n > 0) last = bs[off - 1]; return n; }
Source:
void addOccurances(ConcretizationInfo cfg, KLabel cell, KVariable var, List<K> items) { this.var = var; if (parentCell == null) { parentCell = cell; } else if (!parentCell.equals(cell)) { throw new IllegalArgumentException("Cell variable used under two cells, " + parentCell + " and " + cell); } if (remainingCells == null) { remainingCells = new HashSet<>(cfg.getChildren(cell)); } for (K item : items) { if (item instanceof KApply) { KApply kApply = (KApply) item; Sort s = cfg.getCellSort(kApply.klabel()); if (cfg.getMultiplicity(s) != ConfigurationInfo.Multiplicity.STAR) { remainingCells.remove(s); } } } }

Target:
void addOccurances(ConcretizationInfo cfg, KLabel cell, KVariable var, List<K> items) { this.var = var; if (parentCell == null) { parentCell = cell; } else if (!parentCell.equals(cell)) { throw KExceptionManager.criticalError("Cell variable used under two cells, " + parentCell + " and " + cell); } if (remainingCells == null) { remainingCells = new HashSet<>(cfg.getChildren(cell)); } for (K item : items) { if (item instanceof KApply) { KApply kApply = (KApply) item; Sort s = cfg.getCellSort(kApply.klabel()); if (cfg.getMultiplicity(s) != ConfigurationInfo.Multiplicity.STAR) { remainingCells.remove(s); } } } }
Source:
public ConfigFileParser(File configFile, KTestOptions cmdArgs) throws IOException, SAXException, ParserConfigurationException, TransformerException { this.cmdArgs = cmdArgs; Source schemaFile = new StreamSource(new File(getSchema())); Source xmlFile = new StreamSource(configFile); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaFile); Validator validator = schema.newValidator(); try { validator.validate(xmlFile); } catch (SAXException e) { String formatDoc = "<LINK_0>"; String pre = "Invalid config file formatting. "; String post = " (see " + formatDoc + " for config file formatting)"; throw new SAXException(pre + e.getMessage() + post); } DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer nullTransformer = transformerFactory.newTransformer(); DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder(); doc = docBuilder.newDocument(); DOMResult domResult = new DOMResult(doc); XMLReader xmlReader = XMLReaderFactory.createXMLReader(); ConfigPreProcessor locationAnnotator = new ConfigPreProcessor(xmlReader, doc); String systemId = configFile.getAbsolutePath(); InputSource inputSource = new InputSource(systemId); SAXSource saxSource = new SAXSource(locationAnnotator, inputSource); nullTransformer.transform(saxSource, domResult); }

Target:
public ConfigFileParser(File configFile, KTestOptions cmdArgs) throws IOException, SAXException, ParserConfigurationException, TransformerException { this.cmdArgs = cmdArgs; Source schemaFile = new StreamSource(new File(getSchema())); Source xmlFile = new StreamSource(configFile); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaFile); Validator validator = schema.newValidator(); try { validator.validate(xmlFile); } catch (SAXException e) { GlobalSettings.kem.registerCriticalError( "Invalid config file formatting. Refer to the K manual for details. " + e.getMessage()); } DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer nullTransformer = transformerFactory.newTransformer(); DocumentBuilder docBuilder = documentBuilderFactory.newDocumentBuilder(); doc = docBuilder.newDocument(); DOMResult domResult = new DOMResult(doc); XMLReader xmlReader = XMLReaderFactory.createXMLReader(); ConfigPreProcessor locationAnnotator = new ConfigPreProcessor(xmlReader, doc); String systemId = configFile.getAbsolutePath(); InputSource inputSource = new InputSource(systemId); SAXSource saxSource = new SAXSource(locationAnnotator, inputSource); nullTransformer.transform(saxSource, domResult); }
Source:
public void testShouldAnonymizeCharactersAfterSkippingCharactersUsingDigitals(){ String from = "3551085"; String digitals = "1234567890"; partialCharacterAnonymizer.NUMBER_OF_SKIPPED_CHARACTERS = 3; Map<String, String> m = new HashMap<>(); m.put(PartialCharacterAnonymizer.PARAMETER, digitals); Synonym synonym = partialCharacterAnonymizer.anonymize(from, 5, false, m); String to = (String) synonym.getTo(); System.out.println(from); System.out.println(to); }

Target:
public void testShouldAnonymizeCharactersAfterSkippingCharactersUsingDigitals(){ String from = "3551085"; String CHARS = "1234567890"; partialCharacterAnonymizer.NUMBER_OF_SKIPPED_CHARACTERS = 3; Map<String, String> m = new HashMap<>(); m.put(PartialCharacterAnonymizer.PARAMETER, CHARS); Synonym synonym = partialCharacterAnonymizer.anonymize(from, 5, false, m); String to = (String) synonym.getTo(); Assert.assertNotSame(to.substring(3) +" is not different than " + from.substring(3), to.substring(3) ,from.substring(3)); }
Source:
public ValidationResult bondNotUpdatedAndRemovedSimultaneously() { List<CreateOrUpdateBond> duplicateBonds = params.getCreateOrUpdateBonds() .stream() .filter(bond -> params.getRemovedBonds().contains(bond.getId())).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(duplicateBonds)) { EngineMessage engineMessage = EngineMessage.BOND_UPDATED_AND_REMOVED_SIMULTANEOUSLY; return new ValidationResult(engineMessage, ReplacementUtils.getListVariableAssignmentString(engineMessage, duplicateBonds.stream().map(CreateOrUpdateBond::getName).collect(Collectors.toList()))); } return ValidationResult.VALID; }

Target:
public ValidationResult bondNotUpdatedAndRemovedSimultaneously() { List<String> bondsUpdatedAndRemovedSimultaneously = params.getCreateOrUpdateBonds() .stream() .filter(bond -> params.getRemovedBonds().contains(bond.getId())) .map(CreateOrUpdateBond::getName) .collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(bondsUpdatedAndRemovedSimultaneously)) { EngineMessage engineMessage = EngineMessage.BONDS_UPDATED_AND_REMOVED_SIMULTANEOUSLY; return new ValidationResult(engineMessage, ReplacementUtils.getListVariableAssignmentString(engineMessage, bondsUpdatedAndRemovedSimultaneously)); } return ValidationResult.VALID; }
Source:
public DescribeInternetGatewaysResponseHandler(InternetGatewayHandler gatewayHandler) { this.gatewayHandler = gatewayHandler; }

Target:
DescribeInternetGatewaysResponseHandler(InternetGatewayHandler gatewayHandler) { this.gatewayHandler = gatewayHandler; }
Source:
public List<Footer> getFooters(JobContext jobContext) throws IOException { if (footers == null) { List<FileStatus> statuses = listStatus(jobContext); fileStatuses.clear(); for (FileStatus status : statuses) { fileStatuses.put(status.getPath(), status); } footers = getFooters(ContextUtil.getConfiguration(jobContext), statuses); } return footers; }

Target:
public List<Footer> getFooters(JobContext jobContext) throws IOException { List<FootersCacheValue> cacheFooters= getCachedFooters(jobContext); List<Footer> footers = new ArrayList<Footer>(cacheFooters.size()); for (FootersCacheValue cachedFooter: cacheFooters) { footers.add(cachedFooter.footer); } return footers; }
Source:
ParameterizedTypeName(ClassName rawType, List<TypeName> typeArguments, List<AnnotationSpec> annotations) { this( rawType, rawType.enclosingClassName() != null ? rawType.enclosingClassName() : rawType, rawType.enclosingClassName() != null ? rawType.simpleName() : null, typeArguments, annotations); }

Target:
ParameterizedTypeName(ClassName rawType, List<TypeName> typeArguments, List<AnnotationSpec> annotations) { this(rawType, null, typeArguments, annotations); }
Source:
public void quit() { if (browserComponent != null) { browserComponent.onAppQuit(); } if (!TestController.isTestMode() || TestController.isTestGlobalConfig()) { panels.saveSession(); prefs.saveGlobalConfig(); } if (!TestController.isTestMode() || TestController.isCloseOnQuit()) { Platform.exit(); System.exit(0); } provider.reset(); provider.stop(); }

Target:
public void quit() { globalHotkey.quit(); if (browserComponent != null) { browserComponent.onAppQuit(); } if (!TestController.isTestMode() || TestController.isTestGlobalConfig()) { panels.saveSession(); prefs.saveGlobalConfig(); } if (!TestController.isTestMode() || TestController.isCloseOnQuit()) { Platform.exit(); System.exit(0); } }
Source:
public Response serve(IHTTPSession session) { Map<String, List<String>> parms = session.getParameters(); if (filePath == null) { return newFixedLengthResponse(Response.Status.FORBIDDEN, "", ""); } FileInputStream fis = null; try { fis = new FileInputStream(filePath); } catch (FileNotFoundException e) { e.printStackTrace(); return newFixedLengthResponse(Response.Status.FORBIDDEN, "", ""); } String mimeType = this.mimeType; return newChunkedResponse(Response.Status.OK, mimeType, fis); }

Target:
public Response serve(IHTTPSession session) { Map<String, List<String>> params = session.getParameters(); if (localFileLocationList == null) { return newFixedLengthResponse(Response.Status.FORBIDDEN, "", ""); } if (!params.containsKey("number")) { return null; } int file_number = Integer.parseInt(params.get("number").get(0)); FileInputStream fis = null; LocalFileLocation localFileLocation = localFileLocationList.get(file_number); try { fis = new FileInputStream(localFileLocation.fullPath); } catch (FileNotFoundException e) { LogUtils.LOGW(LogUtils.makeLogTag(HttpApp.class), e.toString()); return newFixedLengthResponse(Response.Status.FORBIDDEN, "", ""); } String mimeType = localFileLocation.getMimeType(); return newChunkedResponse(Response.Status.OK, mimeType, fis); }
Source:
public void onManagementBecomingMaster() { if (setChangeListener != null) { log.warn("{} becoming master twice", this); return; } setChangeListener = new MyEntitySetChangeListener(); ((ManagementContextInternal) getManagementContext()).addEntitySetListener(setChangeListener); Task<Object> rescan = Tasks.builder().name("rescan entities").body( new Runnable() { @Override public void run() { try { rescanEntities(); } catch (Exception e) { log.warn("Error rescanning entities when rebinding; may be a group set against an unknown entity: "+e); log.debug("Trace for rescan entities error", e); Exceptions.propagateIfFatal(e); } } }).build(); getExecutionContext().submit(rescan); }

Target:
public void onManagementBecomingMaster() { if (setChangeListener != null) { log.warn("{} becoming master twice", this); return; } setChangeListener = new MyEntitySetChangeListener(); ((ManagementContextInternal) getManagementContext()).addEntitySetListener(setChangeListener); Task<Object> rescan = Tasks.builder().name("rescan entities").body( new Runnable() { @Override public void run() { try { rescanEntities(); } catch (Exception e) { log.warn("Error rescanning entities on management of "+DynamicGroupImpl.this+"; may be a group set against an unknown entity: "+e); log.debug("Trace for rescan entities error", e); Exceptions.propagateIfFatal(e); } } }).build(); getExecutionContext().submit(rescan); }
Source:
public byte[] getTagsArray() { return new byte[0]; }

Target:
public byte[] getTagsArray() { return HConstants.EMPTY_BYTE_ARRAY; }
Source:
public ArrayList<Attachment> createAttachmentList() { ArrayList<Attachment> result = new ArrayList<>(); for (Attachment attachment : attachments.values()) { int resizeCircumference; int resizeQuality; if (account.isResizeImageEnabled() && !attachment.resizeImageOverrideDefault && ImageResizer.isImage(context, attachment.uri)) { resizeCircumference = account.getResizeImageCircumference(); resizeQuality = account.getResizeImageQuality(); } else if (attachment.resizeImageOverrideDefault && ImageResizer.isImage(context, attachment.uri)) { resizeCircumference = attachment.resizeImageCircumference; resizeQuality = attachment.resizeImageQuality; } else { resizeCircumference = 0; resizeQuality = 0; } if (resizeCircumference != 0) { try { String newFilename = imageResizer.getResizedImageFile(context, attachment.uri, resizeCircumference, resizeQuality); long size = (new File(newFilename)).length(); Attachment newAttachment = attachment.createResizedCopy(newFilename, size); result.add(newAttachment); return result; } catch (IOException ioe) { Timber.i("image resizing failed for " + attachment.uri + " circumference=" + resizeCircumference + ", quality=" + resizeQuality); } } result.add(attachment); } return result; }

Target:
public ArrayList<Attachment> createAttachmentList() { return new ArrayList<>(attachments.values()); }
Source:
public void start() { try { cache.getListenable().addListener(this); cache.start(); } catch (Exception ex) { throw Throwables.propagate(ex); } }

Target:
public void start() { try { cache.getListenable().addListener( (client, event) -> handleChildEvent(client, event) ); cache.start(); } catch (Exception ex) { throw Throwables.propagate(ex); } }
Source:
private void finish() { if (running) { AncientAltarOutputEvent ancientAltarOutputEvent = new AncientAltarOutputEvent(output, altar); Bukkit.getPluginManager().callEvent(ancientAltarOutputEvent); if (!ancientAltarOutputEvent.isCancelled()) { dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1F, 1F); dropLocation.getWorld().playEffect(dropLocation, Effect.STEP_SOUND, Material.EMERALD_BLOCK); dropLocation.getWorld().dropItemNaturally(dropLocation.add(0, -0.5, 0), output); } pedestals.forEach(b -> listener.getAltarsInUse().remove(b.getLocation())); listener.getAltarsInUse().remove(altar.getLocation()); listener.getAltars().remove(altar); } else { dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 1F); } }

Target:
private void finish() { if (running) { AncientAltarCraftEvent event = new AncientAltarCraftEvent(output, altar, player); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_VILLAGER_CURE, 1F, 1F); dropLocation.getWorld().playEffect(dropLocation, Effect.STEP_SOUND, Material.EMERALD_BLOCK); dropLocation.getWorld().dropItemNaturally(dropLocation.add(0, -0.5, 0), event.getItem()); } pedestals.forEach(b -> listener.getAltarsInUse().remove(b.getLocation())); listener.getAltarsInUse().remove(altar.getLocation()); listener.getAltars().remove(altar); } else { dropLocation.getWorld().playSound(dropLocation, Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 1F); } }
Source:
private static void validateInode(INodesInPath srcIIP) throws IOException { String errorPrefix = "DIR* FSDirectory.swapBlockList: "; String error = "Swap Block List input "; final INode srcInode = srcIIP.getLastINode(); if (srcInode == null) { error += srcIIP.getPath() + " is not found."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new FileNotFoundException(error); } if (!srcInode.isFile()) { error += srcIIP.getPath() + " is not a file."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } INodeFile iNodeFile = (INodeFile) srcIIP.getLastINode(); if (iNodeFile.isUnderConstruction()) { error += srcIIP.getPath() + " is under construction."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } if (srcIIP.getLatestSnapshotId() != Snapshot.CURRENT_STATE_ID) { error += srcIIP.getPath() + " is in a snapshot directory."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } }

Target:
private static void validateInode(INodesInPath srcIIP) throws IOException { String errorPrefix = "DIR* FSDirectory.swapBlockList: "; String error = "Swap Block List input "; INode srcInode = FSDirectory.resolveLastINode(srcIIP); if (!srcInode.isFile()) { error += srcIIP.getPath() + " is not a file."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } INodeFile iNodeFile = (INodeFile) srcIIP.getLastINode(); if (iNodeFile.isUnderConstruction()) { error += srcIIP.getPath() + " is under construction."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } if (srcIIP.getLatestSnapshotId() != Snapshot.CURRENT_STATE_ID) { error += srcIIP.getPath() + " is in a snapshot directory."; NameNode.stateChangeLog.warn(errorPrefix + error); throw new IOException(error); } }
Source:
private void searchAndRemoveGraphicalSynapseCongif(IProject project) { try { if (project.hasNature("org.wso2.developerstudio.eclipse.esb.project.nature")) { deleteGraphicalSynapseConfigDir(project); } else if (project.hasNature("org.wso2.developerstudio.eclipse.general.project.nature")){ deleteGraphicalSynapseConfigFiles(project); } } catch (CoreException e) { log.error("Error while deleting graphical-synapse-config directory in " + project); } }

Target:
private void searchAndRemoveGraphicalSynapseCongif(IProject project) { try { if (project.hasNature(Constants.ESB_PROJECT_NATURE)) { deleteGraphicalSynapseConfigDir(project); } else if (project.hasNature(Constants.GENERAL_PROJECT_NATURE)) { deleteGraphicalSynapseConfigFiles(project); } } catch (CoreException e) { log.error("Error while deleting graphical-synapse-config directory in " + project); } }
Source:
public void persistQueueOnCrash() { j.addStepWithDirtyShutdown(new Statement() { @Override public void evaluate() throws Throwable { Queue.Saver.DELAY_SECONDS = 0; scheduleSomeBuild(); assertBuildIsScheduled(); assertTrue("queue.xml does not exist", j.j.jenkins.getQueue().getXMLQueueFile().exists()); } }); j.addStep(new Statement() { @Override public void evaluate() { assertBuildIsScheduled(); } }); }

Target:
public void persistQueueOnCrash() { j.addStepWithDirtyShutdown(new Statement() { @Override public void evaluate() throws Throwable { Queue.Saver.DELAY_SECONDS = 0; scheduleSomeBuild(); assertBuildIsScheduled(); ExtensionList.lookup(Queue.Saver.class).get(0).getNextSave().get(3, TimeUnit.SECONDS); assertTrue("queue.xml does not exist", j.j.jenkins.getQueue().getXMLQueueFile().exists()); } }); j.addStep(new Statement() { @Override public void evaluate() { assertBuildIsScheduled(); } }); }