auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Connection openConnection() { try { MysqlDataSource dataSource = new MysqlDataSource(); dataSource.setServerName(data.get(0)); dataSource.setPort(Integer.parseInt(data.get(1))); dataSource.setDatabaseName(data.get(2)); dataSource.setUser(data.get(3)); dataSource.setPassword(data.get(4)); conn = dataSource.getConnection(); stat = conn.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return conn; }

Target:
private Connection openConnection() { try { connection = dataSource.getConnection(); statement = connection.createStatement(); } catch (SQLException e) { e.printStackTrace(); } return connection; }
Source:
public void powerDown() { rest(); purgeTasks(); disable(); if (ear != null) { ear.lockOutAllGrammarExcept("wake up"); } startSleep = System.currentTimeMillis(); python.execMethod("power_down"); }

Target:
public void powerDown() { rest(); purgeTasks(); disable(); if (ear != null) { ear.lockOutAllGrammarExcept("power up"); } startSleep = System.currentTimeMillis(); python.execMethod("power_down"); }
Source:
public static void main(String[] args) throws Exception { if (args.length < 5) { System.err.println("Usage: SimpePageRank <DOP> <pageWithRankInputPath> <adjacencyListInputPath> <outputPath> <numIterations>"); return; } final int dop = Integer.parseInt(args[0]); final String pageWithRankInputPath = args[1]; final String adjacencyListInputPath = args[2]; final String outputPath = args[3]; final int numIterations = Integer.parseInt(args[4]); run(dop, pageWithRankInputPath, adjacencyListInputPath, outputPath, numIterations, true); }

Target:
public static void main(String[] args) throws Exception { if (args.length < 5) { System.err.println("Usage: SimpePageRank <DOP> <pageWithRankInputPath> <adjacencyListInputPath> <outputPath> <numIterations>"); return; } final int dop = Integer.parseInt(args[0]); final String pageWithRankInputPath = args[1]; final String adjacencyListInputPath = args[2]; final String outputPath = args[3]; final int maxIterations = Integer.parseInt(args[4]); run(dop, pageWithRankInputPath, adjacencyListInputPath, outputPath, maxIterations, true); }
Source:
private TypeSubstitution inferTypeSubstitutionRec(MethodJavaSymbol method, List<JavaType> formals, List<JavaType> argTypes) { boolean isVarArgs = method.isVarArgs(); int numberFormals = formals.size(); int numberArgs = argTypes.size(); int numberParamToCheck = Math.min(numberFormals, numberArgs); List<JavaType> newArgTypes = new ArrayList<>(argTypes); TypeSubstitution substitution = new TypeSubstitution(); if (isVarArgs && numberFormals == numberArgs + 1) { numberParamToCheck += 1; newArgTypes.add(symbols.objectType); } for (int i = 0; i < numberParamToCheck; i++) { JavaType formalType = formals.get(i); JavaType argType = newArgTypes.get(i); boolean variableArity = isVarArgs && i == (numberFormals - 1); List<JavaType> remainingArgTypes = new ArrayList<>(newArgTypes.subList(i, newArgTypes.size())); substitution = inferTypeSubstitution(method, substitution, formalType, argType, variableArity, remainingArgTypes); if (substitution.unchecked || (!method.isConstructor() && substitution.typeVariables().containsAll(method.typeVariableTypes))) { break; } } return substitution; }

Target:
private TypeSubstitution inferTypeSubstitutionRec(MethodJavaSymbol method, List<JavaType> formals, List<JavaType> argTypes) { boolean isVarArgs = method.isVarArgs(); int numberFormals = formals.size(); int numberArgs = argTypes.size(); int numberParamToCheck = Math.min(numberFormals, numberArgs); List<JavaType> newArgTypes = new ArrayList<>(argTypes); TypeSubstitution substitution = new TypeSubstitution(); if (isVarArgs && numberFormals == numberArgs + 1) { numberParamToCheck += 1; newArgTypes.add(symbols.objectType); } for (int i = 0; i < numberParamToCheck; i++) { JavaType formalType = formals.get(i); JavaType argType = newArgTypes.get(i); boolean variableArity = isVarArgs && i == (numberFormals - 1); List<JavaType> remainingArgTypes = new ArrayList<>(newArgTypes.subList(i, newArgTypes.size())); substitution = inferTypeSubstitution(method, substitution, formalType, argType, variableArity, remainingArgTypes); if (substitution.isUnchecked() || (!method.isConstructor() && substitution.typeVariables().containsAll(method.typeVariableTypes))) { break; } } return substitution; }
Source:
protected void initClusterInvalidator(DBSRepositoryDescriptor descriptor) { String nodeId = descriptor.clusterNodeId; if (StringUtils.isBlank(nodeId)) { nodeId = String.valueOf(RANDOM.nextInt(32768)); log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: " + nodeId); } else { nodeId = nodeId.trim(); } clusterInvalidator = createClusterInvalidator(descriptor); clusterInvalidator.initialize(nodeId, this); }

Target:
protected void initClusterInvalidator(DBSRepositoryDescriptor descriptor) { String nodeId = descriptor.clusterNodeId; if (StringUtils.isBlank(nodeId)) { nodeId = String.valueOf(RANDOM.nextInt(Integer.MAX_VALUE)); log.warn("Missing cluster node id configuration, please define it explicitly " + "(usually through repository.clustering.id). Using random cluster node id instead: " + nodeId); } else { nodeId = nodeId.trim(); } clusterInvalidator = createClusterInvalidator(descriptor); clusterInvalidator.initialize(nodeId, this); }
Source:
void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void removeEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; void setEventTypeDeleted(String name) throws InternalNakadiException, NoSuchEventTypeException; default Optional<EventType> findByNameO(final String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (final NoSuchEventTypeException e) { return Optional.empty(); } catch (final InternalNakadiException e) { throw e; } }

Target:
void saveEventType(EventType eventType) throws InternalNakadiException, DuplicatedEventTypeNameException; EventType findByName(String name) throws InternalNakadiException, NoSuchEventTypeException; void update(EventType eventType) throws InternalNakadiException, NoSuchEventTypeException; List<EventType> list(); void archiveEventType(String name) throws InternalNakadiException, NoSuchEventTypeException; default Optional<EventType> findByNameO(final String eventTypeName) throws InternalNakadiException { try { return Optional.of(findByName(eventTypeName)); } catch (final NoSuchEventTypeException e) { return Optional.empty(); } catch (final InternalNakadiException e) { throw e; } }
Source:
public int hashCode() { return set.hashCode(); }

Target:
public int hashCode() { return set.get() * 3559; }
Source:
public String getShareUrl(String id, String title) { return null; }

Target:
public String getShareUrl(String id, String title) { return getApiUrl() + "&view=detail&id=" + id; }
Source:
void retry() throws JMSConnectorException { logger.error("Re-connection will be attempted after " + retryInterval + " milli-seconds."); try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } while (retryCount < maxRetryCount) { try { retryCount++; jmsServerConnector.createMessageListener(); logger.info("Connected to the message broker after retrying for " + retryCount + " time(s)"); return; } catch (JMSConnectorException ex) { if (null != jmsServerConnector.getConnection()) { jmsServerConnector.closeAll(); throw new JMSConnectorException("JMS Connection succeeded but exception has occurred while " + "creating, session or consumer from the connection"); } jmsServerConnector.closeAll(); if (retryCount < maxRetryCount) { logger.error("Retry connection attempt " + retryCount + " to JMS Provider failed. Retry will be " + "attempted "); retryInterval = retryInterval * 2; try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } throw new JMSConnectorException( "Connection to the jms provider failed after retrying for " + retryCount + " times"); }

Target:
void retry() throws JMSConnectorException { if (logger.isDebugEnabled()) { logger.debug("Re-connection will be attempted after " + retryInterval + " milli-seconds."); } try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } while (retryCount < maxRetryCount) { try { retryCount++; jmsServerConnector.createMessageListener(); logger.info("Connected to the message broker after retrying for " + retryCount + " time(s)"); return; } catch (JMSConnectorException ex) { if (null != jmsServerConnector.getConnection()) { jmsServerConnector.closeAll(); throw new JMSConnectorException("JMS Connection succeeded but exception has occurred while " + "creating, session or consumer from the connection"); } jmsServerConnector.closeAll(); if (retryCount < maxRetryCount) { logger.error("Retry connection attempt " + retryCount + " to JMS Provider failed. Retry will be " + "attempted "); retryInterval = retryInterval * 2; try { TimeUnit.MILLISECONDS.sleep(retryInterval); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } } } throw new JMSConnectorException( "Connection to the jms provider failed after retrying for " + retryCount + " times"); }
Source:
private void addBondOptionIfMissing(String candidateOption, boolean doesBondHaveVmNetworkAttached) { if (doesBondHaveVmNetworkAttached && BondMode.isBondModeValidForVmNetwork(candidateOption)){ return; } if (!pairForBondOption.containsKey(candidateOption)) { EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(candidateOption); Entry<String, EntityModel<String>> newPair = new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel); bondOptions.add(newPair); pairForBondOption.put(candidateOption, newPair); } }

Target:
private void addBondOptionIfMissing(String candidateOption, boolean doesBondHaveVmNetworkAttached) { if (doesBondHaveVmNetworkAttached && !BondMode.isBondModeValidForVmNetwork(candidateOption)){ return; } if (!pairForBondOption.containsKey(candidateOption)) { EntityModel<String> entityModel = new EntityModel<String>(); entityModel.setEntity(candidateOption); Entry<String, EntityModel<String>> newPair = new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel); bondOptions.add(newPair); pairForBondOption.put(candidateOption, newPair); } }
Source:
private <T> T queryStringWithParameters(Map<String, Object> params, boolean singleResult, LockModeType lockMode, Class<T> clazz, Query query) { ; if (lockMode != null) { query.setLockMode(lockMode); } if (params != null && !params.isEmpty()) { for (String name : params.keySet()) { if (FIRST_RESULT.equals(name)) { query.setFirstResult((Integer) params.get(name)); continue; } else if (MAX_RESULTS.equals(name)) { if (((Integer) params.get(name)) > -1) { query.setMaxResults((Integer) params.get(name)); } continue; } else if (QueryManager.ASCENDING_KEY.equals(name) || QueryManager.DESCENDING_KEY.equals(name) || QueryManager.ORDER_BY_KEY.equals(name) || QueryManager.FILTER.equals(name)) { continue; } query.setParameter(name, params.get(name)); } } if (singleResult) { return (T) query.getSingleResult(); } return (T) query.getResultList(); }

Target:
private <T> T queryStringWithParameters(Map<String, Object> params, boolean singleResult, LockModeType lockMode, Class<T> clazz, Query query) { if (lockMode != null) { query.setLockMode(lockMode); } if (params != null && !params.isEmpty()) { for (String name : params.keySet()) { if (FIRST_RESULT.equals(name)) { query.setFirstResult((Integer) params.get(name)); continue; } else if (MAX_RESULTS.equals(name)) { if (((Integer) params.get(name)) > -1) { query.setMaxResults((Integer) params.get(name)); } continue; } else if (QueryManager.ASCENDING_KEY.equals(name) || QueryManager.DESCENDING_KEY.equals(name) || QueryManager.ORDER_BY_KEY.equals(name) || QueryManager.FILTER.equals(name)) { continue; } query.setParameter(name, params.get(name)); } } if (singleResult) { return (T) query.getSingleResult(); } return (T) query.getResultList(); }
Source:
public Gauge registerOrGet(Class clazz, String metricName, Gauge gauge, Map<String, String> tag) { MetricName metricToAdd = MetricName.builder() .safeName(MetricRegistry.name(clazz, metricName)) .safeTags(tag) .build(); try { return taggedMetricRegistry.gauge(metricToAdd, gauge); } catch (IllegalArgumentException ex) { log.warn("Tried to add a gauge to a metric name that has non-gauge metrics associated with it." + " This indicates a product bug.", SafeArg.of("metricName", metricName), ex); return gauge; } }

Target:
public Gauge registerOrGet(Class clazz, String metricName, Gauge gauge, Map<String, String> tag) { MetricName metricToAdd = MetricName.builder() .safeName(MetricRegistry.name(clazz, metricName)) .safeTags(tag) .build(); try { return taggedMetricRegistry.gauge(metricToAdd, gauge); } catch (IllegalArgumentException ex) { log.error("Tried to add a gauge to a metric name that has non-gauge metrics associated with it." + " This indicates a product bug.", SafeArg.of("metricName", metricName), ex); throw ex; } }
Source:
private void attachRecyclerViewAdapter() { mAdapter = new FirebaseIndexRecyclerAdapter<Chat, ChatHolder>( Chat.class, R.layout.message, ChatHolder.class, mChatIndicesRef.limitToLast(50), mChatRef) { @Override public void populateViewHolder(final ChatHolder holder, Chat chat, int position) { holder.bind(chat); holder.itemView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() { @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.add("Delete") .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { DatabaseReference ref = getRef(holder.getAdapterPosition()); mChatIndicesRef.child(ref.getKey()).removeValue(); ref.removeValue(); return true; } }); } }); } @Override public void onChildChanged(EventType type, DataSnapshot snapshot, int index, int oldIndex) { super.onChildChanged(type, snapshot, index, oldIndex); onDataChanged(); } @Override public void onDataChanged() { mEmptyListMessage.setVisibility(getItemCount() == 0 ? View.VISIBLE : View.GONE); } }; mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { mManager.smoothScrollToPosition(mMessages, null, mAdapter.getItemCount()); } }); mMessages.setAdapter(mAdapter); }

