auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public LruCache(int maxSize) { super(maxSize + 1, 0.75f, true); this.maxSize = maxSize; }

Target:
public LruCache(int maxSize) { super(maxSize + 1, 1, true); this.maxSize = maxSize; }
Source:
private ChannelInitializer<SocketChannel> channelInitializer(final Map<String, RequestHandler> requestHandlers) { return new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new LengthFieldBasedFrameDecoder(TFrame.MAX_FRAME_LENGTH, 0, 2, -2, 0, true)); ch.pipeline().addLast(new TFrameCodec()); ch.pipeline().addLast(new MessageCodec()); ch.pipeline().addLast(new InitRequestHandler()); ch.pipeline().addLast(new MessageMultiplexer()); ch.pipeline().addLast(new RequestDispatcher(requestHandlers)); } }; }

Target:
private ChannelInitializer<SocketChannel> channelInitializer(final Map<String, RequestHandler> requestHandlers) { return new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new LengthFieldBasedFrameDecoder( TFrame.MAX_FRAME_LENGTH, TFrame.LENGTH_FIELD_OFFSET, TFrame.LENGTH_FIELD_LENGTH, TFrame.LENGTH_ADJUSTMENT, TFrame.INITIAL_BYTES_TO_STRIP, TFrame.FAIL_FAST )); ch.pipeline().addLast(new TFrameCodec()); ch.pipeline().addLast(new MessageCodec()); ch.pipeline().addLast(new InitRequestHandler()); ch.pipeline().addLast(new MessageMultiplexer()); ch.pipeline().addLast(new RequestDispatcher(requestHandlers)); } }; }
Source:
public void testListRegions() { List<Region> regions = regionApi.list(); assertTrue(regions.size() > 0, "Region list should not be empty"); }

Target:
public void testListRegions() { List<Region> regions = regionApi.list(); assertFalse(regions.isEmpty(), "Region list should not be empty"); }
Source:
private NetworkSecurityGroup createGroup() { NetworkSecurityRule rule = NetworkSecurityRule.create("denyallout", null, null, NetworkSecurityRuleProperties.create("deny all out", Protocol.Tcp, "*", "*", "*", "*", Access.Deny, 4095, Direction.Outbound)); ArrayList<NetworkSecurityRule> ruleList = new ArrayList<NetworkSecurityRule>(); ruleList.add(rule); NetworkSecurityGroup nsg = NetworkSecurityGroup.create("samplensg", "westus", null, NetworkSecurityGroupProperties.create(ruleList, null, null, null, null, null), null); return nsg; }

Target:
private NetworkSecurityGroup createGroup() { NetworkSecurityRule rule = NetworkSecurityRule.create("denyallout", null, null, NetworkSecurityRuleProperties.builder() .description("deny all out") .protocol(Protocol.Tcp) .sourcePortRange("*") .destinationPortRange("*") .sourceAddressPrefix("*") .destinationAddressPrefix("*") .access(Access.Deny) .priority(4095) .direction(Direction.Outbound) .build()); ArrayList<NetworkSecurityRule> ruleList = new ArrayList<NetworkSecurityRule>(); ruleList.add(rule); NetworkSecurityGroup nsg = NetworkSecurityGroup.create("samplensg", "westus", null, NetworkSecurityGroupProperties.builder() .securityRules(ruleList) .build(), null); return nsg; }
Source:
public static Runnable getTerminationRunnable(Vertx vertx, Logger log, Runnable action) { return () -> { CountDownLatch latch = new CountDownLatch(1); System.out.println("Shutdown hook ! " + vertx); if (vertx != null) { vertx.close(ar -> { if (!ar.succeeded()) { log.error("Failure in stopping Vert.x", ar.cause()); } latch.countDown(); }); try { if (!latch.await(2, TimeUnit.MINUTES)) { log.error("Timed out waiting to undeploy all"); } if (action != null) { action.run(); } } catch (InterruptedException e) { throw new IllegalStateException(e); } } }; }

Target:
public static Runnable getTerminationRunnable(Vertx vertx, Logger log, Runnable action) { return () -> { CountDownLatch latch = new CountDownLatch(1); if (vertx != null) { vertx.close(ar -> { if (!ar.succeeded()) { log.error("Failure in stopping Vert.x", ar.cause()); } latch.countDown(); }); try { if (!latch.await(2, TimeUnit.MINUTES)) { log.error("Timed out waiting to undeploy all"); } if (action != null) { action.run(); } } catch (InterruptedException e) { throw new IllegalStateException(e); } } }; }
Source:
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) { return null; } List<BlockDevice> blockDevices = Lists.newArrayList(); for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) { blockDevices.add(new BlockDevice(blockDevice.getDevice(), blockDevice.getVirtualDiskImage().getCapacity())); } Collections.sort(blockDevices, new BlockDevicesComparator()); return blockDevices; }

Target:
private List<BlockDevice> getBlockDevices(VirtualGuest virtualGuest) { if (virtualGuest.getVirtualGuestBlockDevices() == null) { return null; } List<BlockDevice> blockDevices = Lists.newArrayList(); for (VirtualGuestBlockDevice blockDevice : virtualGuest.getVirtualGuestBlockDevices()) { blockDevices.add(new BlockDevice(blockDevice.getDevice(), blockDevice.getVirtualDiskImage().getCapacity())); } Collections.sort(blockDevices, new BlockDevicesComparator()); return ImmutableList.copyOf(blockDevices); }
Source:
private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { List<Class<?>> sqlMethodAnnotations = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodAnnotation.class)) .collect(toList()); if (sqlMethodAnnotations.size() > 1) { throw new IllegalStateException( String.format("Mutually exclusive annotations on method %s.%s: %s", sqlObjectType.getName(), method.getName(), sqlMethodAnnotations)); } if (method.isDefault()) { if (!sqlMethodAnnotations.isEmpty()) { throw new IllegalStateException(String.format( "Method %s.%s has mutually exclusive default implementation and a SQL method annotation %s " + "(must be one or the other)", sqlObjectType.getSimpleName(), method.getName(), sqlMethodAnnotations.get(0).getName())); } return new DefaultMethodHandler(); } return sqlMethodAnnotations.stream() .map(type -> type.getAnnotation(SqlMethodAnnotation.class)) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) .findFirst() .orElseThrow(() -> new AbstractMethodError(String.format( "Method %s.%s must be default or be annotated with a SQL method annotation.", sqlObjectType.getSimpleName(), method.getName()))); }

