auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public DatabaseStorageBase(String databaseDirectory) { dbUrl = String.format(dbUrlPreFormat, databaseDirectory); try { conn = DriverManager.getConnection(dbUrl); } catch (SQLException e) { log.error("Ran into a SQL problem - could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } catch (Exception e) { log.error("Ran into a general expection, so could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } if (propertiesTableExists() == false) { createPropertiesTable(); } }

Target:
public DatabaseStorageBase(String databaseDirectory) { dbUrl = String.format(dbUrlPreFormat, databaseDirectory); try { conn = DriverManager.getConnection(dbUrl); } catch (SQLException e) { log.error("Ran into a SQL problem - could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } catch (Exception e) { log.error("Ran into a general exception, so could not open a connection to the database! No properties will be loaded or persisted!!"); log.error(e.toString()); e.printStackTrace(); } if (propertiesTableExists() == false) { createPropertiesTable(); } }
Source:
default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B> joiner) { if (joiner instanceof FilteringBiJoiner) { FilteringBiJoiner<A, B> filteringJoiner = (FilteringBiJoiner<A, B>) joiner; return join(otherClass) .filter(filteringJoiner.getFilter()); } else { return join(getConstraintFactory().from(otherClass), joiner); } }

Target:
default <B> BiConstraintStream<A, B> join(Class<B> otherClass, BiJoiner<A, B> joiner) { return join(getConstraintFactory().from(otherClass), joiner); }
Source:
public void run() { try { stats.addQueuedTime(Duration.nanosSince(queuedTime)); long start = System.nanoTime(); backupStore.get().backupShard(uuid, source); stats.addCopyShardDataRate(new DataSize(source.length(), BYTE), Duration.nanosSince(start)); File restored = new File(storageService.getStagingFile(uuid) + ".validate"); backupStore.get().restoreShard(uuid, restored); if (!Files.equal(source, restored)) { stats.incrementBackupCorruption(); File quarantineBase = storageService.getQuarantineFile(uuid); File quarantineOriginal = new File(quarantineBase.getPath() + ".original"); File quarantineRestored = new File(quarantineBase.getPath() + ".restored"); if (!source.renameTo(quarantineOriginal) || !restored.renameTo(quarantineRestored)) { log.warn("Quarantine of corrupt backup shard failed: %s", uuid); } throw new PrestoException(RAPTOR_BACKUP_CORRUPTION, "Backup is corrupt after write: " + uuid); } stats.incrementBackupSuccess(); } catch (Throwable t) { stats.incrementBackupFailure(); throw Throwables.propagate(t); } }

Target:
public void run() { try { stats.addQueuedTime(Duration.nanosSince(queuedTime)); long start = System.nanoTime(); backupStore.get().backupShard(uuid, source); stats.addCopyShardDataRate(new DataSize(source.length(), BYTE), Duration.nanosSince(start)); File restored = new File(storageService.getStagingFile(uuid) + ".validate"); backupStore.get().restoreShard(uuid, restored); if (!Files.equal(source, restored)) { stats.incrementBackupCorruption(); File quarantineBase = storageService.getQuarantineFile(uuid); File quarantineOriginal = new File(quarantineBase.getPath() + ".original"); File quarantineRestored = new File(quarantineBase.getPath() + ".restored"); log.error("Backup is corrupt after write. Quarantining local file: %s", quarantineBase); if (!source.renameTo(quarantineOriginal) || !restored.renameTo(quarantineRestored)) { log.warn("Quarantine of corrupt backup shard failed: %s", uuid); } throw new PrestoException(RAPTOR_BACKUP_CORRUPTION, "Backup is corrupt after write: " + uuid); } if (!restored.delete()) { log.warn("Failed to delete staging file: %s", restored); } stats.incrementBackupSuccess(); } catch (Throwable t) { stats.incrementBackupFailure(); throw Throwables.propagate(t); } }
Source:
public DDF removeColumns(List<String> columnNames) throws DDFException { if (columnNames == null || columnNames.isEmpty()) throw new DDFException("columnNames must be specified"); List<String> currentColumnNames = this.getDDF().getColumnNames(); for(String columnName: columnNames) { if(!currentColumnNames.contains(columnName)) { throw new DDFException(String.format("Column %s does not exists", columnName)); } } List<String> columns = this.getDDF().getColumnNames(); for (String columnName : currentColumnNames) { for (Iterator<String> it = columns.iterator();it.hasNext();) { if (it.next().equals(columnName)) { it.remove(); } } } DDF newddf = this.project(columns); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; }

Target:
public DDF removeColumns(List<String> columnNames) throws DDFException { if (columnNames == null || columnNames.isEmpty()) throw new DDFException("columnNames must be specified"); List<String> currentColumnNames = this.getDDF().getColumnNames(); for(String columnName: columnNames) { if(!currentColumnNames.contains(columnName)) { throw new DDFException(String.format("Column %s does not exists", columnName)); } } for (String columnName : columnNames) { for (Iterator<String> it = currentColumnNames.iterator();it.hasNext();) { if (it.next().equals(columnName)) { it.remove(); } } } DDF newddf = this.project(currentColumnNames); newddf.getMetaDataHandler().copyFactor(this.getDDF()); return newddf; }
Source:
public static List<SearchField> buildSearchFields(Class<?> model, FieldBuilderOptions options) { if (options == null) { return FieldBuilder.build(model, MemberNameConverterProviders.createInstance()); } return FieldBuilder.build(model, options.getSerializer()); }

Target:
public static List<SearchField> buildSearchFields(Class<?> model, FieldBuilderOptions options) { return SearchIndexAsyncClient.buildSearchFields(model, options); }
Source:
public Class<?> getType(Class<?> entityClass, String identifier) { if (isIdType(entityClass, identifier)) { return getIdType(entityClass); } ConcurrentHashMap<String, Class<?>> fieldTypes = getEntityBinding(entityClass).fieldsToTypes; return fieldTypes == null ? null : fieldTypes.get(identifier); }

Target:
public Class<?> getType(Class<?> entityClass, String identifier) { if (identifier.equals(REGULAR_ID_NAME)) { return getEntityBinding(entityClass).getIdType(); } ConcurrentHashMap<String, Class<?>> fieldTypes = getEntityBinding(entityClass).fieldsToTypes; return fieldTypes == null ? null : fieldTypes.get(identifier); }
Source:
public static <T extends GraphQLType> List<T> sortGraphQLTypes(Collection<T> types) { ArrayList<T> sorted = new ArrayList<>(types); sorted.sort(graphQLTypeComparator()); return sorted; }

Target:
public static <T extends GraphQLType> List<T> sortGraphQLTypes(Collection<T> types) { List<T> sorted = new ArrayList<>(types); sorted.sort(graphQLTypeComparator()); return sorted; }
Source:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { return null; }

Target:
public ResolvedExpression parseSqlExpression(String sqlExpression, TableSchema inputSchema) { throw new UnsupportedOperationException(); }
Source:
public InputReferenceNode(CallSiteBinder callSiteBinder, Scope scope, Type type, BytecodeExpression block, BytecodeExpression position) { Variable wasNullVariable = scope.getVariable("wasNull"); Class<?> javaType = type.getJavaType(); if (!javaType.isPrimitive() && javaType != Slice.class) { javaType = Object.class; } body = new IfStatement(); body.condition(block.invoke("isNull", boolean.class, position)); body.ifTrue() .putVariable(wasNullVariable, true) .pushJavaDefault(javaType); String methodName = "get" + Primitives.wrap(javaType).getSimpleName(); body.ifFalse(constantType(callSiteBinder, type).invoke(methodName, javaType, block, position)); this.block = block; this.position = position; }

Target:
private InputReferenceNode(CallSiteBinder callSiteBinder, Scope scope, Type type, BytecodeExpression block, BytecodeExpression position) { Variable wasNullVariable = scope.getVariable("wasNull"); Class<?> javaType = type.getJavaType(); if (!javaType.isPrimitive() && javaType != Slice.class) { javaType = Object.class; } IfStatement ifStatement = new IfStatement(); ifStatement.condition(block.invoke("isNull", boolean.class, position)); ifStatement.ifTrue() .putVariable(wasNullVariable, true) .pushJavaDefault(javaType); String methodName = "get" + Primitives.wrap(javaType).getSimpleName(); ifStatement.ifFalse(constantType(callSiteBinder, type).invoke(methodName, javaType, block, position)); this.body = ifStatement; this.block = block; this.position = position; }
Source:
public boolean isAuthSupported() { return true; }

Target:
public boolean isAuthSupported() { return isAuthRequired(); }
Source:
public synchronized ArrayList<StorageDirectoryParcelable> getStorageDirectoriesNew() { ArrayList<StorageDirectoryParcelable> volumes = new ArrayList<>(); StorageManager sm = getSystemService(StorageManager.class); for (StorageVolume volume : sm.getStorageVolumes()) { Log.i("MainActivity", "Volume: " + volume + ""); if (!volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED) && !volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED_READ_ONLY)) { continue; } File path = Utils.getVolumeDirectory(volume); String name = volume.getDescription(this); int icon = R.drawable.ic_sd_storage_white_24dp; if (!volume.isRemovable()) { icon = R.drawable.ic_phone_android_white_24dp; } else { if (name.toUpperCase().contains("USB") || path.getPath().toUpperCase().contains("USB")) { icon = R.drawable.ic_usb_white_24dp; } else { icon = R.drawable.ic_sd_storage_white_24dp; } } volumes.add(new StorageDirectoryParcelable(path.getPath(), name, icon)); } return volumes; }

Target:
public synchronized ArrayList<StorageDirectoryParcelable> getStorageDirectoriesNew() { ArrayList<StorageDirectoryParcelable> volumes = new ArrayList<>(); StorageManager sm = getSystemService(StorageManager.class); for (StorageVolume volume : sm.getStorageVolumes()) { if (!volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED) && !volume.getState().equalsIgnoreCase(Environment.MEDIA_MOUNTED_READ_ONLY)) { continue; } File path = Utils.getVolumeDirectory(volume); String name = volume.getDescription(this); int icon; if (!volume.isRemovable()) { icon = R.drawable.ic_phone_android_white_24dp; } else { if (name.toUpperCase().contains("USB") || path.getPath().toUpperCase().contains("USB")) { icon = R.drawable.ic_usb_white_24dp; } else { icon = R.drawable.ic_sd_storage_white_24dp; } } volumes.add(new StorageDirectoryParcelable(path.getPath(), name, icon)); } return volumes; }
Source:
public Segment(String path, String etag, long sizeBytes) { this.path = checkNotNull(path, "path"); this.etag = checkNotNull(etag, "etag of %s", path); this.sizeBytes = sizeBytes; }