Target:
private void attachRecyclerViewAdapter() { mAdapter = getAdapter(); mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onItemRangeInserted(int positionStart, int itemCount) { mManager.smoothScrollToPosition(mMessages, null, mAdapter.getItemCount()); } }); mMessages.setAdapter(mAdapter); }
Source:
public SegmentReader(String cursorId) { m_cursorId = cursorId; }

Target:
public SegmentReader(String cursorId) { assert(cursorId != null); m_cursorId = cursorId; }
Source:
public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException { String resourceWorkSpaceName = null; CatalogInfo resourceInfo = event.getSource(); String resourceName = null; if (resourceInfo != null && resourceInfo instanceof LayerInfo) { resourceWorkSpaceName = ((LayerInfo) resourceInfo).getResource().getStore().getWorkspace().getName(); resourceName = ((LayerInfo) resourceInfo).getName(); } else if (resourceInfo != null && event.getSource() instanceof LayerGroupInfo) { resourceWorkSpaceName = ((LayerGroupInfo) resourceInfo).getWorkspace().getName(); resourceName = ((LayerGroupInfo) resourceInfo).getName(); } if (resourceWorkSpaceName != null && resourceInfo != null) { if (layerHasSecurityRule(resourceWorkSpaceName, resourceName)) { LOGGER.info( String.format( "Removing Security Rules for removed layer: %s", resourceName)); List<DataAccessRule> rulesToRemove = getDataAccessRule(resourceInfo, resourceName); for (DataAccessRule r : rulesToRemove) { dao.removeRule(r); } } } }

