auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static String toSafePathName(final String name) { int nameLength = name.length(); char[] newPath = new char[nameLength]; for (int i = 0; i < nameLength; i++) { char oldChar = name.charAt(i); boolean isDigit = oldChar >= '0' && oldChar <= '9'; boolean isCharacter = (oldChar >= 'a' && oldChar <= 'z') || (oldChar >= 'A' && oldChar <= 'Z'); boolean isWhitespace = Character.isWhitespace(oldChar); if (isDigit || isCharacter) { newPath[i] = oldChar; } else if (isWhitespace) { newPath[i] = '_'; } else { newPath[i] = '-'; } } return new String(newPath); }

Target:
public static String toSafePathName(final String name) { Pattern whitespace = Pattern.compile("\\s"); String nameWithoutWhitespace = whitespace.matcher(name).replaceAll("_"); Pattern allButAllowedCharacters = Pattern.compile("[^a-zA-Z0-9_]"); return allButAllowedCharacters.matcher(nameWithoutWhitespace).replaceAll("-"); }
Source:
public static BasicInventoryPacketState fromWindowPacket(CPacketClickWindow windowPacket) { final int mode = 0x01 << 9 << windowPacket.getClickType().ordinal(); final int packed = windowPacket.getUsedButton(); final int unpacked = mode == MODE_DRAG ? (0x01 << 6 << (packed >> 2 & 3)) | (0x01 << 3 << (packed & 3)) : (0x01 << (packed & 3)); final int state = clickType(windowPacket.getSlotId()) | mode | unpacked; for (InventoryClickPacketState inventory : Inventory.CLICK_STATES) { if (inventory.matches(state)) { return inventory; } } SpongeImpl.getLogger().warn(String.format("Unable to find InventoryPacketState handler for click window packet: %s", windowPacket)); return Inventory.UNKNOWN_CLICK; }

Target:
public static BasicInventoryPacketState fromWindowPacket(CPacketClickWindow windowPacket) { final int mode = 0x01 << 9 << windowPacket.getClickType().ordinal(); final int packed = windowPacket.getUsedButton(); final int unpacked = mode == MODE_DRAG ? (0x01 << 6 << (packed >> 2 & 3)) | (0x01 << 3 << (packed & 3)) : (0x01 << (packed & 3)); final int state = clickType(windowPacket.getSlotId()) | mode | unpacked; for (InventoryClickPacketState inventory : Inventory.CLICK_STATES) { if (inventory.matches(state)) { return inventory; } } SpongeImpl.getLogger().warn("Unable to find InventoryPacketState handler for click window packet: {}", windowPacket); return Inventory.UNKNOWN_CLICK; }
Source:
public Object get(String scriptIdentifier, String type) { Object obj = staticTypes.get(type); if (obj != null) { return obj; } HashMap<String, Object> objects = objectCache.get(scriptIdentifier); if (objects == null) { objects = new HashMap<>(); objectCache.put(scriptIdentifier, objects); } obj = objects.get(type); if (obj != null) { return obj; } if (type.equals("AutomationManager") || type.equals("RuleRegistry")) { RuleSupportRuleRegistryDelegate ruleRegistryDelegate = new RuleSupportRuleRegistryDelegate(ruleRegistry, ruleProvider); ScriptedAutomationManager automationManager = new ScriptedAutomationManager(ruleRegistryDelegate); objects.put("AutomationManager", automationManager); objects.put("RuleRegistry", ruleRegistryDelegate); obj = objects.get(type); } return obj; }

Target:
public Object get(String scriptIdentifier, String type) { Object obj = staticTypes.get(type); if (obj != null) { return obj; } HashMap<String, Object> objects = objectCache.get(scriptIdentifier); if (objects == null) { objects = new HashMap<>(); objectCache.put(scriptIdentifier, objects); } obj = objects.get(type); if (obj != null) { return obj; } if (type.equals(AUTOMATION_MANAGER) || type.equals(RULE_REGISTRY)) { RuleSupportRuleRegistryDelegate ruleRegistryDelegate = new RuleSupportRuleRegistryDelegate(ruleRegistry, ruleProvider); ScriptedAutomationManager automationManager = new ScriptedAutomationManager(ruleRegistryDelegate, scriptedCustomModuleHandlerFactory, scriptedCustomModuleTypeProvider, scriptedPrivateModuleHandlerFactory); objects.put(AUTOMATION_MANAGER, automationManager); objects.put(RULE_REGISTRY, ruleRegistryDelegate); obj = objects.get(type); } return obj; }
Source:
public void onViewAttachedToWindow(@NonNull ViewHolder holder) { super.onViewAttachedToWindow(holder); mController.onViewAttachedToWindow(holder); }

Target:
public void onViewAttachedToWindow(@NonNull ViewHolder holder) { mController.onViewAttachedToWindow(holder); }
Source:
public MixRecipeManager removeOxidizer(IIngredient oxidizer) { if (oxidizer != null && removedAdditives.get(MixAdditive.OXIDIZER) != null) { removedAdditives.get(MixAdditive.OXIDIZER).add(new RecipeMatchIIngredient(oxidizer)); } else { removedAdditives.put(MixAdditive.OXIDIZER, null); } return this; }

