auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public JFormattedTextField getDashArrayField(final ConstantColorAndDashesPSLegend cps){ final JFormattedTextField jrf = new JFormattedTextField(NumberFormat.getNumberInstance()); jrf.setText(cps.getDashArray()); jrf.setHorizontalAlignment(JFormattedTextField.RIGHT); jrf.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cps.setDashArray(((JTextField)e.getSource()).getText()); } }); jrf.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { JTextField jtf = (JTextField)e.getSource(); String tmp = jtf.getText(); cps.setDashArray(tmp); if(!tmp.equals(cps.getDashArray())){ LOGGER.warn(I18N.tr("Could not validate your input.")); jtf.setText(cps.getDashArray()); } } }); jrf.addFocusListener( EventHandler.create(FocusListener.class, preview, "imageChanged")); return jrf; }

Target:
public JTextField getDashArrayField(final ConstantColorAndDashesPSLegend cps){ final JTextField jrf = new JTextField("", 8); jrf.setText(cps.getDashArray()); jrf.setHorizontalAlignment(JFormattedTextField.RIGHT); jrf.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cps.setDashArray(((JTextField)e.getSource()).getText()); } }); jrf.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { JTextField jtf = (JTextField)e.getSource(); String tmp = jtf.getText(); cps.setDashArray(tmp); if(!tmp.equals(cps.getDashArray())){ LOGGER.warn(I18N.tr("Could not validate your input.")); jtf.setText(cps.getDashArray()); } } }); jrf.addFocusListener( EventHandler.create(FocusListener.class, preview, "imageChanged")); return jrf; }
Source:
protected Long nullUnsafeScalar(LocalDateTime value) { return value.atZone( ZoneOffset.UTC ).toInstant().toEpochMilli(); }

Target:
protected Long nullUnsafeScalar(LocalDateTime value) { return value.toInstant( ZoneOffset.UTC ).toEpochMilli(); }
Source:
public IMetadataTable getMetadataFromConnector(String connector) { for (IMetadataTable table : metadataList) { if (table != null && table.getAttachedConnector() != null) { if (table.getAttachedConnector().equals(connector)) { return table; } } } if (EConnectionType.FLOW_MAIN.equals(EConnectionType.getTypeFromName(connector))) { for (IMetadataTable table : metadataList) { if (table != null && EConnectionType.getTypeFromName(table.getAttachedConnector()) == null) { return table; } } } return null; }

Target:
public IMetadataTable getMetadataFromConnector(String connector) { for (IMetadataTable table : metadataList) { if (table != null && table.getAttachedConnector() != null) { if (table.getAttachedConnector().equals(connector)) { return table; } } } return null; }
Source:
public void setContentType(RequestContext res, ResponseContext resp, Operation operation) { if (resp.getContentType() != null) { return; } ApiResponses responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { final ApiResponse response = responses.get(responseCode); Content content = response.getContent(); if(content == null) { return; } for(String key : content.keySet()) { MediaType mediaType = MediaType.valueOf(key); if (res.getHeaders().get("Content-Type")!= null) { for (String acceptable : res.getHeaders().get("Content-Type")) { String subtype = acceptable.substring(acceptable.lastIndexOf("/") + 1); if (subtype.equals(mediaType.getSubtype())) { resp.setContentType(mediaType); return; }else { resp.setContentType(mediaType); } } }else { for (MediaType acceptable : res.getAcceptableMediaTypes()){ if (mediaType.isCompatible(acceptable)) { resp.setContentType(mediaType); return; }else { resp.setContentType(mediaType); } } } } } } }

Target:
public void setContentType(RequestContext res, ResponseContext resp, Operation operation) { if (resp.getContentType() != null) { return; } ApiResponses responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { final ApiResponse response = responses.get(responseCode); Content content = response.getContent(); if(content == null) { return; } for(String key : content.keySet()) { MediaType mediaType = MediaType.valueOf(key); if (res.getHeaders().get("Accept")!= null) { for (String acceptable : res.getHeaders().get("Accept")) { String subtype = acceptable.substring(acceptable.lastIndexOf("/") + 1); resp.setContentType(mediaType); if (subtype.equals(mediaType.getSubtype())) { return; } } }else { for (MediaType acceptable : res.getAcceptableMediaTypes()){ resp.setContentType(mediaType); if (mediaType.isCompatible(acceptable)) { return; } } } } } } }
Source:
public int partition(final long dataId) { return (int) (dataId >> partitionSizeBits); }

Target:
public long partition(final long dataId) { return dataId >> partitionSizeBits; }
Source:
public RequestBuilder(URI baseURI) { builder = new URIBuilder(baseURI); paths = new ArrayList<>(); Collections.addAll(paths, strip(strip(baseURI.getPath())).split("/")); }

Target:
public RequestBuilder(URI baseURI) { builder = new URIBuilder(baseURI); paths = new ArrayList<>(); Collections.addAll(paths, strip(baseURI.getPath()).split("/")); }
Source:
public static String getTimeFromNanoSeconds(long nanoSec, String format) throws Exception { if (!format.equals(TIME_FORMAT_HHMMSS) || (!format.equals(TIME_FORMAT_HH_HR_MM_MIN_SS_SEC))) { throw new Exception("given time format not supported"); } nanoSec = nanoSec / 1000; int hour = (int) nanoSec / 3600; nanoSec = nanoSec % 3600; int min = (int) nanoSec / 60; int sec = (int) nanoSec % 60; String time = ""; if (format.equals(TIME_FORMAT_HHMMSS)) { if (hour > 0) { time = time + hour + ":"; } if (min > 0) { time = time + min + ";"; } return time + sec; } else { if (hour > 0) { time = time + hour + " hr "; } if (min > 0) { time = time + min + " min "; } return time + sec + " sec"; } }