Target:
public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException { String resourceWorkSpaceName = null; CatalogInfo resourceInfo = event.getSource(); String resourceName = null; if (resourceInfo instanceof LayerInfo) { resourceWorkSpaceName = ((LayerInfo) resourceInfo).getResource().getStore().getWorkspace().getName(); resourceName = ((LayerInfo) resourceInfo).getName(); } else if (event.getSource() instanceof LayerGroupInfo) { resourceWorkSpaceName = ((LayerGroupInfo) resourceInfo).getWorkspace().getName(); resourceName = ((LayerGroupInfo) resourceInfo).getName(); } if (resourceWorkSpaceName != null && resourceInfo != null) { if (layerHasSecurityRule(resourceWorkSpaceName, resourceName)) { LOGGER.info( String.format( "Removing Security Rules for removed layer: %s", resourceName)); List<DataAccessRule> rulesToRemove = getDataAccessRule(resourceInfo, resourceName); for (DataAccessRule r : rulesToRemove) { dao.removeRule(r); } } } }
Source:
private boolean sendWants(final Collection<Ref> want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true; for (final Ref r : want) { ObjectId objectId = r.getObjectId(); if (objectId == null) { throw new TransportException(MessageFormat .format(JGitText.get().cannotRead, r.getName())); } try { if (walk.parseAny(objectId).has(REACHABLE)) { continue; } } catch (IOException err) { } final StringBuilder line = new StringBuilder(46); line.append("want "); line.append(objectId.name()); if (first) { line.append(enableCapabilities()); first = false; } line.append('\n'); p.writeString(line.toString()); } if (first) return false; p.end(); outNeedsEnd = false; return true; }

Target:
private boolean sendWants(final Collection<Ref> want) throws IOException { final PacketLineOut p = statelessRPC ? pckState : pckOut; boolean first = true; for (final Ref r : want) { ObjectId objectId = r.getObjectId(); if (objectId == null) { continue; } try { if (walk.parseAny(objectId).has(REACHABLE)) { continue; } } catch (IOException err) { } final StringBuilder line = new StringBuilder(46); line.append("want "); line.append(objectId.name()); if (first) { line.append(enableCapabilities()); first = false; } line.append('\n'); p.writeString(line.toString()); } if (first) return false; p.end(); outNeedsEnd = false; return true; }
Source:
public AccurevSCM(String serverName, String depot, String stream) { this.depot = depot; this.stream = stream; AccurevServer server = getDescriptor().getServer(serverName); if (server != null) { setServerName(server.getName()); setServerUUID(server.getUuid()); } updateMode(); }

