auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected String usage() { final StringBuilder usage = new StringBuilder(); usage.append("Available commands"); if (!getName().isEmpty()) { usage.append(" of "); usage.append(getName()); } usage.append(" are:\n"); usage.append("\n"); int maxLength = -1; for (String name : commands.keySet()) { maxLength = Math.max(maxLength, name.length()); } String format = "%-" + maxLength + "s %s"; for (String name : Sets.newTreeSet(commands.keySet())) { final Command cmd = commands.get(name).get(); usage.append(" "); if (cmd instanceof BaseCommand) { BaseCommand bc = (BaseCommand)cmd; String descr = bc.getDescription(); if (name.equals("plugin")) { descr = "Install, reload, remove and list plugins"; } usage.append(String.format(format, name, descr)); } else { usage.append(name); } usage.append("\n"); } usage.append("\n"); usage.append("See '"); if (getName().indexOf(' ') < 0) { usage.append(getName()); usage.append(' '); } usage.append("COMMAND --help' for more information.\n"); usage.append("\n"); return usage.toString(); }

Target:
protected String usage() { final StringBuilder usage = new StringBuilder(); usage.append("Available commands"); if (!getName().isEmpty()) { usage.append(" of "); usage.append(getName()); } usage.append(" are:\n"); usage.append("\n"); int maxLength = -1; for (String name : commands.keySet()) { maxLength = Math.max(maxLength, name.length()); } String format = "%-" + maxLength + "s %s"; for (String name : Sets.newTreeSet(commands.keySet())) { final Command cmd = commands.get(name).get(); usage.append(" "); if (cmd instanceof BaseCommand) { BaseCommand bc = (BaseCommand)cmd; usage.append(String.format(format, name, bc.getDescription())); } else { usage.append(name); } usage.append("\n"); } usage.append("\n"); usage.append("See '"); if (getName().indexOf(' ') < 0) { usage.append(getName()); usage.append(' '); } usage.append("COMMAND --help' for more information.\n"); usage.append("\n"); return usage.toString(); }
Source:
public void evalGroups(final MutableTupleBuffer state, final int col) throws DbException { IntIterator iter = buffer.keySet().intIterator(); while (iter.hasNext()) { int key = iter.next(); pyWorker.sendNumTuples(buffer.get(key).numTuples()); for (TupleBatch tb : buffer.get(key).getAll()) { for (int tup = 0; tup < tb.numTuples(); tup++) { for (int i = 0; i < tb.numColumns(); ++i) { writeToStream(tb, tup, i); } } } ColumnBuilder<?> output = ColumnFactory.allocateColumn(outputType); readFromStream(null, output); if (output.size() > 1) { throw new RuntimeException("PythonUDFEvaluator cannot be multivalued for Aggregate"); } for (int i = 0; i < output.size(); ++i) { state.replace(col, key, output, i); } } }

Target:
public void evalGroups(final MutableTupleBuffer state, final int col) throws DbException { IntIterator keyIter = groups.keySet().intIterator(); while (keyIter.hasNext()) { int key = keyIter.next(); pyWorker.sendNumTuples(groups.get(key).size()); IntIterator rowIter = groups.get(key).intIterator(); while (rowIter.hasNext()) { int row = rowIter.next(); for (int i = 0; i < buffer.numColumns(); ++i) { writeToStream(buffer, row, i); } } ColumnBuilder<?> output = ColumnFactory.allocateColumn(outputType); readFromStream(null, output); if (output.size() > 1) { throw new RuntimeException("PythonUDFEvaluator cannot be multivalued for Aggregate"); } for (int i = 0; i < output.size(); ++i) { state.replace(col, key, output, i); } } }
Source:
private void addOrUpdateSnapshotsConfig(Guid clusterId, GlusterSnapshotConfigInfo configInfo) { try (EngineLock lock = acquireEntityLock(clusterId)) { addOrUpdateClusterConfig(clusterId, "snap-max-hard-limit", configInfo.getSystemSnapMaxHardLimit() .toString()); addOrUpdateClusterConfig(clusterId, "snap-max-soft-limit", configInfo.getSystemSoftLimitPcnt()); addOrUpdateClusterConfig(clusterId, "auto-delete", configInfo.isAutoDeleteEnabled() ? "enable" : "disable"); } List<GlusterSnapshotConfigInfo.VolumeSnapshotConfigInfo> volumeConfigs = configInfo.getVolumeConfigList(); for (GlusterSnapshotConfigInfo.VolumeSnapshotConfigInfo volumeConfig : volumeConfigs) { GlusterVolumeEntity volume = getGlusterVolumeDao().getByName(clusterId, volumeConfig.getVolumeName()); try (EngineLock lock = acquireEntityLock(volume.getId())) { addOrUpdateVolumeConfig(clusterId, volume.getId(), "snap-max-hard-limit", volumeConfig.getVolumeSnapMaxHardLimit().toString()); } } }

Target:
private void addOrUpdateSnapshotsConfig(Guid clusterId, GlusterSnapshotConfigInfo configInfo) { try (EngineLock lock = acquireEntityLock(clusterId)) { for (String key : configInfo.getClusterConfigOptions().keySet()) { String value = configInfo.getClusterConfigOptions().get(key); if (value != null) { addOrUpdateClusterConfig(clusterId, key, value); } } } Map<String, Map<String, String>> volumeConfigs = configInfo.getVolumeConfigOptions(); for (String key : volumeConfigs.keySet()) { GlusterVolumeEntity volume = getGlusterVolumeDao().getByName(clusterId, key); try (EngineLock lock = acquireEntityLock(volume.getId())) { Map<String, String> volumeConfig = volumeConfigs.get(key); if (volumeConfig != null) { for (String configKey : volumeConfig.keySet()) { String value = volumeConfig.get(configKey); if (value != null) { addOrUpdateVolumeConfig(clusterId, volume.getId(), configKey, value); } } } } } }
Source:
public Collection<SlotKey> getChildrenKeys(Granularity destGranularity) { if (!getGranularity().isCoarser(destGranularity)) { throw new IllegalArgumentException("Current granularity must be coarser than the destination granularity"); } List<SlotKey> result = new ArrayList<SlotKey>(); for(SlotKey slotKey: this.getChildrenKeys()) { if (slotKey.getGranularity().equals(destGranularity)) { result.add(slotKey); } } return Collections.unmodifiableList(result); }