Target:
public static String getTimeFromNanoSeconds(long nanoSec, String format) throws Exception { if (!format.equals(TIME_FORMAT_HHMMSS) || (!format.equals(TIME_FORMAT_HH_HR_MM_MIN_SS_SEC))) { throw new Exception("given time format not supported"); } nanoSec = nanoSec / 1000; int hour = (int) nanoSec / 3600; nanoSec = nanoSec % 3600; int min = (int) nanoSec / 60; int sec = (int) nanoSec % 60; String time = ""; if (format.equals(TIME_FORMAT_HHMMSS)) { if (hour > 0) { time = time + hour + ":"; } if (min > 0) { time = time + min + ":"; } return time + sec; } else { if (hour > 0) { time = time + hour + " hr "; } if (min > 0) { time = time + min + " min "; } return time + sec + " sec"; } }
Source:
public void deleteFile(String screenToFrame) { File fileToDelete = new File(screenToFrame); fileToDelete.delete(); }

Target:
public void deleteFile(String screenToFrame) { File fileToDelete = new File(screenToFrame); if (fileToDelete.exists()) { fileToDelete.delete(); } }
Source:
private String generateMessageTypes() { return dictionary .messages() .stream() .map((message) -> { final int type = message.packedType(); final String constantName = "MSG_" + constantName(message.name()); final String stringConstantName = constantName + "_AS_STR"; return generateMessageTypeConstant(stringConstantName, type) + generateIntConstant(constantName, type); }) .collect(joining()); }

