auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ParseOsImages(Json json) { super(json, TypeLiteral.get(OsImages.class)); }

Target:
ParseOsImages(Json json) { super(json, TypeLiteral.get(OsImages.class)); }
Source:
public void isActiveReturnFalseWhenBeforeTimeInFuture() { int currentTime = Time.currentTime(); int futureTime = currentTime + 1; JsonWebToken jsonWebToken = new JsonWebToken(); jsonWebToken.notBefore(futureTime); assertFalse(jsonWebToken.isActive()); }

Target:
public void isActiveReturnFalseWhenBeforeTimeInFuture() { int currentTime = Time.currentTime(); int futureTime = currentTime + 10; JsonWebToken jsonWebToken = new JsonWebToken(); jsonWebToken.notBefore(futureTime); assertFalse(jsonWebToken.isActive()); }
Source:
public void close() { StandardException se = null; for (OperationContext ctx : activeContexts) { try { ctx.getOperation().close(); } catch (StandardException e) { se = e; LOG.error("Exception while closing operation", e); } } for (Future<Pair<OperationContext, Iterator<ExecRow>>> future : futures) { future.cancel(true); } if (se != null) Exceptions.throwAsRuntime(se); }

Target:
public void close() { StandardException se = null; for (OperationContext ctx : allContexts) { try { ctx.getOperation().close(); } catch (StandardException e) { se = e; LOG.error("Exception while closing operation", e); } } for (Future<Pair<OperationContext, Iterator<ExecRow>>> future : futures) { future.cancel(true); } if (se != null) Exceptions.throwAsRuntime(se); }
Source:
private static Method getDispatcherMethod(String dispatcherMethodName, Class<? extends Message> contextClass) { try { return ProcessManagerRepository.class.getMethod(dispatcherMethodName, Message.class, contextClass); } catch (NoSuchMethodException e) { throw propagate(e); } }

Target:
private static Method getDispatcherMethod(String dispatcherMethodName, Class<? extends Message> contextClass) { try { final Method method = ProcessManagerRepository.class.getMethod(dispatcherMethodName, Message.class, contextClass); return method; } catch (NoSuchMethodException e) { throw propagate(e); } }
Source:
public URL findResource(String name) { URL url = super.findResource(name); final Channel channel = channel(); if(url!=null || channel == null || !channel.isRemoteClassLoadingAllowed()) return url; try { if(resourceMap.containsKey(name)) { URLish f = resourceMap.get(name); if(f==null) return null; URL u = f.toURL(); if (u!=null) return u; } if (TESTING_RESOURCE_LOAD != null) TESTING_RESOURCE_LOAD.run(); long startTime = System.nanoTime(); ResourceFile r = proxy.getResource2(name); ResourceImageRef image=null; if (r!=null) image=r.image; channel.resourceLoadingTime.addAndGet(System.nanoTime()-startTime); channel.resourceLoadingCount.incrementAndGet(); if(image==null) { resourceMap.put(name,null); return null; } URLish res = image.resolveURL(channel, name).get(); resourceMap.put(name,res); return res.toURL(); } catch (IOException e) { throw new Error("Unable to load resource "+name,e); } catch (InterruptedException e) { throw new Error("Unable to load resource "+name,e); } catch (ExecutionException e) { throw new Error("Unable to load resource "+name,e); } }

Target:
public URL findResource(String name) { URL url = super.findResource(name); final Channel channel = channel(); if (url != null || channel == null || !channel.isRemoteClassLoadingAllowed()) { return url; } try { if (resourceMap.containsKey(name)) { URLish f = resourceMap.get(name); if (f == null) { return null; } URL u = f.toURL(); if (u != null) { return u; } } if (TESTING_RESOURCE_LOAD != null) { TESTING_RESOURCE_LOAD.run(); } long startTime = System.nanoTime(); ResourceFile r = proxy.getResource2(name); ResourceImageRef image = null; if (r != null) { image = r.image; } channel.resourceLoadingTime.addAndGet(System.nanoTime() - startTime); channel.resourceLoadingCount.incrementAndGet(); if (image == null) { resourceMap.put(name, null); return null; } URLish res = image.resolveURL(channel, name).get(); resourceMap.put(name, res); return res.toURL(); } catch (IOException | InterruptedException | ExecutionException e) { throw new Error("Unable to load resource " + name, e); } }
Source:
private static final String quoteValue(String value) { return "\"" + value + "\""; }

Target:
private static String quoteValue(String value) { return "\"" + value + "\""; }
Source:
public SelectorNodeMetric(MetricRegistry registry, String hostname, int port) { sendCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-RequestCount")); bytesSentLatency = registry.histogram(MetricRegistry.name(Selector.class, hostname + "-" + port + "- BytesSentLatencyInMs")); bytesReceivedLatency = registry.histogram(MetricRegistry.name(Selector.class, hostname + "-" + port + "- BytesReceivedLatencyInMs")); bytesSentCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-BytesSentCount")); bytesReceivedCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-BytesReceivedCount")); }

Target:
public SelectorNodeMetric(MetricRegistry registry, String hostname, int port) { sendCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-SendCount")); bytesSentLatency = registry.histogram(MetricRegistry.name(Selector.class, hostname + "-" + port + "- BytesSentLatencyInMs")); bytesReceivedLatency = registry.histogram(MetricRegistry.name(Selector.class, hostname + "-" + port + "- BytesReceivedLatencyInMs")); bytesSentCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-BytesSentCount")); bytesReceivedCount = registry.counter(MetricRegistry.name(Selector.class, hostname + "-" + port + "-BytesReceivedCount")); }
Source:
public <T> String buildHtml(T model) { if (model == null) { return null; } try { Context context = Context.newBuilder(model).resolver(resolvers).build(); return template.apply(context); } catch (IOException e) { LOGGER.warn("Failed to apply model to {}{}", htmlTemplate, TEMPLATE_SUFFIX, e); } return null; }

Target:
public <T> String buildHtml(T model) { if (model == null || template == null) { return null; } try { Context context = Context.newBuilder(model).resolver(resolvers).build(); return template.apply(context); } catch (IOException e) { LOGGER.warn("Failed to apply model to {}{}", htmlTemplate, TEMPLATE_SUFFIX, e); } return null; }
Source:
public void testNoTimeout() throws Exception { Ignite ignite = ignite(0); IgniteFuture fut = null; for (int i = 0; i < 10000; i++) { fut = ignite.compute().runAsync(new IgniteRunnable() { @Override public void run() { } }); } fut.get(); }