Target:
private Segment(String path, String etag, long sizeBytes) { this.path = checkNotNull(path, "path"); this.etag = checkNotNull(etag, "etag of %s", path); this.sizeBytes = sizeBytes; }
Source:
public String toString() { return "ClientIcmpPingConfig{" + "timeoutMilliseconds=" + timeoutMilliseconds + ", intervalMilliseconds=" + intervalMilliseconds + ", echoFailFastOnStartup=" + echoFailFastOnStartup + ", ttl=" + ttl + ", maxAttempts=" + maxAttempts + ", enabled=" + enabled + '}'; }

Target:
public String toString() { return "ClientIcmpPingConfig{" + "enabled=" + enabled + ", timeoutMilliseconds=" + timeoutMilliseconds + ", intervalMilliseconds=" + intervalMilliseconds + ", echoFailFastOnStartup=" + echoFailFastOnStartup + ", ttl=" + ttl + ", maxAttempts=" + maxAttempts + '}'; }
Source:
public void setup() { initMocks(this); registerVolatileStorageService(); managedItemProvider = getService(ManagedItemProvider.class); assertNotNull(managedItemProvider); metadataRegistry = getService(MetadataRegistry.class); assertNotNull(metadataRegistry); itemRegistry = getService(ItemRegistry.class); assertNotNull(itemRegistry); itemRegistry.removeRegistryChangeListener(mockListener); }