Target:
private String generateMessageTypes() { return dictionary .messages() .stream() .map((message) -> { final int type = message.packedType(); final String constantName = constantName(message.name()) + "_MESSAGE"; final String stringConstantName = constantName + "_AS_STR"; return generateMessageTypeConstant(stringConstantName, type) + generateIntConstant(constantName, type); }) .collect(joining()); }
Source:
public static void main(String[] args) throws Throwable { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkDictionaryBlockGetSizeInBytes().getSizeInBytes(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .warmupMode(WarmupMode.INDI) .include(".*" + BenchmarkDictionaryBlockGetSizeInBytes.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }

Target:
public static void main(String[] args) throws Throwable { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkDictionaryBlockGetSizeInBytes().getSizeInBytes(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkDictionaryBlockGetSizeInBytes.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }
Source:
public boolean isValid(String cidr, ConstraintValidatorContext context) { boolean isCidrFormat = CidrValidator.isCidrFormatValid(cidr); if (!isCidrFormat) { return false; } boolean isNetworkAddress = CidrValidator.isCidrValidNetworkAddress(cidr); if (!isNetworkAddress) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("CIDR_NOT_NETWORK_ADDRESS") .addNode("cidr") .addConstraintViolation(); return false; } return true; }

Target:
public boolean isValid(String cidr, ConstraintValidatorContext context) { if (!CidrValidator.isCidrFormatValid(cidr)) { return failWith(context, "BAD_CIDR_FORMAT"); } if (!CidrValidator.isCidrValidNetworkAddress(cidr)) { return failWith(context, "CIDR_NOT_NETWORK_ADDRESS"); } return true; }
Source:
public static Locale getPreferredLanguage(OsmandSettings set){ if (set.usingEnglishNames()) { return new Locale("en"); } return Locale.getDefault(); }

Target:
public static Locale getPreferredLanguage(OsmandSettings set){ if (set.usingEnglishNames()) { return Locale.ENGLISH; } return Locale.getDefault(); }
Source:
private String replaceBindingKeysByTheirValue(String scriptContent, Map<String, Serializable> binding) { for (Map.Entry<String, Serializable> variableMapping : binding.entrySet()) { scriptContent = scriptContent.replace(variableMapping.getKey(), variableMapping.getValue().toString()); } return scriptContent; }

Target:
private String replaceBindingKeysByTheirValue(String scriptContent, Map<String, Serializable> binding) { for (Map.Entry<String, Serializable> variableMapping : binding.entrySet()) { Serializable bindingValue = variableMapping.getValue(); if (bindingValue != null) { scriptContent = scriptContent.replace(variableMapping.getKey(), bindingValue.toString()); } } return scriptContent; }
Source:
public SwappedByteBuf(ByteBuf buf) { ObjectUtil.checkNotNull(buf, "buf"); this.buf = buf; if (buf.order() == ByteOrder.BIG_ENDIAN) { order = ByteOrder.LITTLE_ENDIAN; } else { order = ByteOrder.BIG_ENDIAN; } }

Target:
public SwappedByteBuf(ByteBuf buf) { this.buf = ObjectUtil.checkNotNull(buf, "buf"); if (buf.order() == ByteOrder.BIG_ENDIAN) { order = ByteOrder.LITTLE_ENDIAN; } else { order = ByteOrder.BIG_ENDIAN; } }
Source:
public Object command(final OCommandRequestText iCommand) { try { while (true) { try { final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand); executor.setContext(iCommand.getContext()); executor.setProgressListener(iCommand.getProgressListener()); executor.parse(iCommand); String currentThreadName = Thread.currentThread().getName(); try { Thread.currentThread().setName(currentThreadName + " <command>" + iCommand + "</command>"); return executeCommand(iCommand, executor); } finally { Thread.currentThread().setName(String.valueOf(currentThreadName)); } } catch (ORetryQueryException ignore) { if (iCommand instanceof OQueryAbstract) { final OQueryAbstract query = (OQueryAbstract) iCommand; query.reset(); } continue; } } } catch (RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (Error e) { throw logAndPrepareForRethrow(e); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }

Target:
public Object command(final OCommandRequestText iCommand) { try { while (true) { try { final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand); executor.setContext(iCommand.getContext()); executor.setProgressListener(iCommand.getProgressListener()); executor.parse(iCommand); String currentThreadName = Thread.currentThread().getName(); try { if (currentThreadName == null || !(currentThreadName.contains("<query>") || currentThreadName.contains("<command>"))) { try { Thread.currentThread().setName(currentThreadName + " <command>" + iCommand + "</command>"); } catch (SecurityException x) { } } return executeCommand(iCommand, executor); } finally { try { Thread.currentThread().setName(currentThreadName); } catch (SecurityException x) { } } } catch (ORetryQueryException ignore) { if (iCommand instanceof OQueryAbstract) { final OQueryAbstract query = (OQueryAbstract) iCommand; query.reset(); } continue; } } } catch (RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (Error e) { throw logAndPrepareForRethrow(e); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }
Source:
private Schema getOutputSchema(Schema inputSchema) throws IllegalArgumentException { Schema outputSchema = schemaCache.get(inputSchema); if (outputSchema != null) { return outputSchema; } List<Schema.Field> outputFields = Lists.newArrayList(); for (Schema.Field inputField : inputSchema.getFields()) { if (inputField.getSchema().getType() != Schema.Type.STRING) { throw new IllegalArgumentException("Input field type should be String"); } else { if (fieldsMapping.containsKey(inputField.getName())) { outputFields.add(Schema.Field.of(fieldsMapping.get(inputField.getName()), Schema.of(Schema.Type.STRING))); } else { outputFields.add(inputField); } } } outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".formatted", outputFields); schemaCache.put(inputSchema, outputSchema); return outputSchema; }

Target:
private Schema getOutputSchema(Schema inputSchema) throws IllegalArgumentException { Schema outputSchema = schemaCache.get(inputSchema); if (outputSchema != null) { return outputSchema; } List<Schema.Field> outputFields = new ArrayList<>(); for (Schema.Field inputField : inputSchema.getFields()) { String inputFieldName = inputField.getName(); if (mappingValues.containsKey(inputFieldName)) { Schema fieldSchema = inputField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema .getType(); if (fieldType != Schema.Type.STRING) { throw new IllegalArgumentException("Input field " + inputFieldName + " must be of type string, but is" + " of type" + inputField.getSchema().getType().name()); } else { if (defaultsMapping.containsKey(inputFieldName)) { outputFields.add(Schema.Field.of(mappingValues.get(inputFieldName).getTargetField(), Schema.of(Schema.Type.STRING))); } else { outputFields.add(Schema.Field.of(mappingValues.get(inputFieldName).getTargetField(), Schema.nullableOf(Schema.of(Schema.Type.STRING)))); } } } else { outputFields.add(inputField); } } outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".formatted", outputFields); schemaCache.put(inputSchema, outputSchema); return outputSchema; }
Source:
private static List<JavadocTag> getMethodTags(final TextBlock comment) { final String[] lines = comment.getText(); final List<JavadocTag> tags = new ArrayList<>(0); int current = comment.getStartLineNo() - 1; final int start = comment.getStartColNo(); for (int line = 0; line < lines.length; line = line + 1) { current = current + 1; final Matcher docmatcher = MATCH_JAVADOC_ARG.matcher(lines[line]); final Matcher multiline = MATCH_JAVADOC_ARG_MULTILINE_START.matcher(lines[line]); if (docmatcher.find()) { final int col = calculateTagColumn( docmatcher, line, start ); tags.add( new JavadocTag( current, col, docmatcher.group(1), docmatcher.group(2) ) ); } else if (multiline.find()) { final int col = calculateTagColumn( multiline, line, start ); tags.addAll( getMultilineArgTags( multiline, col, lines, line, current ) ); } } return tags; }

Target:
private static List<JavadocTag> getMethodTags(final TextBlock comment) { final String[] lines = comment.getText(); final List<JavadocTag> tags = new LinkedList<>(); int current = comment.getStartLineNo() - 1; final int start = comment.getStartColNo(); for (int line = 0; line < lines.length; line = line + 1) { current = current + 1; final Matcher docmatcher = MATCH_JAVADOC_ARG.matcher(lines[line]); final Matcher multiline = MATCH_JAVADOC_ARG_MULTILINE_START.matcher(lines[line]); if (docmatcher.find()) { final int col = calculateTagColumn( docmatcher, line, start ); tags.add( new JavadocTag( current, col, docmatcher.group(1), docmatcher.group(2) ) ); } else if (multiline.find()) { final int col = calculateTagColumn( multiline, line, start ); tags.addAll( getMultilineArgTags( multiline, col, lines, line, current ) ); } } return tags; }
Source:
public void init() { Assert.notNull(serverUriResolver, "serverUriResolver must be configured."); Assert.notNull(callbackUri, "callbackUri must be configured."); Assert.notNull(idSiteOrganizationResolver, "idSiteOrganizationResolver must be configured."); Assert.notNull(alreadyLoggedInUri, "alreadyLoggedInUri must be configured."); Assert.isTrue(!(preRegisterHandler != null && preLoginHandler != null), "This IDSite controller must contain only one of preRegisterHandler and preLoginHandler"); }

Target:
public void init() { Assert.notNull(serverUriResolver, "serverUriResolver must be configured."); Assert.notNull(callbackUri, "callbackUri must be configured."); Assert.notNull(idSiteOrganizationResolver, "idSiteOrganizationResolver must be configured."); Assert.notNull(alreadyLoggedInUri, "alreadyLoggedInUri must be configured."); }
Source:
public String get() { String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); if (localConfDir == null) { return null; } File extConfDir = new File(localConfDir, PLUGIN_CONF); if (!extConfDir.isDirectory()) { if (extConfDir.exists()) { LOG.warn("{} set to the but it must be directory not file", CheBootstrap.CHE_LOCAL_CONF_DIR, extConfDir); } return null; } if (volumeOptions == null) { volumeOptions="ro,Z"; } if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path plgConfDir = cheHome.resolve(PLUGIN_CONF); IoUtil.copy(extConfDir, plgConfDir.toFile(), null, true); return plgConfDir.toString() + CONTAINER_TARGET + ":" + volumeOptions; } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return extConfDir.getAbsolutePath() + CONTAINER_TARGET + ":" + volumeOptions; } }