Target:
private Handler buildBaseHandler(Class<?> sqlObjectType, Method method) { List<Class<?>> sqlMethodAnnotations = Stream.of(method.getAnnotations()) .map(Annotation::annotationType) .filter(type -> type.isAnnotationPresent(SqlMethodAnnotation.class)) .collect(toList()); if (sqlMethodAnnotations.size() > 1) { throw new IllegalStateException( String.format("Mutually exclusive annotations on method %s.%s: %s", sqlObjectType.getName(), method.getName(), sqlMethodAnnotations)); } if (method.isDefault()) { if (!sqlMethodAnnotations.isEmpty()) { throw new IllegalStateException(String.format( "Default method %s.%s has @%s annotation. " + "SQL object methods may be default, or have a SQL method annotation, but not both.", sqlObjectType.getSimpleName(), method.getName(), sqlMethodAnnotations.get(0).getSimpleName())); } return new DefaultMethodHandler(); } return sqlMethodAnnotations.stream() .map(type -> type.getAnnotation(SqlMethodAnnotation.class)) .map(a -> buildFactory(a.value())) .map(factory -> factory.buildHandler(sqlObjectType, method)) .findFirst() .orElseThrow(() -> new IllegalStateException(String.format( "Method %s.%s must be default or be annotated with a SQL method annotation.", sqlObjectType.getSimpleName(), method.getName()))); }
Source:
public void verifyMapContains(Map<String, Boolean> map, List<FeedbackParticipantType> list) { for (FeedbackParticipantType participant : list) { assertTrue(map.get(participant.name())); } Set<FeedbackParticipantType> allParticipantTypes = EnumSet.allOf(FeedbackParticipantType.class); Set<String> nonParticipants = new HashSet<String>(); for (FeedbackParticipantType participantType : allParticipantTypes) { if (list.contains(participantType.name())) { nonParticipants.add(participantType.name()); } } for (String participant : nonParticipants) { assertFalse(map.containsKey(participant)); } }

Target:
public void verifyMapContains(Map<String, Boolean> map, List<FeedbackParticipantType> list) { for (FeedbackParticipantType participant : list) { assertTrue(map.get(participant.name())); } Set<FeedbackParticipantType> nonParticipants = new HashSet<>(Arrays.asList(FeedbackParticipantType.values())); nonParticipants.removeAll(list); for (FeedbackParticipantType nonParticipant : nonParticipants) { assertFalse(map.containsKey(nonParticipant.name())); } }
Source:
public int getCount() { return cities == null ? 0 : cities.size(); }

Target:
public int getCount() { return cities.size(); }
Source:
public void testGetRequiredTokens() { final NoCodeInFileCheck checkObj = new NoCodeInFileCheck(); assertArrayEquals(CommonUtil.EMPTY_INT_ARRAY, checkObj.getRequiredTokens(), "Required tokens array is not empty"); }

Target:
public void testGetRequiredTokens() { final NoCodeInFileCheck checkObj = new NoCodeInFileCheck(); assertWithMessage("Required tokens array is not empty") .that(checkObj.getRequiredTokens()) .isEmpty(); }
Source:
public Score toScore() { if ( scoreClass == null ) { return null; } if ( BendableScore.class.equals( scoreClass ) ) { return BendableScore.parseScore( scoreString ); } else if ( BendableBigDecimalScore.class.equals( scoreClass ) ) { return BendableBigDecimalScore.parseScore( scoreString ); } else if ( BendableLongScore.class.equals( scoreClass ) ) { return BendableLongScore.parseScore( scoreString ); } else if ( HardMediumSoftScore.class.equals( scoreClass ) ) { return HardMediumSoftScore.parseScore( scoreString ); } else if ( HardMediumSoftLongScore.class.equals( scoreClass ) ) { return HardMediumSoftLongScore.parseScore( scoreString ); } else if ( HardSoftScore.class.equals( scoreClass ) ) { return HardSoftScore.parseScore( scoreString ); } else if ( HardSoftBigDecimalScore.class.equals( scoreClass ) ) { return HardSoftBigDecimalScore.parseScore( scoreString ); } else if ( HardSoftDoubleScore.class.equals( scoreClass ) ) { return HardSoftDoubleScore.parseScore( scoreString ); } else if ( HardSoftLongScore.class.equals( scoreClass ) ) { return HardSoftLongScore.parseScore( scoreString ); } else if ( SimpleScore.class.equals( scoreClass ) ) { return SimpleScore.parseScore( scoreString ); } else if ( SimpleBigDecimalScore.class.equals( scoreClass ) ) { return SimpleBigDecimalScore.parseScore( scoreString ); } else if ( SimpleDoubleScore.class.equals( scoreClass ) ) { return SimpleDoubleScore.parseScore( scoreString ); } else if ( SimpleLongScore.class.equals( scoreClass ) ) { return SimpleLongScore.parseScore( scoreString ); } throw new UnsupportedOperationException( "Unsupported score class '" + scoreClass + "'." ); }

Target:
public Score toScore() { if ( scoreClass == null ) { return null; } return ScoreUtils.parseScore( scoreClass, scoreString ); }
Source:
private void send(final List<RemoteRefUpdate> cmds, final RefSpec spec) throws IOException { final String src = spec.getSource(); String dst = spec.getDestination(); if (dst == null) dst = src; final boolean force = spec.isForceUpdate(); cmds.add(new RemoteRefUpdate(db, src, dst, force, null, null)); }

Target:
private void send(final List<RemoteRefUpdate> cmds, final RefSpec spec) throws IOException { final String src = spec.getSource(); String dst = spec.getDestination(); if (dst == null) { dst = src; } final boolean force = spec.isForceUpdate(); cmds.add(new RemoteRefUpdate(db, src, dst, force, null, null)); }
Source:
protected void executeVmCommand() { resourceManager.getVmManager(getVmId()).getStatistics().setMigrationProgressPercent(0); try { setSucceeded(initVdss() && perform()); } catch (Exception e) { setSucceeded(false); } if (!getSucceeded()) { cleanupPassthroughVnics(getDestinationVdsId()); } }