Target:
public void setup() { initMocks(this); registerVolatileStorageService(); managedItemProvider = getService(ManagedItemProvider.class); assertNotNull(managedItemProvider); metadataRegistry = getService(MetadataRegistry.class); assertNotNull(metadataRegistry); itemRegistry = getService(ItemRegistry.class); assertNotNull(itemRegistry); }
Source:
public void constraintViolationExceptionCausesBadRequest() { Path violationPath = mock(Path.class); when(violationPath.toString()).thenReturn("violationPath"); ConstraintViolation violation = mock(ConstraintViolation.class); when(violation.getRootBeanClass()).thenReturn(CustomValidationExceptionMapperTest.class); when(violation.getPropertyPath()).thenReturn(violationPath); when(violation.getMessage()).thenReturn("violationMessage"); ConstraintViolationException exception = mock(ConstraintViolationException.class); when(exception.getConstraintViolations()).thenReturn(new LinkedHashSet(asList(violation))); try (Response response = exceptionMapper.toResponse(exception)) { assertThat(response.getStatus(), is(Response.Status.BAD_REQUEST.getStatusCode())); ErrorResponse error = (ErrorResponse) response.getEntity(); assertThat(error.error, is("violationPath: violationMessage")); } }

Target:
public void constraintViolationExceptionCausesBadRequest() { Path violationPath = mock(Path.class); when(violationPath.toString()).thenReturn("violationPath"); ConstraintViolation violation = mock(ConstraintViolation.class); when(violation.getRootBeanClass()).thenReturn(CustomValidationExceptionMapperTest.class); when(violation.getPropertyPath()).thenReturn(violationPath); when(violation.getMessage()).thenReturn("violationMessage"); ConstraintViolationException exception = mock(ConstraintViolationException.class); when(exception.getConstraintViolations()).thenReturn(new LinkedHashSet(asList(violation))); try (Response response = exceptionMapper.toResponse(exception)) { assertThat(response.getStatus(), is(BAD_REQUEST.getStatusCode())); ErrorResponse error = (ErrorResponse) response.getEntity(); assertThat(error.error, is("violationPath: violationMessage")); } }
Source:
public static String getResponseFromServer(final URL constructedUrl, final HostnameVerifier hostnameVerifier, final Properties sslConfig, final String encoding) { URLConnection conn = null; try { conn = constructedUrl.openConnection(); if (conn instanceof HttpsURLConnection) { HttpsURLConnection httpsConnection = (HttpsURLConnection)conn; SSLSocketFactory socketFactory = createSslSocketFactory(sslConfig); if (socketFactory != null) { httpsConnection.setSSLSocketFactory(socketFactory); } if (hostnameVerifier != null) { httpsConnection.setHostnameVerifier(hostnameVerifier); } else { httpsConnection.setHostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier()); } } final BufferedReader in; if (CommonUtils.isEmpty(encoding)) { in = new BufferedReader(new InputStreamReader(conn.getInputStream())); } else { in = new BufferedReader(new InputStreamReader(conn.getInputStream(), encoding)); } String line; final StringBuilder stringBuffer = new StringBuilder(255); while ((line = in.readLine()) != null) { stringBuffer.append(line); stringBuffer.append("\n"); } return stringBuffer.toString(); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e); } finally { if (conn != null && conn instanceof HttpURLConnection) { ((HttpURLConnection)conn).disconnect(); } } }

Target:
public static String getResponseFromServer(final URL constructedUrl, final HostnameVerifier hostnameVerifier, final Properties sslConfig, final String encoding) { URLConnection conn = null; try { conn = constructedUrl.openConnection(); configureHttpsConnection(conn,sslConfig,hostnameVerifier); final BufferedReader in; if (CommonUtils.isEmpty(encoding)) { in = new BufferedReader(new InputStreamReader(conn.getInputStream())); } else { in = new BufferedReader(new InputStreamReader(conn.getInputStream(), encoding)); } String line; final StringBuilder stringBuffer = new StringBuilder(255); while ((line = in.readLine()) != null) { stringBuffer.append(line); stringBuffer.append("\n"); } return stringBuffer.toString(); } catch (final Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e); } finally { if (conn != null && conn instanceof HttpURLConnection) { ((HttpURLConnection)conn).disconnect(); } } }
Source:
public void doAnalysisForRelativeTreeRef(TreeReference expressionWithContextTypeRelative) throws AnalysisInvalidException { if (getContextRef() == null) { throw new AnalysisInvalidException(); } doNormalTreeRefAnalysis(expressionWithContextTypeRelative); if (!this.isSubAnalyzer) { getContextRef().applyAndPropagateAnalyzer(this); } }