Target:
public AccurevSCM(String serverName, String depot, String stream) { this(serverName, null, depot, stream); }
Source:
public void updatePartitionsConfiguration(final Partition[] partitions) { try { final Topology topology = readTopology(); final Topology newTopology = topology.withUpdatedPartitions(partitions); getCurator().setData().forPath( getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(newTopology)); } catch (final Exception ex) { throw new NakadiRuntimeException(ex); } }

Target:
public void updatePartitionsConfiguration(final Partition[] partitions) throws NakadiRuntimeException { try { final Topology topology = readTopology(); final Topology newTopology = topology.withUpdatedPartitions(partitions); getCurator().setData().forPath( getSubscriptionPath(NODE_TOPOLOGY), objectMapper.writeValueAsBytes(newTopology)); } catch (final Exception ex) { throw new NakadiRuntimeException(ex); } }
Source:
public Response intercept(Chain chain) throws IOException { Response response = chain.proceed(chain.request()); if (response.isSuccessful()) { String deprecationHeader = response.header("deprecation"); if (deprecationHeader != null) { log.warn("Using a deprecated endpoint when connecting to service", SafeArg.of("serviceClass", serviceClassName), SafeArg.of("service", response.header("server", "no server header provided"))); } } return response; }

Target:
public Response intercept(Chain chain) throws IOException { Response response = chain.proceed(chain.request()); String deprecationHeader = response.header("deprecation"); if (deprecationHeader != null) { clientMetrics.deprecations(serviceClassName).mark(); if (loggingRateLimiter.tryAcquire(1)) { log.warn( "Using a deprecated endpoint when connecting to service", SafeArg.of("serviceClass", serviceClassName), SafeArg.of("service", response.header("server", "no server header provided"))); } } return response; }
Source:
public ParseErrorMessage(int lineNumber, String messageKey, Object... messageArguments) { this.lineNumber = lineNumber; this.messageKey = messageKey; this.messageArguments = messageArguments.clone(); }

Target:
ParseErrorMessage(int lineNumber, String messageKey, Object... messageArguments) { this.lineNumber = lineNumber; this.messageKey = messageKey; this.messageArguments = messageArguments.clone(); }
Source:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } fIncrement = Boolean.valueOf(node.getAttribute(TmfXmlStrings.INCREMENT)); fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ValueForcedType.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ValueForcedType.INT; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ValueForcedType.LONG; break; default: fForcedType = ValueForcedType.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); switch (stack) { case TmfXmlStrings.STACK_PUSH: fStack = ValueTypeStack.PUSH; break; case TmfXmlStrings.STACK_POP: fStack = ValueTypeStack.POP; break; case TmfXmlStrings.STACK_PEEK: fStack = ValueTypeStack.PEEK; break; default: fStack = ValueTypeStack.NULL; } }

Target:
protected TmfXmlStateValue(ITmfXmlModelFactory modelFactory, Element node, IXmlStateSystemContainer container, List<ITmfXmlStateAttribute> attributes, String eventField) { fPath = attributes; fContainer = container; fEventField = eventField; if (!node.getNodeName().equals(TmfXmlStrings.STATE_VALUE)) { throw new IllegalArgumentException("TmfXmlStateValue constructor: Element is not a stateValue"); } fIncrement = Boolean.valueOf(node.getAttribute(TmfXmlStrings.INCREMENT)); fStateValue = initializeStateValue(modelFactory, node); switch (node.getAttribute(TmfXmlStrings.FORCED_TYPE)) { case TmfXmlStrings.TYPE_STRING: fForcedType = ValueForcedType.STRING; break; case TmfXmlStrings.TYPE_INT: fForcedType = ValueForcedType.INT; break; case TmfXmlStrings.TYPE_LONG: fForcedType = ValueForcedType.LONG; break; default: fForcedType = ValueForcedType.NULL; } String stack = node.getAttribute(TmfXmlStrings.ATTRIBUTE_STACK); switch (stack) { case TmfXmlStrings.STACK_PUSH: fStackType = ValueTypeStack.PUSH; break; case TmfXmlStrings.STACK_POP: fStackType = ValueTypeStack.POP; break; case TmfXmlStrings.STACK_PEEK: fStackType = ValueTypeStack.PEEK; break; default: fStackType = ValueTypeStack.NULL; } }
Source:
protected void writeListProperty(Property entity, CSVPrinter printer) throws IOException { ListType type = (ListType) entity.getType(); if (entity instanceof ArrayProperty) { Object[] array = (Object[]) entity.getValue(); if (array == null) { printer.print(null); return; } Type itemType = type.getFieldType(); if (itemType instanceof BinaryType) { writeUnsupported(type, printer); } else { String value = Arrays.stream(array).map(itemType::encode).collect(Collectors.joining(LIST_DELIMITER)); printer.print(value); ObjectResolver resolver = itemType.getObjectResolver(); if (resolver instanceof DirectoryEntryResolver) { List<String> translated = new ArrayList<>(); DirectoryEntryResolver directoryEntryResolver = (DirectoryEntryResolver) resolver; Directory directory = directoryEntryResolver.getDirectory(); if (VOCABULARY_TYPES.contains(directory.getSchema())) { try (Session session = directory.getSession()) { String lang = ctx.getParameter(LANG_CTX_DATA); for (Object obj : array) { String label = (String) session.getEntry(itemType.encode(obj)) .getProperty(directory.getSchema(), "label"); Locale locale = lang != null ? Locale.forLanguageTag(lang) : ctx.getLocale(); translated.add(I18NUtils.getMessageString("messages", label, new Object[0], locale)); } } } printer.print(translated.stream().collect(Collectors.joining(LIST_DELIMITER))); } } } else { writeUnsupported(type, printer); } }