Target:
protected void executeVmCommand() { getVmManager().getStatistics().setMigrationProgressPercent(0); try { setSucceeded(initVdss() && perform()); } catch (Exception e) { setSucceeded(false); } if (!getSucceeded()) { cleanupPassthroughVnics(getDestinationVdsId()); } }
Source:
private static void testHighLevelEncodeString(String s, String expectedBits) { BitArray bits = new HighLevelEncoder(s.getBytes(StandardCharsets.ISO_8859_1)).encode(); String receivedBits = stripSpace(bits.toString()); assertEquals("highLevelEncode() failed for input string: " + s, stripSpace(expectedBits), receivedBits); try { assertEquals(s, Decoder.highLevelDecode(toBooleanArray(bits))); } catch (FormatException e) { } }

Target:
private static void testHighLevelEncodeString(String s, String expectedBits) throws FormatException { BitArray bits = new HighLevelEncoder(s.getBytes(StandardCharsets.ISO_8859_1)).encode(); String receivedBits = stripSpace(bits.toString()); assertEquals("highLevelEncode() failed for input string: " + s, stripSpace(expectedBits), receivedBits); assertEquals(s, Decoder.highLevelDecode(toBooleanArray(bits))); }
Source:
public String getMuteReason() { if (muteReason != null) { return muteReason; } else { return ""; } }

Target:
public String getMuteReason() { return muteReason; }
Source:
public static GatewayConnectionConfig getDefaultConfig() { return GatewayConnectionConfig.defaultConfig; }

Target:
public static GatewayConnectionConfig getDefaultConfig() { return new GatewayConnectionConfig(); }
Source:
public int hashCode() { return Objects.hash(id, getSocketAddress()); }

Target:
public int hashCode() { return Objects.hash(id, host, port); }
Source:
private void cleanupConnectionManager(ZkConnectionManager zkConnectionManager) { synchronized (_connectionManagerPool) { zkConnectionManager.close(true); _connectionManagerPool.remove(zkConnectionManager); } }

Target:
private void cleanupConnectionManager(ZkConnectionManager zkConnectionManager) { synchronized (_connectionManagerPool) { if (zkConnectionManager.close(true)) { _connectionManagerPool.remove(zkConnectionManager); } } }
Source:
public void setUp() { mWebViewOnUiThread = new androidx.webkit.WebViewOnUiThread(); mWebViewOnUiThread.getSettings().setJavaScriptEnabled(true); }

Target:
public void setUp() { WebkitUtils.checkFeature(WebViewFeature.WEB_MESSAGE_LISTENER); mWebViewOnUiThread = new WebViewOnUiThread(); mWebViewOnUiThread.getSettings().setJavaScriptEnabled(true); }
Source:
default BundleSpecBuilder addResourceWithCopy(Class<?> class1) { String className = class1.getName(); String path = className.replace('.', '/') + ".class"; URL url = BundleSpecBuilder.class.getClassLoader() .getResource(path); if (url == null) { throw new IllegalArgumentException( "Couldn't find class file for " + class1.getName() + ", possibly a synthetic class"); } addResource(path, url); return this; }

Target:
default BundleSpecBuilder addResourceWithCopy(Class<?> class1) { String className = class1.getName(); String path = className.replace('.', '/') + ".class"; URL url = class1.getClassLoader() .getResource(path); if (url == null) { throw new IllegalArgumentException( "Couldn't find class file for " + className + ", possibly a synthetic class"); } addResource(path, url); return this; }
Source:
public LogStatistics(String FileName, String delimeter) { this.logFile = new File(FileName); this.delimeter = delimeter; this.outputInitialized = true; FileWriter fileWriter = null; try { fileWriter = new FileWriter(logFile.getAbsoluteFile()); } catch (IOException e) { outputInitialized = false; e.printStackTrace(); } out = new BufferedWriter(fileWriter); }

Target:
public LogStatistics(String FileName, String delimeter) { this.logFile = new File(FileName); this.delimeter = delimeter; FileWriter logFileWriter = null; try { logFileWriter = new FileWriter(logFile.getAbsoluteFile()); } catch (IOException e) { e.printStackTrace(); return; } logFileBuffer = new BufferedWriter(logFileWriter); }
Source:
public void afterClass() throws Exception { String testClassName = this.getShortClassName(); System.out.println("AfterClass: " + testClassName + " of TestMaxNumberOfAttempsMasterSwitch called."); super.afterClass(); }

Target:
public void afterClass() throws Exception { super.afterClass(); }
Source:
public String getRemoteFile() throws InterruptedException, IOException { if (CommonUtils.isBlank(fileName)) { logger.info(LOGGER_TAG, "no file configured"); return null; } FilePath[] src = workspace.list(fileName); if (src.length == 0) { logger.info(LOGGER_TAG, "no files found by path: '" + fileName + "'"); return null; } if (src.length > 1) { logger.info(LOGGER_TAG, "Found multiple matches. Reading first only."); } FilePath source = src[0]; int maxLength = DEFAULT_MAX_SIZE; if (!CommonUtils.isBlank(maxSize)) { maxLength = parseInt(maxSize, 10); } if (source.length() < maxLength) { maxLength = (int) source.length(); } byte[] buffer = new byte[maxLength]; InputStream stream = source.read(); IOUtils.read(stream, buffer); stream.close(); return new String(buffer); }

Target:
public String getRemoteFile() throws InterruptedException, IOException { if (CommonUtils.isBlank(fileName)) { logger.info(LOGGER_TAG, "no file configured"); return null; } FilePath[] src = workspace.list(fileName); if (src.length == 0) { logger.info(LOGGER_TAG, "no files found by path: '" + fileName + "'"); return null; } if (src.length > 1) { logger.info(LOGGER_TAG, "Found multiple matches. Reading first only."); } FilePath source = src[0]; int maxLength = DEFAULT_MAX_SIZE; if (!CommonUtils.isBlank(maxSize)) { maxLength = parseInt(maxSize, 10); } if (source.length() < maxLength) { maxLength = (int) source.length(); } byte[] buffer = new byte[maxLength]; InputStream stream = source.read(); try { IOUtils.read(stream, buffer); } finally { try { if (stream != null) { stream.close(); } } catch (IOException e) { } } return new String(buffer); }
Source:
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); logger.info("Updating: TaskExecution with executionId="+executionId + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); return taskExecutionDao.getTaskExecution(executionId); }