Target:
public Collection<SlotKey> getChildrenKeys(Granularity destGranularity) { if (!getGranularity().isCoarser(destGranularity)) { throw new IllegalArgumentException(String.format("Current granularity [%s] must be coarser than the destination granularity [%s]", getGranularity(), destGranularity)); } List<SlotKey> result = new ArrayList<SlotKey>(); for(SlotKey slotKey: this.getChildrenKeys()) { if (slotKey.getGranularity().equals(destGranularity)) { result.add(slotKey); } } return Collections.unmodifiableList(result); }
Source:
public GridTableViewerComposite build() { final GridTableViewerComposite viewerComposite = new GridTableViewerComposite(getComposite(), getSwtStyleBits(), getInput(), getCustomization(), getTitle(), getTooltip()); TableConfigurationUtil.setTableConfiguration(viewerComposite, getCustomization().getTableConfiguration()); return viewerComposite; }

Target:
public GridTableViewerComposite build() { return new GridTableViewerComposite(getComposite(), getSwtStyleBits(), getInput(), getCustomization(), getTitle(), getTooltip()); }
Source:
protected <T> T deserialize(byte[] data, Class<T> klass, String path) { try { return objectMapper.readValue(data, klass); } catch (JsonParseException jpe) { try { LOG.error("Invalid Json at path {}: {}", path, new String(data, StandardCharsets.UTF_8), jpe); } catch (Exception e) { LOG.error("Could not parse valid json at path {}", path, e); } throw Throwables.propagate(jpe); } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
protected <T> T deserialize(byte[] data, Class<T> klass, String path) { try { return objectMapper.readValue(data, klass); } catch (JsonParseException jpe) { try { LOG.error("Invalid Json at path {}: {}", path, new String(data, StandardCharsets.UTF_8), jpe); } catch (Exception e) { LOG.error("Could not get raw json string at path {}", path, e); } throw Throwables.propagate(jpe); } catch (IOException e) { throw Throwables.propagate(e); } }
Source:
public void test_Case_ChangesWithoutTasks() throws OseeCoreException, InterruptedException { ensurePopulated(); assert_Tasks_OriginalData(destTeamWf1_Proper); assert_Tasks_OriginalData(destTeamWf2_ChangesWithoutTasks); assert_Tasks_OriginalData(destTeamWf3_TasksWithoutChanges); runCreateTasksOperation(ver2_ChangesWithoutTasks, aia2_ChangesWithoutTasks, changeData_ChangesWithoutTasks); assert_Tasks_OriginalData(destTeamWf1_Proper); assert_Tasks_OriginalData(destTeamWf3_TasksWithoutChanges); cleanupAndReset(); }

Target:
public void test_Case_ChangesWithoutTasks() throws OseeCoreException, InterruptedException { ensurePopulated(); assert_Tasks_OriginalData(destTeamWf1_Proper); assert_Tasks_OriginalData(destTeamWf2_ChangesWithoutTasks); assert_Tasks_OriginalData(destTeamWf3_TasksWithoutChanges); runCreateTasksOperation(ver2_ChangesWithoutTasks, aia2_ChangesWithoutTasks, changeData_ChangesWithoutTasks); assert_Tasks_OriginalData(destTeamWf1_Proper); assert_Tasks_Generated(destTeamWf2_ChangesWithoutTasks); assert_Tasks_OriginalData(destTeamWf3_TasksWithoutChanges); cleanupAndReset(); }
Source:
private boolean doNotReportProblems() { if (fReportingProblemsCurrent) { return fDoNotReportProblems; } fReportingProblemsCurrent = true; fDoNotReportProblems = false; if (AntUIPlugin.getDefault().getCombinedPreferenceStore().getBoolean(AntEditorPreferenceConstants.BUILDFILE_IGNORE_ALL)) { fDoNotReportProblems = true; return fDoNotReportProblems; } String buildFileNames = AntUIPlugin.getDefault().getCombinedPreferenceStore().getString(AntEditorPreferenceConstants.BUILDFILE_NAMES_TO_IGNORE); if (buildFileNames.length() > 0) { String editedFileName = getEditedFile().getName(); for (String string : AntUtil.parseString(buildFileNames, ",")) { if (string.trim().equals(editedFileName)) { fDoNotReportProblems = true; return fDoNotReportProblems; } } } return fDoNotReportProblems; }

Target:
private boolean doNotReportProblems() { if (fReportingProblemsCurrent) { return fDoNotReportProblems; } fReportingProblemsCurrent = true; fDoNotReportProblems = false; if (AntUIPlugin.getDefault().getCombinedPreferenceStore().getBoolean(AntEditorPreferenceConstants.BUILDFILE_IGNORE_ALL)) { fDoNotReportProblems = true; return fDoNotReportProblems; } String buildFileNames = AntUIPlugin.getDefault().getCombinedPreferenceStore().getString(AntEditorPreferenceConstants.BUILDFILE_NAMES_TO_IGNORE); if (buildFileNames.length() > 0) { String editedFileName = getEditedFile().getName(); for (String fileName : AntUtil.parseString(buildFileNames, ",")) { if (fileName.trim().equals(editedFileName)) { fDoNotReportProblems = true; return fDoNotReportProblems; } } } return fDoNotReportProblems; }
Source:
public Image getScaledWebImage(URI sourceUri, double factor) throws IOException { if (!new File(sourceUri).exists()) { throw new FileNotFoundException("sourceUri must exist: " + sourceUri.getRawPath()); } if (Double.isNaN(factor)) { throw new IllegalArgumentException("factor must be a number, but was " + Double.toString(factor)); } if (factor <= 0.0) { throw new IllegalArgumentException("factor must be > 0.0, but was " + Double.toString(factor)); } File tempFile = File.createTempFile("scaledWebImage-", WEB_IMAGE_FORMAT, TMPDIR); try { tempFile.deleteOnExit(); ImageConverter imageConverter = new ImageConverter(sourceUri); imageConverter.addResult(tempFile.toURI()).resize(factor); logger.info("Generating scaled web image from as {}, factor {}%", sourceUri, tempFile, 100 * factor); imageConverter.run(); logger.trace("Loading {}", tempFile); Image buffer = ImageIO.read(tempFile); logger.trace("{} successfully loaded", tempFile); return buffer; } finally { logger.debug("Deleting {}", tempFile); tempFile.delete(); logger.trace("Successfully deleted {}", tempFile); } }

Target:
public Image getScaledWebImage(URI sourceUri, double factor) throws IOException { if (!new File(sourceUri).exists()) { throw new FileNotFoundException("sourceUri must exist: " + sourceUri.getRawPath()); } if (Double.isNaN(factor)) { throw new IllegalArgumentException("factor must be a number, but was " + Double.toString(factor)); } if (factor <= 0.0) { throw new IllegalArgumentException("factor must be > 0.0, but was " + Double.toString(factor)); } return summarize("scaledWebImage-", WEB_IMAGE_FORMAT, sourceUri, λ -> λ.resize(factor), "Generating scaled web image from as {}, factor {}%", 100 * factor); }
Source:
public JSchFileManager(IRemoteConnection connection) { if (connection instanceof JSchConnection) try { ((JSchConnection) connection).getSftpChannel(); } catch (RemoteConnectionException e) { throw new UnsupportedOperationException(Messages.JSchConnection_Remote_host_does_not_support_sftp); } fConnection = connection; }

Target:
private JSchFileManager(IRemoteConnection connection) { fConnection = connection; }
Source:
public SearchData(String text, String title, String content, String wikiType, String wikiOwner, String pageId) { this.text = org.exoplatform.wiki.utils.Utils.escapeIllegalCharacterInQuery(text); this.title = title; this.content = content; this.wikiType = wikiType; this.wikiOwner = Utils.validateWikiOwner(wikiType, wikiOwner); this.pageId = pageId; if (PortalConfig.USER_TYPE.equals(wikiType)) { NodeHierarchyCreator nodeHierachyCreator = (NodeHierarchyCreator) ExoContainerContext.getCurrentContainer() .getComponentInstanceOfType(NodeHierarchyCreator.class); try { if (wikiOwner != null && wikiOwner.length() > 0) { Node userNode = nodeHierachyCreator.getUserApplicationNode(CommonUtils.createSystemProvider(), wikiOwner); USER_PATH = userNode.getPath() + "/" + WikiNodeType.Definition.WIKI_APPLICATION + "/"; } } catch (Exception e) { if (e instanceof PathNotFoundException) throw new NoSuchNodeException(e); else throw new UndeclaredRepositoryException(e.getMessage()); } } }

Target:
public SearchData(String text, String title, String content, String wikiType, String wikiOwner, String pageId) { this.text = Utils.escapeIllegalCharacterInQuery(text); this.title = title; this.content = content; this.wikiType = wikiType; this.wikiOwner = Utils.validateWikiOwner(wikiType, wikiOwner); this.pageId = pageId; if (PortalConfig.USER_TYPE.equals(wikiType)) { NodeHierarchyCreator nodeHierachyCreator = (NodeHierarchyCreator) ExoContainerContext.getCurrentContainer() .getComponentInstanceOfType(NodeHierarchyCreator.class); try { if (wikiOwner != null && wikiOwner.length() > 0) { Node userNode = nodeHierachyCreator.getUserApplicationNode(CommonUtils.createSystemProvider(), wikiOwner); USER_PATH = userNode.getPath() + "/" + WikiNodeType.Definition.WIKI_APPLICATION + "/"; } } catch (Exception e) { if (e instanceof PathNotFoundException) throw new NoSuchNodeException(e); else throw new UndeclaredRepositoryException(e.getMessage()); } } }
Source:
private Object convertValue(Object value, Type type) { if (value == null) { return null; } if (BOOLEAN.equals(type) || Varchars.isVarcharType(type)) { return value; } if (BIGINT.equals(type)) { return ((Number) value).longValue(); } if (INTEGER.equals(type)) { return ((Number) value).intValue(); } if (DOUBLE.equals(type)) { return ((Number) value).doubleValue(); } if (DATE.equals(type)) { return value; } throw new IllegalArgumentException("unhandled type: " + type); }

Target:
private Object convertValue(Object value, Type type) { if (value == null) { return null; } if (BOOLEAN.equals(type) || DATE.equals(type) || Varchars.isVarcharType(type)) { return value; } if (BIGINT.equals(type)) { return ((Number) value).longValue(); } if (INTEGER.equals(type)) { return ((Number) value).intValue(); } if (DOUBLE.equals(type)) { return ((Number) value).doubleValue(); } throw new IllegalArgumentException("Unhandled type: " + type); }
Source:
public void setUp() throws IOException { project = createProject(); ArrayList<UserVariable> allVariables = new ArrayList<>(); sprite1.getUserVariables().addAll(generateUserVariables("S1_Variable:", 3)); allVariables.addAll(sprite1.getUserVariables()); sprite2.getUserVariables().addAll(generateUserVariables("S2_Variable:", 3)); allVariables.addAll(sprite2.getUserVariables()); sprite3.getUserVariables().addAll(generateUserVariables("S3_Variable:", 3)); allVariables.addAll(sprite3.getUserVariables()); project.getUserVariables().addAll(generateUserVariables("S3_Variable:", 3)); allVariables.addAll(project.getUserVariables()); accessor = new DeviceVariableAccessor(directory); HashMap<UUID, Object> map = new HashMap<>(); for (UserVariable userVariable: allVariables) { map.put(userVariable.getDeviceValueKey(), userVariable.getValue()); } accessor.writeMapToJson(map); }

Target:
public void setUp() throws IOException { project = createProject(); ArrayList<UserVariable> allVariables = new ArrayList<>(); sprite1.getUserVariables().add(sprite1UserVariable); allVariables.addAll(sprite1.getUserVariables()); sprite2.getUserVariables().add(sprite2UserVariable); allVariables.addAll(sprite2.getUserVariables()); project.getUserVariables().add(globalUserVariable); allVariables.addAll(project.getUserVariables()); accessor = new DeviceVariableAccessor(directory); HashMap<UUID, Object> map = new HashMap<>(); for (UserVariable userVariable: allVariables) { map.put(userVariable.getDeviceValueKey(), userVariable.getValue()); } accessor.writeMapToJson(map); }
Source:
boolean maybeOverrideCodeGen(Node n) { @Nullable Node parent = n.getParent(); switch (n.getToken()) { case INDEX_SIGNATURE: Node first = n.getFirstChild(); if (null != first) { add("{["); add(first); add(":"); add(first.getDeclaredTypeExpression()); add("]:"); add(n.getDeclaredTypeExpression()); add("}"); } return true; case UNDEFINED_TYPE: add("undefined"); return true; case CAST: add("("); add(n.getFirstChild()); add(" as "); add(n.getDeclaredTypeExpression()); add(")"); return true; case NAME: if (n.getParent().isParamList()) { Visibility visibility = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (visibility != null) { switch (visibility) { case PRIVATE: add("private "); break; case PROTECTED: add("protected "); break; case PUBLIC: add("public "); break; default: break; } } if (n.getBooleanProp(Node.IS_CONSTANT_NAME)) { add("readonly "); } } return false; case ANY_TYPE: String anyTypeName = externsMap.get("any"); if (anyTypeName != null) { add(anyTypeName); return true; } return false; case EXPORT: if (!n.hasOneChild()) { return false; } if (n.getFirstChild().getToken() == Token.TYPE_ALIAS) { add("export"); add(n.getFirstChild()); return true; } return false; case FUNCTION_TYPE: if (parent != null && parent.getToken() == Token.UNION_TYPE && parent.getFirstChild() == n) { add("("); } return false; default: return false; } }

Target:
boolean maybeOverrideCodeGen(Node n) { @Nullable Node parent = n.getParent(); switch (n.getToken()) { case INDEX_SIGNATURE: Node first = n.getFirstChild(); if (null != first) { add("{["); add(first); add(":"); add(first.getDeclaredTypeExpression()); add("]:"); add(n.getDeclaredTypeExpression()); add("}"); } return true; case UNDEFINED_TYPE: add("undefined"); return true; case CAST: add("("); add(n.getFirstChild()); add(" as "); add(n.getDeclaredTypeExpression()); add(")"); return true; case NAME: if (n.getParent().isParamList()) { Visibility visibility = (Visibility) n.getProp(Node.ACCESS_MODIFIER); if (visibility != null) { switch (visibility) { case PRIVATE: add("private "); break; case PROTECTED: add("protected "); break; case PUBLIC: add("public "); break; default: break; } } if (n.getBooleanProp(Node.IS_CONSTANT_NAME)) { add("readonly "); } } return false; case ANY_TYPE: String anyTypeName = externsMap.get("any"); if (anyTypeName != null) { add(anyTypeName); return true; } return false; case EXPORT: if (!n.hasOneChild()) { return false; } if (n.getFirstChild().getToken() == Token.TYPE_ALIAS) { add("export"); add(n.getFirstChild()); return true; } return false; case FUNCTION_TYPE: if (parent != null && parent.getToken() == Token.UNION_TYPE) { add("("); } return false; default: return false; } }
Source:
public <V> V run(String callableName, Callable<V> callable) throws Exception { requireNonNull(callableName, "callableName is null"); requireNonNull(callable, "callable is null"); long startTime = System.nanoTime(); int attempt = 0; while (true) { attempt++; if (attempt > 1) { retryRunnable.ifPresent(Runnable::run); } try { return callable.call(); } catch (Exception e) { suppressedExceptions.add(e); e = exceptionMapper.apply(e); for (Class<? extends Exception> clazz : exceptionWhiteList) { if (clazz.isInstance(e)) { throw addSuppressedExceptions(e, suppressedExceptions); } } if (attempt >= maxAttempts || Duration.nanosSince(startTime).compareTo(maxRetryTime) >= 0) { throw addSuppressedExceptions(e, suppressedExceptions); } log.debug("Failed on executing %s with attempt %d, will retry. Exception: %s", callableName, attempt, e.getMessage()); int delayInMs = (int) Math.min(minSleepTime.toMillis() * Math.pow(scaleFactor, attempt - 1), maxSleepTime.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); try { TimeUnit.MILLISECONDS.sleep(delayInMs + jitter); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw addSuppressedExceptions(new RuntimeException(ie), suppressedExceptions); } } } }

Target:
public <V> V run(String callableName, Callable<V> callable) throws Exception { requireNonNull(callableName, "callableName is null"); requireNonNull(callable, "callable is null"); List<Throwable> suppressedExceptions = new ArrayList<>(); long startTime = System.nanoTime(); int attempt = 0; while (true) { attempt++; if (attempt > 1) { retryRunnable.ifPresent(Runnable::run); } try { return callable.call(); } catch (Exception e) { e = exceptionMapper.apply(e); for (Class<? extends Exception> clazz : exceptionWhiteList) { if (clazz.isInstance(e)) { addSuppressed(e, suppressedExceptions); throw e; } } if (attempt >= maxAttempts || Duration.nanosSince(startTime).compareTo(maxRetryTime) >= 0) { addSuppressed(e, suppressedExceptions); throw e; } log.debug("Failed on executing %s with attempt %d, will retry. Exception: %s", callableName, attempt, e.getMessage()); suppressedExceptions.add(e); int delayInMs = (int) Math.min(minSleepTime.toMillis() * Math.pow(scaleFactor, attempt - 1), maxSleepTime.toMillis()); int jitter = ThreadLocalRandom.current().nextInt(Math.max(1, (int) (delayInMs * 0.1))); try { TimeUnit.MILLISECONDS.sleep(delayInMs + jitter); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); Exception exception = new RuntimeException(ie); addSuppressed(new RuntimeException(ie), suppressedExceptions); throw exception; } } } }
Source:
public CFIndex getCount() { return INSTANCE.CFArrayGetCount(this); }