Target:
protected void writeListProperty(Property entity, CSVPrinter printer) throws IOException { ListType type = (ListType) entity.getType(); if (entity instanceof ArrayProperty) { Object[] array = (Object[]) entity.getValue(); if (array == null) { printer.print(null); return; } Type itemType = type.getFieldType(); if (itemType instanceof BinaryType) { writeUnsupported(type, printer); } else { String value = Arrays.stream(array).map(itemType::encode).collect(Collectors.joining(LIST_DELIMITER)); printer.print(value); Directory vocabulary = DocumentModelCSVHelper.getVocabulary(itemType); if (vocabulary != null) { String[] values = Arrays.stream(array).map(itemType::encode).toArray(String[]::new); writeListVocabularyProperty(values, vocabulary, printer); } } } else { writeUnsupported(type, printer); } }
Source:
public void onEvent(Event event, Object source, Object data) { boolean xObjectFound; for (PageNotificationEventDescriptor descriptor : pageNotificationEventDescriptorContainer.getDescriptorList()) { if (descriptor.getEventTrigger().contains(event.getClass().getCanonicalName())) { XWikiDocument document = (XWikiDocument) source; Map<DocumentReference, List<BaseObject>> documentXObjects = document.getXObjects(); xObjectFound = false; for (DocumentReference documentReference : documentXObjects.keySet()) { if (this.checkXObject(documentReference, descriptor)) { xObjectFound = true; break; } } if (xObjectFound && this.evaluateVelocityTemplate(descriptor.getAuthorReference(), descriptor.getValidationExpression())) { observationManager.notify( new PageNotificationEvent(descriptor), "org.xwiki.platform:xwiki-platform-notifications-api", document); } } } }

Target:
public void onEvent(Event event, Object source, Object data) { for (PageNotificationEventDescriptor descriptor : pageNotificationEventDescriptorManager.getDescriptors()) { if (descriptor.getEventTriggers().contains(event.getClass().getCanonicalName()) && checkXObjectCondition(descriptor, source) && this.evaluateVelocityTemplate(descriptor.getAuthorReference(), descriptor.getValidationExpression())) { observationManager.notify( new PageNotificationEvent(descriptor), "org.xwiki.platform:xwiki-platform-notifications-api", source); } } }
Source:
private void removeInvalidRoles() { if (getParameters().getUserToRoles() == null || getParameters().getUserToRoles().isEmpty() || getParameters().getRoleMap() == null) { return; } Set<String> roles = new HashSet<>(getParameters().getRoleMap().values()); roles.addAll(getParameters().getRoleMap().keySet()); log.info("Checking for missing roles"); missingRoles = getImportValidator().findMissingEntities(roles, val -> roleDao.getByName(val)); getParameters().getUserToRoles().forEach((k, v) -> v.removeAll(missingRoles)); }

Target:
private void removeInvalidRoles() { if (MapUtils.isEmpty(getParameters().getUserToRoles()) || MapUtils.isEmpty(getParameters().getRoleMap())) { return; } Set<String> roles = new HashSet<>(getParameters().getRoleMap().values()); roles.addAll(getParameters().getRoleMap().keySet()); log.info("Checking for missing roles"); missingRoles = getImportValidator().findMissingEntities(roles, val -> roleDao.getByName(val)); getParameters().getUserToRoles().forEach((k, v) -> v.removeAll(missingRoles)); }
Source:
private void addEnvironmentParameters(final Map<String, Object> items) { for (final Map.Entry<String, Object> item : items.entrySet()) { String key = item.getKey(); if (key.startsWith("secure:")) { repo.addEnvironmentParameter(key.substring(key.indexOf("secure:")), secureService.decrypt(item.getValue().toString())); } else { repo.addEnvironmentParameter(key, item.getValue()); } } }

Target:
private void addEnvironmentParameters(final Map<String, Object> items) { for (final Map.Entry<String, Object> item : items.entrySet()) { String key = item.getKey(); if (key.startsWith(SECURE_PREFIX)) { repo.addEnvironmentParameter(key.substring(key.indexOf(SECURE_PREFIX)), secureService.decrypt(item.getValue().toString())); } else { repo.addEnvironmentParameter(key, item.getValue()); } } }
Source:
public void javaDoc(){ assertTrue("Groovy project doesn't exist.", Eclim.projectExists(Groovy.TEST_PROJECT)); int count = getJavaDocCount("true"); int minimalCount = 50; Assert.assertTrue("We received some JavaDoc links", count > minimalCount); }

Target:
public void javaDoc(){ assertTrue("Groovy project doesn't exist.", Eclim.projectExists(Groovy.TEST_PROJECT)); int count = getJavaDocCount("anything"); assertJavaDocPresent(count); }
Source:
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { if (!((FasterPaymentsAccountPayload) paymentAccountPayload).getHolderName().isEmpty()) { addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), ((FasterPaymentsAccountPayload) paymentAccountPayload).getHolderName()); } addCompactTopLabelTextField(gridPane, ++gridRow, UK_SORT_CODE, ((FasterPaymentsAccountPayload) paymentAccountPayload).getSortCode()); addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.accountNr"), ((FasterPaymentsAccountPayload) paymentAccountPayload).getAccountNr()); return gridRow; }