Target:
public TaskExecution completeTaskExecution(long executionId, Integer exitCode, Date endTime, String exitMessage) { initialize(); validateExitInformation(executionId, exitCode, endTime); exitMessage = trimExitMessage(exitMessage); taskExecutionDao.completeTaskExecution(executionId, exitCode, endTime, exitMessage); logger.debug("Updating: TaskExecution with executionId="+executionId + " with the following {" + "exitCode=" + exitCode + ", endTime=" + endTime + ", exitMessage='" + exitMessage + '\'' + '}'); return taskExecutionDao.getTaskExecution(executionId); }
Source:
private void checkServerReadiness(String machineName, String serverRef, String serverUrl) throws InternalInfrastructureException { if (!livenessChecksPaths.containsKey(serverRef)) { return; } String livenessCheckPath = livenessChecksPaths.get(serverRef); URL url; try { url = UriBuilder.fromUri(serverUrl) .replacePath(livenessCheckPath) .build() .toURL(); } catch (MalformedURLException e) { throw new InternalInfrastructureException("Server " + serverRef + " URL is invalid. Error: " + e.getLocalizedMessage(), e); } long readinessDeadLine = System.currentTimeMillis() + 3000 * 60; while (System.currentTimeMillis() < readinessDeadLine) { LOG.info("Checking agent of machine at {}", serverRef, machineName, System.currentTimeMillis()); if (Thread.currentThread().isInterrupted()) { throw new InternalInfrastructureException("Interrupted"); } if (checkServerConnection(url)) { DockerMachine machine = startSynchronizer.getMachines().get(machineName); machine.setServerStatus(serverRef, ServerStatus.RUNNING); eventService.publish(DtoFactory.newDto(ServerStatusEvent.class) .withIdentity(DtoConverter.asDto(identity)) .withMachineName(machineName) .withServerName(serverRef) .withStatus(ServerStatus.RUNNING) .withServerUrl(serverUrl)); LOG.info("Agent of machine started", serverRef, machineName); return; } try { Thread.sleep(3000); } catch (InterruptedException e) { throw new InternalInfrastructureException("Interrupted"); } } }

Target:
private void checkServerReadiness(String machineName, String serverRef, String serverUrl) throws InfrastructureException { if (!livenessChecksPaths.containsKey(serverRef)) { return; } String livenessCheckPath = livenessChecksPaths.get(serverRef); URL url; try { url = UriBuilder.fromUri(serverUrl) .replacePath(livenessCheckPath) .build() .toURL(); } catch (MalformedURLException e) { throw new InternalInfrastructureException("Server " + serverRef + " URL is invalid. Error: " + e.getLocalizedMessage(), e); } long readinessDeadLine = System.currentTimeMillis() + 3000 * 60; while (System.currentTimeMillis() < readinessDeadLine) { LOG.info("Checking agent of machine at {}", serverRef, machineName, System.currentTimeMillis()); checkStartInterruption(); if (isHttpConnectionSucceed(url)) { DockerMachine machine = startSynchronizer.getMachines().get(machineName); machine.setServerStatus(serverRef, ServerStatus.RUNNING); eventService.publish(DtoFactory.newDto(ServerStatusEvent.class) .withIdentity(DtoConverter.asDto(identity)) .withMachineName(machineName) .withServerName(serverRef) .withStatus(ServerStatus.RUNNING) .withServerUrl(serverUrl)); LOG.info("Server of machine started", serverRef, machineName); return; } try { Thread.sleep(3000); } catch (InterruptedException e) { throw new InternalInfrastructureException("Interrupted"); } } }
Source:
<T extends Operation, R> R processWithTimeout( long timeout, CatalogFunction<T, R> catalog, T request) throws InterruptedException, IngestTimeoutException, ExecutionException { LOGGER.info("Running catalog operation with timeout of {}", timeout); Subject subject = SecurityUtils.getSubject(); if (subject instanceof ddf.security.Subject) { request .getProperties() .put(SecurityConstants.SECURITY_SUBJECT, (ddf.security.Subject) subject); } try { List<Future<R>> futures = executor.invokeAll( Collections.singleton((Callable<R>) () -> catalog.ingest(request)), timeout, TimeUnit.MILLISECONDS); if (!futures.get(0).isDone()) { LOGGER.warn("Ingest task was canceled due to timeout"); throw new IngestTimeoutException("The ingest request timed out 1"); } return futures.get(0).get(); } catch (CancellationException e) { throw new IngestTimeoutException("The ingest request timed out 2"); } }

Target:
<T extends Operation, R> R processWithTimeout( long timeout, CatalogFunction<T, R> catalog, T request) throws InterruptedException, IngestTimeoutException, ExecutionException { LOGGER.trace("Running catalog operation with timeout of {}", timeout); Subject subject = SecurityUtils.getSubject(); if (subject instanceof ddf.security.Subject) { request .getProperties() .put(SecurityConstants.SECURITY_SUBJECT, (ddf.security.Subject) subject); } try { List<Future<R>> futures = executor.invokeAll( Collections.singleton((Callable<R>) () -> catalog.ingest(request)), timeout, TimeUnit.MILLISECONDS); if (!futures.get(0).isDone()) { LOGGER.warn("Ingest task was canceled due to timeout"); throw new IngestTimeoutException("The ingest request timed out 1"); } return futures.get(0).get(); } catch (CancellationException e) { throw new IngestTimeoutException("The ingest request timed out 2"); } }
Source:
static List<Card> buildCards(@NonNull List<Announcement> announcements) { List<Card> cards = new ArrayList<>(); String country = getGeoIPCountry(); Date now = new Date(); for (Announcement announcement : announcements) { if (shouldShow(announcement, country, now)) { switch (announcement.type()) { case "survey": cards.add(new SurveyCard(announcement)); break; case "fundraising": cards.add(new FundraisingCard(announcement)); break; default: cards.add(new AnnouncementCard(announcement)); break; } } } return cards; }

