auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static SqlParts selectStatementForTextClause(Object clause, String indexName) { if (clause == null) { return null; } if (indexName == null || indexName.isEmpty()) { return null; } if (!(clause instanceof Map)) { return null; } Map<String, Object> textClause = (Map<String, Object>) clause; Map<String, String> searchClause = (Map<String, String>) textClause.get(TEXT); String tableName = IndexManager.tableNameForIndex(indexName); String search = searchClause.get(SEARCH); String sql = String.format("SELECT _id FROM %s WHERE %s MATCH ?", tableName, tableName); return SqlParts.partsForSql(sql, new String[]{ String.format("'%s'", search) }); }

Target:
protected static SqlParts selectStatementForTextClause(Object clause, String indexName) { if (clause == null) { return null; } if (indexName == null || indexName.isEmpty()) { return null; } if (!(clause instanceof Map)) { return null; } Map<String, Object> textClause = (Map<String, Object>) clause; Map<String, String> searchClause = (Map<String, String>) textClause.get(TEXT); String tableName = IndexManager.tableNameForIndex(indexName); String search = searchClause.get(SEARCH); search = search.replace("'", "''"); String sql = String.format("SELECT _id FROM %s WHERE %s MATCH ?", tableName, tableName); return SqlParts.partsForSql(sql, new String[]{ String.format("'%s'", search) }); }
Source:
public static void setProperties() { Map<String, String> oldProperties = new HashMap<>(); overrideProperty(oldProperties, TCPropertiesConsts.L1_SHUTDOWN_THREADGROUP_GRACETIME, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.TC_TRANSPORT_HANDSHAKE_TIMEOUT, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.CLIENT_MAX_PENDING_REQUESTS, "" + CLIENT_MAX_PENDING_REQUESTS); OLD_PROPERTIES = oldProperties; }

Target:
public static void setProperties() { Map<String, String> oldProperties = new HashMap<>(); overrideProperty(oldProperties, TCPropertiesConsts.L1_SHUTDOWN_THREADGROUP_GRACETIME, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.TC_TRANSPORT_HANDSHAKE_TIMEOUT, "1000"); overrideProperty(oldProperties, TCPropertiesConsts.CLIENT_MAX_PENDING_REQUESTS, Integer.toString(CLIENT_MAX_PENDING_REQUESTS)); OLD_PROPERTIES = oldProperties; }
Source:
static SameSite of(String name) { if (name != null) { try { return SameSite.valueOf(name); } catch (IllegalArgumentException e) { for (SameSite each : SameSite.class.getEnumConstants()) { if (each.name().equalsIgnoreCase(name)) { return each; } } } } return null; }

Target:
static SameSite of(String name) { if (name != null) { for (SameSite each : SameSite.class.getEnumConstants()) { if (each.name().equalsIgnoreCase(name)) { return each; } } } return null; }
Source:
public void shouldIndentedWhenEnvironmentReturnsTrue() { when(environment.supports(anyString())).thenReturn(true); serialization.init(); String expectedResult = "<order>\n <price>15.0</price>\n <comments>pack it nicely, please</comments>\n</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }

Target:
public void shouldIndentedWhenEnvironmentReturnsTrue() { when(environment.supports(ENVIRONMENT_INDENTED_KEY)).thenReturn(true); serialization.init(); String expectedResult = "<order>\n <price>15.0</price>\n <comments>pack it nicely, please</comments>\n</order>"; Order order = new Order(new Client("guilherme silveira"), 15.0, "pack it nicely, please"); serialization.from(order).serialize(); assertThat(result(), is(equalTo(expectedResult))); }
Source:
public Void call() { SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize) { Formatter dummy = new SimpleFormatter(); @Override public void publish(LogRecord record) { if (record.getMessage() != null && record.getParameters() != null && Stream.of(record.getParameters()).anyMatch(p -> p != null && !(p instanceof String))) { record.setMessage(dummy.formatMessage(record)); record.setParameters(null); } super.publish(record); } }; for (Handler h : LOGGER.getHandlers()) { if (h.getClass().getName().equals(SLAVE_LOG_HANDLER.getClass().getName())) LOGGER.removeHandler(h); } LOGGER.addHandler(SLAVE_LOG_HANDLER); try { Security.removeProvider("SunPKCS11-Solaris"); } catch (SecurityException e) { } try { getChannelOrFail().setProperty("slave",Boolean.TRUE); } catch (ChannelClosedException e) { throw new IllegalStateException(e); } return null; }

