auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static ProcessingEnvironment unwrapProcessingEnvironment(ProcessingEnvironment env) { if (env.getClass().getName() == "com.sun.tools.javac.processing.JavacProcessingEnvironment") { return env; } if (Proxy.isProxyClass(env.getClass())) { @Nullable ProcessingEnvironment unwrapped = unwrapIntelliJ(env); if (unwrapped != null) { return unwrapProcessingEnvironment(unwrapped); } } for (@Nullable Class<?> envClass = env.getClass(); envClass != null; envClass = envClass.getSuperclass()) { @Nullable ProcessingEnvironment unwrapped = unwrapGradle(envClass, env); if (unwrapped != null) { return unwrapProcessingEnvironment(unwrapped); } } throw new IllegalArgumentException( "CheckerFramework only supports Javac processing environment"); }

Target:
private static ProcessingEnvironment unwrapProcessingEnvironment(ProcessingEnvironment env) { if (env.getClass().getName() == "com.sun.tools.javac.processing.JavacProcessingEnvironment") { return env; } ProcessingEnvironment unwrappedIntelliJ = unwrapIntelliJ(env); if (unwrappedIntelliJ != null) { return unwrapProcessingEnvironment(unwrappedIntelliJ); } for (Class<?> envClass = env.getClass(); envClass != null; envClass = envClass.getSuperclass()) { ProcessingEnvironment unwrappedGradle = unwrapGradle(envClass, env); if (unwrappedGradle != null) { return unwrapProcessingEnvironment(unwrappedGradle); } } throw new BugInCF("Unexpected processing environment: %s %s", env, env.getClass()); }
Source:
public void useHostIdAndTheUserDontHavePermission() throws DotDataException, DotSecurityException { final Host host = new SiteDataGen().nextPersisted(); final HttpServletRequest request = mock(HttpServletRequest.class); final HttpSession session = mock(HttpSession.class); setAllParametersAndAttributes(request, session); when(request.getParameter("host_id")).thenReturn(host.getIdentifier()); final User user = createBackendUser(); final HostWebAPIImpl hostWebAPI = new HostWebAPIImpl(); try { hostWebAPI.getCurrentHost(request, user); throw new RuntimeException("should throw a DotSecurityException"); } catch (DotSecurityException e) { } verify(request, never()).setAttribute(anyString(), anyObject()); verify(session, never()).setAttribute(anyString(), anyObject()); }

Target:
public void useHostIdAndTheUserDontHavePermission() throws DotDataException, DotSecurityException { final Host host = new SiteDataGen().nextPersisted(); final HttpServletRequest request = mock(HttpServletRequest.class); final HttpSession session = mock(HttpSession.class); setAllParametersAndAttributes(request, session); when(request.getParameter(HOST_ID_PARAMETER_NAME)).thenReturn(host.getIdentifier()); final User user = createBackendUser(); final HostWebAPIImpl hostWebAPI = new HostWebAPIImpl(); try { hostWebAPI.getCurrentHost(request, user); throw new RuntimeException("should throw a DotSecurityException"); } catch (DotSecurityException e) { } verify(request, never()).setAttribute(anyString(), anyObject()); verify(session, never()).setAttribute(anyString(), anyObject()); }
Source:
public void testCommentBeforeCreateTableAs() throws Exception { methodWatcher.executeUpdate("create table test_comment_before_create_as_dep_tbl (col int)"); String createStmt = "create table %s as select * from test_comment_before_create_as_dep_tbl"; try { methodWatcher.executeUpdate("-- some SQL-style comment here\n" + String.format(createStmt, generateTableName())); methodWatcher.executeUpdate(" \n" + String.format(createStmt, generateTableName())); methodWatcher.executeUpdate(" \n-- comments\n" + String.format(createStmt, generateTableName())); } catch (SQLException e) { Assert.fail("No exception should be thrown"); } }

Target:
public void testCommentBeforeCreateTableAs() throws Exception { methodWatcher.executeUpdate("create table test_comment_before_create_as_dep_tbl (col int)"); String createStmt = "create table %s as select * from test_comment_before_create_as_dep_tbl"; methodWatcher.executeUpdate("-- some SQL-style comment here\n" + String.format(createStmt, generateTableName())); methodWatcher.executeUpdate(" \n" + String.format(createStmt, generateTableName())); methodWatcher.executeUpdate(" \n-- comments\n" + String.format(createStmt, generateTableName())); }
Source:
public Transceiver readAuthors(ArticleIngestionIdentifier ingestionId) { return new Transceiver() { @Override protected Object getData() throws IOException { return parseAuthors(getManuscriptXml(getArticleIngestion(ingestionId))); } @Override protected Calendar getLastModifiedDate() throws IOException { return null; } }; }

Target:
public Transceiver readAuthors(ArticleIngestionIdentifier ingestionId) { ArticleIngestion articleIngestion = getArticleIngestion(ingestionId); return new Transceiver() { @Override protected Object getData() throws IOException { return parseAuthors(getManuscriptXml(articleIngestion)); } @Override protected Calendar getLastModifiedDate() throws IOException { return copyToCalendar(articleIngestion.getLastModified()); } }; }
Source:
public GetUserResult getUserByProperty(final String key, final String value) { final UserDB userDB; try { userDB = getUserDb(); } catch (Exception e) { return new GetUserResult(GetUserResult.State.INTERNAL_ERROR, "Unable to get user database", e); } final Set<User> users = new HashSet<User>(); for (String username : userDB.getUserNames()) { final User user = userDB.getUser(username); final Map<String, String> properties = user.getProperties(); if (properties != null && value.equals(properties.get(key))) { users.add(user); } } if (users.isEmpty()) { return new GetUserResult(GetUserResult.State.UNKNOWN_USER); } return new GetUserResult(users, GetUserResult.State.OK); }