Target:
public String get() { String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); if (localConfDir == null) { return null; } File extConfDir = new File(localConfDir, PLUGIN_CONF); if (!extConfDir.isDirectory()) { if (extConfDir.exists()) { LOG.warn("{} set to the but it must be directory not file", CheBootstrap.CHE_LOCAL_CONF_DIR, extConfDir); } return null; } if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path plgConfDir = cheHome.resolve(PLUGIN_CONF); IoUtil.copy(extConfDir, plgConfDir.toFile(), null, true); return getTargetOptions(plgConfDir.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(extConfDir.getAbsolutePath()); } }
Source:
public void pulse() { super.pulse(); if (getTicksLived() >= ticksToLive) { remove(); } if (getTicksLived() == 1) { location.getWorld().playSound(location, Sound.AMBIENCE_THUNDER, 10000, 0.8F + random.nextFloat() * 0.2F); location.getWorld().playSound(location, Sound.EXPLODE, 2, 0.5F + random.nextFloat() * 0.2F); if (effect) { return; } else { for (LivingEntity livingEntity : location.getWorld().getLivingEntities()) { if (location.distanceSquared(livingEntity.getLocation()) <= distanceToDamage) { int damage = 5; livingEntity.damage(damage, this, EntityDamageEvent.DamageCause.LIGHTNING); } if (location.distanceSquared(livingEntity.getLocation()) <= distanceToIgnition) { livingEntity.setFireTicks(burnTicks); } } } } }

Target:
public void pulse() { super.pulse(); if (getTicksLived() >= ticksToLive) { remove(); } if (getTicksLived() == 1) { location.getWorld().playSound(location, Sound.AMBIENCE_THUNDER, 10000, 0.8F + random.nextFloat() * 0.2F); location.getWorld().playSound(location, Sound.EXPLODE, 2, 0.5F + random.nextFloat() * 0.2F); if (effect) { return; } else { for (LivingEntity livingEntity : location.getWorld().getLivingEntities()) { if (location.distanceSquared(livingEntity.getLocation()) <= distanceToDamageSquared) { int damage = 5; livingEntity.damage(damage, this, EntityDamageEvent.DamageCause.LIGHTNING); } if (location.distanceSquared(livingEntity.getLocation()) <= distanceToIgnitionSquared) { livingEntity.setFireTicks(burnTicks); } } } } }
Source:
public ITmfStateInterval getAggregatedState(long timestamp) { List<ITmfStateInterval> potentialIntervals = getQuarkStream() .map(quark -> { try { return getStateSystem().querySingleState(timestamp, quark.intValue()); } catch (AttributeNotFoundException | StateSystemDisposedException e) { throw new IllegalStateException("Bad aggregation rule"); } }) .collect(Collectors.toList()); for (ITmfStateInterval interval : potentialIntervals) { if (!interval.getStateValue().isNull()) { return interval; } } return potentialIntervals.get(0); }

Target:
public ITmfStateInterval getAggregatedState(long timestamp) { ITmfStateSystemBuilder ss = getStateSystem(); List<Integer> quarks = getQuarkStream().collect(Collectors.toList()); List<ITmfStateInterval> intervalsToUse = new ArrayList<>(); ITmfStateValue value = TmfStateValue.nullValue(); try { for (Integer quark : quarks) { ITmfStateInterval interval = ss.querySingleState(timestamp, quark); intervalsToUse.add(interval); ITmfStateValue sv = interval.getStateValue(); if (!sv.isNull()) { value = sv; break; } } long start = intervalsToUse.stream() .mapToLong(ITmfStateInterval::getStartTime) .max().orElse(ss.getStartTime()); long end = intervalsToUse.stream() .mapToLong(ITmfStateInterval::getEndTime) .min().orElse(ss.getCurrentEndTime()); return new TmfStateInterval(start, end, getTargetQuark(), value); } catch (AttributeNotFoundException | StateSystemDisposedException e) { throw new IllegalStateException("Bad aggregation rule"); } }
Source:
static void saveUniqueOutcomeNotifications(JSONArray notificationIds, String outcomeName, OneSignalDbHelper dbHelper) { if (notificationIds == null) return; synchronized (lock) { SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); try { for (int i = 0; i < notificationIds.length(); i++) { ContentValues values = new ContentValues(); String notificationId = notificationIds.getString(i); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NOTIFICATION_ID, notificationId); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NAME, outcomeName); writableDb.insert(CachedUniqueOutcomeNotificationTable.TABLE_NAME, null, values); } } catch (JSONException e) { e.printStackTrace(); } writableDb.close(); } }

Target:
synchronized static void saveUniqueOutcomeNotifications(JSONArray notificationIds, String outcomeName, OneSignalDbHelper dbHelper) { if (notificationIds == null) return; SQLiteDatabase writableDb = dbHelper.getWritableDbWithRetries(); try { for (int i = 0; i < notificationIds.length(); i++) { ContentValues values = new ContentValues(); String notificationId = notificationIds.getString(i); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NOTIFICATION_ID, notificationId); values.put(CachedUniqueOutcomeNotificationTable.COLUMN_NAME_NAME, outcomeName); writableDb.insert(CachedUniqueOutcomeNotificationTable.TABLE_NAME, null, values); } } catch (JSONException e) { e.printStackTrace(); } writableDb.close(); }
Source:
public Response add(Storage storage) { validateParameters(storage, "address", "type", "host.id|name"); StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = getHostId(storage.getHost()); switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "iqn", "port"); break; case NFS: case LOCALFS: validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }

Target:
public Response add(Storage storage) { validateParameters(storage, "address", "type"); StorageServerConnections storageConnection = getMapper(Storage.class, StorageServerConnections.class).map(storage, null); Guid hostId = Guid.Empty; if (storage.getHost() != null) { hostId = getHostId(storage.getHost()); } switch (storageConnection.getstorage_type()) { case ISCSI: validateParameters(storage, "target", "port"); break; case NFS: case LOCALFS: validateParameters(storage, "path"); break; case POSIXFS: case GLUSTERFS: validateParameters(storage, "path", "vfsType"); break; default: break; } return performCreate(VdcActionType.AddStorageServerConnection, getAddParams(storageConnection, hostId), ENTITY_RETRIEVER); }
Source:
public void empty_list_should_not_diff_with_empty_table() { try { List<List<String>> emptyList = new ArrayList<List<String>>(); DataTable emptyTable = DataTable.create(Collections.emptyList()); emptyTable.diff(emptyList); } catch (IndexOutOfBoundsException e) { String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }

Target:
public void empty_list_should_not_diff_with_empty_table() { List<List<String>> emptyList = new ArrayList<List<String>>(); DataTable emptyTable = DataTable.create(Collections.emptyList()); assertEquals(emptyTable.raw(), emptyList); }
Source:
public static CuratorFramework newCurator(Map conf, List<String> servers, Object port, String root, ZookeeperAuthInfo auth) { List<String> serverPorts = new ArrayList<String>(); for(String zkServer: (List<String>) servers) { serverPorts.add(zkServer + ":" + Utils.getInt(port)); } String zkStr = StringUtils.join(serverPorts, ",") + root; try { CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(zkStr) .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT))) .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT))) .retryPolicy(new ExponentialBackoffRetry(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)))); if(auth!=null && auth.scheme!=null) { builder = builder.authorization(auth.scheme, auth.payload); } return builder.build(); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public static CuratorFramework newCurator(Map conf, List<String> servers, Object port, String root, ZookeeperAuthInfo auth) { List<String> serverPorts = new ArrayList<String>(); for(String zkServer: (List<String>) servers) { serverPorts.add(zkServer + ":" + Utils.getInt(port)); } String zkStr = StringUtils.join(serverPorts, ",") + root; try { CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder() .connectString(zkStr) .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT))) .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT))) .retryPolicy(new BoundedExponentialBackoffRetry( Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES)), Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING)))); if(auth!=null && auth.scheme!=null) { builder = builder.authorization(auth.scheme, auth.payload); } return builder.build(); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
private void setAzureCloudIdentityMapping(SdxCluster sdxCluster, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) { String stackCrn = sdxCluster.getStackCrn(); LOGGER.info("Updating azure cloud id mappings for datalake stack crn = {}", stackCrn); try { clouderaManagerRangerUtil.setAzureCloudIdentityMapping(stackCrn, azureUserMapping, azureGroupMapping); } catch (ApiException e) { throw new RangerCloudIdentitySyncException("Encountered api exception", e); } }

Target:
private void setAzureCloudIdentityMapping(SdxCluster sdxCluster, Map<String, String> azureUserMapping, Map<String, String> azureGroupMapping) { String stackCrn = sdxCluster.getStackCrn(); LOGGER.info("Updating azure cloud id mappings for datalake stack crn = {}", stackCrn); try { clouderaManagerRangerUtil.setAzureCloudIdentityMapping(stackCrn, azureUserMapping, azureGroupMapping); } catch (ApiException e) { LOGGER.error("Encountered api exception", e); throw new RangerCloudIdentitySyncException("Encountered api exception", e); } }
Source:
void initializeRangeForQuery( StringSchemaKey treeKeyFrom, StringSchemaKey treeKeyTo, IndexQuery[] predicates ) { IndexQuery predicate = predicates[0]; switch ( predicate.type() ) { case exists: treeKeyFrom.initAsLowest(); treeKeyTo.initAsHighest(); break; case exact: ExactPredicate exactPredicate = (ExactPredicate) predicate; treeKeyFrom.from( Long.MIN_VALUE, exactPredicate.value() ); treeKeyTo.bytes = treeKeyFrom.bytes; treeKeyTo.setEntityIdIsSpecialTieBreaker( false ); treeKeyTo.setEntityId( Long.MAX_VALUE ); break; case rangeString: StringRangePredicate rangePredicate = (StringRangePredicate)predicate; initFromForRange( rangePredicate, treeKeyFrom ); initToForRange( rangePredicate, treeKeyTo ); break; default: throw new IllegalArgumentException( "IndexQuery of type " + predicate.type() + " is not supported." ); } }

Target:
void initializeRangeForQuery( StringSchemaKey treeKeyFrom, StringSchemaKey treeKeyTo, IndexQuery[] predicates ) { IndexQuery predicate = predicates[0]; switch ( predicate.type() ) { case exists: treeKeyFrom.initAsLowest(); treeKeyTo.initAsHighest(); break; case exact: ExactPredicate exactPredicate = (ExactPredicate) predicate; treeKeyFrom.from( Long.MIN_VALUE, exactPredicate.value() ); treeKeyTo.from( Long.MAX_VALUE, exactPredicate.value() ); break; case rangeString: StringRangePredicate rangePredicate = (StringRangePredicate)predicate; initFromForRange( rangePredicate, treeKeyFrom ); initToForRange( rangePredicate, treeKeyTo ); break; default: throw new IllegalArgumentException( "IndexQuery of type " + predicate.type() + " is not supported." ); } }
Source:
default AdminClient getAdminClient(final Map<String, Object> config) { throw new UnsupportedOperationException("Direct use of this method is deprecated. " + "Implementations of KafkaClientSupplier should implement the getAdmin method instead. " + "The method will be removed in a future release."); }

Target:
default AdminClient getAdminClient(final Map<String, Object> config) { throw new UnsupportedOperationException("Direct use of this method is deprecated. " + "Implementations of KafkaClientSupplier should implement the getAdmin() method instead. " + "The method will be removed in a future release."); }
Source:
default KeyValueFilterConverter getFilterConverter() { return getFilterConverter(null); }