Target:
public Void call() { SLAVE_LOG_HANDLER = new RingBufferLogHandler(ringBufferSize) { ThreadLocal<Formatter> dummy = ThreadLocal.withInitial(() -> new SimpleFormatter()); @Override public void publish(LogRecord record) { if (record.getMessage() != null && record.getParameters() != null && Stream.of(record.getParameters()).anyMatch(p -> p != null && !(p instanceof String))) { record.setMessage(dummy.get().formatMessage(record)); record.setParameters(null); } super.publish(record); } }; for (Handler h : LOGGER.getHandlers()) { if (h.getClass().getName().equals(SLAVE_LOG_HANDLER.getClass().getName())) LOGGER.removeHandler(h); } LOGGER.addHandler(SLAVE_LOG_HANDLER); try { Security.removeProvider("SunPKCS11-Solaris"); } catch (SecurityException e) { } try { getChannelOrFail().setProperty("slave",Boolean.TRUE); } catch (ChannelClosedException e) { throw new IllegalStateException(e); } return null; }
Source:
private static void drawScale(PDPageContentStream stream, PrintRequest request) throws IOException { if (!request.isShowScale()) { return; } String units = getUnits(request.getSrsName()); if (units == null) { return; } double mppx; switch (units) { case "m": mppx = request.getResolution(); break; case "°": LOG.info("Map units is deegrees, not drawing Scale Line"); return; default: LOG.info("Unknown unit", units, "- not drawing Scale line"); return; } double mppt = mppx * Units.PDF_DPI / Units.OGC_DPI; double minDistance = mppt * 50; double distance = SCALE_LINE_DISTANCES_METRES[0]; for (int i = 1; i < SCALE_LINE_DISTANCES_METRES.length; i++) { double d = SCALE_LINE_DISTANCES_METRES[i]; if (d > minDistance) { distance = d; break; } } double pt = distance / mppt; float x1 = (float) OFFSET_SCALE_LEFT; float y1 = (float) OFFSET_SCALE_BOTTOM; float x2 = (float) (OFFSET_SCALE_LEFT + pt); float y2 = y1 + 10; if(request.isScaleText()) { float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, request.getScaleText(), FONT, FONT_SIZE_SCALE, cx, y1 + 5); } else { String distanceStr; if (distance > 1000) { distanceStr = Math.round(distance / 1000) + " km"; } else { distanceStr = Math.round(distance) + " m"; } stream.moveTo(x1, y2); stream.lineTo(x1, y1); stream.lineTo(x2, y1); stream.lineTo(x2, y2); stream.stroke(); float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, distanceStr, FONT, FONT_SIZE_SCALE, cx, y1 + 5); } }

Target:
private static void drawScale(PDPageContentStream stream, PrintRequest request) throws IOException { if (!request.isShowScale()) { return; } String units = getUnits(request.getSrsName()); if (units == null) { return; } double mppx; switch (units) { case "m": mppx = request.getResolution(); break; case "°": LOG.info("Map units is deegrees, not drawing Scale Line"); return; default: LOG.info("Unknown unit", units, "- not drawing Scale line"); return; } double mppt = mppx * Units.OGC_DPI / Units.PDF_DPI; double minDistance = mppt * 50; double distance = SCALE_LINE_DISTANCES_METRES[0]; for (int i = 1; i < SCALE_LINE_DISTANCES_METRES.length; i++) { double d = SCALE_LINE_DISTANCES_METRES[i]; if (d > minDistance) { distance = d; break; } } double pt = distance / mppt; float x1 = (float) OFFSET_SCALE_LEFT; float y1 = (float) OFFSET_SCALE_BOTTOM; float x2 = (float) (OFFSET_SCALE_LEFT + pt); float y2 = y1 + 10; if(request.isScaleText()) { float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, request.getScaleText(), FONT, FONT_SIZE_SCALE, cx, y1 + 5); } else { String distanceStr; if (distance > 1000) { distanceStr = Math.round(distance / 1000) + " km"; } else { distanceStr = Math.round(distance) + " m"; } stream.moveTo(x1, y2); stream.lineTo(x1, y1); stream.lineTo(x2, y1); stream.lineTo(x2, y2); stream.stroke(); float cx = x1 + ((x2 - x1) / 2); PDFBoxUtil.drawTextCentered(stream, distanceStr, FONT, FONT_SIZE_SCALE, cx, y1 + 5); } }
Source:
private static List<MethodMatcher> slf4jVariants(Supplier<MethodMatcher> prototype) { return ImmutableList.of( prototype.get().parameters(STRING), prototype.get().parameters(STRING, TypeCriteria.anyType()), prototype.get().parameters(STRING, TypeCriteria.anyType(), TypeCriteria.anyType()), prototype.get().parameters(STRING, OBJECT_ARR), prototype.get().parameters(MARKER, STRING), prototype.get().parameters(MARKER, STRING, TypeCriteria.anyType()), prototype.get().parameters(MARKER, STRING, TypeCriteria.anyType(), TypeCriteria.anyType()), prototype.get().parameters(MARKER, STRING, OBJECT_ARR) ); }

Target:
private static List<MethodMatcher> slf4jVariants(Supplier<MethodMatcher> prototype) { return ImmutableList.of( prototype.get().parameters(STRING), prototype.get().parameters(STRING, anyType()), prototype.get().parameters(STRING, anyType(), anyType()), prototype.get().parameters(STRING, OBJECT_ARR), prototype.get().parameters(MARKER, STRING), prototype.get().parameters(MARKER, STRING, anyType()), prototype.get().parameters(MARKER, STRING, anyType(), anyType()), prototype.get().parameters(MARKER, STRING, OBJECT_ARR) ); }
Source:
public Optional<MapBean> getMapLocallyFromName(String mapFolderName) { logger.debug("Trying to find map '{}' locally", mapFolderName); String mapFolderKey = mapFolderName.toLowerCase(); if (!mapsByFolderName.containsKey(mapFolderKey)) { return Optional.empty(); } else { MapBean mapBean = mapsByFolderName.get(mapFolderKey); return Optional.of(mapBean); } }

Target:
public Optional<MapBean> getMapLocallyFromName(String mapFolderName) { logger.debug("Trying to find map '{}' locally", mapFolderName); String mapFolderKey = mapFolderName.toLowerCase(); return Optional.ofNullable(mapsByFolderName.get(mapFolderKey)); }
Source:
default MessageId rootMessage() { return isImported() ? messageId() : context() .rootMessage() .orElseThrow(IllegalStateException::new); }

Target:
default MessageId rootMessage() { return context() .rootMessage() .orElseGet(this::messageId); }
Source:
public void start(Integer port) throws IOException { server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext("/" + GlobalSettings.TXTUML_DIAGNOSTICS_HTTP_PATH, new DiagnosticsHandler()); server.createContext("/delay", new DelayHandler()); server.setExecutor(null); server.start(); }