Target:
public void doAnalysisForRelativeTreeRef(TreeReference expressionWithContextTypeRelative) throws AnalysisInvalidException { if (getContextRef() == null) { throw new AnalysisInvalidException("No context ref was available when trying to " + "analyze the following expression with context type relative: " + expressionWithContextTypeRelative.toString()); } doNormalTreeRefAnalysis(expressionWithContextTypeRelative); if (!this.isSubAnalyzer) { getContextRef().applyAndPropagateAnalyzer(this); } }
Source:
protected void doRun() throws Exception { if (DISABLED) { return; } final long now = System.currentTimeMillis(); long iota = System.currentTimeMillis(); final long recurrencePeriosMillis = TimeUnit.SECONDS.toMillis(RECURRENCE_PERIOD_SEC); long thresholdMillis = recurrencePeriosMillis > THRESHOLD ? recurrencePeriosMillis * 2 : THRESHOLD; OUTER: for (InflightRequest req : filter.tracker.values()) { long totalTime = now - req.startTime; if (totalTime> thresholdMillis) { if (req.ended) continue; PrintWriter w = null; try { if (req.record==null) { req.record = logs.file(format.format(new Date(iota++)) + ".txt"); logs.add(req.record); w = new PrintWriter(req.record,"UTF-8"); req.writeHeader(w); } else { w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(req.record,true),"UTF-8")); logs.touch(req.record); } ThreadInfo lockedThread = ManagementFactory.getThreadMXBean().getThreadInfo(req.thread.getId()); w.println(lockedThread); w.println(totalTime + "msec elapsed in " + lockedThread.getThreadName()); w.println(ManagementFactory.getThreadMXBean().getThreadInfo(lockedThread.getLockOwnerId())); continue OUTER; } finally { IOUtils.closeQuietly(w); } } } }

Target:
protected void doRun() throws Exception { if (DISABLED) { return; } final long now = System.currentTimeMillis(); long iota = System.currentTimeMillis(); final long recurrencePeriosMillis = TimeUnit.SECONDS.toMillis(RECURRENCE_PERIOD_SEC); long thresholdMillis = recurrencePeriosMillis > THRESHOLD ? recurrencePeriosMillis * 2 : THRESHOLD; for (InflightRequest req : filter.tracker.values()) { long totalTime = now - req.startTime; if (totalTime> thresholdMillis) { if (req.ended) continue; PrintWriter w = null; try { if (req.record==null) { req.record = logs.file(format.format(new Date(iota++)) + ".txt"); logs.add(req.record); w = new PrintWriter(req.record,"UTF-8"); req.writeHeader(w); } else { w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(req.record,true),"UTF-8")); logs.touch(req.record); } ThreadInfo lockedThread = ManagementFactory.getThreadMXBean().getThreadInfo(req.thread.getId()); if (lockedThread != null ) { w.println(lockedThread); w.println(totalTime + "msec elapsed in " + lockedThread.getThreadName()); w.println(ManagementFactory.getThreadMXBean().getThreadInfo(lockedThread.getLockOwnerId())); } } finally { IOUtils.closeQuietly(w); } } } }
Source:
public static void main(String[] args) throws Exception { if (args.length < 1) { System.err.println("Usage: babble <file.bla>"); } else { String path = args[0]; File file = new File(path); CharStream chars = new ANTLRInputStream(new FileInputStream(file)); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); String target = "target/classes/" + file.getName().replace(".bla", ".class"); ParseTreeWalker walker = new ParseTreeWalker(); ParseTree tree = parser.program(); ASTGenerator generator = new ASTGenerator(); Node irtree = generator.visitProgram((ProgramContext) tree); PrintWriter out = new PrintWriter("target/classes/" + file.getName().replace(".bla", ".graphviz")); out.print(Graphvizivier.nodeToGraph(irtree)); out.close(); App app = new App(file.getName().split("\\.")[0]); walker.walk(app, tree); app.writeBytecode(target); System.out.println(String.format("[ OK ] Compiled %s", target)); } }

Target:
public static void main(String[] args) throws Exception { for (String path : args) { File file = new File(path); CharStream chars = new ANTLRInputStream(new FileInputStream(file)); Lexer lexer = new BabbleLexer(chars); TokenStream tokens = new CommonTokenStream(lexer); BabbleParser parser = new BabbleParser(tokens); String target = "target/classes/" + file.getName().replace(".bla", ".class"); ParseTreeWalker walker = new ParseTreeWalker(); ParseTree tree = parser.program(); ASTGenerator generator = new ASTGenerator(); Node irtree = generator.visitProgram((ProgramContext) tree); PrintWriter out = new PrintWriter("target/classes/" + file.getName().replace(".bla", ".dot")); out.print(Graphvizivier.nodeToGraph(irtree)); out.close(); App app = new App(file.getName().split("\\.")[0]); walker.walk(app, tree); app.writeBytecode(target); System.out.println(String.format("[ OK ] Compiled %s", target)); } }
Source:
public ItemFoodBundle() { super(15, 20.6f, true); setUnlocalizedName("food_bundle"); setRegistryName(new ResourceLocation(AncientWarfareNPC.MOD_ID, "food_bundle")); setCreativeTab(AncientWarfareNPC.TAB); AncientWarfareNPC.proxy.addClientRegister(this); }

Target:
public ItemFoodBundle() { super(15, 1, true); setUnlocalizedName("food_bundle"); setRegistryName(new ResourceLocation(AncientWarfareNPC.MOD_ID, "food_bundle")); setCreativeTab(AncientWarfareNPC.TAB); AncientWarfareNPC.proxy.addClientRegister(this); }
Source:
public void stop() { LOG.info("Stopping event hub system consumer..."); List<CompletableFuture<Void>> futures = new ArrayList<>(); streamPartitionReceivers.values().forEach((receiver) -> futures.add(receiver.close())); CompletableFuture<Void> allFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])); try { allFuture.get(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOG.warn("Failed to close receivers", e); Util.logThreadDump("Log thread dump as we failed during consumer shutdown"); } LOG.info("Receivers are shutdown. Start shutting down EventHubManagers"); ExecutorService shutdownExecutorService = Executors.newCachedThreadPool(); List<Future> futureList = new ArrayList<>(); perPartitionEventHubManagers.values() .forEach(ehClientManager -> futureList.add( shutdownExecutorService.submit(() -> ehClientManager.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS)))); futureList.forEach(future -> { try { future.get(); } catch (Exception e) { LOG.warn("exception during EventHubManagers shutdown", e); } }); shutdownExecutorService.shutdown(); LOG.info("EventHubManagers are shutdown"); perPartitionEventHubManagers.clear(); perStreamEventHubManagers.clear(); isStarted = false; LOG.info("Event hub system consumer stopped."); }