Target:
static List<Card> buildCards(@NonNull List<Announcement> announcements) { List<Card> cards = new ArrayList<>(); String country = GeoUtil.getGeoIPCountry(); Date now = new Date(); for (Announcement announcement : announcements) { if (shouldShow(announcement, country, now)) { switch (announcement.type()) { case Announcement.SURVEY: cards.add(new FundraisingCard(announcement)); break; case Announcement.FUNDRAISING: cards.add(new FundraisingCard(announcement)); break; default: cards.add(new AnnouncementCard(announcement)); break; } } } return cards; }
Source:
private void writeElementValue(Object value, PropertyDefinition propDef) throws XMLStreamException { if (value == null) { if (!propDef.getConstraint(NillableFlag.class).isEnabled()) { log.warn("Non-nillable element " + propDef.getName() + " is null"); } else { writer.writeAttribute(SCHEMA_INSTANCE_NS, "nil", "true"); } } else { TypeDefinition propType = propDef.getPropertyType(); if (value instanceof Iterable && List.class .isAssignableFrom(propType.getConstraint(Binding.class).getBinding()) && propType.getConstraint(ElementType.class).getBinding() != null) { boolean first = true; for (Object element : ((Iterable<?>) value)) { if (first) { first = false; } else { writer.writeCharacters(" "); } writer.writeCharacters(SimpleTypeUtil.convertToXml(element, propType.getConstraint(ElementType.class).getDefinition())); } } else if (value instanceof Double || value instanceof Float || value instanceof BigDecimal) { String representation = DecimalFormatUtil.applyFormatter((Number) value, getDecimalFormatter()); writer.writeCharacters( SimpleTypeUtil.convertToXml(representation, propDef.getPropertyType())); } else { writer.writeCharacters( SimpleTypeUtil.convertToXml(value, propDef.getPropertyType())); } } }

Target:
private void writeElementValue(Object value, PropertyDefinition propDef) throws XMLStreamException { if (value == null) { if (!propDef.getConstraint(NillableFlag.class).isEnabled()) { log.warn("Non-nillable element " + propDef.getName() + " is null"); } else { writer.writeAttribute(SCHEMA_INSTANCE_NS, "nil", "true"); } } else { TypeDefinition propType = propDef.getPropertyType(); if (value instanceof Iterable && List.class .isAssignableFrom(propType.getConstraint(Binding.class).getBinding()) && propType.getConstraint(ElementType.class).getBinding() != null) { boolean first = true; for (Object element : ((Iterable<?>) value)) { if (first) { first = false; } else { writer.writeCharacters(" "); } writer.writeCharacters(SimpleTypeUtil.convertToXml(element, propType.getConstraint(ElementType.class).getDefinition())); } } else if (getDecimalFormatter() != null && (value instanceof Double || value instanceof Float || value instanceof BigDecimal)) { String representation = DecimalFormatUtil.applyFormatter((Number) value, getDecimalFormatter()); writer.writeCharacters( SimpleTypeUtil.convertToXml(representation, propDef.getPropertyType())); } else { writer.writeCharacters( SimpleTypeUtil.convertToXml(value, propDef.getPropertyType())); } } }
Source:
public void visitTable(Connection connection, String name) throws SQLException; } public interface Props { public static final String CONNECTION_KEEPALIVE_PERIOD = "connectionKeepAlivePeriod"; public static final String ID_COLUMN_LENGTH = "idColumnLength"; public static final String READER_POOL_CAPACITY = "readerPoolCapacity"; public static final String WRITER_POOL_CAPACITY = "writerPoolCapacity"; public static final String DB_FIELD_TRACK_CONSTRUCTION = "dbFieldTrackConstruction"; }

Target:
public void visitTable(Connection connection, String name) throws SQLException; } public interface Props { public static final String CONNECTION_KEEPALIVE_PERIOD = "connectionKeepAlivePeriod"; public static final String ID_COLUMN_LENGTH = "idColumnLength"; public static final String READER_POOL_CAPACITY = "readerPoolCapacity"; public static final String WRITER_POOL_CAPACITY = "writerPoolCapacity"; public static final String FIELD_CONSTRUCTION_TRACKING = "fieldConstructionTracking"; }
Source:
private static String taggedMessagesToJson(Set<TaggedMessagesContainer> messages) { if (messages.isEmpty()) { return emptyJSON; } ObjectMapper mapper = new ObjectMapper(); try { return mapper.writeValueAsString(messages); } catch (JsonProcessingException e) { LOGGER.log(Level.WARNING, "failed to encode to JSON", messages); return null; } }

Target:
private static String taggedMessagesToJson(Set<TaggedMessagesContainer> messages) { if (messages.isEmpty()) { return JSONable.EMPTY; } ObjectMapper mapper = new ObjectMapper(); try { return mapper.writeValueAsString(messages); } catch (JsonProcessingException e) { LOGGER.log(Level.WARNING, String.format("failed to encode '%s' to JSON: ", messages), e); return JSONable.EMPTY; } }
Source:
public TokenAwarePolicy(LoadBalancingPolicy childPolicy) { this(childPolicy, ReplicaOrdering.TOPOLOGICAL); }

Target:
public TokenAwarePolicy(LoadBalancingPolicy childPolicy) { this(childPolicy, ReplicaOrdering.RANDOM); }
Source:
public static Versions getVersionsInstance() { return VersionsHolder.INSTANCE; }

Target:
private static Versions getVersionsInstance() { return VersionsHolder.INSTANCE; }
Source:
public void afterStatusChange(Job job, Status before, Status after) { if (after == Status.ERROR) { if (job.getException() != null) { LOG.error("Error", job.getException()); } } if (job.isTerminated()) { LOG.info("Job is finished", job.getId()); try { note.persist(null); } catch (IOException e) { LOG.error(e.toString(), e); } } notebookServer.broadcastNote(note); try { notebookServer.broadcastUpdateNotebookJobInfo(System.currentTimeMillis() - 5000); } catch (IOException ioe) { LOG.error("can not broadcast for job manager {}", ioe.getMessage()); } }

Target:
public void afterStatusChange(Job job, Status before, Status after) { if (after == Status.ERROR) { if (job.getException() != null) { LOG.error("Error", job.getException()); } } if (job.isTerminated()) { LOG.info("Job is finished", job.getId()); try { note.persist(null); } catch (IOException e) { LOG.error(e.toString(), e); } } notebookServer.broadcastNote(note); try { notebookServer.broadcastUpdateNotebookJobInfo(System.currentTimeMillis() - 5000); } catch (IOException e) { LOG.error("can not broadcast for job manager {}", e); } }
Source:
default Mono<Void> subscribeToUpstream(Publisher<? extends Message<?>> upstreamPublisher) { subscribeTo(upstreamPublisher); return Mono.empty(); }

