You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by ajs6f <gi...@git.apache.org> on 2016/12/23 20:43:52 UTC

[GitHub] jena pull request #199: Use some library functions

GitHub user ajs6f opened a pull request:

    https://github.com/apache/jena/pull/199

    Use some library functions

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ajs6f/jena UseSomeLibraryFunctions

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/jena/pull/199.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #199
    
----
commit d753a3e0a0d517d89a876ffb90b29aa86bc1798b
Author: ajs6f <aj...@virginia.edu>
Date:   2016-12-21T22:48:09Z

    Using some library functions for strings and suggesting others

commit 2f9759eb8ea37e6e9ac48b619f90cc65bbfe31b8
Author: ajs6f <aj...@virginia.edu>
Date:   2016-12-23T20:10:39Z

    Replacing only use of Ref with AtomicBoolean

commit d48f2d9ad0a7867f584616f09d7af877f508f687
Author: ajs6f <aj...@virginia.edu>
Date:   2016-12-23T20:37:55Z

    Removed totally unused class RefLong

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/jena/pull/199


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/199#discussion_r93801583
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java ---
    @@ -33,32 +35,34 @@ private StrUtils() {}
         
         /** strjoin with a newline as the separator */
         public static String strjoinNL(String... args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
         /** strjoin with a newline as the separator */
         public static String strjoinNL(List<String> args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
    -    /** Concatentate strings, using a separator */
    +    /** 
    +     * Concatentate strings, using a separator
    +     * 
    +     * @deprecated Prefer String.join(sep, args)
    +     */
    +    @Deprecated
         public static String strjoin(String sep, String... args) {
    -        return join(sep, args);
    +        return String.join(sep, args);
         }
     
    -    /** Concatentate strings, using a separator */
    +    /**
    +     * Concatentate strings, using a separator
    +     * 
    +     * @deprecated Prefer String.join(sep, args)
    +     */
    +    @Deprecated
    --- End diff --
    
    Ditto.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    @afs , yep there's another commit coming getting rid of those warnings. Just an oversight on my part, sorry.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Also will send a further commit getting rid of calls to now-deprecated functions.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Just replacing some homegrown stuff with library functions that came out since, and pruning two classes, one for which an equivalent is now available in library code, and the other wasn't used at all and never has been AFAICT.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Commits are orthogonal. I'll wait until the top of the week in case anyone has any comments/objections.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    I'll wait for any further comment until Tuesday.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on a diff in the pull request:

    https://github.com/apache/jena/pull/199#discussion_r93801809
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java ---
    @@ -85,17 +89,20 @@ public static int strCompareIgnoreCase(String s1, String s2) {
         }
     
         public static byte[] asUTF8bytes(String s) {
    -        try { return s.getBytes("UTF-8") ; }
    -        catch (UnsupportedEncodingException ex)
    -        { throw new InternalErrorException("UTF-8 not supported!") ; } 
    +        return s.getBytes(UTF_8) ; 
         }
     
         public static String fromUTF8bytes(byte[] bytes) {
    -        try { return new String(bytes, "UTF-8") ; }
    -        catch (UnsupportedEncodingException ex)
    -        { throw new InternalErrorException("UTF-8 not supported!") ; } 
    +        return new String(bytes, UTF_8) ; 
         }
         
    +    /**
    +     * @param x
    +     * @return &lt;null&gt; if x == null, otherwise, x.toString()
    +     * 
    +     * @deprecated prefer {@link Objects#toString(Object, String)} with "&lt;null&gt;" or just {@link Objects#toString(Object)} 
    +     */
    +    @Deprecated
         public static String str(Object x) {
    --- End diff --
    
    all right, if that seems clearer.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Weird, Travis blew out with No Heap Space...
    
    https://api.travis-ci.org/jobs/186431648/log.txt?deansi=true


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Thanks, I got caught up with holiday stuff and forgot to merge this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena issue #199: Use some library functions

Posted by ajs6f <gi...@git.apache.org>.
Github user ajs6f commented on the issue:

    https://github.com/apache/jena/pull/199
  
    Yeah, it does a perfectly nice full build (no profile) for me. Not sure what Travis' problem is. I never even noticed that `src-examples` dir-- I'll add a commit to clean that up. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/199#discussion_r93801615
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java ---
    @@ -85,17 +89,20 @@ public static int strCompareIgnoreCase(String s1, String s2) {
         }
     
         public static byte[] asUTF8bytes(String s) {
    -        try { return s.getBytes("UTF-8") ; }
    -        catch (UnsupportedEncodingException ex)
    -        { throw new InternalErrorException("UTF-8 not supported!") ; } 
    +        return s.getBytes(UTF_8) ; 
         }
     
         public static String fromUTF8bytes(byte[] bytes) {
    -        try { return new String(bytes, "UTF-8") ; }
    -        catch (UnsupportedEncodingException ex)
    -        { throw new InternalErrorException("UTF-8 not supported!") ; } 
    +        return new String(bytes, UTF_8) ; 
         }
         
    +    /**
    +     * @param x
    +     * @return &lt;null&gt; if x == null, otherwise, x.toString()
    +     * 
    +     * @deprecated prefer {@link Objects#toString(Object, String)} with "&lt;null&gt;" or just {@link Objects#toString(Object)} 
    +     */
    +    @Deprecated
         public static String str(Object x) {
    --- End diff --
    
    I suggest we leave this, and not `@Deprecated`.  `str()` is supposed to be reminiscent of SPARQL `STR`.  `str(...)` is used elsewhere so this is a pattern.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/199#discussion_r93801320
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java ---
    @@ -33,32 +35,34 @@ private StrUtils() {}
         
         /** strjoin with a newline as the separator */
         public static String strjoinNL(String... args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
         /** strjoin with a newline as the separator */
         public static String strjoinNL(List<String> args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
    -    /** Concatentate strings, using a separator */
    +    /** 
    +     * Concatentate strings, using a separator
    +     * 
    +     * @deprecated Prefer String.join(sep, args)
    +     */
    +    @Deprecated
    --- End diff --
    
    If we are going to deprecate this, then I really would like to see the changes propagated through the codebase, not left pending.
    
    Currently, at least for me, Jena is warning free in the main modules so I can see when warnings appear. Having unfinished deprecations means that it is harder to notice warnings appearing.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] jena pull request #199: Use some library functions

Posted by afs <gi...@git.apache.org>.
Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/199#discussion_r93801569
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/StrUtils.java ---
    @@ -33,32 +35,34 @@ private StrUtils() {}
         
         /** strjoin with a newline as the separator */
         public static String strjoinNL(String... args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
         /** strjoin with a newline as the separator */
         public static String strjoinNL(List<String> args) {
    -        return join("\n", args);
    +        return String.join("\n", args);
         }
     
    -    /** Concatentate strings, using a separator */
    +    /** 
    +     * Concatentate strings, using a separator
    +     * 
    +     * @deprecated Prefer String.join(sep, args)
    --- End diff --
    
    Add to javadoc `This function will be removed - do not use.`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---