Target:
default KeyValueFilterConverter<K, V, C> getFilterConverter() { return getFilterConverter(null); }
Source:
public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { @SuppressWarnings( "unchecked" ) String dbName = (String) input[0]; List<Endpoint> routers = routeEndpoints( dbName ); long ttl = config.get( CausalClusteringSettings.cluster_routing_ttl ).toMillis(); HashMap<String,List<Endpoint>> routerMap = new HashMap<>(); routerMap.put( dbName, routers ); MultiClusterRoutingResult result = new MultiClusterRoutingResult( routerMap, ttl ); return RawIterator.<Object[], ProcedureException>of( MultiClusterRoutingResultFormat.build( result ) ); }

Target:
public RawIterator<Object[],ProcedureException> apply( Context ctx, Object[] input, ResourceTracker resourceTracker ) throws ProcedureException { @SuppressWarnings( "unchecked" ) String dbName = (String) input[0]; List<Endpoint> routers = routeEndpoints( dbName ); HashMap<String,List<Endpoint>> routerMap = new HashMap<>(); routerMap.put( dbName, routers ); MultiClusterRoutingResult result = new MultiClusterRoutingResult( routerMap, timeToLiveMillis ); return RawIterator.<Object[], ProcedureException>of( MultiClusterRoutingResultFormat.build( result ) ); }
Source:
private static void testSymbolAPI(RecordMetadata metadata, RecordCursor cursor) { IntList symbolIndexes = null; for (int i = 0, n = metadata.getColumnCount(); i < n; i++) { if (metadata.getColumnType(i) == ColumnType.SYMBOL) { if (symbolIndexes == null) { symbolIndexes = new IntList(); } symbolIndexes.add(i); } } if (symbolIndexes != null) { cursor.toTop(); final Record record = cursor.getRecord(); while (cursor.hasNext()) { for (int i = 0, n = symbolIndexes.size(); i < n; i++) { int column = symbolIndexes.getQuick(i); SymbolTable symbolTable = cursor.getSymbolTable(column); if (symbolTable instanceof StaticSymbolTable) { CharSequence sym = record.getSym(column); int value = record.getInt(column); if (symbolTable instanceof SymbolMapReader && ((SymbolMapReader) symbolTable).containsNullValue() && value == ((StaticSymbolTable) symbolTable).size()) { Assert.assertEquals(Integer.MIN_VALUE, ((SymbolMapReader) symbolTable).keyOf(sym)); } else { Assert.assertEquals(value, ((StaticSymbolTable) symbolTable).keyOf(sym)); } TestUtils.assertEquals(sym, symbolTable.valueOf(value)); } else { final int value = record.getInt(column); TestUtils.assertEquals(record.getSym(column), symbolTable.valueOf(value)); } } } } }

Target:
private static void testSymbolAPI(RecordMetadata metadata, RecordCursor cursor) { IntList symbolIndexes = null; for (int i = 0, n = metadata.getColumnCount(); i < n; i++) { if (metadata.getColumnType(i) == ColumnType.SYMBOL) { if (symbolIndexes == null) { symbolIndexes = new IntList(); } symbolIndexes.add(i); } } if (symbolIndexes != null) { cursor.toTop(); final Record record = cursor.getRecord(); while (cursor.hasNext()) { for (int i = 0, n = symbolIndexes.size(); i < n; i++) { int column = symbolIndexes.getQuick(i); SymbolTable symbolTable = cursor.getSymbolTable(column); if (symbolTable instanceof StaticSymbolTable) { CharSequence sym = record.getSym(column); int value = record.getInt(column); if (((StaticSymbolTable) symbolTable).containsNullValue() && value == ((StaticSymbolTable) symbolTable).size()) { Assert.assertEquals(Integer.MIN_VALUE, ((StaticSymbolTable) symbolTable).keyOf(sym)); } else { Assert.assertEquals(value, ((StaticSymbolTable) symbolTable).keyOf(sym)); } TestUtils.assertEquals(sym, symbolTable.valueOf(value)); } else { final int value = record.getInt(column); TestUtils.assertEquals(record.getSym(column), symbolTable.valueOf(value)); } } } } }
Source:
public void store(IFrontendActionAsyncCallback callback) { if (getProgress() != null || !validate()) { return; } ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> paramerterList = new ArrayList<VdcActionParametersBase>(); ArrayList<IFrontendActionAsyncCallback> callbacks = new ArrayList<IFrontendActionAsyncCallback>(); IFrontendActionAsyncCallback onFinishCallback = callback != null ? callback : new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { NewDiskModel diskModel = (NewDiskModel) result.getState(); diskModel.stopProgress(); diskModel.cancel(); } }; List<EntityModel<DiskModel>> disksToAttach = getSelectedDisks(); for (int i = 0; i < disksToAttach.size(); i++) { DiskModel disk = disksToAttach.get(i).getEntity(); boolean activate = false; if (getIsPlugged().getEntity()) { if (disk.getDisk().getDiskInterface() == DiskInterface.IDE) { activate = getVm().getStatus() == VMStatus.Down; } else { activate = true; } } AttachDetachVmDiskParameters parameters = new AttachDetachVmDiskParameters( getVm().getId(), disk.getDisk().getId(), activate, Boolean.TRUE.equals(disk.getDisk().getReadOnly())); actionTypes.add(VdcActionType.AttachDiskToVm); paramerterList.add(parameters); callbacks.add(i == disksToAttach.size() - 1 ? onFinishCallback : null); } startProgress(null); Frontend.getInstance().runMultipleActions(actionTypes, paramerterList, callbacks, null, this); }