Target:
public int getCount() { return INSTANCE.CFArrayGetCount(this).intValue(); }
Source:
CompletableFuture<LogicalSlot> allocateLogicalSlot(ExecutionVertexID executionVertexId) { Preconditions.checkArgument(executionSlotSharingGroup.getExecutionVertexIds().contains(executionVertexId)); CompletableFuture<SingleLogicalSlot> logicalSlotFuture = requestedLogicalSlots.getValueByKeyA(executionVertexId); if (logicalSlotFuture != null) { LOG.debug("Request for already exists", getLogicalSlotString(executionVertexId)); } else { logicalSlotFuture = allocateNonExistentLogicalSlot(executionVertexId); } return logicalSlotFuture.thenApply(Function.identity()); }

Target:
CompletableFuture<LogicalSlot> allocateLogicalSlot(ExecutionVertexID executionVertexId) { Preconditions.checkState(state == State.ALLOCATED, "SharedSlot (physical request %s) has been released", physicalSlotRequestId); Preconditions.checkArgument( executionSlotSharingGroup.getExecutionVertexIds().contains(executionVertexId), "Trying to allocate a logical slot for execution %s which is not in the ExecutionSlotSharingGroup", executionVertexId); CompletableFuture<SingleLogicalSlot> logicalSlotFuture = requestedLogicalSlots.getValueByKeyA(executionVertexId); if (logicalSlotFuture != null) { LOG.debug("Request for already exists", getLogicalSlotString(executionVertexId)); } else { logicalSlotFuture = allocateNonExistentLogicalSlot(executionVertexId); } return logicalSlotFuture.thenApply(Function.identity()); }
Source:
public void updateUserFromUserDTO(UserDTO userDTO, User user) { if ( userDTO == null ) { return; } String[] settings1 = userDTOContactDataDTOSettings( userDTO ); if ( settings1 != null ) { user.setSettings( Arrays.copyOf( settings1, settings1.length ) ); } else { user.setSettings( null ); } List<String> preferences = userDTOContactDataDTOPreferences( userDTO ); if ( preferences != null ) { for ( String contactDataDTOPreference : userDTOContactDataDTOPreferences( userDTO ) ) { user.addPreference( contactDataDTOPreference ); } } user.setAddress( userDTOContactDataDTOAddress( userDTO ) ); String phone = userDTOContactDataDTOPhone( userDTO ); if ( phone != null ) { user.setPhone( Integer.parseInt( phone ) ); } else { user.setPhone( null ); } user.setEmail( userDTOContactDataDTOEmail( userDTO ) ); user.setName( userDTO.getName() ); }