Target:
public void start(Integer port) throws IOException { server = HttpServer.create(new InetSocketAddress(port), 0); server.createContext("/" + TXTUML_DIAGNOSTICS_HTTP_PATH, new DiagnosticsHandler()); server.createContext("/" + TXTUML_DIAGNOSTICS_DELAY_PATH, new DelayHandler()); server.setExecutor(null); server.start(); }
Source:
public boolean isADPCM() { return getCodecA() != null && getCodecA().equalsIgnoreCase(FormatConfiguration.ADPCM); }

Target:
public boolean isADPCM() { return FormatConfiguration.ADPCM.equalsIgnoreCase(getCodecA()); }
Source:
public void close() { if (hasConnection.getAndSet(false)) { try { final AmqpConnection connection = connectionMono.block(timeout); if (connection != null) { connection.close(); } } catch (IOException exception) { throw new AzureException("Unable to close connection to service", exception); } } }

Target:
public void close() { if (hasConnection.getAndSet(false)) { try { final AmqpConnection connection = connectionMono.block(timeout); if (connection != null) { connection.close(); } } catch (IOException exception) { throw new AmqpException(false, "Unable to close connection to service", exception); } } }
Source:
private void inspectModulesForTestClass(Class<?> testClass) { final List<Class<? extends Module>> moduleClasses = new ArrayList<>(); moduleClasses.addAll(getModulesForAnnotatedClass(testClass)); for (Class<?> parentClass : getAllSuperClassesInReverseOrder(testClass)) { moduleClasses.addAll(getModulesForAnnotatedClass(parentClass)); } for (Class<? extends Module> moduleClass : moduleClasses) { try { modulesForTestClass.add(moduleClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { try { Constructor<?>[] declaredConstructors = moduleClass.getDeclaredConstructors(); for(int i=0; i < declaredConstructors.length; i++) { if(declaredConstructors[i].getParameterCount() == 0) { Constructor<?> zeroArgConstructor = declaredConstructors[i]; zeroArgConstructor.setAccessible(true); modulesForTestClass.add((Module) zeroArgConstructor.newInstance()); break; } } } catch (Exception ex) { throw new RuntimeException("Error instantiating module " + moduleClass + ". Please ensure that the module is public and has a no-arg constructor", e); } } } }

Target:
private void inspectModulesForTestClass(Class<?> testClass) { final List<Class<? extends Module>> moduleClasses = new ArrayList<>(); moduleClasses.addAll(getModulesForAnnotatedClass(testClass)); for (Class<?> parentClass : getAllSuperClassesInReverseOrder(testClass)) { moduleClasses.addAll(getModulesForAnnotatedClass(parentClass)); } for (Class<? extends Module> moduleClass : moduleClasses) { try { modulesForTestClass.add(moduleClass.newInstance()); } catch (InstantiationException | IllegalAccessException e) { try { Constructor<?> zeroArgConstructor = moduleClass.getDeclaredConstructor(); zeroArgConstructor.setAccessible(true); modulesForTestClass.add((Module) zeroArgConstructor.newInstance()); } catch (Exception ex) { throw new RuntimeException("Error instantiating module " + moduleClass + ". Please ensure that the module is public and has a no-arg constructor", e); } } } }
Source:
public void testSqlCompletion() throws IOException { verifySqlCompletion("", 0, Arrays.asList("SOURCE", "QUIT;", "RESET;"), Collections.emptyList()); verifySqlCompletion("SOUR", 5, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 0, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("QU", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion(" qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("set ", 3, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show t ", 6, Collections.emptyList(), Collections.singletonList("SET")); }

Target:
public void testSqlCompletion() throws IOException { verifySqlCompletion("", 0, Arrays.asList("SOURCE", "QUIT;", "RESET;"), Collections.emptyList()); verifySqlCompletion("SELE", 5, Collections.singletonList("HintA"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 5, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("SOUR", 0, Collections.singletonList("SOURCE"), Collections.singletonList("QUIT;")); verifySqlCompletion("QU", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion(" qu", 2, Collections.singletonList("QUIT;"), Collections.singletonList("SELECT")); verifySqlCompletion("set ", 3, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show t ", 6, Collections.emptyList(), Collections.singletonList("SET")); verifySqlCompletion("show", 7, Collections.singletonList("MODULES;"), Collections.singletonList("QUIT;")); verifySqlCompletion("show ", 4, Collections.singletonList("MODULES;"), Collections.singletonList("QUIT;")); verifySqlCompletion("show modules", 13, Collections.emptyList(), Collections.singletonList("QUIT;")); }
Source:
public ServiceBusSenderClient buildClient() { return new ServiceBusSenderClient(buildAsyncClient(), MessageUtils.calcTotalTimeout(retryOptions)); }

Target:
public ServiceBusSenderClient buildClient() { return new ServiceBusSenderClient(buildAsyncClient(), MessageUtils.getTotalTimeout(retryOptions)); }
Source:
public static Display[] getDisplays() { List<Display> displays = new ArrayList<>(); WinNT.HANDLE hDevInfo = SetupApi.INSTANCE.SetupDiGetClassDevs(GUID_DEVINTERFACE_MONITOR, null, null, SetupApi.DIGCF_PRESENT | SetupApi.DIGCF_DEVICEINTERFACE); if (!hDevInfo.equals(WinNT.INVALID_HANDLE_VALUE)) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = new SetupApi.SP_DEVICE_INTERFACE_DATA(); deviceInterfaceData.cbSize = deviceInterfaceData.size(); SP_DEVINFO_DATA info = new SetupApi.SP_DEVINFO_DATA(); for (int memberIndex = 0; SetupApi.INSTANCE.SetupDiEnumDeviceInfo(hDevInfo, memberIndex, info); memberIndex++) { HKEY key = SetupApi.INSTANCE.SetupDiOpenDevRegKey(hDevInfo, info, SetupApi.DICS_FLAG_GLOBAL, 0, SetupApi.DIREG_DEV, WinNT.KEY_QUERY_VALUE); byte[] edid = new byte[1]; Advapi32 advapi32 = Advapi32.INSTANCE; IntByReference pType = new IntByReference(); IntByReference lpcbData = new IntByReference(); if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_MORE_DATA) { edid = new byte[lpcbData.getValue()]; if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_SUCCESS) { Display display = new WindowsDisplay(edid); displays.add(display); } } Advapi32.INSTANCE.RegCloseKey(key); } } SetupApi.INSTANCE.SetupDiDestroyDeviceInfoList(hDevInfo); return displays.toArray(new Display[0]); }

Target:
public static Display[] getDisplays() { List<Display> displays = new ArrayList<>(); WinNT.HANDLE hDevInfo = SetupApi.INSTANCE.SetupDiGetClassDevs(GUID_DEVINTERFACE_MONITOR, null, null, SetupApi.DIGCF_PRESENT | SetupApi.DIGCF_DEVICEINTERFACE); if (!hDevInfo.equals(WinNT.INVALID_HANDLE_VALUE)) { SP_DEVICE_INTERFACE_DATA deviceInterfaceData = new SetupApi.SP_DEVICE_INTERFACE_DATA(); deviceInterfaceData.cbSize = deviceInterfaceData.size(); SP_DEVINFO_DATA info = new SetupApi.SP_DEVINFO_DATA(); for (int memberIndex = 0; SetupApi.INSTANCE.SetupDiEnumDeviceInfo(hDevInfo, memberIndex, info); memberIndex++) { HKEY key = SetupApi.INSTANCE.SetupDiOpenDevRegKey(hDevInfo, info, SetupApi.DICS_FLAG_GLOBAL, 0, SetupApi.DIREG_DEV, WinNT.KEY_QUERY_VALUE); byte[] edid = new byte[1]; Advapi32 advapi32 = Advapi32.INSTANCE; IntByReference pType = new IntByReference(); IntByReference lpcbData = new IntByReference(); if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_MORE_DATA) { edid = new byte[lpcbData.getValue()]; if (advapi32.RegQueryValueEx(key, "EDID", 0, pType, edid, lpcbData) == WinError.ERROR_SUCCESS) { Display display = new WindowsDisplay(edid); displays.add(display); } } Advapi32.INSTANCE.RegCloseKey(key); } SetupApi.INSTANCE.SetupDiDestroyDeviceInfoList(hDevInfo); } return displays.toArray(new Display[0]); }
Source:
public boolean supportsBitmapIndex(BitmapIndexSelector selector) { if(selector.getBitmapIndex(dimension) == null) { return false; } else { return true; } }

Target:
public boolean supportsBitmapIndex(BitmapIndexSelector selector) { return selector.getBitmapIndex(dimension) != null; }
Source:
public JmsConfiguration incomingOsgpCoreRequestsJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeConfiguration("jms.incoming.osgp.core.requests", this.incomingOsgpCoreRequestMessageListener); }

Target:
public JmsConfiguration incomingOsgpCoreRequestsJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeReceiveConfiguration("jms.incoming.osgp.core.requests", this.incomingOsgpCoreRequestMessageListener); }
Source:
public void deregisterMetricsWithPrefix(Class clazz, String prefix) { String fqnPrefix = MetricRegistry.name(clazz, prefix); Set<String> relevantMetrics = registeredMetrics.stream() .filter(metricName -> metricName.startsWith(fqnPrefix)) .collect(Collectors.toSet()); relevantMetrics.forEach(this::deregisterMetric); }

Target:
public void deregisterMetricsWithPrefix(Class clazz, String prefix) { String fqnPrefix = prefix.isEmpty() ? clazz.getName() + "." : MetricRegistry.name(clazz, prefix); Set<String> relevantMetrics = registeredMetrics.stream() .filter(metricName -> metricName.startsWith(fqnPrefix)) .collect(Collectors.toSet()); relevantMetrics.forEach(this::deregisterMetric); }
Source:
public String get() { String terminalArchivePath = System.getProperty("user.home") + "\\AppData\\Local\\che\\terminal"; return terminalArchivePath + ":/mnt/che/terminal"; }

Target:
public String get() { return System.getProperty("user.home") + "\\AppData\\Local\\che\\terminal" + ":/mnt/che/terminal"; }
Source:
public void zkConnection() throws Exception { commonspec.getLogger().debug("Closing zookeeper connection"); if (!"".equals(System.getProperty("ZOOKEEPER_CONNECT",""))) { if(commonspec.getZkClient().isConnected()){ commonspec.getZkClient().disconnect(); } } }

Target:
public void zkConnection() throws Exception { commonspec.getLogger().debug("Closing zookeeper connection"); if (!"".equals(System.getProperty("ZOOKEEPER_HOSTS",""))) { if(commonspec.getZkClient().isConnected()){ commonspec.getZkClient().disconnect(); } } }
Source:
public void run() { try { while (!shouldStop()) { isRunning = true; List rowValues = new ArrayList<String>(); synchronized (resultHandler) { for (MonitorDetails monitorDetails : MONITOR_DETAILS_LIST) { rowValues.clear(); try { StandardMBean bean = new StandardMBean(monitorDetails.getMonitor(), Monitor.class); Calendar calendar = new GregorianCalendar(); rowValues.add(monitorDetails); rowValues.add(((Monitor) bean.getImplementation()).getStat()); rowValues.add(DateUtil.DEFAULT_MS_DATE_FORMATTER.format(calendar.getTime())); Result result = new Result(ResultFileDetails.CSV, ResultFileDetails.CSV_MONITOR.getHeader().toString(), rowValues); resultHandler.write(result); } catch (Exception e) { throw new FileLoaderRuntimeException("Could not log monitor result.", e); } rowCount++; } try { Thread.sleep(getMonitorFrequency()); } catch (InterruptedException e) { e.printStackTrace(); } } } } finally { try { isRunning = false; if (resultHandler != null) { resultHandler.flush(); resultHandler.close(); } } catch (Exception e) { throw new FileLoaderRuntimeException("Could not close monitor results.", e); } } }

Target:
public void run() { try { while (!shouldStop()) { isRunning = true; List rowValues = new ArrayList<String>(); synchronized (resultHandler) { for (MonitorDetails monitorDetails : MONITOR_DETAILS_LIST) { rowValues.clear(); try { StandardMBean bean = new StandardMBean(monitorDetails.getMonitor(), Monitor.class); Calendar calendar = new GregorianCalendar(); rowValues.add(monitorDetails); rowValues.add(((Monitor) bean.getImplementation()).getStat()); rowValues.add(DateUtil.DEFAULT_MS_DATE_FORMATTER.format(calendar.getTime())); Result result = new Result(ResultFileDetails.CSV, ResultFileDetails.CSV_MONITOR.getHeader().toString(), rowValues); resultHandler.write(result); } catch (Exception e) { throw new FileLoaderRuntimeException("Could not log monitor result.", e); } rowCount.getAndIncrement(); } try { Thread.sleep(getMonitorFrequency()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } } } } finally { try { isRunning = false; if (resultHandler != null) { resultHandler.flush(); resultHandler.close(); } } catch (Exception e) { throw new FileLoaderRuntimeException("Could not close monitor results.", e); } } }
Source:
public void updateIfNeeded(VdsDynamic vdsDynamic) { VdsDynamic dbData = get(vdsDynamic.getId()); if (!dbData.equals(vdsDynamic)) { update(vdsDynamic); } else { log.info("Ignored an unneeded update of VdsDynamic"); } }

Target:
public void updateIfNeeded(VdsDynamic vdsDynamic) { VdsDynamic dbData = get(vdsDynamic.getId()); if (!dbData.equals(vdsDynamic)) { update(vdsDynamic); } else { log.debug("Ignored an unneeded update of VdsDynamic"); } }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (!(object instanceof IntegerStateValue)) { return -1; } IntegerStateValue other = (IntegerStateValue) object; return Integer.compare(this.value, other.value); }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: IntegerStateValue other = (IntegerStateValue) object; result = Integer.compare(this.value, other.value); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); double thisDoubleValue = this.value; result = Double.compare(thisDoubleValue, otherDoubleValue); break; case LONG: long otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
public void run() { try { while (!end || !queue.isEmpty()) { RDFRecordedAction action = queue.take(); action.exec(targetHandler); } } catch (RDFHandlerException e) { onFailureListener.accept(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); onFailureListener.accept(e); } }

Target:
public void run() { try { while (!end || !queue.isEmpty()) { RDFRecordedAction action = queue.poll(100, MILLISECONDS); if (action != null) { action.exec(targetHandler); } } } catch (RDFHandlerException e) { onFailureListener.accept(e); } catch (InterruptedException e) { Thread.currentThread().interrupt(); onFailureListener.accept(e); } }
Source:
private Object doDeleteRange(ConsecutiveNarrowTable table, int numBatches) { Iterable<RangeRequest> rangeRequests; if (numBatches == 1) { rangeRequests = ImmutableList.of(RangeRequest.all()); } else { rangeRequests = table.getRangeRequests(1, table.getNumRows() / numBatches); } rangeRequests.forEach(rangeRequest -> table.getKvs().deleteRange(table.getTableRef(), rangeRequest)); return rangeRequests; }

Target:
private Object doDeleteRange(ConsecutiveNarrowTable table, int numBatches) { Iterable<RangeRequest> rangeRequests = numBatches == 1 ? ImmutableList.of(RangeRequest.all()) : table.getRangeRequests(1, table.getNumRows() / numBatches); rangeRequests.forEach(rangeRequest -> table.getKvs().deleteRange(table.getTableRef(), rangeRequest)); return rangeRequests; }
Source:
public static void createProjects( final Set<ProjectRecord> projectsToCreate, final Repository repository, final IWorkingSet[] selectedWorkingSets, IProgressMonitor monitor) throws CoreException, OperationCanceledException { IWorkspaceRunnable wsr = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { IWorkingSetManager workingSetManager = PlatformUI .getWorkbench().getWorkingSetManager(); try { actMonitor.beginTask("", projectsToCreate.size()); if (actMonitor.isCanceled()) { throw new OperationCanceledException(); } for (ProjectRecord projectRecord : projectsToCreate) { if (actMonitor.isCanceled()) { throw new OperationCanceledException(); } actMonitor.setTaskName(projectRecord.getProjectLabel()); IProject project = createExistingProject(projectRecord, new SubProgressMonitor(actMonitor, 1)); if (repository != null) { ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation( project, repository.getDirectory()); connectProviderOperation.execute(actMonitor); } if (selectedWorkingSets != null && selectedWorkingSets.length > 0) workingSetManager.addToWorkingSets(project, selectedWorkingSets); } } finally { actMonitor.done(); } } }; ResourcesPlugin.getWorkspace().run(wsr, monitor); }

Target:
public static void createProjects( final Set<ProjectRecord> projectsToCreate, final Repository repository, final IWorkingSet[] selectedWorkingSets, IProgressMonitor monitor) throws CoreException, OperationCanceledException { IWorkspaceRunnable wsr = new IWorkspaceRunnable() { public void run(IProgressMonitor actMonitor) throws CoreException { IWorkingSetManager workingSetManager = PlatformUI .getWorkbench().getWorkingSetManager(); try { actMonitor.beginTask("", projectsToCreate.size()); if (actMonitor.isCanceled()) throw new OperationCanceledException(); for (ProjectRecord projectRecord : projectsToCreate) { if (actMonitor.isCanceled()) throw new OperationCanceledException(); actMonitor.setTaskName(projectRecord.getProjectLabel()); IProject project = createExistingProject(projectRecord, new SubProgressMonitor(actMonitor, 1)); if (repository != null) { ConnectProviderOperation connectProviderOperation = new ConnectProviderOperation( project, repository.getDirectory()); connectProviderOperation.execute(actMonitor); } if (selectedWorkingSets != null && selectedWorkingSets.length > 0) workingSetManager.addToWorkingSets(project, selectedWorkingSets); } } finally { actMonitor.done(); } } }; ResourcesPlugin.getWorkspace().run(wsr, monitor); }
Source:
public int getCookieMaxAge() { return "".equals(this.cookieValue) ? 0 : this.cookieMaxAge; }

Target:
public int getCookieMaxAge() { return this.cookieMaxAge; }
Source:
private static BoundCustomizer defaultParameterCustomizer(Class<?> type, Method method, Parameter parameter, Integer i) { return (stmt, args) -> getDefaultParameterCustomizerFactory(stmt) .createForParameter(null, type, method, parameter, i) .apply(stmt, args[i]); }

Target:
private static BoundCustomizer defaultParameterCustomizer(Class<?> type, Method method, Parameter parameter, Integer i) { return (stmt, args) -> getDefaultParameterCustomizerFactory(stmt) .createForParameter(type, method, parameter, i) .apply(stmt, args[i]); }
Source:
public static int compareRecords(String key, String value, StructuredRecord structuredRecord1, StructuredRecord structuredRecord2) { int res; Schema.Type type = structuredRecord1.getSchema().getField(key).getSchema().getType(); if (type.equals(Schema.Type.STRING)) { res = getSortingOrder(value) * ((String) structuredRecord1.get(key)) .compareTo((String) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.INT)) { res = getSortingOrder(value) * Integer.compare((Integer) structuredRecord1.get(key), (Integer) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.LONG)) { res = getSortingOrder(value) * Long.compare((Long) structuredRecord1.get(key), (Long) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.FLOAT)) { res = getSortingOrder(value) * Float.compare((Float) structuredRecord1.get(key), (Float) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.DOUBLE)) { res = getSortingOrder(value) * Double.compare((Double) structuredRecord1.get(key), (Double) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.BYTES)) { res = getSortingOrder(value) * Byte.compare((Byte) structuredRecord1.get(key), (Byte) structuredRecord2.get(key)); } else { throw new IllegalArgumentException("Sorting can be performed only on the following CDAP data types: " + "String, Int, Long, Float, Double, Byte"); } return res; }

Target:
public static int compareRecords(String key, String value, StructuredRecord structuredRecord1, StructuredRecord structuredRecord2) { int res; res = compareNull(key, structuredRecord1, structuredRecord2); if (res == DEFAULT_COMP_VALUE) { Schema schema = structuredRecord1.getSchema().getField(key).getSchema(); Schema.Type type = schema.isNullableSimple() ? schema.getNonNullable().getType() : schema.getType(); if (type.equals(Schema.Type.STRING)) { res = getSortingOrder(value) * ((String) structuredRecord1.get(key)) .compareTo((String) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.INT)) { res = getSortingOrder(value) * Integer.compare((Integer) structuredRecord1.get(key), (Integer) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.LONG)) { res = getSortingOrder(value) * Long.compare((Long) structuredRecord1.get(key), (Long) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.FLOAT)) { res = getSortingOrder(value) * Float.compare((Float) structuredRecord1.get(key), (Float) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.DOUBLE)) { res = getSortingOrder(value) * Double.compare((Double) structuredRecord1.get(key), (Double) structuredRecord2.get(key)); } else if (type.equals(Schema.Type.BYTES)) { res = getSortingOrder(value) * Byte.compare((Byte) structuredRecord1.get(key), (Byte) structuredRecord2.get(key)); } else { throw new IllegalArgumentException("Sorting can be performed only on the following CDAP data types: " + "String, Int, Long, Float, Double, Byte"); } } return res; }
Source:
public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } addDnsConfiguration(result); boolean defaultRouteSupported = FeatureSupported.defaultRouteSupported(cluster.getCompatibilityVersion()); result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), !defaultRouteSupported || isDefaultRouteNetwork); return result; }