Target:
public GetUserResult getUserByProperty(final String key, final String value) { final UserDB userDB; try { userDB = getUserDb(); } catch (Exception e) { return new GetUserResult(GetUserResult.State.INTERNAL_ERROR, "Unable to get user database", e); } final Set<User> users = new HashSet<User>(); for (final User user : userDB.getAllUsers()) { final Map<String, String> properties = user.getProperties(); if (properties == null || properties.get(key) == null) { continue; } final String propertyValue = properties.get(key); if (Arrays.asList(propertyValue.split(" ")).contains(value)) { users.add(user); } } if (users.isEmpty()) { return new GetUserResult(GetUserResult.State.UNKNOWN_USER); } return new GetUserResult(users, GetUserResult.State.OK); }
Source:
protected void endSuccessfully() { if (isStatelessSnapshotExistsForVm()) { getBackend().endAction(VdcActionType.CreateAllSnapshotsFromVm, buildCreateSnapshotParametersForEndAction(), getContext().duplicate().resetCompensationContext().resetExecutionContext().resetLock()); getParameters().setShouldBeLogged(false); getParameters().setRunAsStateless(false); setSucceeded(getBackend().runInternalAction( getActionType(), getParameters(), createContextForRunStatelessVm()).getSucceeded()); if (!getSucceeded()) { getParameters().setShouldBeLogged(true); log.errorFormat("Could not run VM {0} ({1}) in stateless mode", getVm().getName(), getVm().getId()); getReturnValue().setEndActionTryAgain(false); } } else { super.endSuccessfully(); } }

Target:
protected void endSuccessfully() { if (isStatelessSnapshotExistsForVm()) { getBackend().endAction(VdcActionType.CreateAllSnapshotsFromVm, buildCreateSnapshotParametersForEndAction(), getContext().duplicate().withoutCompensationContext().withoutExecutionContext().withoutLock()); getParameters().setShouldBeLogged(false); getParameters().setRunAsStateless(false); setSucceeded(getBackend().runInternalAction( getActionType(), getParameters(), createContextForRunStatelessVm()).getSucceeded()); if (!getSucceeded()) { getParameters().setShouldBeLogged(true); log.errorFormat("Could not run VM {0} ({1}) in stateless mode", getVm().getName(), getVm().getId()); getReturnValue().setEndActionTryAgain(false); } } else { super.endSuccessfully(); } }
Source:
public void configurePipeline(PipelineConfigurer configurer) throws IllegalArgumentException { super.configurePipeline(configurer); if (this.config.format == null || this.config.format.isEmpty()) { throw new IllegalArgumentException("Format is not specified. Allowed values are DEFAULT, EXCEL, MYSQL," + " RFC4180, PDL & TDF"); } if (!this.config.format.equalsIgnoreCase("DEFAULT") && !this.config.format.equalsIgnoreCase("EXCEL") && !this.config.format.equalsIgnoreCase("MYSQL") && !this.config.format.equalsIgnoreCase("RFC4180") && !this.config.format.equalsIgnoreCase("TDF") && !this.config.format.equalsIgnoreCase("PDL")) { throw new IllegalArgumentException("Format specified is not one of the allowed values. Allowed values are " + "DEFAULT, EXCEL, MYSQL, RFC4180, PDL & TDF"); } Schema inputSchema = configurer.getStageConfigurer().getInputSchema(); if (inputSchema != null) { Schema.Field inputSchemaField = inputSchema.getField(config.field); if (inputSchemaField == null) { throw new IllegalArgumentException( "Field " + config.field + " is not present in the input schema"); } else { if (!inputSchemaField.getSchema().getType().equals(Schema.Type.STRING) && !isNullableString(inputSchemaField.getSchema())) { throw new IllegalArgumentException( "Type for field " + config.field + " must be String"); } } } try { Schema outputSchema = Schema.parseJson(this.config.schema); configurer.getStageConfigurer().setOutputSchema(outputSchema); if (inputSchema != null) { for (Field field : inputSchema.getFields()) { if (outputSchema.getField(field.getName()) != null) { Schema out = outputSchema.getField(field.getName()).getSchema(); Schema in = field.getSchema(); if (!in.equals(out)) { throw new IllegalArgumentException( "Input field '" + field.getName() + "' does not have same output schema as input." ); } } } } } catch (IOException e) { throw new IllegalArgumentException("Format of schema specified is invalid. Please check the format."); } }

Target:
public void configurePipeline(PipelineConfigurer configurer) throws IllegalArgumentException { super.configurePipeline(configurer); if (this.config.format == null || this.config.format.isEmpty()) { throw new IllegalArgumentException("Format is not specified. Allowed values are DEFAULT, EXCEL, MYSQL," + " RFC4180, PDL & TDF"); } if (!this.config.format.equalsIgnoreCase("DEFAULT") && !this.config.format.equalsIgnoreCase("EXCEL") && !this.config.format.equalsIgnoreCase("MYSQL") && !this.config.format.equalsIgnoreCase("RFC4180") && !this.config.format.equalsIgnoreCase("TDF") && !this.config.format.equalsIgnoreCase("PDL")) { throw new IllegalArgumentException("Format specified is not one of the allowed values. Allowed values are " + "DEFAULT, EXCEL, MYSQL, RFC4180, PDL & TDF"); } Schema inputSchema = configurer.getStageConfigurer().getInputSchema(); validateInputSchema(inputSchema); configurer.getStageConfigurer().setOutputSchema(parseAndValidateOutputSchema(inputSchema)); }
Source:
protected void executeQueryCommand() { GlusterGeoRepDao geoRepDb = getGeoRepDao(); Guid sessionId = getParameters().getId(); GlusterGeoRepSession session = geoRepDb.getById(sessionId); GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(session.getMasterVolumeId()); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterVolumeGeoRepConfigList, new GlusterVolumeGeoRepSessionVDSParameters(getUpServerId(masterVolume.getClusterId()), sessionId, masterVolume.getName())); getQueryReturnValue().setReturnValue((List<GlusterGeoRepSessionConfiguration>)returnValue.getReturnValue()); }