Target:
public void testNoTimeout() throws Exception { Ignite ignite = ignite(0); IgniteFuture fut = null; for (int i = 0; i < 10000; i++) { fut = ignite.compute().runAsync(new IgniteRunnable() { @Override public void run() { } }); } fut.get(); assertTrue(true); }
Source:
Name getTypeName() { String typeName = "Null"; if (shpFiles != null) { typeName = shpFiles.getTypeName(); } else { typeName = "Null"; } return new NameImpl(namespaceURI, typeName); }

Target:
Name getTypeName() { String typeName = "Null"; if (shpFiles != null) { typeName = shpFiles.getTypeName(); } return new NameImpl(namespaceURI, typeName); }
Source:
public void testCreateObjectFromFullModuleNamesWithException() throws Exception { final Method method = factory.getClass().getDeclaredMethod( "createObjectFromFullModuleNames", String.class, Set.class); method.setAccessible(true); final String name = "FooCheck"; final String barFullName = BASE_PACKAGE + ".packageobjectfactory.bar" + PACKAGE_SEPARATOR + name; final String fooFullName = BASE_PACKAGE + ".packageobjectfactory.foo" + PACKAGE_SEPARATOR + name; final Set<String> fullModuleNames = new HashSet<>(Arrays.asList(barFullName, fooFullName)); try { method.invoke(factory, name, fullModuleNames); fail("Exception is expected"); } catch (InvocationTargetException ex) { final String optionalNames = fullModuleNames.stream() .reduce((fullNames, fullName) -> fullNames + STRING_SEPARATOR + fullName).get(); final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE, new String[] {name, optionalNames}, null, getClass(), null); assertEquals(exceptionMessage.getMessage(), ex.getTargetException().getMessage()); } }

Target:
public void testCreateObjectFromFullModuleNamesWithException() throws Exception { final String barPackage = BASE_PACKAGE + ".packageobjectfactory.bar"; final String fooPackage = BASE_PACKAGE + ".packageobjectfactory.foo"; final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final PackageObjectFactory objectFactory = new PackageObjectFactory( new LinkedHashSet<>(Arrays.asList(barPackage, fooPackage)), classLoader); final String name = "FooCheck"; try { objectFactory.createModule(name); fail("Exception is expected"); } catch (CheckstyleException ex) { final String optionalNames = barPackage + PACKAGE_SEPARATOR + name + STRING_SEPARATOR + fooPackage + PACKAGE_SEPARATOR + name; final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, AMBIGUOUS_MODULE_NAME_EXCEPTION_MESSAGE, new String[] {name, optionalNames}, null, getClass(), null); assertEquals(exceptionMessage.getMessage(), ex.getMessage()); } }
Source:
private PhysicalOperation createRemoteSource(RemoteSourceNode node, LocalExecutionPlanContext context) { if (node.isOrdered()) { context.setDriverInstanceCount(1); } else if (!context.getDriverInstanceCount().isPresent()) { context.setDriverInstanceCount(getTaskConcurrency(session)); } OperatorFactory operatorFactory = new ExchangeOperatorFactory( context.getNextOperatorId(), node.getId(), context.getTaskExchangeClientManager(), new PagesSerdeFactory(blockEncodingSerde, isExchangeCompressionEnabled(session))); return new PhysicalOperation(operatorFactory, makeLayout(node), context, UNGROUPED_EXECUTION); }

Target:
private PhysicalOperation createRemoteSource(RemoteSourceNode node, LocalExecutionPlanContext context) { if (node.isEnsureSourceOrdering()) { context.setDriverInstanceCount(1); } else if (!context.getDriverInstanceCount().isPresent()) { context.setDriverInstanceCount(getTaskConcurrency(session)); } OperatorFactory operatorFactory = new ExchangeOperatorFactory( context.getNextOperatorId(), node.getId(), context.getTaskExchangeClientManager(), new PagesSerdeFactory(blockEncodingSerde, isExchangeCompressionEnabled(session))); return new PhysicalOperation(operatorFactory, makeLayout(node), context, UNGROUPED_EXECUTION); }
Source:
private static String discoverLfsUrl(Repository db, String purpose, Map<String, String> additionalHeaders, String remoteUrl) { try { URIish u = new URIish(remoteUrl); if (u.getScheme() == null || SCHEME_SSH.equals(u.getScheme())) { Protocol.ExpiringAction action = getSshAuthentication( db, purpose, remoteUrl, u); additionalHeaders.putAll(action.header); return action.href; } else { return remoteUrl + Protocol.INFO_LFS_ENDPOINT; } } catch (Exception e) { e.printStackTrace(); return null; } }

Target:
private static String discoverLfsUrl(Repository db, String purpose, Map<String, String> additionalHeaders, String remoteUrl) { try { URIish u = new URIish(remoteUrl); if (u.getScheme() == null || SCHEME_SSH.equals(u.getScheme())) { Protocol.ExpiringAction action = getSshAuthentication( db, purpose, remoteUrl, u); additionalHeaders.putAll(action.header); return action.href; } else { return remoteUrl + Protocol.INFO_LFS_ENDPOINT; } } catch (Exception e) { log.error(LfsText.get().cannotDiscoverLfs, e); return null; } }
Source:
public void testConcurrentMapMerge() { MetaData metaData = new MetaData(); Map<Object, Object> nestedMap = new HashMap<>(); metaData.addToTab("foo", "bar", nestedMap); nestedMap.put("whoops", null); Map<String, Object> mergedMap = MetaData.merge(metaData, metaData).store; assertFalse(mergedMap.containsKey("whoops")); }

Target:
public void testConcurrentMapMerge() { MetaData.merge(generateMetaData(), generateMetaData()); }
Source:
public int getContentViewId() { return R.layout.rsb_activity_step_switcher; }

Target:
public @LayoutRes int getContentViewId() { return R.layout.rsb_activity_step_switcher; }
Source:
private T waitForCompletionAndThrowIfUploadFailed() throws IOException { try { return uploadOperation.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); uploadOperation.cancel(true); IOException exception = new ClosedByInterruptException(); exception.addSuppressed(e); throw exception; } catch (ExecutionException e) { GoogleJsonResponseException exception = ApiErrorExtractor.getJsonResponseException(e.getCause()); if (exception != null && exception.getStatusCode() == 412) { throw (FileAlreadyExistsException) new FileAlreadyExistsException( String.format("Object %s already exists.", getResourceString())) .initCause(e.getCause()); } if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw new IOException( String.format("Upload failed for '%s'", getResourceString()), e.getCause()); } }