Target:
public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload paymentAccountPayload) { if (!((FasterPaymentsAccountPayload) paymentAccountPayload).getHolderName().isEmpty()) { addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("payment.account.owner"), ((FasterPaymentsAccountPayload) paymentAccountPayload).getHolderName()); } addCompactTopLabelTextField(gridPane, ++gridRow, UK_SORT_CODE, ((FasterPaymentsAccountPayload) paymentAccountPayload).getSortCode()); addCompactTopLabelTextField(gridPane, gridRow, 1, Res.get("payment.accountNr"), ((FasterPaymentsAccountPayload) paymentAccountPayload).getAccountNr()); return gridRow; }
Source:
protected Map<?,?> getCustomChildFlags() { return ImmutableMap.builder() .putAll(super.getCustomChildFlags()) .put(MongoDBServer.REPLICA_SET_ENABLED, true) .put(MongoDBServer.REPLICA_SET, this) .build(); }

Target:
protected Map<?,?> getCustomChildFlags() { return ImmutableMap.builder() .putAll(super.getCustomChildFlags()) .put(MongoDBServer.REPLICA_SET, getProxy()) .build(); }
Source:
public BlockManagementTaskResult() { mBlockOpResults = new Hashtable<>(); }

Target:
public BlockManagementTaskResult() { mBlockOpResults = new HashMap<>(); }
Source:
public static LiteralExpression newConstant(Object value, PDataType type) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new SQLException("Type mismatch: " + type + " and " + actualType + " for " + value); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value); if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b); } catch (IllegalDataException e) { throw SQLExceptionInfo.getNewInfoObject(SQLExceptionCodeEnum.ILLEGAL_DATA).genWrappedException(e); } }

Target:
public static LiteralExpression newConstant(Object value, PDataType type) throws SQLException { if (value == null) { if (type == null) { return NULL_EXPRESSION; } return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } PDataType actualType = PDataType.fromLiteral(value); if (!actualType.isCoercibleTo(type, value)) { throw new TypeMismatchException(type, actualType, value.toString()); } value = type.toObject(value, actualType); try { byte[] b = type.toBytes(value); if (b.length == 0) { return TYPED_NULL_EXPRESSIONS[type.ordinal()]; } return new LiteralExpression(value, type, b); } catch (IllegalDataException e) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.ILLEGAL_DATA).setRootCause(e).build().buildException(); } }
Source:
public Response getAccountEmailAuditLogsWithHistory(@PathParam("accountId") final UUID accountId, @PathParam("accountEmailId") final UUID accountEmailId, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException { final TenantContext tenantContext = context.createTenantContextWithAccountId(accountId, request); final List<AuditLogWithHistory> auditLogWithHistory = accountUserApi.getEmailAuditLogsWithHistoryForId(accountId, accountEmailId, AuditLevel.FULL, tenantContext); return Response.status(Status.OK).entity(getAuditLogsWithHistory(auditLogWithHistory)).build(); }

Target:
public Response getAccountEmailAuditLogsWithHistory(@PathParam("accountId") final UUID accountId, @PathParam("accountEmailId") final UUID accountEmailId, @javax.ws.rs.core.Context final HttpServletRequest request) throws AccountApiException { final TenantContext tenantContext = context.createTenantContextWithAccountId(accountId, request); final List<AuditLogWithHistory> auditLogWithHistory = accountUserApi.getEmailAuditLogsWithHistoryForId(accountEmailId, AuditLevel.FULL, tenantContext); return Response.status(Status.OK).entity(getAuditLogsWithHistory(auditLogWithHistory)).build(); }
Source:
public String transform(String value) { LocalAuthPasswordValidator.validatePassword(value, jsonMapper); if (StringUtils.isBlank(value)){ return ""; } return hash(value); }

Target:
public String transform(String value) { if (StringUtils.isBlank(value)){ return ""; } return hash(value); }
Source:
private Builder(ReadSupport<T> readSupport, Path path) { this.readSupport = Objects.requireNonNull(readSupport, "readSupport"); this.file = null; this.path = Objects.requireNonNull(path, "path cannot be null"); this.conf = new Configuration(); this.optionsBuilder = HadoopReadOptions.builder(conf); }

Target:
private Builder(ReadSupport<T> readSupport, Path path) { this.readSupport = Objects.requireNonNull(readSupport, "readSupport cannot be null"); this.file = null; this.path = Objects.requireNonNull(path, "path cannot be null"); this.conf = new Configuration(); this.optionsBuilder = HadoopReadOptions.builder(conf); }
Source:
public void testGenotypePhenotypeSearchFeaturePagingMore() throws AvroRemoteException { SearchGenotypePhenotypeRequest request = SearchGenotypePhenotypeRequest.newBuilder().build(); request.setFeature("KIT *wild"); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotype(request); assertThat(response).isNotNull(); assertThat(response.getAssociations()).isNotNull() ; assertThat(response.getAssociations().size()).isGreaterThan(1); }

Target:
public void testGenotypePhenotypeSearchFeaturePagingMore() throws AvroRemoteException { SearchGenotypePhenotypeRequest request = SearchGenotypePhenotypeRequest.newBuilder().build(); request.setFeature(TestData.FEATURE_NAME); SearchGenotypePhenotypeResponse response = client.genotypePhenotype.searchGenotypePhenotype(request); assertThat(response.getAssociations()).isNotNull() ; assertThat(response.getAssociations().size()).isGreaterThan(1); }
Source:
int computeWidthDifference (GtkRequisition requisition, int width) { int diffwidth; diffwidth = requisition.width - width; if (width - diffwidth < 0) { return requisition.width; } else { return width; } }

Target:
int computeWidthDifference (GtkRequisition requisition, int width) { return (requisition.width - width) < 0 ? requisition.width : width; }
Source:
public void mustEvictCleanPageWithoutFlushing() throws Exception { writeInitialDataTo( file( "a" ) ); RecordingPageCacheTracer tracer = new RecordingPageCacheTracer(); RecordingPageCursorTracer cursorTracer = new RecordingPageCursorTracer(); ConfigurablePageCursorTracerSupplier cursorTracerSupplier = new ConfigurablePageCursorTracerSupplier( cursorTracer ); try ( MuninnPageCache pageCache = createPageCache( fs, 2, 8, blockCacheFlush( tracer ), cursorTracerSupplier ) ) { try ( PagedFile pagedFile = pageCache.map( file( "a" ), 8 ) ) { try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_READ_LOCK ) ) { assertTrue( cursor.next() ); } cursorTracer.reportEvents(); assertNotNull( cursorTracer.observe( Fault.class ) ); assertEquals( 1, cursorTracer.faults() ); assertEquals( 1, tracer.faults() ); int clockArm = pageCache.evictPages( 1, 0, tracer.beginPageEvictions( 1 ) ); assertThat( clockArm, is( 1 ) ); assertNotNull( tracer.observe( Evict.class ) ); } } }