Target:
protected void executeQueryCommand() { getQueryReturnValue().setReturnValue(getGeoRepDao().getGeoRepSessionConfig(getParameters().getId())); }
Source:
public void testReferenceCounting() { int positionCount = 5; Slice[] baseValues = createExpectedUniqueValues(positionCount); Slice[] identicalValues = createExpectedUniqueValues(positionCount); Slice[] realValues = new Slice[positionCount * 3]; long sliceContentBytes = 0; for (int i = 0; i < positionCount; i++) { realValues[i] = baseValues[i]; realValues[positionCount + i] = baseValues[i]; realValues[positionCount * 2 + i] = identicalValues[i]; sliceContentBytes += i; } long expectedRetainedBytes = ClassLayout.parseClass(SliceArrayBlock.class).instanceSize() + ClassLayout.parseClass(Slice.class).instanceSize() * positionCount * 3 + sizeOf(realValues) + sliceContentBytes * 2; SliceArrayBlock block = new SliceArrayBlock(positionCount * 3, realValues, false); assertEquals(block.getRetainedSizeInBytes(), expectedRetainedBytes); }

Target:
public void testReferenceCounting() { int positionCount = 5; Slice[] baseSlices = createExpectedUniqueValues(positionCount); Slice[] baseSlicesCopy = createExpectedUniqueValues(positionCount); Slice[] testSlices = new Slice[positionCount * 3]; long testSlicesSizeInBytes = 0; for (int i = 0; i < positionCount; i++) { testSlices[i] = baseSlices[i]; testSlices[positionCount + i] = baseSlices[i]; testSlices[positionCount * 2 + i] = baseSlicesCopy[i]; testSlicesSizeInBytes += i; } long expectedRetainedSizeInBytes = ClassLayout.parseClass(SliceArrayBlock.class).instanceSize() + ClassLayout.parseClass(Slice.class).instanceSize() * (testSlices.length - 3) + sizeOf(testSlices) + testSlicesSizeInBytes * 2; SliceArrayBlock block = new SliceArrayBlock(testSlices.length, testSlices, false); assertEquals(block.getRetainedSizeInBytes(), expectedRetainedSizeInBytes); }
Source:
public void setup() throws IOException { Path filePath = Paths.get(this.getClass().getClassLoader().getResource("large_polygon.txt").getPath()); List<String> lines = Files.lines(filePath).collect(Collectors.toList()); String line = lines.get(0); String[] parts = line.split("\\|"); String wkt = parts[0]; geometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice(wkt)); envelope = GeoFunctions.stEnvelope(geometry); zoomLevel = Integer.parseInt(parts[1]); }

Target:
public void setup() throws IOException { Path filePath = Paths.get(this.getClass().getClassLoader().getResource("large_polygon.txt").getPath()); List<String> lines = Files.readAllLines(filePath); String line = lines.get(0); String[] parts = line.split("\\|"); String wkt = parts[0]; geometry = GeoFunctions.stGeometryFromText(Slices.utf8Slice(wkt)); envelope = GeoFunctions.stEnvelope(geometry); zoomLevel = Integer.parseInt(parts[1]); }
Source:
public static String getPLD(String hostname) { if (hostname.startsWith("[") && hostname.endsWith("]")) { return hostname; } if (IPV4_ADDRESS_PATTERN.matcher(hostname).matches()) { return hostname; } String result = EffectiveTldFinder.getAssignedDomain(hostname, true); if (result == null) { LOGGER.debug(String.format("Hostname %s isn't a valid FQDN", hostname)); return hostname; } else { return result; } }

Target:
public static String getPLD(String hostname) { if (hostname.startsWith("[") && hostname.endsWith("]")) { return hostname; } if (IPV4_ADDRESS_PATTERN.matcher(hostname).matches()) { return hostname; } String result = EffectiveTldFinder.getAssignedDomain(hostname, true); if (result == null) { LOGGER.debug("Hostname isn't a valid FQDN", hostname); return hostname; } else { return result; } }
Source:
void throwExceptionIfError() { if (this.isError()) { throw logger.logExceptionAsError(new TextAnalyticsException( String.format("Error in accessing the property on document id: %s, when %s returned with an error: %s", this.id, this.getClass().getSimpleName(), this.error.getMessage()), this.error.getCode().toString(), null)); } }

Target:
void throwExceptionIfError() { if (this.isError()) { throw logger.logExceptionAsError(new TextAnalyticsException( String.format(Locale.ROOT, "Error in accessing the property on document id: %s, when %s returned with an error: %s", this.id, this.getClass().getSimpleName(), this.error.getMessage()), this.error.getCode().toString(), null)); } }
Source:
public void store(final Configuration configuration) { try { Resource configurationResource = getConfigurationResource(); if (!configurationResource.isFile()) { LOGGER.warn(String.format("Skip configuration resource store [%s]", configurationResource)); return; } parser.store(configuration, configurationResource.getFile()); } catch (JAXBException | IOException e) { throw new ConfigurationSaveException(e); } }

Target:
public void store(final Configuration configuration) { try { parser.store(configuration, getConfigurationResource()); } catch (JAXBException | IOException e) { throw new ConfigurationSaveException(e); } }
Source:
public void writeResult(Object result) throws IOException { if (result instanceof String || result instanceof Number || result instanceof Boolean) { writeString(String.valueOf(result)); } else if (result instanceof Date) { Date timeStamp = (Date) result; DateFormat df = new SimpleDateFormat("YYYY/MM/DD hh:mm:ss"); writeResult(df.format(timeStamp)); } else if (result instanceof ComplexAttribute) { ComplexAttribute attr = (ComplexAttribute) result; writeResult(attr.getValue()); } else if (result instanceof Attribute) { Attribute attr = (Attribute) result; writeResult(attr.getValue()); } else if (result instanceof List) { List list = (List) result; if (list.size() == 1) { writeResult(list.get(0)); } else { writeStartArray(); for (int i = 0; i < list.size(); i++) { writeResult(list.get(i)); } writeEndArray(); } } else { writeNull(); } }