Target:
public void updateUserFromUserDTO(UserDTO userDTO, User user) { if ( userDTO == null ) { return; } String[] settings1 = userDTOContactDataDTOSettings( userDTO ); if ( settings1 != null ) { user.setSettings( Arrays.copyOf( settings1, settings1.length ) ); } else { user.setSettings( null ); } List<String> preferences = userDTOContactDataDTOPreferences( userDTO ); if ( preferences != null ) { for ( String contactDataDTOPreference : preferences ) { user.addPreference( contactDataDTOPreference ); } } user.setAddress( userDTOContactDataDTOAddress( userDTO ) ); String phone = userDTOContactDataDTOPhone( userDTO ); if ( phone != null ) { user.setPhone( Integer.parseInt( phone ) ); } else { user.setPhone( null ); } user.setEmail( userDTOContactDataDTOEmail( userDTO ) ); user.setName( userDTO.getName() ); }
Source:
public void createNewMFAService() { final DefaultMultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService("<LINK_0>", "<LINK_0>", null, null, "test_loa"); assertEquals(svc.getAuthenticationMethod(), "test_loa"); final Response res = svc.getResponse("testTicketId"); assertNotNull(res); assertEquals(res.getResponseType(), Response.ResponseType.REDIRECT); assertEquals(res.getUrl(), "<LINK_0>?ticket=testTicketId"); }