Target:
public MixRecipeManager removeOxidizer(IIngredient oxidizer) { if (oxidizer != null && removedAdditives.get(MixAdditive.OXIDIZER) != null) { removedAdditives.get(MixAdditive.OXIDIZER).add(oxidizer); } else { removedAdditives.put(MixAdditive.OXIDIZER, null); } return this; }
Source:
public int getMaximumNumberOfSubtasks() { if (!(this.format instanceof FileOutputFormat<?>)) { return -1; } final String pathName = this.config.getStubParameter(FileOutputFormat.FILE_PARAMETER_KEY, null); final Path path; if (pathName == null) { return 0; } try { path = new Path(pathName); } catch (Throwable t) { return 0; } try { final FileSystem fs = path.getFileSystem(); if(fs.getUri().getScheme().toLowerCase().equals("hdfs") || fs.getUri().getScheme().toLowerCase().equals("s3")) { try { final FileStatus f = fs.getFileStatus(path); if (f == null) { return 1; } if (f.isDir()) { return -1; } else { fs.delete(path, false); int dop = getTaskConfiguration().getInteger(DEGREE_OF_PARALLELISM_KEY, -1); if (dop == 1) { return 1; } else { fs.mkdirs(path); return -1; } } } catch (FileNotFoundException fnfex) { int dop = getTaskConfiguration().getInteger(DEGREE_OF_PARALLELISM_KEY, -1); if (dop == 1) { return 1; } fs.mkdirs(path); return -1; } } else { return -1; } } catch (IOException e) { LOG.error("Could not access the file system to detemine the status of the output.", e); throw new RuntimeException("I/O Error while accessing file", e); } }

Target:
public int getMaximumNumberOfSubtasks() { if (!(this.format instanceof FileOutputFormat<?>)) { return -1; } final String pathName = this.config.getStubParameter(FileOutputFormat.FILE_PARAMETER_KEY, null); final WriteMode writeMode = ((FileOutputFormat<?>)this.format).getWriteMode(); final Path path; if (pathName == null) { return 0; } try { path = new Path(pathName); } catch (Throwable t) { return 0; } try { int dop = getTaskConfiguration().getInteger(DEGREE_OF_PARALLELISM_KEY, -1); final FileSystem fs = path.getFileSystem(); if(dop == 1) { if(fs.isDistributedFS()) { if(!fs.initOutPathDistFS(path, writeMode, false)) { throw new IOException("Output path could not be initialized."); } } return 1; } else { if(fs.isDistributedFS()) { if(!fs.initOutPathDistFS(path, writeMode, true)) { throw new IOException("Output directory could not be created."); } } return -1; } } catch (IOException e) { LOG.error("Could not access the file system to detemine the status of the output.", e); throw new RuntimeException("I/O Error while accessing file", e); } }
Source:
private StringListPanel renderStringListPanel(LabeledWidgetsGrid g, ConfigParameterInfo param) { StringListPanel p = new StringListPanel(null, Arrays.asList(getDisplayName(param)), saveProject, true); List<List<String>> values = new ArrayList<>(); for (String v : Natives.asList(param.values())) { values.add(Arrays.asList(v)); } p.display(values); if (!param.editable()) { p.setEnabled(false); } addWidget(g, p, param); return p; }

Target:
private StringListPanel renderStringListPanel(LabeledWidgetsGrid g, ConfigParameterInfo param) { StringListPanel p = new StringListPanel(null, Arrays.asList(getDisplayName(param)), saveProject, false); List<List<String>> values = new ArrayList<>(); for (String v : Natives.asList(param.values())) { values.add(Arrays.asList(v)); } p.display(values); if (!param.editable()) { p.setEnabled(false); } addWidget(g, p, param); return p; }
Source:
public void onOverflowMenuChange(OverflowMenuUpdateEvent event) { switch (event.getState()) { case PageViewFragment.STATE_NO_FETCH: case PageViewFragment.STATE_INITIAL_FETCH: menu.getMenu().findItem(R.id.menu_save_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_share_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_other_languages).setEnabled(false); menu.getMenu().findItem(R.id.menu_find_in_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_themechooser).setEnabled(false); break; case PageViewFragment.STATE_COMPLETE_FETCH: menu.getMenu().findItem(R.id.menu_save_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_share_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_other_languages).setEnabled(true); menu.getMenu().findItem(R.id.menu_find_in_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_themechooser).setEnabled(true); if (event.getSubtate() == PageViewFragment.SUBSTATE_PAGE_SAVED) { menu.getMenu().findItem(R.id.menu_save_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getResources().getString(R.string.menu_page_saved)); } else if (event.getSubtate() == PageViewFragment.SUBSTATE_SAVED_PAGE_LOADED) { menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getResources().getString(R.string.menu_refresh_saved_page)); } else { menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getResources().getString(R.string.menu_save_page)); } break; default: throw new RuntimeException("This can't happen"); } }

Target:
public void onOverflowMenuChange(OverflowMenuUpdateEvent event) { switch (event.getState()) { case PageViewFragment.STATE_NO_FETCH: case PageViewFragment.STATE_INITIAL_FETCH: menu.getMenu().findItem(R.id.menu_save_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_share_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_other_languages).setEnabled(false); menu.getMenu().findItem(R.id.menu_find_in_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_themechooser).setEnabled(false); break; case PageViewFragment.STATE_COMPLETE_FETCH: menu.getMenu().findItem(R.id.menu_save_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_share_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_other_languages).setEnabled(true); menu.getMenu().findItem(R.id.menu_find_in_page).setEnabled(true); menu.getMenu().findItem(R.id.menu_themechooser).setEnabled(true); if (event.getSubstate() == PageViewFragment.SUBSTATE_PAGE_SAVED) { menu.getMenu().findItem(R.id.menu_save_page).setEnabled(false); menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getString(R.string.menu_page_saved)); } else if (event.getSubstate() == PageViewFragment.SUBSTATE_SAVED_PAGE_LOADED) { menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getString(R.string.menu_refresh_saved_page)); } else { menu.getMenu().findItem(R.id.menu_save_page).setTitle(WikipediaApp.getInstance().getString(R.string.menu_save_page)); } break; default: throw new RuntimeException("This can't happen"); } }
Source:
private List<ElasticsearchColumn> buildColumns(ElasticsearchTableDescription tableDescription) { List<ElasticsearchColumn> columns = new ArrayList<>(); TransportClient client = clients.get(tableDescription.getClusterName()); verify(client != null, "TransportClient should not be null"); for (String index : getIndices(tableDescription)) { try { GetMappingsRequest mappingsRequest = new GetMappingsRequest().types(tableDescription.getType()); if (!isNullOrEmpty(index)) { mappingsRequest.indices(index); } ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = client.admin() .indices() .getMappings(mappingsRequest) .actionGet(timeout.toMillis()) .getMappings(); Iterator<String> indexIterator = mappings.keysIt(); while (indexIterator.hasNext()) { MappingMetaData mappingMetaData = mappings.get(indexIterator.next()).get(tableDescription.getType()); JsonNode rootNode = objecMapper.readTree(mappingMetaData.source().uncompressed()); JsonNode mappingNode = rootNode.get(tableDescription.getType()); JsonNode propertiesNode = mappingNode.get("properties"); List<String> lists = new ArrayList<>(); JsonNode metaNode = mappingNode.get("_meta"); if (metaNode != null) { JsonNode arrayNode = metaNode.get("lists"); if (arrayNode != null && arrayNode.isArray()) { ArrayNode arrays = (ArrayNode) arrayNode; for (int i = 0; i < arrays.size(); i++) { lists.add(arrays.get(i).textValue()); } } } populateColumns(propertiesNode, lists, columns); } } catch (IOException e) { throw new PrestoException(ELASTIC_SEARCH_MAPPING_REQUEST_ERROR, e); } } return columns; }