Target:
public void writeResult(Object result) throws IOException { if (result instanceof String || result instanceof Number || result instanceof Boolean) { writeString(String.valueOf(result)); } else if (result instanceof Date) { Date timeStamp = (Date) result; DateFormat df = new SimpleDateFormat("YYYY/MM/DD hh:mm:ss"); writeResult(df.format(timeStamp)); } else if (result instanceof ComplexAttribute) { ComplexAttribute attr = (ComplexAttribute) result; writeResult(attr.getValue()); } else if (result instanceof Attribute) { Attribute attr = (Attribute) result; writeResult(attr.getValue()); } else if (result instanceof List) { List list = (List) result; if (list.size() == 1) { writeResult(list.get(0)); } else { writeStartArray(); for (int i = 0; i < list.size(); i++) { writeResult(list.get(i)); } writeEndArray(); } } else if (result == null) { writeNull(); } else { throw new RuntimeException( "We can't handle the provided object o type '" + result.getClass() + "'."); } }
Source:
public LineString toLineString(boolean includeElevation) { return toLineString(new GeometryFactory(), includeElevation); }

Target:
public LineString toLineString(boolean includeElevation) { Coordinate[] coordinates = new Coordinate[getSize() == 1 ? 2 : getSize()]; for (int i = 0; i < getSize(); i++) { coordinates[i] = includeElevation ? new Coordinate( round6(getLongitude(i)), round6(getLatitude(i)), round2(getElevation(i))) : new Coordinate( round6(getLongitude(i)), round6(getLatitude(i))); } if (getSize() == 1) coordinates[1] = coordinates[0]; return factory.createLineString(new PackedCoordinateSequence.Double(coordinates, includeElevation ? 3 : 2)); }
Source:
PacketStream(Protocol protocol, int id, ProtocolEndpointPair endpointPair) { fProtocol = protocol; fId = id; fEndpointPair = endpointPair; fNbPacketsAtoB = 0; fNbPacketsBtoA = 0; fNbBytesAtoB = 0; fNbBytesBtoA = 0; fStartTime = -1; fStopTime = -1; }

Target:
PacketStream(Protocol protocol, int id, ProtocolEndpointPair endpointPair) { fProtocol = protocol; fId = id; fEndpointPair = endpointPair; fNbPacketsAtoB = 0; fNbPacketsBtoA = 0; fNbBytesAtoB = 0; fNbBytesBtoA = 0; fStartTime = Long.MAX_VALUE; fEndTime = Long.MIN_VALUE; }
Source:
public void handle(final DolphinRemotingException e) { LOG.info(" Error in remoting layer: ", e); }

Target:
public void handle(final DolphinRemotingException e) { LOG.error(" Error in remoting layer: ", e); }
Source:
public void testNonRefAllele() { Assert.assertTrue(NonRef.isNonRefAllele()); Assert.assertTrue(UnspecifiedAlternate.isNonRefAllele()); Assert.assertFalse(T.isNonRefAllele()); Assert.assertFalse(ATIns.isNonRefAllele()); Assert.assertTrue(Allele.NON_REF_ALLELE.isNonRefAllele()); Assert.assertTrue(Allele.UNSPECIFIED_ALTERNATE_ALLELE.isNonRefAllele()); Allele a = Allele.create("<*>"); Assert.assertTrue(a.isNonRefAllele()); }

Target:
public void testNonRefAllele() { Assert.assertTrue(NonRef.isNonRefAllele()); Assert.assertTrue(UnspecifiedAlternate.isNonRefAllele()); Assert.assertFalse(T.isNonRefAllele()); Assert.assertFalse(ATIns.isNonRefAllele()); Assert.assertTrue(Allele.NON_REF_ALLELE.isNonRefAllele()); Assert.assertTrue(Allele.UNSPECIFIED_ALTERNATE_ALLELE.isNonRefAllele()); Allele a = Allele.create(new String("<*>")); Assert.assertTrue(a.isNonRefAllele()); }
Source:
public void basicInvocation(Runnable call) throws Exception { DistributedExecutorService des = createDES(getCache()); des.submit(call); }

Target:
public void basicInvocation(Runnable call) throws Exception { DistributedExecutorService des = createDES(getCache()); des.submit(call).get(); }
Source:
protected Response doAction(final VdcActionType task, final VdcActionParametersBase params, final Action action, AbstractBackendResource.PollingType pollingType) { awaitGrace(action); try { VdcReturnValueBase actionResult = doAction(task, params); if (actionResult.getJobId() != null) { setJobLink(action, actionResult); } if (actionResult.getHasAsyncTasks() || actionResult.getJobId() != null) { if (expectBlocking(action)) { CreationStatus status = awaitCompletion(actionResult, pollingType); return actionStatus(status, action, addLinks(newModel(id))); } else { return actionAsync(actionResult, action); } } else { return actionSuccess(action, addLinks(newModel(id))); } } catch (Exception e) { return handleError(e, action); } }

Target:
protected Response doAction(final VdcActionType task, final VdcActionParametersBase params, final Action action, AbstractBackendResource.PollingType pollingType) { awaitGrace(action); try { VdcReturnValueBase actionResult = doAction(task, params); if (actionResult.getJobId() != null) { setJobLink(action, actionResult); } if (actionResult.getHasAsyncTasks()) { if (expectBlocking(action)) { CreationStatus status = awaitCompletion(actionResult, pollingType); return actionStatus(status, action, addLinks(newModel(id))); } else { return actionAsync(actionResult, action); } } else { return actionSuccess(action, addLinks(newModel(id))); } } catch (Exception e) { return handleError(e, action); } }
Source:
public void setChainingStrategy(ChainingStrategy strategy) { chainingStrategy = strategy; }

Target:
public void setChainingStrategy(ChainingStrategy strategy) { chainingStrategy = checkNotNull(strategy); }
Source:
public String getVersion(){ return group.getSelectedVersionGroup().getVersion(); }