Target:
public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } addDnsConfiguration(result); boolean defaultRouteSupported = FeatureSupported.defaultRouteSupported(cluster.getCompatibilityVersion()); result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork, !defaultRouteSupported || Objects.equals(iface.isIpv4DefaultRoute(), isDefaultRouteNetwork)); return result; }
Source:
public void testExecute() { aDeleteNodeCommand.execute(); hasExecuted = true; try { ArrayList<Node> aListNodesToBeRemoved = (ArrayList<Node>)(aNodesToBeRemoved.get(aGraph)); assertTrue(aListNodesToBeRemoved.contains((Node)aNode)); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } try { assertTrue((boolean)aNeedsLayout.get(aGraph)); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }

Target:
public void testExecute() { aDeleteNodeCommand.execute(); ArrayList<Node> aListNodesToBeRemoved; try { aListNodesToBeRemoved = (ArrayList<Node>) (aNodesToBeRemoved.get(aGraph)); assertTrue(aListNodesToBeRemoved.contains((Node) aNode)); } catch (IllegalArgumentException | IllegalAccessException e1) { fail(); } }
Source:
public void testScanExercise() { plugin.scanExercise(simpleAllTestsPassProject, "main.R"); File availablePointsJson = new File(simpleAllTestsPassProject.toAbsolutePath().toString() + "/.available_points.json"); assertTrue(availablePointsJson.exists()); }

Target:
public void testScanExercise() { plugin.scanExercise(simpleAllTestsPassProject, "main.R"); assertTrue(Files.exists(simpleAllTestsPassProject.resolve(".available_points.json"))); }
Source:
protected void onDataStateChanged(AsyncResult ar) { ArrayList<DataCallState> dataCallStates = (ArrayList<DataCallState>)(ar.result); if (ar.exception != null) { return; } if (state == State.CONNECTED) { boolean isActiveOrDormantConnectionPresent = false; int connectionState = DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE; for (int index = 0; index < dataCallStates.size(); index++) { connectionState = dataCallStates.get(index).active; if (connectionState != DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) { isActiveOrDormantConnectionPresent = true; break; } } if (!isActiveOrDormantConnectionPresent) { Log.i(LOG_TAG, "onDataStateChanged: No active connection" + "state is CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); boolean desiredPowerState = mCdmaPhone.mSST.getDesiredPowerState(); if (desiredPowerState == true) { cleanUpConnection(true, null); } else { Log.i(LOG_TAG, "Due to radio turn off cleanup the data call"); cleanUpConnection(false, Phone.REASON_RADIO_TURNED_OFF); } return; } switch (connectionState) { case DATA_CONNECTION_ACTIVE_PH_LINK_UP: Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore"); activity = Activity.NONE; phone.notifyDataActivity(); startNetStatPoll(); break; case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN: Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant"); activity = Activity.DORMANT; phone.notifyDataActivity(); stopNetStatPoll(); break; default: Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active=" + connectionState); } } else { Log.i(LOG_TAG, "onDataStateChanged: not connected, state=" + state + " ignoring"); } }