Target:
default Mono<Void> subscribeToUpstream(Publisher<? extends Message<?>> upstreamPublisher) { return Mono.defer(() -> { subscribeTo(upstreamPublisher); return Mono.empty(); } ); }
Source:
public void testGetExternalResourceInfoProvider() { final Configuration config = new Configuration(); final Map<Class<?>, Iterator<?>> plugins = new HashMap<>(); plugins.put(ExternalResourceDriverFactory.class, IteratorUtils.singletonIterator(new TestingExternalResourceDriverFactory())); final PluginManager testingPluginManagerPluginManager = new TestingPluginManager(plugins); final String driverFactoryClassName = TestingExternalResourceDriverFactory.class.getName(); config.set(ExternalResourceOptions.EXTERNAL_RESOURCE_LIST, Collections.singletonList(RESOURCE_NAME_1)); config.setLong(ExternalResourceOptions.keyWithResourceNameAndSuffix(RESOURCE_NAME_1, ExternalResourceOptions.EXTERNAL_RESOURCE_AMOUNT_SUFFIX), RESOURCE_AMOUNT_1); config.setString(ExternalResourceOptions.keyWithResourceNameAndSuffix(RESOURCE_NAME_1, ExternalResourceOptions.EXTERNAL_RESOURCE_DRIVER_FACTORY_SUFFIX), driverFactoryClassName); final ExternalResourceInfoProvider externalResourceInfoProvider = ExternalResourceUtils.getExternalResourceInfoProvider(config, testingPluginManagerPluginManager); assertNotNull(externalResourceInfoProvider.getExternalResources().get(RESOURCE_NAME_1)); }

Target:
public void testGetExternalResourceInfoProvider() { final Map<String, Long> externalResourceAmountMap = new HashMap<>(); final Map<String, ExternalResourceDriver> externalResourceDrivers = new HashMap<>(); externalResourceAmountMap.put(RESOURCE_NAME_1, RESOURCE_AMOUNT_1); externalResourceDrivers.put(RESOURCE_NAME_1, new TestingExternalResourceDriver()); final StaticExternalResourceInfoProvider externalResourceInfoProvider = (StaticExternalResourceInfoProvider) ExternalResourceUtils.createStaticExternalResourceInfoProvider(externalResourceAmountMap, externalResourceDrivers); assertNotNull(externalResourceInfoProvider.getExternalResources().get(RESOURCE_NAME_1)); }
Source:
private JAXBDecoder(Builder builder) { if (builder.jaxbContextFactory == null) { throw new IllegalStateException("JAXBContextFactory must be non-null"); } this.jaxbContextFactory = builder.jaxbContextFactory; this.namespaceAware = builder.namespaceAware; }

Target:
private JAXBDecoder(Builder builder) { this.jaxbContextFactory = builder.jaxbContextFactory; this.namespaceAware = builder.namespaceAware; }
Source:
protected void store(Command command, Error error) { checkNotClosed(); checkNotDefault(error); CommandId id = getOrGenerateCommandId(command); final CommandRecord.Builder builder = newRecordBuilder(command, ERROR, id); builder.getStatusBuilder() .setError(error); final CommandRecord record = builder.build(); write(id, record); }

Target:
protected void store(Command command, Error error) { checkNotClosed(); checkNotDefault(error); final CommandId id = getOrGenerateCommandId(command); final CommandRecord.Builder builder = newRecordBuilder(command, ERROR, id); builder.getStatusBuilder() .setError(error); final CommandRecord record = builder.build(); write(id, record); }
Source:
public static final Operator fromString(final String str) { for (Operator o : Operator.values()) { if (o.value.equals(str)) { return o; } } throw new IllegalArgumentException("Value " + str + " not recognized."); }

Target:
public static Operator fromString(final String str) { for (Operator o : Operator.values()) { if (o.value.equals(str)) { return o; } } throw new IllegalArgumentException("Value " + str + " not recognized."); }
Source:
public View getPrototypeView(Context context) { View view = View.inflate(context, R.layout.brick_play_sound, null); spinner = view.findViewById(R.id.playsound_spinner); spinnerAdapter = new SpinnerAdapterWithNewOption(context, getSoundNames()); spinner.setAdapter(spinnerAdapter); spinner.setSelection(spinnerAdapter.getPosition(sound != null ? sound.getName() : null)); if (wait) { ((TextView) view.findViewById(R.id.brick_play_sound_label)).setText(R.string.brick_play_sound_and_wait); } return view; }

Target:
public View getPrototypeView(Context context) { View view = prepareView(context); spinner = findSpinner(view); spinnerAdapter = new SpinnerAdapterWithNewOption(context, getSoundNames()); spinner.setAdapter(spinnerAdapter); spinner.setSelection(spinnerAdapter.getPosition(sound != null ? sound.getName() : null)); return view; }
Source:
public static String readFileAsString(String path) throws IOException { log.debug("Reading file {}", path); byte[] allBytes = Files.readAllBytes(Paths.get(path)); return new String(allBytes, StandardCharsets.UTF_8); }

Target:
public static String readFileAsString(String path) throws IOException { try { byte[] allBytes = Files.readAllBytes(Paths.get(path)); return new String(allBytes, StandardCharsets.UTF_8); } catch (IOException ex) { throw new IOException("Unable to read file " + path, ex); } }
Source:
default void inputDetail() { or(mandatory(storageDomain().id()), mandatory(storageDomain().name())); or(optional(disk().name()), optional(disk().alias())); }

Target:
default void inputDetail() { or(mandatory(storageDomain().id()), mandatory(storageDomain().name())); or(optional(disk().name()), optional(disk().alias())); optional(diskProfile().id()); optional(quota().id()); }
Source:
private int computeSize(List<ByteBuffer> bufferList) { int size = 0; for (ByteBuffer buffer : bufferList) { if (buffer != null ) { size += buffer.array().length; } } return size; }