Target:
public IHTMLLibraryVersion getVersion(){ return group.getSelectedVersionGroup().getVersion(); }
Source:
private static void handleAPIError(String rBody, int rCode, String requestId) throws InvalidRequestException, AuthenticationException, CardException, APIException { LiveStripeResponseGetter.Error error = APIResource.GSON.fromJson(rBody, LiveStripeResponseGetter.ErrorContainer.class).error; switch (rCode) { case 400: throw new InvalidRequestException(error.message, requestId, error.param, null); case 404: throw new InvalidRequestException(error.message, requestId, error.param, null); case 401: throw new AuthenticationException(error.message); case 402: throw new CardException(error.message, requestId, error.code, error.param, error.decline_code, error.charge, null); default: throw new APIException(error.message, null); } }

Target:
private static void handleAPIError(String rBody, int rCode, String requestId) throws InvalidRequestException, AuthenticationException, CardException, APIException { LiveStripeResponseGetter.Error error = APIResource.GSON.fromJson(rBody, LiveStripeResponseGetter.ErrorContainer.class).error; switch (rCode) { case 400: throw new InvalidRequestException(error.message, requestId, error.param, null); case 404: throw new InvalidRequestException(error.message, requestId, error.param, null); case 401: throw new AuthenticationException(error.message, requestId); case 402: throw new CardException(error.message, requestId, error.code, error.param, error.decline_code, error.charge, null); default: throw new APIException(error.message, requestId, null); } }
Source:
private Response getStat(BaseDataAccessor<byte[]> zkBaseDataAccessor, String path) { if (zkBaseDataAccessor.exists(path, AccessOption.PERSISTENT)) { Stat stat = zkBaseDataAccessor.getStat(path, AccessOption.PERSISTENT); Map<String, String> result = ZKUtil.fromStatToMap(stat); result.put("path", path); return JSONRepresentation(result); } else { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity(String.format("The ZNode at path %s does not exist!", path)).build()); } }

Target:
private Response getStat(BaseDataAccessor<byte[]> zkBaseDataAccessor, String path) { Stat stat = zkBaseDataAccessor.getStat(path, AccessOption.PERSISTENT); if (stat == null) { throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND) .entity(String.format("The ZNode at path %s does not exist!", path)).build()); } Map<String, String> result = ZKUtil.fromStatToMap(stat); result.put("path", path); return JSONRepresentation(result); }
Source:
private static final Element parseXML(InputStream input, Optional<String> encoding) throws SAXException, IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder documentBuilder; try { documentBuilder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { String message = e.getMessage(); throw new RuntimeException(message != null ? message : e.getClass().getSimpleName(), e); } InputSource source = new InputSource(input); encoding.ifPresent((value) -> { source.setEncoding(value); }); return documentBuilder.parse(source).getDocumentElement(); } finally { input.close(); } }

Target:
private static final Element parseXML(InputStream input, Optional<String> encoding) throws SAXException, IOException { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); InputSource source = new InputSource(input); encoding.ifPresent(value -> source.setEncoding(value)); return factory.newDocumentBuilder().parse(source).getDocumentElement(); } catch (ParserConfigurationException e) { throw new IllegalStateException(e.getMessage(), e); } }
Source:
public HashMap<ItemIdentifier, Integer> getItemsAndCount() { return getItemsAndCount(false); }

Target:
public Map<ItemIdentifier, Integer> getItemsAndCount() { return getItemsAndCount(false); }
Source:
EvalResult evaluate(LDUser user, FeatureStore featureStore) throws EvaluationError { if (user == null || user.getKey() == null) { throw new EvaluationError("User or user key is null"); } List<FeatureRequestEvent> prereqEvents = new ArrayList<>(); JsonElement value = evaluate(user, featureStore, prereqEvents); return new EvalResult(value, prereqEvents); }

Target:
EvalResult evaluate(LDUser user, FeatureStore featureStore) throws EvaluationException { if (user == null || user.getKey() == null) { throw new EvaluationException("User or user key is null"); } List<FeatureRequestEvent> prereqEvents = new ArrayList<>(); JsonElement value = evaluate(user, featureStore, prereqEvents); return new EvalResult(value, prereqEvents); }
Source:
public void init() throws Exception { final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, topicRepository, partitionResolver, enrichment, uuid, featureToggleService); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, new DefaultApplicationService()); Mockito.doReturn(randomUUID).when(uuid).randomUUID(); final MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper); doReturn(SecuritySettings.AuthMode.OFF).when(settings).getAuthMode(); doReturn("nakadi").when(settings).getAdminClientId(); doReturn(false).when(featureToggleService).isFeatureEnabled(any()); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), jackson2HttpMessageConverter) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .build(); }