Target:
protected void onDataStateChanged(AsyncResult ar) { ArrayList<DataCallState> dataCallStates = (ArrayList<DataCallState>)(ar.result); if (ar.exception != null) { return; } if (state == State.CONNECTED) { boolean isActiveOrDormantConnectionPresent = false; int connectionState = DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE; for (int index = 0; index < dataCallStates.size(); index++) { connectionState = dataCallStates.get(index).active; if (connectionState != DATA_CONNECTION_ACTIVE_PH_LINK_INACTIVE) { isActiveOrDormantConnectionPresent = true; break; } } if (!isActiveOrDormantConnectionPresent) { Log.i(LOG_TAG, "onDataStateChanged: No active connection" + "state is CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); cleanUpConnection(true, null); return; } switch (connectionState) { case DATA_CONNECTION_ACTIVE_PH_LINK_UP: Log.v(LOG_TAG, "onDataStateChanged: active=LINK_ACTIVE && CONNECTED, ignore"); activity = Activity.NONE; phone.notifyDataActivity(); startNetStatPoll(); break; case DATA_CONNECTION_ACTIVE_PH_LINK_DOWN: Log.v(LOG_TAG, "onDataStateChanged active=LINK_DOWN && CONNECTED, dormant"); activity = Activity.DORMANT; phone.notifyDataActivity(); stopNetStatPoll(); break; default: Log.v(LOG_TAG, "onDataStateChanged: IGNORE unexpected DataCallState.active=" + connectionState); } } else { Log.i(LOG_TAG, "onDataStateChanged: not connected, state=" + state + " ignoring"); } }
Source:
public DiskImage createDisk(Guid domainId) { DiskImage createdDistImage = new DiskImage(); createdDistImage.setDiskInterface(DiskInterface.IDE); createdDistImage.setWipeAfterDelete(false); createdDistImage.setDiskAlias(OvfInfoFileConstants.OvfStoreDescriptionLabel); createdDistImage.setDiskDescription(OvfInfoFileConstants.OvfStoreDescriptionLabel); createdDistImage.setShareable(shouldOvfStoreBeShareable()); createdDistImage.setStorageIds(new ArrayList<>(Arrays.asList(domainId))); createdDistImage.setSize(SizeConverter.BYTES_IN_MB * 128); createdDistImage.setvolumeFormat(VolumeFormat.RAW); createdDistImage.setVolumeType(VolumeType.Preallocated); createdDistImage.setDescription("OVF store for domain " + domainId); Date creationDate = new Date(); createdDistImage.setCreationDate(creationDate); createdDistImage.setLastModified(creationDate); return createdDistImage; }

Target:
public DiskImage createDisk(Guid domainId) { DiskImage createdDiskImage = new DiskImage(); createdDiskImage.setDiskInterface(DiskInterface.IDE); createdDiskImage.setWipeAfterDelete(false); createdDiskImage.setDiskAlias(OvfInfoFileConstants.OvfStoreDescriptionLabel); createdDiskImage.setDiskDescription(OvfInfoFileConstants.OvfStoreDescriptionLabel); createdDiskImage.setShareable(shouldOvfStoreBeShareable()); createdDiskImage.setStorageIds(new ArrayList<>(Arrays.asList(domainId))); createdDiskImage.setSize(SizeConverter.BYTES_IN_MB * 128); createdDiskImage.setvolumeFormat(VolumeFormat.RAW); createdDiskImage.setVolumeType(VolumeType.Preallocated); createdDiskImage.setDescription("OVF store for domain " + domainId); Date creationDate = new Date(); createdDiskImage.setCreationDate(creationDate); createdDiskImage.setLastModified(creationDate); return createdDiskImage; }
Source:
public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (ctx instanceof DocumentEventContext) { DocumentEventContext docCtx = (DocumentEventContext) ctx; CoreSession session = docCtx.getCoreSession(); DocumentModel doc = docCtx.getSourceDocument(); if (doc == null) { return; } String docId = doc.getId(); TagService tagService = Framework.getService(TagService.class); if (doc instanceof DeletedDocumentModel) { tagService.removeTags(session, docId); return; } DocumentRef versionRef = (DocumentRef) ctx.getProperty("checkedInVersionRef"); if (versionRef instanceof IdRef && Framework.getService(ConfigurationService.class).isBooleanPropertyFalse( TagServiceImpl.FACETED_TAG_SERVICE_ENABLED)) { tagService.copyTags(session, docId, versionRef.toString()); } } }

Target:
public void handleEvent(Event event) { EventContext ctx = event.getContext(); if (ctx instanceof DocumentEventContext) { DocumentEventContext docCtx = (DocumentEventContext) ctx; CoreSession session = docCtx.getCoreSession(); DocumentModel doc = docCtx.getSourceDocument(); if (doc == null) { return; } String docId = doc.getId(); TagService tagService = Framework.getService(TagService.class); if (doc instanceof DeletedDocumentModel) { tagService.removeTags(session, docId); return; } DocumentRef versionRef = (DocumentRef) ctx.getProperty("checkedInVersionRef"); boolean facetedTags = Framework.getService(ConfigurationService.class) .isBooleanPropertyTrue(TagServiceImpl.FACETED_TAG_SERVICE_ENABLED); if (versionRef instanceof IdRef && !facetedTags) { tagService.copyTags(session, docId, versionRef.toString()); } } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShellChecked(event); DirectoryDialog dlg = new DirectoryDialog(shell); dlg.setFilterPath(getFilterPath()); dlg.setText(Messages.DownloadFilesHandler_folderDlg_text); dlg.setMessage(Messages.DownloadFilesHandler_folderDlg_message); final String destination = dlg.open(); if (destination == null) return null; File destinationFile = new File(destination); saveFilterPath(destinationFile); IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); List<IFSTreeNode> nodes = selection.toList(); IRuntimeModel peer = nodes.get(0).getRuntimeModel(); peer.operationDownload(nodes, destinationFile, new MoveCopyCallback()).runInUserJob(new Callback() { @Override protected void internalDone(Object caller, IStatus status) { if (status.isOK() || status.matches(IStatus.CANCEL)) { IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(new Path(destination)); if (container != null) { try { container.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (CoreException e) { e.printStackTrace(); } } } } }); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell shell = HandlerUtil.getActiveShellChecked(event); DirectoryDialog dlg = new DirectoryDialog(shell); dlg.setFilterPath(getFilterPath()); dlg.setText(Messages.DownloadFilesHandler_folderDlg_text); dlg.setMessage(Messages.DownloadFilesHandler_folderDlg_message); final String destination = dlg.open(); if (destination == null) return null; final File destinationFile = new File(destination); saveFilterPath(destinationFile); IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event); List<IFSTreeNode> nodes = selection.toList(); IRuntimeModel peer = nodes.get(0).getRuntimeModel(); peer.operationDownload(nodes, destinationFile, new MoveCopyCallback()).runInUserJob(new Callback() { @Override protected void internalDone(Object caller, IStatus status) { for (IContainer container : ResourcesPlugin.getWorkspace().getRoot().findContainersForLocationURI(destinationFile.toURI())) { if (container != null) { try { container.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException e) { e.printStackTrace(); } } } } }); return null; }
Source:
public boolean next() { if ( added != null && added.hasNext() ) { this.node = added.next(); return true; } else { LabelScanValueIndexProgressor p = progressor; return p != null && p.next(); } }

Target:
public boolean next() { if ( added != null && added.hasNext() ) { this.node = added.next(); return true; } else { return innerNext(); } }
Source:
public void deleteFromRevision() throws ConflictException { DocumentRevision deleted = datastore.deleteDocumentFromRevision(saved); Assert.assertNotNull("Deleted DocumentRevision is null", deleted); Assert.assertTrue("Deleted DocumentRevision is not flagged as deleted", deleted.isDeleted()); }

Target:
public void deleteFromRevision() throws ConflictException { BasicDocumentRevision deleted = datastore.deleteDocumentFromRevision(saved); Assert.assertNotNull("Deleted DocumentRevision is null", deleted); Assert.assertTrue("Deleted DocumentRevision is not flagged as deleted", deleted.isDeleted()); }
Source:
public boolean post(Runnable runnable) { RealmLog.error("RRRRR + " + handler); return handler != null && handler.post(runnable); }

Target:
public boolean post(Runnable runnable) { return handler != null && handler.post(runnable); }
Source:
public void preTaskDeactivated(ITask task) { Repository repository = Activator.getDefault().getRepositoryCache() .getAllRepositories()[0]; try { BranchOperation operation = new BranchOperation(repository, Constants.R_REMOTES + "origin/" + Constants.MASTER); operation.execute(null); } catch (CoreException e) { e.printStackTrace(); } }

Target:
public void preTaskDeactivated(ITask task) { for (Repository repo : usedRepositories) { try { BranchOperation operation = new BranchOperation(repo, Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/" + Constants.MASTER); operation.execute(null); } catch (CoreException e) { e.printStackTrace(); } } }
Source:
void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if(MetaClass.class.isInstance(expectedReceiver) && expectedMethodName.equals("invokeMethod")){ return; } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }

Target:
void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if (expectedReceiver instanceof MetaClass && expectedMethodName.equals("invokeMethod")) { return; } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }