auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String getNamespaceURI() { if (namespaceURI == null) { namespaceURI = ClassUtils.getPackageName(getNativeWidget() .getClass()); } System.err.println(namespaceURI); return namespaceURI; }

Target:
public String getNamespaceURI() { if (namespaceURI == null) { namespaceURI = ClassUtils.getPackageName(getNativeWidget() .getClass()); } return namespaceURI; }
Source:
protected static void setOverrideFileName(String... path) { String filePaths = Joiner.on(LIST_SEPARATOR).skipNulls().join(path); fOverridePath = filePaths == null ? null : filePaths.isEmpty() ? null : filePaths; fOverride = true; }

Target:
public static void setOverrideFileName(String... path) { fOverridePath = (path == null) ? null : path; fOverride = true; }
Source:
public void into(RemoteViews remoteViews, int viewId, int notificationId, Notification notification) { if (remoteViews == null) { throw new IllegalArgumentException("RemoteViews must not be null."); } if (notification == null) { throw new IllegalArgumentException("Notification must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with RemoteViews."); } Request finalData = picasso.transformRequest(data.build()); String key = createKey(finalData); RemoteViewsAction action = new NotificationAction(picasso, finalData, remoteViews, viewId, notificationId, notification, skipMemoryCache, errorResId, key); performRemoteViewInto(action); }

Target:
public void into(RemoteViews remoteViews, int viewId, int notificationId, Notification notification) { if (remoteViews == null) { throw new IllegalArgumentException("RemoteViews must not be null."); } if (notification == null) { throw new IllegalArgumentException("Notification must not be null."); } if (deferred) { throw new IllegalStateException("Fit cannot be used with RemoteViews."); } if (placeholderDrawable != null || errorDrawable != null) { throw new IllegalArgumentException( "Cannot use placeholder or error drawables with remote views."); } Request finalData = picasso.transformRequest(data.build()); String key = createKey(finalData); RemoteViewsAction action = new NotificationAction(picasso, finalData, remoteViews, viewId, notificationId, notification, skipMemoryCache, errorResId, key); performRemoteViewInto(action); }
Source:
public String createSortTitle(String title) { if (title == null) { return null; } for (String prefix : prefixes) { String prefixWithLeadingSpace = prefix + " "; if (title.startsWith(prefixWithLeadingSpace)) { return title.substring(prefixWithLeadingSpace.length()) + ", " + prefix; } } return title; }

Target:
public String createSortTitle(String title) { if (title == null) { return null; } for (Map.Entry<String, String> prefix : prefixToPrefixWithLeadingSpace.entrySet()) { String prefixWithLeadingSpace = prefix.getValue(); if (title.startsWith(prefixWithLeadingSpace)) { return title.substring(prefixWithLeadingSpace.length()) + ", " + prefix.getKey(); } } return title; }
Source:
public static void main(String[] args) throws Exception { File f = new File("/home/kohsuke/ws/hudson/investigations/javafx-windows-hang/out.log"); DataInputStream fin = new DataInputStream(new FileInputStream(f)); fin.readFully(new byte[4]); try (ObjectInputStream ois = new ObjectInputStream(fin)) { for (int n=0; ; n++) { Command o = (Command)ois.readObject(); System.out.println("#"+n+" : "+o); if (o instanceof RPCRequest) { RPCRequest request = (RPCRequest) o; System.out.print(" ("); boolean first=true; for (Object argument : request.getArguments()) { if(first) first=false; else System.out.print(","); System.out.print(argument); } System.out.println(")"); } if (o.createdAt!=null) o.createdAt.printStackTrace(System.out); } } }

Target:
public static void main(String[] args) throws Exception { File f = new File("/home/kohsuke/ws/hudson/investigations/javafx-windows-hang/out.log"); try (DataInputStream fin = new DataInputStream(new FileInputStream(f))) { fin.readFully(new byte[4]); try (ObjectInputStream ois = new ObjectInputStream(fin)) { for (int n=0; ; n++) { Command o = (Command)ois.readObject(); System.out.println("#"+n+" : "+o); if (o instanceof RPCRequest) { RPCRequest request = (RPCRequest) o; System.out.print(" ("); boolean first=true; for (Object argument : request.getArguments()) { if(first) first=false; else System.out.print(","); System.out.print(argument); } System.out.println(")"); } if (o.createdAt!=null) o.createdAt.printStackTrace(System.out); } } } }
Source:
private static JSONObject echo(RestRequestMetadata restRequestMetadata, AdminMetrics adminMetrics) throws RestServiceException { Map<String, List<String>> parameters = restRequestMetadata.getArgs(); if (parameters != null && parameters.containsKey(TEXT_KEY)) { try { String text = parameters.get(TEXT_KEY).get(0); return packageResult(text); } catch (JSONException e) { logger.error("While trying to construct response for echo GET: Exception - ", e); adminMetrics.echoGetResponseBuildingError.inc(); throw new RestServiceException("Unable to construct result object - ", e, RestServiceErrorCode.ResponseBuildingFailure); } } else { logger.debug("While trying to handle echo GET: Request missing parameter - {}", TEXT_KEY); adminMetrics.echoGetMissingParameter.inc(); throw new RestServiceException("Request missing parameter - " + TEXT_KEY, RestServiceErrorCode.MissingArgs); } }

Target:
private static JSONObject echo(RestRequestMetadata restRequestMetadata, AdminMetrics adminMetrics) throws RestServiceException { Map<String, List<String>> parameters = restRequestMetadata.getArgs(); if (parameters != null && parameters.containsKey(TEXT_KEY)) { String text = parameters.get(TEXT_KEY).get(0); logger.trace("Text to echo for request is {}", restRequestMetadata.getUri(), text); try { return packageResult(text); } catch (JSONException e) { adminMetrics.echoGetResponseBuildingError.inc(); throw new RestServiceException("Unable to construct result JSON object during echo GET - ", e, RestServiceErrorCode.ResponseBuildingFailure); } } else { adminMetrics.echoGetMissingParameterError.inc(); throw new RestServiceException("Request for echo GET missing parameter - " + TEXT_KEY, RestServiceErrorCode.MissingArgs); } }
Source:
public Subfield(String path) { requireNonNull(path, "path is null"); SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); checkArgument(tokenizer.hasNext(), "Column name is missing: " + path); PathElement firstElement = tokenizer.next(); checkArgument(firstElement instanceof NestedField, "Subfield path must start with a column name: " + path); this.name = ((NestedField) firstElement).getName(); List<PathElement> pathElements = new ArrayList<>(); tokenizer.forEachRemaining(pathElements::add); this.path = Collections.unmodifiableList(pathElements); }

Target:
public Subfield(String path) { requireNonNull(path, "path is null"); SubfieldTokenizer tokenizer = new SubfieldTokenizer(path); checkArgument(tokenizer.hasNext(), "Column name is missing: " + path); PathElement firstElement = tokenizer.next(); checkArgument(firstElement instanceof NestedField, "Subfield path must start with a name: " + path); this.name = ((NestedField) firstElement).getName(); List<PathElement> pathElements = new ArrayList<>(); tokenizer.forEachRemaining(pathElements::add); this.path = Collections.unmodifiableList(pathElements); }
Source:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); Schema schema = context.getInputSchema(); if (schema == null || schema.getFields() == null) { return; } FieldOperation operation = new FieldTransformOperation("Parse", "Parsed field", schema.getFields().stream().map(Schema.Field::getName) .collect(Collectors.toList()), uniqueFields); context.record(Collections.singletonList(operation)); }

Target:
public void prepareRun(BatchAggregatorContext context) throws Exception { super.prepareRun(context); TransformLineageRecorderUtils.generateOneToOnes(dedupConfig.getUniqueFields(), "dedup", "Removed duplicate records.."); }
Source:
private ArrayList<BlobId> generateBlobId(ArrayList<String> blobIdListStr, ClusterMap map) throws IOException { ArrayList<BlobId> blobIdList = new ArrayList<BlobId>(); for(String blobIdStr: blobIdListStr) { BlobId blobId = new BlobId(blobIdStr, map); blobIdList.add(blobId); } return blobIdList; }

Target:
private ArrayList<BlobId> generateBlobId(ArrayList<String> blobIdListStr, ClusterMap map) throws IOException { ArrayList<BlobId> blobIdList = new ArrayList<BlobId>(); for (String blobIdStr : blobIdListStr) { try { BlobId blobId = new BlobId(blobIdStr, map); blobIdList.add(blobId); } catch (IOException e) { System.out.println("IOException thrown for blobId " + blobIdStr); invalidBlobs.put(blobIdStr, e); } catch (IllegalArgumentException e) { System.out.println("IllegalArgumentException thrown for blobId " + blobIdStr); invalidBlobs.put(blobIdStr, e); } } return blobIdList; }
Source:
public static Function<HttpPollValue, Double> latency() { return new Function<HttpPollValue, Double>() { @Override @Nullable public Double apply(HttpPollValue input) { if (input.getLatencyFullContent()==null) return null; return input.getLatencyFullContent().doubleValue(); } }; }

Target:
public static Function<HttpPollValue, Long> latency() { return new Function<HttpPollValue, Long>() { public Long apply(HttpPollValue input) { return input.getLatencyFullContent(); } }; }
Source:
public void testConstructor() throws Exception { HttpTransport transport = new MockHttpTransport(); HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL); HttpResponse response = request.execute(); HttpHeaders headers = response.getHeaders(); HttpResponseException e = new HttpResponseException(response); assertThat(e).hasMessageThat().isEqualTo("200\nRequest URL: " + SIMPLE_GENERIC_URL); assertNull(e.getContent()); assertEquals(200, e.getStatusCode()); assertNull(e.getStatusMessage()); assertTrue(headers == e.getHeaders()); }

Target:
public void testConstructor() throws Exception { HttpTransport transport = new MockHttpTransport(); HttpRequest request = transport.createRequestFactory().buildGetRequest(SIMPLE_GENERIC_URL); HttpResponse response = request.execute(); HttpHeaders headers = response.getHeaders(); HttpResponseException responseException = new HttpResponseException(response); assertThat(responseException).hasMessageThat().isEqualTo("200\nGET " + SIMPLE_GENERIC_URL); assertNull(responseException.getContent()); assertEquals(200, responseException.getStatusCode()); assertNull(responseException.getStatusMessage()); assertTrue(headers == responseException.getHeaders()); }
Source:
public void createDatastore(Datastore datastore) { final String name = datastore.getName(); synchronized (_datastoreCatalog) { if (_datastoreCatalog.containsDatastore(name)) { logger.warn("Datastore '{}' already exists. No new datastore will be created!", name); } else { if (_datastoreCatalog instanceof MutableDatastoreCatalog) { ((MutableDatastoreCatalog) _datastoreCatalog).addDatastore(datastore); } else { logger.error("Tried to create datastore '{}', but the datastore catalog is not mutable", name); } } } }

Target:
public void createDatastore(Datastore datastore) { final String name = datastore.getName(); synchronized (_datastoreCatalog) { if (_datastoreCatalog.containsDatastore(name)) { logger.warn("Datastore '{}' already exists. No new datastore will be created!", name); } else { if (_datastoreCatalog instanceof MutableDatastoreCatalog) { ((MutableDatastoreCatalog) _datastoreCatalog).addDatastore(datastore); } else { throw new IllegalStateException("Tried to create datastore '" + name + "', but the datastore catalog is not mutable"); } } } }
Source:
private void removeImages() { List<CinderDisk> cinderDisks = new ArrayList<>(); for (final DiskImage source : getSourceImages()) { if (source.getDiskStorageType() == DiskStorageType.CINDER) { cinderDisks.add((CinderDisk) source); continue; } List<DiskImage> images = diskImageDao.getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDiskLive) { CommandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest, getSnapshotActionType()), cloneContextAndDetachFromParent()); } else { RemoveSnapshotSingleDiskParameters parameters = buildRemoveSnapshotSingleDiskParameters( source, dest, getSnapshotActionType()); VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), parameters); if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDisk) { getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } if (!cinderDisks.isEmpty()) { handleCinderSnapshotDisks(cinderDisks); } }

Target:
private void removeImages() { List<CinderDisk> cinderDisks = new ArrayList<>(); for (final DiskImage source : getSourceImages()) { if (source.getDiskStorageType() == DiskStorageType.CINDER) { cinderDisks.add((CinderDisk) source); continue; } List<DiskImage> images = diskImageDao.getAllSnapshotsForParent(source.getImageId()); DiskImage dest = null; if (!images.isEmpty()) { dest = images.get(0); } if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDiskLive) { CommandCoordinatorUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest, getSnapshotActionType()), cloneContextAndDetachFromParent()); } else { RemoveSnapshotSingleDiskParameters parameters = buildRemoveSnapshotSingleDiskParameters( source, dest, getSnapshotActionType()); VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), parameters); getTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } List<Guid> quotasToRemoveFromCache = new ArrayList<>(); quotasToRemoveFromCache.add(source.getQuotaId()); if (dest != null) { quotasToRemoveFromCache.add(dest.getQuotaId()); } getQuotaManager().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } if (!cinderDisks.isEmpty()) { handleCinderSnapshotDisks(cinderDisks); } }
Source:
public ListAllMyBucketsResult call() throws IOException, SignatureException, SSLSetupException { final GetServiceResponse response = getClient().getService(new GetServiceRequest()); final ListAllMyBucketsResult result = response.getResult(); if (result.getBuckets() == null) { return null; } return result; }

Target:
public ListAllMyBucketsResult call() throws IOException, SignatureException, SSLSetupException { final GetServiceResponse response = getClient().getService(new GetServiceRequest()); final ListAllMyBucketsResult result = response.getResult(); return result; }
Source:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if(tab == EsteemedInnovation.tab) { for (Type type : Type.LOOKUP) { items.add(new ItemStack(this, 1, type.ordinal())); } } }

Target:
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> items) { if (isInCreativeTab(tab)) { for (Type type : Type.LOOKUP) { items.add(new ItemStack(this, 1, type.ordinal())); } } }
Source:
public Map<String, Object> toObject() { final HashMap<String, Object> flowObj = new HashMap<>(); fillMapFromExecutable(flowObj); flowObj.put(EXECUTIONID_PARAM, this.executionId); flowObj.put(EXECUTIONPATH_PARAM, this.executionPath); flowObj.put(PROJECTID_PARAM, this.projectId); flowObj.put(PROJECTNAME_PARAM, this.projectName); if (this.scheduleId >= 0) { flowObj.put(SCHEDULEID_PARAM, this.scheduleId); } flowObj.put(SUBMITUSER_PARAM, this.submitUser); flowObj.put(VERSION_PARAM, this.version); flowObj.put(LASTMODIFIEDTIME_PARAM, this.lastModifiedTimestamp); flowObj.put(LASTMODIFIEDUSER_PARAM, this.lastModifiedUser); flowObj.put(AZKABANFLOWVERSION_PARAM, this.azkabanFlowVersion); flowObj.put(EXECUTIONOPTIONS_PARAM, this.executionOptions.toObject()); final ArrayList<String> proxyUserList = new ArrayList<>(this.proxyUsers); flowObj.put(PROXYUSERS_PARAM, proxyUserList); flowObj.put(SUBMITTIME_PARAM, this.submitTime); final List<Map<String, Object>> slaOptions = new ArrayList<>(); List<SlaOption> slaOptionList = this.executionOptions.getSlaOptions(); if (slaOptionList != null) { for (SlaOption slaOption : this.executionOptions.getSlaOptions()) { slaOptions.add(slaOption.toObject()); } } flowObj.put(SLAOPTIONS_PARAM, slaOptions); flowObj.put(IS_LOCKED_PARAM, this.isLocked); flowObj.put(FLOW_LOCK_ERROR_MESSAGE_PARAM, this.flowLockErrorMessage); return flowObj; }

Target:
public Map<String, Object> toObject() { final HashMap<String, Object> flowObj = new HashMap<>(); fillMapFromExecutable(flowObj); flowObj.put(EXECUTIONID_PARAM, this.executionId); flowObj.put(EXECUTIONPATH_PARAM, this.executionPath); flowObj.put(PROJECTID_PARAM, this.projectId); flowObj.put(PROJECTNAME_PARAM, this.projectName); if (this.scheduleId >= 0) { flowObj.put(SCHEDULEID_PARAM, this.scheduleId); } flowObj.put(SUBMITUSER_PARAM, this.submitUser); flowObj.put(VERSION_PARAM, this.version); flowObj.put(LASTMODIFIEDTIME_PARAM, this.lastModifiedTimestamp); flowObj.put(LASTMODIFIEDUSER_PARAM, this.lastModifiedUser); flowObj.put(AZKABANFLOWVERSION_PARAM, this.azkabanFlowVersion); flowObj.put(EXECUTIONOPTIONS_PARAM, this.executionOptions.toObject()); final ArrayList<String> proxyUserList = new ArrayList<>(this.proxyUsers); flowObj.put(PROXYUSERS_PARAM, proxyUserList); flowObj.put(SUBMITTIME_PARAM, this.submitTime); final List<Map<String, Object>> slaOptions = new ArrayList<>(); List<SlaOption> slaOptionList = this.executionOptions.getSlaOptions(); if (slaOptionList != null) { for (SlaOption slaOption : slaOptionList) { slaOptions.add(slaOption.toObject()); } } flowObj.put(SLAOPTIONS_PARAM, slaOptions); flowObj.put(IS_LOCKED_PARAM, this.isLocked); flowObj.put(FLOW_LOCK_ERROR_MESSAGE_PARAM, this.flowLockErrorMessage); return flowObj; }
Source:
public HttpResponse execute() throws Exception { StringBuilder requestBody = new StringBuilder(); if (request.getEntity() != null) { String content = ObjectMapperSingleton.getContext(request.getEntity().getClass()).writer().writeValueAsString(request.getEntity()); requestBody.append(content); } else if (request.hasJson()) { requestBody.append(request.getJson()); } StringBuilder contentBuilder = new StringBuilder(); BufferedReader in = null; try { connection.setRequestMethod(request.getMethod().name()); if (requestBody.length() > 0) { System.out.println(requestBody.toString()); connection.setDoOutput(true); BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream()); out.write(requestBody.toString().getBytes()); out.flush(); } in = new BufferedReader(new InputStreamReader( connection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { contentBuilder.append(inputLine); } } catch (IOException ex) { ex.printStackTrace(System.out); in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); String inputLine; while ((inputLine = in.readLine()) != null) { contentBuilder.append(inputLine); } } finally { if (in != null) { in.close(); } } HttpResponseImpl responseImpl = HttpResponseImpl.wrap(connection.getHeaderFields(), connection.getResponseCode(), connection.getResponseMessage(), contentBuilder.toString()); connection.disconnect(); return responseImpl; }