Target:
public void init() throws Exception { final EventTypeService eventTypeService = new EventTypeService(eventTypeRepository, topicRepository, partitionResolver, enrichment, uuid, featureToggleService); final EventTypeOptionsValidator eventTypeOptionsValidator = new EventTypeOptionsValidator(TOPIC_RETENTION_MIN_MS, TOPIC_RETENTION_MAX_MS); final NakadiSettings nakadiSettings = new NakadiSettings(0, 0, 0, TOPIC_RETENTION_TIME_MS, 0); final EventTypeController controller = new EventTypeController(eventTypeService, featureToggleService, eventTypeOptionsValidator, applicationService, nakadiSettings); Mockito.doReturn(randomUUID).when(uuid).randomUUID(); final MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper); doReturn(true).when(applicationService).exists(any()); doReturn(SecuritySettings.AuthMode.OFF).when(settings).getAuthMode(); doReturn("nakadi").when(settings).getAdminClientId(); doReturn(false).when(featureToggleService).isFeatureEnabled(any()); doReturn(true).when(featureToggleService).isFeatureEnabled(CHECK_PARTITIONS_KEYS); mockMvc = standaloneSetup(controller) .setMessageConverters(new StringHttpMessageConverter(), jackson2HttpMessageConverter) .setCustomArgumentResolvers(new ClientResolver(settings, featureToggleService)) .build(); }
Source:
private Optional<InputWithData<IndexedInputGate, BufferOrEvent>> waitAndGetNextData(boolean blocking) throws IOException, InterruptedException { while (true) { Optional<IndexedInputGate> inputGateOpt = getInputGate(blocking); if (!inputGateOpt.isPresent()) { return Optional.empty(); } final IndexedInputGate inputGate = inputGateOpt.get(); Optional<BufferOrEvent> nextOpt = inputGate.pollNext(); if (!nextOpt.isPresent()) { inputGate.getAvailableFuture().thenRun(() -> queueInputGate(inputGate, false)); continue; } final BufferOrEvent bufferOrEvent = nextOpt.get(); synchronized (inputGatesWithData) { if (bufferOrEvent.moreAvailable()) { if (bufferOrEvent.morePriorityEvents()) { inputGatesWithData.addPriorityElement(inputGate); } else { inputGatesWithData.add(inputGate); } } else if (!inputGate.isFinished()) { inputGate.getAvailableFuture().thenRun(() -> queueInputGate(inputGate, false)); } if (bufferOrEvent.hasPriority() && !bufferOrEvent.morePriorityEvents()) { inputGate.getPriorityEventAvailableFuture().thenRun(() -> handlePriorityEventAvailable(inputGate)); } final boolean morePriorityEvents = inputGatesWithData.getNumPriorityElements() > 0; if (bufferOrEvent.hasPriority() && !morePriorityEvents) { priorityAvailabilityHelper.resetUnavailable(); } return Optional.of(new InputWithData<>( inputGate, bufferOrEvent, !inputGatesWithData.isEmpty(), morePriorityEvents)); } } }

Target:
private Optional<InputWithData<IndexedInputGate, BufferOrEvent>> waitAndGetNextData(boolean blocking) throws IOException, InterruptedException { while (true) { synchronized (inputGatesWithData) { Optional<IndexedInputGate> inputGateOpt = getInputGate(blocking); if (!inputGateOpt.isPresent()) { return Optional.empty(); } final IndexedInputGate inputGate = inputGateOpt.get(); Optional<BufferOrEvent> nextOpt = inputGate.pollNext(); if (!nextOpt.isPresent()) { inputGate.getAvailableFuture().thenRun(() -> queueInputGate(inputGate, false)); continue; } return Optional.of(processBufferOrEvent(inputGate, nextOpt.get())); } } }
Source:
private void createHandleForDateWithDropDown () { containerHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 0); if (containerHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, containerHandle); textEntryHandle = OS.gtk_entry_new (); if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (containerHandle, textEntryHandle); OS.gtk_widget_show (containerHandle); OS.gtk_widget_show (textEntryHandle); handle = containerHandle; if (handle == 0) error (SWT.ERROR_NO_HANDLES); if (OS.GTK_VERSION < OS.VERSION(3, 21, 0)) { setFontDescription(defaultFont().handle); } }

Target:
private void createHandleForDateWithDropDown () { containerHandle = gtk_box_new (OS.GTK_ORIENTATION_HORIZONTAL, false, 0); if (containerHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, containerHandle); textEntryHandle = OS.gtk_entry_new (); if (textEntryHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (containerHandle, textEntryHandle); OS.gtk_widget_show (containerHandle); OS.gtk_widget_show (textEntryHandle); handle = containerHandle; if (handle == 0) error (SWT.ERROR_NO_HANDLES); if (OS.GTK_VERSION < OS.VERSION(3, 22, 0)) { setFontDescription(defaultFont().handle); } }
Source:
private String getFromLine() { velocityContext.put("from", args.accountCache.get(fromId).getAccount()); return velocify("#if ($from.fullName || $from.preferredEmail)From"+ "#if ($from.fullName) $from.fullName#endif" + "#if ($from.preferredEmail) <$from.preferredEmail>#endif" + ":\n\n#endif"); }

Target:
protected String getFromLine() { final Account account = args.accountCache.get(fromId).getAccount(); final String name = account.getFullName(); final String email = account.getPreferredEmail(); StringBuilder f = new StringBuilder(); if ((name != null && !name.isEmpty()) || (email != null && !email.isEmpty())) { f.append("From"); if (name != null && !name.isEmpty()) { f.append(" ").append(name); } if (email != null && !email.isEmpty()) { f.append(" <").append(email).append(">"); } f.append(":\n\n"); } return f.toString(); }
Source:
public void onComplete(T result) { if (result != null) { CacheKey cacheKey = new CacheKey(); cacheKey.setBuildAction(this.buildAction); this.cache.put(cacheKey, result); } this.delegate.onComplete(result); }

Target:
public void onComplete(T result) { if (result != null) { this.cache.put(CacheKey.builder().setBuildAction(this.buildAction).build(), result); } this.delegate.onComplete(result); }
Source:
protected SimpleResult compareMetricValues(final Object value1, final Object value2, final String metricName) { boolean equal = true; String description = ""; if (value1 == null || value2 == null) { if (value1 != null || value2 != null) { equal = false; description = "One of the values is null"; } } else { if (value1 instanceof Number) { double numValue1 = ((Number) value1).doubleValue(); double numValue2 = ((Number) value2).doubleValue(); double relativeChange = (numValue1 == 0 && numValue2 == 0) ? 0 : (numValue1 == 0) ? Double.MAX_VALUE : (numValue1 - numValue2) / numValue2; if (relativeChange != 0) { if (MetricToAllowableRelativeChange.containsKey(metricName)) { double allowableRelativeChange = MetricToAllowableRelativeChange.get(metricName); if (abs(relativeChange) >= allowableRelativeChange) { equal = false; description = "Changed by " + RELATIVE_CHANGE_DECIMAL_FORMAT.format(relativeChange) + " which is outside of the allowable tolerance of " + RELATIVE_CHANGE_DECIMAL_FORMAT.format(allowableRelativeChange); } else { equal = true; description = "Changed by " + RELATIVE_CHANGE_DECIMAL_FORMAT.format(relativeChange) + " which is within the allowable tolerance of " + RELATIVE_CHANGE_DECIMAL_FORMAT.format(allowableRelativeChange); } } else { equal = false; description = "Changed by " + RELATIVE_CHANGE_DECIMAL_FORMAT.format(relativeChange); } } } else { if (!value1.equals(value2)) { equal = false; description = "Different Values"; } } } return new SimpleResult(equal, description); }

Target:
protected SimpleResult compareMetricValues(final Object value1, final Object value2, final String metricName) { boolean equal = true; String description = ""; if (value1 == null || value2 == null) { if (value1 != null || value2 != null) { equal = false; description = "One of the values is null"; } } else { if (value1 instanceof Number) { double numValue1 = ((Number) value1).doubleValue(); double numValue2 = ((Number) value2).doubleValue(); double relativeChange = (numValue1 == 0 && numValue2 == 0) ? 0 : (numValue1 == 0) ? Double.MAX_VALUE : (numValue1 - numValue2) / numValue2; if (relativeChange != 0) { if (MetricToAllowableRelativeChange.containsKey(metricName)) { double allowableRelativeChange = MetricToAllowableRelativeChange.get(metricName); if (Math.abs(relativeChange) >= allowableRelativeChange) { equal = false; description = "Changed by " + relativeChange + " which is outside of the allowable tolerance of " + allowableRelativeChange; } else { equal = true; description = "Changed by " + relativeChange + " which is within the allowable tolerance of " + allowableRelativeChange; } } else { equal = false; description = "Changed by " + relativeChange; } } } else { if (!value1.equals(value2)) { equal = false; description = ""; } } } return new SimpleResult(equal, description); }
Source:
public void run() { taskExecutor.execute(new Runnable() { public void run() { int count = 0; while (initialized && (maxMessagesPerPoll <= 0 || count < maxMessagesPerPoll)) { try { if (!pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { throw new MessageHandlingException(new ErrorMessage(e), null); } } } } }); }

Target:
public void run() { taskExecutor.execute(new Runnable() { public void run() { int count = 0; while (initialized && (maxMessagesPerPoll <= 0 || count < maxMessagesPerPoll)) { try { if (!pollingTask.call()) { break; } count++; } catch (Exception e) { if (e instanceof RuntimeException) { throw (RuntimeException) e; } else { throw new MessageHandlingException(new ErrorMessage(e), AbstractPollingEndpoint.this.getComponentName() + " failed to invoke pollingTask.", e); } } } } }); }
Source:
private void insertValues(final String key, final String val, final String updateTs) throws InterruptedException { final CountDownLatch committed = new CountDownLatch(1); Assert.assertNull( dbi.withHandle( new HandleCallback<Void>() { @Override public Void withHandle(Handle handle) throws Exception { try { final String query; if (tsColumn == null) { handle.createStatement( String.format("DELETE FROM %s WHERE %s='%s'", tableName, keyName, key) ).execute(); handle.commit(); query = String.format( "INSERT INTO %s (%s, %s) VALUES ('%s', '%s')", tableName, keyName, valName, key, val ); } else { query = String.format( "INSERT INTO %s (%s, %s, %s) VALUES ('%s', '%s', '%s')", tableName, tsColumn, keyName, valName, updateTs, key, val ); } if (1 != handle.createStatement(query).execute()) { throw new ISE("Did not return the correct number of rows"); } handle.commit(); return null; } finally { committed.countDown(); } } } ) ); committed.await(10, TimeUnit.SECONDS); Thread.sleep(2); }

Target:
private void insertValues(final String key, final String val, final String updateTs) throws InterruptedException { final String query; if (tsColumn == null) { handle.createStatement( String.format("DELETE FROM %s WHERE %s='%s'", tableName, keyName, key) ).setQueryTimeout(1).execute(); query = String.format( "INSERT INTO %s (%s, %s) VALUES ('%s', '%s')", tableName, keyName, valName, key, val ); } else { query = String.format( "INSERT INTO %s (%s, %s, %s) VALUES ('%s', '%s', '%s')", tableName, tsColumn, keyName, valName, updateTs, key, val ); } Assert.assertEquals(1, handle.createStatement(query).setQueryTimeout(1).execute()); handle.commit(); Thread.sleep(2); }
Source:
public void getExistedObjectExecuteAsBlocking() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); TestItem testItem = storIOContentResolver .get() .object(TestItem.class) .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .where(TestItem.COLUMN_VALUE + "=?") .whereArgs("value") .build()) .prepare() .executeAsBlocking(); assertThat(testItem).isNotNull(); assertThat(testItemToInsert.equalsWithoutId(testItem)).isTrue(); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }

Target:
public void getExistedObjectExecuteAsBlocking() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); contentResolver.insert(TestItem.CONTENT_URI, TestItem.create(null, "value1").toContentValues()); contentResolver.insert(TestItem.CONTENT_URI, TestItem.create(null, "value2").toContentValues()); TestItem testItem = storIOContentResolver .get() .object(TestItem.class) .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .where(TestItem.COLUMN_VALUE + "=?") .whereArgs("value") .build()) .prepare() .executeAsBlocking(); assertThat(testItem).isNotNull(); assertThat(testItemToInsert.equalsWithoutId(testItem)).isTrue(); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }
Source:
static int lineNumber(CommentNode node, int offset) { int lineNumber = node.getStartLinePosition(); String contentBeforeTodo = node.getCode().substring(0, offset); for (int i = 0; i < contentBeforeTodo.length(); i++) { if (contentBeforeTodo.charAt(i) == '\n') { lineNumber++; } } return lineNumber; }

Target:
static int lineNumber(CommentNode node, int offset) { String content = node.getCode(); if (offset < 0 || offset > content.length()) { throw new IllegalArgumentException("Out of range offset: " + offset + " for comment content (size: " + content.length() + ")"); } int lineFeedCountBeforeOffset = (int) content.substring(0, offset).chars().filter(c -> c == '\n').count(); return node.getStartLinePosition() + lineFeedCountBeforeOffset; }
Source:
private void checkImageTarget() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE) { for (DiskImage image : getVm().getImages()) { StorageDomain domain = storageDomainDao.get(getStorageDomainId()); if (domain.getStorageType().isBlockDomain()) { image.setActualSizeInBytes(image.getSize()); } } } }