Target:
private T waitForCompletionAndThrowIfUploadFailed() throws IOException { try { return uploadOperation.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); uploadOperation.cancel(true); IOException exception = new ClosedByInterruptException(); exception.addSuppressed(e); throw exception; } catch (ExecutionException e) { if (e.getCause() instanceof Error) { throw (Error) e.getCause(); } throw new IOException( String.format("Upload failed for '%s'", getResourceString()), e.getCause()); } }
Source:
ThwackingElement(final String chan, final int stId, final boolean verifiable, final boolean createSubscriber) { channel = chan; streamId = stId; verify = verifiable; buffer = new ThreadLocal<UnsafeBuffer>() { @Override protected UnsafeBuffer initialValue() { return new UnsafeBuffer(ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE)); } }; isActive = new AtomicBoolean(false); lock = new ReentrantReadWriteLock(); msgCount = new AtomicInteger(0); if (createSubscriber) { msgHandler = new FragmentAssemblyAdapter(new Handler(this)::messageHandler); streamMap = new Int2ObjectHashMap<Long2ObjectHashMap<MessageStream>>(); } else { senderStream = new ThreadLocal<MessageStream>(); bytesSent = new ThreadLocal<Integer>(); previousSendFailed = new ThreadLocal<Boolean>() { @Override protected Boolean initialValue() { return false; } }; } }

Target:
ThwackingElement(final String chan, final int stId, final boolean verifiable, final boolean createSubscriber) { channel = chan; streamId = stId; verify = verifiable; buffer = new ThreadLocal<UnsafeBuffer>().withInitial( () -> new UnsafeBuffer(ByteBuffer.allocateDirect(DEFAULT_BUFFER_SIZE))); isActive = new AtomicBoolean(false); lock = new ReentrantReadWriteLock(); msgCount = new AtomicInteger(0); if (createSubscriber) { msgHandler = new FragmentAssemblyAdapter(new Handler(this)::messageHandler); streamMap = new Int2ObjectHashMap<Long2ObjectHashMap<MessageStream>>(); } else { senderStream = new ThreadLocal<MessageStream>(); bytesSent = new ThreadLocal<Integer>(); previousSendFailed = new ThreadLocal<Boolean>().withInitial(() -> false); } }
Source:
public CommentLinkInfo(Pattern pattern, String link) { this.pattern = pattern; this.link = checkNotNull(link); }

Target:
public CommentLinkInfo(Pattern pattern, String link) { this.pattern = checkNotNull(pattern); this.link = checkNotNull(link); }
Source:
public String lookupName(int id) { return null; }

Target:
public String lookupName(int id) { throw new UnsupportedOperationException("Map column doesn't support lookupName()"); }
Source:
private void formatAndSetErrorMessage(String message) { int urlIndex = message.indexOf(("http")); if (message != null && urlIndex != -1) { String beforeURL = message.substring(0, urlIndex); String url = message.substring(urlIndex); StringBuilder htmlPart = new StringBuilder(); htmlPart.append(beforeURL) .append("<a href=\"").append(url).append("\" target=\"_blank\">").append(url).append("</a>"); getView().setErrorMessage(htmlPart.toString(), true); } else { getView().setErrorMessage(message, false); } }

Target:
private void formatAndSetErrorMessage(String message) { int urlIndex = message.indexOf(("http")); if (message != null && urlIndex != -1) { String beforeURL = message.substring(0, urlIndex); String url = message.substring(urlIndex); StringBuilder htmlPart = new StringBuilder(); htmlPart.append(beforeURL) .append("<a href=\"").append(url).append("\" target=\"_blank\">").append(url).append("</a>"); getView().setErrorMessageHtml(htmlPart.toString()); } else { getView().setErrorMessageHtml(message); } }
Source:
void assertEqualsFloatWithDeltaWithUnequalValues() { AssertionFailedError e1 = expectThrows(AssertionFailedError.class, () -> assertEquals(0.5f, 0.2f, 0.2f)); assertMessageEndsWith(e1, "expected: <0.5> but was: <0.2>"); AssertionFailedError e2 = expectThrows(AssertionFailedError.class, () -> assertEquals(0.1f, 0.2f, 0.000001f)); assertMessageEndsWith(e2, "expected: <0.1> but was: <0.2>"); AssertionFailedError e3 = expectThrows(AssertionFailedError.class, () -> assertEquals(100.0f, 50.0f, 10.0f)); assertMessageEndsWith(e3, "expected: <100.0> but was: <50.0>"); AssertionFailedError e4 = expectThrows(AssertionFailedError.class, () -> assertEquals(-3.5f, -3.3f, -42.0f)); assertMessageEndsWith(e4, "expected: <-3.5> but was: <-3.3>"); AssertionFailedError e5 = expectThrows(AssertionFailedError.class, () -> assertEquals(+0.0f, -0.0f, -1.0f)); assertMessageEndsWith(e5, "expected: <0.0> but was: <-0.0>"); }

Target:
void assertEqualsFloatWithDeltaWithUnequalValues() { AssertionFailedError e1 = expectThrows(AssertionFailedError.class, () -> assertEquals(0.5f, 0.2f, 0.2f)); assertMessageEndsWith(e1, "expected: <0.5> but was: <0.2>"); AssertionFailedError e2 = expectThrows(AssertionFailedError.class, () -> assertEquals(0.1f, 0.2f, 0.000001f)); assertMessageEndsWith(e2, "expected: <0.1> but was: <0.2>"); AssertionFailedError e3 = expectThrows(AssertionFailedError.class, () -> assertEquals(100.0f, 50.0f, 10.0f)); assertMessageEndsWith(e3, "expected: <100.0> but was: <50.0>"); AssertionFailedError e4 = expectThrows(AssertionFailedError.class, () -> assertEquals(-3.5f, -3.3f, 0.01f)); assertMessageEndsWith(e4, "expected: <-3.5> but was: <-3.3>"); AssertionFailedError e5 = expectThrows(AssertionFailedError.class, () -> assertEquals(+0.0f, -0.001f, .00001f)); assertMessageEndsWith(e5, "expected: <0.0> but was: <-0.001>"); }
Source:
public long findFirstDate(long columnIndex, Date date) { if (date == null) { throw new IllegalArgumentException("null is not supported"); } return nativeFindFirstTimestamp(nativePtr, columnIndex, date.getTime() / 1000); }