Target:
public HttpResponse execute() throws Exception { StringBuilder requestBody = new StringBuilder(); if (request.getEntity() != null) { String content = ObjectMapperSingleton.getContext(request.getEntity().getClass()).writer().writeValueAsString(request.getEntity()); requestBody.append(content); } else if (request.hasJson()) { requestBody.append(request.getJson()); } StringBuilder contentBuilder = new StringBuilder(); BufferedReader in = null; try { connection.setRequestMethod(request.getMethod().name()); if (requestBody.length() > 0) { System.out.println(requestBody.toString()); connection.setDoOutput(true); BufferedOutputStream out = new BufferedOutputStream(connection.getOutputStream()); out.write(requestBody.toString().getBytes()); out.flush(); } in = new BufferedReader(new InputStreamReader( connection.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { contentBuilder.append(inputLine); } } catch (IOException ex) { ex.printStackTrace(System.out); in = new BufferedReader(new InputStreamReader( connection.getErrorStream())); String inputLine; while ((inputLine = in.readLine()) != null) { contentBuilder.append(inputLine); } } finally { if (in != null) { in.close(); } } HttpResponseImpl responseImpl = HttpResponseImpl.wrap(connection.getHeaderFields(), connection.getResponseCode(), connection.getResponseMessage(), connection.getInputStream()); connection.disconnect(); return responseImpl; }
Source:
protected void assertEncrypted(Path path) throws IOException { Configuration c = new Configuration(); String kmsKey = c.get(SERVER_SIDE_ENCRYPTION_KEY); ObjectMetadata objectMetadata = getFileSystem().getObjectMetadata(path); assertEquals("SSE KMS key id should match", kmsKey, objectMetadata.getSSEAwsKmsKeyId()); }

Target:
protected void assertEncrypted(Path path) throws IOException { S3AFileSystem fs = getFileSystem(); Configuration c = fs.getConf(); String kmsKey = c.getTrimmed(SERVER_SIDE_ENCRYPTION_KEY); EncryptionTestUtils.assertEncrypted(fs, path, SSE_KMS, kmsKey); }
Source:
protected void testBulkLifeCycleChangeTwoLevels() { DocumentModel folderDoc1 = session.createDocumentModel("/", "testFolder1", "Folder"); folderDoc1 = session.createDocument(folderDoc1); DocumentModel folderDoc2 = session.createDocumentModel(folderDoc1.getPathAsString(), "testFolder2", "Folder"); folderDoc2 = session.createDocument(folderDoc2); DocumentModel testFile1 = session.createDocumentModel(folderDoc2.getPathAsString(), "testFile1", "File"); testFile1 = session.createDocument(testFile1); DocumentModel testFile2 = session.createDocumentModel(folderDoc2.getPathAsString(), "testFile2", "File"); testFile2 = session.createDocument(testFile2); DocumentModel testFile3 = session.createDocumentModel(folderDoc2.getPathAsString(), "testFile3", "File"); testFile3 = session.createDocument(testFile3); session.saveDocument(folderDoc1); session.saveDocument(folderDoc2); session.saveDocument(testFile1); session.saveDocument(testFile2); session.saveDocument(testFile3); Collection<String> allowedStateTransitions = session.getAllowedStateTransitions(folderDoc1.getRef()); assertTrue(allowedStateTransitions.contains("approve")); assertTrue(session.followTransition(folderDoc1.getRef(), "approve")); session.save(); nextTransaction(); assertEquals("approved", session.getCurrentLifeCycleState(folderDoc2.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile1.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile2.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile3.getRef())); }

Target:
protected void testBulkLifeCycleChangeTwoLevels() { DocumentModel folderDoc1 = session.createDocumentModel("/", "testFolder1", "Folder"); folderDoc1 = session.createDocument(folderDoc1); DocumentModel folderDoc2 = session.createDocumentModel("/testFolder1", "testFolder2", "Folder"); folderDoc2 = session.createDocument(folderDoc2); DocumentModel testFile1 = session.createDocumentModel("/testFolder1/testFolder2", "testFile1", "File"); testFile1 = session.createDocument(testFile1); DocumentModel testFile2 = session.createDocumentModel("/testFolder1/testFolder2", "testFile2", "File"); testFile2 = session.createDocument(testFile2); DocumentModel testFile3 = session.createDocumentModel("/testFolder1/testFolder2", "testFile3", "File"); testFile3 = session.createDocument(testFile3); session.saveDocument(folderDoc1); session.saveDocument(folderDoc2); session.saveDocument(testFile1); session.saveDocument(testFile2); session.saveDocument(testFile3); Collection<String> allowedStateTransitions = session.getAllowedStateTransitions(folderDoc1.getRef()); assertTrue(allowedStateTransitions.contains("approve")); assertTrue(session.followTransition(folderDoc1.getRef(), "approve")); session.save(); nextTransaction(); assertEquals("approved", session.getCurrentLifeCycleState(folderDoc2.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile1.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile2.getRef())); assertEquals("approved", session.getCurrentLifeCycleState(testFile3.getRef())); }
Source:
protected void setUp() throws Exception { super.setUp(); RefUpdate refUpdate = db.updateRef("refs/remotes/origin/remote-a"); refUpdate.setNewObjectId(db.resolve("refs/heads/a")); refUpdate.update(); refUpdate = db.updateRef("refs/remotes/origin/remote-b"); refUpdate.setNewObjectId(db.resolve("refs/heads/b")); refUpdate.update(); formatter = new MergeMessageFormatter(); }

Target:
protected void setUp() throws Exception { super.setUp(); RefUpdate createRemoteRefA = db .updateRef("refs/remotes/origin/remote-a"); createRemoteRefA.setNewObjectId(db.resolve("refs/heads/a")); createRemoteRefA.update(); RefUpdate createRemoteRefB = db .updateRef("refs/remotes/origin/remote-b"); createRemoteRefB.setNewObjectId(db.resolve("refs/heads/b")); createRemoteRefB.update(); formatter = new MergeMessageFormatter(); }
Source:
public void checkValidErrorMessage() { runErrorMesaageCheck(false, true, false, false, ErrorMessage.invalidMask); runErrorMesaageCheck(true, false, false, false, ErrorMessage.badPrefixOrNetmaskFormatMessage); runErrorMesaageCheck(false, false, false, false, ErrorMessage.badNetmaskFormatMessage); runErrorMesaageCheck(false, true, true, false, ErrorMessage.NoError); runErrorMesaageCheck(true, false, true, true, ErrorMessage.NoError); }

Target:
public void checkValidErrorMessage() { Random random = new Random(); runErrorMessageCheck(random.nextBoolean(), true, false, false, ErrorMessage.invalidMask); runErrorMessageCheck(true, false, random.nextBoolean(), false, ErrorMessage.badPrefixOrNetmaskFormatMessage); runErrorMessageCheck(false, false, random.nextBoolean(), random.nextBoolean(), ErrorMessage.badNetmaskFormatMessage); runErrorMessageCheck(false, true, true, random.nextBoolean(), ErrorMessage.NoError); runErrorMessageCheck(true, false, random.nextBoolean(), true, ErrorMessage.NoError); }
Source:
public AbstractHttpResponse(CloseableHttpResponse httpResponse, Class<T> resultClass, boolean flatMapData) { this.resultClass = resultClass; try ( CloseableHttpResponse httpResponseToClose = httpResponse; InputStream inputStreamOfResponse = httpResponseToClose.getEntity().getContent(); TokenBuffer bufferedResponse = createTokenBuffer(inputStreamOfResponse); ) { JsonParser pointingOnErrors = findNextObject(bufferedResponse.asParserOnFirstToken(), "errors"); throwExceptionOnErrorEntry(pointingOnErrors); JsonParser unbufferedResults = findNextObject(bufferedResponse.asParserOnFirstToken(), "results"); if (unbufferedResults == null || !JsonToken.START_ARRAY.equals(unbufferedResults.currentToken())) { throw new IOException("Current result object is not an array!"); } TokenBuffer resultBuffer = createTokenBuffer(unbufferedResults); this.columns = readColumns(resultBuffer); this.queryStatistics = readQueryStatistics(resultBuffer); this.results = new ResultNodeIterator(this.mapper, resultBuffer.asParserOnFirstToken(), flatMapData); } catch (IOException e) { throw new UncheckedIOException(e); } }

Target:
AbstractHttpResponse(CloseableHttpResponse httpResponse, Class<T> resultClass, boolean flatMapData) { this.resultClass = resultClass; try ( CloseableHttpResponse httpResponseToClose = httpResponse; InputStream inputStreamOfResponse = httpResponseToClose.getEntity().getContent(); TokenBuffer bufferedResponse = createTokenBuffer(inputStreamOfResponse); ) { JsonParser pointingOnErrors = findNextObject(bufferedResponse.asParserOnFirstToken(), "errors"); throwExceptionOnErrorEntry(pointingOnErrors); JsonParser unbufferedResults = findNextObject(bufferedResponse.asParserOnFirstToken(), "results"); throwExceptionOnIncorrectResultEntry(unbufferedResults); TokenBuffer resultBuffer = createTokenBuffer(unbufferedResults); this.columns = readColumns(resultBuffer); this.queryStatistics = readQueryStatistics(resultBuffer); this.results = new ResultNodeIterator(this.mapper, resultBuffer.asParserOnFirstToken(), flatMapData); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
public void canGetTrimMarkAndLogSize() throws Exception { byte[] testString = "hello world".getBytes(); client.write(0, null, testString, Collections.emptyMap()).get(); LogData r = client.read(0).get().getAddresses().get(0L); assertThat (client.getTrimMark().get()); assertThat (client.getLogFileSize ().get()); }

Target:
public void canGetTrimMarkAndLogSize() throws Exception { byte[] testString = "hello world".getBytes(); client.write(0, null, testString, Collections.emptyMap()).get(); LogData r = client.read(0).get().getAddresses().get(0L); assertThat (client.getTrimMark().get()==0); long startAddress = 0; long endAddress = client.getTrimMark().get(); assertThat(client.getLogStats(startAddress, endAddress).get().getUsedQuota() > testString.length); startAddress = endAddress; endAddress = client.getLogTail().get().getLogTail(); long size0 = client.getLogStats(startAddress, endAddress).get().getLogSize(); assertThat ( size0 > testString.length); long size1 = client.getLogStats(startAddress, endAddress + number).get().getLogSize(); assertThat(size0 == size1); }
Source:
public void logCurrentState() { logAllHeldAndOutstandingLocks(); StringBuilder logString = getGeneralLockStats(); for (Pair<String, ? extends Collection<?>> nameValuePair : ImmutableList.of( Pair.create("descriptorToLockMap", descriptorToLockMap.asMap().entrySet()), Pair.create("outstandingLockRequestMultimap", outstandingLockRequestMultimap.asMap().entrySet()), Pair.create("heldLocksTokenMap", heldLocksTokenMap.entrySet()), Pair.create("heldLocksGrantMap", heldLocksGrantMap.entrySet()), Pair.create("lockTokenReaperQueue", queueToOrderedList(lockTokenReaperQueue)), Pair.create("lockGrantReaperQueue", queueToOrderedList(lockGrantReaperQueue)), Pair.create("lockClientMultimap", lockClientMultimap.asMap().entrySet()), Pair.create("versionIdMap", versionIdMap.asMap().entrySet()))) { Collection<?> elements = nameValuePair.getRhSide(); logString.append(nameValuePair.getLhSide()).append(".size() = ").append(elements.size()).append("\n"); if (elements.size() > MAX_LOCKS_TO_LOG) { logString.append("WARNING: Only logging the first ").append(MAX_LOCKS_TO_LOG).append(" locks, "); logString.append("logging more is likely to OOM or slow down lock server to the point of failure"); } for (Object element : Iterables.limit(elements, MAX_LOCKS_TO_LOG)) { logString.append(element).append("\n"); } } logString.append("Finished logging current state. Time = ").append(currentTimeMillis()); log.error("Current State: {}", logString.toString()); log.error(logString.toString()); logCurrentHeldLocks(); logOutstandingLockRequests(); }

Target:
public void logCurrentState() { StringBuilder logString = getGeneralLockStats(); log.info("Current State: {}", logString.toString()); try { logAllHeldAndOutstandingLocks(); } catch (IOException e) { log.error("Can't dump state to Yaml: [{}]", e); throw new IllegalStateException(e); } }
Source:
public void authenticateCorrectly() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenReturn(authentication); manager.addProvider(provider); Optional<Authentication> optional = Optional.ofNullable(manager.authenticate(authentication)); verify(provider).authenticate(authentication); assertThat(optional.isPresent(), is(true)); assertThat(optional.get(), is(authentication)); }

Target:
public void authenticateCorrectly() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenReturn(authentication); manager.addProvider(provider); Optional<Authentication> optional = ofNullable(manager.authenticate(authentication)); verify(provider).authenticate(authentication); assertThat(optional.get(), is(authentication)); }
Source:
public static AbstractCalledFunction create(long start, long end, int depth, long value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledFunction(start, end, value, depth, parent); }

Target:
private static CalledFunction create(long start, long end, int depth, long value, @Nullable ICalledFunction parent) { if (start > end) { throw new IllegalArgumentException(Messages.TimeError + '[' + start + ',' + end + ']'); } return new CalledFunction(start, end, value, depth, parent); }
Source:
public void setServers(@NotNull List<ServerEntity> servers) { List<ServerEntity> list = new ArrayList<>(); for (ServerEntity serverEntity : servers) { if (!Constants.TERMINAL_REFERENCE.equals(serverEntity.getRef())){ list.add(serverEntity); } } this.servers.setRowData(list); }

Target:
public void setServers(@NotNull List<ServerEntity> servers) { Iterable<ServerEntity> serversToDisplay = filter(servers, new Predicate<ServerEntity>() { @Override public boolean apply(ServerEntity serverEntity) { String reference = serverEntity.getRef(); return !TERMINAL_REFERENCE.equals(reference); } }); this.servers.setRowData(newArrayList(serversToDisplay)); }
Source:
public static void setBiomeArrayMethod(boolean jeidPresent) { try { if (jeidPresent) { biomeArrayMethod = Chunk.class.getMethod("getIntBiomeArray"); } else biomeArrayMethod = Chunk.class.getMethod("getBiomeArray"); } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }

Target:
public static void setBiomeArrayMethod(boolean jeidPresent) { try { if (jeidPresent) { biomeArrayMethod = Chunk.class.getMethod("getIntBiomeArray"); } else { biomeArrayMethod = Chunk.class.getMethod("getBiomeArray"); } } catch (NoSuchMethodException e) { throw new RuntimeException(e); } }
Source:
public void setup(Context.OperatorContext context) { operatorId = context.getId(); if (isRecoveryPathRelativeToAppPath) { statePath = context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + recoveryPath; } else { statePath = recoveryPath; } try { fileContext = FileContextUtils.getFileContext(statePath); setupWals(context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID)); } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public void setup(Context.OperatorContext context) { operatorId = context.getId(); if (isStatePathRelativeToAppPath) { fullStatePath = context.getValue(DAG.APPLICATION_PATH) + Path.SEPARATOR + statePath; } else { fullStatePath = statePath; } try { fileContext = FileContextUtils.getFileContext(fullStatePath); setupWals(context.getValue(Context.OperatorContext.ACTIVATION_WINDOW_ID)); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void update() { displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")).attachDepthBufferTo(displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE)); }

Target:
public void update() { sceneOpaqueFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); refractiveReflectiveFbo = displayResolutionDependentFBOs.get(REFRACTIVE_REFLECTIVE); sceneOpaqueFbo.attachDepthBufferTo(refractiveReflectiveFbo); }
Source:
private boolean isAuthFailure(Throwable error) { boolean authFailure = true; if (error instanceof AllNodesFailedException) { Collection<Throwable> errors = ((AllNodesFailedException) error).getErrors().values(); for (Throwable nodeError : errors) { if (!(nodeError instanceof AuthenticationException)) { authFailure = false; break; } } } return authFailure; }

Target:
private boolean isAuthFailure(Throwable error) { boolean authFailure = true; if (error instanceof AllNodesFailedException) { Collection<Throwable> errors = ((AllNodesFailedException) error).getErrors().values(); if (errors.size() == 0) { return false; } for (Throwable nodeError : errors) { if (!(nodeError instanceof AuthenticationException)) { authFailure = false; break; } } } return authFailure; }
Source:
public String getDataLabelTextWithIndex(int index) { wait.forElementVisible(itemLabels.get(index)); return itemLabels.get(index).getText(); }

Target:
public String getDataLabelTextWithIndex(int index) { WebElement selectedLabel = itemLabels.get(index); wait.forElementVisible(selectedLabel); return selectedLabel.getText(); }
Source:
protected PageCacheNumberArray( PagedFile pagedFile, int entrySize, long length, long defaultValue, long base ) throws IOException { this.pagedFile = pagedFile; this.entrySize = entrySize; this.entriesPerPage = pagedFile.pageSize() / entrySize; this.length = length; this.defaultValue = defaultValue; this.base = base; try ( PageCursor cursorToSetLength = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { setLength( cursorToSetLength, length ); } if ( defaultValue != 0 ) { setDefaultValue( defaultValue ); } }

Target:
PageCacheNumberArray( PagedFile pagedFile, int entrySize, long length, long defaultValue, long base ) throws IOException { this.pagedFile = pagedFile; this.entrySize = entrySize; this.entriesPerPage = pagedFile.pageSize() / entrySize; this.length = length; this.defaultValue = defaultValue; this.base = base; try ( PageCursor cursorToSetLength = pagedFile.io( 0, PF_SHARED_WRITE_LOCK ) ) { setLength( cursorToSetLength, length ); } if ( defaultValue != 0 ) { setDefaultValue( defaultValue ); } }
Source:
public void process(int journalVersion, long offset, ByteBuffer entry) throws IOException { if (!printJournalVersion) { System.out.println("Journal Version : " + journalVersion); printJournalVersion = true; } }

Target:
public void process(int journalVersion, long offset, ByteBuffer entry) throws IOException { LOG.warn("Journal Version : " + journalVersion); }
Source:
public EList<Table> getMatchingTables(final EObject expectedTableContext) { final List<Table> filteredTables = new ArrayList<>(); ECrossReferenceAdapter crossRef = ECrossReferenceAdapter.getCrossReferenceAdapter(expectedTableContext); final Collection<Setting> crossReference = crossRef.getNonNavigableInverseReferences(expectedTableContext, true); for (final Setting set : crossReference) { final EObject eobject = set.getEObject(); switch (this.contextFilterRule) { case SEMANTIC_CONTEXT: if (false == isSemanticContext(eobject, expectedTableContext)) { continue; } break; case GRAPHICAL_CONTEXT: if (false == isGraphicalContext(eobject, expectedTableContext)) { continue; } case BOTH: if (false == (isSemanticContext(eobject, expectedTableContext) || isGraphicalContext(eobject, expectedTableContext))) { continue; } break; default: } final Table table; if (eobject instanceof Table) { table = (Table) eobject; } else { continue; } if (matchTableKind(table) && matchTableType(table)) { filteredTables.add(table); } } return ECollections.unmodifiableEList(filteredTables); }

Target:
public EList<Table> getMatchingTables(final EObject expectedTableContext) { final List<Table> filteredTables = new ArrayList<>(); ECrossReferenceAdapter crossRef = ECrossReferenceAdapter.getCrossReferenceAdapter(expectedTableContext); final Collection<Setting> crossReference = crossRef.getNonNavigableInverseReferences(expectedTableContext, true); for (final Setting set : crossReference) { final EObject eobject = set.getEObject(); switch (this.contextFilterRule) { case SEMANTIC_CONTEXT: if (false == isSemanticContext(eobject, expectedTableContext)) { continue; } break; case GRAPHICAL_CONTEXT: if (false == isGraphicalContext(eobject, expectedTableContext)) { continue; } break; case BOTH: if (false == (isSemanticContext(eobject, expectedTableContext) || isGraphicalContext(eobject, expectedTableContext))) { continue; } break; default: } final Table table; if (eobject instanceof Table) { table = (Table) eobject; } else { continue; } if (matchTableKind(table) && matchTableType(table)) { filteredTables.add(table); } } return ECollections.unmodifiableEList(filteredTables); }
Source:
public Iterator<TileEntity> iterator() { return new Iterator<TileEntity>() { int index = 0; Iterator<List<TileEntity>> iterator = values().iterator(); List<TileEntity> currentList; @Override public boolean hasNext() { while(currentList == null || currentList.size() <= index) { if(iterator.hasNext()) { currentList = iterator.next(); index = 0; } else return false; } return true; } @Override public TileEntity next() { TileEntity value = currentList.get(index); index++; return value; } @Override public void remove() { currentList.remove(index-1); } }; }

Target:
public Iterator<TileEntity> iterator() { return new Iterator<TileEntity>() { int index = 0; int expModCount = ChunkedTileEntityList.this.modCount; Iterator<List<TileEntity>> iterator = content.values().iterator(); List<TileEntity> currentList; @Override public boolean hasNext() { while (currentList == null || currentList.size() <= index) { if (iterator.hasNext()) { currentList = iterator.next(); index = 0; } else return false; } return true; } @Override public TileEntity next() { this.checkCoModifications(); TileEntity value = currentList.get(index); index++; return value; } @Override public void remove() { this.checkCoModifications(); ChunkedTileEntityList.this.totalCount--; currentList.remove(index - 1); } protected void checkCoModifications() { if (this.expModCount != ChunkedTileEntityList.this.modCount) throw new ConcurrentModificationException(); } }; }
Source:
private AzkabanFlow(final String name, final Props props, final Map<String, AzkabanNode> nodes, final List<String> dependsOn) { super(name, Constants.NODE_TYPE_FLOW, props, dependsOn); this.nodes = nodes; }

Target:
private AzkabanFlow(final String name, final Props props, final Map<String, AzkabanNode> nodes, final List<String> dependsOn) { super(name, Constants.FLOW_NODE_TYPE, props, dependsOn); this.nodes = nodes; }
Source:
public NetInterfaceStatus getNetInterfaceStatus() { return netInterfaceStatus; }

Target:
public NetInterfaceStatus getNetInterfaceStatus() { return this.netInterfaceStatus; }
Source:
public void run() { final RecipeResourceCopier copier = new RecipeResourceCopier( "assets/appliedenergistics2/recipes/" ); final File configDirectory = AppEng.instance().getConfigDirectory(); final File generatedRecipesDir = new File( configDirectory, "generated recipes" ); final File userRecipesDir = new File( configDirectory, "user recipes" ); try { FileUtils.forceMkdir( generatedRecipesDir ); FileUtils.forceMkdir( userRecipesDir ); FileUtils.cleanDirectory( generatedRecipesDir ); copier.copyTo( generatedRecipesDir ); this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" ); } catch( IOException e ) { e.printStackTrace(); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } catch( URISyntaxException e ) { e.printStackTrace(); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } }

Target:
public void run() { final RecipeResourceCopier copier = new RecipeResourceCopier( "assets/appliedenergistics2/recipes/" ); final File configDirectory = AppEng.instance().getConfigDirectory(); final File generatedRecipesDir = new File( configDirectory, "generated-recipes" ); final File userRecipesDir = new File( configDirectory, "user-recipes" ); final File readmeGenDest = new File( generatedRecipesDir, "README.html" ); final File readmeUserDest = new File( userRecipesDir, "README.html" ); try { FileUtils.forceMkdir( generatedRecipesDir ); FileUtils.forceMkdir( userRecipesDir ); FileUtils.cleanDirectory( generatedRecipesDir ); copier.copyTo( generatedRecipesDir ); FileUtils.copyFile( readmeGenDest, readmeUserDest ); this.handler.parseRecipes( new ConfigLoader( generatedRecipesDir, userRecipesDir ), "index.recipe" ); } catch( IOException e ) { AELog.error( e ); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } catch( URISyntaxException e ) { AELog.error( e ); this.handler.parseRecipes( new JarLoader( "/assets/appliedenergistics2/recipes/" ), "index.recipe" ); } }
Source:
public void writeBfqFiles() { final Iterator<SAMRecord> iterator = SamReaderFactory.makeDefault().open(bamFile).iterator(); final TagFilter tagFilter = new TagFilter(ReservedTagConstants.XN, 1); final FailsVendorReadQualityFilter qualityFilter = new FailsVendorReadQualityFilter(); final WholeReadClippedFilter clippedFilter = new WholeReadClippedFilter(); if (!pairedReads) { List<SamRecordFilter> filters = new ArrayList<SamRecordFilter>(); filters.add(tagFilter); filters.add(clippedFilter); if (!this.includeNonPfReads) { filters.add(qualityFilter); } writeSingleEndBfqs(iterator, filters); codec1.close(); } else { writePairedEndBfqs(iterator, tagFilter, qualityFilter, clippedFilter); codec1.close(); codec2.close(); } log.info("Wrote " + wrote + " bfq records."); }

Target:
public void writeBfqFiles() { final SamReader reader = SamReaderFactory.makeDefault().open(bamFile); final Iterator<SAMRecord> iterator = reader.iterator(); final TagFilter tagFilter = new TagFilter(ReservedTagConstants.XN, 1); final FailsVendorReadQualityFilter qualityFilter = new FailsVendorReadQualityFilter(); final WholeReadClippedFilter clippedFilter = new WholeReadClippedFilter(); if (!pairedReads) { List<SamRecordFilter> filters = new ArrayList<SamRecordFilter>(); filters.add(tagFilter); filters.add(clippedFilter); if (!this.includeNonPfReads) { filters.add(qualityFilter); } writeSingleEndBfqs(iterator, filters); codec1.close(); } else { writePairedEndBfqs(iterator, tagFilter, qualityFilter, clippedFilter); codec1.close(); codec2.close(); } log.info("Wrote " + wrote + " bfq records."); CloserUtil.close(reader); }
Source:
static Resource findStyle(StyleInfo style) throws IOException { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource styleFile = loader.get("/styles/" + style.getFilename()); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " found"); } return styleFile; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " not found. Trying to search in the layer workspace"); } Resource workspaces = loader.get ("/workspaces"); styleFile = workspaces.get(style.getWorkspace().getName() + "/styles/" + style.getFilename()); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "The style file cannot be found anywhere. We need to skip the SLD file"); } return null; } return styleFile; } }

Target:
static Resource findStyle(StyleInfo style) throws IOException { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource styleFile = loader.get(Paths.path("styles", style.getFilename())); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " found"); } return styleFile; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Style " + style.getName() + " not found. Trying to search in the layer workspace"); } styleFile = loader.get(Paths.path("workspaces", style.getWorkspace().getName(), "styles", style.getFilename())); if (styleFile != null && styleFile.getType() == Resource.Type.RESOURCE && Resources.canRead(styleFile)) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "The style file cannot be found anywhere. We need to skip the SLD file"); } return null; } return styleFile; } }