Target:
public void mustEvictCleanPageWithoutFlushing() throws Exception { writeInitialDataTo( file( "a" ) ); RecordingPageCacheTracer tracer = new RecordingPageCacheTracer(); RecordingPageCursorTracer cursorTracer = new RecordingPageCursorTracer(); ConfigurablePageCursorTracerSupplier cursorTracerSupplier = new ConfigurablePageCursorTracerSupplier( cursorTracer ); try ( MuninnPageCache pageCache = createPageCache( fs, 2, 8, blockCacheFlush( tracer ), cursorTracerSupplier ); PagedFile pagedFile = pageCache.map( file( "a" ), 8 ) ) { try ( PageCursor cursor = pagedFile.io( 0, PF_SHARED_READ_LOCK ) ) { assertTrue( cursor.next() ); } cursorTracer.reportEvents(); assertNotNull( cursorTracer.observe( Fault.class ) ); assertEquals( 1, cursorTracer.faults() ); assertEquals( 1, tracer.faults() ); int clockArm = pageCache.evictPages( 1, 0, tracer.beginPageEvictions( 1 ) ); assertThat( clockArm, is( 1 ) ); assertNotNull( tracer.observe( Evict.class ) ); } }
Source:
public void testThrownErrorSingleTagGHFileNotFound() throws IOException { SCMHeadObserver mockSCMHeadObserver = Mockito.mock(SCMHeadObserver.class); Error e = new Error("Bad Tag Request", new GHFileNotFoundException()); Mockito.when(mockSCMHeadObserver.getIncludes()).thenReturn(Collections .singleton(new GitHubTagSCMHead("existent-tag", System.currentTimeMillis()))); GHRepository repoSpy = Mockito.spy(repo); GitHubSCMSourceContext context = new GitHubSCMSourceContext(null, mockSCMHeadObserver); context.wantTags(true); GitHubSCMSourceRequest request = context.newRequest(revisions()[0], null); Mockito.doThrow(e).when(repoSpy).getRef("tags/existent-tag"); Iterator<GHRef> tags = new GitHubSCMSource.LazyTags(request, repoSpy).iterator(); assertFalse(tags.hasNext()); }

Target:
public void testThrownErrorSingleTagGHFileNotFound() throws IOException { SCMHeadObserver mockSCMHeadObserver = Mockito.mock(SCMHeadObserver.class); Error e = new Error("Bad Tag Request", new GHFileNotFoundException()); Mockito.when(mockSCMHeadObserver.getIncludes()).thenReturn(Collections .singleton(new GitHubTagSCMHead("existent-tag", System.currentTimeMillis()))); GHRepository repoSpy = Mockito.spy(repo); GitHubSCMSourceContext context = new GitHubSCMSourceContext(null, mockSCMHeadObserver); context.wantTags(true); GitHubSCMSourceRequest request = context.newRequest(new GitHubSCMSource("cloudbeers", "yolo", null, false), null); Mockito.doThrow(e).when(repoSpy).getRef("tags/existent-tag"); Iterator<GHRef> tags = new GitHubSCMSource.LazyTags(request, repoSpy).iterator(); assertFalse(tags.hasNext()); }
Source:
MessageConverterConfigurer messageConverterConfigurer (ChannelBindingServiceProperties channelBindingServiceProperties) { return new MessageConverterConfigurer(channelBindingServiceProperties); }

Target:
public MessageConverterConfigurer messageConverterConfigurer (ChannelBindingServiceProperties channelBindingServiceProperties) { return new MessageConverterConfigurer(channelBindingServiceProperties); }
Source:
public Subscription updateSubscription(final String subscriptionId, final SubscriptionBase newValue) throws NoSuchSubscriptionException, SubscriptionUpdateConflictException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot create subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription old = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(old); subscriptionValidationService.validateSubscriptionChange(old, newValue); old.mergeFrom(newValue); old.setUpdatedAt(new DateTime()); subscriptionRepository.updateSubscription(old); return old; }

Target:
public Subscription updateSubscription(final String subscriptionId, final SubscriptionBase newValue) throws NoSuchSubscriptionException, SubscriptionUpdateConflictException { if (featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.DISABLE_DB_WRITE_OPERATIONS)) { throw new DbWriteOperationsBlockedException("Cannot create subscription: write operations on DB " + "are blocked by feature flag."); } final Subscription old = subscriptionRepository.getSubscription(subscriptionId); authorizationValidator.authorizeSubscriptionAdmin(old); subscriptionValidationService.validateSubscriptionChange(old, newValue); old.mergeFrom(newValue); old.setUpdatedAt(new DateTime(DateTimeZone.UTC)); subscriptionRepository.updateSubscription(old); return old; }
Source:
protected boolean delegate(float delta) { return rendererChanged; }

Target:
protected boolean delegate(float delta) { return true; }
Source:
public Iterable<Server> listNodesByIds(final Iterable<String> ids) { return Iterables.filter(listNodes(), new Predicate<Server>() { @Override public boolean apply(Server server) { return Iterables.contains(ids, Integer.toString(server.id)); } }); }