Target:
public long findFirstDate(long columnIndex, Date date) { if (date == null) { throw new IllegalArgumentException("null is not supported"); } return nativeFindFirstTimestamp(nativePtr, columnIndex, date.getTime()); }
Source:
private void refreshActionModeTitle() { MediaOverviewPageViewModel pageViewModel = ViewModelProviders.of(this).get(MediaOverviewPageViewModel.class); pageViewModel.updateActionModeTitle(adapter.getSelectedMediaCount(), adapter.getSelectedMediaTotalFileSize(), detail, sorting, mediaType); }

Target:
private void refreshActionModeTitle() { pageViewModel.updateActionModeTitle(adapter.getSelectedMediaCount(), adapter.getSelectedMediaTotalFileSize(), detail, sorting, mediaType); }
Source:
protected Connection getDBConnection(final boolean autoCommit) throws IOException { Connection connection = null; SERVICE_PROVIDER.getInstance(CommonMetrics.class).markDBConnection(); final long startMs = System.currentTimeMillis(); try { connection = this.dataSource.getConnection(); connection.setAutoCommit(autoCommit); } catch (final Exception e) { DbUtils.closeQuietly(connection); throw new IOException("Error getting DB connection.", e); } SERVICE_PROVIDER.getInstance(CommonMetrics.class) .setDBConnectionTime(System.currentTimeMillis() - startMs); return connection; }

Target:
protected Connection getDBConnection(final boolean autoCommit) throws IOException { Connection connection = null; this.commonMetrics.markDBConnection(); final long startMs = System.currentTimeMillis(); try { connection = this.dataSource.getConnection(); connection.setAutoCommit(autoCommit); } catch (final Exception e) { DbUtils.closeQuietly(connection); throw new IOException("Error getting DB connection.", e); } this.commonMetrics.setDBConnectionTime(System.currentTimeMillis() - startMs); return connection; }
Source:
public void loginUser(String email, String password, final LoginCallback callback) { Map<String, ?extends Object> params = ImmutableMap.of("email", email, "password", password); invokeStaticMethod("login", params, new Adapter.JsonObjectCallback() { @Override public void onError(Throwable t) { callback.onError(t); } @Override public void onSuccess(JSONObject response) { if (response == null) { callback.onSuccess(null); } else { callback.onSuccess( createModel(JsonUtil.fromJson(response))); } } }); }

Target:
public void loginUser(String email, String password, final LoginCallback callback) { HashMap<String, Object> params = new HashMap<String, Object>(); params.put("email", email); params.put("password", password); invokeStaticMethod("login", params, new Adapter.JsonObjectCallback() { @Override public void onError(Throwable t) { callback.onError(t); } @Override public void onSuccess(JSONObject response) { RestAdapter radapter = (RestAdapter)getAdapter(); if ( accessTokenRepository == null ) { accessTokenRepository = radapter.createRepository(AccessTokenRepository.class); } AccessToken accessTokenModel = accessTokenRepository.createModel(JsonUtil.fromJson(response)); radapter.setAccessToken(accessTokenModel.getId()); callback.onSuccess(accessTokenModel); } }); }
Source:
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection<? extends E> coll) { if (coll == null) { throw new NullPointerException("Collection must not be null."); } for (int i = 0; i < 1000; i++) { if (coll instanceof BoundedCollection) { break; } if (coll instanceof org.apache.commons.collections4.collection.AbstractCollectionDecorator) { coll = ((org.apache.commons.collections4.collection.AbstractCollectionDecorator<E>) coll).decorated(); } else if (coll instanceof org.apache.commons.collections4.collection.SynchronizedCollection) { coll = ((org.apache.commons.collections4.collection.SynchronizedCollection<E>) coll).decorated(); } } if (coll instanceof BoundedCollection == false) { throw new IllegalArgumentException("Collection is not a bounded collection."); } return new UnmodifiableBoundedCollection<>((BoundedCollection<E>) coll); }

Target:
public static <E> BoundedCollection<E> unmodifiableBoundedCollection(Collection<? extends E> coll) { if (coll == null) { throw new NullPointerException("Collection must not be null."); } for (int i = 0; i < 1000; i++) { if (coll instanceof BoundedCollection) { break; } if (coll instanceof AbstractCollectionDecorator) { coll = ((AbstractCollectionDecorator<E>) coll).decorated(); } else if (coll instanceof SynchronizedCollection) { coll = ((SynchronizedCollection<E>) coll).decorated(); } } if (coll instanceof BoundedCollection == false) { throw new IllegalArgumentException("Collection is not a bounded collection."); } return new UnmodifiableBoundedCollection<>((BoundedCollection<E>) coll); }
Source:
void print(PrintWriter out) { seen.clear(); collisions.clear(); for (RelationModel r : rels) { for (ColumnModel c : r.getColumns()) { if (c.isNested()) { String type = getShortClassName(c); if (seen.contains(type)) { collisions.add(type); } else { seen.add(type); } } } } seen.clear(); for (RelationModel r : rels) { generateMessage(r.getPrimaryKey().getField(), out, true); } for (RelationModel r : rels) { generateMessage(r, out); } out.print("message Any" + schemaName + "PrimaryKey {\n"); for (RelationModel r : sortRelations(rels)) { ColumnModel pk = r.getPrimaryKey().getField(); out.print("\toptional " + getType(pk) + " " + r.getRelationName().toLowerCase() + " = " + r.getRelationID() + ";\n"); } out.print("}\n"); out.print("message Any" + schemaName + " {\n"); for (RelationModel r : sortRelations(rels)) { out.print("\toptional " + getMessageName(r) + " " + r.getRelationName().toLowerCase() + " = " + r.getRelationID() + ";\n"); } out.print("}\n"); }

Target:
void print(PrintWriter out) { seen.clear(); collisions.clear(); for (RelationModel r : rels) { for (ColumnModel c : r.getColumns()) { if (c.isNested()) { String type = getShortClassName(c); if (seen.contains(type)) { collisions.add(type); } else { seen.add(type); } } } } seen.clear(); for (RelationModel r : rels) { generateMessage(r.getPrimaryKey().getField(), out, true); } for (RelationModel r : rels) { generateMessage(r, out); } out.print("message Any" + schemaName + "PrimaryKey {\n"); for (RelationModel r : sortRelations(rels)) { ColumnModel pk = r.getPrimaryKey().getField(); out.print("\toptional " + getType(pk) + " " + r.getRelationName().toLowerCase() + " = " + r.getRelationID() + ";\n"); } out.print("}\n"); out.print("\n"); out.print("message Any" + schemaName + " {\n"); for (RelationModel r : sortRelations(rels)) { out.print("\toptional " + getMessageName(r) + " " + r.getRelationName().toLowerCase() + " = " + r.getRelationID() + ";\n"); } out.print("}\n"); }
Source:
private void processProjection(ServiceNode serviceNode) { List<Resolution> resolutions = LabelService.findResolutions(serviceNode); if (serviceNode.getProjectedVars() == null && resolutions.size() > 0) { serviceNode.setProjectedVars(resolutions .stream() .map(r -> (IVariable<?>)r.target()) .collect(Collectors.toSet())); } }

Target:
private void processProjection(ServiceNode serviceNode) { List<Resolution> resolutions = LabelService.findResolutions(serviceNode); if (serviceNode.getProjectedVars() == null && resolutions.size() > 0) { Set<IVariable<?>> inVars = new HashSet<>(); Set<IVariable<?>> outVars = new HashSet<>(); for (Resolution resolution: resolutions) { if (resolution.subject() instanceof IVariable) { inVars.add((IVariable<?>)resolution.subject()); } outVars.add(resolution.target()); } serviceNode.annotations().put(LabelService.LABEL_SERVICE_IN_VARS, inVars); serviceNode.annotations().put(LabelService.LABEL_SERVICE_OUT_VARS, outVars); HashSet<IVariable<?>> projectedVars = new HashSet<>(inVars); projectedVars.addAll(outVars); serviceNode.setProjectedVars(projectedVars); } }
Source:
public FaultDomain(FaultDomainType type, String id) { this.type = type; this.id = id; }

Target:
public FaultDomain(FaultDomainType type, String id) { Preconditions.checkNotNull(type, "Fault domain type (ex:rack) cannot be null."); Preconditions.checkNotNull(id, "Fault domain ID (rack ID) cannot be null."); this.type = type; this.id = id; }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); copyDepthMaterial.setFloat("zNear",activeCamera.getzNear(),true); copyDepthMaterial.setFloat("zFar",activeCamera.getzFar(),true); glViewport(0, 0, Display.getWidth(), Display.getHeight()); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final Subject subject = updateContext.getSubject(update); if (subject.hasPrincipal(Principal.OVERRIDE_MAINTAINER) || subject.hasPrincipal(Principal.ALLOC_MAINTAINER)) { return; } final RpslObject originalObject = update.getReferenceObject(); final RpslObject updatedObject = update.getUpdatedObject(); if (hasCountryChanged(originalObject, updatedObject, update.getAction())) { updateContext.addMessage(update, UpdateMessages.canOnlyBeChangedByRipeNCC(COUNTRY)); } }

Target:
public void validate(final PreparedUpdate update, final UpdateContext updateContext) { final Subject subject = updateContext.getSubject(update); if (subject.hasPrincipal(Principal.OVERRIDE_MAINTAINER) || subject.hasPrincipal(Principal.RS_MAINTAINER)) { return; } final RpslObject originalObject = update.getReferenceObject(); final RpslObject updatedObject = update.getUpdatedObject(); if (hasCountryChanged(originalObject, updatedObject, update.getAction())) { updateContext.addMessage(update, UpdateMessages.canOnlyBeChangedByRipeNCC(COUNTRY)); } }
Source:
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.method = method; }

Target:
public CosmosQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { super(method, metadata, factory); this.annotatedQueryValue = findAnnotatedQuery(method).orElse(null); }
Source:
private String getDeviceIpAddressFromSessionProvider(final DlmsDevice dlmsDevice) throws ProtocolAdapterException, FunctionalException { final SessionProvider sessionProvider = this.sessionProviderService .getSessionProvider(dlmsDevice.getCommunicationProvider()); String deviceIpAddress = null; try { deviceIpAddress = sessionProvider.getIpAddress(dlmsDevice.getIccId()); if (deviceIpAddress != null) { return deviceIpAddress; } this.jasperWirelessSmsClient.sendWakeUpSMS(dlmsDevice.getIccId()); deviceIpAddress = this.pollForSession(sessionProvider, dlmsDevice); } catch (final SessionProviderException e) { LOGGER.error("IccId is probably not supported in this session provider", e); throw new FunctionalException(FunctionalExceptionType.INVALID_ICCID, ComponentType.PROTOCOL_DLMS); } if ((deviceIpAddress == null) || "".equals(deviceIpAddress)) { throw new ProtocolAdapterException("Session provider: " + dlmsDevice.getCommunicationProvider() + " did not return an IP address for device: " + dlmsDevice.getDeviceIdentification() + "and iccId: " + dlmsDevice.getIccId()); } return deviceIpAddress; }

Target:
private String getDeviceIpAddressFromSessionProvider(final DlmsDevice dlmsDevice) throws ProtocolAdapterException, FunctionalException { final SessionProvider sessionProvider = this.sessionProviderService .getSessionProvider(dlmsDevice.getCommunicationProvider()); String deviceIpAddress = null; try { deviceIpAddress = sessionProvider.getIpAddress(dlmsDevice.getIccId()); if (deviceIpAddress != null) { return deviceIpAddress; } this.jasperWirelessSmsClient.sendWakeUpSMS(dlmsDevice.getIccId()); deviceIpAddress = this.pollForSession(sessionProvider, dlmsDevice); } catch (final SessionProviderException e) { LOGGER.error("IccId is probably not supported in this session provider", e); throw new FunctionalException(FunctionalExceptionType.INVALID_ICCID, ComponentType.PROTOCOL_DLMS, e); } if ((deviceIpAddress == null) || "".equals(deviceIpAddress)) { throw new ProtocolAdapterException("Session provider: " + dlmsDevice.getCommunicationProvider() + " did not return an IP address for device: " + dlmsDevice.getDeviceIdentification() + "and iccId: " + dlmsDevice.getIccId()); } return deviceIpAddress; }
Source:
public String toString() { return "MachineLogMessageImpl{" + "machine='" + machine + '\'' + ", content='" + content + '\'' + '}'; }

Target:
public String toString() { return "MachineLogMessageImpl{machineName='" + machineName + "', content='" + content + "'}"; }
Source:
public Map<Object, Object> loadInitialData() { Map<Object, Object> result = new HashedMap(); int linesToCache = cacheContext.getValue(CacheManager.CacheContext.NUM_INIT_CACHED_LINES_ATTR); int lineCount = 0; for (Map.Entry entry : DummyBackupStore.backupMap.entrySet()) { if (linesToCache > 0 && lineCount >= linesToCache) { break; } result.put(entry.getKey(), DummyBackupStore.backupMap.get(entry.getKey())); lineCount++; } return result; }

Target:
public Map<Object, Object> loadInitialData() { Map<Object, Object> result = new HashMap(); int linesToCache = cacheContext.getValue(CacheManager.CacheContext.NUM_INIT_CACHED_LINES_ATTR); int lineCount = 0; for (Map.Entry entry : DummyBackupStore.backupMap.entrySet()) { if (linesToCache > 0 && lineCount >= linesToCache) { break; } result.put(entry.getKey(), DummyBackupStore.backupMap.get(entry.getKey())); lineCount++; } return result; }
Source:
public void givenSubtypeOfGenericType_thenPamCorrectly() throws Exception { DomainInfo domainInfo = DomainInfo.create(org.neo4j.ogm.metadata.schema.generics.Person.class.getPackage().getName()); schema = new DomainInfoSchemaBuilder(domainInfo).build(); Node person = schema.findNode("Person"); Map<String, Relationship> relationships = person.relationships(); Relationship organisations = relationships.get("organisations"); assertThat(organisations).isNotNull(); assertThat(organisations.type()).isEqualTo("FOUNDED"); assertThat(organisations.direction(person)).isEqualTo(OUTGOING); assertThat(organisations.other(person)).isEqualTo(schema.findNode("Organisation")); Node entity = schema.findNode("Entity"); assertThat(entity.label()).isEqualTo("Entity"); Node company = schema.findNode("Company"); assertThat(company).as("Abstract non annotated classes should be ignored").isNull(); }

Target:
public void givenSubtypeOfGenericType_thenPamCorrectly() throws Exception { DomainInfo domainInfo = DomainInfo.create(org.neo4j.ogm.metadata.schema.generics.Person.class.getPackage().getName()); schema = new DomainInfoSchemaBuilder(domainInfo).build(); Node person = schema.findNode("Person"); Map<String, Relationship> relationships = person.relationships(); Relationship organisations = relationships.get("organisations"); assertThat(organisations).isNotNull(); assertThat(organisations.type()).isEqualTo("FOUNDED"); assertThat(organisations.direction(person)).isEqualTo(OUTGOING); assertThat(organisations.other(person)).isEqualTo(schema.findNode("Organisation")); }
Source:
public void postProcess() { uniqueID = UUID.randomUUID().toString(); if (hasMissingAttributes()) { int failuresCount = 0; int skippedCount = 0; int errorsCount = 0; Double totalTime = 0.0; for (TestCaseModel test : testcase) { if (test.getOverallStatus().equals(Constants.FAILED)) { failuresCount++; } else if (test.getOverallStatus().equals(Constants.ERRORED)) { errorsCount++; } else if (test.getOverallStatus().equals(Constants.SKIPPED)) { skippedCount++; } totalTime += Double.parseDouble(test.getTime()); } if (failures == null) failures = Integer.toString(failuresCount); if (skipped == null) skipped = Integer.toString(skippedCount); if (tests == null) tests = Integer.toString(testcase.size()); if (time == null) time = Double.toString(totalTime); if (errors == null) errors = Integer.toString(errorsCount); System.out.println("LOL\n"); } if (Integer.parseInt(failures) > 0 || Integer.parseInt(errors) > 0) { overallStatus = Constants.FAILED; } else { overallStatus = Constants.PASSED; } }

Target:
public void postProcess() { uniqueID = UUID.randomUUID().toString(); if (hasMissingAttributes()) { int failuresCount = 0; int skippedCount = 0; int errorsCount = 0; Double totalTime = 0.0; for (TestCaseModel test : testcase) { if (test.getOverallStatus().equals(Constants.FAILED)) { failuresCount++; } else if (test.getOverallStatus().equals(Constants.ERRORED)) { errorsCount++; } else if (test.getOverallStatus().equals(Constants.SKIPPED)) { skippedCount++; } totalTime += Double.parseDouble(test.getTime()); } if (failures == null) { failures = Integer.toString(failuresCount); } if (skipped == null) { skipped = Integer.toString(skippedCount); } if (tests == null) { tests = Integer.toString(testcase.size()); } if (time == null) { time = Double.toString(totalTime); } if (errors == null) { errors = Integer.toString(errorsCount); } } if (Integer.parseInt(failures) > 0 || Integer.parseInt(errors) > 0) { overallStatus = Constants.FAILED; } else { overallStatus = Constants.PASSED; } }
Source:
public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineBackupLogDao(); existingEngineBackupLog = dao.getLastSuccessfulEngineBackup(DB_NAME); newEntity = new EngineBackupLog(); newEntity.setDbName("asd"); newEntity.setOutputMessage("asd"); newEntity.setDoneAt(new Date()); newEntity.setPassed(true); }

Target:
public void setUp() throws Exception { super.setUp(); dao = dbFacade.getEngineBackupLogDao(); existingEngineBackupLog = dao.getLastSuccessfulEngineBackup(DB_NAME); newEntity = new EngineBackupLog(); newEntity.setDbName(RandomUtils.instance().nextString(20)); newEntity.setOutputMessage(RandomUtils.instance().nextString(20)); newEntity.setDoneAt(new Date()); newEntity.setPassed(true); }
Source:
public void testGetValidityInfoForNonHtmlField_unsanitizedInput_returnErrorString() { String unsanitizedInput = "Invalid unsanitized input <>\"/'&"; String testFieldName = "Inconsequential test field name"; String actual = validator.getValidityInfoForNonHtmlField(testFieldName, unsanitizedInput); assertEquals("Invalid unsanitized input should return error string", "The provided Inconsequential test field name is not acceptable to TEAMMATES as it " + "cannot contain the following special html characters in brackets: (&lt; &gt; \" " + "&#x2f; &#39; &amp;)", actual); }