Target:
public void createNewMFAService() { final DefaultMultiFactorAuthenticationSupportingWebApplicationService svc = new DefaultMultiFactorAuthenticationSupportingWebApplicationService("<LINK_0>", "<LINK_0>", null, null, "test_authn_method"); assertEquals(svc.getAuthenticationMethod(), "test_authn_method"); final Response res = svc.getResponse("testTicketId"); assertNotNull(res); assertEquals(res.getResponseType(), Response.ResponseType.REDIRECT); assertEquals(res.getUrl(), "<LINK_0>?ticket=testTicketId"); }
Source:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(DELETE_ACTION) .setPost(true) .setDescription("Delete a Webhook.<br>" + "Requires 'Administer' permission on the specified project, or global 'Administer' permission.") .setSince("7.1") .setHandler(this); action.createParam(KEY_PARAM) .setRequired(true) .setMaximumLength(KEY_PARAM_MAXIMUN_LENGTH) .setDescription("The key of the webhook to be deleted") .setExampleValue(KEY_PROJECT_EXAMPLE_001); }

Target:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(DELETE_ACTION) .setPost(true) .setDescription("Delete a Webhook.<br>" + "Requires 'Administer' permission on the specified project, or global 'Administer' permission.") .setSince("7.1") .setHandler(this); action.createParam(KEY_PARAM) .setRequired(true) .setMaximumLength(KEY_PARAM_MAXIMUN_LENGTH) .setDescription("The key of the webhook to be deleted,"+ "auto-generated value can be obtained through api/webhooks/create or api/webhooks/list") .setExampleValue(KEY_PROJECT_EXAMPLE_001); }
Source:
public static String executePost(String targetURL, String urlParameters, String clientCredentials) throws SSOAgentException { URL url; HttpURLConnection connection = null; try { url = new URL(targetURL); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Authorization", "Basic " + clientCredentials); connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes(Charset.forName("UTF-8")).length)); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); DataOutputStream wr = new DataOutputStream( connection.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuilder response = new StringBuilder(); while ((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); return response.toString(); } catch (Exception e) { if (log.isDebugEnabled()) { log.debug("Exception occurred : ", e); } throw new SSOAgentException(e); } finally { if (connection != null) { connection.disconnect(); } } }

Target:
public static String executePost(String targetURL, String urlParameters, String clientCredentials) throws SSOAgentException { URL url; HttpURLConnection connection = null; try { url = new URL(targetURL); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Authorization", "Basic " + clientCredentials); connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes(Charset.forName("UTF-8")).length)); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); DataOutputStream wr = new DataOutputStream( connection.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); InputStream is = connection.getInputStream(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); String line; StringBuilder response = new StringBuilder(); while ((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); return response.toString(); } catch (Exception e) { throw new SSOAgentException("Exception while executiong post", e); } finally { if (connection != null) { connection.disconnect(); } } }
Source:
public void setProjectOrDefault(IProject project) { if (project != null) { setProject(project); } else if (!projects.isEmpty()) { setProject(projects.get(0)); } }

Target:
protected void setProjectOrDefault(IProject project) { if (projects == null) { return; } if (project != null && projects.contains(project)) { setProject(project); } else if (!projects.isEmpty()) { project = getDefaultProject(); setProject(project); } }
Source:
private static VariableSymbol getVariableSymbol(AssignmentExpressionTree assignment) { VariableSymbol variableSymbol = null; if (assignment.variable().is(Tree.Kind.IDENTIFIER)) { Symbol reference = ((IdentifierTree) assignment.variable()).symbol(); if (reference instanceof VariableSymbol) { variableSymbol = (VariableSymbol) ((IdentifierTree) assignment.variable()).symbol(); } } else { MemberSelectExpressionTree mse = (MemberSelectExpressionTree) assignment.variable(); if (mse.identifier().symbol() instanceof VariableSymbol) { variableSymbol = (VariableSymbol) mse.identifier().symbol(); } } return variableSymbol; }

Target:
private static VariableSymbol getVariableSymbol(AssignmentExpressionTree assignment) { VariableSymbol variableSymbol = null; if (assignment.variable().is(Tree.Kind.IDENTIFIER)) { Symbol reference = ((IdentifierTree) assignment.variable()).symbol(); if (reference.isVariableSymbol()) { variableSymbol = (VariableSymbol) reference; } } else { MemberSelectExpressionTree mse = (MemberSelectExpressionTree) assignment.variable(); if (mse.identifier().symbol().isVariableSymbol()) { variableSymbol = (VariableSymbol) mse.identifier().symbol(); } } return variableSymbol; }
Source:
public static void main(String[] args) { final AtomicBoolean isRunning = new AtomicBoolean(true); Mono.delay(Duration.ofMinutes(2)).subscribe(index -> { System.out.println("2 minutes has elapsed, stopping receive loop."); isRunning.set(false); }); String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() .connectionString(connectionString) .sessionReceiver() .sessionId("greetings") .queueName("<<queue-name>>") .buildClient(); while (isRunning.get()) { IterableStream<ServiceBusReceivedMessageContext> messages = receiver.receive(10, Duration.ofSeconds(30)); for (ServiceBusReceivedMessageContext context : messages) { System.out.println("Processing message from session: " + context.getSessionId()); ServiceBusReceivedMessage message = context.getMessage(); boolean isSuccessfullyProcessed = processMessage(message); if (isSuccessfullyProcessed) { receiver.complete(message.getLockToken()); receiver.complete(message.getLockToken(), message.getSessionId()); } else { receiver.abandon(message.getLockToken(), null, message.getSessionId()); } } } receiver.close(); }

Target:
public static void main(String[] args) { final AtomicBoolean isRunning = new AtomicBoolean(true); Mono.delay(Duration.ofMinutes(2)).subscribe(index -> { System.out.println("2 minutes has elapsed, stopping receive loop."); isRunning.set(false); }); String connectionString = "Endpoint={fully-qualified-namespace};SharedAccessKeyName={policy-name};" + "SharedAccessKey={key}"; ServiceBusReceiverClient receiver = new ServiceBusClientBuilder() .connectionString(connectionString) .sessionReceiver() .sessionId("greetings") .queueName("<<queue-name>>") .buildClient(); while (isRunning.get()) { IterableStream<ServiceBusReceivedMessageContext> messages = receiver.receive(10, Duration.ofSeconds(30)); for (ServiceBusReceivedMessageContext context : messages) { System.out.println("Processing message from session: " + context.getSessionId()); ServiceBusReceivedMessage message = context.getMessage(); boolean isSuccessfullyProcessed = processMessage(message); if (isSuccessfullyProcessed) { receiver.complete(message.getLockToken(), message.getSessionId()); } else { receiver.abandon(message.getLockToken(), null, message.getSessionId()); } } } receiver.close(); }
Source:
public InertialMeasurementUnitAdapter() { super(ImuType.navX); try { this.ahrs = new AHRS(Port.kMXP); } catch (Exception e){ isBroken = true; } this.ahrs.zeroYaw(); }

Target:
public InertialMeasurementUnitAdapter() { super(ImuType.navX); try { this.ahrs = new AHRS(Port.kMXP); } catch (Exception e){ isBroken = true; } }
Source:
public void testEnum() { final EnumMap<Planet, String> obj = new EnumMap<Planet, String>(Planet.class); for (Planet p : Planet.values()) { obj.put(p, p.name()); } final byte[] serialized = serialize(_kryo, ImmutableMap.copyOf(obj)); final ImmutableMap<?, ?> deserialized = deserialize(_kryo, serialized, ImmutableMap.class); assertEquals(deserialized, obj); }

Target:
public void testEnum() { final EnumMap<Planet, String> obj = new EnumMap<Planet, String>(Planet.class); for (Planet p : Planet.values()) { obj.put(p, p.name()); } final ImmutableMap<?, ?> immutableObj = ImmutableMap.copyOf(obj); final byte[] serialized = serialize(_kryo, immutableObj); final ImmutableMap<?, ?> deserialized = deserialize(_kryo, serialized, ImmutableMap.class); assertEquals(deserialized, immutableObj); }
Source:
static void completelyRemoveUnusedUser(Path localBaseDir, String user) throws IOException { Path userFileCacheDir = getLocalUserFileCacheDir(localBaseDir, user); LOG.info("completelyRemoveUnusedUser for directory {}", user, userFileCacheDir); Files.deleteIfExists(getCacheDirForFiles(userFileCacheDir)); Files.deleteIfExists(getCacheDirForArchives(userFileCacheDir)); Files.deleteIfExists(userFileCacheDir); Files.deleteIfExists(getLocalUserDir(localBaseDir, user)); }

Target:
static void completelyRemoveUnusedUser(Path localBaseDir, String user) throws IOException { Path localUserDir = getLocalUserDir(localBaseDir, user); LOG.info("completelyRemoveUnusedUser for directory {}", user, localUserDir); Path userFileCacheDir = getLocalUserFileCacheDir(localBaseDir, user); Files.deleteIfExists(getCacheDirForFiles(userFileCacheDir)); Files.deleteIfExists(getCacheDirForArchives(userFileCacheDir)); Files.deleteIfExists(userFileCacheDir); Files.deleteIfExists(localUserDir); }
Source:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { properties = new HashMap<>(properties); boolean disableAudit = removeBoolean(properties, PARAM_DISABLE_AUDIT); VersioningOption versioingOption = removeVersioningOption(properties, PARAM_VERSIONING_OPTION); for (DocumentModel doc : loadDocuments(session, ids)) { if (disableAudit) { doc.putContextData(PARAM_DISABLE_AUDIT, Boolean.TRUE); } if (versioingOption != null) { doc.putContextData(VersioningService.VERSIONING_OPTION, versioingOption); } for (Entry<String, Serializable> es : properties.entrySet()) { try { doc.setPropertyValue(es.getKey(), es.getValue()); } catch (PropertyException e) { log.warn("Cannot write property: of document: {}", es.getKey(), doc.getId(), e); } } try { session.saveDocument(doc); } catch (PropertyException e) { log.warn("Cannot save document: {}", doc.getId(), e); } } }

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { for (DocumentModel doc : loadDocuments(session, ids)) { if (disableAudit) { doc.putContextData(PARAM_DISABLE_AUDIT, Boolean.TRUE); } if (versioningOption != null) { doc.putContextData(VersioningService.VERSIONING_OPTION, versioningOption); } for (Entry<String, Serializable> es : properties.entrySet()) { if (!PARAM_DISABLE_AUDIT.equals(es.getKey()) && !PARAM_VERSIONING_OPTION.equals(es.getKey())) { try { doc.setPropertyValue(es.getKey(), es.getValue()); } catch (PropertyException e) { log.warn("Cannot write property: of document: {}", es.getKey(), doc.getId(), e); } } } try { session.saveDocument(doc); } catch (PropertyException e) { log.warn("Cannot save document: {}", doc.getId(), e); } } }
Source:
public void getMessage_should_return_message_if_address_is_null() { assertEquals("[null] Test message", new ConnectionException(null, "Test message").getMessage()); }

Target:
public void getMessage_should_return_message_if_address_is_null() { assertEquals(new ConnectionException(null, "Test message").getMessage(), "Test message"); }
Source:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } if (volume.getIsGeoRepMaster()) { SafeHtml geoRepMasterHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(geoRepMasterImage).getHTML()); sb.append(applicationTemplates.statusTemplate(geoRepMasterHtml, constants.geoRepMasterVolumeToolTip())); } if (volume.getIsGeoRepSlave()) { SafeHtml geoRepSlaveHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(geoRepSlaveImage).getHTML()); sb.append(applicationTemplates.statusTemplate(geoRepSlaveHtml, messages.geoRepSlaveVolumeToolTip(formatVolClusterName(volume.getGeoRepMasterVolAndClusterName())))); } }