Target:
public Iterable<Server> listNodesByIds(final Iterable<String> ids) { return filter(listNodes(), new Predicate<Server>() { @Override public boolean apply(Server server) { return contains(ids, Integer.toString(server.id)); } }); }
Source:
public static void enlargeButtonText(Button button) { if (modifier == 1.0f) { return; } if (!enlargedButtons.contains(button)) { button.setTextSize(TypedValue.COMPLEX_UNIT_PX, button.getTextSize() * getModifier()); enlargedButtons.add(button); } }

Target:
public static void enlargeButtonText(Button button) { if (modifier == 1.0f) { return; } button.setTextSize(TypedValue.COMPLEX_UNIT_PX, button.getTextSize() * getModifier()); }
Source:
private <T> InstanceRegistry<T> instanceRegistry(final Class<T> category) { @SuppressWarnings("unchecked") InstanceRegistry<T> registry = (InstanceRegistry<T>) categories.get(category); if (registry == null) { throw new IllegalArgumentException("The category '" + category + "' is not registered"); } return registry; }

Target:
private <T> InstanceRegistry<T> instanceRegistry(final Class<T> category) { ensureArgumentNonNull("category", category); @SuppressWarnings("unchecked") InstanceRegistry<T> registry = (InstanceRegistry<T>) categories.get(category); if (registry == null) { throw new IllegalArgumentException("The category '" + category + "' is not registered"); } return registry; }
Source:
public FileScan(final String filename, final Schema schema, final Character delimiter) { this(filename, schema, delimiter, null, null, null); }

Target:
public FileScan(final String filename, final Schema schema, final Character delimiter) { this(new FileSource(filename), schema, delimiter, null, null, null); }
Source:
public Map<String, ResourceAssignment> getBaseline() { if (_globalBaseline == null) { try { HelixProperty baseline = _dataAccessor.compressedBucketRead(_baselinePath, HelixProperty.class); _globalBaseline = splitAssignments(baseline); } catch (HelixException e) { _globalBaseline = new HashMap<>(); } } return _globalBaseline; }

Target:
public Map<String, ResourceAssignment> getBaseline() { if (_globalBaseline == null) { HelixProperty baseline = _dataAccessor.compressedBucketRead(_baselinePath, HelixProperty.class); _globalBaseline = splitAssignments(baseline); } return _globalBaseline; }
Source:
public static void register(Context ctx, PreferenceManager preferenceManager){ CountlyConfig config = new CountlyConfig() .setAppKey("146836f41172f9e3287cab6f2cc347de3f5ddf3b") .setContext(ctx) .setIdMode(DeviceId.Type.ADVERTISING_ID) .setRequiresConsent(true) .setConsentEnabled(basicFeatures) .setServerURL(BuildConfig.NOTIFICATION_SERVER) .setLoggingEnabled(!BuildConfig.DEBUG) .setViewTracking(true) .setHttpPostForced(true) .setViewTracking(true) .enableCrashReporting() .enableCrashReporting(); CountlyManager.reloadConsent(preferenceManager); Countly.sharedInstance().init(config); }

Target:
public static void register(Context ctx, PreferenceManager preferenceManager){ CountlyConfig config = new CountlyConfig() .setAppKey("146836f41172f9e3287cab6f2cc347de3f5ddf3b") .setContext(ctx) .setDeviceId(preferenceManager.getOrGenerateUUID4()) .setRequiresConsent(true) .setConsentEnabled(getConsentsEnabled(preferenceManager)) .setServerURL(BuildConfig.NOTIFICATION_SERVER) .setLoggingEnabled(!BuildConfig.DEBUG) .setViewTracking(true) .setHttpPostForced(true) .enableCrashReporting(); Countly.sharedInstance().init(config); }
Source:
private Set<Path> getFileRepo() { if (this.scmRepositories != null) { String repositoryUri = null; try { for (AbstractScmEnvironmentRepository repository : scmRepositories) { repositoryUri = repository.getUri(); Resource resource = this.resourceLoader.getResource(repositoryUri); if (resource instanceof FileSystemResource) { return Collections.singleton(Paths.get(resource.getURI())); } } } catch (IOException e) { log.error("Cannot resolve URI for path: " + repositoryUri); } } if (this.nativeEnvironmentRepository != null) { Set<Path> paths = new LinkedHashSet<>(); for (String path : this.nativeEnvironmentRepository.getSearchLocations()) { Resource resource = this.resourceLoader.getResource(path); if (resource.exists()) { try { paths.add(Paths.get(resource.getURI())); } catch (Exception e) { log.error("Cannot resolve URI for path: " + path); } } } return paths; } return null; }

Target:
private Set<Path> getFileRepo() { if (this.scmRepositories != null) { String repositoryUri = null; Set<Path> paths = new LinkedHashSet<>(); try { for (AbstractScmEnvironmentRepository repository : scmRepositories) { repositoryUri = repository.getUri(); Resource resource = this.resourceLoader.getResource(repositoryUri); if (resource instanceof FileSystemResource) { paths.add(Paths.get(resource.getURI())); } } return paths; } catch (IOException e) { log.error("Cannot resolve URI for path: " + repositoryUri); } } if (this.nativeEnvironmentRepository != null) { Set<Path> paths = new LinkedHashSet<>(); for (String path : this.nativeEnvironmentRepository.getSearchLocations()) { Resource resource = this.resourceLoader.getResource(path); if (resource.exists()) { try { paths.add(Paths.get(resource.getURI())); } catch (Exception e) { log.error("Cannot resolve URI for path: " + path); } } } return paths; } return null; }
Source:
void copy() throws IOException { FileInputStream input = new FileInputStream(src); FileOutputStream output = new FileOutputStream(dest); FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); input.close(); output.close(); }

Target:
void copy() throws IOException { FileInputStream input = new FileInputStream(src); FileOutputStream output = new FileOutputStream(dest); try { FileChannel channel = input.getChannel(); output.getChannel().transferFrom(channel, 0, channel.size()); } finally { input.close(); output.close(); } }