Target:
private void checkImageTarget() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE) { StorageDomain domain = storageDomainDao.get(getStorageDomainId()); for (DiskImage image : getVm().getImages()) { if (domain.getStorageType().isBlockDomain()) { image.setActualSizeInBytes(image.getSize()); } } } }
Source:
public void openFileWithApplication(String filePath, String application) throws IOException { String[] openWith; if ((application != null) && !application.isEmpty()) { openWith = application.split(" "); } else { openWith = new String[] {"xdg-open"}; } String[] cmdArray = new String[openWith.length + 1]; System.arraycopy(openWith, 0, cmdArray, 0, openWith.length); cmdArray[cmdArray.length - 1] = filePath; Process process = Runtime.getRuntime().exec(cmdArray); StreamGobbler streamGobblerInput = new StreamGobbler(process.getInputStream(), LOGGER::debug); StreamGobbler streamGobblerError = new StreamGobbler(process.getErrorStream(), LOGGER::debug); JabRefExecutorService.INSTANCE.execute(streamGobblerInput); JabRefExecutorService.INSTANCE.execute(streamGobblerError); }

Target:
public void openFileWithApplication(String filePath, String application) throws IOException { String[] openWith; if ((application != null) && !application.isEmpty()) { openWith = application.split(" "); } else { openWith = new String[] {"xdg-open"}; } String[] cmdArray = new String[openWith.length + 1]; System.arraycopy(openWith, 0, cmdArray, 0, openWith.length); cmdArray[cmdArray.length - 1] = filePath; ProcessBuilder processBuilder = new ProcessBuilder(cmdArray); Process process = processBuilder.start(); StreamGobbler streamGobblerInput = new StreamGobbler(process.getInputStream(), LOGGER::debug); StreamGobbler streamGobblerError = new StreamGobbler(process.getErrorStream(), LOGGER::debug); JabRefExecutorService.INSTANCE.execute(streamGobblerInput); JabRefExecutorService.INSTANCE.execute(streamGobblerError); }
Source:
private void checkIsPrimaryKey(String fieldName) { RealmObjectSchema objectSchema = proxyState.getRealm$realm().getSchema().getSchemaForClass(getType()); if (objectSchema.hasPrimaryKey() && objectSchema.getPrimaryKey().equals(fieldName)) { throw new RealmException(String.format("Primary key field '%s' cannot be changed after object created." , fieldName)); } }

Target:
private void checkIsPrimaryKey(String fieldName) { RealmObjectSchema objectSchema = proxyState.getRealm$realm().getSchema().getSchemaForClass(getType()); if (objectSchema.hasPrimaryKey() && objectSchema.getPrimaryKey().equals(fieldName)) { throw new IllegalArgumentException(String.format( "Primary key field '%s' cannot be changed after object was created.", fieldName)); } }
Source:
public final <E> void assertSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>... consumers) { assertNotNull(info, actual); requireNonNull(consumers, "The Consumer<? super E>... expressing the assertions consumers must not be null"); requireNonNull(consumers[0], "The Consumer<? super E>... expressing the assertions consumers must not be null"); List<E>[] stasfiedElementsLists = new ArrayList[consumers.length]; for (int i = 0; i < consumers.length; i++) { Consumer<? super E> consumer = consumers[i]; stasfiedElementsLists[i] = stream(actual).filter(element -> { try { consumer.accept(element); } catch (AssertionError ex) { return false; } return true; }).collect(toList()); } if (!isSatisfied(stasfiedElementsLists, 0)) throw failures.failure(info, shouldSatisfy(actual)); }

Target:
public final <E> void assertSatisfy(AssertionInfo info, Iterable<? extends E> actual, Consumer<? super E>... consumers) { assertNotNull(info, actual); requireNonNull(consumers, "The Consumer<? super E>... expressing the assertions consumers must not be null"); for (Consumer<? super E> consumer : consumers) requireNonNull(consumer, "The element in consumers must not be null"); List<E>[] satisfiedElementsLists = stream(consumers) .map(listFilteredBySatisfiedElements(actual)) .<List<E>> toArray(List[]::new); if (!isSatisfied(satisfiedElementsLists, 0)) throw failures.failure(info, shouldSatisfy(actual)); }
Source:
public boolean isEnabled() { return Boolean.parseBoolean( userProperties.getProperty( NEXUS_STAGING_MAVEN_PLUGIN_REMOVAL_PROPERTY, Boolean.TRUE.toString() ) ); }

Target:
public boolean isEnabled() { return enabled; }
Source:
public void createPackage(Path originFolderPath, Path destinationPath) throws ArchiverException, IOException { checkArgument(originFolderPath != null, "The origin path must not be null"); checkArgument(originFolderPath.toFile().exists(), "The origin path must exists"); Path metaInfPath = originFolderPath.resolve(META_INF.value()); this.withDomain(originFolderPath.resolve(DOMAIN.value()).toFile()) .withApplications(originFolderPath.resolve(APPLICATIONS.value()).toFile()) .withMaven(metaInfPath.resolve(MAVEN.value()).toFile()); this.createArchive(destinationPath); }

Target:
public void createPackage(Path originFolderPath, Path destinationPath) throws ArchiverException, IOException { checkArgument(originFolderPath != null, "The origin path must not be null"); checkArgument(originFolderPath.toFile().exists(), "The origin path must exist"); Path metaInfPath = originFolderPath.resolve(META_INF.value()); this.withDomain(originFolderPath.resolve(DOMAIN.value()).toFile()) .withApplications(originFolderPath.resolve(APPLICATIONS.value()).toFile()) .withMaven(metaInfPath.resolve(MAVEN.value()).toFile()); this.createArchive(destinationPath); }