Target:
public void store(IFrontendActionAsyncCallback callback) { if (getProgress() != null || !validate()) { return; } ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> paramerterList = new ArrayList<VdcActionParametersBase>(); ArrayList<IFrontendActionAsyncCallback> callbacks = new ArrayList<IFrontendActionAsyncCallback>(); IFrontendActionAsyncCallback onFinishCallback = callback != null ? callback : new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { NewDiskModel diskModel = (NewDiskModel) result.getState(); diskModel.stopProgress(); diskModel.cancel(); } }; List<EntityModel<DiskModel>> disksToAttach = getSelectedDisks(); for (int i = 0; i < disksToAttach.size(); i++) { DiskModel disk = disksToAttach.get(i).getEntity(); boolean activate = false; if (getIsPlugged().getEntity()) { activate = disk.getDisk().getDiskInterface() == DiskInterface.IDE ? getVm().getStatus() == VMStatus.Down : true; } AttachDetachVmDiskParameters parameters = new AttachDetachVmDiskParameters( getVm().getId(), disk.getDisk().getId(), activate, Boolean.TRUE.equals(disk.getDisk().getReadOnly())); actionTypes.add(VdcActionType.AttachDiskToVm); paramerterList.add(parameters); callbacks.add(i == disksToAttach.size() - 1 ? onFinishCallback : null); } startProgress(null); Frontend.getInstance().runMultipleActions(actionTypes, paramerterList, callbacks, null, this); }
Source:
public void testStatusWhenInitializing() throws Exception { TestContext testContext = createTestContext(Dispatcher.ExecutionType.SUBMISSION); DispatcherJob dispatcherJob = testContext.getDispatcherJob(); Assert.assertThat(dispatcherJob.isInitialized(), is(false)); Assert.assertThat(dispatcherJob.getResultFuture().isDone(), is(false)); assertJobStatus(dispatcherJob, JobStatus.INITIALIZING); }

Target:
public void testStatusWhenInitializing() throws Exception { TestContext testContext = createTestContext(); DispatcherJob dispatcherJob = testContext.getDispatcherJob(); assertThat(dispatcherJob.isInitialized(), is(false)); assertThat(dispatcherJob.getResultFuture().isDone(), is(false)); assertJobStatus(dispatcherJob, JobStatus.INITIALIZING); }
Source:
private String generateJSON(boolean preserveReports) { ConcurrentLinkedQueue<MLSJSONObject> jsonCollector = new ConcurrentLinkedQueue<MLSJSONObject>(); MLSJSONObject report = null; final String kPrefix = "{\"items\":["; StringBuilder reportString = new StringBuilder(kPrefix); report = reportList.poll(); if (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append(report.toString()); } report = reportList.poll(); while (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append("," + report.toString()); report = reportList.poll(); } if (preserveReports) { report = jsonCollector.poll(); while (report != null) { reportList.add(report); report = jsonCollector.poll(); } } return reportString.toString() + "]}"; }

Target:
private String generateJSON(boolean preserveReports) { ConcurrentLinkedQueue<MLSJSONObject> jsonCollector = new ConcurrentLinkedQueue<MLSJSONObject>(); MLSJSONObject report = null; final String kPrefix = "{\"items\":["; StringBuilder reportString = new StringBuilder(kPrefix); String jsonSep = ""; report = mReportList.poll(); while (report != null) { if (preserveReports) { jsonCollector.add(report); } reportString.append(jsonSep + report.toString()); report = mReportList.poll(); jsonSep = ","; } if (preserveReports) { report = jsonCollector.poll(); while (report != null) { mReportList.add(report); report = jsonCollector.poll(); } } return reportString.toString() + "]}"; }
Source:
public void shouldCreateTransactionalDatabaseTemplate_withDatabaseTemplate() { final DatabaseTemplate dynamoDbTemplate = mock(DatabaseTemplate.class); final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( dynamoDbTemplate); assertNotNull(transactionalDatabaseTemplate); }

Target:
public void shouldCreateTransactionalDatabaseTemplate_withDatabaseTemplate() { final DatabaseTemplate databaseTemplate = mock(DatabaseTemplate.class); final TransactionalDatabaseTemplate transactionalDatabaseTemplate = new TransactionalDatabaseTemplate( databaseTemplate); assertNotNull(transactionalDatabaseTemplate); }
Source:
private TerrainFacing determineFacing() { Terrain terrain = getTerrain(); TerrainFacingDeterminer facingDeterminer = new TerrainFacingDeterminer(); facingDeterminer.setTopSame(terrain.isSame(topTerrain())); facingDeterminer.setRightSame(terrain.isSame(rightTerrain())); facingDeterminer.setBottomSame(terrain.isSame(bottomTerrain())); facingDeterminer.setLeftSame(terrain.isSame(leftTerrain())); return facingDeterminer.getFacing(); }

Target:
private TerrainFacing determineFacing() { Terrain terrain = getTerrain(); return TerrainFacingDeterminer.getFacing( terrain.isSame(topTerrain()), terrain.isSame(rightTerrain()), terrain.isSame(bottomTerrain()), terrain.isSame(leftTerrain()) ); }
Source:
public Transform hydrateTransform( ChainrEntry entry ) { final Class<? extends Transform> transformClass = entry.getTransformClass(); final Object transformSpec = entry.getSpec(); if ( entry.isSpecDriven() ) { Injector injector; try { injector = Guice.createInjector( new AbstractModule() { @Override protected void configure() { install( parentModule ); bind( Object.class ).toInstance( transformSpec ); } } ); } catch ( CreationException creationException ) { throw new SpecException( "Exception using Guice to initialize class:" + transformClass.getCanonicalName(), creationException ); } return injector.getInstance( transformClass ); } else { return nonSpecInjector.getInstance( transformClass ); } }