Target:
public void stop() { LOG.info("Stopping event hub system consumer..."); LOG.info("Start shutting down eventhubs receivers"); ShutdownUtil.boundedShutdown(streamPartitionReceivers.values().stream().map(receiver -> new Runnable() { @Override public void run() { try { receiver.close().get(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (Exception e) { LOG.error("Failed to shutdown receiver.", e); } } }).collect(Collectors.toList()), "EventHubSystemConsumer.Receiver#close", DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); LOG.info("Start shutting down eventhubs managers"); ShutdownUtil.boundedShutdown(perPartitionEventHubManagers.values().stream().map(manager -> new Runnable() { @Override public void run() { try { manager.close(DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); } catch (Exception e) { LOG.error("Failed to shutdown eventhubs manager.", e); } } }).collect(Collectors.toList()), "EventHubSystemConsumer.ClientManager#close", DEFAULT_SHUTDOWN_TIMEOUT_MILLIS); perPartitionEventHubManagers.clear(); perStreamEventHubManagers.clear(); isStarted = false; LOG.info("Event hub system consumer stopped."); }
Source:
public LedgerHandle createLedgerAdv(final long ledgerId, int ensSize, int writeQuorumSize, int ackQuorumSize, DigestType digestType, byte passwd[], final Map<String, byte[]> customMetadata) throws InterruptedException, BKException{ SyncCreateCallback result = new SyncCreateCallback(); asyncCreateLedgerAdv(ledgerId, ensSize, writeQuorumSize, ackQuorumSize, digestType, passwd, result, null, customMetadata); LedgerHandle lh = (LedgerHandle) SyncCallbackUtils.waitForResult(result); if (lh == null) { LOG.error("Unexpected condition : no ledger handle returned for a success ledger creation"); throw BKException.create(BKException.Code.UnexpectedConditionException); } else if (ledgerId != lh.getId()) { LOG.error("Unexpected condition : Expected ledgerId: but got: {}", ledgerId, lh.getId()); throw BKException.create(BKException.Code.UnexpectedConditionException); } LOG.info("Ensemble: for ledger: {}", lh.getLedgerMetadata().getEnsemble(0L), lh.getId()); return lh; }

Target:
public LedgerHandle createLedgerAdv(final long ledgerId, int ensSize, int writeQuorumSize, int ackQuorumSize, DigestType digestType, byte passwd[], final Map<String, byte[]> customMetadata) throws InterruptedException, BKException{ CompletableFuture<LedgerHandle> future = new CompletableFuture<>(); SyncCreateCallback result = new SyncCreateCallback(future); asyncCreateLedgerAdv(ledgerId, ensSize, writeQuorumSize, ackQuorumSize, digestType, passwd, result, null, customMetadata); LedgerHandle lh = SyncCallbackUtils.waitForResult(future); if (lh == null) { LOG.error("Unexpected condition : no ledger handle returned for a success ledger creation"); throw BKException.create(BKException.Code.UnexpectedConditionException); } else if (ledgerId != lh.getId()) { LOG.error("Unexpected condition : Expected ledgerId: but got: {}", ledgerId, lh.getId()); throw BKException.create(BKException.Code.UnexpectedConditionException); } LOG.info("Ensemble: for ledger: {}", lh.getLedgerMetadata().getEnsemble(0L), lh.getId()); return lh; }
Source:
private String prepareSkippedObjectsMessage(List<String> skippedObjects, String objectName) { String skippedObjectsMessage = null; if (!skippedObjects.isEmpty()) { skippedObjectsMessage = "These " + objectName + " from extSource were skipped: { "; for (String skippedGroup : skippedObjects) { if (skippedGroup == null) continue; skippedObjectsMessage += skippedObjects + ", "; } skippedObjectsMessage += " }"; } return skippedObjectsMessage; }

Target:
private String prepareSkippedObjectsMessage(List<String> skippedObjects, String objectName) { String skippedObjectsMessage = null; if (!skippedObjects.isEmpty()) { skippedObjectsMessage = "These " + objectName + " from extSource were skipped: { "; for (String skippedObject : skippedObjects) { if (skippedObject == null) continue; skippedObjectsMessage += skippedObjects + ", "; } skippedObjectsMessage += " }"; } return skippedObjectsMessage; }
Source:
default boolean hasParametersOfType(Class<?>... paramTypes) { return getParameters().stream() .map(p -> p.getType() instanceof ClassOrInterfaceType ? ((ClassOrInterfaceType) p.getType()).getName().asString() : p.getType().asString()) .collect(toList()) .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toList())); }

Target:
default boolean hasParametersOfType(Class<?>... paramTypes) { return getParameters().stream() .map(p -> p.getType().toClassOrInterfaceType() .map(NodeWithSimpleName::getNameAsString) .orElse(p.getType().asString())) .collect(toList()) .equals(Stream.of(paramTypes).map(Class::getSimpleName).collect(toList())); }
Source:
public void set(Object value) throws Exception { if (direction == OUTPUT|| direction == RETURN_VALUE) throw new UnsupportedOperationException("Trying to set value of output parameter "+name); if (value != null) { TypeNormaliser tn = TypeNormaliserFactory.getNormaliser(value.getClass()); if (tn != null) { value = tn.normalise(value); } } cs.setObject(index, value, sqlType, userDefinedTypeName); }

Target:
public void set(Object value) throws Exception { if (direction == OUTPUT|| direction == RETURN_VALUE) throw new UnsupportedOperationException("Trying to set value of output parameter "+name); cs.setObject(index, toJdbcCompatibleValue(value), sqlType, userDefinedTypeName); }
Source:
public T copyAttribute(T attribute) { try { Class<T> klass = (Class<T>) attribute.getClass(); Constructor<T> constructor = klass.getConstructor(klass); return constructor.newInstance(attribute); } catch (Exception e) { throw new CacheException(e); } }

Target:
public T copyAttribute(T attribute) { try { Class<T> klass = (Class<T>) attribute.getClass(); Constructor<T> constructor = klass.getConstructor(klass); return constructor.newInstance(attribute); } catch (Exception e) { throw new CacheConfigurationException(e); } }
Source:
public CompletableFuture<Void> invoke(boolean success) { if (trace) { log.tracef("After completion callback, success=%d", success); } validator.endInvalidatingKey(lockOwner, key, success); return null; }

Target:
public CompletableFuture<Void> invoke(boolean success) { if (trace) { log.tracef("After completion callback, success=%b", success); } validator.endInvalidatingKey(lockOwner, key, success); return null; }
Source:
@Override protected void writeToSocket(Socket sock, byte[] data, long timeout) throws IOException { if (!blockMsgs) super.writeToSocket(sock, data, timeout); }

Target:
@Override protected void writeToSocket(Socket sock, byte[] data, long timeout) throws IOException { super.writeToSocket(sock, data, timeout); }
Source:
public CharSequence getStr(int col) { return PG_TYPE_TO_NAME.get(PG_TYPE_OIDS.get(row)); }

Target:
public CharSequence getStr(int col) { return PG_TYPE_TO_NAME[row]; }
Source:
public String get(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where("key").is(key)); Datastore result = template.findOne(query, Datastore.class, collectionName); if(result != null){ return result.value; } return null; }

Target:
public String get(String key) { Assert.notNull(key, "'key' must not be null."); Query query = new Query(Criteria.where(ID_FIELD).is(key)); query.fields().exclude(ID_FIELD); @SuppressWarnings("unchecked") Map<String, String> result = template.findOne(query, Map.class, collectionName); return result == null ? null : result.get(VALUE); }
Source:
public void start() { running = true; System.out.println("Started"); }

Target:
public void start() { running = true; addToLog("[GAME]\tStarted game."); }
Source:
private static void setYValue(int index, double[] y, double value, DisplayType type) { if (type.equals(DisplayType.DELTA)) { y[index] = value; double prevValue = value; if (index > 0) { prevValue = y[index - 1]; } y[index] = value - prevValue; return; } y[index] = value; }

Target:
private static void setYValue(int index, double[] y, double value, DisplayType type) { if (type.equals(DisplayType.DELTA)) { y[index] = value; double prevValue = value; if (index > 0) { prevValue = y[index - 1]; } y[index] = value - prevValue; } else { y[index] = value; } }
Source:
public DefaultBlockWorkerClient(UserState userState, GrpcServerAddress address, AlluxioConfiguration alluxioConf) throws IOException { RetryPolicy retryPolicy = RetryUtils.defaultClientRetry( alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_DURATION), alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_BASE_SLEEP_MS), alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_SLEEP_MS)); UnauthenticatedException lastException = null; while (retryPolicy.attempt()) { try { mStreamingChannel = GrpcChannelBuilder.newBuilder(address, alluxioConf) .setSubject(userState.getSubject()) .setNetworkGroup(GrpcChannelKey.NetworkGroup.STREAMING) .setClientType("DefaultBlockWorkerClient-Stream") .build(); mStreamingChannel.intercept(new StreamSerializationClientInterceptor()); mRpcChannel = GrpcChannelBuilder.newBuilder(address, alluxioConf) .setSubject(userState.getSubject()) .setNetworkGroup(GrpcChannelKey.NetworkGroup.DEFAULT) .setClientType("DefaultBlockWorkerClient") .build(); lastException = null; break; } catch (StatusRuntimeException e) { close(); throw AlluxioStatusException.fromStatusRuntimeException(e); } catch (UnauthenticatedException e) { close(); userState.relogin(); lastException = e; } } if (lastException != null) { throw lastException; } mStreamingAsyncStub = BlockWorkerGrpc.newStub(mStreamingChannel); mRpcBlockingStub = BlockWorkerGrpc.newBlockingStub(mRpcChannel); mRpcAsyncStub = BlockWorkerGrpc.newStub(mRpcChannel); mAddress = address; mDataTimeoutMs = alluxioConf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT_MS); }

Target:
public DefaultBlockWorkerClient(UserState userState, GrpcServerAddress address, AlluxioConfiguration alluxioConf) throws IOException { RetryPolicy retryPolicy = RetryUtils.defaultClientRetry( alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_DURATION), alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_BASE_SLEEP_MS), alluxioConf.getDuration(PropertyKey.USER_RPC_RETRY_MAX_SLEEP_MS)); UnauthenticatedException lastException = null; while (retryPolicy.attempt()) { try { mStreamingChannel = GrpcChannelBuilder.newBuilder(address, alluxioConf) .setSubject(userState.getSubject()) .setNetworkGroup(GrpcChannelKey.NetworkGroup.STREAMING) .setClientType("DefaultBlockWorkerClient-Stream") .build(); mStreamingChannel.intercept(new StreamSerializationClientInterceptor()); mRpcChannel = GrpcChannelBuilder.newBuilder(address, alluxioConf) .setSubject(userState.getSubject()) .setNetworkGroup(GrpcChannelKey.NetworkGroup.RPC) .setClientType("DefaultBlockWorkerClient-Rpc") .build(); lastException = null; break; } catch (StatusRuntimeException e) { close(); throw AlluxioStatusException.fromStatusRuntimeException(e); } catch (UnauthenticatedException e) { close(); userState.relogin(); lastException = e; } } if (lastException != null) { throw lastException; } mStreamingAsyncStub = BlockWorkerGrpc.newStub(mStreamingChannel); mRpcBlockingStub = BlockWorkerGrpc.newBlockingStub(mRpcChannel); mRpcAsyncStub = BlockWorkerGrpc.newStub(mRpcChannel); mAddress = address; mDataTimeoutMs = alluxioConf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT); }
Source:
public void deploy( BootOptions bootOptions ) throws DeployException { final DeploymentInfo di = indyDeployment.getDeployment( bootOptions.getContextPath() ).setContextPath( "/" ); final DeploymentManager dm = Servlets.defaultContainer().addDeployment( di ); Collection<String> list = Servlets.defaultContainer().listDeployments(); logger.info( "List deployments: {}", list ); dm.deploy(); try { Integer port = bootOptions.getPort(); if ( port < 1 ) { logger.info( "Looking for open Undertow port..." ); final ThreadLocal<ServletException> errorHolder = new ThreadLocal<>(); ThreadLocal<Integer> usingPort = new ThreadLocal<>(); server = PortFinder.findPortFor( 16, ( foundPort ) -> { Undertow undertow = null; try { EncodingHandler eh = getGzipEncodeHandler( dm ); undertow = Undertow.builder() .setHandler( eh ) .addHttpListener( foundPort, bootOptions.getBind() ) .build(); undertow.start(); usingPort.set( foundPort ); } catch ( ServletException e ) { errorHolder.set( e ); } return undertow; } ); ServletException e = errorHolder.get(); if ( e != null ) { throw e; } bootOptions.setPort( usingPort.get() ); } else { logger.info( "Start Undertow server, bind: {}, port: {}", bootOptions.getBind(), port ); server = Undertow.builder() .setHandler( getGzipEncodeHandler( dm ) ) .addHttpListener( port, bootOptions.getBind() ) .build(); server.start(); } logger.info( "Indy listening on {}:{}\n\n", bootOptions.getBind(), bootOptions.getPort() ); } catch ( Exception e ) { logger.error( "Deploy failed", e ); throw new DeployException( "Deploy failed", e ); } }

Target:
public void deploy( BootOptions bootOptions ) throws DeployException { final DeploymentInfo di = indyDeployment.getDeployment( bootOptions.getContextPath() ).setContextPath( "/" ); final DeploymentManager dm = Servlets.defaultContainer().addDeployment( di ); Collection<String> list = Servlets.defaultContainer().listDeployments(); logger.info( "List deployments: {}", list ); dm.deploy(); try { Integer port = bootOptions.getPort(); if ( port < 1 ) { logger.info( "Looking for open Undertow port..." ); final AtomicReference<ServletException> errorHolder = new AtomicReference<>(); AtomicReference<Integer> usingPort = new AtomicReference<>(); server = PortFinder.findPortFor( 16, ( foundPort ) -> { Undertow undertow = null; try { EncodingHandler eh = getGzipEncodeHandler( dm ); undertow = Undertow.builder() .setHandler( eh ) .addHttpListener( foundPort, bootOptions.getBind() ) .build(); undertow.start(); usingPort.set( foundPort ); } catch ( ServletException e ) { errorHolder.set( e ); } return undertow; } ); ServletException e = errorHolder.get(); if ( e != null ) { throw e; } bootOptions.setPort( usingPort.get() ); } else { logger.info( "Start Undertow server, bind: {}, port: {}", bootOptions.getBind(), port ); server = Undertow.builder() .setHandler( getGzipEncodeHandler( dm ) ) .addHttpListener( port, bootOptions.getBind() ) .build(); server.start(); } logger.info( "Indy listening on {}:{}\n\n", bootOptions.getBind(), bootOptions.getPort() ); } catch ( Exception e ) { logger.error( "Deploy failed", e ); throw new DeployException( "Deploy failed", e ); } }
Source:
private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] groupIds = aspect.getGroupIds(); int quark = (groupIds.length > 0) ? ss.getQuarkRelativeAndAdd(rootQuark, groupIds) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent == null ? TmfStateValue.nullValue() : TmfStateValue.newValueLong(eventContent), quark); }

Target:
private static void handleCounterAspect(ITmfEvent event, ITmfStateSystemBuilder ss, CounterAspect aspect, int rootQuark) { String[] groupIds = aspect.getGroupIds(); int quark = (groupIds.length > 0) ? ss.getQuarkRelativeAndAdd(rootQuark, groupIds) : rootQuark; quark = ss.getQuarkRelativeAndAdd(quark, aspect.getName()); Long eventContent = aspect.resolve(event); ss.modifyAttribute(event.getTimestamp().toNanos(), eventContent == null ? null : eventContent, quark); }
Source:
public HttpFields.Mutable getTrailers() { return trailers; }

Target:
public HttpFields getTrailers() { return trailers; }
Source:
void setBackgroundColor (long handle, GdkColor color) { if (OS.GTK3) { GdkRGBA rgba = null; double alpha = 1.0; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { alpha = 0; Control control = findBackgroundControl(); if (control == null) control = this; color = control.getBackgroundColor(); } } else { alpha = backgroundAlpha; } if (color != null) { rgba = new GdkRGBA (); rgba = display.toGdkRGBA (color); rgba.alpha = alpha / (float)255; } long context = OS.gtk_widget_get_style_context (handle); setBackgroundColor (context, handle, rgba); OS.gtk_style_context_invalidate (context); return; } int index = OS.GTK_STATE_NORMAL; long style = OS.gtk_widget_get_modifier_style (handle); long ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr != 0) OS.g_free (ptr); ptr = 0; String pixmapName = null; int flags = OS.gtk_rc_style_get_color_flags (style, index); if (color != null) { flags |= OS.GTK_RC_BG; pixmapName = "<none>"; } else { flags &= ~OS.GTK_RC_BG; if (backgroundImage == null && (state & PARENT_BACKGROUND) != 0) { pixmapName = "<parent>"; } } if (pixmapName != null) { byte[] buffer = Converter.wcsToMbcs (null, pixmapName, true); ptr = OS.g_malloc (buffer.length); OS.memmove (ptr, buffer, buffer.length); } OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); OS.gtk_rc_style_set_bg (style, index, color); OS.gtk_rc_style_set_color_flags (style, index, flags); modifyStyle (handle, style); }

Target:
void setBackgroundColor (long handle, GdkColor color) { if (OS.GTK3) { GdkRGBA rgba = null; double alpha = 1.0; if (color == null) { if ((state & PARENT_BACKGROUND) != 0) { alpha = 0; Control control = findBackgroundControl(); if (control == null) control = this; color = control.getBackgroundColor(); } } else { alpha = backgroundAlpha; } if (color != null) { rgba = display.toGdkRGBA (color); rgba.alpha = alpha / (float)255; } long context = OS.gtk_widget_get_style_context (handle); setBackgroundColor (context, handle, rgba); OS.gtk_style_context_invalidate (context); return; } int index = OS.GTK_STATE_NORMAL; long style = OS.gtk_widget_get_modifier_style (handle); long ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr != 0) OS.g_free (ptr); ptr = 0; String pixmapName = null; int flags = OS.gtk_rc_style_get_color_flags (style, index); if (color != null) { flags |= OS.GTK_RC_BG; pixmapName = "<none>"; } else { flags &= ~OS.GTK_RC_BG; if (backgroundImage == null && (state & PARENT_BACKGROUND) != 0) { pixmapName = "<parent>"; } } if (pixmapName != null) { byte[] buffer = Converter.wcsToMbcs (null, pixmapName, true); ptr = OS.g_malloc (buffer.length); OS.memmove (ptr, buffer, buffer.length); } OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); OS.gtk_rc_style_set_bg (style, index, color); OS.gtk_rc_style_set_color_flags (style, index, flags); modifyStyle (handle, style); }
Source:
private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) && !isSameRange(reference.getRange(), included.getRange()) && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); }

Target:
private boolean isIncluded(Location reference, Location included) { return reference.getUri().equals(included.getUri()) && !reference.equals(included) && isAfter(reference.getRange().getStart(), included.getRange().getStart()) && isAfter(included.getRange().getEnd(), reference.getRange().getEnd()); }
Source:
private void testGodMode(boolean isPart) throws IOException { runGodModeRoutine(isPart); writeToFile(OUTPUT_PATH, PLACEHOLDER_CONTENT); runGodModeRoutine(isPart); File file = new File(OUTPUT_PATH); if (!file.delete()) { print("Delete failed: " + file.getAbsolutePath()); file.deleteOnExit(); } }

Target:
private void testGodMode(boolean isPart) throws Exception { try { verifyHtml(OUTPUT_FILENAME, isPart); signalFailureToDetectException(); } catch (IOException e) { ignoreExpectedException(); } runGodModeRoutine(isPart); writeToFile(OUTPUT_FILEPATH, PLACEHOLDER_CONTENT); try { verifyHtml(OUTPUT_FILENAME, isPart); signalFailureToDetectException(); } catch (AssertionError ae) { ignoreExpectedException(); } runGodModeRoutine(isPart); deleteFile(OUTPUT_FILEPATH); }
Source:
private long findSize(CapacityRange capacityRange) { if (capacityRange.getRequiredBytes() != 0) { return capacityRange.getRequiredBytes(); } else { if (capacityRange.getLimitBytes() != 0) { return Math.min(1000_000_000, capacityRange.getLimitBytes()); } else { return 1000_000_000; } } }

Target:
private long findSize(CapacityRange capacityRange) { if (capacityRange.getRequiredBytes() != 0) { return capacityRange.getRequiredBytes(); } else { if (capacityRange.getLimitBytes() != 0) { return Math.min(defaultVolumeSize, capacityRange.getLimitBytes()); } else { return defaultVolumeSize; } } }
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); TmfTraceElement prompting = traceElement; while (prompting != null) { boolean always = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.DELETE_RESOURCE_REFRESH); if (always) { traceElement.closeEditors(); traceElement.deleteSupplementaryResources(); } else { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); int returnCode = MessageDialog.open(MessageDialog.QUESTION, shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getName()), 1, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL); if (returnCode >= 1) { traceElement.closeEditors(); traceElement.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.DELETE_RESOURCE_REFRESH, true); } } promptQueue.remove(); prompting = promptQueue.peek(); } }); }

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); 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(); int returnCode = MessageDialog.open(MessageDialog.QUESTION, shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getName()), 1, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL); if (returnCode >= 1) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.DELETE_RESOURCE_REFRESH, true); } } } }); }
Source:
public void onFileCreate(final File file) { if (file != null) { Log_OC.i(TAG, "onFileCreate called for " + file.getAbsolutePath()); synchronized (mLock) { final String fileName = file.getAbsolutePath().substring( mConfiguration.getSourcePath().length() + 1 ); mHandler.postDelayed( new Runnable() { @Override public void run() { mInstantUploadsHandler.handleNewFile(fileName, mConfiguration, mContext); } }, HANDLE_DELAY_IN_MS ); } } else { Log_OC.i(TAG, "onFileCrete called with NULL file"); } }

Target:
public void onFileCreate(final File file) { if (file != null) { Log_OC.i(TAG, "onFileCreate called for " + file.getAbsolutePath()); synchronized (mLock) { final String fileName = file.getAbsolutePath().substring( mConfiguration.getSourcePath().length() + 1 ); mInstantUploadsHandler.handleNewFile(fileName, mConfiguration, mContext); } } else { Log_OC.i(TAG, "onFileCrete called with NULL file"); } }