Target:
public void testGetValidityInfoForNonHtmlField_unsanitizedInput_returnErrorString() { String unsanitizedInput = "Invalid unsanitized input <>\"/'&"; String testFieldName = "Inconsequential test field name"; String actual = validator.getValidityInfoForNonHtmlField(testFieldName, unsanitizedInput); assertEquals("Invalid unsanitized input should return error string", "The provided Inconsequential test field name is not acceptable to TEAMMATES as it " + "cannot contain the following special html characters in brackets: (&lt; &gt; &quot; " + "&#x2f; &#39; &amp;)", actual); }
Source:
public void setSupertype(TypeName typeName) { if (supertype.isPresent()) { throw new IllegalStateException("Supertype already set to " + writeToString(supertype.get())); } checkArgument(!anonymous, "Anonymous classes cannot declare supertypes"); supertype = Optional.of(typeName); }

Target:
public void setSupertype(TypeName typeName) { if (supertype.isPresent()) { throw new IllegalStateException("Supertype already set to " + writeToString(supertype.get())); } supertype = Optional.of(typeName); }
Source:
public void started() { AdministrationService administrationService= org.openmrs.api.context.Context.getAdministrationService(); AijarService aijarService= org.openmrs.api.context.Context.getService(AijarService.class); if (administrationService.getGlobalProperty(GP_NHPI).equalsIgnoreCase(GP_NHPI_VALUE)) { aijarService.setAlertForAllUsers(GP_NHPI_DEFAULT_ALERT_MESSAGE); log.info("Creating alert "+GP_NHPI_DEFAULT_ALERT_MESSAGE); } if (administrationService.getGlobalProperty(GP_HEALTH_CENTER_NAME).equalsIgnoreCase(GP_HEALTH_CENTER_NAME_VALUE)) { aijarService.setAlertForAllUsers(GP_HEALTH_CENTER_NAME_DEFAULT_ALERT_MESSAGE); log.info("Creating alert "+GP_HEALTH_CENTER_NAME_DEFAULT_ALERT_MESSAGE); } if (administrationService.getGlobalProperty(GP_DHIS2).equalsIgnoreCase(GP_DHIS2_VALUE)) { aijarService.setAlertForAllUsers(GP_DHIS2_DEFAULT_ALERT_MESSAGE); log.info("Creating alert "+GP_DHIS2_DEFAULT_ALERT_MESSAGE); } }

Target:
public void started() { createAlertWhenDefaultIsNotSet(GP_NHPI, GP_NHPI_VALUE, GP_NHPI_DEFAULT_ALERT_MESSAGE); createAlertWhenDefaultIsNotSet(GP_HEALTH_CENTER_NAME, GP_HEALTH_CENTER_NAME_VALUE, GP_HEALTH_CENTER_NAME_DEFAULT_ALERT_MESSAGE); createAlertWhenDefaultIsNotSet(GP_DHIS2, GP_DHIS2_VALUE, GP_DHIS2_DEFAULT_ALERT_MESSAGE); }
Source:
public void decapitalizeShouldReturnDecapizalizedWordOnTurkishLocale() { Locale.setDefault(new Locale("tr", "TR")); assertEquals( StringHelper.decapitalize( "IsIsolationLevelGuaranteed" ), "isIsolationLevelGuaranteed" ); }

Target:
public void decapitalizeShouldReturnDecapizalizedWordOnTurkishLocale() { Locale defaultLocale = Locale.getDefault(); Locale.setDefault( new Locale( "tr" , "TR" ) ); assertEquals( StringHelper.decapitalize( "IsIsolationLevelGuaranteed" ), "isIsolationLevelGuaranteed" ); Locale.setDefault( defaultLocale ); }
Source:
private void addProfile(MultipartHttpServletRequest request, ModelMap model) { List<String> lines = new ArrayList<>(); MultipartFile mpf = request.getFile("file"); if (mpf != null) { String message = ""; String filename = mpf.getOriginalFilename(); try { File tempFile = File.createTempFile("profile", null); mpf.transferTo(tempFile); boolean exResult = execute(VALIDATE_CMD, tempFile, lines); if (exResult) { filename = getNextVersionedFilename(mpf.getOriginalFilename()); File newFile = new File(profileDir, filename); FileUtils.moveFile(tempFile, newFile); model.addAttribute("success", true); message = "Success adding profile: "; } else { model.addAttribute("success", false); message = "Error adding profile: "; } } catch (Exception e) { model.addAttribute("success", false); message = "Problem saving uploaded profile: "; lines.add(e.getMessage()); log.error("Problem saving uploaded profile", e); } finally { model.addAttribute("operation", "add"); model.addAttribute("message", message + filename); model.addAttribute("filename", filename); model.addAttribute("output", StringUtils.join(lines, "\n")); } } }

Target:
private void addProfile(MultipartHttpServletRequest request, ModelMap model) { List<String> lines = new ArrayList<>(); MultipartFile mpf = request.getFile("file"); if (mpf != null) { String message = ""; String filename = mpf.getOriginalFilename(); try { File tempFile = File.createTempFile("profile", null); mpf.transferTo(tempFile); boolean exResult = execute(VALIDATE_CMD, tempFile, lines); if (exResult) { filename = getNextVersionedFilename(filename); File newFile = new File(profileDir, filename); FileUtils.moveFile(tempFile, newFile); model.addAttribute("success", true); message = "Success adding profile: "; } else { model.addAttribute("success", false); message = "Error adding profile: "; } } catch (Exception e) { model.addAttribute("success", false); message = "Problem saving uploaded profile: "; lines.add(e.getMessage()); log.error("Problem saving uploaded profile", e); } finally { model.addAttribute("operation", "add"); model.addAttribute("message", message + filename); model.addAttribute("filename", filename); model.addAttribute("output", StringUtils.join(lines, "\n")); } } }
Source:
protected Object cleanSimplePropertyValue( Class<? extends PersistableBusinessObject> businessObjectClass, RassPropertyDefinition propertyMapping, Object propertyValue) { if (propertyValue instanceof String) { propertyValue = cleanStringValue(businessObjectClass, propertyMapping, (String) propertyValue); } else if (propertyValue instanceof Date) { propertyValue = cleanDateValue(businessObjectClass, propertyMapping.getBoPropertyName(), (Date) propertyValue); } else if (propertyValue instanceof Boolean) { return cleanBooleanValue(businessObjectClass, propertyMapping.getBoPropertyName(), (Boolean) propertyValue); } else if (LOG.isDebugEnabled()) { String propertyNameForLogging = StringUtils.defaultIfBlank(propertyMapping.getBoPropertyName(), "[Blank]"); if (ObjectUtils.isNull(propertyValue)) { LOG.debug("cleanSimplePropertyValue, property " + propertyNameForLogging + " is null on business object " + businessObjectClass.getName()); } else { LOG.debug("cleanSimplePropertyValue, no cleaning for property " + propertyNameForLogging + " on business object " + businessObjectClass.getName() + " (value: " + propertyValue.toString() + ")"); } } return propertyValue; }