Target:
public void render(Context context, GlusterVolumeEntity volume, SafeHtmlBuilder sb) { if (volume == null) { return; } if (volume.getIsGeoRepMaster()) { SafeHtml geoRepMasterHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(geoRepMasterImage).getHTML()); sb.append(applicationTemplates.statusTemplate(geoRepMasterHtml, constants.geoRepMasterVolumeToolTip())); } if (volume.getIsGeoRepSlave()) { SafeHtml geoRepSlaveHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(geoRepSlaveImage).getHTML()); String[] volClusterNames = formatVolClusterName(volume.getGeoRepMasterVolAndClusterName()); String volName = volClusterNames[0]; String clusterName = volClusterNames.length == 2 ? volClusterNames[1] : "UNKNOWN"; sb.append(applicationTemplates.statusTemplate(geoRepSlaveHtml, messages.geoRepSlaveVolumeToolTip(volName, clusterName))); } }
Source:
public static CommandBase<?> CreateCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } return (CommandBase<?>) constructor.newInstance(new Object[] { commandId }); } catch (java.lang.Exception e) { log.error( "CommandsFactory : Failed to get type information using " + "reflection for Class : " + className + ", Command Id:" + commandId, e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }

Target:
public static CommandBase<?> CreateCommand(String className, Guid commandId) { Constructor<?> constructor = null; Boolean isAcessible = null; try { constructor = Class.forName(className).getDeclaredConstructor(Guid.class); if (!constructor.isAccessible()) { isAcessible = constructor.isAccessible(); constructor.setAccessible(true); } return (CommandBase<?>) constructor.newInstance(new Object[] { commandId }); } catch (Exception e) { log.error( "CommandsFactory : Failed to get type information using " + "reflection for Class : " + className + ", Command Id:" + commandId, e); return null; } finally { if (isAcessible != null) { constructor.setAccessible(isAcessible); } } }
Source:
public static <T> T getOrDefault(CompletableFuture<T> future, T defaultValue) { if (future.isDone() && !future.isCompletedExceptionally()) { return getWithoutException(future); } return defaultValue; }

Target:
public static <T> T getOrDefault(CompletableFuture<T> future, T defaultValue) { T value = getWithoutException(future); return value == null ? defaultValue : value; }
Source:
public void testFilterPluginNoFiltering() throws Exception { String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); Dictionary<String, Object> filterPluginProps = configureMetacardValidityFilterPlugin( Collections.singletonList("invalid-state=data-manager"), false, false, getAdminConfig()); testWithRetry( () -> { query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); }); configureMetacardValidityFilterPlugin(filterPluginProps, getAdminConfig()); }