Target:
private int computeSize(List<ByteBuffer> bufferList) { int totalSize = 0; for (ByteBuffer buffer : bufferList) { totalSize += buffer.remaining(); } return totalSize; }
Source:
private void buildUnaryOperation(@Nonnull RegisterSpec destReg, @Nonnull JUnaryOperation unary) { SourcePosition unarySrcPos = RopHelper.getSourcePosition(unary); RegisterSpec srcRegisterSpec = getRegisterSpec(unary.getArg()); RegisterSpecList sources = RegisterSpecList.make(srcRegisterSpec); Rop opcode = null; switch(unary.getOp()) { case NEG: { assert unary.getType() == JPrimitiveTypeEnum.BYTE.getType() || unary.getType() == JPrimitiveTypeEnum.CHAR.getType() || unary.getType() == JPrimitiveTypeEnum.SHORT.getType() || unary.getType() == JPrimitiveTypeEnum.INT.getType() || unary.getType() == JPrimitiveTypeEnum.LONG.getType() || unary.getType() == JPrimitiveTypeEnum.FLOAT.getType() || unary.getType() == JPrimitiveTypeEnum.DOUBLE.getType(); opcode = Rops.opNeg(srcRegisterSpec); break; } case BIT_NOT: { assert unary.getType() == JPrimitiveTypeEnum.BYTE.getType() || unary.getType() == JPrimitiveTypeEnum.CHAR.getType() || unary.getType() == JPrimitiveTypeEnum.SHORT.getType() || unary.getType() == JPrimitiveTypeEnum.INT.getType() || unary.getType() == JPrimitiveTypeEnum.LONG.getType(); opcode = Rops.opNot(srcRegisterSpec); break; } case NOT: { assert unary.getType() == JPrimitiveTypeEnum.BOOLEAN.getType(); addInstruction( new PlainCstInsn( Rops.opXor(sources), unarySrcPos, destReg, sources, CstInteger.make(1))); return; } default: { throw new AssertionError("Unary operation not supported."); } } addInstruction(new PlainInsn(opcode, unarySrcPos, destReg, sources)); }

Target:
private void buildUnaryOperation(@Nonnull RegisterSpec destReg, @Nonnull JUnaryOperation unary) { SourcePosition unarySrcPos = RopHelper.getSourcePosition(unary); RegisterSpec srcRegisterSpec = getRegisterSpec(unary.getArg()); RegisterSpecList sources = RegisterSpecList.make(srcRegisterSpec); Rop opcode = null; switch(unary.getOp()) { case NEG: { assert unary.getType() == JPrimitiveTypeEnum.BYTE.getType() || unary.getType() == JPrimitiveTypeEnum.CHAR.getType() || unary.getType() == JPrimitiveTypeEnum.SHORT.getType() || unary.getType() == JPrimitiveTypeEnum.INT.getType() || unary.getType() == JPrimitiveTypeEnum.LONG.getType() || unary.getType() == JPrimitiveTypeEnum.FLOAT.getType() || unary.getType() == JPrimitiveTypeEnum.DOUBLE.getType(); opcode = Rops.opNeg(srcRegisterSpec); break; } case BIT_NOT: { assert unary.getType() == JPrimitiveTypeEnum.BYTE.getType() || unary.getType() == JPrimitiveTypeEnum.CHAR.getType() || unary.getType() == JPrimitiveTypeEnum.SHORT.getType() || unary.getType() == JPrimitiveTypeEnum.INT.getType() || unary.getType() == JPrimitiveTypeEnum.LONG.getType(); opcode = Rops.opNot(srcRegisterSpec); break; } case NOT: { assert unary.getType() == JPrimitiveTypeEnum.BOOLEAN.getType(); addInstruction( new PlainCstInsn( Rops.opXor(sources), unarySrcPos, destReg, sources, CstBoolean.make(true))); return; } default: { throw new AssertionError("Unary operation not supported."); } } addInstruction(new PlainInsn(opcode, unarySrcPos, destReg, sources)); }
Source:
private synchronized int purgeExpiredRecallRequests(long expirationTime, int purgeSize) { int n = new TapeRecallCatalog().purgeCatalog(expirationTime, purgeSize); if (n == 0) { log.trace("No entries have been purged from tape_recall table"); } else { log.info("{} entries have been purged from tape_recall table", n); } return n; }

Target:
private synchronized int purgeExpiredRecallRequests(long expirationTime, int purgeSize) { return new TapeRecallCatalog().purgeCatalog(expirationTime, purgeSize); }
Source:
private ExternalStatus(int value) { intValue = value; }