Target:
private List<ElasticsearchColumn> buildColumns(ElasticsearchTableDescription tableDescription) { List<ElasticsearchColumn> columns = new ArrayList<>(); TransportClient client = clients.get(tableDescription.getClusterName()); verify(client != null, "client is null"); for (String index : getIndices(tableDescription)) { try { GetMappingsRequest mappingsRequest = new GetMappingsRequest().types(tableDescription.getType()); if (!isNullOrEmpty(index)) { mappingsRequest.indices(index); } ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = client.admin() .indices() .getMappings(mappingsRequest) .actionGet(timeout.toMillis()) .getMappings(); Iterator<String> indexIterator = mappings.keysIt(); while (indexIterator.hasNext()) { MappingMetaData mappingMetaData = mappings.get(indexIterator.next()).get(tableDescription.getType()); JsonNode rootNode = objecMapper.readTree(mappingMetaData.source().uncompressed()); JsonNode mappingNode = rootNode.get(tableDescription.getType()); JsonNode propertiesNode = mappingNode.get("properties"); List<String> lists = new ArrayList<>(); JsonNode metaNode = mappingNode.get("_meta"); if (metaNode != null) { JsonNode arrayNode = metaNode.get("lists"); if (arrayNode != null && arrayNode.isArray()) { ArrayNode arrays = (ArrayNode) arrayNode; for (int i = 0; i < arrays.size(); i++) { lists.add(arrays.get(i).textValue()); } } } populateColumns(propertiesNode, lists, columns); } } catch (IOException e) { throw new PrestoException(ELASTICSEARCH_CORRUPTED_MAPPING_METADATA, e); } } return columns; }
Source:
public boolean isEmpty() { return getPrimary() == null && getDisplay() == null && getType() == null && getValue() == null; }

Target:
public boolean isEmpty() { return getPrimary() == null && Strings.isNullOrEmpty(getDisplay()) && Strings.isNullOrEmpty(getType()) && Strings.isNullOrEmpty(getValue()); }
Source:
public Void computeResults(final OperationParams params) { if (parameters.size() != 2) { throw new ParameterException("Requires arguments: <store name> <type name>"); } final String inputStoreName = parameters.get(0); final String typeName = parameters.get(1); final File configFile = getGeoWaveConfigFile(params); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info( "Describing everything in store: " + inputStoreName + " with type name: " + typeName); DataTypeAdapter[] types = inputStoreOptions.createDataStore().getTypes(); for (DataTypeAdapter type : types) { if (type.getTypeName().equals(typeName)) { Map<String, String> description = type.describe(); List<List<Object>> rows = new ArrayList<>(); for (Entry<String, String> entry : description.entrySet()) { List<Object> row = new ArrayList<>(); row.add(entry.getKey()); row.add(entry.getValue()); rows.add(row); } List<String> headers = new ArrayList<>(); headers.add("Property"); headers.add("Value"); ConsolePrinter cp = new ConsolePrinter(); cp.print(headers, rows); } } return null; }

Target:
public Void computeResults(final OperationParams params) { if (parameters.size() != 2) { throw new ParameterException("Requires arguments: <store name> <type name>"); } final String inputStoreName = parameters.get(0); final String typeName = parameters.get(1); final File configFile = getGeoWaveConfigFile(params); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info( "Describing everything in store: " + inputStoreName + " with type name: " + typeName); final PersistentAdapterStore adapterStore = inputStoreOptions.createAdapterStore(); final InternalAdapterStore internalAdapterStore = inputStoreOptions.createInternalAdapterStore(); final DataTypeAdapter<?> type = adapterStore.getAdapter(internalAdapterStore.getAdapterId(typeName)).getAdapter(); Map<String, String> description = type.describe(); List<List<Object>> rows = new ArrayList<>(); for (Entry<String, String> entry : description.entrySet()) { List<Object> row = new ArrayList<>(); row.add(entry.getKey()); row.add(entry.getValue()); rows.add(row); } List<String> headers = new ArrayList<>(); headers.add("Property"); headers.add("Value"); ConsolePrinter cp = new ConsolePrinter(); cp.print(headers, rows); return null; }
Source:
public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) { Object[] lookupObjects = lookup(projectionBlock); int[] resultSet = new int[lookupObjects.length]; Arrays.fill(resultSet, ((Number) _lookupColumnFieldSpec.getDefaultNullValue()).intValue()); for (int i = 0; i < lookupObjects.length; i++) { resultSet[i] = ((Number) lookupObjects[i]).intValue(); } return resultSet; }

Target:
public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) { Object[] lookupObjects = lookup(projectionBlock); int[] resultSet = new int[lookupObjects.length]; Arrays.fill(resultSet, ((Number) _lookupColumnFieldSpec.getDefaultNullValue()).intValue()); for (int i = 0; i < lookupObjects.length; i++) { if (lookupObjects[i] != null) { resultSet[i] = ((Number) lookupObjects[i]).intValue(); } } return resultSet; }
Source:
public void shouldSaveNewConfiguration() throws CommcareConnectionFailureException { Config config = configService.create(); config.setName("newName"); Config savedConfig = configService.saveNewConfig(config); assertEquals(config.getName(), savedConfig.getName()); }

Target:
public void shouldSaveNewConfiguration() throws CommcareConnectionFailureException { Config config = configService.create(); config.setName("newName"); Config savedConfig = configService.addConfig(config); assertEquals(config.getName(), savedConfig.getName()); }
Source:
public void setUseIntermediateSharedCache(boolean useIntermediateSharedCache) { }

Target:
public boolean setUseIntermediateSharedCache(boolean useIntermediateSharedCache) { return false; }
Source:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && valueMatcher.matches(e, oldValue, newValue, valueEquivalence)) { e.setChanged(true); Object old = e.setValue(newValue); updateMetadata(e, metadata); if (valueMatcher != ValueMatcher.MATCH_EXPECTED_OR_NEW) { return returnValue(old, e.getMetadata(), true, ctx); } else { return returnValue(oldValue, e.getMetadata(), true, ctx); } } return returnValue(null, null, false, ctx); }

Target:
public Object perform(InvocationContext ctx) throws Throwable { if (valueMatcher == ValueMatcher.MATCH_NEVER) { successful = false; return null; } MVCCEntry e = (MVCCEntry) ctx.lookupEntry(key); if (e != null && valueMatcher.matches(e, oldValue, newValue, valueEquivalence)) { e.setChanged(true); Object old = e.setValue(newValue); Metadatas.updateMetadata(e, metadata); if (valueMatcher != ValueMatcher.MATCH_EXPECTED_OR_NEW) { return returnValue(old, e.getMetadata(), true, ctx); } else { return returnValue(oldValue, e.getMetadata(), true, ctx); } } return returnValue(null, null, false, ctx); }
Source:
public static boolean binaryIdentical(IStorage left, IStorage right) { BufferedInputStream leftStream = null; BufferedInputStream rightStream = null; try { final int maxBufferSize = 8192; final byte[] leftBuff = new byte[maxBufferSize]; final byte[] rightBuff = new byte[maxBufferSize]; leftStream = new BufferedInputStream(left.getContents(), maxBufferSize); rightStream = new BufferedInputStream(right.getContents(), maxBufferSize); boolean diffFound = false, eofFound = false; while (!diffFound && !eofFound) { leftStream.mark(maxBufferSize); rightStream.mark(maxBufferSize); int readLeft = leftStream.read(leftBuff, 0, leftBuff.length); int readRight = rightStream.read(rightBuff, 0, rightBuff.length); int readMin = Math.min(readLeft, readRight); diffFound |= (readLeft == -1) != (readRight == -1); diffFound |= !equalArrays(readMin, leftBuff, rightBuff); eofFound |= readMin < 0; if (readMin > 0) { leftStream.reset(); rightStream.reset(); leftStream.skip(readMin); rightStream.skip(readMin); } } return !diffFound; } catch (CoreException e) { logError(e); } catch (IOException e) { logError(e); } finally { Closeables.closeQuietly(leftStream); Closeables.closeQuietly(rightStream); } return false; }

Target:
public static boolean binaryIdentical(IStorage left, IStorage right) { BufferedInputStream leftStream = null; BufferedInputStream rightStream = null; try { final int maxBufferSize = 8192; final byte[] leftBuff = new byte[maxBufferSize]; final byte[] rightBuff = new byte[maxBufferSize]; leftStream = new BufferedInputStream(left.getContents(), maxBufferSize); rightStream = new BufferedInputStream(right.getContents(), maxBufferSize); int readMin; do { leftStream.mark(maxBufferSize); rightStream.mark(maxBufferSize); int readLeft = leftStream.read(leftBuff, 0, leftBuff.length); int readRight = rightStream.read(rightBuff, 0, rightBuff.length); readMin = Math.min(readLeft, readRight); if ((readLeft == -1) != (readRight == -1) || !equalArrays(readMin, leftBuff, rightBuff)) { return false; } if (readMin > 0) { resetAndSkip(leftStream, readMin); resetAndSkip(rightStream, readMin); } } while (readMin > 0); return true; } catch (CoreException e) { logError(e); } catch (IOException e) { logError(e); } finally { Closeables.closeQuietly(leftStream); Closeables.closeQuietly(rightStream); } return false; }
Source:
private static void spawnMetricsAccounting(SpawnMetrics.Builder spawnMetrics, ExecutedActionMetadata executionMetadata) { if (!executionMetadata.getWorker().isEmpty()) { Duration remoteQueueTime = spawnMetrics.build().remoteQueueTime().plus( between( executionMetadata.getQueuedTimestamp(), executionMetadata.getWorkerStartTimestamp())); spawnMetrics.setRemoteQueueTime(remoteQueueTime); Duration setupTime = between( executionMetadata.getWorkerStartTimestamp(), executionMetadata.getExecutionStartTimestamp()); spawnMetrics.setSetupTime(setupTime); Duration executionWallTime = between( executionMetadata.getExecutionStartTimestamp(), executionMetadata.getExecutionCompletedTimestamp()); spawnMetrics.setExecutionWallTime(executionWallTime); Duration remoteProcessOutputsTime = between( executionMetadata.getOutputUploadStartTimestamp(), executionMetadata.getOutputUploadCompletedTimestamp()); spawnMetrics.setRemoteProcessOutputsTime(remoteProcessOutputsTime); } }

Target:
static void spawnMetricsAccounting(SpawnMetrics.Builder spawnMetrics, ExecutedActionMetadata executionMetadata) { if (!executionMetadata.getWorker().isEmpty()) { Duration remoteQueueTime = spawnMetrics.build().remoteQueueTime().plus( between( executionMetadata.getQueuedTimestamp(), executionMetadata.getWorkerStartTimestamp())); spawnMetrics.setRemoteQueueTime(remoteQueueTime); Duration setupTime = between( executionMetadata.getWorkerStartTimestamp(), executionMetadata.getExecutionStartTimestamp()); spawnMetrics.setSetupTime(setupTime); Duration executionWallTime = between( executionMetadata.getExecutionStartTimestamp(), executionMetadata.getExecutionCompletedTimestamp()); spawnMetrics.setExecutionWallTime(executionWallTime); Duration remoteProcessOutputsTime = between( executionMetadata.getOutputUploadStartTimestamp(), executionMetadata.getOutputUploadCompletedTimestamp()); spawnMetrics.setRemoteProcessOutputsTime(remoteProcessOutputsTime); } }
Source:
public Object onTraversalSuccess(){ if (! exhaustedTruthVariants){ if (currentTruthVariant.get().isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } while (truthIterator.hasNext()){ currentTruthVariant = getNextNonSVTruthVariant(); if (! currentTruthVariant.isPresent()) { break; } if (currentTruthVariant.get().isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } } } try ( ConcordanceSummaryRecord.Writer concordanceSummaryWriter = ConcordanceSummaryRecord.getWriter(summary) ){ concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.SNP, snpTruePositives, snpFalsePositives, snpFalseNegatives)); concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.INDEL, indelTruePositives, indelFalsePositives, indelFalseNegatives)); variantStatusWriter.close(); } catch (IOException e){ throw new UserException("Encountered an IO exception writing the concordance summary table", e); } return "SUCCESS"; }

Target:
public Object onTraversalSuccess() { if (! exhaustedTruthVariants ) { while (true) { if (currentTruthVariant.isSNP()) { snpFalseNegatives++; } else { indelFalseNegatives++; } if (truthIterator.hasNext()) { checkInvariant(); currentTruthVariant = truthIterator.next(); } else { break; } } } try ( ConcordanceSummaryRecord.Writer concordanceSummaryWriter = ConcordanceSummaryRecord.getWriter(summary) ){ concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.SNP, snpTruePositives, snpFalsePositives, snpFalseNegatives)); concordanceSummaryWriter.writeRecord(new ConcordanceSummaryRecord(VariantContext.Type.INDEL, indelTruePositives, indelFalsePositives, indelFalseNegatives)); variantStatusWriter.close(); } catch (IOException e){ throw new UserException("Encountered an IO exception writing the concordance summary table", e); } return "SUCCESS"; }
Source:
private static void runInCurrentThread(IRunnableWithProgress runnable, IProgressMonitor progressMonitor) throws InterruptedException, InvocationTargetException { try { if (runnable != null) { runnable.run(progressMonitor); } } catch (InvocationTargetException | InterruptedException | ThreadDeath e) { throw e; }catch (OperationCanceledException e) { throw new InterruptedException(); } catch (RuntimeException | Error e) { throw new InvocationTargetException(e); } }

Target:
private static void runInCurrentThread(IRunnableWithProgress runnable, IProgressMonitor progressMonitor) throws InterruptedException, InvocationTargetException { try { if (runnable != null) { runnable.run(progressMonitor); } } catch (InvocationTargetException | InterruptedException e) { throw e; } catch (OperationCanceledException e) { throw new InterruptedException(); } catch (ThreadDeath e) { throw e; } catch (RuntimeException | Error e) { throw new InvocationTargetException(e); } }
Source:
protected void onDraw(Canvas canvas) { PasscodeManager passcodeManager = SalesforceSDKManager.getInstance().getPasscodeManager(); boolean passcodeLengthKnown = passcodeManager.getPasscodeLengthKnown(); int passcodeLength = passcodeManager.getPasscodeLength(); float density = getResources().getDisplayMetrics().density; float diameter = CIRCLE_DIAMETER * density; float lineWidth = LINE_WIDTH * density; float padding = DEFAULT_PADDING * density; float spacing = CIRCLE_SPACING * density; Paint openCirclePaint = new Paint(); Paint typedCirclePaint = new Paint(); openCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); openCirclePaint.setStyle(Paint.Style.STROKE); openCirclePaint.setStrokeWidth(lineWidth); typedCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); int circleSpacing = 0; int lengthForSpacing = passcodeLengthKnown ? passcodeLength : MAX_PASSCODE_LENGTH; float yPosition = getHeight()/2f; float startX = (getWidth() - (diameter * lengthForSpacing) - (padding * (lengthForSpacing - 1)) + (lineWidth * lengthForSpacing * 2)) / 2; if (passcodeLengthKnown) { for (int count = 0; count < passcodeLength; count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, openCirclePaint); circleSpacing += diameter + spacing; } } else { startX = (startX > padding) ? padding : startX; } circleSpacing = 0; for (int count = 0; count < getText().length(); count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, typedCirclePaint); circleSpacing += diameter + spacing; } }