Target:
public void testFilterPluginNoFiltering() throws Exception { String warningId = ingestXmlFromResourceAndWait(WARNING_METACARD); String cleanId = ingestXmlFromResourceAndWait(CLEAN_METACARD); String errorId = ingestXmlFromResourceAndWait(ERROR_METACARD); Dictionary<String, Object> filterPluginProps = configureMetacardValidityFilterPlugin( Collections.singletonList("invalid-state=data-manager"), false, false, getAdminConfig()); query(warningId, TRANSFORMER_XML, HttpStatus.SC_OK); query(cleanId, TRANSFORMER_XML, HttpStatus.SC_OK); query(errorId, TRANSFORMER_XML, HttpStatus.SC_OK); configureMetacardValidityFilterPlugin(filterPluginProps, getAdminConfig()); }
Source:
public ScriptResult executeForkEnvironmentScript(TaskContext context,PrintStream outputSink, PrintStream errorSink) throws Exception { ForkEnvironment forkEnvironment = context.getInitializer().getForkEnvironment(); Map<String, Serializable> variables = taskContextVariableExtractor.extractTaskVariables(context); Map<String, String> thirdPartyCredentials = forkedTaskVariablesManager.extractThirdPartyCredentials(context); ScriptResult scriptResult; ScriptHandler scriptHandler = ScriptLoader.createLocalHandler(); Script<?> script = forkEnvironment.getEnvScript(); forkedTaskVariablesManager .addBindingsToScriptHandler(scriptHandler, context, variables, thirdPartyCredentials); forkedTaskVariablesManager.replaceScriptParameters(script, thirdPartyCredentials, variables, errorSink); scriptResult = scriptHandler.handle(script, outputSink, errorSink); if (scriptResult.errorOccured()) { throw new Exception("Failed to execute fork environment script", scriptResult.getException()); } return scriptResult; }

Target:
public ScriptResult executeForkEnvironmentScript(TaskContext context, PrintStream outputSink, PrintStream errorSink) throws Exception { Map<String, Serializable> variables = taskContextVariableExtractor.extractTaskVariables(context); Map<String, String> thirdPartyCredentials = forkedTaskVariablesManager.extractThirdPartyCredentials( context); ScriptHandler scriptHandler = ScriptLoader.createLocalHandler(); Script<?> script = context.getInitializer().getForkEnvironment().getEnvScript(); forkedTaskVariablesManager .addBindingsToScriptHandler(scriptHandler, context, variables, thirdPartyCredentials); forkedTaskVariablesManager.replaceScriptParameters(script, thirdPartyCredentials, variables, errorSink); ScriptResult scriptResult = scriptHandler.handle(script, outputSink, errorSink); if (scriptResult.errorOccured()) { throw new Exception("Failed to execute fork environment script", scriptResult.getException()); } return scriptResult; }
Source:
private void handleCommandStepAndEntities() { if (getCommandStep() != null) { Step taskStep = executionHandler.addTaskStep(getExecutionContext(), getCommandStep(), null, getCommandStepSubjectEntities()); if (taskStep != null) { getExecutionContext().setStep(taskStep); persistCommandIfNeeded(); } } }

Target:
private void handleCommandStepAndEntities() { if (getCommandStep() != null) { Step taskStep = executionHandler.addTaskStep(getExecutionContext(), getCommandStep(), null, getCommandStepSubjectEntities()); if (taskStep != null) { if (updatingStepProgress()) { stepDao.updateStepProgress(taskStep.getId(), 0); } getExecutionContext().setStep(taskStep); persistCommandIfNeeded(); } } }
Source:
public final Completable flatMapCompletable(final Func1<? super T, ? extends Completable> func) { return Completable.create(new CompletableFlatMapSingleToCompletable(this, func)); }

Target:
public final Completable flatMapCompletable(final Func1<? super T, ? extends Completable> func) { return Completable.create(new CompletableFlatMapSingleToCompletable<T>(this, func)); }
Source:
public Txn txn(final Task task) { return null; }

Target:
public Txn txn(final Task task) { throw new UnsupportedOperationException(); }
Source:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); mOptionsMenu = menu; MenuItem menuItem = mOptionsMenu.findItem(R.id.action_switch_view); changeGridIcon(); return true; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return true; }
Source:
protected boolean doSelect(Viewer viewer, Object parent, Object element) { if (element instanceof PackageFragmentRootContainer) { if (isApplicable() && viewer instanceof StructuredViewer) { PackageFragmentRootContainer rootContainer = (PackageFragmentRootContainer) element; if (rootContainer.getChildren().length > 0) { return hasFilteredChildren((StructuredViewer) viewer, rootContainer); } return false; } } return true; }

Target:
protected boolean doSelect(Viewer viewer, Object parent, Object element) { if (element instanceof PackageFragmentRootContainer) { if (isApplicable() && viewer instanceof StructuredViewer) { PackageFragmentRootContainer rootContainer= (PackageFragmentRootContainer) element; return rootContainer.getChildren().length > 0 ? hasFilteredChildren((StructuredViewer) viewer, rootContainer) : false; } } return true; }
Source:
public void copy_shouldCopyAllTestOrderFields() throws Exception { OrderTest.assertThatAllFieldsAreCopied(new TestOrder(), null, "orderGroup", "sortWeight"); }

Target:
public void copy_shouldCopyAllTestOrderFields() throws Exception { OrderTest.assertThatAllFieldsAreCopied(new TestOrder(), null); }
Source:
private static File getConfigDropinsDir() { File configDropins = null; if (configDirectory != null && configDirectory.exists()) { configDropins = new File(configDirectory, "configDropins"); } if (configDropins == null || !configDropins.exists()) { configDropins = new File(getServerXML().getParent(), "configDropins"); } return configDropins; }

Target:
private static File getConfigDropinsDir() { File configDropins = null; if (configDropins == null || !configDropins.exists()) { configDropins = new File(getServerXML().getParent(), "configDropins"); } return configDropins; }