Target:
protected Object cleanSimplePropertyValue( Class<? extends PersistableBusinessObject> businessObjectClass, RassPropertyDefinition propertyMapping, Object propertyValue) { Object cleanedValue = propertyValue; if (propertyValue instanceof String) { cleanedValue = cleanStringValue(businessObjectClass, propertyMapping, (String) propertyValue); } else if (propertyValue instanceof Date) { cleanedValue = cleanDateValue(businessObjectClass, propertyMapping.getBoPropertyName(), (Date) propertyValue); } else if (propertyValue instanceof Boolean) { cleanedValue = cleanBooleanValue(businessObjectClass, propertyMapping.getBoPropertyName(), (Boolean) propertyValue); } else if (LOG.isDebugEnabled()) { String propertyNameForLogging = StringUtils.defaultIfBlank(propertyMapping.getBoPropertyName(), "[Blank]"); if (ObjectUtils.isNull(propertyValue)) { LOG.debug("cleanSimplePropertyValue, property " + propertyNameForLogging + " is null on business object " + businessObjectClass.getName()); } else { LOG.debug("cleanSimplePropertyValue, no cleaning for property " + propertyNameForLogging + " on business object " + businessObjectClass.getName() + " (value: " + propertyValue.toString() + ")"); } } return cleanedValue; }
Source:
public void testElideGetInvalidKey() throws Exception { DataStore store = mock(DataStore.class); Elide elide = getElide(store, dictionary, MOCK_AUDIT_LOGGER); MultivaluedMap<String, String> headers = new MultivaluedHashMap<>(); headers.putSingle("fields[testModel]", "field"); headers.putSingle("?filter", "field"); ElideResponse response = elide.get(baseUrl, "/testModel/1", headers, null, NO_VERSION); assertEquals(HttpStatus.SC_BAD_REQUEST, response.getResponseCode()); assertEquals("{\"errors\":[{\"detail\":\"Found undefined keys in request: ?filter\"}]}", response.getBody()); }

Target:
public void testElideGetInvalidKey() throws Exception { DataStore store = mock(DataStore.class); Elide elide = getElide(store, dictionary, MOCK_AUDIT_LOGGER); MultivaluedMap<String, String> queryParams = new MultivaluedHashMap<>(); queryParams.putSingle("fields[testModel]", "field"); queryParams.putSingle("?filter", "field"); queryParams.putSingle("Sort", "field"); queryParams.putSingle("INCLUDE", "field"); queryParams.putSingle("fields.testModel", "field"); queryParams.putSingle("page.size", "10"); ElideResponse response = elide.get(baseUrl, "/testModel/1", queryParams, null, NO_VERSION); assertEquals(HttpStatus.SC_BAD_REQUEST, response.getResponseCode()); assertEquals("{\"errors\":[{\"detail\":\"Found undefined keys in request: fields.testModel, ?filter, Sort, page.size, INCLUDE\"}]}", response.getBody()); }
Source:
private static void registerGeoShapeBoundsAggregator(ValuesSourceRegistry.Builder builder) { builder.register(GeoBoundsAggregationBuilder.NAME, GeoShapeValuesSourceType.instance(), (GeoBoundsAggregatorSupplier) (name, aggregationContext, parent, valuesSourceConfig, wrapLongitude, metadata) -> new GeoShapeBoundsAggregator(name, aggregationContext, parent, valuesSourceConfig, wrapLongitude, metadata)); }

Target:
private static void registerGeoShapeBoundsAggregator(ValuesSourceRegistry.Builder builder) { builder.register(GeoBoundsAggregationBuilder.NAME, GeoShapeValuesSourceType.instance(), (GeoBoundsAggregatorSupplier) GeoShapeBoundsAggregator::new); }
Source:
void recover() { if (isStartRefused.get()) { LOG.warn("Recovery of the workspaces is rejected."); return; } Set<RuntimeIdentity> identities; try { identities = infrastructure.getIdentities(); } catch (UnsupportedOperationException e) { LOG.warn("Not recoverable infrastructure: '{}'", infrastructure.getName()); return; } catch (InfrastructureException e) { LOG.error( "An error occurred while attempted to recover runtimes using infrastructure '{}'. Reason: '{}'", infrastructure.getName(), e.getMessage()); return; } for (RuntimeIdentity identity : identities) { try { recoverOne(infrastructure, identity); } catch (ServerException | ConflictException e) { LOG.error( "An error occurred while attempted to recover runtimes using infrastructure '{}'. Reason: '{}'", infrastructure.getName(), e.getMessage()); } } }

Target:
void recover() { if (isStartRefused.get()) { LOG.warn("Recovery of the workspaces is rejected."); return; } Set<RuntimeIdentity> identities; try { identities = infrastructure.getIdentities(); } catch (UnsupportedOperationException e) { LOG.warn("Not recoverable infrastructure: '{}'", infrastructure.getName()); return; } catch (InfrastructureException e) { LOG.error( "An error occurred while attempting to get runtime identities for infrastructure '{}'. Reason: '{}'", infrastructure.getName(), e.getMessage()); return; } for (RuntimeIdentity identity : identities) { try { recoverOne(infrastructure, identity); } catch (ServerException | ConflictException e) { LOG.error( "An error occurred while attempting to recover runtimes using infrastructure '{}'. Reason: '{}'", infrastructure.getName(), e.getMessage()); } } }