Target:
private ExternalStatus(int value) { id = value; }
Source:
public WorkflowVersion addAliases(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow version to modify.", required = true) @PathParam("workflowVersionId") Long workflowVersionId, @ApiParam(value = "Comma-delimited list of aliases.", required = true) @QueryParam("aliases") String aliases) { return workflowVersionResource.addAliases(user, workflowVersionId, aliases); }

Target:
public WorkflowVersion addAliases(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow version to modify.", required = true) @PathParam("workflowVersionId") Long workflowVersionId, @ApiParam(value = "Comma-delimited list of aliases.", required = true) @QueryParam("aliases") String aliases) { return addAliasesAndCheck(user, workflowVersionId, aliases, true); }
Source:
protected RESTRecord findParticipant(String participantUrl) { if (pendingList != null) { RecordListIterator i = new RecordListIterator(pendingList); AbstractRecord r; while ((r = i.iterate()) != null) { if (r instanceof RESTRecord) { RESTRecord rr = (RESTRecord) r; if (rr.getParticipantURI().equals(participantUrl)) return rr; } } } return null; }

Target:
private RESTRecord findParticipant(String participantUrl) { if (pendingList != null) { RecordListIterator i = new RecordListIterator(pendingList); AbstractRecord r; while ((r = i.iterate()) != null) { if (r instanceof RESTRecord) { RESTRecord rr = (RESTRecord) r; if (rr.getParticipantURI().equals(participantUrl)) return rr; } } } return null; }
Source:
public ResolvedTableAlter resolve(Schema schema) throws SchemaSyncError { Database database = schema.findDatabaseOrThrow(this.database); Table oldTable = database.findTableOrThrow(this.table); Table table = oldTable.copy(); if ( newTableName != null && newDatabase != null ) { schema.findDatabaseOrThrow(this.newDatabase); table.name = newTableName; table.database = newDatabase; } for (ColumnMod mod : columnMods) { mod.apply(table); } if ( convertCharset != null ) { for ( StringColumnDef sc : table.getStringColumns() ) { if ( !sc.getCharset().toLowerCase().equals("binary") ) sc.setCharset(convertCharset); } } if ( this.pks != null ) { table.setPKList(this.pks); } table.setDefaultColumnCharsets(); return new ResolvedTableAlter(this.database, this.table, oldTable, table); }

Target:
public ResolvedTableAlter resolve(Schema schema) throws InvalidSchemaError { Database database = schema.findDatabaseOrThrow(this.database); Table oldTable = database.findTableOrThrow(this.table); Table table = oldTable.copy(); if ( newTableName != null && newDatabase != null ) { schema.findDatabaseOrThrow(this.newDatabase); if ( schema.getCaseSensitivity() == CaseSensitivity.CONVERT_TO_LOWER ) newTableName = newTableName.toLowerCase(); table.name = newTableName; table.database = newDatabase; } for (ColumnMod mod : columnMods) { mod.apply(table); } if ( convertCharset != null ) { for ( StringColumnDef sc : table.getStringColumns() ) { if ( !sc.getCharset().toLowerCase().equals("binary") ) sc.setCharset(convertCharset); } } if ( this.pks != null ) { table.setPKList(this.pks); } table.setDefaultColumnCharsets(); return new ResolvedTableAlter(this.database, this.table, oldTable, table); }
Source:
public Validator getValidator() { return createValidator( constraintValidatorManager.getDefaultConstraintValidatorFactory(), valueExtractorManager, validatorFactoryScopedContext, methodValidationConfiguration ); }

Target:
public Validator getValidator() { return createValidator( constraintCreationContext.getConstraintValidatorManager().getDefaultConstraintValidatorFactory(), constraintCreationContext, validatorFactoryScopedContext, methodValidationConfiguration ); }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession httpSession = ((HttpServletRequest) request).getSession(); String engineSession = (String) httpSession.getAttribute(ENGINE_SESSION_ID_KEY); boolean authenticated = false; if (engineSession == null) { chain.doFilter(request, response); } else { try { InitialContext ctx = new InitialContext(); BackendLocal backend = (BackendLocal) ctx.lookup("java:global/engine/bll/Backend!org.ovirt.engine.core.common.interfaces.BackendLocal"); VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); if (backend.runPublicQuery(VdcQueryType.ValidateSession, parameters).getSucceeded()) { authenticated = true; } ctx.close(); httpSession.setAttribute("authenticated", authenticated); chain.doFilter(request, response); } catch (Exception ex) { } } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpSession httpSession = ((HttpServletRequest) request).getSession(); String engineSession = (String) httpSession.getAttribute(ENGINE_SESSION_ID_KEY); if (engineSession == null) { chain.doFilter(request, response); } else { InitialContext ctx = null; try { ctx = new InitialContext();; BackendLocal backend = (BackendLocal) ctx.lookup("java:global/engine/bll/Backend!org.ovirt.engine.core.common.interfaces.BackendLocal"); VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); httpSession.setAttribute("authenticated", backend.runPublicQuery(VdcQueryType.ValidateSession, parameters).getSucceeded()); ctx.close(); chain.doFilter(request, response); } catch (Exception ex) { log.error(String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage())); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } finally { try { ctx.close(); } catch (NamingException e) { } } } }
Source:
public B withService(ServiceCreationConfiguration<?, ?> config) { List<ServiceCreationConfiguration<?, ?>> newServiceConfigurations = new ArrayList<>(serviceConfigurations); newServiceConfigurations.removeIf(config.getClass()::isInstance); newServiceConfigurations.add(config); return newBuilderWith(newServiceConfigurations); }

Target:
public B withService(ServiceCreationConfiguration<?, ?> config) { List<ServiceCreationConfiguration<?, ?>> newServiceConfigurations = new ArrayList<>(serviceConfigurations); newServiceConfigurations.removeIf(other -> !other.compatibleWith(config) || !config.compatibleWith(other)); newServiceConfigurations.add(config); return newBuilderWith(newServiceConfigurations); }
Source:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION_FILTER_SORTING) < 0) { List<DDiagram> diagrams = dAnalysis.getOwnedViews().stream().flatMap(view -> view.getOwnedRepresentationDescriptors().stream()).map(desc -> desc.getRepresentation()) .filter(DDiagram.class::isInstance).map(DDiagram.class::cast).collect(Collectors.toList()); for (DDiagram dDiagram : diagrams) { List<FilterDescription> activatedFilters = new ArrayList<>(FilterService.sortFilters(dDiagram.getActivatedFilters())); dDiagram.getActivatedFilters().clear(); dDiagram.getActivatedFilters().addAll(activatedFilters); } } }

Target:
protected void postLoad(DAnalysis dAnalysis, Version loadedVersion) { if (loadedVersion.compareTo(MIGRATION_VERSION_FILTER_SORTING) < 0) { List<DDiagram> diagrams = dAnalysis.getOwnedViews().stream().flatMap(view -> view.getOwnedRepresentationDescriptors().stream()).map(desc -> desc.getRepresentation()) .filter(DDiagram.class::isInstance).map(DDiagram.class::cast).collect(Collectors.toList()); for (DDiagram dDiagram : diagrams) { List<FilterDescription> activatedFilters = new ArrayList<>(FilterService.sortFilters(dDiagram.getActivatedFilters())); dDiagram.getActivatedFilters().clear(); dDiagram.getActivatedFilters().addAll(activatedFilters); diagramUpdated++; } } }
Source:
Class getReturnType() { return null; }

Target:
Class getReturnType() { throw new IllegalArgumentException("Non applicable for Json getters"); }
Source:
static Instant lastModifiedInstant(Path path) { try { return Files.getLastModifiedTime(path, LinkOption.NOFOLLOW_LINKS) .toInstant(); } catch (IOException e) { return Instant.ofEpochMilli(path.toFile().lastModified()); } }

Target:
static Instant lastModifiedInstant(Path path) { try { return Files.getLastModifiedTime(path, LinkOption.NOFOLLOW_LINKS) .toInstant(); } catch (IOException e) { LOG.error(MessageFormat .format(JGitText.get().readLastModifiedFailed, path)); return Instant.ofEpochMilli(path.toFile().lastModified()); } }