Target:
public Transform hydrateTransform( ChainrEntry entry ) { final Class<? extends Transform> transformClass = entry.getTransformClass(); final Object transformSpec = entry.getSpec(); try { if ( entry.isSpecDriven() ) { Injector injector; injector = Guice.createInjector( new AbstractModule() { @Override protected void configure() { install( parentModule ); bind( Object.class ).toInstance( transformSpec ); } } ); return injector.getInstance( transformClass ); } else { return nonSpecInjector.getInstance( transformClass ); } } catch ( Exception creationException ) { throw new SpecException( "Exception using Guice to initialize class:" + transformClass.getCanonicalName(), creationException ); } }
Source:
public void munge(String entityId, Collection<Statement> statements, Collection<String> existingValues, Collection<String> existingRefs) throws ContainedException { if(existingValues == null) { existingValues = new HashSet<String>(); } if(existingRefs == null) { existingRefs = new HashSet<String>(); } if (statements.isEmpty()) { return; } MungeOperation op = new MungeOperation(entityId, statements, existingValues, existingRefs); op.munge(); existingValues.removeAll(op.extraValidSubjects); existingRefs.removeAll(op.extraValidSubjects); return; }

Target:
public void munge(String entityId, Collection<Statement> statements, Collection<String> existingValues, Collection<String> existingRefs) throws ContainedException { if (statements.isEmpty()) { return; } MungeOperation op = new MungeOperation(entityId, statements, existingValues, existingRefs); op.munge(); existingValues.removeAll(op.extraValidSubjects); existingRefs.removeAll(op.extraValidSubjects); return; }
Source:
public void testImportPackageCanContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); Map<String, String> headers = new HashMap<String, String>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.IMPORT_PACKAGE, JAVA_LANG); config.mkdirs(); File bundle = SystemBundleTests.createBundle(config, getName(), headers); Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); Dictionary<String, String> testHeaders = testBundle.getHeaders(); assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); } catch (BundleException e) { fail("Failed to test Import-Package header"); } finally { try { equinox.stop(); equinox.waitForStop(10000); } catch (Exception e) { } } }

Target:
public void testImportPackageCanContainJavaPackages() throws Exception { File config = OSGiTestsActivator.getContext().getDataFile(getName()); Map<String, String> headers = new HashMap<String, String>(); headers.put(Constants.BUNDLE_MANIFESTVERSION, "2"); headers.put(Constants.BUNDLE_SYMBOLICNAME, getName()); headers.put(Constants.IMPORT_PACKAGE, JAVA_LANG); config.mkdirs(); File bundle = SystemBundleTests.createBundle(config, getName(), headers); Equinox equinox = new Equinox(Collections.singletonMap(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath())); try { equinox.start(); BundleContext systemContext = equinox.getBundleContext(); Bundle testBundle = systemContext.installBundle(bundle.toURI().toString()); testBundle.start(); Dictionary<String, String> testHeaders = testBundle.getHeaders(); assertTrue(Constants.IMPORT_PACKAGE + " does not contain the java.* package", testHeaders.get(Constants.IMPORT_PACKAGE).contains(JAVA_LANG)); List<BundleWire> pkgWires = testBundle.adapt(BundleWiring.class).getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE); assertEquals("Wrong number of package requiremens: ", 1, pkgWires.size()); assertEquals("Wrong package found: " + pkgWires.get(0), JAVA_LANG, pkgWires.get(0).getCapability().getAttributes().get(PackageNamespace.PACKAGE_NAMESPACE)); } catch (BundleException e) { fail("Failed to test Import-Package header"); } finally { try { equinox.stop(); equinox.waitForStop(10000); } catch (Exception e) { } } }
Source:
public boolean canFlipToNextPage() { boolean canFlip = true; IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (canFlip != false) { for (IProject iproject : projects) { if (this.getProjectName().equalsIgnoreCase(iproject.getName())) { canFlip = false; this.setErrorMessage("There already is a project with this name: " + iproject.getName()); break; } } } if (!validatePage()) { canFlip = false; } return canFlip; }

Target:
public boolean canFlipToNextPage() { boolean canFlip = true; final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); if (canFlip) { for (IProject iproject : projects) { if (this.getProjectName().equalsIgnoreCase(iproject.getName())) { canFlip = false; this.setErrorMessage("There already is a project with this name: " + iproject.getName()); break; } } } if (!validatePage()) { canFlip = false; } return canFlip; }
Source:
public static StackTraceResponse create(final int startFrame, final int levels, final Suspension suspension, final int requestId) { ArrayList<DebugStackFrame> frames = suspension.getStackFrames(); int skipFrames = 0; if (suspension.isHaltPrimitive()) { skipFrames = Suspension.FRAMES_SKIPPED_FOR_HALT; } else if (suspension.isSuspendExecutionNode()) { skipFrames = suspension.skipFrames(); } if (startFrame > skipFrames) { skipFrames = startFrame; } int numFrames = levels; if (numFrames == 0) { numFrames = Integer.MAX_VALUE; } numFrames = Math.min(frames.size(), numFrames); numFrames -= skipFrames; StackFrame[] arr = new StackFrame[numFrames]; for (int i = 0; i < numFrames; i += 1) { int frameId = i + skipFrames; StackFrame f = createFrame(suspension, frameId, frames.get(frameId)); arr[i] = f; } return new StackTraceResponse(suspension.activityId, arr, frames.size(), requestId); }

Target:
public static StackTraceResponse create(final int startFrame, final int levels, final Suspension suspension, final int requestId) { ArrayList<DebugStackFrame> frames = suspension.getStackFrames(); int skipFrames = suspension.getFrameSkipCount(); if (startFrame > skipFrames) { skipFrames = startFrame; } int numFrames = levels; if (numFrames == 0) { numFrames = Integer.MAX_VALUE; } numFrames = Math.min(frames.size(), numFrames); numFrames -= skipFrames; StackFrame[] arr = new StackFrame[numFrames]; for (int i = 0; i < numFrames; i += 1) { int frameId = i + skipFrames; StackFrame f = createFrame(suspension, frameId, frames.get(frameId)); arr[i] = f; } return new StackTraceResponse(suspension.activityId, arr, frames.size(), requestId); }