Target:
protected void onDraw(Canvas canvas) { PasscodeManager passcodeManager = SalesforceSDKManager.getInstance().getPasscodeManager(); boolean passcodeLengthKnown = passcodeManager.getPasscodeLengthKnown(); int passcodeLength = passcodeManager.getPasscodeLength(); float density = getResources().getDisplayMetrics().density; float diameter = CIRCLE_DIAMETER * density; float lineWidth = LINE_WIDTH * density; float padding = DEFAULT_PADDING * density; float spacing = CIRCLE_SPACING * density; Paint openCirclePaint = new Paint(); Paint typedCirclePaint = new Paint(); openCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); openCirclePaint.setStyle(Paint.Style.STROKE); openCirclePaint.setStrokeWidth(lineWidth); typedCirclePaint.setColor(getResources().getColor(R.color.sf__passcode_primary_color)); int circleSpacing = 0; int lengthForSpacing = passcodeLengthKnown ? passcodeLength : MAX_PASSCODE_LENGTH; float yPosition = getHeight()/2f; float startX = (getWidth() - (diameter * lengthForSpacing) - (spacing * (lengthForSpacing - 1)) + (lineWidth * lengthForSpacing * 2)) / 2; if (passcodeLengthKnown) { for (int count = 0; count < passcodeLength; count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, openCirclePaint); circleSpacing += diameter + spacing; } } else { startX = (startX > padding) ? padding : startX; } circleSpacing = 0; for (int count = 0; count < getText().length(); count++) { canvas.drawCircle(startX + circleSpacing, yPosition, diameter/2, typedCirclePaint); circleSpacing += diameter + spacing; } }
Source:
public void updateChange(ChangeContext ctx) throws OrmException, AuthException, ResourceNotFoundException { IdentifiedUser user = ctx.getUser().asIdentifiedUser(); Change change = ctx.getChange(); ChangeControl ctl = ctx.getChangeControl(); PatchSet.Id psId = change.currentPatchSetId(); PatchSetApproval psa = null; StringBuilder msg = new StringBuilder(); for (PatchSetApproval a : approvalsUtil.byPatchSetUser( ctx.getDb(), ctl, psId, accountId)) { if (ctl.canRemoveReviewer(a)) { if (a.getLabel().equals(label)) { msg.append("Removed ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(user.getAccountId()) .getNameEmail()) .append("\n"); psa = a; a.setValue((short)0); ctx.getChangeUpdate().setPatchSetId(psId); ctx.getChangeUpdate().removeApproval(label); break; } } else { throw new AuthException("delete not permitted"); } } if (psa == null) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(change.getId(), ctx.getDb()); ctx.getDb().patchSetApprovals().update(Collections.singleton(psa)); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(ctx.getDb())), user.getAccountId(), TimeUtil.nowTs(), change.currentPatchSetId()); changeMessage.setMessage(msg.toString()); cmUtil.addChangeMessage(ctx.getDb(), ctx.getChangeUpdate(), changeMessage); } }

Target:
public void updateChange(ChangeContext ctx) throws OrmException, AuthException, ResourceNotFoundException { IdentifiedUser user = ctx.getUser().asIdentifiedUser(); Change change = ctx.getChange(); ChangeControl ctl = ctx.getChangeControl(); PatchSet.Id psId = change.currentPatchSetId(); PatchSetApproval psa = null; StringBuilder msg = new StringBuilder(); for (PatchSetApproval a : approvalsUtil.byPatchSetUser( ctx.getDb(), ctl, psId, accountId)) { if (ctl.canRemoveReviewer(a)) { if (a.getLabel().equals(label)) { msg.append("Removed ") .append(a.getLabel()).append(formatLabelValue(a.getValue())) .append(" by ").append(userFactory.create(user.getAccountId()) .getNameEmail()) .append("\n"); psa = a; a.setValue((short)0); ctx.getChangeUpdate().setPatchSetId(psId); ctx.getChangeUpdate().removeApproval(label); break; } } else { throw new AuthException("delete not permitted"); } } if (psa == null) { throw new ResourceNotFoundException(); } ChangeUtil.bumpRowVersionNotLastUpdatedOn(change.getId(), ctx.getDb()); ctx.getDb().patchSetApprovals().update(Collections.singleton(psa)); if (msg.length() > 0) { ChangeMessage changeMessage = new ChangeMessage(new ChangeMessage.Key(change.getId(), ChangeUtil.messageUUID(ctx.getDb())), user.getAccountId(), ctx.getWhen(), change.currentPatchSetId()); changeMessage.setMessage(msg.toString()); cmUtil.addChangeMessage(ctx.getDb(), ctx.getChangeUpdate(), changeMessage); } }
Source:
public void onArrowSuccessfulHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Arrow && e.getEntity() instanceof LivingEntity) { if (e.getCause() == EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) return; SlimefunBow bow = projectiles.get(e.getDamager().getUniqueId()); if (bow != null) { bow.callItemHandler(BowShootHandler.class, handler -> handler.onHit(e, (LivingEntity) e.getEntity())); } projectiles.remove(e.getDamager().getUniqueId()); } }

Target:
public void onArrowSuccessfulHit(EntityDamageByEntityEvent e) { if (e.getDamager() instanceof Arrow && e.getEntity() instanceof LivingEntity && e.getCause() != EntityDamageEvent.DamageCause.ENTITY_EXPLOSION) { SlimefunBow bow = projectiles.get(e.getDamager().getUniqueId()); if (bow != null) { bow.callItemHandler(BowShootHandler.class, handler -> handler.onHit(e, (LivingEntity) e.getEntity())); } projectiles.remove(e.getDamager().getUniqueId()); } }
Source:
public static DateTime getDateTime(final String dateString) throws Exception { DateTime retval; final String pattern = "([a-z]*)[ ]*([+-]?)[ ]*([0-9]*)[ ]*([a-z]*)"; final Pattern r = Pattern.compile(pattern); final Matcher m = r.matcher(dateString); if (m.groupCount() != 4) { throw new Exception("Incorrect dateString [" + dateString + "]"); } m.find(); final String when = m.group(1).toLowerCase(); final String op = m.group(2); final Integer numberToAddOrSubstract = Integer.parseInt(m.group(3)); final String what = m.group(4); switch (when) { case "tomorrow": retval = DateTime.now().plusDays(1); break; case "yesterday": retval = DateTime.now().minusDays(1); break; case "now": case "today": retval = DateTime.now(); break; default: throw new Exception("Incorrect dateString [" + dateString + "]"); } switch (what) { case "days": if (op.equals("+")) { retval = retval.plusDays(numberToAddOrSubstract); } else { retval = retval.minusDays(numberToAddOrSubstract); } case "hours": if (op.equals("+")) { retval = retval.plusHours(numberToAddOrSubstract); } else { retval = retval.minusHours(numberToAddOrSubstract); } case "weeks": if (op.equals("+")) { retval = retval.plusWeeks(numberToAddOrSubstract); } else { retval = retval.minusWeeks(numberToAddOrSubstract); } case "months": if (op.equals("+")) { retval = retval.plusMonths(numberToAddOrSubstract); } else { retval = retval.minusMonths(numberToAddOrSubstract); } case "years": if (op.equals("+")) { retval = retval.plusYears(numberToAddOrSubstract); } else { retval = retval.minusYears(numberToAddOrSubstract); } } return retval; }

Target:
public static DateTime getDateTime(final String dateString) throws Exception { DateTime retval; final String pattern = "([a-z]*)[ ]*([+-]?)[ ]*([0-9]*)[ ]*([a-z]*)"; final Pattern r = Pattern.compile(pattern); final Matcher m = r.matcher(dateString); if (m.groupCount() != 4) { throw new Exception("Incorrect dateString [" + dateString + "]"); } m.find(); final String when = m.group(1).toLowerCase(); final String op = m.group(2); final Integer numberToAddOrSubstract = Integer.parseInt(m.group(3)); final String what = m.group(4); switch (when) { case "tomorrow": retval = DateTime.now().plusDays(1); break; case "yesterday": retval = DateTime.now().minusDays(1); break; case "now": case "today": retval = DateTime.now(); break; default: throw new Exception("Incorrect dateString [" + dateString + "]"); } if (op.equals("+")) { switch (what) { case "days": retval = retval.plusDays(numberToAddOrSubstract); case "hours": retval = retval.plusHours(numberToAddOrSubstract); case "weeks": retval = retval.plusWeeks(numberToAddOrSubstract); case "months": retval = retval.plusMonths(numberToAddOrSubstract); case "years": retval = retval.plusYears(numberToAddOrSubstract); } } else { switch (what) { case "days": retval = retval.minusDays(numberToAddOrSubstract); case "hours": retval = retval.minusHours(numberToAddOrSubstract); case "weeks": retval = retval.minusWeeks(numberToAddOrSubstract); case "months": retval = retval.minusMonths(numberToAddOrSubstract); case "years": retval = retval.minusYears(numberToAddOrSubstract); } } return retval; }
Source:
public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data, final String versionMessage ) { Constructor exceptionConstructor = null; try { exceptionConstructor = UnifiedRepositoryUpdateFileException.class.getConstructor( String.class, Throwable.class ); } catch ( NoSuchMethodException e ) { e.printStackTrace(); } return callLogThrow( new Callable<RepositoryFile>() { public RepositoryFile call() throws Exception { return delegatee.updateFile( file, data, versionMessage ); } }, Messages.getInstance().getString( "ExceptionLoggingDecorator.updateFile", file != null ? file.getId() : null ), exceptionConstructor ); }

Target:
public RepositoryFile updateFile( final RepositoryFile file, final IRepositoryFileData data, final String versionMessage ) { Constructor exceptionConstructor = null; try { exceptionConstructor = UnifiedRepositoryUpdateFileException.class.getConstructor( String.class, Throwable.class ); } catch ( NoSuchMethodException e ) { logger.error( e ); } return callLogThrow( new Callable<RepositoryFile>() { public RepositoryFile call() throws Exception { return delegatee.updateFile( file, data, versionMessage ); } }, Messages.getInstance().getString( "ExceptionLoggingDecorator.updateFile", file != null ? file.getId() : null ), exceptionConstructor ); }
Source:
private static <T extends PlanNode> Optional<T> findSinglePlanNode(StreamingSubPlan plan, Class<T> clazz) { List<PlanNode> allMatches = findPlanNodes(plan, clazz); switch (allMatches.size()) { case 0: return Optional.empty(); case 1: return Optional.of((T) getOnlyElement(allMatches)); default: throw new IllegalStateException(format("Multiple matches found for class %s", clazz)); } }

Target:
private static <T extends PlanNode> Optional<T> findSinglePlanNode(StreamingSubPlan plan, Class<T> clazz) { List<T> allMatches = findPlanNodes(plan, clazz); switch (allMatches.size()) { case 0: return Optional.empty(); case 1: return Optional.of(getOnlyElement(allMatches)); default: throw new IllegalArgumentException(format("Multiple matches found for class %s", clazz)); } }
Source:
private ValuesWriter dictWriterWithFallBack(ColumnDescriptor path, int initialSizePerCol) { ValuesWriter fallbackWriter = fallbackWriter(path, initialSizePerCol); if (enableDictionary) { return FallbackValuesWriter.of( dictionaryWriter(path, initialSizePerCol), fallbackWriter); } else { return fallbackWriter; } }

Target:
private ValuesWriter dictWriterWithFallBack(ColumnDescriptor path, int initialSizePerCol) { ValuesWriter writerToFallBackTo = writerToFallbackTo(path, initialSizePerCol); if (enableDictionary) { return FallbackValuesWriter.of( dictionaryWriter(path, initialSizePerCol), writerToFallBackTo); } else { return writerToFallBackTo; } }
Source:
private String getRSyncPath() throws IOException { ProcessBuilder builder; if (Platform.OS_WIN32.equals(Platform.getOS())) { builder = new ProcessBuilder("where", "rsync.exe"); } else { builder = new ProcessBuilder("which", "rsync"); } Process process = builder.start(); String path; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { path = reader.readLine(); } try { if (process.waitFor() == 0) { return path; } else { throw new IOException(); } } catch (InterruptedException e) { throw new IOException(e); } }

Target:
private String getRSyncPath() throws IOException { ProcessBuilder builder; builder = getProcessBuilder(); Process process = builder.start(); String path; try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { path = reader.readLine(); } try { if (process.waitFor() == 0) { return path; } else { throw new IOException(); } } catch (InterruptedException e) { throw new IOException(e); } }
Source:
public OrderingScheme map(OrderingScheme orderingScheme) { return new OrderingScheme(orderingScheme.getOrderBy().stream().map(this::map).collect(toImmutableList()), orderingScheme.getOrderings().entrySet().stream().collect(toMap(entry -> map(entry.getKey()), entry -> entry.getValue()))); }

Target:
public OrderingScheme map(OrderingScheme orderingScheme) { ImmutableList.Builder<VariableReferenceExpression> orderBy = ImmutableList.builder(); ImmutableMap.Builder<VariableReferenceExpression, SortOrder> ordering = ImmutableMap.builder(); for (VariableReferenceExpression variable : orderingScheme.getOrderBy()) { VariableReferenceExpression translated = map(variable); orderBy.add(translated); ordering.put(translated, orderingScheme.getOrdering(variable)); } return new OrderingScheme(orderBy.build(), ordering.build()); }
Source:
public void testRunNonStaticMain() throws Throwable { RunJar runJar = spy(new RunJar()); when(runJar.useClientClassLoader()).thenReturn(true); String mainCls = NonStaticMain.class.getName(); String systemClasses = "-" + mainCls + "," + ApplicationClassLoader.SYSTEM_CLASSES_DEFAULT; when(runJar.getSystemClasses()).thenReturn(systemClasses); File testJar = JarFinder.makeClassLoaderTestJar(this.getClass(), TEST_ROOT_DIR, TEST_JAR_2_NAME, BUFF_SIZE, mainCls); String[] args = new String[3]; args[0] = testJar.getAbsolutePath(); args[1] = mainCls; try { runJar.run(args); fail("run should throw IOException."); } catch (IOException e) { GenericTestUtils.assertExceptionContains("Method main must be static", e); } }

Target:
public void testRunNonStaticMain() throws Throwable { RunJar runJar = spy(new RunJar()); when(runJar.useClientClassLoader()).thenReturn(true); String mainCls = NonStaticMain.class.getName(); String systemClasses = "-" + mainCls + "," + ApplicationClassLoader.SYSTEM_CLASSES_DEFAULT; when(runJar.getSystemClasses()).thenReturn(systemClasses); File testJar = JarFinder.makeClassLoaderTestJar(this.getClass(), TEST_ROOT_DIR, TEST_JAR_2_NAME, BUFF_SIZE, mainCls); String[] args = new String[] {testJar.getAbsolutePath(), mainCls}; try { runJar.run(args); fail("run should throw IOException."); } catch (IOException e) { GenericTestUtils.assertExceptionContains("Method main must be static", e); } }
Source:
private boolean isLastDayOfMonth(Calendar calendar) { calendar.set(Calendar.DATE, (calendar.get(Calendar.DATE) + 1)); if (calendar.get(Calendar.DAY_OF_MONTH) == 1) { return true; } return false; }

Target:
private boolean isLastDayOfMonth(Calendar calendar) { calendar.set(Calendar.DATE, (calendar.get(Calendar.DATE) + 1)); return calendar.get(Calendar.DAY_OF_MONTH) == 1; }
Source:
private static List<? extends KeyFormat<?>> createPersistenceList(int size) { List<SimpleKeyFormat<Type>> list = new ArrayList<>(); for (int index = 0; index < size; index++) { SimpleKeyFormat<Type> typeSimpleKeyFormat = new SimpleKeyFormat<>((Class<Type>) Type.values()[index].getClass(), value -> Type.valueOf(value), Type::name); list.add(typeSimpleKeyFormat); } return list; }

Target:
private static List<? extends KeyFormat<?>> createPersistenceList(int size) { return java.util.stream.IntStream.range(0, size).mapToObj(index -> new SimpleKeyFormat<>((Class<Type>) Type.values()[index].getClass(), value -> Type.valueOf(value), Type::name)).collect(Collectors.toList()); }
Source:
public final Object invoke(Object proxy, Method invoked, @Nullable Object[] argv) throws Throwable { if (argv == null) { argv = NO_ARGS; } if (argv.length == 0 && invoked.getName().equals("hashCode")) { return hashCode(); } if (argv.length == 1 && invoked.getName().equals("equals") && invoked.getParameterTypes()[0] == Object.class) { Object arg = argv[0]; return proxy.getClass().isInstance(arg) && equals(Proxy.getInvocationHandler(arg)); } if (argv.length == 0 && invoked.getName().equals("toString")) { return toString(); } List<Object> args = Arrays.asList(argv); if (all(args, notNull())) args = ImmutableList.copyOf(args); else args = Collections.unmodifiableList(args); Invokable<?, Object> invokable = method(ownerType, invoked); Invocation invocation = Invocation.create(invokable, args); try { return handle(invocation, invoked); } catch (Throwable e) { propagateIfPossible(e, invocation.getInvokable().getExceptionTypes()); throw e; } }

Target:
public final Object invoke(Object proxy, Method invoked, @Nullable Object[] argv) throws Throwable { if (argv == null) { argv = NO_ARGS; } if (argv.length == 0 && invoked.getName().equals("hashCode")) { return hashCode(); } if (argv.length == 1 && invoked.getName().equals("equals") && invoked.getParameterTypes()[0] == Object.class) { Object arg = argv[0]; return proxy.getClass().isInstance(arg) && equals(Proxy.getInvocationHandler(arg)); } if (argv.length == 0 && invoked.getName().equals("toString")) { return toString(); } List<Object> args = Arrays.asList(argv); if (all(args, notNull())) args = ImmutableList.copyOf(args); else args = Collections.unmodifiableList(args); Invokable<?, Object> invokable = method(ownerType, invoked); Invocation invocation = Invocation.create(invokable, args); try { return handle(invocation); } catch (Throwable e) { propagateIfPossible(e, invocation.getInvokable().getExceptionTypes()); throw e; } }
Source:
public Date getEndDate() { return endDate != null ? (Date) endDate.clone() : new Date(); }

Target:
public Date getEndDate() { return endDate != null ? (Date) endDate.clone() : null; }